@quillsql/react 1.6.0 → 1.6.3
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/AddToDashboardButton.d.ts +1 -0
- package/lib/AddToDashboardButton.js +2 -0
- package/lib/AddToDashboardButton.js.map +1 -0
- package/lib/AddToDashboardModal.d.ts +22 -0
- package/lib/AddToDashboardModal.js +638 -0
- package/lib/AddToDashboardModal.js.map +1 -0
- package/lib/BarList.js +28 -28
- package/lib/BarList.js.map +1 -1
- package/lib/Chart.js +30 -114
- package/lib/Chart.js.map +1 -1
- package/lib/Context.d.ts +3 -3
- package/lib/Context.js +3 -3
- package/lib/Context.js.map +1 -1
- package/lib/Dashboard.js +31 -16
- package/lib/Dashboard.js.map +1 -1
- package/lib/Dialog.d.ts +68 -0
- package/lib/Dialog.js +407 -0
- package/lib/Dialog.js.map +1 -0
- package/lib/Portal.d.ts +32 -0
- package/lib/Portal.js +171 -0
- package/lib/Portal.js.map +1 -0
- package/lib/Props.d.ts +0 -0
- package/lib/Props.js +2 -0
- package/lib/Props.js.map +1 -0
- package/lib/QuillProvider.d.ts +32 -14
- package/lib/QuillProvider.js +15 -2
- package/lib/QuillProvider.js.map +1 -1
- package/lib/ReportBuilder.d.ts +26 -2
- package/lib/ReportBuilder.js +220 -492
- package/lib/ReportBuilder.js.map +1 -1
- package/lib/SQLEditor.d.ts +35 -1
- package/lib/SQLEditor.js +264 -211
- package/lib/SQLEditor.js.map +1 -1
- package/lib/Table.js +2 -10
- package/lib/Table.js.map +1 -1
- package/lib/components/BigModal/BigModal.d.ts +14 -0
- package/lib/components/BigModal/BigModal.js +85 -0
- package/lib/components/BigModal/BigModal.js.map +1 -0
- package/lib/components/BigModal/Modal.d.ts +14 -0
- package/lib/components/BigModal/Modal.js +109 -0
- package/lib/components/BigModal/Modal.js.map +1 -0
- package/lib/components/Modal/Modal.d.ts +1 -1
- package/lib/hooks/useQuill.js +14 -24
- package/lib/hooks/useQuill.js.map +1 -1
- package/lib/hooks/useSyncRefs.d.ts +5 -0
- package/lib/hooks/useSyncRefs.js +38 -0
- package/lib/hooks/useSyncRefs.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/types/Props.d.ts +0 -0
- package/lib/types/Props.js +2 -0
- package/lib/types/Props.js.map +1 -0
- package/lib/types.d.ts +27 -0
- package/lib/types.js +6 -0
- package/lib/types.js.map +1 -0
- package/package.json +2 -1
- package/src/AddToDashboardModal.tsx +1213 -0
- package/src/BarList.tsx +28 -28
- package/src/Chart.tsx +31 -107
- package/src/Context.tsx +8 -5
- package/src/Dashboard.tsx +29 -2
- package/src/QuillProvider.tsx +52 -10
- package/src/ReportBuilder.tsx +433 -652
- package/src/SQLEditor.tsx +578 -235
- package/src/Table.tsx +9 -21
- package/src/components/BigModal/BigModal.tsx +108 -0
- package/src/components/Modal/Modal.tsx +1 -1
- package/src/continue_logs.txt +75 -0
- package/src/hooks/useQuill.ts +2 -16
- package/src/index.ts +1 -0
package/lib/SQLEditor.js
CHANGED
|
@@ -46,13 +46,15 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
49
|
-
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
import { useState, useContext, useEffect } from 'react';
|
|
50
52
|
import MonacoEditor from '@monaco-editor/react';
|
|
51
53
|
// import './nightOwlLight.css';
|
|
52
54
|
import axios from 'axios';
|
|
53
55
|
import { TailSpin } from 'react-loader-spinner';
|
|
54
56
|
import { ClientContext, SchemaContext, ThemeContext } from './Context';
|
|
55
|
-
import { ChevronDownIcon, ChevronRightIcon,
|
|
57
|
+
import { ChevronDownIcon, ChevronRightIcon, } from '@heroicons/react/20/solid';
|
|
56
58
|
export function convertPostgresColumn(column) {
|
|
57
59
|
var format;
|
|
58
60
|
switch (column.dataTypeID) {
|
|
@@ -107,9 +109,49 @@ function setEditorTheme(editor, monaco) {
|
|
|
107
109
|
console.log('ERROR: ', e);
|
|
108
110
|
}
|
|
109
111
|
}
|
|
112
|
+
var QuillButton = function (_a) {
|
|
113
|
+
var onClick = _a.onClick, label = _a.label, theme = _a.theme, secondary = _a.secondary;
|
|
114
|
+
return (_jsx("button", __assign({ style: {
|
|
115
|
+
borderRadius: '6px',
|
|
116
|
+
backgroundColor: secondary
|
|
117
|
+
? (theme === null || theme === void 0 ? void 0 : theme.secondaryButtonColor) || '#FFFFFF'
|
|
118
|
+
: theme === null || theme === void 0 ? void 0 : theme.primaryButtonColor,
|
|
119
|
+
opacity: 1,
|
|
120
|
+
paddingLeft: '16px',
|
|
121
|
+
paddingRight: '16px',
|
|
122
|
+
paddingTop: '10px',
|
|
123
|
+
paddingBottom: '10px',
|
|
124
|
+
fontSize: '14px',
|
|
125
|
+
fontWeight: 600,
|
|
126
|
+
color: secondary ? theme === null || theme === void 0 ? void 0 : theme.primaryTextColor : '#FFFFFF',
|
|
127
|
+
cursor: 'pointer',
|
|
128
|
+
outline: 'none',
|
|
129
|
+
border: 'none',
|
|
130
|
+
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
131
|
+
}, onClick: onClick }, { children: label })));
|
|
132
|
+
};
|
|
133
|
+
var QuillTextInput = function (_a) {
|
|
134
|
+
var onChange = _a.onChange, value = _a.value, id = _a.id, placeholder = _a.placeholder, theme = _a.theme;
|
|
135
|
+
return (_jsx("input", { style: {
|
|
136
|
+
display: 'flex',
|
|
137
|
+
flexDirection: 'row',
|
|
138
|
+
alignItems: 'center',
|
|
139
|
+
paddingLeft: '12px',
|
|
140
|
+
paddingRight: '12px',
|
|
141
|
+
fontWeight: 'medium',
|
|
142
|
+
height: 36,
|
|
143
|
+
boxShadow: 'rgba(0, 0, 0, 0.1) 0px 1px 5px 0px',
|
|
144
|
+
width: '445px',
|
|
145
|
+
backgroundColor: (theme === null || theme === void 0 ? void 0 : theme.backgroundColor) || 'white',
|
|
146
|
+
color: theme === null || theme === void 0 ? void 0 : theme.primaryTextColor,
|
|
147
|
+
borderWidth: '1px',
|
|
148
|
+
borderColor: (theme === null || theme === void 0 ? void 0 : theme.borderColor) || '#E7E7E7',
|
|
149
|
+
borderRadius: '6px',
|
|
150
|
+
}, id: id, onChange: onChange, value: value, placeholder: placeholder }));
|
|
151
|
+
};
|
|
110
152
|
export default function QueryEditor(_a) {
|
|
111
153
|
var _this = this;
|
|
112
|
-
var _b = _a.containerStyle, containerStyle = _b === void 0 ? { height: '100vh' } : _b;
|
|
154
|
+
var _b = _a.containerStyle, containerStyle = _b === void 0 ? { height: '100vh' } : _b, ButtonComponent = _a.ButtonComponent, SecondaryButtonComponent = _a.SecondaryButtonComponent, TextInputComponent = _a.TextInputComponent, TableComponent = _a.TableComponent, AddToDashboardButton = _a.AddToDashboardButton, LoadingComponent = _a.LoadingComponent;
|
|
113
155
|
var _c = useState(''), sqlPrompt = _c[0], setSqlPrompt = _c[1];
|
|
114
156
|
var _d = useState(false), isOpen = _d[0], setIsOpen = _d[1];
|
|
115
157
|
var client = useContext(ClientContext)[0];
|
|
@@ -121,6 +163,8 @@ export default function QueryEditor(_a) {
|
|
|
121
163
|
var _j = useContext(SchemaContext), schema = _j[0], setSchema = _j[1];
|
|
122
164
|
var _k = useState(''), errorMessage = _k[0], setErrorMessage = _k[1];
|
|
123
165
|
var _l = useState(false), sqlResponseLoading = _l[0], setSqlResponseLoading = _l[1];
|
|
166
|
+
var _m = useState(false), sqlQueryLoading = _m[0], setSqlQueryLoading = _m[1];
|
|
167
|
+
var _o = useState(false), schemaLoading = _o[0], setSchemaLoading = _o[1];
|
|
124
168
|
useEffect(function () {
|
|
125
169
|
var isSubscribed = true;
|
|
126
170
|
function getSchema() {
|
|
@@ -130,6 +174,7 @@ export default function QueryEditor(_a) {
|
|
|
130
174
|
switch (_a.label) {
|
|
131
175
|
case 0:
|
|
132
176
|
publicKey = client.publicKey, environment = client.environment;
|
|
177
|
+
setSchemaLoading(true);
|
|
133
178
|
return [4 /*yield*/, axios.get("https://quill-344421.uc.r.appspot.com/schema2/".concat(publicKey, "/"), {
|
|
134
179
|
headers: {
|
|
135
180
|
Authorization: "Bearer ",
|
|
@@ -140,6 +185,7 @@ export default function QueryEditor(_a) {
|
|
|
140
185
|
response3 = _a.sent();
|
|
141
186
|
if (isSubscribed) {
|
|
142
187
|
setSchema(response3.data.tables);
|
|
188
|
+
setSchemaLoading(false);
|
|
143
189
|
}
|
|
144
190
|
return [2 /*return*/];
|
|
145
191
|
}
|
|
@@ -178,54 +224,64 @@ export default function QueryEditor(_a) {
|
|
|
178
224
|
});
|
|
179
225
|
}); };
|
|
180
226
|
var handleRunQuery = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
181
|
-
var publicKey, customerId, environment, response, e_1;
|
|
227
|
+
var publicKey, customerId, environment, queryEndpoint, queryHeaders, response, e_1;
|
|
182
228
|
return __generator(this, function (_a) {
|
|
183
229
|
switch (_a.label) {
|
|
184
230
|
case 0:
|
|
185
|
-
publicKey = client.publicKey, customerId = client.customerId, environment = client.environment;
|
|
231
|
+
publicKey = client.publicKey, customerId = client.customerId, environment = client.environment, queryEndpoint = client.queryEndpoint, queryHeaders = client.queryHeaders;
|
|
186
232
|
_a.label = 1;
|
|
187
233
|
case 1:
|
|
188
|
-
_a.trys.push([1,
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
orgId: customerId,
|
|
194
|
-
publicKey: publicKey,
|
|
195
|
-
},
|
|
196
|
-
headers: {
|
|
197
|
-
Authorization: "Bearer ",
|
|
198
|
-
environment: environment || undefined,
|
|
199
|
-
},
|
|
200
|
-
})];
|
|
234
|
+
_a.trys.push([1, 6, , 7]);
|
|
235
|
+
response = void 0;
|
|
236
|
+
setSqlQueryLoading(true);
|
|
237
|
+
if (!queryEndpoint) return [3 /*break*/, 3];
|
|
238
|
+
return [4 /*yield*/, axios.post(queryEndpoint, { metadata: { query: query, task: 'query' } }, { headers: queryHeaders })];
|
|
201
239
|
case 2:
|
|
202
240
|
response = _a.sent();
|
|
241
|
+
return [3 /*break*/, 5];
|
|
242
|
+
case 3: return [4 /*yield*/, axios.post("https://quill-344421.uc.r.appspot.com/dashquery", {
|
|
243
|
+
query: query,
|
|
244
|
+
}, {
|
|
245
|
+
params: {
|
|
246
|
+
orgId: customerId,
|
|
247
|
+
publicKey: publicKey,
|
|
248
|
+
},
|
|
249
|
+
headers: {
|
|
250
|
+
Authorization: "Bearer ",
|
|
251
|
+
environment: environment || undefined,
|
|
252
|
+
},
|
|
253
|
+
})];
|
|
254
|
+
case 4:
|
|
255
|
+
response = _a.sent();
|
|
256
|
+
_a.label = 5;
|
|
257
|
+
case 5:
|
|
203
258
|
if (response && response.data && response.data.errorMessage) {
|
|
259
|
+
setSqlQueryLoading(false);
|
|
204
260
|
setErrorMessage('Failed to run SQL query: ' + response.data.errorMessage);
|
|
205
261
|
setRows([]);
|
|
206
262
|
setColumns([]);
|
|
207
263
|
setFields([]);
|
|
208
264
|
return [2 /*return*/];
|
|
209
265
|
}
|
|
266
|
+
setSqlQueryLoading(false);
|
|
210
267
|
setErrorMessage('');
|
|
211
|
-
setRows(response.data.rows
|
|
268
|
+
setRows(response.data.rows && response.data.rows.length
|
|
269
|
+
? response.data.rows
|
|
270
|
+
: []);
|
|
212
271
|
setColumns(response.data.fields.map(function (elem) { return convertPostgresColumn(elem); }));
|
|
213
272
|
setFields(response.data.fields);
|
|
214
|
-
return [3 /*break*/,
|
|
215
|
-
case
|
|
273
|
+
return [3 /*break*/, 7];
|
|
274
|
+
case 6:
|
|
216
275
|
e_1 = _a.sent();
|
|
217
276
|
console.log('ERROR: ', e_1);
|
|
218
277
|
return [2 /*return*/];
|
|
219
|
-
case
|
|
278
|
+
case 7: return [2 /*return*/];
|
|
220
279
|
}
|
|
221
280
|
});
|
|
222
281
|
}); };
|
|
223
282
|
var handleAddToDashboard = function () {
|
|
224
283
|
setIsOpen(true);
|
|
225
284
|
};
|
|
226
|
-
var newRows = useMemo(function () {
|
|
227
|
-
return JSON.parse(JSON.stringify(rows));
|
|
228
|
-
}, [rows]);
|
|
229
285
|
/* all your useState and useContext calls and your useEffect hooks */
|
|
230
286
|
var downloadCSV = function () {
|
|
231
287
|
// report.rows
|
|
@@ -269,7 +325,7 @@ export default function QueryEditor(_a) {
|
|
|
269
325
|
display: 'flex',
|
|
270
326
|
height: '100%',
|
|
271
327
|
flexDirection: 'row',
|
|
272
|
-
} }, { children: [_jsx(SchemaListComponent, { schema: schema, theme: theme }), _jsxs("div", __assign({ style: {
|
|
328
|
+
} }, { children: [_jsx(SchemaListComponent, { schema: schema, theme: theme, LoadingComponent: LoadingComponent, loading: schemaLoading }), _jsxs("div", __assign({ style: {
|
|
273
329
|
display: 'flex',
|
|
274
330
|
flexDirection: 'column',
|
|
275
331
|
width: 'calc(100% - 250px)',
|
|
@@ -280,79 +336,7 @@ export default function QueryEditor(_a) {
|
|
|
280
336
|
display: 'flex',
|
|
281
337
|
flexDirection: 'row',
|
|
282
338
|
alignItems: 'center',
|
|
283
|
-
} }, { children: [_jsxs("div", __assign({ style: {
|
|
284
|
-
display: 'flex',
|
|
285
|
-
flexDirection: 'row',
|
|
286
|
-
alignItems: 'center',
|
|
287
|
-
paddingLeft: '12px',
|
|
288
|
-
paddingRight: '12px',
|
|
289
|
-
height: 38,
|
|
290
|
-
boxShadow: 'rgba(0, 0, 0, 0.1) 0px 1px 5px 0px',
|
|
291
|
-
width: '445px',
|
|
292
|
-
// TODO: change color
|
|
293
|
-
borderColor: theme.borderColor,
|
|
294
|
-
color: theme.primaryTextColor,
|
|
295
|
-
borderWidth: '1px',
|
|
296
|
-
// TODO: change color
|
|
297
|
-
backgroundColor: 'white',
|
|
298
|
-
borderRadius: 6,
|
|
299
|
-
borderStyle: 'solid',
|
|
300
|
-
outline: 'none',
|
|
301
|
-
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
302
|
-
} }, { children: [_jsx(MagnifyingGlassIcon, { style: {
|
|
303
|
-
height: 16,
|
|
304
|
-
width: 16,
|
|
305
|
-
color: theme.secondaryTextColor,
|
|
306
|
-
}, "aria-hidden": "true" }), _jsx("input", { value: sqlPrompt, onChange: function (e) { return setSqlPrompt(e.target.value); }, style: {
|
|
307
|
-
outline: 'none',
|
|
308
|
-
marginLeft: 8,
|
|
309
|
-
width: '100%',
|
|
310
|
-
border: 'none',
|
|
311
|
-
outline: 'none',
|
|
312
|
-
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
313
|
-
} })] })), _jsx("button", __assign({ onClick: handleRunSqlPrompt, style: {
|
|
314
|
-
// TODO: change color
|
|
315
|
-
background: theme.primaryButtonColor,
|
|
316
|
-
// TODO: change color
|
|
317
|
-
color: theme.backgroundColor,
|
|
318
|
-
height: 38,
|
|
319
|
-
paddingLeft: 10,
|
|
320
|
-
paddingRight: 12,
|
|
321
|
-
width: 87,
|
|
322
|
-
minWidth: 87,
|
|
323
|
-
maxWidth: 87,
|
|
324
|
-
marginLeft: 12,
|
|
325
|
-
fontWeight: '400',
|
|
326
|
-
borderRadius: '0.375rem',
|
|
327
|
-
border: 'none',
|
|
328
|
-
outline: 'none',
|
|
329
|
-
cursor: 'pointer',
|
|
330
|
-
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
331
|
-
} }, { children: sqlResponseLoading ? (_jsx("div", __assign({ style: {
|
|
332
|
-
display: 'flex',
|
|
333
|
-
flexDirection: 'row',
|
|
334
|
-
alignItems: 'center',
|
|
335
|
-
width: '100%',
|
|
336
|
-
height: '100%',
|
|
337
|
-
justifyContent: 'center',
|
|
338
|
-
} }, { children: _jsx(TailSpin, { height: "20", width: "20",
|
|
339
|
-
// TODO: change color
|
|
340
|
-
color: theme.backgroundColor, ariaLabel: "loading-indicator" }) }))) : (_jsxs("div", __assign({ style: {
|
|
341
|
-
display: 'flex',
|
|
342
|
-
flexDirection: 'row',
|
|
343
|
-
alignItems: 'center',
|
|
344
|
-
} }, { children: [_jsx(SparklesIcon, { style: {
|
|
345
|
-
height: 12,
|
|
346
|
-
width: 12,
|
|
347
|
-
marginRight: 4,
|
|
348
|
-
// TODO: change color
|
|
349
|
-
color: theme.backgroundColor,
|
|
350
|
-
}, "aria-hidden": "true" }), _jsx("div", __assign({ style: {
|
|
351
|
-
fontSize: 14,
|
|
352
|
-
fontWeight: 600,
|
|
353
|
-
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
354
|
-
color: theme.backgroundColor,
|
|
355
|
-
} }, { children: "Ask AI" }))] }))) }))] })), _jsx("div", __assign({ style: { height: 'calc(50% - 40px)' } }, { children: _jsx(SQLEditorComponent, { query: query, setQuery: setQuery, handleRunQuery: handleRunQuery, theme: theme, defineEditorTheme: defineEditorTheme, setEditorTheme: setEditorTheme }) })), _jsxs("div", __assign({ style: {
|
|
339
|
+
} }, { children: [_jsx("div", __assign({ style: { minWidth: 440, marginRight: 10 } }, { children: (TextInputComponent && (_jsx(TextInputComponent, { id: "ai-search", value: sqlPrompt, onChange: function (e) { return setSqlPrompt(e.target.value); }, placeholder: "Ask a question..." }))) || (_jsx(QuillTextInput, { id: "ai-search", value: sqlPrompt, onChange: function (e) { return setSqlPrompt(e.target.value); }, placeholder: "Ask a question...", theme: theme })) })), (ButtonComponent && (_jsx(ButtonComponent, { onClick: handleRunSqlPrompt, label: "Ask AI" }))) || (_jsx(QuillButton, { theme: theme, onClick: handleRunSqlPrompt, label: "Ask AI" }))] })), _jsx("div", __assign({ style: { height: 'calc(50% - 40px)' } }, { children: _jsx(SQLEditorComponent, { query: query, setQuery: setQuery, handleRunQuery: handleRunQuery, theme: theme, defineEditorTheme: defineEditorTheme, setEditorTheme: setEditorTheme, ButtonComponent: ButtonComponent, loading: sqlResponseLoading, LoadingComponent: LoadingComponent }) })), _jsxs("div", __assign({ style: {
|
|
356
340
|
height: 'calc(50% - 40px)',
|
|
357
341
|
display: 'flex',
|
|
358
342
|
flexDirection: 'column',
|
|
@@ -361,8 +345,8 @@ export default function QueryEditor(_a) {
|
|
|
361
345
|
border: 'none',
|
|
362
346
|
outline: 'none',
|
|
363
347
|
} }, { children: [errorMessage && (_jsx("div", __assign({ style: {
|
|
364
|
-
fontFamily: theme.fontFamily,
|
|
365
|
-
color: theme.primaryTextColor,
|
|
348
|
+
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
349
|
+
color: theme === null || theme === void 0 ? void 0 : theme.primaryTextColor,
|
|
366
350
|
fontSize: 15,
|
|
367
351
|
fontWeight: '400',
|
|
368
352
|
} }, { children: _jsx("div", __assign({ style: {
|
|
@@ -372,105 +356,39 @@ export default function QueryEditor(_a) {
|
|
|
372
356
|
display: 'inline-block',
|
|
373
357
|
flex: 0,
|
|
374
358
|
borderRadius: 6,
|
|
359
|
+
color: theme === null || theme === void 0 ? void 0 : theme.primaryTextColor,
|
|
375
360
|
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
376
|
-
} }, { children: errorMessage })) }))),
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
margin: 0,
|
|
381
|
-
border: 'none',
|
|
382
|
-
outline: 'none',
|
|
383
|
-
} }, { children: _jsxs("table", __assign({ style: {
|
|
384
|
-
padding: 0,
|
|
385
|
-
margin: 0,
|
|
386
|
-
border: 'none',
|
|
387
|
-
outline: 'none',
|
|
388
|
-
borderSpacing: 0,
|
|
389
|
-
} }, { children: [_jsx("thead", __assign({ style: {
|
|
390
|
-
position: 'sticky',
|
|
391
|
-
// TODO: change color
|
|
392
|
-
background: theme.backgroundColor,
|
|
393
|
-
top: 0,
|
|
394
|
-
height: 37,
|
|
395
|
-
minHeight: 37,
|
|
396
|
-
maxHeight: 37,
|
|
397
|
-
} }, { children: _jsx("tr", __assign({ style: {
|
|
398
|
-
outline: 'none',
|
|
399
|
-
border: 'none',
|
|
400
|
-
padding: 0,
|
|
401
|
-
margin: 0,
|
|
402
|
-
} }, { children: columns.map(function (column, index) { return (_jsx("th", __assign({ scope: "col", style: {
|
|
403
|
-
textAlign: 'left',
|
|
404
|
-
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
405
|
-
fontSize: 13,
|
|
406
|
-
height: 37,
|
|
407
|
-
minHeight: 37,
|
|
408
|
-
maxHeight: 37,
|
|
409
|
-
paddingLeft: 12,
|
|
410
|
-
paddingRight: 12,
|
|
411
|
-
paddingTop: 0,
|
|
412
|
-
paddingBottom: 0,
|
|
413
|
-
margin: 0,
|
|
414
|
-
fontWeight: '500',
|
|
415
|
-
// TODO: change color
|
|
416
|
-
boxShadow: "inset 0 -1px 0 ".concat(theme.borderColor),
|
|
417
|
-
// TODO: change color
|
|
418
|
-
color: theme.primaryTextColor,
|
|
419
|
-
outline: 'none',
|
|
420
|
-
border: 'none',
|
|
421
|
-
} }, { children: column.label }), index)); }) })) })), _jsx("tbody", __assign({ style: {
|
|
422
|
-
// TODO: change color
|
|
423
|
-
backgroundColor: theme.backgroundColor,
|
|
424
|
-
} }, { children: newRows.map(function (row, rowIndex) { return (_jsx("tr", { children: columns.map(function (column, columnIndex) { return (_jsx("td", __assign({ style: {
|
|
425
|
-
padding: 12,
|
|
426
|
-
whiteSpace: 'nowrap',
|
|
427
|
-
fontSize: 13,
|
|
428
|
-
color: theme.secondaryTextColor,
|
|
429
|
-
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
430
|
-
// TODO: change color
|
|
431
|
-
// borderBottom: `1px solid ${theme.borderColor} !important`,
|
|
432
|
-
boxShadow: "inset 0 -1px 0 ".concat(theme.borderColor),
|
|
433
|
-
outline: 'none',
|
|
434
|
-
} }, { children: typeof row[column.field] === 'object'
|
|
435
|
-
? JSON.stringify(row[column.field]).length > 55
|
|
436
|
-
? JSON.stringify(row[column.field]).substring(0, 52) + '...'
|
|
437
|
-
: JSON.stringify(row[column.field])
|
|
438
|
-
: row[column.field].length > 55
|
|
439
|
-
? row[column.field].substring(0, 52) + '...'
|
|
440
|
-
: row[column.field] }), columnIndex)); }) }, rowIndex)); }) }))] })) })), _jsx("div", __assign({ style: {
|
|
441
|
-
height: 60,
|
|
361
|
+
} }, { children: errorMessage })) }))), errorMessage
|
|
362
|
+
? null
|
|
363
|
+
: (TableComponent && (_jsx(TableComponent, { rows: rows, columns: columns, height: "calc(100% - 70px)" }))) || (_jsx(SpecialTable, { rows: rows, columns: columns, height: "calc(100% - 70px)", LoadingComponent: LoadingComponent, loading: sqlQueryLoading })), _jsx("div", __assign({ style: {
|
|
364
|
+
height: 70,
|
|
442
365
|
// TODO: change color
|
|
443
|
-
background: theme.backgroundColor,
|
|
366
|
+
background: theme === null || theme === void 0 ? void 0 : theme.backgroundColor,
|
|
444
367
|
} }, { children: rows.length ? (_jsxs("div", __assign({ style: {
|
|
445
368
|
display: 'flex',
|
|
446
369
|
flexDirection: 'column',
|
|
447
|
-
height:
|
|
370
|
+
height: 70,
|
|
448
371
|
border: 'none',
|
|
449
372
|
} }, { children: [_jsx("div", { style: {
|
|
450
373
|
height: 1,
|
|
374
|
+
width: '100%',
|
|
451
375
|
// TODO: change color
|
|
452
|
-
background: theme.borderColor,
|
|
453
|
-
} }), _jsxs("div", __assign({ style: {
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
fontFamily: theme.fontFamily,
|
|
466
|
-
outline: 'none',
|
|
467
|
-
border: 'none',
|
|
468
|
-
cursor: 'pointer',
|
|
469
|
-
marginTop: 14,
|
|
470
|
-
} }, { children: "Download CSV" })), _jsx("div", {})] }))] }))) : null }))] }))] }))] })) })) })) })));
|
|
376
|
+
// background: theme.borderColor,
|
|
377
|
+
} }), _jsxs("div", __assign({ style: {
|
|
378
|
+
marginLeft: 0,
|
|
379
|
+
height: 69,
|
|
380
|
+
display: 'flex',
|
|
381
|
+
alignItems: 'center',
|
|
382
|
+
justifyContent: 'flex-end',
|
|
383
|
+
paddingRight: 20,
|
|
384
|
+
} }, { children: [(SecondaryButtonComponent && (_jsx(SecondaryButtonComponent, { onClick: downloadCSV, label: "Download CSV" }))) || (_jsx(QuillButton, { theme: theme, onClick: downloadCSV, label: "Download CSV", secondary: true })), AddToDashboardButton && _jsx("div", { style: { width: 10 } }), AddToDashboardButton && (_jsx(AddToDashboardButton
|
|
385
|
+
// @ts-ignore
|
|
386
|
+
, {
|
|
387
|
+
// @ts-ignore
|
|
388
|
+
rows: rows, columns: columns, query: query })), _jsx("div", {})] }))] }))) : null }))] }))] }))] })) })) })) })));
|
|
471
389
|
}
|
|
472
390
|
var SQLEditorComponent = function (_a) {
|
|
473
|
-
var query = _a.query, setQuery = _a.setQuery, handleRunQuery = _a.handleRunQuery, theme = _a.theme, defineEditorTheme = _a.defineEditorTheme, setEditorTheme = _a.setEditorTheme;
|
|
391
|
+
var query = _a.query, setQuery = _a.setQuery, handleRunQuery = _a.handleRunQuery, theme = _a.theme, defineEditorTheme = _a.defineEditorTheme, setEditorTheme = _a.setEditorTheme, ButtonComponent = _a.ButtonComponent, theme = _a.theme, loading = _a.loading, LoadingComponent = _a.LoadingComponent;
|
|
474
392
|
return (_jsxs("div", __assign({ style: {
|
|
475
393
|
background: theme.backgroundColor,
|
|
476
394
|
// maxHeight: 700,
|
|
@@ -485,38 +403,173 @@ var SQLEditorComponent = function (_a) {
|
|
|
485
403
|
borderTopRightRadius: 0,
|
|
486
404
|
borderBottomRightRadius: 0,
|
|
487
405
|
overflow: 'hidden',
|
|
488
|
-
} }, { children: [
|
|
406
|
+
} }, { children: [loading ? (_jsxs("div", __assign({ style: {
|
|
407
|
+
height: 'calc(100% - 70px)',
|
|
408
|
+
width: '100%',
|
|
409
|
+
display: 'flex',
|
|
410
|
+
alignItems: 'center',
|
|
411
|
+
justifyContent: 'center',
|
|
412
|
+
background: '#F9F9F9',
|
|
413
|
+
} }, { children: [LoadingComponent && _jsx(LoadingComponent, {}), !LoadingComponent && (_jsx(TailSpin, { height: 36, width: 36, color: "#364153" }))] }))) : (_jsx(MonacoEditor, { height: "calc(100% - 70px)", width: "100%", defaultLanguage: "pgsql", defaultValue: "", value: query, loading: _jsx("div", {}), options: {
|
|
489
414
|
wordWrap: 'on',
|
|
490
415
|
minimap: {
|
|
491
416
|
enabled: false,
|
|
492
417
|
},
|
|
493
418
|
padding: { top: 16 },
|
|
494
|
-
}, onChange: function (query) { return setQuery(query); }, beforeMount: function (monaco) { return defineEditorTheme(monaco, theme); }, onMount: setEditorTheme }), _jsx("div", __assign({ style: {
|
|
419
|
+
}, onChange: function (query) { return setQuery(query); }, beforeMount: function (monaco) { return defineEditorTheme(monaco, theme); }, onMount: setEditorTheme })), _jsx("div", __assign({ style: {
|
|
495
420
|
display: 'flex',
|
|
496
421
|
flexDirection: 'row',
|
|
497
422
|
alignItems: 'center',
|
|
498
|
-
height:
|
|
499
|
-
} }, { children: _jsx(
|
|
500
|
-
borderRadius: 6,
|
|
501
|
-
backgroundColor: theme.primaryButtonColor,
|
|
502
|
-
height: 32,
|
|
503
|
-
width: 100,
|
|
504
|
-
marginLeft: 0,
|
|
505
|
-
// paddingLeft: '1rem',
|
|
506
|
-
// paddingRight: '1rem',
|
|
507
|
-
// paddingTop: '0.5rem',
|
|
508
|
-
// paddingBottom: '0.5rem',
|
|
509
|
-
fontSize: '0.875rem',
|
|
510
|
-
fontWeight: '600',
|
|
511
|
-
color: theme.backgroundColor,
|
|
512
|
-
fontFamily: theme.fontFamily,
|
|
513
|
-
outline: 'none',
|
|
514
|
-
border: 'none',
|
|
515
|
-
cursor: 'pointer',
|
|
516
|
-
} }, { children: "Run query" })) }))] })));
|
|
423
|
+
height: 70,
|
|
424
|
+
} }, { children: (ButtonComponent && (_jsx(ButtonComponent, { onClick: handleRunQuery, label: "Run query" }))) || (_jsx(QuillButton, { onClick: handleRunQuery, label: "Run query", theme: theme })) }))] })));
|
|
517
425
|
};
|
|
426
|
+
var styles = {
|
|
427
|
+
columnHeader: {
|
|
428
|
+
boxSizing: 'border-box',
|
|
429
|
+
flex: '150 0 auto',
|
|
430
|
+
minWidth: '50px',
|
|
431
|
+
width: '150px',
|
|
432
|
+
position: 'relative',
|
|
433
|
+
cursor: 'pointer',
|
|
434
|
+
background: 'rgb(249, 250, 251)',
|
|
435
|
+
borderRight: '1px solid rgb(229, 231, 235)',
|
|
436
|
+
whiteSpace: 'nowrap',
|
|
437
|
+
display: 'flex',
|
|
438
|
+
alignItems: 'center',
|
|
439
|
+
overflowX: 'visible',
|
|
440
|
+
margin: '0px',
|
|
441
|
+
textOverflow: 'ellipsis',
|
|
442
|
+
minHeight: '36px', // 2.25rem * 16px = 36px
|
|
443
|
+
},
|
|
444
|
+
columnHeaderLabel: {
|
|
445
|
+
fontFamily: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',
|
|
446
|
+
WebkitTapHighlightColor: 'transparent',
|
|
447
|
+
color: 'rgb(55, 65, 81)',
|
|
448
|
+
textDecoration: 'none',
|
|
449
|
+
fontWeight: 500,
|
|
450
|
+
fontSize: '14px',
|
|
451
|
+
lineHeight: '20px',
|
|
452
|
+
textOverflow: 'ellipsis',
|
|
453
|
+
whiteSpace: 'nowrap',
|
|
454
|
+
overflow: 'hidden',
|
|
455
|
+
},
|
|
456
|
+
};
|
|
457
|
+
export function SpecialTable(_a) {
|
|
458
|
+
var columns = _a.columns, rows = _a.rows, height = _a.height, containerStyle = _a.containerStyle, loading = _a.loading, LoadingComponent = _a.LoadingComponent;
|
|
459
|
+
if (loading) {
|
|
460
|
+
return (_jsx("div", __assign({ style: __assign(__assign({}, containerStyle), {
|
|
461
|
+
// paddingLeft: 25,
|
|
462
|
+
// paddingRight: 25,
|
|
463
|
+
// borderRadius: 8,
|
|
464
|
+
// marginTop: 25,
|
|
465
|
+
// overflow: 'visible',
|
|
466
|
+
width: '100%', height: height }) }, { children: _jsxs("div", __assign({ style: {
|
|
467
|
+
height: '100%',
|
|
468
|
+
overflow: 'scroll',
|
|
469
|
+
borderRadius: 6,
|
|
470
|
+
border: '1px solid rgb(229, 231, 235)',
|
|
471
|
+
padding: 0,
|
|
472
|
+
margin: 0,
|
|
473
|
+
// border: 'none',
|
|
474
|
+
boxSizing: 'border-box',
|
|
475
|
+
outline: 'none',
|
|
476
|
+
display: 'flex',
|
|
477
|
+
flexDirection: 'column',
|
|
478
|
+
justifyContent: 'center',
|
|
479
|
+
alignItems: 'center',
|
|
480
|
+
// maxHeight: 600,
|
|
481
|
+
} }, { children: [LoadingComponent && _jsx(LoadingComponent, {}), !LoadingComponent && (_jsx(TailSpin, { height: 36, width: 36, color: "#364153" }))] })) })));
|
|
482
|
+
}
|
|
483
|
+
if (!columns || !columns.length) {
|
|
484
|
+
return null;
|
|
485
|
+
}
|
|
486
|
+
return (_jsx("div", __assign({ style: __assign(__assign({}, containerStyle), {
|
|
487
|
+
// paddingLeft: 25,
|
|
488
|
+
// paddingRight: 25,
|
|
489
|
+
// borderRadius: 8,
|
|
490
|
+
// marginTop: 25,
|
|
491
|
+
overflow: 'visible', height: height }) }, { children: _jsx("div", __assign({ style: {
|
|
492
|
+
height: '100%',
|
|
493
|
+
overflow: 'scroll',
|
|
494
|
+
borderRadius: 6,
|
|
495
|
+
border: '1px solid rgb(229, 231, 235)',
|
|
496
|
+
padding: 0,
|
|
497
|
+
margin: 0,
|
|
498
|
+
// border: 'none',
|
|
499
|
+
boxSizing: 'border-box',
|
|
500
|
+
outline: 'none',
|
|
501
|
+
// maxHeight: 600,
|
|
502
|
+
} }, { children: _jsxs("div", __assign({ role: "table", className: "table", style: { minWidth: '0px' } }, { children: [_jsx("div", __assign({ className: "thead" }, { children: _jsx("div", __assign({ role: "row", className: "tr", style: {
|
|
503
|
+
display: 'flex',
|
|
504
|
+
flex: '1 0 auto',
|
|
505
|
+
minWidth: '100px',
|
|
506
|
+
boxSizing: 'border-box',
|
|
507
|
+
} }, { children: columns.map(function (column, index) { return (_jsxs("div", __assign({
|
|
508
|
+
// @ts-ignore
|
|
509
|
+
style: styles.columnHeader }, { children: [_jsx("div", { style: { width: 16 } }), _jsx("div", __assign({ "aria-haspopup": "dialog", "aria-expanded": "false", "aria-controls": "mantine-r6-dropdown",
|
|
510
|
+
// @ts-ignore
|
|
511
|
+
style: styles.columnHeaderLabel }, { children: column.label }))] }), 'sqlcol' + index)); }) })) })), _jsx("div", __assign({ role: "rowgroup", className: "tbody" }, { children: rows.map(function (row, rowIndex) { return (_jsx("div", __assign({ role: "row", className: "tr", style: {
|
|
512
|
+
display: 'flex',
|
|
513
|
+
flex: '1 0 auto',
|
|
514
|
+
minWidth: '100px',
|
|
515
|
+
boxSizing: 'border-box',
|
|
516
|
+
} }, { children: columns.map(function (column, columnIndex) { return (_jsx("div", __assign({ role: "cell", className: "td airplane-1h7muk6", style: {
|
|
517
|
+
boxSizing: 'border-box',
|
|
518
|
+
flex: '150 0 auto',
|
|
519
|
+
minWidth: '50px',
|
|
520
|
+
width: '150px',
|
|
521
|
+
display: 'flex',
|
|
522
|
+
margin: '0px',
|
|
523
|
+
textOverflow: 'ellipsis',
|
|
524
|
+
minHeight: '36px',
|
|
525
|
+
borderRight: '1px solid rgb(229, 231, 235)',
|
|
526
|
+
overflow: 'hidden',
|
|
527
|
+
borderTop: '1px solid rgb(229, 231, 235)',
|
|
528
|
+
} }, { children: _jsx("div", __assign({ style: {
|
|
529
|
+
lineHeight: '1.5rem',
|
|
530
|
+
width: '100%',
|
|
531
|
+
display: 'flex',
|
|
532
|
+
cursor: 'default',
|
|
533
|
+
position: 'relative',
|
|
534
|
+
}, className: "airplane-gowkln", "data-testid": "static-cell" }, { children: _jsx("div", __assign({ className: "airplane-Text-root airplane-mzqt6k", "aria-haspopup": "dialog", "aria-expanded": "false", "aria-controls": "mantine-r8-dropdown", id: "mantine-r8-target", style: {
|
|
535
|
+
fontFamily: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',
|
|
536
|
+
WebkitTapHighlightColor: 'transparent',
|
|
537
|
+
color: 'rgb(55, 65, 81)',
|
|
538
|
+
textDecoration: 'none',
|
|
539
|
+
fontWeight: 400,
|
|
540
|
+
fontSize: '14px',
|
|
541
|
+
lineHeight: '20px',
|
|
542
|
+
textOverflow: 'ellipsis',
|
|
543
|
+
whiteSpace: 'nowrap',
|
|
544
|
+
overflow: 'hidden',
|
|
545
|
+
padding: '8px 16px',
|
|
546
|
+
} }, { children: typeof row[column.field] === 'object'
|
|
547
|
+
? JSON.stringify(row[column.field]).length > 55
|
|
548
|
+
? JSON.stringify(row[column.field]).substring(0, 52) + '...'
|
|
549
|
+
: JSON.stringify(row[column.field])
|
|
550
|
+
: row[column.field].length > 55
|
|
551
|
+
? row[column.field].substring(0, 52) + '...'
|
|
552
|
+
: row[column.field] })) })) }), 'sqlcell' + columnIndex)); }) }), 'sqlrow' + rowIndex)); }) }))] })) })) })));
|
|
553
|
+
}
|
|
518
554
|
var SchemaListComponent = function (_a) {
|
|
519
|
-
var schema = _a.schema, theme = _a.theme;
|
|
555
|
+
var schema = _a.schema, theme = _a.theme, loading = _a.loading, LoadingComponent = _a.LoadingComponent;
|
|
556
|
+
if (loading) {
|
|
557
|
+
return (_jsxs("div", __assign({ style: {
|
|
558
|
+
background: theme.backgroundColor,
|
|
559
|
+
// maxHeight: 700,
|
|
560
|
+
width: 250,
|
|
561
|
+
minWidth: 250,
|
|
562
|
+
// overflowY: 'scroll',
|
|
563
|
+
height: '100%',
|
|
564
|
+
// maxHeight: "100%",
|
|
565
|
+
paddingLeft: 20,
|
|
566
|
+
paddingRight: 30,
|
|
567
|
+
paddingTop: 40,
|
|
568
|
+
display: 'flex',
|
|
569
|
+
// alignItems: 'center',
|
|
570
|
+
justifyContent: 'center',
|
|
571
|
+
} }, { children: [_jsx("div", { style: { height: 100 } }), LoadingComponent && _jsx(LoadingComponent, {}), !LoadingComponent && (_jsx(TailSpin, { height: 36, width: 36, color: "#364153" }))] })));
|
|
572
|
+
}
|
|
520
573
|
return (_jsx("div", __assign({ style: {
|
|
521
574
|
background: theme.backgroundColor,
|
|
522
575
|
// maxHeight: 700,
|