@quillsql/admin 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{lib → dist}/Admin.d.ts +12 -7
- package/dist/Admin.d.ts.map +1 -0
- package/dist/Admin.js +1384 -0
- package/{lib → dist}/AdminProvider.d.ts +41 -27
- package/dist/AdminProvider.d.ts.map +1 -0
- package/{lib → dist}/AdminProvider.js +105 -89
- package/dist/api/ConnectionClient.d.ts +27 -0
- package/dist/api/ConnectionClient.d.ts.map +1 -0
- package/dist/api/ConnectionClient.js +247 -0
- package/dist/components/Banner/index.d.ts +3 -0
- package/dist/components/Banner/index.d.ts.map +1 -0
- package/dist/components/Banner/index.js +27 -0
- package/dist/components/CardSection.d.ts +3 -0
- package/dist/components/CardSection.d.ts.map +1 -0
- package/dist/components/CardSection.js +9 -0
- package/dist/components/CardTitle.d.ts +3 -0
- package/dist/components/CardTitle.d.ts.map +1 -0
- package/dist/components/CardTitle.js +11 -0
- package/dist/components/DashboardSelectPopover.d.ts +11 -0
- package/dist/components/DashboardSelectPopover.d.ts.map +1 -0
- package/dist/components/DashboardSelectPopover.js +175 -0
- package/dist/components/DatabaseSelector.d.ts +11 -0
- package/dist/components/DatabaseSelector.d.ts.map +1 -0
- package/dist/components/DatabaseSelector.js +22 -0
- package/dist/components/DeleteButton.d.ts +3 -0
- package/dist/components/DeleteButton.d.ts.map +1 -0
- package/dist/components/DeleteButton.js +10 -0
- package/{lib → dist}/components/DropDownMenu.d.ts +1 -0
- package/dist/components/DropDownMenu.d.ts.map +1 -0
- package/dist/components/DropDownMenu.js +39 -0
- package/dist/components/DropDownMenuWithLabel.d.ts +12 -0
- package/dist/components/DropDownMenuWithLabel.d.ts.map +1 -0
- package/dist/components/DropDownMenuWithLabel.js +47 -0
- package/{lib → dist}/components/EnvSelectPopover.d.ts +1 -0
- package/dist/components/EnvSelectPopover.d.ts.map +1 -0
- package/dist/components/EnvSelectPopover.js +205 -0
- package/dist/components/InputLabel.d.ts +3 -0
- package/dist/components/InputLabel.d.ts.map +1 -0
- package/dist/components/InputLabel.js +10 -0
- package/{lib → dist}/components/OrgSelect.d.ts +1 -0
- package/dist/components/OrgSelect.d.ts.map +1 -0
- package/dist/components/OrgSelect.js +193 -0
- package/dist/components/SqlViewTile.d.ts +8 -0
- package/dist/components/SqlViewTile.d.ts.map +1 -0
- package/dist/components/SqlViewTile.js +40 -0
- package/dist/components/StepDisplay.d.ts +10 -0
- package/dist/components/StepDisplay.d.ts.map +1 -0
- package/dist/components/StepDisplay.js +15 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/forms/client_onboard/ConnectDatabase.d.ts +11 -0
- package/dist/forms/client_onboard/ConnectDatabase.d.ts.map +1 -0
- package/dist/forms/client_onboard/ConnectDatabase.js +137 -0
- package/dist/forms/client_onboard/ConnectSchema.d.ts +13 -0
- package/dist/forms/client_onboard/ConnectSchema.d.ts.map +1 -0
- package/dist/forms/client_onboard/ConnectSchema.js +171 -0
- package/dist/forms/client_onboard/CreateSqlViews.d.ts +15 -0
- package/dist/forms/client_onboard/CreateSqlViews.d.ts.map +1 -0
- package/dist/forms/client_onboard/CreateSqlViews.js +202 -0
- package/dist/hooks/useItemBeingEdited.d.ts +4 -0
- package/dist/hooks/useItemBeingEdited.d.ts.map +1 -0
- package/dist/hooks/useItemBeingEdited.js +25 -0
- package/{lib → dist}/icons/ArrowDownHeadIcon.d.ts +1 -0
- package/dist/icons/ArrowDownHeadIcon.d.ts.map +1 -0
- package/dist/icons/ArrowDownHeadIcon.js +3 -0
- package/dist/icons/XMarkIcon.d.ts +3 -0
- package/dist/icons/XMarkIcon.d.ts.map +1 -0
- package/dist/icons/XMarkIcon.js +11 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.d.ts.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/{lib/index.d.ts → dist/index.js} +1 -0
- package/{lib → dist}/modals/EditDashboardsModal.d.ts +1 -0
- package/dist/modals/EditDashboardsModal.d.ts.map +1 -0
- package/dist/modals/EditDashboardsModal.js +91 -0
- package/dist/modals/NewDashboardModal.d.ts +19 -0
- package/dist/modals/NewDashboardModal.d.ts.map +1 -0
- package/dist/modals/NewDashboardModal.js +276 -0
- package/{lib → dist}/modals/PromoteDashModal.d.ts +2 -1
- package/dist/modals/PromoteDashModal.d.ts.map +1 -0
- package/dist/modals/PromoteDashModal.js +123 -0
- package/{lib → dist}/modals/PromoteViewModal.d.ts +1 -0
- package/dist/modals/PromoteViewModal.d.ts.map +1 -0
- package/{lib → dist}/modals/PromoteViewModal.js +13 -16
- package/{lib → dist}/modals/ReorderDashboardModal.d.ts +4 -1
- package/dist/modals/ReorderDashboardModal.d.ts.map +1 -0
- package/{lib → dist}/modals/ReorderDashboardModal.js +53 -55
- package/dist/modals/index.d.ts +5 -0
- package/dist/modals/index.d.ts.map +1 -0
- package/{lib → dist}/primitives/ButtonPrimitive.d.ts +3 -0
- package/dist/primitives/ButtonPrimitive.d.ts.map +1 -0
- package/dist/primitives/ButtonPrimitive.js +47 -0
- package/{lib → dist}/primitives/HeaderPrimitive.d.ts +1 -0
- package/dist/primitives/HeaderPrimitive.d.ts.map +1 -0
- package/dist/primitives/HeaderPrimitive.js +9 -0
- package/{lib → dist}/primitives/ModalPrimitive.d.ts +3 -1
- package/dist/primitives/ModalPrimitive.d.ts.map +1 -0
- package/{lib → dist}/primitives/ModalPrimitive.js +9 -11
- package/{lib → dist}/primitives/SecondaryButtonPrimitive.d.ts +1 -0
- package/dist/primitives/SecondaryButtonPrimitive.d.ts.map +1 -0
- package/{lib → dist}/primitives/SecondaryButtonPrimitive.js +5 -8
- package/{lib → dist}/primitives/SelectPrimitive.d.ts +1 -0
- package/dist/primitives/SelectPrimitive.d.ts.map +1 -0
- package/{lib → dist}/primitives/SelectPrimitive.js +8 -11
- package/{lib → dist}/primitives/TextInputPrimitive.d.ts +2 -0
- package/dist/primitives/TextInputPrimitive.d.ts.map +1 -0
- package/dist/primitives/TextInputPrimitive.js +24 -0
- package/dist/primitives/TogglePrimitive.d.ts +6 -0
- package/dist/primitives/TogglePrimitive.d.ts.map +1 -0
- package/dist/primitives/TogglePrimitive.js +45 -0
- package/dist/primitives/index.d.ts +7 -0
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/public_components/CreateEnvironment.d.ts +6 -0
- package/dist/public_components/CreateEnvironment.d.ts.map +1 -0
- package/dist/public_components/CreateEnvironment.js +129 -0
- package/{lib → dist}/public_components/DashboardBuilder.d.ts +2 -1
- package/dist/public_components/DashboardBuilder.d.ts.map +1 -0
- package/dist/public_components/DashboardBuilder.js +192 -0
- package/{lib → dist}/public_components/DashboardManager.d.ts +2 -1
- package/dist/public_components/DashboardManager.d.ts.map +1 -0
- package/dist/public_components/DashboardManager.js +308 -0
- package/{lib → dist}/public_components/SQLViewManager.d.ts +2 -1
- package/dist/public_components/SQLViewManager.d.ts.map +1 -0
- package/dist/public_components/SQLViewManager.js +394 -0
- package/dist/utils/constants.d.ts +26 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +13 -0
- package/dist/utils/databases.d.ts +34 -0
- package/dist/utils/databases.d.ts.map +1 -0
- package/dist/utils/databases.js +51 -0
- package/dist/utils/delay.d.ts +2 -0
- package/dist/utils/delay.d.ts.map +1 -0
- package/dist/utils/delay.js +3 -0
- package/dist/utils/schema.d.ts +22 -0
- package/dist/utils/schema.d.ts.map +1 -0
- package/dist/utils/schema.js +1 -0
- package/dist/utils/table.d.ts +9 -0
- package/dist/utils/table.d.ts.map +1 -0
- package/dist/utils/table.js +1 -0
- package/package.json +19 -26
- package/LICENSE +0 -21
- package/README.md +0 -10
- package/lib/Admin.js +0 -1573
- package/lib/Admin.js.map +0 -1
- package/lib/AdminProvider.js.map +0 -1
- package/lib/components/DashboardSelectPopover.d.ts +0 -9
- package/lib/components/DashboardSelectPopover.js +0 -187
- package/lib/components/DashboardSelectPopover.js.map +0 -1
- package/lib/components/DropDownMenu.js +0 -43
- package/lib/components/DropDownMenu.js.map +0 -1
- package/lib/components/EnvSelectPopover.js +0 -190
- package/lib/components/EnvSelectPopover.js.map +0 -1
- package/lib/components/OrgSelect.js +0 -188
- package/lib/components/OrgSelect.js.map +0 -1
- package/lib/components/index.js +0 -17
- package/lib/components/index.js.map +0 -1
- package/lib/icons/ArrowDownHeadIcon.js +0 -6
- package/lib/icons/ArrowDownHeadIcon.js.map +0 -1
- package/lib/icons/index.js +0 -9
- package/lib/icons/index.js.map +0 -1
- package/lib/index.js +0 -17
- package/lib/index.js.map +0 -1
- package/lib/modals/EditDashboardsModal.js +0 -94
- package/lib/modals/EditDashboardsModal.js.map +0 -1
- package/lib/modals/PromoteDashModal.js +0 -126
- package/lib/modals/PromoteDashModal.js.map +0 -1
- package/lib/modals/PromoteViewModal.js.map +0 -1
- package/lib/modals/ReorderDashboardModal.js.map +0 -1
- package/lib/modals/index.js +0 -15
- package/lib/modals/index.js.map +0 -1
- package/lib/primitives/ButtonPrimitive.js +0 -25
- package/lib/primitives/ButtonPrimitive.js.map +0 -1
- package/lib/primitives/HeaderPrimitive.js +0 -12
- package/lib/primitives/HeaderPrimitive.js.map +0 -1
- package/lib/primitives/ModalPrimitive.js.map +0 -1
- package/lib/primitives/SecondaryButtonPrimitive.js.map +0 -1
- package/lib/primitives/SelectPrimitive.js.map +0 -1
- package/lib/primitives/TextInputPrimitive.js +0 -26
- package/lib/primitives/TextInputPrimitive.js.map +0 -1
- package/lib/primitives/index.js +0 -19
- package/lib/primitives/index.js.map +0 -1
- package/lib/public_components/DashboardBuilder.js +0 -166
- package/lib/public_components/DashboardBuilder.js.map +0 -1
- package/lib/public_components/DashboardManager.js +0 -255
- package/lib/public_components/DashboardManager.js.map +0 -1
- package/lib/public_components/SQLViewManager.js +0 -400
- package/lib/public_components/SQLViewManager.js.map +0 -1
- /package/{lib/components/index.d.ts → dist/components/index.js} +0 -0
- /package/{lib/icons/index.d.ts → dist/icons/index.js} +0 -0
- /package/{lib/modals/index.d.ts → dist/modals/index.js} +0 -0
- /package/{lib/primitives/index.d.ts → dist/primitives/index.js} +0 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { ButtonPrimitive, TextInputPrimitive } from '../../primitives';
|
|
4
|
+
import DatabaseSelector from '../../components/DatabaseSelector';
|
|
5
|
+
import { DATABASE_DEFAULT_INFO, formConnectionString, getDatabaseConnectionFormat, } from '../../utils/databases';
|
|
6
|
+
import { getSchemaTableInfo, testConnectionString, } from '../../api/ConnectionClient';
|
|
7
|
+
import { delay } from '../../utils/delay';
|
|
8
|
+
export default function ConnectDatabase({ containerStyle, header1Style, header2Style, setEnvironmentDetails, environmentDetails, }) {
|
|
9
|
+
const [showError, setShowError] = useState(false);
|
|
10
|
+
const [connectButtonMessage, setConnectButtonMessage] = useState('Connect');
|
|
11
|
+
const [copied, setCopied] = useState(false);
|
|
12
|
+
const [databaseConnectionDetails, setConnectionDetails] = useState(environmentDetails);
|
|
13
|
+
const onDatabaseSelect = (database) => {
|
|
14
|
+
setConnectionDetails(getDatabaseConnectionFormat(database));
|
|
15
|
+
};
|
|
16
|
+
const testConnection = async () => {
|
|
17
|
+
const connectionString = formConnectionString(databaseConnectionDetails);
|
|
18
|
+
const result = await testConnectionString(connectionString);
|
|
19
|
+
if (result) {
|
|
20
|
+
try {
|
|
21
|
+
const suspectedSchema = await getSchemaTableInfo(connectionString, 'public');
|
|
22
|
+
setConnectButtonMessage('Connecting');
|
|
23
|
+
// Stop the next code from running for a second
|
|
24
|
+
// This is to show the connecting message
|
|
25
|
+
await delay(1000);
|
|
26
|
+
if ('selectedFields' in suspectedSchema) {
|
|
27
|
+
setConnectButtonMessage('Connected ✅');
|
|
28
|
+
await delay(2000);
|
|
29
|
+
setEnvironmentDetails(databaseConnectionDetails, suspectedSchema, undefined);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
setConnectButtonMessage('Connected ✅');
|
|
33
|
+
await delay(2000);
|
|
34
|
+
setEnvironmentDetails(databaseConnectionDetails, undefined, suspectedSchema);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
setConnectButtonMessage('Connect');
|
|
39
|
+
setShowError(true);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
setConnectButtonMessage('Connect');
|
|
44
|
+
setShowError(true);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
return (_jsxs("div", { style: { ...containerStyle }, id: "connect-database-form", children: [_jsx("h1", { style: header1Style, children: "Connect Database" }), _jsxs("div", { style: { marginTop: 12 }, children: [_jsx("h2", { style: { ...header2Style, fontWeight: 600, color: '#565656' }, children: "Database type" }), _jsx("div", { style: { display: 'flex', gap: 10 }, children: DATABASE_DEFAULT_INFO.map((database) => {
|
|
48
|
+
return (_jsx(DatabaseSelector, { onDatabaseSelect: onDatabaseSelect, containerStyle: { marginBottom: '12px' }, label: database.label, value: database.value, imageUrl: database.imageUrl }, database.label));
|
|
49
|
+
}) })] }), _jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center' }, children: [_jsxs("div", { style: {
|
|
50
|
+
// width: '100%',
|
|
51
|
+
maxWidth: 330,
|
|
52
|
+
display: 'flex',
|
|
53
|
+
flexDirection: 'row',
|
|
54
|
+
justifyContent: 'space-between',
|
|
55
|
+
alignItems: 'center',
|
|
56
|
+
padding: '6px 12px',
|
|
57
|
+
marginTop: '20px',
|
|
58
|
+
marginBottom: '18px',
|
|
59
|
+
borderRadius: 6,
|
|
60
|
+
cursor: 'pointer',
|
|
61
|
+
}, onClick: () => {
|
|
62
|
+
navigator.clipboard.writeText('34.133.137.225');
|
|
63
|
+
setCopied(true);
|
|
64
|
+
setTimeout(() => setCopied(false), 1500);
|
|
65
|
+
}, className: "quill-active", children: [_jsx("style", { children: `.quill-active { background: #fff; border: 1px solid #e7e7e7; }
|
|
66
|
+
.quill-active:hover { background: #fff; box-shadow: 0px 1px 12px rgba(0, 0, 0, 0.07); border: 1px solid #e7e7e7 }
|
|
67
|
+
.quill-active:active { background: #fff; box-shadow: 0px 1px 12px rgba(0, 0, 0, 0.07); border: 1px solid #9DC4F8; outline: 2px solid #9DC4F8; }
|
|
68
|
+
` }), _jsx("div", { style: { ...header2Style, color: '#212121', marginBottom: '0px' }, children: _jsx("h2", { style: {
|
|
69
|
+
WebkitUserSelect: 'none',
|
|
70
|
+
MozUserSelect: 'none',
|
|
71
|
+
msUserSelect: 'none',
|
|
72
|
+
userSelect: 'none',
|
|
73
|
+
}, children: "Whitelist Quill's IP" }) }), _jsxs("div", { style: {
|
|
74
|
+
display: 'flex',
|
|
75
|
+
flexDirection: 'row',
|
|
76
|
+
alignItems: 'center',
|
|
77
|
+
gap: '6px',
|
|
78
|
+
cursor: 'pointer',
|
|
79
|
+
marginLeft: '12px',
|
|
80
|
+
}, children: [_jsx("h2", { style: {
|
|
81
|
+
...header2Style,
|
|
82
|
+
color: '#212121',
|
|
83
|
+
marginBottom: '0px',
|
|
84
|
+
}, children: "34.133.137.225" }), _jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "#212121", width: 18, height: 18, children: [_jsx("path", { d: "M7 3.5A1.5 1.5 0 0 1 8.5 2h3.879a1.5 1.5 0 0 1 1.06.44l3.122 3.12A1.5 1.5 0 0 1 17 6.622V12.5a1.5 1.5 0 0 1-1.5 1.5h-1v-3.379a3 3 0 0 0-.879-2.121L10.5 5.379A3 3 0 0 0 8.379 4.5H7v-1Z" }), _jsx("path", { d: "M4.5 6A1.5 1.5 0 0 0 3 7.5v9A1.5 1.5 0 0 0 4.5 18h7a1.5 1.5 0 0 0 1.5-1.5v-5.879a1.5 1.5 0 0 0-.44-1.06L9.44 6.439A1.5 1.5 0 0 0 8.378 6H4.5Z" })] })] })] }), copied && (_jsxs("div", { style: {
|
|
85
|
+
fontSize: 13,
|
|
86
|
+
fontWeight: 600,
|
|
87
|
+
color: '#565656',
|
|
88
|
+
marginLeft: 16,
|
|
89
|
+
display: 'flex',
|
|
90
|
+
flexDirection: 'row',
|
|
91
|
+
alignItems: 'center',
|
|
92
|
+
gap: 6,
|
|
93
|
+
}, children: [_jsx("div", { children: "\u2705" }), " ", _jsx("div", { children: "Copied to clipboard" })] }))] }), databaseConnectionDetails && (_jsxs("div", { children: [databaseConnectionDetails.type === 'PostgreSQL' && (_jsx("div", { children: _jsxs("div", { children: [_jsx("h2", { style: { ...header2Style, fontWeight: 600 }, children: "Connection String" }), _jsx(TextInputPrimitive, { onChange: (e) => {
|
|
94
|
+
setConnectionDetails({
|
|
95
|
+
...databaseConnectionDetails,
|
|
96
|
+
connectionString: e.target.value,
|
|
97
|
+
});
|
|
98
|
+
}, value: databaseConnectionDetails.connectionString })] }) })), _jsxs("div", { style: {
|
|
99
|
+
...header1Style,
|
|
100
|
+
textAlign: 'center',
|
|
101
|
+
fontSize: 14,
|
|
102
|
+
color: '#565656',
|
|
103
|
+
display: 'flex',
|
|
104
|
+
flexDirection: 'row',
|
|
105
|
+
alignItems: 'center',
|
|
106
|
+
paddingTop: 24,
|
|
107
|
+
paddingBottom: 0,
|
|
108
|
+
}, children: [_jsx("div", { style: { width: '100%', height: 1, background: '#e7e7e7' } }), _jsx("div", { style: { padding: 12 }, children: "or" }), _jsx("div", { style: { width: '100%', height: 1, background: '#e7e7e7' } })] }), _jsx("div", { id: "database-details-form", children: _jsx("div", { style: {
|
|
109
|
+
display: 'grid',
|
|
110
|
+
gridTemplateColumns: 'repeat(3, 1fr)',
|
|
111
|
+
gap: '20px',
|
|
112
|
+
justifyContent: 'space-between',
|
|
113
|
+
marginTop: '16px',
|
|
114
|
+
}, children:
|
|
115
|
+
// get a list of types in the databaseConnectionDetails object and create a form for each
|
|
116
|
+
Object.entries(databaseConnectionDetails).map(([key, value]) => {
|
|
117
|
+
if (key !== 'connectionString' && key !== 'type')
|
|
118
|
+
return (_jsxs("div", { children: [_jsx("h2", { style: {
|
|
119
|
+
...header2Style,
|
|
120
|
+
fontWeight: '600',
|
|
121
|
+
}, children: key
|
|
122
|
+
.split(/(?=[A-Z])/)
|
|
123
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
124
|
+
.join(' ') }), _jsx(TextInputPrimitive, { onChange: (e) => {
|
|
125
|
+
setConnectionDetails({
|
|
126
|
+
...databaseConnectionDetails,
|
|
127
|
+
[key]: e.target.value,
|
|
128
|
+
});
|
|
129
|
+
}, value: value, disabled: key === 'type' })] }, key));
|
|
130
|
+
}) }) }), _jsxs("div", { style: {
|
|
131
|
+
width: '100%',
|
|
132
|
+
display: 'flex',
|
|
133
|
+
justifyContent: 'space-between',
|
|
134
|
+
alignItems: 'center',
|
|
135
|
+
marginTop: '24px',
|
|
136
|
+
}, children: [showError ? (_jsx("h2", { style: { ...header2Style, color: 'red' }, children: "Couldn't connect to database." })) : (_jsx("div", {})), _jsx(ButtonPrimitive, { label: connectButtonMessage, onClick: testConnection })] })] }))] }));
|
|
137
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { SchemaDetails } from '../../utils/schema';
|
|
3
|
+
import { ConnectionError, ConnectionType } from '../../utils/databases';
|
|
4
|
+
export default function ConnectSchema({ containerStyle, header1Style, header2Style, allSchemaInfo, environmentDetails, propogateSchemaDetails, initialError, }: {
|
|
5
|
+
containerStyle?: CSSProperties;
|
|
6
|
+
header1Style?: CSSProperties;
|
|
7
|
+
header2Style?: CSSProperties;
|
|
8
|
+
allSchemaInfo?: SchemaDetails;
|
|
9
|
+
environmentDetails?: ConnectionType;
|
|
10
|
+
initialError?: ConnectionError;
|
|
11
|
+
propogateSchemaDetails: (schemaDetails?: SchemaDetails) => void;
|
|
12
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=ConnectSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectSchema.d.ts","sourceRoot":"","sources":["../../../src/forms/client_onboard/ConnectSchema.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAuB,MAAM,OAAO,CAAC;AAIlE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AASnD,OAAO,EACL,eAAe,EACf,cAAc,EAEf,MAAM,uBAAuB,CAAC;AAE/B,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,sBAAsB,EACtB,YAAY,GACb,EAAE;IACD,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,kBAAkB,CAAC,EAAE,cAAc,CAAC;IACpC,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B,sBAAsB,EAAE,CAAC,aAAa,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;CACjE,2CA6RA"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { ButtonPrimitive } from '../../primitives';
|
|
4
|
+
import DropdownMenuWithLabel from '../../components/DropDownMenuWithLabel';
|
|
5
|
+
import { getFKInfo, getOrgInfo, getSchemaTableInfo, getTableInfo, getTablesBySchema, } from '../../api/ConnectionClient';
|
|
6
|
+
import { formConnectionString, } from '../../utils/databases';
|
|
7
|
+
export default function ConnectSchema({ containerStyle, header1Style, header2Style, allSchemaInfo, environmentDetails, propogateSchemaDetails, initialError, }) {
|
|
8
|
+
const [schemaDetails, setSchemaDetails] = useState(allSchemaInfo);
|
|
9
|
+
const [schemaError, setSchemaError] = useState(initialError);
|
|
10
|
+
const [formError, setFormError] = useState({ show: false, message: '' });
|
|
11
|
+
return (_jsxs("div", { style: { ...containerStyle }, id: "connect-database-form", children: [_jsx("h1", { style: header1Style, children: "Select Organization Table" }), _jsx("h2", { style: header2Style, children: "Select which table you use for organizations (your customers). Quill uses this table to partition data by organization." }), _jsxs("div", { style: {
|
|
12
|
+
marginTop: 16,
|
|
13
|
+
width: '100%',
|
|
14
|
+
display: 'flex',
|
|
15
|
+
flexDirection: 'row',
|
|
16
|
+
gap: '16px',
|
|
17
|
+
alignItems: 'flex-end',
|
|
18
|
+
paddingBottom: '16px',
|
|
19
|
+
}, children: [_jsx(DropdownMenuWithLabel, { items: schemaDetails?.schemas || schemaError?.schemas || [], setSelected: async (e) => {
|
|
20
|
+
const tables = await getTablesBySchema(formConnectionString(environmentDetails), e);
|
|
21
|
+
if (tables) {
|
|
22
|
+
setFormError({ show: false, message: '' });
|
|
23
|
+
setSchemaError(undefined);
|
|
24
|
+
setSchemaDetails({
|
|
25
|
+
...schemaDetails,
|
|
26
|
+
schemas: schemaDetails?.schemas || schemaError?.schemas || [],
|
|
27
|
+
tables: tables,
|
|
28
|
+
columns: [],
|
|
29
|
+
organizations: [],
|
|
30
|
+
foreignKeys: [],
|
|
31
|
+
selectedFields: {
|
|
32
|
+
schema: e,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
setSchemaDetails({
|
|
38
|
+
schemas: schemaDetails?.schemas || schemaError?.schemas || [],
|
|
39
|
+
tables: undefined,
|
|
40
|
+
columns: [],
|
|
41
|
+
organizations: [],
|
|
42
|
+
foreignKeys: [],
|
|
43
|
+
selectedFields: {
|
|
44
|
+
schema: e,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
setSchemaError({
|
|
48
|
+
schemas: schemaDetails?.schemas || schemaError?.schemas || [],
|
|
49
|
+
message: "Invalid permissions. Unable to access to '" +
|
|
50
|
+
e +
|
|
51
|
+
"' schema.",
|
|
52
|
+
schemaName: e,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}, selected: schemaDetails?.selectedFields?.schema || schemaError?.schemaName, label: 'Schema' }), schemaError?.schemas.length === 0 && (_jsx(ButtonPrimitive, { label: "Re-fetch", onClick: async () => {
|
|
56
|
+
const suspectedSchema = await getSchemaTableInfo(formConnectionString(environmentDetails), 'public');
|
|
57
|
+
if ('selectedFields' in suspectedSchema) {
|
|
58
|
+
setSchemaError(undefined);
|
|
59
|
+
setSchemaDetails(suspectedSchema);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
setSchemaError(suspectedSchema);
|
|
63
|
+
}
|
|
64
|
+
} }))] }), schemaDetails?.tables && (_jsxs("div", { children: [_jsx("div", { style: { gap: 16 }, id: "database-details-form", children: _jsxs("div", {
|
|
65
|
+
// style={{
|
|
66
|
+
// display: 'flex',
|
|
67
|
+
// flexWrap: 'wrap',
|
|
68
|
+
// width: '100%',
|
|
69
|
+
// gap: '16px',
|
|
70
|
+
// }}
|
|
71
|
+
style: {
|
|
72
|
+
display: 'grid',
|
|
73
|
+
gridTemplateColumns: 'repeat(3, 1fr)',
|
|
74
|
+
gap: '20px',
|
|
75
|
+
justifyContent: 'space-between',
|
|
76
|
+
marginTop: '8px',
|
|
77
|
+
}, children: [_jsx(DropdownMenuWithLabel, { items: schemaDetails?.tables || [], setSelected: async (e) => {
|
|
78
|
+
const columns = await getTableInfo(formConnectionString(environmentDetails), schemaDetails?.selectedFields?.schema, e);
|
|
79
|
+
setSchemaDetails({
|
|
80
|
+
...schemaDetails,
|
|
81
|
+
columns: columns.columns,
|
|
82
|
+
foreignKeys: [],
|
|
83
|
+
organizations: [],
|
|
84
|
+
selectedFields: {
|
|
85
|
+
schema: schemaDetails?.selectedFields?.schema,
|
|
86
|
+
table: e,
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
}, selected: schemaDetails?.selectedFields?.table, label: 'Organization table' }), _jsx(DropdownMenuWithLabel, { items: schemaDetails?.columns || [], setSelected: async (e) => {
|
|
90
|
+
const fkStrings = await getFKInfo(formConnectionString(environmentDetails), schemaDetails?.selectedFields?.schema, schemaDetails?.selectedFields?.table, e);
|
|
91
|
+
if (schemaDetails?.selectedFields.customerNameField) {
|
|
92
|
+
const organizations = await getOrgInfo(formConnectionString(environmentDetails), schemaDetails?.selectedFields?.schema, schemaDetails?.selectedFields?.table, e, schemaDetails?.selectedFields.customerNameField);
|
|
93
|
+
setSchemaDetails({
|
|
94
|
+
...schemaDetails,
|
|
95
|
+
organizations: organizations,
|
|
96
|
+
selectedFields: {
|
|
97
|
+
...schemaDetails?.selectedFields,
|
|
98
|
+
organizationIdField: e,
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
setSchemaDetails({
|
|
103
|
+
...schemaDetails,
|
|
104
|
+
foreignKeys: fkStrings,
|
|
105
|
+
selectedFields: {
|
|
106
|
+
...schemaDetails?.selectedFields,
|
|
107
|
+
organizationIdField: e,
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
}, selected: schemaDetails?.selectedFields?.organizationIdField, label: 'Organization ID field' }), _jsx(DropdownMenuWithLabel, { items: schemaDetails?.columns || [], setSelected: async (e) => {
|
|
111
|
+
if (schemaDetails?.selectedFields.organizationIdField) {
|
|
112
|
+
const organizations = await getOrgInfo(formConnectionString(environmentDetails), schemaDetails?.selectedFields?.schema, schemaDetails?.selectedFields?.table, schemaDetails?.selectedFields.organizationIdField, e);
|
|
113
|
+
setSchemaDetails({
|
|
114
|
+
...schemaDetails,
|
|
115
|
+
organizations: organizations,
|
|
116
|
+
selectedFields: {
|
|
117
|
+
...schemaDetails?.selectedFields,
|
|
118
|
+
customerNameField: e,
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
setSchemaDetails({
|
|
124
|
+
...schemaDetails,
|
|
125
|
+
selectedFields: {
|
|
126
|
+
...schemaDetails?.selectedFields,
|
|
127
|
+
customerNameField: e,
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}, selected: schemaDetails?.selectedFields?.customerNameField, label: 'Organization name field' }), _jsx(DropdownMenuWithLabel, { items: schemaDetails?.organizations?.map((orgObj) => orgObj.name) ||
|
|
132
|
+
[], setSelected: async (e) => {
|
|
133
|
+
const orgObj = schemaDetails?.organizations?.find((orgObj) => orgObj.name === e);
|
|
134
|
+
setSchemaDetails({
|
|
135
|
+
...schemaDetails,
|
|
136
|
+
selectedFields: {
|
|
137
|
+
...schemaDetails?.selectedFields,
|
|
138
|
+
defaultOrg: orgObj,
|
|
139
|
+
},
|
|
140
|
+
});
|
|
141
|
+
}, selected: schemaDetails?.selectedFields?.defaultOrg?.name, label: 'Default organization' }), _jsx(DropdownMenuWithLabel, { items: schemaDetails?.foreignKeys || [], setSelected: async (e) => {
|
|
142
|
+
setSchemaDetails({
|
|
143
|
+
...schemaDetails,
|
|
144
|
+
selectedFields: {
|
|
145
|
+
...schemaDetails?.selectedFields,
|
|
146
|
+
foreignKey: e,
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
}, selected: schemaDetails?.selectedFields?.foreignKey, label: 'Foreign key' })] }) }), _jsxs("div", { style: {
|
|
150
|
+
width: '100%',
|
|
151
|
+
display: 'flex',
|
|
152
|
+
justifyContent: 'space-between',
|
|
153
|
+
alignItems: 'center',
|
|
154
|
+
marginTop: '12px',
|
|
155
|
+
}, children: [formError.show ? (_jsx("h2", { style: { ...header2Style, color: 'red' }, children: formError.message })) : (_jsx("div", {})), _jsx(ButtonPrimitive, { label: "Confirm", onClick: () => {
|
|
156
|
+
if (schemaDetails?.selectedFields?.schema &&
|
|
157
|
+
schemaDetails?.selectedFields?.table &&
|
|
158
|
+
schemaDetails?.selectedFields?.organizationIdField &&
|
|
159
|
+
schemaDetails?.selectedFields?.customerNameField &&
|
|
160
|
+
schemaDetails?.selectedFields?.defaultOrg &&
|
|
161
|
+
schemaDetails?.selectedFields?.foreignKey) {
|
|
162
|
+
propogateSchemaDetails(schemaDetails);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
setFormError({
|
|
166
|
+
show: true,
|
|
167
|
+
message: 'Please complete all dropdowns',
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
} })] })] })), schemaError?.message && (_jsx("h2", { style: { ...header2Style, color: 'red' }, children: schemaError.message }))] }));
|
|
171
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { ColumnsByTable } from '../../utils/table';
|
|
3
|
+
import { SchemaDetails } from '../../utils/schema';
|
|
4
|
+
import { ConnectionType } from '../../utils/databases';
|
|
5
|
+
export default function CreateSQLViews({ containerStyle, header1Style, header2Style, columnsByTable, environmentDetails, allSchemaInfo, domainName, completeOnboarding, }: {
|
|
6
|
+
containerStyle?: CSSProperties;
|
|
7
|
+
header1Style?: CSSProperties;
|
|
8
|
+
header2Style?: CSSProperties;
|
|
9
|
+
columnsByTable: ColumnsByTable[];
|
|
10
|
+
environmentDetails?: ConnectionType;
|
|
11
|
+
allSchemaInfo?: SchemaDetails;
|
|
12
|
+
domainName: string | undefined;
|
|
13
|
+
completeOnboarding: (client: any) => void;
|
|
14
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=CreateSqlViews.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateSqlViews.d.ts","sourceRoot":"","sources":["../../../src/forms/client_onboard/CreateSqlViews.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAuB,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAanD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAwB,MAAM,uBAAuB,CAAC;AAG7E,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,kBAAkB,GACnB,EAAE;IACD,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,cAAc,EAAE,cAAc,EAAE,CAAC;IACjC,kBAAkB,CAAC,EAAE,cAAc,CAAC;IACpC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,kBAAkB,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;CAC3C,2CA8VA"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { ButtonPrimitive, ModalPrimitive, TextInputPrimitive, } from '../../primitives';
|
|
4
|
+
import { SqlTextEditor, Table } from '@quillsql/react';
|
|
5
|
+
import { addEnvironment, getQueryFromAI, getSqlViewData, } from '../../api/ConnectionClient';
|
|
6
|
+
import { formConnectionString } from '../../utils/databases';
|
|
7
|
+
import SqlViewTile from '../../components/SqlViewTile';
|
|
8
|
+
export default function CreateSQLViews({ containerStyle, header1Style, header2Style, columnsByTable, environmentDetails, allSchemaInfo, domainName, completeOnboarding, }) {
|
|
9
|
+
const [selectedTable, setSelectedTable] = useState(undefined);
|
|
10
|
+
const [queryInfo, setQueryInfo] = useState({
|
|
11
|
+
name: '',
|
|
12
|
+
query: '',
|
|
13
|
+
});
|
|
14
|
+
const [aiPrompt, setAIPrompt] = useState('');
|
|
15
|
+
const [errorInfo, setErrorInfo] = useState({ status: false, msg: '' });
|
|
16
|
+
const [sqlQueryError, setSqlQueryInfo] = useState({ status: false, msg: '' });
|
|
17
|
+
const [tableData, setTableData] = useState(undefined);
|
|
18
|
+
const [client, setClient] = useState(undefined);
|
|
19
|
+
const [sqlTables, setSqlTables] = useState([]);
|
|
20
|
+
const [askAIButton, setAskAIButton] = useState('Ask AI');
|
|
21
|
+
const [runQueryButtonLabel, setRunQueryButtonLabel] = useState('Run query');
|
|
22
|
+
const [showFKModal, setShowFKModal] = useState(false);
|
|
23
|
+
const addSqlView = async (override) => {
|
|
24
|
+
const results = await addEnvironment(environmentDetails, allSchemaInfo, columnsByTable, queryInfo, client, domainName, tableData, sqlTables.map((e) => {
|
|
25
|
+
return e.name;
|
|
26
|
+
}), override);
|
|
27
|
+
if (results.throwModal) {
|
|
28
|
+
setShowFKModal(true);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (results.success) {
|
|
32
|
+
setSqlQueryInfo({ msg: '', status: false });
|
|
33
|
+
setClient(results.client);
|
|
34
|
+
setSqlTables(results.tables);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
setSqlQueryInfo({ msg: results.message, status: true });
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
window.scrollTo({
|
|
42
|
+
behavior: 'smooth',
|
|
43
|
+
top: 900,
|
|
44
|
+
});
|
|
45
|
+
}, []);
|
|
46
|
+
return (_jsxs("div", { style: {
|
|
47
|
+
...containerStyle,
|
|
48
|
+
display: 'flex',
|
|
49
|
+
flexDirection: 'column',
|
|
50
|
+
overflow: 'hidden',
|
|
51
|
+
}, id: "create-sql-view", children: [_jsxs("div", { style: {
|
|
52
|
+
padding: 20,
|
|
53
|
+
paddingBottom: 12,
|
|
54
|
+
height: 92,
|
|
55
|
+
maxHeight: 92,
|
|
56
|
+
minHeight: 92,
|
|
57
|
+
}, children: [_jsx("h1", { style: header1Style, children: "Add SQL Views" }), _jsx("h2", { style: { ...header2Style }, children: "Create a cleaned schema that makes it easier to write queries." })] }), _jsxs("div", { style: {
|
|
58
|
+
display: 'flex',
|
|
59
|
+
flexDirection: 'row',
|
|
60
|
+
borderTop: 'solid 1px #e7e7e7',
|
|
61
|
+
height: 'calc(100vh - 143px)',
|
|
62
|
+
}, children: [_jsxs("div", { id: "form-editor-table", style: {
|
|
63
|
+
display: 'flex',
|
|
64
|
+
flexDirection: 'column',
|
|
65
|
+
width: 'calc(100% - 300px)',
|
|
66
|
+
}, children: [_jsxs("div", { style: {
|
|
67
|
+
display: 'flex',
|
|
68
|
+
flexDirection: 'row',
|
|
69
|
+
alignItems: 'center',
|
|
70
|
+
justifyContent: 'space-between',
|
|
71
|
+
gap: 12,
|
|
72
|
+
paddingLeft: 16,
|
|
73
|
+
paddingRight: 16,
|
|
74
|
+
height: 70,
|
|
75
|
+
}, children: [_jsx(TextInputPrimitive, { onChange: (e) => {
|
|
76
|
+
setAIPrompt(e.target.value);
|
|
77
|
+
}, placeholder: 'Describe a query...', value: aiPrompt }), _jsx(ButtonPrimitive, { label: askAIButton, onClick: async () => {
|
|
78
|
+
setAskAIButton('Loading...');
|
|
79
|
+
const results = await getQueryFromAI(aiPrompt, columnsByTable);
|
|
80
|
+
setQueryInfo({ name: queryInfo.name, query: results });
|
|
81
|
+
setAskAIButton('Ask AI');
|
|
82
|
+
}, style: { width: '90px' } })] }), _jsx(SqlTextEditor, { value: queryInfo.query, setValue: (e) => {
|
|
83
|
+
setQueryInfo({ name: queryInfo.name, query: e });
|
|
84
|
+
}, containerStyle: { paddingLeft: 16, paddingRight: 16 } }), _jsxs("div", { style: {
|
|
85
|
+
display: 'flex',
|
|
86
|
+
flexDirection: 'row',
|
|
87
|
+
justifyContent: 'space-between',
|
|
88
|
+
alignItems: 'center',
|
|
89
|
+
paddingLeft: 16,
|
|
90
|
+
paddingRight: 16,
|
|
91
|
+
height: 70,
|
|
92
|
+
}, children: [_jsx(ButtonPrimitive, { label: runQueryButtonLabel, onClick: async () => {
|
|
93
|
+
setRunQueryButtonLabel('Querying...');
|
|
94
|
+
const connectionString = formConnectionString(environmentDetails);
|
|
95
|
+
const getSqlResults = await getSqlViewData(connectionString, queryInfo.query);
|
|
96
|
+
if (!getSqlResults.success) {
|
|
97
|
+
setErrorInfo({ status: true, msg: getSqlResults.error });
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
setErrorInfo({ status: false, msg: '' });
|
|
101
|
+
setTableData(getSqlResults);
|
|
102
|
+
}
|
|
103
|
+
setRunQueryButtonLabel('Run query');
|
|
104
|
+
} }), errorInfo.status ? (_jsx("h2", { style: {
|
|
105
|
+
...header2Style,
|
|
106
|
+
color: 'red',
|
|
107
|
+
paddingTop: '12px',
|
|
108
|
+
textTransform: 'capitalize',
|
|
109
|
+
}, children: errorInfo.msg })) : (_jsx("div", {}))] }), !errorInfo.status && tableData && (_jsxs("div", { style: {
|
|
110
|
+
paddingLeft: 16,
|
|
111
|
+
paddingRight: 16,
|
|
112
|
+
height: 'calc(100vh - 515px)',
|
|
113
|
+
}, children: [_jsx(Table, { rows: tableData.rows, columns: tableData.columns,
|
|
114
|
+
// height="400px"
|
|
115
|
+
containerStyle: {
|
|
116
|
+
height: 'calc(100vh - 589px)',
|
|
117
|
+
width: '100%',
|
|
118
|
+
}, showDownloadCsvButton: false }), _jsxs("div", { style: {
|
|
119
|
+
width: '100%',
|
|
120
|
+
display: 'flex',
|
|
121
|
+
justifyContent: 'space-between',
|
|
122
|
+
alignItems: 'center',
|
|
123
|
+
height: 70,
|
|
124
|
+
}, children: [sqlQueryError.status ? (_jsx("h2", { style: {
|
|
125
|
+
...header2Style,
|
|
126
|
+
color: 'red',
|
|
127
|
+
paddingTop: '12px',
|
|
128
|
+
// textTransform: 'capitalize',
|
|
129
|
+
}, children: sqlQueryError.msg })) : (_jsx("div", {})), _jsx(ButtonPrimitive, { label: "Add SQL View", onClick: () => addSqlView(false) })] })] }))] }), _jsxs("div", { style: {
|
|
130
|
+
// width: '30%',
|
|
131
|
+
background: '#fafafa',
|
|
132
|
+
borderLeft: 'solid 1px #e7e7e7',
|
|
133
|
+
width: 300,
|
|
134
|
+
height: 'calc(100vh - 154px)',
|
|
135
|
+
}, children: [_jsx("h1", { style: {
|
|
136
|
+
...header1Style,
|
|
137
|
+
color: '#212121',
|
|
138
|
+
paddingLeft: 16,
|
|
139
|
+
height: 70,
|
|
140
|
+
background: 'white',
|
|
141
|
+
borderBottom: 'solid 1px #e7e7e7',
|
|
142
|
+
display: 'flex',
|
|
143
|
+
flexDirection: 'column',
|
|
144
|
+
justifyContent: 'center',
|
|
145
|
+
alignItems: 'flex-start',
|
|
146
|
+
}, children: "SQL Views" }), sqlTables.length > 0 ? (_jsx("div", { style: { height: 'calc(100vh - 302px)' }, children: _jsxs("div", { style: {
|
|
147
|
+
display: 'grid',
|
|
148
|
+
gridTemplateColumns: 'repeat(auto-fill, minmax(245px, 1fr))',
|
|
149
|
+
gridAutoRows: '200px',
|
|
150
|
+
gap: '10px',
|
|
151
|
+
overflow: 'auto',
|
|
152
|
+
height: 'calc(100vh - 302px)',
|
|
153
|
+
paddingLeft: '12px',
|
|
154
|
+
paddingRight: '12px',
|
|
155
|
+
}, children: [sqlTables.map((e) => {
|
|
156
|
+
return (_jsx("div", { children: _jsx(SqlViewTile, { name: e.name, query: e.viewQuery, header1Style: header1Style, header2Style: header2Style }) }, e.name));
|
|
157
|
+
}), _jsx("div", { style: { height: 20 } })] }) })) : (_jsx("div", { style: { paddingLeft: 12, paddingRight: 12 }, children: _jsx("div", { style: {
|
|
158
|
+
display: 'flex',
|
|
159
|
+
justifyContent: 'center',
|
|
160
|
+
alignItems: 'center',
|
|
161
|
+
border: 'dashed 1px #C5C5C5',
|
|
162
|
+
marginTop: '12px',
|
|
163
|
+
borderRadius: 6,
|
|
164
|
+
height: 200,
|
|
165
|
+
}, children: _jsxs("h2", { style: {
|
|
166
|
+
...header2Style,
|
|
167
|
+
display: 'flex',
|
|
168
|
+
justifyContent: 'center',
|
|
169
|
+
alignItems: 'center',
|
|
170
|
+
color: '#565656',
|
|
171
|
+
textAlign: 'center',
|
|
172
|
+
}, children: ['No SQL views yet.', _jsx("br", {}), 'Add one with the SQL editor.'] }) }) })), sqlTables.length > 0 ? (_jsx("div", { style: {
|
|
173
|
+
display: 'flex',
|
|
174
|
+
justifyContent: 'flex-end',
|
|
175
|
+
flexDirection: 'row',
|
|
176
|
+
alignItems: 'center',
|
|
177
|
+
height: 70,
|
|
178
|
+
paddingRight: 12,
|
|
179
|
+
background: 'white',
|
|
180
|
+
borderTop: 'solid 1px #e7e7e7',
|
|
181
|
+
}, children: _jsx(ButtonPrimitive, { label: "Go to dashboard", onClick: () => {
|
|
182
|
+
completeOnboarding(client);
|
|
183
|
+
}, style: { width: 276 } }) })) : null] })] }), _jsx(ForeignKeyModal, { isOpen: showFKModal, setIsOpen: setShowFKModal, override: addSqlView, foreignKey: allSchemaInfo?.selectedFields.foreignKey, tableName: allSchemaInfo?.selectedFields.table })] }));
|
|
184
|
+
}
|
|
185
|
+
function ForeignKeyModal({ isOpen, setIsOpen, override, foreignKey, tableName, }) {
|
|
186
|
+
return (_jsx(ModalPrimitive, { isOpen: isOpen, close: () => {
|
|
187
|
+
setIsOpen(false);
|
|
188
|
+
}, children: _jsxs("div", { style: { display: 'flex', flexDirection: 'column', width: '600px' }, children: [_jsx("h1", { style: {
|
|
189
|
+
fontSize: 24,
|
|
190
|
+
fontWeight: 600,
|
|
191
|
+
color: '#212121',
|
|
192
|
+
paddingBottom: 14,
|
|
193
|
+
}, children: `Organization Foreign Key "${foreignKey}" Not Found` }), _jsxs("div", { style: { marginBottom: '12px' }, children: [`Your organization table `, _jsx("strong", { children: `"${tableName}"` }), ` foreign key `, _jsx("strong", { children: `"${foreignKey}"` }), " is not present in the current query. If this query will never have organization specific data on it (this is rare), override this message.`"] }), _jsx("br", {}), _jsxs("div", { style: {
|
|
194
|
+
display: 'flex',
|
|
195
|
+
flexDirection: 'row',
|
|
196
|
+
gap: '12px',
|
|
197
|
+
justifyContent: 'flex-end',
|
|
198
|
+
}, children: [_jsx(ButtonPrimitive, { label: "Got It", onClick: () => setIsOpen(false) }), _jsx(ButtonPrimitive, { label: "Override", variant: "danger", onClick: () => {
|
|
199
|
+
override(true);
|
|
200
|
+
setIsOpen(false);
|
|
201
|
+
} })] })] }) }));
|
|
202
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useItemBeingEdited.d.ts","sourceRoot":"","sources":["../../src/hooks/useItemBeingEdited.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EAIlB,MAAM,OAAO,CAAC;AAsCf,eAAO,MAAM,kBAAkB,YAI9B,CAAC;AAEF,eAAO,MAAM,uBAAuB,UAAW,iBAAiB,4CAM/D,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import { createContext, useContext, useReducer, } from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* The actual context that this hook will monitor.
|
|
6
|
+
*/
|
|
7
|
+
const ItemBeingEditedContext = createContext(null);
|
|
8
|
+
const reducer = (_, action) => {
|
|
9
|
+
switch (action.type) {
|
|
10
|
+
case 'SET_ITEM': {
|
|
11
|
+
return action.value;
|
|
12
|
+
}
|
|
13
|
+
case 'CLEAR_ITEM': {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
// No default necessary because action.type is a union of string literals
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export const useItemBeingEdited = () => {
|
|
20
|
+
const [todos, dispatch] = useReducer(reducer, null);
|
|
21
|
+
const foo = useContext(ItemBeingEditedContext);
|
|
22
|
+
};
|
|
23
|
+
export const ItemBeingEditedProvider = (props) => {
|
|
24
|
+
return (_jsx(ItemBeingEditedContext.Provider, { value: { state, dispatch }, children: children }));
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArrowDownHeadIcon.d.ts","sourceRoot":"","sources":["../../src/icons/ArrowDownHeadIcon.tsx"],"names":[],"mappings":"AAAA,QAAA,MAAM,iBAAiB;;6CActB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const ArrowDownHeadIcon = ({ ...props }) => (_jsxs("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "24", height: "24", children: [_jsx("path", { fill: "none", d: "M0 0h24v24H0z" }), _jsx("path", { fill: "currentColor", d: "M12 13.172l4.95-4.95 1.414 1.414L12 16 5.636 9.636 7.05 8.222z" })] }));
|
|
3
|
+
export default ArrowDownHeadIcon;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"XMarkIcon.d.ts","sourceRoot":"","sources":["../../src/icons/XMarkIcon.tsx"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,GAAG,CAAC,OAAO,CA4BzD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export default function XMarkIcon(props) {
|
|
3
|
+
return (_jsx("div", { style: {
|
|
4
|
+
height: 38,
|
|
5
|
+
width: 42,
|
|
6
|
+
alignItems: 'center',
|
|
7
|
+
justifyContent: 'center',
|
|
8
|
+
display: 'flex',
|
|
9
|
+
cursor: 'pointer',
|
|
10
|
+
}, ...props, children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: props.fill || '#4C5462', width: "20", height: "20", children: _jsx("path", { fillRule: "evenodd", d: "M5.47 5.47a.75.75 0 011.06 0L12 10.94l5.47-5.47a.75.75 0 111.06 1.06L13.06 12l5.47 5.47a.75.75 0 11-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 01-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 010-1.06z", clipRule: "evenodd" }) }) }));
|
|
11
|
+
}
|