@quillsql/react 2.11.16 → 2.11.18
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/dist/cjs/Chart.d.ts +109 -42
- package/dist/cjs/Chart.d.ts.map +1 -1
- package/dist/cjs/Chart.js +44 -18
- package/dist/cjs/ChartBuilder.d.ts +204 -30
- package/dist/cjs/ChartBuilder.d.ts.map +1 -1
- package/dist/cjs/ChartBuilder.js +124 -63
- package/dist/cjs/ChartEditor.d.ts +123 -19
- package/dist/cjs/ChartEditor.d.ts.map +1 -1
- package/dist/cjs/ChartEditor.js +47 -15
- package/dist/cjs/Dashboard.d.ts +148 -91
- package/dist/cjs/Dashboard.d.ts.map +1 -1
- package/dist/cjs/Dashboard.js +51 -159
- package/dist/cjs/DateRangePicker/QuillDateRangePicker.d.ts +21 -1
- package/dist/cjs/DateRangePicker/QuillDateRangePicker.d.ts.map +1 -1
- package/dist/cjs/DateRangePicker/QuillDateRangePicker.js +5 -2
- package/dist/cjs/DateRangePicker/dateRangePickerUtils.js +1 -1
- package/dist/cjs/QuillProvider.d.ts +105 -2
- package/dist/cjs/QuillProvider.d.ts.map +1 -1
- package/dist/cjs/QuillProvider.js +59 -0
- package/dist/cjs/ReportBuilder.d.ts +194 -42
- package/dist/cjs/ReportBuilder.d.ts.map +1 -1
- package/dist/cjs/ReportBuilder.js +563 -416
- package/dist/cjs/SQLEditor.d.ts +160 -23
- package/dist/cjs/SQLEditor.d.ts.map +1 -1
- package/dist/cjs/SQLEditor.js +36 -30
- package/dist/cjs/Table.d.ts +119 -15
- package/dist/cjs/Table.d.ts.map +1 -1
- package/dist/cjs/Table.js +37 -6
- package/dist/cjs/TableChart.d.ts.map +1 -1
- package/dist/cjs/TableChart.js +0 -194
- package/dist/cjs/{BarList.d.ts → components/Chart/BarList.d.ts} +1 -1
- package/dist/cjs/components/Chart/BarList.d.ts.map +1 -0
- package/dist/cjs/{BarList.js → components/Chart/BarList.js} +1 -1
- package/dist/cjs/components/Chart/LineChart.d.ts +2 -3
- package/dist/cjs/components/Chart/LineChart.d.ts.map +1 -1
- package/dist/cjs/components/Chart/LineChart.js +3 -3
- package/dist/cjs/components/Chart/PieChart.d.ts.map +1 -0
- package/dist/cjs/{PieChart.js → components/Chart/PieChart.js} +1 -1
- package/dist/cjs/components/Dashboard/ChartComponent.d.ts +2 -1
- package/dist/cjs/components/Dashboard/ChartComponent.d.ts.map +1 -1
- package/dist/cjs/components/Dashboard/ChartComponent.js +6 -7
- package/dist/cjs/components/Dashboard/DashboardFilter.d.ts +22 -0
- package/dist/cjs/components/Dashboard/DashboardFilter.d.ts.map +1 -0
- package/dist/cjs/components/Dashboard/DashboardFilter.js +75 -0
- package/dist/cjs/components/Dashboard/DataLoader.d.ts +1 -1
- package/dist/cjs/components/Dashboard/DataLoader.d.ts.map +1 -1
- package/dist/cjs/components/Dashboard/DataLoader.js +1 -1
- package/dist/cjs/components/Dashboard/MetricComponent.d.ts +2 -12
- package/dist/cjs/components/Dashboard/MetricComponent.d.ts.map +1 -1
- package/dist/cjs/components/Dashboard/MetricComponent.js +39 -17
- package/dist/cjs/components/Dashboard/TableComponent.d.ts +2 -1
- package/dist/cjs/components/Dashboard/TableComponent.d.ts.map +1 -1
- package/dist/cjs/components/Dashboard/TableComponent.js +6 -9
- package/dist/cjs/components/QuillCard.d.ts +2 -7
- package/dist/cjs/components/QuillCard.d.ts.map +1 -1
- package/dist/cjs/components/QuillCard.js +15 -9
- package/dist/cjs/components/QuillSelect.d.ts +4 -1
- package/dist/cjs/components/QuillSelect.d.ts.map +1 -1
- package/dist/cjs/components/QuillSelect.js +13 -8
- package/dist/cjs/components/QuillTable.d.ts +16 -2
- package/dist/cjs/components/QuillTable.d.ts.map +1 -1
- package/dist/cjs/components/QuillTable.js +4 -4
- package/dist/cjs/components/ReportBuilder/AddColumnPopover.d.ts +9 -3
- package/dist/cjs/components/ReportBuilder/AddColumnPopover.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/AddColumnPopover.js +10 -6
- package/dist/cjs/components/ReportBuilder/AddLimitPopover.d.ts +13 -1
- package/dist/cjs/components/ReportBuilder/AddLimitPopover.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/AddLimitPopover.js +5 -15
- package/dist/cjs/components/ReportBuilder/AddSortPopover.d.ts +21 -1
- package/dist/cjs/components/ReportBuilder/AddSortPopover.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/AddSortPopover.js +15 -17
- package/dist/cjs/components/ReportBuilder/bigDateMap.js +1 -1
- package/dist/cjs/components/ReportBuilder/convert.d.ts +3 -1
- package/dist/cjs/components/ReportBuilder/convert.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/convert.js +60 -21
- package/dist/cjs/components/ReportBuilder/operators.d.ts +15 -10
- package/dist/cjs/components/ReportBuilder/operators.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/operators.js +23 -10
- package/dist/cjs/components/ReportBuilder/pivot.d.ts +2 -1
- package/dist/cjs/components/ReportBuilder/pivot.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/ui.d.ts +82 -18
- package/dist/cjs/components/ReportBuilder/ui.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/ui.js +55 -103
- package/dist/cjs/components/ReportBuilder/util.d.ts +10 -4
- package/dist/cjs/components/ReportBuilder/util.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/util.js +124 -71
- package/dist/cjs/components/UiComponents.d.ts +81 -87
- package/dist/cjs/components/UiComponents.d.ts.map +1 -1
- package/dist/cjs/components/UiComponents.js +76 -103
- package/dist/cjs/hooks/index.d.ts +1 -0
- package/dist/cjs/hooks/index.d.ts.map +1 -1
- package/dist/cjs/hooks/index.js +3 -1
- package/dist/cjs/hooks/useTheme.d.ts +7 -0
- package/dist/cjs/hooks/useTheme.d.ts.map +1 -0
- package/dist/cjs/hooks/useTheme.js +12 -0
- package/dist/cjs/index.d.ts +10 -2
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/internals/ReportBuilder/PivotList.d.ts +5 -2
- package/dist/cjs/internals/ReportBuilder/PivotList.d.ts.map +1 -1
- package/dist/cjs/internals/ReportBuilder/PivotList.js +21 -21
- package/dist/cjs/internals/ReportBuilder/PivotModal.d.ts +30 -14
- package/dist/cjs/internals/ReportBuilder/PivotModal.d.ts.map +1 -1
- package/dist/cjs/internals/ReportBuilder/PivotModal.js +77 -52
- package/dist/cjs/utils/dataFetcher.d.ts.map +1 -1
- package/dist/cjs/utils/dataFetcher.js +2 -0
- package/dist/cjs/utils/parserBigQuery.d.ts +6 -0
- package/dist/cjs/utils/parserBigQuery.d.ts.map +1 -0
- package/dist/cjs/utils/parserBigQuery.js +60 -0
- package/dist/cjs/utils/parserPostgres.d.ts +3 -0
- package/dist/cjs/utils/parserPostgres.d.ts.map +1 -0
- package/dist/cjs/utils/parserPostgres.js +42 -0
- package/dist/esm/Chart.d.ts +109 -42
- package/dist/esm/Chart.d.ts.map +1 -1
- package/dist/esm/Chart.js +45 -19
- package/dist/esm/ChartBuilder.d.ts +204 -30
- package/dist/esm/ChartBuilder.d.ts.map +1 -1
- package/dist/esm/ChartBuilder.js +124 -63
- package/dist/esm/ChartEditor.d.ts +123 -19
- package/dist/esm/ChartEditor.d.ts.map +1 -1
- package/dist/esm/ChartEditor.js +51 -19
- package/dist/esm/Dashboard.d.ts +148 -91
- package/dist/esm/Dashboard.d.ts.map +1 -1
- package/dist/esm/Dashboard.js +54 -160
- package/dist/esm/DateRangePicker/QuillDateRangePicker.d.ts +21 -1
- package/dist/esm/DateRangePicker/QuillDateRangePicker.d.ts.map +1 -1
- package/dist/esm/DateRangePicker/QuillDateRangePicker.js +6 -3
- package/dist/esm/DateRangePicker/dateRangePickerUtils.js +1 -1
- package/dist/esm/QuillProvider.d.ts +105 -2
- package/dist/esm/QuillProvider.d.ts.map +1 -1
- package/dist/esm/QuillProvider.js +59 -0
- package/dist/esm/ReportBuilder.d.ts +194 -42
- package/dist/esm/ReportBuilder.d.ts.map +1 -1
- package/dist/esm/ReportBuilder.js +566 -419
- package/dist/esm/SQLEditor.d.ts +160 -23
- package/dist/esm/SQLEditor.d.ts.map +1 -1
- package/dist/esm/SQLEditor.js +36 -30
- package/dist/esm/Table.d.ts +119 -15
- package/dist/esm/Table.d.ts.map +1 -1
- package/dist/esm/Table.js +38 -7
- package/dist/esm/TableChart.d.ts.map +1 -1
- package/dist/esm/TableChart.js +0 -194
- package/dist/esm/{BarList.d.ts → components/Chart/BarList.d.ts} +1 -1
- package/dist/esm/components/Chart/BarList.d.ts.map +1 -0
- package/dist/esm/{BarList.js → components/Chart/BarList.js} +1 -1
- package/dist/esm/components/Chart/LineChart.d.ts +2 -3
- package/dist/esm/components/Chart/LineChart.d.ts.map +1 -1
- package/dist/esm/components/Chart/LineChart.js +3 -3
- package/dist/esm/components/Chart/PieChart.d.ts.map +1 -0
- package/dist/esm/{PieChart.js → components/Chart/PieChart.js} +1 -1
- package/dist/esm/components/Dashboard/ChartComponent.d.ts +2 -1
- package/dist/esm/components/Dashboard/ChartComponent.d.ts.map +1 -1
- package/dist/esm/components/Dashboard/ChartComponent.js +5 -6
- package/dist/esm/components/Dashboard/DashboardFilter.d.ts +22 -0
- package/dist/esm/components/Dashboard/DashboardFilter.d.ts.map +1 -0
- package/dist/esm/components/Dashboard/DashboardFilter.js +71 -0
- package/dist/esm/components/Dashboard/DataLoader.d.ts +1 -1
- package/dist/esm/components/Dashboard/DataLoader.d.ts.map +1 -1
- package/dist/esm/components/Dashboard/DataLoader.js +1 -1
- package/dist/esm/components/Dashboard/MetricComponent.d.ts +2 -12
- package/dist/esm/components/Dashboard/MetricComponent.d.ts.map +1 -1
- package/dist/esm/components/Dashboard/MetricComponent.js +39 -17
- package/dist/esm/components/Dashboard/TableComponent.d.ts +2 -1
- package/dist/esm/components/Dashboard/TableComponent.d.ts.map +1 -1
- package/dist/esm/components/Dashboard/TableComponent.js +6 -9
- package/dist/esm/components/QuillCard.d.ts +2 -7
- package/dist/esm/components/QuillCard.d.ts.map +1 -1
- package/dist/esm/components/QuillCard.js +15 -9
- package/dist/esm/components/QuillSelect.d.ts +4 -1
- package/dist/esm/components/QuillSelect.d.ts.map +1 -1
- package/dist/esm/components/QuillSelect.js +14 -9
- package/dist/esm/components/QuillTable.d.ts +16 -2
- package/dist/esm/components/QuillTable.d.ts.map +1 -1
- package/dist/esm/components/QuillTable.js +4 -4
- package/dist/esm/components/ReportBuilder/AddColumnPopover.d.ts +9 -3
- package/dist/esm/components/ReportBuilder/AddColumnPopover.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/AddColumnPopover.js +10 -6
- package/dist/esm/components/ReportBuilder/AddLimitPopover.d.ts +13 -1
- package/dist/esm/components/ReportBuilder/AddLimitPopover.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/AddLimitPopover.js +5 -15
- package/dist/esm/components/ReportBuilder/AddSortPopover.d.ts +21 -1
- package/dist/esm/components/ReportBuilder/AddSortPopover.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/AddSortPopover.js +17 -19
- package/dist/esm/components/ReportBuilder/bigDateMap.js +1 -1
- package/dist/esm/components/ReportBuilder/convert.d.ts +3 -1
- package/dist/esm/components/ReportBuilder/convert.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/convert.js +51 -13
- package/dist/esm/components/ReportBuilder/operators.d.ts +15 -10
- package/dist/esm/components/ReportBuilder/operators.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/operators.js +23 -10
- package/dist/esm/components/ReportBuilder/pivot.d.ts +2 -1
- package/dist/esm/components/ReportBuilder/pivot.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/ui.d.ts +82 -18
- package/dist/esm/components/ReportBuilder/ui.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/ui.js +53 -101
- package/dist/esm/components/ReportBuilder/util.d.ts +10 -4
- package/dist/esm/components/ReportBuilder/util.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/util.js +114 -67
- package/dist/esm/components/UiComponents.d.ts +81 -87
- package/dist/esm/components/UiComponents.d.ts.map +1 -1
- package/dist/esm/components/UiComponents.js +71 -102
- package/dist/esm/hooks/index.d.ts +1 -0
- package/dist/esm/hooks/index.d.ts.map +1 -1
- package/dist/esm/hooks/index.js +1 -0
- package/dist/esm/hooks/useTheme.d.ts +7 -0
- package/dist/esm/hooks/useTheme.d.ts.map +1 -0
- package/dist/esm/hooks/useTheme.js +10 -0
- package/dist/esm/index.d.ts +10 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/internals/ReportBuilder/PivotList.d.ts +5 -2
- package/dist/esm/internals/ReportBuilder/PivotList.d.ts.map +1 -1
- package/dist/esm/internals/ReportBuilder/PivotList.js +21 -21
- package/dist/esm/internals/ReportBuilder/PivotModal.d.ts +30 -14
- package/dist/esm/internals/ReportBuilder/PivotModal.d.ts.map +1 -1
- package/dist/esm/internals/ReportBuilder/PivotModal.js +77 -52
- package/dist/esm/utils/dataFetcher.d.ts.map +1 -1
- package/dist/esm/utils/dataFetcher.js +2 -0
- package/dist/esm/utils/parserBigQuery.d.ts +6 -0
- package/dist/esm/utils/parserBigQuery.d.ts.map +1 -0
- package/dist/esm/utils/parserBigQuery.js +52 -0
- package/dist/esm/utils/parserPostgres.d.ts +3 -0
- package/dist/esm/utils/parserPostgres.d.ts.map +1 -0
- package/dist/esm/utils/parserPostgres.js +37 -0
- package/package.json +1 -1
- package/dist/cjs/BarList.d.ts.map +0 -1
- package/dist/cjs/PieChart.d.ts.map +0 -1
- package/dist/esm/BarList.d.ts.map +0 -1
- package/dist/esm/PieChart.d.ts.map +0 -1
- /package/dist/cjs/{PieChart.d.ts → components/Chart/PieChart.d.ts} +0 -0
- /package/dist/esm/{PieChart.d.ts → components/Chart/PieChart.d.ts} +0 -0
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
/* eslint-disable no-unused-vars */
|
|
7
8
|
const react_1 = require("react");
|
|
8
9
|
const UiComponents_1 = require("./components/UiComponents");
|
|
9
10
|
const core_1 = require("@dnd-kit/core");
|
|
@@ -25,11 +26,11 @@ const AddColumnPopover_1 = __importDefault(require("./components/ReportBuilder/A
|
|
|
25
26
|
const AddSortPopover_1 = require("./components/ReportBuilder/AddSortPopover");
|
|
26
27
|
const PivotModal_1 = require("./internals/ReportBuilder/PivotModal");
|
|
27
28
|
const PivotList_1 = require("./internals/ReportBuilder/PivotList");
|
|
28
|
-
const QuillTable_1 = __importDefault(require("./components/QuillTable"));
|
|
29
|
-
const QuillSelect_1 = require("./components/QuillSelect");
|
|
30
29
|
const textProcessing_1 = require("./utils/textProcessing");
|
|
31
30
|
const AddLimitPopover_1 = require("./components/ReportBuilder/AddLimitPopover");
|
|
32
31
|
const width_1 = require("./utils/width");
|
|
32
|
+
const QuillSelect_1 = require("./components/QuillSelect");
|
|
33
|
+
const QuillCard_1 = require("./components/QuillCard");
|
|
33
34
|
/**
|
|
34
35
|
* Quill Report Builder
|
|
35
36
|
*
|
|
@@ -37,14 +38,38 @@ const width_1 = require("./utils/width");
|
|
|
37
38
|
* then edit them on the fly. Once users have constructed a query they like,
|
|
38
39
|
* they can click a button and add that report to their dashboard or export it
|
|
39
40
|
* as a CSV.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```js
|
|
44
|
+
* // Usage without custom components
|
|
45
|
+
* <ReportBuilder />
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```js
|
|
50
|
+
* // You can also pass your own components
|
|
51
|
+
* <ReportBuilder
|
|
52
|
+
* initialTableName="transactions"
|
|
53
|
+
* TableComponent={MyTable}
|
|
54
|
+
* SelectComponent={MySelect}
|
|
55
|
+
* ButtonComponent={MyButton}
|
|
56
|
+
* PopoverComponent={MyPopover}
|
|
57
|
+
* TextInputComponent={MyTextInput}
|
|
58
|
+
* containerStyle={{ backgroundColor: 'white', padding: '10px' }}
|
|
59
|
+
* />
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* ### Report Builder API
|
|
63
|
+
* @see https://docs.quillsql.com/components/report-builder
|
|
40
64
|
*/
|
|
41
|
-
function ReportBuilder({ initialTableName = '',
|
|
65
|
+
function ReportBuilder({ initialTableName = '', onSubmitChartBuilder = () => void null, destinationDashboard = undefined, organizationName = '', ButtonComponent = UiComponents_1.MemoizedButton, SecondaryButtonComponent = UiComponents_1.MemoizedSecondaryButton, DeleteButtonComponent = UiComponents_1.MemoizedDeleteButton, ModalComponent = UiComponents_1.MemoizedModal, TextInputComponent = UiComponents_2.QuillTextInput, SelectComponent = QuillSelect_1.QuillSelectComponent, TableComponent = UiComponents_1.QuillTableComponent, PopoverComponent = UiComponents_1.MemoizedPopover, TabsComponent = UiComponents_1.QuillTabs, CheckboxComponent = UiComponents_1.MemoizedCheckbox, SidebarComponent = ui_1.QuillSidebar, ContainerComponent = ui_1.CustomContainer, SelectColumnComponent = ui_1.QuillSelectColumn, DraggableColumnComponent = ui_1.QuillDraggableColumn, SidebarHeadingComponent = ui_1.QuillSidebarHeading, FilterPopoverComponent = ui_1.QuillFilterPopover, SortPopoverComponent = ui_1.QuillSortPopover, LimitPopoverComponent = ui_1.QuillLimitPopover, CardComponent = QuillCard_1.QuillCard, LabelComponent = UiComponents_1.MemoizedLabel, HeaderComponent = UiComponents_1.MemoizedHeader, TextComponent = UiComponents_1.MemoizedText, isAdminEnabled = false, isAIEnabled = true, containerStyle, }) {
|
|
42
66
|
const [aiPrompt, setAiPrompt] = (0, react_1.useState)('');
|
|
43
67
|
const [errorMessage, setErrorMessage] = (0, react_1.useState)('');
|
|
44
68
|
const [baseAst, setBaseAst] = (0, react_1.useState)(null);
|
|
45
69
|
const [formData, setFormData] = (0, react_1.useState)(null);
|
|
46
70
|
const [orderedColumnNames, setOrderedColumnNames] = (0, react_1.useState)([]);
|
|
47
71
|
const [selectedColumns, setSelectedColumns] = (0, react_1.useState)([]);
|
|
72
|
+
const [selectedOrderedColumns, setSelectedOrderedColumns] = (0, react_1.useState)([]);
|
|
48
73
|
const [schemaTables, setSchemaTables] = (0, react_1.useState)([]);
|
|
49
74
|
const [activeQuery, setActiveQuery] = (0, react_1.useState)('');
|
|
50
75
|
const [activeEditItem, setActiveEditItem] = (0, react_1.useState)(null);
|
|
@@ -104,7 +129,9 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
104
129
|
.sort(sortFn)
|
|
105
130
|
.filter((c) => columnsInPivot.includes(c));
|
|
106
131
|
}
|
|
107
|
-
|
|
132
|
+
// make the columnNames match the order of the selectedOrderedColumns
|
|
133
|
+
return columnNames.sort((a, b) => selectedOrderedColumns.indexOf(a) - selectedOrderedColumns.indexOf(b));
|
|
134
|
+
// return columnNames;
|
|
108
135
|
};
|
|
109
136
|
/**
|
|
110
137
|
* Transforms an array of column names into an array of columnInfo objects
|
|
@@ -130,9 +157,9 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
130
157
|
setAiPrompt('');
|
|
131
158
|
setBaseAst(null);
|
|
132
159
|
setFormData(null);
|
|
133
|
-
setOrderedColumnNames([]);
|
|
134
160
|
setSelectedColumns([]);
|
|
135
161
|
setSchemaTables([]);
|
|
162
|
+
setOrderedColumnNames([]);
|
|
136
163
|
setActiveQuery('');
|
|
137
164
|
setActiveEditItem(null);
|
|
138
165
|
setActivePath(null);
|
|
@@ -143,6 +170,7 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
143
170
|
setFields([]);
|
|
144
171
|
setTopLevelBinaryOperator('AND');
|
|
145
172
|
setEditPopoverKey(null);
|
|
173
|
+
setErrorMessage('');
|
|
146
174
|
// setUniqueValues({});
|
|
147
175
|
setPivot(null);
|
|
148
176
|
setPivotData(null);
|
|
@@ -207,23 +235,28 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
207
235
|
}
|
|
208
236
|
setUniqueValues(newValues);
|
|
209
237
|
};
|
|
210
|
-
const fetchSqlQuery = async (ast, formData) => {
|
|
211
|
-
|
|
238
|
+
const fetchSqlQuery = async (ast, formData, fetchData = true) => {
|
|
239
|
+
if (fetchData) {
|
|
240
|
+
setLoading(true);
|
|
241
|
+
}
|
|
212
242
|
setErrorMessage('');
|
|
213
243
|
try {
|
|
244
|
+
const where = formData ? formData : ast?.where || null;
|
|
214
245
|
const response = await fetch(`https://quill-344421.uc.r.appspot.com/sqlify`, {
|
|
215
246
|
method: 'POST',
|
|
216
247
|
headers: {
|
|
217
248
|
'Content-Type': 'application/json',
|
|
218
249
|
},
|
|
219
250
|
body: JSON.stringify({
|
|
220
|
-
ast: { ...ast, where
|
|
251
|
+
ast: { ...ast, where },
|
|
221
252
|
publicKey: client.publicKey,
|
|
222
253
|
}),
|
|
223
254
|
});
|
|
224
255
|
const data = await response.json();
|
|
225
256
|
setActiveQuery(data.query);
|
|
226
|
-
|
|
257
|
+
if (fetchData) {
|
|
258
|
+
fetchUponChange(ast, formData);
|
|
259
|
+
}
|
|
227
260
|
}
|
|
228
261
|
catch (error) {
|
|
229
262
|
setLoading(false);
|
|
@@ -242,7 +275,9 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
242
275
|
const result = [];
|
|
243
276
|
const table = tables[0];
|
|
244
277
|
const { valueField, rowField, columnField } = pivot;
|
|
245
|
-
if (columnField &&
|
|
278
|
+
if (columnField &&
|
|
279
|
+
uniqueValues[table] &&
|
|
280
|
+
uniqueValues[table][columnField]) {
|
|
246
281
|
result.push(...Object.keys(uniqueValues[table][columnField]));
|
|
247
282
|
}
|
|
248
283
|
result.push(valueField, rowField);
|
|
@@ -280,6 +315,32 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
280
315
|
}
|
|
281
316
|
};
|
|
282
317
|
(0, react_1.useEffect)(() => {
|
|
318
|
+
const loadTable = async (tables) => {
|
|
319
|
+
if (!tables)
|
|
320
|
+
return;
|
|
321
|
+
setLoading(true);
|
|
322
|
+
await getDistinctValues(initialTableName, tables);
|
|
323
|
+
const columnsForTable = tables
|
|
324
|
+
.find((t) => t.name === initialTableName)
|
|
325
|
+
?.columns.map((c) => c.name)
|
|
326
|
+
.sort((a, b) => {
|
|
327
|
+
const aIsId = a.endsWith('.id') ||
|
|
328
|
+
a.endsWith('_id') ||
|
|
329
|
+
a.endsWith('Id') ||
|
|
330
|
+
a === 'id';
|
|
331
|
+
const bIsId = b.endsWith('.id') ||
|
|
332
|
+
b.endsWith('_id') ||
|
|
333
|
+
b.endsWith('Id') ||
|
|
334
|
+
b === 'id';
|
|
335
|
+
if (aIsId && !bIsId)
|
|
336
|
+
return 1;
|
|
337
|
+
if (bIsId && !aIsId)
|
|
338
|
+
return -1;
|
|
339
|
+
return 0;
|
|
340
|
+
});
|
|
341
|
+
await handleAsk(`get ${columnsForTable} from ${initialTableName}`);
|
|
342
|
+
setInitialLoad(false);
|
|
343
|
+
};
|
|
283
344
|
const fetchSchema = async () => {
|
|
284
345
|
try {
|
|
285
346
|
setLoadingSchema(true);
|
|
@@ -305,8 +366,14 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
305
366
|
setOrderedColumnNames((tables ?? []).flatMap((table) => table.columns
|
|
306
367
|
.map((c) => `${table.name}.${c.name}`)
|
|
307
368
|
.sort((a, b) => {
|
|
308
|
-
const aIsId = a.endsWith('.id') ||
|
|
309
|
-
|
|
369
|
+
const aIsId = a.endsWith('.id') ||
|
|
370
|
+
a.endsWith('_id') ||
|
|
371
|
+
a.endsWith('Id') ||
|
|
372
|
+
a === 'id';
|
|
373
|
+
const bIsId = b.endsWith('.id') ||
|
|
374
|
+
b.endsWith('_id') ||
|
|
375
|
+
b.endsWith('Id') ||
|
|
376
|
+
b === 'id';
|
|
310
377
|
if (aIsId && !bIsId)
|
|
311
378
|
return 1;
|
|
312
379
|
if (bIsId && !aIsId)
|
|
@@ -314,13 +381,7 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
314
381
|
return 0;
|
|
315
382
|
})));
|
|
316
383
|
if (initialTableName && initialLoad) {
|
|
317
|
-
|
|
318
|
-
setLoading(true);
|
|
319
|
-
await getDistinctValues(initialTableName, tables);
|
|
320
|
-
const columnsForTable = tables
|
|
321
|
-
.find((t) => t.name === initialTableName)
|
|
322
|
-
?.columns.map((c) => c.name);
|
|
323
|
-
await handleAsk(`get ${columnsForTable} from ${initialTableName}`);
|
|
384
|
+
await loadTable(tables);
|
|
324
385
|
}
|
|
325
386
|
setLoadingSchema(false);
|
|
326
387
|
}
|
|
@@ -330,8 +391,9 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
330
391
|
};
|
|
331
392
|
if (schemaTables.length === 0) {
|
|
332
393
|
fetchSchema();
|
|
394
|
+
setInitialLoad(false);
|
|
333
395
|
}
|
|
334
|
-
}, [schemaTables]);
|
|
396
|
+
}, [schemaTables, initialTableName]);
|
|
335
397
|
const updateFormData = (updates, { isDeletion = false, isInsertion = false, isReplaceSubtree = false, isAddVariant = false, isDeleteVariant = false, topLevelBinOp = 'OR', isCondition = undefined, }) => {
|
|
336
398
|
// Function to immutably update or delete nodes based on their path
|
|
337
399
|
// TODO: fix the following horible code
|
|
@@ -738,7 +800,9 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
738
800
|
// see onChange callback handleChange
|
|
739
801
|
// eslint-disable-next-line no-unused-vars
|
|
740
802
|
dateColumnPath, dateFilterType, intervalCount, intervalType, intervalPaths, } = (0, util_1.getDateFilterInfo)(node);
|
|
741
|
-
const isPlural = intervalCount !== 1
|
|
803
|
+
const isPlural = intervalCount !== 1 && dateFilterType !== 'in the current'
|
|
804
|
+
? 's'
|
|
805
|
+
: '';
|
|
742
806
|
// Pull off the string literal date for "equals" comparisons
|
|
743
807
|
const rawDateStringEquals = node.right?.value ??
|
|
744
808
|
node.right?.args?.value[1]?.column ??
|
|
@@ -748,50 +812,50 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
748
812
|
'node.right.args.value.1.column') ??
|
|
749
813
|
(node.right?.args?.value[1]?.value &&
|
|
750
814
|
'node.right.args.value.1.value');
|
|
751
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', gap: 20 }, children: [(0, jsx_runtime_1.jsx)(
|
|
752
|
-
const columnType = getColumnTypeByName(value);
|
|
815
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', gap: 20 }, children: [(0, jsx_runtime_1.jsx)(SelectComponent, { value: dateColumn, onChange: (event) => {
|
|
816
|
+
const columnType = getColumnTypeByName(event.target.value);
|
|
753
817
|
if ((0, ast_1.isDateishColumnType)(columnType)) {
|
|
754
818
|
// handleChange(value, keyPrefix + dateColumnPath, "text");
|
|
755
|
-
handleOperatorChange('IN_THE_LAST', node, keyPrefix, value);
|
|
819
|
+
handleOperatorChange('IN_THE_LAST', node, keyPrefix, event.target.value);
|
|
756
820
|
}
|
|
757
821
|
else if ((0, ast_1.isNumericColumnType)(columnType)) {
|
|
758
822
|
const newSubtree = (0, util_1.deepCopy)(constants_1.defaultNumericComparison);
|
|
759
|
-
newSubtree.left.column = value;
|
|
823
|
+
newSubtree.left.column = event.target.value;
|
|
760
824
|
handleReplaceSubtree(keyPrefix, newSubtree);
|
|
761
825
|
}
|
|
762
826
|
else {
|
|
763
827
|
const newSubtree = (0, util_1.deepCopy)(constants_1.defaultEntry);
|
|
764
|
-
newSubtree.left.args.value[0].column = value;
|
|
828
|
+
newSubtree.left.args.value[0].column = event.target.value;
|
|
765
829
|
handleReplaceSubtree(keyPrefix, newSubtree);
|
|
766
830
|
}
|
|
767
831
|
}, options: getAllPossibleColumns().map((column) => ({
|
|
768
832
|
label: (0, textProcessing_1.snakeCaseToTitleCase)(column.displayName),
|
|
769
833
|
value: column.name,
|
|
770
|
-
})) }), (0, jsx_runtime_1.jsx)(
|
|
771
|
-
if (value === dateFilterType)
|
|
834
|
+
})) }), (0, jsx_runtime_1.jsx)(SelectComponent, { value: dateFilterType, onChange: (event) => {
|
|
835
|
+
if (event.target.value === dateFilterType)
|
|
772
836
|
return null;
|
|
773
837
|
let newSubtree = {};
|
|
774
838
|
// TODO: implement one for each database type (eg. pg, snowflake, etc.)
|
|
775
|
-
if (value === 'in the last') {
|
|
839
|
+
if (event.target.value === 'in the last') {
|
|
776
840
|
newSubtree = (0, postgres_1.generateLastNPeriodsPostgres)({
|
|
777
841
|
dateField: dateColumn,
|
|
778
842
|
intervalPeriod: `${intervalCount ?? 1} ${intervalType}`,
|
|
779
843
|
});
|
|
780
844
|
}
|
|
781
|
-
else if (value === 'in the previous') {
|
|
845
|
+
else if (event.target.value === 'in the previous') {
|
|
782
846
|
newSubtree = (0, postgres_1.generatePreviousPeriodPostgres)({
|
|
783
847
|
dateField: dateColumn,
|
|
784
848
|
intervalPeriod: `${intervalCount ?? 1} ${intervalType}`,
|
|
785
849
|
currentPeriod: intervalType,
|
|
786
850
|
});
|
|
787
851
|
}
|
|
788
|
-
else if (value === 'in the current') {
|
|
852
|
+
else if (event.target.value === 'in the current') {
|
|
789
853
|
newSubtree = (0, postgres_1.generateCurrentPeriodPostgres)({
|
|
790
854
|
dateField: dateColumn,
|
|
791
855
|
currentPeriod: intervalType,
|
|
792
856
|
});
|
|
793
857
|
}
|
|
794
|
-
else if (value === 'equals') {
|
|
858
|
+
else if (event.target.value === 'equals') {
|
|
795
859
|
newSubtree = (0, postgres_1.generateEqualsPostgres)({
|
|
796
860
|
dateField: dateColumn,
|
|
797
861
|
currentPeriod: intervalType,
|
|
@@ -805,7 +869,7 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
805
869
|
{ label: 'in the previous', value: 'in the previous' },
|
|
806
870
|
{ label: 'in the current', value: 'in the current' },
|
|
807
871
|
{ label: 'equals', value: 'equals' },
|
|
808
|
-
] }), !['in the current', 'equals'].includes(dateFilterType) && ((0, jsx_runtime_1.jsx)(
|
|
872
|
+
] }), !['in the current', 'equals'].includes(dateFilterType) && ((0, jsx_runtime_1.jsx)(TextInputComponent, { id: "date_filter_interval_count", value: intervalCount?.toString() ?? '', width: 70, onChange: (e) => {
|
|
809
873
|
if (Number.isNaN(parseFloat(e.target.value || '0'))) {
|
|
810
874
|
alert('Please input a number.');
|
|
811
875
|
return;
|
|
@@ -817,13 +881,13 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
817
881
|
path: keyPrefix + intervalPath,
|
|
818
882
|
},
|
|
819
883
|
]));
|
|
820
|
-
} })), (0, jsx_runtime_1.jsx)(
|
|
884
|
+
} })), (0, jsx_runtime_1.jsx)(SelectComponent, { value: intervalType, onChange: (event) => {
|
|
821
885
|
if (intervalPaths.length === 1) {
|
|
822
886
|
handleChangeText([
|
|
823
887
|
{
|
|
824
888
|
value: intervalCount !== null
|
|
825
|
-
? `${intervalCount} ${value}${isPlural}`
|
|
826
|
-
: value,
|
|
889
|
+
? `${intervalCount} ${event.target.value}${isPlural}`
|
|
890
|
+
: event.target.value,
|
|
827
891
|
path: keyPrefix + intervalPaths[0],
|
|
828
892
|
},
|
|
829
893
|
]);
|
|
@@ -833,14 +897,14 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
833
897
|
if (dateFilterType === 'equals') {
|
|
834
898
|
newSubtree = (0, postgres_1.generateEqualsPostgres)({
|
|
835
899
|
dateField: dateColumn,
|
|
836
|
-
currentPeriod: value,
|
|
900
|
+
currentPeriod: event.target.value,
|
|
837
901
|
timestamp: rawDateStringEquals,
|
|
838
902
|
});
|
|
839
903
|
}
|
|
840
904
|
else {
|
|
841
905
|
newSubtree = (0, postgres_1.generateCurrentPeriodPostgres)({
|
|
842
906
|
dateField: dateColumn,
|
|
843
|
-
currentPeriod: value,
|
|
907
|
+
currentPeriod: event.target.value,
|
|
844
908
|
});
|
|
845
909
|
}
|
|
846
910
|
handleReplaceSubtree(keyPrefix, newSubtree);
|
|
@@ -851,7 +915,7 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
851
915
|
{ label: `week${isPlural}`, value: 'week' },
|
|
852
916
|
{ label: `day${isPlural}`, value: 'day' },
|
|
853
917
|
{ label: `hour${isPlural}`, value: 'hour' },
|
|
854
|
-
] }), dateFilterType === 'equals' && ((0, jsx_runtime_1.jsx)(
|
|
918
|
+
] }), dateFilterType === 'equals' && ((0, jsx_runtime_1.jsx)(TextInputComponent, { id: "date_filter_equals_raw_date", value: rawDateStringEquals, width: 120, onChange: (e) => {
|
|
855
919
|
handleChangeText([
|
|
856
920
|
{
|
|
857
921
|
value: e.target.value,
|
|
@@ -872,40 +936,44 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
872
936
|
flexDirection: 'row',
|
|
873
937
|
alignItems: 'center',
|
|
874
938
|
gap: 20,
|
|
875
|
-
}, children: [(0, jsx_runtime_1.jsx)(
|
|
876
|
-
const columnType = getColumnTypeByName(value);
|
|
939
|
+
}, children: [(0, jsx_runtime_1.jsx)(SelectComponent, { value: node.left.column, onChange: (event) => {
|
|
940
|
+
const columnType = getColumnTypeByName(event.target.value);
|
|
877
941
|
if ((0, ast_1.isDateishColumnType)(columnType)) {
|
|
878
942
|
// handleChange(value, keyPrefix + dateColumnPath, "text");
|
|
879
|
-
handleOperatorChange('IN_THE_LAST', node, keyPrefix, value);
|
|
943
|
+
handleOperatorChange('IN_THE_LAST', node, keyPrefix, event.target.value);
|
|
880
944
|
}
|
|
881
945
|
else if ((0, ast_1.isNumericColumnType)(columnType)) {
|
|
882
946
|
const newSubtree = (0, util_1.deepCopy)(constants_1.defaultNumericComparison);
|
|
883
|
-
newSubtree.left.column = value;
|
|
947
|
+
newSubtree.left.column = event.target.value;
|
|
884
948
|
handleReplaceSubtree(keyPrefix, newSubtree);
|
|
885
949
|
}
|
|
886
950
|
else {
|
|
887
951
|
const newSubtree = (0, util_1.deepCopy)(constants_1.defaultEntry);
|
|
888
|
-
newSubtree.left.args.value[0].column = value;
|
|
952
|
+
newSubtree.left.args.value[0].column = event.target.value;
|
|
889
953
|
handleReplaceSubtree(keyPrefix, newSubtree);
|
|
890
954
|
}
|
|
891
|
-
}, options: options }), (0, jsx_runtime_1.jsx)(
|
|
892
|
-
handleOperatorChange(value, node, keyPrefix, dateColumn);
|
|
955
|
+
}, options: options }), (0, jsx_runtime_1.jsx)(SelectComponent, { value: 'IN_THE_LAST', onChange: (event) => {
|
|
956
|
+
handleOperatorChange(event.target.value, node, keyPrefix, dateColumn);
|
|
893
957
|
}, options: [
|
|
894
958
|
{ label: 'in the last', value: 'IN_THE_LAST' },
|
|
895
959
|
{ label: 'in the previous', value: 'IN_THE_PREVIOUS' },
|
|
896
960
|
{ label: 'in the current', value: 'IN_THE_CURRENT' },
|
|
961
|
+
{ label: 'equals', value: 'EQUALS' },
|
|
897
962
|
{ label: 'is not null', value: 'IS NOT' },
|
|
898
963
|
{ label: 'is null', value: 'IS' },
|
|
899
964
|
// { label: 'equals', value: 'equals' },
|
|
900
|
-
] }), (0, jsx_runtime_1.jsx)(
|
|
965
|
+
] }), (0, jsx_runtime_1.jsx)(TextInputComponent, { id: 'date_window_interval_count', value: node.right.args.value[1].expr.value, width: 120, onChange: (e) => {
|
|
901
966
|
handleChange([
|
|
902
967
|
{
|
|
903
968
|
value: e.target.value,
|
|
904
969
|
path: keyPrefix + 'right.args.value||1.expr.value',
|
|
905
970
|
},
|
|
906
971
|
]);
|
|
907
|
-
} }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(
|
|
908
|
-
{
|
|
972
|
+
} }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(SelectComponent, { value: node.right.args.value[1].unit, onChange: (event) => handleChange([
|
|
973
|
+
{
|
|
974
|
+
value: event.target.value,
|
|
975
|
+
path: keyPrefix + 'right.args.value||1.unit',
|
|
976
|
+
},
|
|
909
977
|
]), options: [
|
|
910
978
|
{ label: `year${plural}`, value: '* 365 DAY' },
|
|
911
979
|
{ label: `month${plural}`, value: '* 30 DAY' },
|
|
@@ -924,35 +992,42 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
924
992
|
flexDirection: 'row',
|
|
925
993
|
alignItems: 'center',
|
|
926
994
|
gap: 20,
|
|
927
|
-
}, children: [(0, jsx_runtime_1.jsx)(
|
|
928
|
-
const columnType = getColumnTypeByName(value);
|
|
995
|
+
}, children: [(0, jsx_runtime_1.jsx)(SelectComponent, { value: node.left.column, onChange: (event) => {
|
|
996
|
+
const columnType = getColumnTypeByName(event.target.value);
|
|
929
997
|
if ((0, ast_1.isDateishColumnType)(columnType)) {
|
|
930
998
|
// handleChange(value, keyPrefix + dateColumnPath, "text");
|
|
931
|
-
handleOperatorChange('IN_THE_LAST', node, keyPrefix, value);
|
|
999
|
+
handleOperatorChange('IN_THE_LAST', node, keyPrefix, event.target.value);
|
|
932
1000
|
}
|
|
933
1001
|
else if ((0, ast_1.isNumericColumnType)(columnType)) {
|
|
934
1002
|
const newSubtree = (0, util_1.deepCopy)(constants_1.defaultNumericComparison);
|
|
935
|
-
newSubtree.left.column = value;
|
|
1003
|
+
newSubtree.left.column = event.target.value;
|
|
936
1004
|
handleReplaceSubtree(keyPrefix, newSubtree);
|
|
937
1005
|
}
|
|
938
1006
|
else {
|
|
939
1007
|
const newSubtree = (0, util_1.deepCopy)(constants_1.defaultEntry);
|
|
940
|
-
newSubtree.left.args.value[0].column = value;
|
|
1008
|
+
newSubtree.left.args.value[0].column = event.target.value;
|
|
941
1009
|
handleReplaceSubtree(keyPrefix, newSubtree);
|
|
942
1010
|
}
|
|
943
|
-
}, options: options }), (0, jsx_runtime_1.jsx)(
|
|
944
|
-
handleOperatorChange(value, node, keyPrefix, node.left.column);
|
|
1011
|
+
}, options: options }), (0, jsx_runtime_1.jsx)(SelectComponent, { value: 'IN_THE_CURRENT', onChange: (event) => {
|
|
1012
|
+
handleOperatorChange(event.target.value, node, keyPrefix, node.left.column);
|
|
945
1013
|
}, options: [
|
|
946
1014
|
{ label: 'in the last', value: 'IN_THE_LAST' },
|
|
947
1015
|
{ label: 'in the previous', value: 'IN_THE_PREVIOUS' },
|
|
948
1016
|
{ label: 'in the current', value: 'IN_THE_CURRENT' },
|
|
1017
|
+
{ label: 'equals', value: 'EQUALS' },
|
|
949
1018
|
{ label: 'is not null', value: 'IS NOT' },
|
|
950
1019
|
{ label: 'is null', value: 'IS' },
|
|
951
1020
|
// { label: 'equals', value: 'equals' },
|
|
952
|
-
] }), (0, jsx_runtime_1.jsx)(
|
|
1021
|
+
] }), (0, jsx_runtime_1.jsx)(SelectComponent, { value: node.left.args.value[1].column, onChange: (event) => {
|
|
953
1022
|
handleChange([
|
|
954
|
-
{
|
|
955
|
-
|
|
1023
|
+
{
|
|
1024
|
+
value: event.target.value,
|
|
1025
|
+
path: 'right.args.value||1.column',
|
|
1026
|
+
},
|
|
1027
|
+
{
|
|
1028
|
+
value: event.target.value,
|
|
1029
|
+
path: 'left.args.value||1.column',
|
|
1030
|
+
},
|
|
956
1031
|
]);
|
|
957
1032
|
}, options: [
|
|
958
1033
|
{ label: `year`, value: 'YEAR' },
|
|
@@ -971,32 +1046,33 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
971
1046
|
flexDirection: 'row',
|
|
972
1047
|
alignItems: 'center',
|
|
973
1048
|
gap: 20,
|
|
974
|
-
}, children: [(0, jsx_runtime_1.jsx)(
|
|
975
|
-
const columnType = getColumnTypeByName(value);
|
|
1049
|
+
}, children: [(0, jsx_runtime_1.jsx)(SelectComponent, { value: node.left.column, onChange: (event) => {
|
|
1050
|
+
const columnType = getColumnTypeByName(event.target.value);
|
|
976
1051
|
if ((0, ast_1.isDateishColumnType)(columnType)) {
|
|
977
1052
|
// handleChange(value, keyPrefix + dateColumnPath, "text");
|
|
978
|
-
handleOperatorChange('IN_THE_LAST', node, keyPrefix, value);
|
|
1053
|
+
handleOperatorChange('IN_THE_LAST', node, keyPrefix, event.target.value);
|
|
979
1054
|
}
|
|
980
1055
|
else if ((0, ast_1.isNumericColumnType)(columnType)) {
|
|
981
1056
|
const newSubtree = (0, util_1.deepCopy)(constants_1.defaultNumericComparison);
|
|
982
|
-
newSubtree.left.column = value;
|
|
1057
|
+
newSubtree.left.column = event.target.value;
|
|
983
1058
|
handleReplaceSubtree(keyPrefix, newSubtree);
|
|
984
1059
|
}
|
|
985
1060
|
else {
|
|
986
1061
|
const newSubtree = (0, util_1.deepCopy)(constants_1.defaultEntry);
|
|
987
|
-
newSubtree.left.args.value[0].column = value;
|
|
1062
|
+
newSubtree.left.args.value[0].column = event.target.value;
|
|
988
1063
|
handleReplaceSubtree(keyPrefix, newSubtree);
|
|
989
1064
|
}
|
|
990
|
-
}, options: options }), (0, jsx_runtime_1.jsx)(
|
|
991
|
-
handleOperatorChange(value, node, keyPrefix, node.left.column);
|
|
1065
|
+
}, options: options }), (0, jsx_runtime_1.jsx)(SelectComponent, { value: 'IN_THE_PREVIOUS', onChange: (event) => {
|
|
1066
|
+
handleOperatorChange(event.target.value, node, keyPrefix, node.left.column);
|
|
992
1067
|
}, options: [
|
|
993
1068
|
{ label: 'in the last', value: 'IN_THE_LAST' },
|
|
994
1069
|
{ label: 'in the previous', value: 'IN_THE_PREVIOUS' },
|
|
995
1070
|
{ label: 'in the current', value: 'IN_THE_CURRENT' },
|
|
1071
|
+
{ label: 'equals', value: 'EQUALS' },
|
|
996
1072
|
{ label: 'is not null', value: 'IS NOT' },
|
|
997
1073
|
{ label: 'is null', value: 'IS' },
|
|
998
1074
|
// { label: 'equals', value: 'equals' },
|
|
999
|
-
] }), (0, jsx_runtime_1.jsx)(
|
|
1075
|
+
] }), (0, jsx_runtime_1.jsx)(SelectComponent, { value: node.left.args.value[1].column, onChange: (event) => {
|
|
1000
1076
|
const dayConversion = {
|
|
1001
1077
|
YEAR: 365,
|
|
1002
1078
|
QUARTER: 90,
|
|
@@ -1005,15 +1081,15 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1005
1081
|
};
|
|
1006
1082
|
handleChange([
|
|
1007
1083
|
{
|
|
1008
|
-
value,
|
|
1084
|
+
value: event.target.value,
|
|
1009
1085
|
path: 'left.args.value||1.column',
|
|
1010
1086
|
},
|
|
1011
1087
|
{
|
|
1012
|
-
value,
|
|
1088
|
+
value: event.target.value,
|
|
1013
1089
|
path: 'right.args.value||1.column',
|
|
1014
1090
|
},
|
|
1015
1091
|
{
|
|
1016
|
-
value: dayConversion[value] || 30,
|
|
1092
|
+
value: dayConversion[event.target.value] || 30,
|
|
1017
1093
|
path: 'right.args.value||0.args.value||1.expr.value',
|
|
1018
1094
|
},
|
|
1019
1095
|
]);
|
|
@@ -1024,6 +1100,65 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1024
1100
|
{ label: `week`, value: 'WEEK' },
|
|
1025
1101
|
] })] }));
|
|
1026
1102
|
}
|
|
1103
|
+
else if ((0, util_1.isEquals)(node, client.databaseType)) {
|
|
1104
|
+
const options = getAllPossibleColumns().map((column) => ({
|
|
1105
|
+
label: (0, textProcessing_1.snakeCaseToTitleCase)(column.displayName),
|
|
1106
|
+
value: column.name,
|
|
1107
|
+
}));
|
|
1108
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
1109
|
+
display: 'flex',
|
|
1110
|
+
flexDirection: 'row',
|
|
1111
|
+
alignItems: 'center',
|
|
1112
|
+
gap: 20,
|
|
1113
|
+
}, children: [(0, jsx_runtime_1.jsx)(SelectComponent, { value: node.left.column, onChange: (event) => {
|
|
1114
|
+
const columnType = getColumnTypeByName(event.target.value);
|
|
1115
|
+
if ((0, ast_1.isDateishColumnType)(columnType)) {
|
|
1116
|
+
// handleChange(value, keyPrefix + dateColumnPath, "text");
|
|
1117
|
+
handleOperatorChange('IN_THE_LAST', node, keyPrefix, event.target.value);
|
|
1118
|
+
}
|
|
1119
|
+
else if ((0, ast_1.isNumericColumnType)(columnType)) {
|
|
1120
|
+
const newSubtree = (0, util_1.deepCopy)(constants_1.defaultNumericComparison);
|
|
1121
|
+
newSubtree.left.column = event.target.value;
|
|
1122
|
+
handleReplaceSubtree(keyPrefix, newSubtree);
|
|
1123
|
+
}
|
|
1124
|
+
else {
|
|
1125
|
+
const newSubtree = (0, util_1.deepCopy)(constants_1.defaultEntry);
|
|
1126
|
+
newSubtree.left.args.value[0].column = event.target.value;
|
|
1127
|
+
handleReplaceSubtree(keyPrefix, newSubtree);
|
|
1128
|
+
}
|
|
1129
|
+
}, options: options }), (0, jsx_runtime_1.jsx)(SelectComponent, { value: 'EQUALS', onChange: (event) => {
|
|
1130
|
+
handleOperatorChange(event.target.value, node, keyPrefix, node.left.column);
|
|
1131
|
+
}, options: [
|
|
1132
|
+
{ label: 'in the last', value: 'IN_THE_LAST' },
|
|
1133
|
+
{ label: 'in the previous', value: 'IN_THE_PREVIOUS' },
|
|
1134
|
+
{ label: 'in the current', value: 'IN_THE_CURRENT' },
|
|
1135
|
+
{ label: 'equals', value: 'EQUALS' },
|
|
1136
|
+
{ label: 'is not null', value: 'IS NOT' },
|
|
1137
|
+
{ label: 'is null', value: 'IS' },
|
|
1138
|
+
// { label: 'equals', value: 'equals' },
|
|
1139
|
+
] }), (0, jsx_runtime_1.jsx)(SelectComponent, { value: node.right.args.value[1].column, onChange: (event) => {
|
|
1140
|
+
handleChange([
|
|
1141
|
+
{
|
|
1142
|
+
value: event.target.value,
|
|
1143
|
+
path: 'right.args.value||1.column',
|
|
1144
|
+
},
|
|
1145
|
+
{
|
|
1146
|
+
value: event.target.value,
|
|
1147
|
+
path: 'left.args.value||1.column',
|
|
1148
|
+
},
|
|
1149
|
+
]);
|
|
1150
|
+
}, options: [
|
|
1151
|
+
{ label: `year`, value: 'YEAR' },
|
|
1152
|
+
{ label: `quarter`, value: 'QUARTER' },
|
|
1153
|
+
{ label: `month`, value: 'MONTH' },
|
|
1154
|
+
{ label: `week`, value: 'WEEK' },
|
|
1155
|
+
] }), (0, jsx_runtime_1.jsx)(TextInputComponent, { id: 'quoted_string', value: node.right.args.value[0].value, width: 120, onChange: (e) => handleChange([
|
|
1156
|
+
{
|
|
1157
|
+
value: e.target.value,
|
|
1158
|
+
path: 'right.args.value||0.value',
|
|
1159
|
+
},
|
|
1160
|
+
]) })] }));
|
|
1161
|
+
}
|
|
1027
1162
|
else if ((0, util_1.isColumnComparison)(node)) {
|
|
1028
1163
|
const options = getAllPossibleColumns().map((column) => ({
|
|
1029
1164
|
label: (0, textProcessing_1.snakeCaseToTitleCase)(column.displayName),
|
|
@@ -1053,10 +1188,10 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1053
1188
|
: []),
|
|
1054
1189
|
...((0, ast_1.isTextColumnType)(columnType)
|
|
1055
1190
|
? [
|
|
1056
|
-
{ label: 'is', value: 'LIKE' },
|
|
1057
|
-
{ label: 'is not', value: 'NOT LIKE' },
|
|
1058
|
-
{ label: 'is
|
|
1059
|
-
{ label: 'is not
|
|
1191
|
+
{ label: 'is exactly', value: 'LIKE' },
|
|
1192
|
+
{ label: 'is not exactly', value: 'NOT LIKE' },
|
|
1193
|
+
{ label: 'is', value: 'IN' },
|
|
1194
|
+
{ label: 'is not', value: 'NOT IN' },
|
|
1060
1195
|
{ label: 'is not null', value: 'IS NOT' },
|
|
1061
1196
|
{ label: 'is null', value: 'IS' },
|
|
1062
1197
|
]
|
|
@@ -1075,10 +1210,6 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1075
1210
|
]
|
|
1076
1211
|
: []),
|
|
1077
1212
|
];
|
|
1078
|
-
if (client.databaseType === 'BigQuery' &&
|
|
1079
|
-
(0, ast_1.isDateishColumnType)(columnType)) {
|
|
1080
|
-
operatorOptions = operatorOptions.filter((option) => option.value !== 'equals');
|
|
1081
|
-
}
|
|
1082
1213
|
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
1083
1214
|
display: 'flex',
|
|
1084
1215
|
gap: 12,
|
|
@@ -1088,45 +1219,49 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1088
1219
|
}, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
1089
1220
|
display: 'flex',
|
|
1090
1221
|
gap: 20,
|
|
1091
|
-
// justifyContent: "space-between",
|
|
1092
1222
|
flexDirection: (0, util_1.showNodeAsRow)(node, formData)
|
|
1093
1223
|
? 'row'
|
|
1094
1224
|
: 'column',
|
|
1095
1225
|
width: '100%',
|
|
1096
|
-
}, children: [(0, jsx_runtime_1.jsx)(
|
|
1097
|
-
const columnType = getColumnTypeByName(value);
|
|
1226
|
+
}, children: [(0, jsx_runtime_1.jsx)(SelectComponent, { value: leftChildValue, onChange: (event) => {
|
|
1227
|
+
const columnType = getColumnTypeByName(event.target.value);
|
|
1098
1228
|
if ((0, ast_1.isDateishColumnType)(columnType)) {
|
|
1099
|
-
handleOperatorChange('IN_THE_LAST', node, keyPrefix, value);
|
|
1229
|
+
handleOperatorChange('IN_THE_LAST', node, keyPrefix, event.target.value);
|
|
1100
1230
|
}
|
|
1101
1231
|
else if ((0, ast_1.isNumericColumnType)(columnType)) {
|
|
1102
1232
|
const newSubtree = (0, util_1.deepCopy)(constants_1.defaultNumericComparison);
|
|
1103
|
-
newSubtree.left.column = value;
|
|
1233
|
+
newSubtree.left.column = event.target.value;
|
|
1104
1234
|
handleReplaceSubtree(keyPrefix, newSubtree);
|
|
1105
1235
|
}
|
|
1106
1236
|
else {
|
|
1107
1237
|
const newSubtree = (0, util_1.deepCopy)(constants_1.defaultEntry);
|
|
1108
|
-
newSubtree.left.args.value[0].column = value;
|
|
1238
|
+
newSubtree.left.args.value[0].column = event.target.value;
|
|
1109
1239
|
handleReplaceSubtree(keyPrefix, newSubtree);
|
|
1110
1240
|
}
|
|
1111
|
-
}, options: options }), operatorOptions.length > 0 && ((0, jsx_runtime_1.jsx)(
|
|
1112
|
-
handleOperatorChange(value, node, keyPrefix, leftChildValue);
|
|
1113
|
-
},
|
|
1241
|
+
}, options: options }), operatorOptions.length > 0 && ((0, jsx_runtime_1.jsx)(SelectComponent, { value: node.operator, onChange: (event) => {
|
|
1242
|
+
handleOperatorChange(event.target.value, node, keyPrefix, leftChildValue);
|
|
1243
|
+
}, options: operatorOptions })), node.right &&
|
|
1114
1244
|
node.right.type !== 'expr_list' &&
|
|
1115
1245
|
renderNode(node.right, keyPrefix + 'right.')] }, keyPrefix), node.right && node.right.type === 'expr_list' && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
1116
1246
|
display: 'grid',
|
|
1117
1247
|
gridTemplateColumns: 'repeat(2, 1fr)',
|
|
1118
1248
|
gap: 12,
|
|
1119
|
-
}, children:
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1249
|
+
}, children: uniqueValues[table] &&
|
|
1250
|
+
Object.keys(uniqueValues[table][leftChildValue] ?? {}).map((key) => ((0, jsx_runtime_1.jsxs)("label", { style: { display: 'flex', gap: 4 }, children: [(0, jsx_runtime_1.jsx)(CheckboxComponent, { isChecked: uniqueValues[table][leftChildValue][key], onChange: (event) => {
|
|
1251
|
+
const newValues = (0, util_1.deepCopy)(uniqueValues);
|
|
1252
|
+
newValues[table][leftChildValue][key] =
|
|
1253
|
+
event.target.checked;
|
|
1254
|
+
setUniqueValues(newValues);
|
|
1255
|
+
if (event.target.checked) {
|
|
1256
|
+
handleInsertVariant(keyPrefix + 'right.' + 'value', key);
|
|
1257
|
+
}
|
|
1258
|
+
else {
|
|
1259
|
+
handleDeleteVariant(keyPrefix + 'right.' + 'value', key);
|
|
1260
|
+
}
|
|
1261
|
+
} }), (0, jsx_runtime_1.jsx)("span", { style: {
|
|
1262
|
+
fontFamily: theme.fontFamily,
|
|
1263
|
+
margin: 'auto 0',
|
|
1264
|
+
}, children: key })] }, key))) }, keyPrefix + 'right.'))] }));
|
|
1130
1265
|
}
|
|
1131
1266
|
else {
|
|
1132
1267
|
const columnName = node.left.column;
|
|
@@ -1138,9 +1273,9 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1138
1273
|
justifyContent: 'space-between',
|
|
1139
1274
|
flexDirection: (0, util_1.showNodeAsRow)(node, formData) ? 'row' : 'column',
|
|
1140
1275
|
width: '100%',
|
|
1141
|
-
}, children: [node.left && renderNode(node.left, keyPrefix + 'left.'), (0, jsx_runtime_1.jsx)(
|
|
1142
|
-
handleOperatorChange(value, node, keyPrefix);
|
|
1143
|
-
},
|
|
1276
|
+
}, children: [node.left && renderNode(node.left, keyPrefix + 'left.'), (0, jsx_runtime_1.jsx)(SelectComponent, { value: node.operator, onChange: (event) => {
|
|
1277
|
+
handleOperatorChange(event.target.value, node, keyPrefix);
|
|
1278
|
+
}, options: [
|
|
1144
1279
|
// { label: `and`, value: "AND" },
|
|
1145
1280
|
// { label: `or`, value: "OR" },
|
|
1146
1281
|
...((0, ast_1.isNumericColumnType)(columnType)
|
|
@@ -1157,10 +1292,10 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1157
1292
|
: []),
|
|
1158
1293
|
...((0, ast_1.isTextColumnType)(columnType)
|
|
1159
1294
|
? [
|
|
1160
|
-
{ label: 'is', value: 'LIKE' },
|
|
1161
|
-
{ label: 'is not', value: 'NOT LIKE' },
|
|
1162
|
-
{ label: 'is
|
|
1163
|
-
{ label: 'is not
|
|
1295
|
+
{ label: 'is exactly', value: 'LIKE' },
|
|
1296
|
+
{ label: 'is not exactly', value: 'NOT LIKE' },
|
|
1297
|
+
{ label: 'is', value: 'IN' },
|
|
1298
|
+
{ label: 'is not', value: 'NOT IN' },
|
|
1164
1299
|
{ label: 'is not null', value: 'IS NOT' },
|
|
1165
1300
|
{ label: 'is null', value: 'IS' },
|
|
1166
1301
|
]
|
|
@@ -1170,6 +1305,7 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1170
1305
|
{ label: 'in the last', value: 'IN_THE_LAST' },
|
|
1171
1306
|
{ label: 'in the previous', value: 'IN_THE_PREVIOUS' },
|
|
1172
1307
|
{ label: 'in the current', value: 'IN_THE_CURRENT' },
|
|
1308
|
+
{ label: 'equals', value: 'EQUALS' },
|
|
1173
1309
|
{ label: 'is not null', value: 'IS NOT' },
|
|
1174
1310
|
{ label: 'is null', value: 'IS' },
|
|
1175
1311
|
]
|
|
@@ -1183,15 +1319,17 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1183
1319
|
label: (0, textProcessing_1.snakeCaseToTitleCase)(column.displayName),
|
|
1184
1320
|
value: column.name,
|
|
1185
1321
|
}));
|
|
1186
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
1187
|
-
handleChange([
|
|
1322
|
+
return ((0, jsx_runtime_1.jsx)(SelectComponent, { value: node.column ?? options[0]?.value, onChange: (event) => {
|
|
1323
|
+
handleChange([
|
|
1324
|
+
{ value: event.target.value, path: keyPrefix + 'column' },
|
|
1325
|
+
]);
|
|
1188
1326
|
}, options: options }));
|
|
1189
1327
|
}
|
|
1190
1328
|
case 'expr_list': {
|
|
1191
1329
|
const len = node.value.length;
|
|
1192
1330
|
return ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'row', gap: 12 }, children: [node.value.map((elem, index) => {
|
|
1193
1331
|
if (elem.value) {
|
|
1194
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
1332
|
+
return ((0, jsx_runtime_1.jsx)(TextInputComponent, { id: `expr_list_${index}`, width: 200, value: elem.value, onChange: (e) => handleChange([
|
|
1195
1333
|
{
|
|
1196
1334
|
value: e.target.value,
|
|
1197
1335
|
path: keyPrefix + `value.${index}.`,
|
|
@@ -1199,11 +1337,11 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1199
1337
|
]) }, `input_${index}`));
|
|
1200
1338
|
}
|
|
1201
1339
|
return renderNode(elem, keyPrefix + `value.${index}.`);
|
|
1202
|
-
}), len > 1 && ((0, jsx_runtime_1.jsx)(
|
|
1340
|
+
}), len > 1 && ((0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { label: '-', onClick: () => handleDeleteVariant(keyPrefix + 'value') })), (0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { onClick: () => handleInsertVariant(keyPrefix + 'value'), label: '+' })] }, keyPrefix));
|
|
1203
1341
|
}
|
|
1204
1342
|
case 'double_quote_string':
|
|
1205
1343
|
case 'single_quote_string':
|
|
1206
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
1344
|
+
return ((0, jsx_runtime_1.jsx)(TextInputComponent, { id: 'quoted_string', value: node.value.replaceAll('%', ''), width: 120, onChange: (e) => handleChange([
|
|
1207
1345
|
{
|
|
1208
1346
|
value: e.target.value,
|
|
1209
1347
|
path: keyPrefix + 'value',
|
|
@@ -1212,7 +1350,7 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1212
1350
|
case 'null':
|
|
1213
1351
|
return (0, jsx_runtime_1.jsx)("div", {});
|
|
1214
1352
|
case 'number':
|
|
1215
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
1353
|
+
return ((0, jsx_runtime_1.jsx)(TextInputComponent, { id: "quill_number_input", value: node.value, width: 120, onChange: (e) => {
|
|
1216
1354
|
handleChange([
|
|
1217
1355
|
{
|
|
1218
1356
|
value: e.target.value,
|
|
@@ -1265,15 +1403,7 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1265
1403
|
// @depreciated TODO: remove next update
|
|
1266
1404
|
// eslint-disable-next-line no-unused-vars
|
|
1267
1405
|
isTopLevelAnd = false, isParentRow = false) => {
|
|
1268
|
-
const
|
|
1269
|
-
? (0, util_1.getInTheCurrentIntervalSentence)(node, client.databaseType)
|
|
1270
|
-
: null;
|
|
1271
|
-
const isInTheLastIntervalSentence = (0, util_1.isInTheLastInterval)(node, client.databaseType)
|
|
1272
|
-
? (0, util_1.getInTheLastIntervalSentence)(node, client.databaseType)
|
|
1273
|
-
: null;
|
|
1274
|
-
const isInThePreviousIntervalSentence = (0, util_1.isThePreviousInterval)(node, client.databaseType)
|
|
1275
|
-
? (0, util_1.getInThePreviousIntervalSentence)(node, client.databaseType)
|
|
1276
|
-
: null;
|
|
1406
|
+
const uniqueSentence = (0, util_1.getCustomSentence)(node, client.databaseType);
|
|
1277
1407
|
let dateComparisonPartialMatch = null;
|
|
1278
1408
|
let dateEqualityPartialMatch = null;
|
|
1279
1409
|
if (client.databaseType !== 'BigQuery') {
|
|
@@ -1285,13 +1415,13 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1285
1415
|
const OPS = {
|
|
1286
1416
|
AND: 'and',
|
|
1287
1417
|
OR: 'or',
|
|
1288
|
-
LIKE: 'is',
|
|
1418
|
+
LIKE: 'is exactly',
|
|
1289
1419
|
BETWEEN: 'is between',
|
|
1290
|
-
IN: 'is
|
|
1291
|
-
'NOT IN': 'is not
|
|
1292
|
-
'NOT LIKE': 'is not',
|
|
1293
|
-
'!=': 'is not',
|
|
1294
|
-
'=': 'is',
|
|
1420
|
+
IN: 'is',
|
|
1421
|
+
'NOT IN': 'is not',
|
|
1422
|
+
'NOT LIKE': 'is not exactly',
|
|
1423
|
+
'!=': 'is not exactly',
|
|
1424
|
+
'=': 'is exactly',
|
|
1295
1425
|
'<': 'is less than',
|
|
1296
1426
|
'>': 'is greater than',
|
|
1297
1427
|
'<=': 'is less than or equal to',
|
|
@@ -1299,25 +1429,14 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1299
1429
|
'<>': 'is not',
|
|
1300
1430
|
'-': 'minus',
|
|
1301
1431
|
'IS NOT': 'is not',
|
|
1302
|
-
IS: 'is
|
|
1432
|
+
IS: 'is',
|
|
1303
1433
|
};
|
|
1304
1434
|
switch (node.type) {
|
|
1305
1435
|
case 'binary_expr':
|
|
1306
|
-
return ((0, jsx_runtime_1.jsx)(ui_1.TagWrapper, { keyPrefix: keyPrefix, formData: formData, activeEditItem: activeEditItem, setEditPopoverKey: setEditPopoverKey, setActiveEditItem: setActiveEditItem, setCheckboxes: setCheckboxes, handleReplaceSubtree: handleReplaceSubtree, FilterPopover:
|
|
1307
|
-
display: 'flex',
|
|
1308
|
-
gap: 3,
|
|
1309
|
-
flexDirection: isRow ? 'row' : 'column',
|
|
1310
|
-
padding: '1px',
|
|
1311
|
-
border: isCard ? '1px solid black' : 'none',
|
|
1312
|
-
whiteSpace: 'nowrap',
|
|
1313
|
-
overflow: 'hidden',
|
|
1314
|
-
textOverflow: 'ellipsis',
|
|
1315
|
-
}, children: dateComparisonPartialMatch ??
|
|
1436
|
+
return ((0, jsx_runtime_1.jsx)(ui_1.TagWrapper, { keyPrefix: keyPrefix, formData: formData, activeEditItem: activeEditItem, setEditPopoverKey: setEditPopoverKey, setActiveEditItem: setActiveEditItem, setCheckboxes: setCheckboxes, handleReplaceSubtree: handleReplaceSubtree, FilterPopover: FilterPopoverComponent, setActivePath: setActivePath, setOpenPopover: setOpenPopover, setIsPending: setIsPending, clearCheckboxes: clearCheckboxes, handleDelete: handleDelete, editPopoverKey: editPopoverKey, isCard: isCard, isRow: isRow, getByKey: getByKey, EditPopover: ui_1.EditPopover, Button: ButtonComponent, renderNode: renderNode, children: dateComparisonPartialMatch ??
|
|
1316
1437
|
dateEqualityPartialMatch ??
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
isInThePreviousIntervalSentence ?? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [node.left &&
|
|
1320
|
-
renderSentence(formData, node.left, keyPrefix + 'left.', false, false, isRow), isRow ? (' ' + OPS[node.operator] + ' ') : isTopLevel || topLevelBinaryOperator === 'OR' ? ((0, jsx_runtime_1.jsx)(TopLevelBooleanSwitch, { node: node, keyPrefix: keyPrefix, handleOperatorChange: handleOperatorChange, Select: Select })) : null, node.right &&
|
|
1438
|
+
uniqueSentence ?? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [node.left &&
|
|
1439
|
+
renderSentence(formData, node.left, keyPrefix + 'left.', false, false, isRow), isRow ? (' ' + OPS[node.operator] + ' ') : isTopLevel || topLevelBinaryOperator === 'OR' ? ((0, jsx_runtime_1.jsx)(TopLevelBooleanSwitch, { node: node, keyPrefix: keyPrefix, handleOperatorChange: handleOperatorChange, Select: SelectComponent })) : null, node.right &&
|
|
1321
1440
|
renderSentence(formData, node.right, keyPrefix + 'right.', false, false, isRow)] })) }));
|
|
1322
1441
|
case 'column_ref':
|
|
1323
1442
|
return (0, textProcessing_1.snakeCaseToTitleCase)(node.column);
|
|
@@ -1352,6 +1471,9 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1352
1471
|
if (node.args.value.length < 1)
|
|
1353
1472
|
return null;
|
|
1354
1473
|
if (node.args.value[0].value) {
|
|
1474
|
+
if (node.args.value[0].type === 'single_quote_string') {
|
|
1475
|
+
return node.args.value[0].value.replaceAll('%', '');
|
|
1476
|
+
}
|
|
1355
1477
|
return (0, textProcessing_1.snakeCaseToTitleCase)(node.args.value[0].value.replaceAll('%', ''));
|
|
1356
1478
|
}
|
|
1357
1479
|
if (node.args.value[0].column)
|
|
@@ -1399,9 +1521,11 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1399
1521
|
}))
|
|
1400
1522
|
.sort((a, b) => {
|
|
1401
1523
|
const aIsId = a.name.toLowerCase() === 'id' ||
|
|
1402
|
-
a.name.toLowerCase().endsWith('_id')
|
|
1524
|
+
a.name.toLowerCase().endsWith('_id') ||
|
|
1525
|
+
a.name.endsWith('Id');
|
|
1403
1526
|
const bIsId = b.name.toLowerCase() === 'id' ||
|
|
1404
|
-
b.name.toLowerCase().endsWith('_id')
|
|
1527
|
+
b.name.toLowerCase().endsWith('_id') ||
|
|
1528
|
+
b.name.endsWith('Id');
|
|
1405
1529
|
if (aIsId && !bIsId)
|
|
1406
1530
|
return 1;
|
|
1407
1531
|
if (bIsId && !aIsId)
|
|
@@ -1418,7 +1542,8 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1418
1542
|
return false;
|
|
1419
1543
|
const allColumns = orderedColumnNames.filter((row) => {
|
|
1420
1544
|
const [table, _] = row.split('.');
|
|
1421
|
-
|
|
1545
|
+
const selectedTable = selectedColumns[0].split('.')[0];
|
|
1546
|
+
return selectedTable === table;
|
|
1422
1547
|
});
|
|
1423
1548
|
return selectedColumns.length === allColumns.length;
|
|
1424
1549
|
};
|
|
@@ -1437,12 +1562,12 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1437
1562
|
fontSize: 18,
|
|
1438
1563
|
margin: 0,
|
|
1439
1564
|
textAlign: 'left',
|
|
1440
|
-
}, children: "Add condition" }), (0, jsx_runtime_1.jsx)(
|
|
1565
|
+
}, children: "Add condition" }), (0, jsx_runtime_1.jsx)(TabsComponent, { value: topLevelBinaryOperator, options: UiComponents_1.DEFAULT_TAB_OPTIONS, onChange: (event) => setTopLevelBinaryOperator(event.target.value) }), activeEditItem && renderNode(activeEditItem), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
1441
1566
|
display: 'flex',
|
|
1442
1567
|
flexDirection: 'row',
|
|
1443
1568
|
gap: 8,
|
|
1444
1569
|
justifyContent: 'end',
|
|
1445
|
-
}, children: (0, jsx_runtime_1.jsx)(
|
|
1570
|
+
}, children: (0, jsx_runtime_1.jsx)(ButtonComponent, { onClick: onSave, label: 'Add condition' }) })] }));
|
|
1446
1571
|
};
|
|
1447
1572
|
const fetchUponChange = async (baseAst, newFormData) => {
|
|
1448
1573
|
// if newFormData is null still use it
|
|
@@ -1703,9 +1828,8 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1703
1828
|
newAst = (0, convert_1.convertRemoveSimpleParentheses)(newAst);
|
|
1704
1829
|
const table = (0, ast_1.getTableNames)(newAst)[0] ?? initialTableName;
|
|
1705
1830
|
const tableAlias = (0, ast_1.getTableAliases)(newAst)[0] ?? initialTableName;
|
|
1706
|
-
newAst = (0, util_1.removeNonSelectedTableReferences)(newAst, tableAlias ?? table);
|
|
1831
|
+
newAst = (0, util_1.removeNonSelectedTableReferences)(newAst, tableAlias ?? table, getAllPossibleColumns().map((col) => col.name));
|
|
1707
1832
|
// newAst = convertDateComparison(newAst); // TODO
|
|
1708
|
-
ast = newAst; // so we fetch data for newAst later.
|
|
1709
1833
|
if (table !== currentTable) {
|
|
1710
1834
|
await getDistinctValues(table);
|
|
1711
1835
|
setCurrentTable(table);
|
|
@@ -1725,6 +1849,7 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1725
1849
|
}));
|
|
1726
1850
|
if (groupByPivot) {
|
|
1727
1851
|
setBaseAst((0, util_1.deepCopy)({ ...newAst, orderby: null, limit: null }));
|
|
1852
|
+
newAst = (0, util_1.deepCopy)({ ...newAst, orderby: null, limit: null });
|
|
1728
1853
|
}
|
|
1729
1854
|
else {
|
|
1730
1855
|
setBaseAst((0, util_1.deepCopy)({ ...newAst }));
|
|
@@ -1734,6 +1859,7 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1734
1859
|
// @ts-ignore
|
|
1735
1860
|
newAst?.where ? newAst?.where?.operator : 'AND');
|
|
1736
1861
|
}
|
|
1862
|
+
ast = newAst; // so we fetch data for newAst later.
|
|
1737
1863
|
const res2 = await fetch('https://quill-344421.uc.r.appspot.com/patterns', {
|
|
1738
1864
|
method: 'POST',
|
|
1739
1865
|
headers: {
|
|
@@ -1814,11 +1940,11 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1814
1940
|
fetchSqlQuery(newAst);
|
|
1815
1941
|
};
|
|
1816
1942
|
function TopLevelBooleanSwitch({ node, keyPrefix, handleOperatorChange, }) {
|
|
1817
|
-
return ((0, jsx_runtime_1.jsx)("div", { style: { width: 'fit-content' }, children: (0, jsx_runtime_1.jsx)(
|
|
1943
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: { width: 'fit-content' }, children: (0, jsx_runtime_1.jsx)(TabsComponent, { value: node.operator, options: UiComponents_1.DEFAULT_TAB_OPTIONS, onChange: (event) => {
|
|
1818
1944
|
if (loading) {
|
|
1819
1945
|
return;
|
|
1820
1946
|
}
|
|
1821
|
-
handleOperatorChange(value, node, keyPrefix);
|
|
1947
|
+
handleOperatorChange(event.target.value, node, keyPrefix);
|
|
1822
1948
|
} }) }));
|
|
1823
1949
|
}
|
|
1824
1950
|
const DraggableItem = ({ id, label, onDelete }) => {
|
|
@@ -1827,9 +1953,9 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1827
1953
|
transform: utilities_1.CSS.Transform.toString(transform),
|
|
1828
1954
|
transition,
|
|
1829
1955
|
};
|
|
1830
|
-
return ((0, jsx_runtime_1.jsx)("div", { style: { ...style }, ref: setNodeRef, children: (0, jsx_runtime_1.jsx)(
|
|
1956
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: { ...style }, ref: setNodeRef, children: (0, jsx_runtime_1.jsx)(DraggableColumnComponent, { label: (0, textProcessing_1.snakeCaseToTitleCase)(label), onDelete: onDelete, DragHandle: (props) => ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
1831
1957
|
cursor: 'grab',
|
|
1832
|
-
}, ...attributes, ...listeners, children: (0, jsx_runtime_1.jsx)(
|
|
1958
|
+
}, ...attributes, ...listeners, children: (0, jsx_runtime_1.jsx)(props.dragIcon, {}) })) }) }));
|
|
1833
1959
|
};
|
|
1834
1960
|
function DraggableColumns() {
|
|
1835
1961
|
const sensors = (0, core_1.useSensors)((0, core_1.useSensor)(core_1.PointerSensor), (0, core_1.useSensor)(core_1.KeyboardSensor, {
|
|
@@ -1838,9 +1964,11 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1838
1964
|
// When a drag event ends, switch the item order.
|
|
1839
1965
|
function handleDragEnd(event) {
|
|
1840
1966
|
const { active, over } = event;
|
|
1967
|
+
if (!active || !over)
|
|
1968
|
+
return;
|
|
1841
1969
|
if (active.id !== over.id) {
|
|
1842
|
-
const oldIndex = orderedColumnNames.findIndex((c) => c.endsWith(active.id));
|
|
1843
|
-
const newIndex = orderedColumnNames.findIndex((c) => c.endsWith(over.id));
|
|
1970
|
+
const oldIndex = orderedColumnNames.findIndex((c) => c.endsWith(`${currentTable}.${active.id}`));
|
|
1971
|
+
const newIndex = orderedColumnNames.findIndex((c) => c.endsWith(`${currentTable}.${over.id}`));
|
|
1844
1972
|
const newOrder = (0, sortable_1.arrayMove)(orderedColumnNames, oldIndex, newIndex);
|
|
1845
1973
|
setOrderedColumnNames(newOrder);
|
|
1846
1974
|
const orderedSelectedColumns = [];
|
|
@@ -1850,6 +1978,7 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1850
1978
|
orderedSelectedColumns.push(column);
|
|
1851
1979
|
}
|
|
1852
1980
|
}
|
|
1981
|
+
setSelectedOrderedColumns(orderedSelectedColumns);
|
|
1853
1982
|
// If there is already an AST saved in state, only update the columns
|
|
1854
1983
|
// otherwise fill in the defaultAST shape and also update columns.
|
|
1855
1984
|
const fallbackAST = {
|
|
@@ -1865,7 +1994,7 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1865
1994
|
};
|
|
1866
1995
|
const newAst = baseAst ? newBaseAst : fallbackAST;
|
|
1867
1996
|
setBaseAst(newAst);
|
|
1868
|
-
fetchSqlQuery(newAst);
|
|
1997
|
+
fetchSqlQuery(newAst, undefined, false);
|
|
1869
1998
|
}
|
|
1870
1999
|
}
|
|
1871
2000
|
const columnNamesInAst = baseAst?.columns.map((col) => {
|
|
@@ -1895,25 +2024,27 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1895
2024
|
flexDirection: 'row',
|
|
1896
2025
|
height: '100%',
|
|
1897
2026
|
...containerStyle,
|
|
1898
|
-
}, ref: parentRef, children: [(0, jsx_runtime_1.jsxs)(
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
2027
|
+
}, ref: parentRef, children: [(0, jsx_runtime_1.jsxs)(SidebarComponent, { children: [(0, jsx_runtime_1.jsx)(SidebarHeadingComponent, { label: "Columns" }), (0, jsx_runtime_1.jsx)("div", { style: { height: 4, width: '100%' } }), (0, jsx_runtime_1.jsx)(DraggableColumns, {}), (0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { onClick: () => {
|
|
2028
|
+
if (loadingSchema)
|
|
2029
|
+
return;
|
|
2030
|
+
if (!openPopover) {
|
|
2031
|
+
setOpenPopover('AddColumnPopover');
|
|
2032
|
+
}
|
|
2033
|
+
}, label: 'Select columns' }), (0, jsx_runtime_1.jsx)(PopoverComponent, { isOpen: openPopover === 'AddColumnPopover', setIsOpen: (isOpen) => {
|
|
2034
|
+
if (!isOpen) {
|
|
2035
|
+
setIsPending(false);
|
|
2036
|
+
setActiveEditItem(null);
|
|
2037
|
+
setActivePath(null);
|
|
2038
|
+
setOpenPopover(null);
|
|
2039
|
+
}
|
|
2040
|
+
}, popoverTitle: "Select columns", popoverChildren: (0, jsx_runtime_1.jsx)(AddColumnPopover_1.default, { onSave: () => {
|
|
1910
2041
|
setActiveEditItem(null);
|
|
1911
2042
|
setActivePath(null);
|
|
1912
2043
|
setOpenPopover(null);
|
|
1913
2044
|
}, orderedColumnNames: orderedColumnNames, setOrderedColumnNames: setOrderedColumnNames, selectedColumns: selectedColumns, setSelectedColumns: setSelectedColumns, isSelectedAllColumns: isSelectedAllColumns, clearAllState: clearAllState, nameToColumn: nameToColumn, baseAst: baseAst, setBaseAst: (newAst) => {
|
|
1914
2045
|
setBaseAst(newAst);
|
|
1915
2046
|
fetchSqlQuery(newAst);
|
|
1916
|
-
}, pivot: pivot, initialTableName: initialTableName, defaultAST: constants_1.defaultAST, defaultTable: constants_1.defaultTable, setPivot: setPivot, TextInput:
|
|
2047
|
+
}, pivot: pivot, initialTableName: initialTableName, defaultAST: constants_1.defaultAST, defaultTable: constants_1.defaultTable, setPivot: setPivot, TextInput: TextInputComponent, SelectColumn: SelectColumnComponent, SecondaryButton: SecondaryButtonComponent, Button: ButtonComponent }) }), (0, jsx_runtime_1.jsx)("div", { style: { height: 28, width: '100%' } }), (0, jsx_runtime_1.jsx)(SidebarHeadingComponent, { label: "Filters" }), (0, jsx_runtime_1.jsx)("div", { style: { height: 4, width: '100%' } }), formData && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
1917
2048
|
display: 'flex',
|
|
1918
2049
|
flexDirection: 'column',
|
|
1919
2050
|
gap: 8,
|
|
@@ -1923,39 +2054,41 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1923
2054
|
flexDirection: 'column',
|
|
1924
2055
|
gap: 2.5,
|
|
1925
2056
|
alignItems: 'flex-start',
|
|
1926
|
-
}, children: [(0, jsx_runtime_1.jsx)(
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
2057
|
+
}, children: [(0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { onClick: () => {
|
|
2058
|
+
if (!selectedColumns ||
|
|
2059
|
+
selectedColumns.length === 0 ||
|
|
2060
|
+
loading) {
|
|
2061
|
+
return;
|
|
2062
|
+
}
|
|
2063
|
+
if (!openPopover) {
|
|
2064
|
+
const value = orderedColumnNames[0];
|
|
2065
|
+
const [_table, column] = value.split('.');
|
|
2066
|
+
const columnType = getColumnTypeByName(column);
|
|
2067
|
+
if ((0, ast_1.isNumericColumnType)(columnType)) {
|
|
2068
|
+
const newSubtree = (0, util_1.deepCopy)(constants_1.defaultNumericComparison);
|
|
2069
|
+
newSubtree.left.column = column;
|
|
2070
|
+
setActiveEditItem(newSubtree);
|
|
1931
2071
|
}
|
|
1932
|
-
|
|
1933
|
-
const
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
if ((0, ast_1.isNumericColumnType)(columnType)) {
|
|
1937
|
-
const newSubtree = (0, util_1.deepCopy)(constants_1.defaultNumericComparison);
|
|
1938
|
-
newSubtree.left.column = column;
|
|
1939
|
-
setActiveEditItem(newSubtree);
|
|
1940
|
-
}
|
|
1941
|
-
else {
|
|
1942
|
-
const newSubtree = (0, util_1.deepCopy)(constants_1.defaultEntry);
|
|
1943
|
-
newSubtree.left.args.value[0].column = column;
|
|
1944
|
-
setActiveEditItem(newSubtree);
|
|
1945
|
-
}
|
|
1946
|
-
setOpenPopover('AddFilterPopover');
|
|
1947
|
-
setActivePath('');
|
|
1948
|
-
setIsPending(true);
|
|
2072
|
+
else {
|
|
2073
|
+
const newSubtree = (0, util_1.deepCopy)(constants_1.defaultEntry);
|
|
2074
|
+
newSubtree.left.args.value[0].column = column;
|
|
2075
|
+
setActiveEditItem(newSubtree);
|
|
1949
2076
|
}
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
2077
|
+
setOpenPopover('AddFilterPopover');
|
|
2078
|
+
setActivePath('');
|
|
2079
|
+
setIsPending(true);
|
|
2080
|
+
}
|
|
2081
|
+
}, label: 'Add filter' }), (0, jsx_runtime_1.jsx)(PopoverComponent, { isOpen: openPopover === 'AddFilterPopover', setIsOpen: (isOpen) => {
|
|
2082
|
+
if (!isOpen) {
|
|
2083
|
+
setIsPending(false);
|
|
2084
|
+
setActivePath(null);
|
|
2085
|
+
setOpenPopover(null);
|
|
2086
|
+
clearCheckboxes();
|
|
2087
|
+
setTimeout(() => {
|
|
2088
|
+
setActiveEditItem(null);
|
|
2089
|
+
}, 300);
|
|
2090
|
+
}
|
|
2091
|
+
}, popoverTitle: 'Add filter', popoverChildren: (0, jsx_runtime_1.jsx)(ui_1.AddFilterPopover, { onSave: () => {
|
|
1959
2092
|
if ((0, util_1.isNodeEmptyCollection)(activeEditItem)) {
|
|
1960
2093
|
setIsPending(false);
|
|
1961
2094
|
setActivePath(null);
|
|
@@ -1975,44 +2108,46 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
1975
2108
|
setActiveEditItem(null);
|
|
1976
2109
|
}, 300);
|
|
1977
2110
|
}
|
|
1978
|
-
}, Button:
|
|
2111
|
+
}, Button: ButtonComponent, renderNode: renderNode, activeEditItem: activeEditItem }) }), baseAst?.where &&
|
|
1979
2112
|
false && ( // temp removed the AddConditionPopover
|
|
1980
|
-
(0, jsx_runtime_1.
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2113
|
+
(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { onClick: () => {
|
|
2114
|
+
if (!openPopover) {
|
|
2115
|
+
setActiveEditItem((0, util_1.deepCopy)(constants_1.defaultEntry));
|
|
2116
|
+
setOpenPopover('AddConditionPopover');
|
|
2117
|
+
setActivePath('');
|
|
2118
|
+
setIsPending(true);
|
|
2119
|
+
}
|
|
2120
|
+
}, label: "Add condition" }), (0, jsx_runtime_1.jsx)(PopoverComponent, { isOpen: openPopover === 'AddConditionPopover', setIsOpen: (isOpen) => {
|
|
2121
|
+
if (!isOpen) {
|
|
2122
|
+
setIsPending(false);
|
|
2123
|
+
setTimeout(() => {
|
|
2124
|
+
setActiveEditItem(null);
|
|
2125
|
+
}, 300);
|
|
2126
|
+
setActivePath(null);
|
|
2127
|
+
setOpenPopover(null);
|
|
2128
|
+
clearCheckboxes();
|
|
2129
|
+
}
|
|
2130
|
+
}, popoverTitle: "Add condition", popoverChildren: (0, jsx_runtime_1.jsx)(AddConditionPopover, { onSave: () => {
|
|
2131
|
+
if ((0, util_1.isNodeEmptyCollection)(activeEditItem)) {
|
|
2132
|
+
setIsPending(false);
|
|
2133
|
+
setTimeout(() => {
|
|
2134
|
+
setActiveEditItem(null);
|
|
2135
|
+
}, 300);
|
|
2136
|
+
setActivePath(null);
|
|
2137
|
+
setOpenPopover(null);
|
|
2138
|
+
clearCheckboxes();
|
|
2139
|
+
}
|
|
2140
|
+
else {
|
|
2141
|
+
setIsPending(false);
|
|
2142
|
+
handleInsertion(activeEditItem, topLevelBinaryOperator, true);
|
|
2143
|
+
setTimeout(() => {
|
|
2144
|
+
setActiveEditItem(null);
|
|
2145
|
+
}, 300);
|
|
2146
|
+
setActivePath(null);
|
|
2147
|
+
setOpenPopover(null);
|
|
2148
|
+
clearCheckboxes();
|
|
2149
|
+
}
|
|
2150
|
+
} }) })] }))] }), (0, jsx_runtime_1.jsx)("div", { style: { height: 28, width: '100%' } }), (0, jsx_runtime_1.jsx)(SidebarHeadingComponent, { label: "Pivot" }), (0, jsx_runtime_1.jsx)("div", { style: { height: 4, width: '100%' } }), (0, jsx_runtime_1.jsx)(PivotModal_1.PivotModal, { pivotRowField: pivotRowField, setPivotRowField: setPivotRowField, pivotColumnField: pivotColumnField, setPivotColumnField: setPivotColumnField, pivotValueField: pivotValueField, setPivotValueField: setPivotValueField, pivotAggregation: pivotAggregation, setPivotAggregation: setPivotAggregation, createdPivots: createdPivots, setCreatedPivots: setCreatedPivots, recommendedPivots: recommendedPivots, setRecommendedPivots: setRecommendedPivots, popUpTitle: pivotPopUpTitle, setPopUpTitle: setPivotPopUpTitle, selectedTable: initialTableName, CardComponent: CardComponent, SelectComponent: SelectComponent, ButtonComponent: ButtonComponent, PopoverComponent: PopoverComponent, TextComponent: TextComponent, isOpen: showPivotPopover, setIsOpen: setShowPivotPopover, showUpdatePivot: isEdittingPivot, setShowUpdatePivot: setIsEdittingPivot, parentRef: parentRef, data: rows, columns: processColumnsForChartBuilder(Object.keys(rows[0] ?? {})), triggerButtonText: 'Add pivot', selectedPivotIndex: selectedPivotIndex, setSelectedPivotIndex: setSelectedPivotIndex, removePivot: () => {
|
|
2016
2151
|
setPivot(null);
|
|
2017
2152
|
setPivotData(null);
|
|
2018
2153
|
},
|
|
@@ -2026,7 +2161,7 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
2026
2161
|
setPivot(pivot);
|
|
2027
2162
|
const pivotedData = (0, PivotModal_1.generatePivotTable)(pivot, rows, [null, null, null], false);
|
|
2028
2163
|
setPivotData(pivotedData || []);
|
|
2029
|
-
}, selectPivotOnEdit: true, showTrigger: !pivot, theme: theme, LabelComponent:
|
|
2164
|
+
}, selectPivotOnEdit: true, showTrigger: !pivot, theme: theme, LabelComponent: LabelComponent, HeaderComponent: HeaderComponent, dateRange: [null, null, null], recommendPivotCount: 3, SecondaryButtonComponent: SecondaryButtonComponent }), pivot && ((0, jsx_runtime_1.jsx)(PivotList_1.PivotCard, { pivotTable: {
|
|
2030
2165
|
pivot: pivot,
|
|
2031
2166
|
rows: pivotData?.rows || [],
|
|
2032
2167
|
columns: pivotData?.columns || [],
|
|
@@ -2038,11 +2173,11 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
2038
2173
|
setPivotValueField(pivot?.valueField);
|
|
2039
2174
|
setPivotAggregation(pivot?.aggregationType);
|
|
2040
2175
|
setPivotPopUpTitle('Edit Pivot');
|
|
2041
|
-
}, selectedPivotIndex: -1, onEditPivot: () => { }, ButtonComponent:
|
|
2176
|
+
}, selectedPivotIndex: -1, onEditPivot: () => { }, CardComponent: CardComponent, ButtonComponent: ButtonComponent, HeaderComponent: HeaderComponent, showEdit: false, onClose: () => {
|
|
2042
2177
|
setPivot(null);
|
|
2043
2178
|
setPivotData(null);
|
|
2044
2179
|
setBaseAst((0, util_1.deepCopy)(baseAst)); // trigger refetch
|
|
2045
|
-
}, minHeight: 180, LabelComponent:
|
|
2180
|
+
}, minHeight: 180, LabelComponent: LabelComponent, TextComponent: TextComponent })), (0, jsx_runtime_1.jsx)("div", { style: { height: 28, width: '100%' } }), (0, jsx_runtime_1.jsx)(SidebarHeadingComponent, { label: "Sort" }), (0, jsx_runtime_1.jsx)("div", { style: { height: 4, width: '100%' } }), pivot && pivot.sort && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
2046
2181
|
display: 'flex',
|
|
2047
2182
|
flexDirection: 'column',
|
|
2048
2183
|
gap: 8,
|
|
@@ -2050,7 +2185,7 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
2050
2185
|
}, children: (0, jsx_runtime_1.jsx)(AddSortPopover_1.SortSentence, { sortData: {
|
|
2051
2186
|
type: pivot.sortDirection,
|
|
2052
2187
|
expr: { type: 'column_ref', column: pivot.rowField },
|
|
2053
|
-
}, columns: selectedColumns, setIsPending: setIsPending, setEditPopoverKey: setEditPopoverKey, setActiveEditItem: setActiveEditItem, setOpenPopover: setOpenPopover, SortPopover:
|
|
2188
|
+
}, columns: selectedColumns, setIsPending: setIsPending, setEditPopoverKey: setEditPopoverKey, setActiveEditItem: setActiveEditItem, setActivePath: setActivePath, setOpenPopover: setOpenPopover, SortPopover: SortPopoverComponent, EditPopover: AddSortPopover_1.AddSortPopover, handleDelete: () => {
|
|
2054
2189
|
setPivot({ ...pivot, sort: false });
|
|
2055
2190
|
setBaseAst((0, util_1.deepCopy)(baseAst));
|
|
2056
2191
|
if (!pivot) {
|
|
@@ -2063,7 +2198,7 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
2063
2198
|
if (!pivot) {
|
|
2064
2199
|
fetchSqlQuery(baseAst);
|
|
2065
2200
|
}
|
|
2066
|
-
}, Select:
|
|
2201
|
+
}, Select: SelectComponent, Button: ButtonComponent, SecondaryButton: SecondaryButtonComponent }, `sort-sentence-pivot`) })), baseAst && baseAst.orderby && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
2067
2202
|
display: 'flex',
|
|
2068
2203
|
flexDirection: 'column',
|
|
2069
2204
|
gap: 8,
|
|
@@ -2090,31 +2225,33 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
2090
2225
|
if (!pivot) {
|
|
2091
2226
|
fetchSqlQuery(newAst);
|
|
2092
2227
|
}
|
|
2093
|
-
}, setIsPending: setIsPending, setEditPopoverKey: setEditPopoverKey, setActiveEditItem: setActiveEditItem, setOpenPopover: setOpenPopover, SortPopover:
|
|
2228
|
+
}, setIsPending: setIsPending, setEditPopoverKey: setEditPopoverKey, setActiveEditItem: setActiveEditItem, setActivePath: setActivePath, setOpenPopover: setOpenPopover, SortPopover: SortPopoverComponent, EditPopover: AddSortPopover_1.AddSortPopover, handleDelete: () => {
|
|
2094
2229
|
const newAst = { ...baseAst };
|
|
2095
2230
|
newAst.orderby.splice(id, 1);
|
|
2096
2231
|
setBaseAst((0, util_1.deepCopy)(newAst));
|
|
2097
2232
|
if (!pivot) {
|
|
2098
2233
|
fetchSqlQuery(newAst);
|
|
2099
2234
|
}
|
|
2100
|
-
}, Select:
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2235
|
+
}, Select: SelectComponent, Button: ButtonComponent, SecondaryButton: SecondaryButtonComponent }, `sort-sentence-${id}`))) })), (0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { onClick: () => {
|
|
2236
|
+
if (!selectedColumns || selectedColumns.length === 0) {
|
|
2237
|
+
return;
|
|
2238
|
+
}
|
|
2239
|
+
if (!openPopover) {
|
|
2240
|
+
setOpenPopover('AddSortPopover');
|
|
2241
|
+
}
|
|
2242
|
+
}, label: "Add sort" }), (0, jsx_runtime_1.jsx)(PopoverComponent, { isOpen: openPopover === 'AddSortPopover', setIsOpen: (isOpen) => {
|
|
2243
|
+
if (!isOpen) {
|
|
2244
|
+
setIsPending(false);
|
|
2245
|
+
setActiveEditItem(null);
|
|
2246
|
+
setActivePath(null);
|
|
2247
|
+
setOpenPopover(null);
|
|
2248
|
+
}
|
|
2249
|
+
}, popoverTitle: "Sort by", popoverChildren: (0, jsx_runtime_1.jsx)(AddSortPopover_1.AddSortPopover, { columns: selectedColumns, Select: SelectComponent, Button: ButtonComponent, onSave: () => { } }) }), (0, jsx_runtime_1.jsx)("div", { style: { height: 28, width: '100%' } }), (0, jsx_runtime_1.jsx)(SidebarHeadingComponent, { label: "Limit" }), (0, jsx_runtime_1.jsx)("div", { style: { height: 4, width: '100%' } }), baseAst && baseAst.limit ? ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
2113
2250
|
display: 'flex',
|
|
2114
2251
|
flexDirection: 'column',
|
|
2115
2252
|
gap: 8,
|
|
2116
2253
|
marginBottom: 12,
|
|
2117
|
-
}, children: (0, jsx_runtime_1.jsx)(AddLimitPopover_1.LimitSentence, { limit: baseAst.limit, setOpenPopover: setOpenPopover, LimitPopover:
|
|
2254
|
+
}, children: (0, jsx_runtime_1.jsx)(AddLimitPopover_1.LimitSentence, { limit: baseAst.limit, setOpenPopover: setOpenPopover, LimitPopover: LimitPopoverComponent, EditPopover: AddLimitPopover_1.AddLimitPopover, handleDelete: () => {
|
|
2118
2255
|
const newAst = { ...baseAst };
|
|
2119
2256
|
newAst.limit = null;
|
|
2120
2257
|
setBaseAst((0, util_1.deepCopy)(newAst));
|
|
@@ -2133,27 +2270,29 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
2133
2270
|
setOpenPopover(null);
|
|
2134
2271
|
setBaseAst((0, util_1.deepCopy)(newAst));
|
|
2135
2272
|
fetchSqlQuery(newAst);
|
|
2136
|
-
}, TextInput:
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2273
|
+
}, TextInput: TextInputComponent, Button: ButtonComponent, SecondaryButton: SecondaryButtonComponent }) })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { onClick: () => {
|
|
2274
|
+
if (!openPopover) {
|
|
2275
|
+
setOpenPopover('AddLimitPopover');
|
|
2276
|
+
}
|
|
2277
|
+
}, label: 'Add limit' }), (0, jsx_runtime_1.jsx)(PopoverComponent, { isOpen: openPopover === 'AddLimitPopover', setIsOpen: (isOpen) => {
|
|
2278
|
+
if (!isOpen) {
|
|
2279
|
+
setIsPending(false);
|
|
2280
|
+
setActiveEditItem(null);
|
|
2281
|
+
setActivePath(null);
|
|
2282
|
+
setOpenPopover(null);
|
|
2283
|
+
}
|
|
2284
|
+
}, popoverTitle: "Limit", popoverChildren: (0, jsx_runtime_1.jsx)(TextInputComponent, { id: "loading_input_limit", value: '0', width: 120, onChange: () => { } }) })] }))] }), (0, jsx_runtime_1.jsxs)(ContainerComponent, { children: [isAIEnabled && ((0, jsx_runtime_1.jsxs)("form", { ref: askAILoadingContainerRef, onSubmit: (event) => {
|
|
2146
2285
|
event.preventDefault();
|
|
2147
2286
|
}, style: {
|
|
2148
2287
|
display: 'flex',
|
|
2149
2288
|
flexDirection: 'row',
|
|
2150
2289
|
gap: 12,
|
|
2151
2290
|
padding: 1,
|
|
2152
|
-
}, children: [(0, jsx_runtime_1.jsx)(
|
|
2291
|
+
}, children: [(0, jsx_runtime_1.jsx)(TextInputComponent, { id: "ask_ai_loading_bar", placeholder: baseAst ? 'Ask a follow-up question...' : 'Ask a question...', width: askAILoadingContainerWidth, value: aiPrompt, onChange: () => { } }), (0, jsx_runtime_1.jsx)(ButtonComponent, { onClick: () => { }, label: "Ask AI" }), baseAst && ((0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { onClick: clearAllState, label: "New report" }))] })), (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(TableComponent, { isLoading: true, rows: [], columns: [] }), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
2153
2292
|
display: 'flex',
|
|
2154
2293
|
flexDirection: 'row',
|
|
2155
2294
|
gap: '12px',
|
|
2156
|
-
}, children: [(0, jsx_runtime_1.jsx)("div", { style: { width: '100%' } }), (0, jsx_runtime_1.jsx)(
|
|
2295
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: { width: '100%' } }), (0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { onClick: () => copyToClipboard(activeQuery), label: isCopying ? '✅ Copied' : 'Copy SQL' }), (0, jsx_runtime_1.jsx)(ButtonComponent, { label: 'Add to dashboard', onClick: () => { } })] })] })] }), (0, jsx_runtime_1.jsx)("style", { children: `body{margin:0;}` })] }));
|
|
2157
2296
|
}
|
|
2158
2297
|
return ((0, jsx_runtime_1.jsxs)("div", { ref: parentRef, style: {
|
|
2159
2298
|
display: 'flex',
|
|
@@ -2162,26 +2301,31 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
2162
2301
|
overflowY: 'auto',
|
|
2163
2302
|
boxSizing: 'border-box',
|
|
2164
2303
|
...containerStyle,
|
|
2165
|
-
}, children: [(0, jsx_runtime_1.jsxs)(
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2304
|
+
}, children: [(0, jsx_runtime_1.jsxs)(SidebarComponent, { children: [(0, jsx_runtime_1.jsx)(SidebarHeadingComponent, { label: "Columns" }), (0, jsx_runtime_1.jsx)("div", { style: { height: 4, width: '100%' } }), (0, jsx_runtime_1.jsx)(DraggableColumns, {}), (0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { onClick: () => {
|
|
2305
|
+
if (!orderedColumnNames) {
|
|
2306
|
+
return;
|
|
2307
|
+
}
|
|
2308
|
+
if (!openPopover) {
|
|
2309
|
+
setOpenPopover('AddColumnPopover');
|
|
2310
|
+
}
|
|
2311
|
+
}, label: "Select columns" }), (0, jsx_runtime_1.jsx)(PopoverComponent, { isOpen: openPopover === 'AddColumnPopover', setIsOpen: (isOpen) => {
|
|
2312
|
+
if (!isOpen) {
|
|
2313
|
+
// delay onClose callback so onClick no-ops
|
|
2314
|
+
setTimeout(() => {
|
|
2315
|
+
setIsPending(false);
|
|
2316
|
+
setActiveEditItem(null);
|
|
2317
|
+
setActivePath(null);
|
|
2318
|
+
setOpenPopover(null);
|
|
2319
|
+
}, 100);
|
|
2320
|
+
}
|
|
2321
|
+
}, popoverTitle: "Select columns", popoverChildren: (0, jsx_runtime_1.jsx)(AddColumnPopover_1.default, { onSave: () => {
|
|
2178
2322
|
setActiveEditItem(null);
|
|
2179
2323
|
setActivePath(null);
|
|
2180
2324
|
setOpenPopover(null);
|
|
2181
2325
|
}, orderedColumnNames: orderedColumnNames, setOrderedColumnNames: setOrderedColumnNames, selectedColumns: selectedColumns, setSelectedColumns: setSelectedColumns, isSelectedAllColumns: isSelectedAllColumns, clearAllState: clearAllState, nameToColumn: nameToColumn, baseAst: baseAst, setBaseAst: (ast) => {
|
|
2182
2326
|
setBaseAst(ast);
|
|
2183
2327
|
fetchSqlQuery(ast);
|
|
2184
|
-
}, pivot: pivot, initialTableName: initialTableName, defaultAST: constants_1.defaultAST, defaultTable: constants_1.defaultTable, setPivot: setPivot, TextInput:
|
|
2328
|
+
}, pivot: pivot, initialTableName: initialTableName, defaultAST: constants_1.defaultAST, defaultTable: constants_1.defaultTable, setPivot: setPivot, TextInput: TextInputComponent, SelectColumn: SelectColumnComponent, SecondaryButton: SecondaryButtonComponent, Button: ButtonComponent }) }), (0, jsx_runtime_1.jsx)("div", { style: { height: 28, width: '100%' } }), (0, jsx_runtime_1.jsx)(SidebarHeadingComponent, { label: "Filters" }), (0, jsx_runtime_1.jsx)("div", { style: { height: 4, width: '100%' } }), formData && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
2185
2329
|
display: 'flex',
|
|
2186
2330
|
flexDirection: 'column',
|
|
2187
2331
|
gap: 8,
|
|
@@ -2191,52 +2335,42 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
2191
2335
|
flexDirection: 'column',
|
|
2192
2336
|
gap: 2.5,
|
|
2193
2337
|
alignItems: 'flex-start',
|
|
2194
|
-
}, children: [(0, jsx_runtime_1.jsx)(
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2338
|
+
}, children: [(0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { onClick: () => {
|
|
2339
|
+
if (!selectedColumns || selectedColumns.length === 0 || loading) {
|
|
2340
|
+
return;
|
|
2341
|
+
}
|
|
2342
|
+
if (!openPopover) {
|
|
2343
|
+
const value = orderedColumnNames[0];
|
|
2344
|
+
const [_table, column] = value.split('.');
|
|
2345
|
+
const columnType = getColumnTypeByName(column);
|
|
2346
|
+
if ((0, ast_1.isNumericColumnType)(columnType)) {
|
|
2347
|
+
const newSubtree = (0, util_1.deepCopy)(constants_1.defaultNumericComparison);
|
|
2348
|
+
newSubtree.left.column = column;
|
|
2349
|
+
setActiveEditItem(newSubtree);
|
|
2199
2350
|
}
|
|
2200
|
-
|
|
2201
|
-
const
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
if ((0, ast_1.isNumericColumnType)(columnType)) {
|
|
2205
|
-
const newSubtree = (0, util_1.deepCopy)(constants_1.defaultNumericComparison);
|
|
2206
|
-
newSubtree.left.column = column;
|
|
2207
|
-
setActiveEditItem(newSubtree);
|
|
2208
|
-
}
|
|
2209
|
-
else {
|
|
2210
|
-
const newSubtree = (0, util_1.deepCopy)(constants_1.defaultEntry);
|
|
2211
|
-
newSubtree.left.args.value[0].column = column;
|
|
2212
|
-
setActiveEditItem(newSubtree);
|
|
2213
|
-
}
|
|
2214
|
-
setOpenPopover('AddFilterPopover');
|
|
2215
|
-
setActivePath('');
|
|
2216
|
-
setIsPending(true);
|
|
2351
|
+
else {
|
|
2352
|
+
const newSubtree = (0, util_1.deepCopy)(constants_1.defaultEntry);
|
|
2353
|
+
newSubtree.left.args.value[0].column = column;
|
|
2354
|
+
setActiveEditItem(newSubtree);
|
|
2217
2355
|
}
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
}, 200);
|
|
2227
|
-
}, children: (0, jsx_runtime_1.jsx)(ui_1.AddFilterPopover, { onSave: () => {
|
|
2228
|
-
if ((0, util_1.isNodeEmptyCollection)(activeEditItem)) {
|
|
2356
|
+
setOpenPopover('AddFilterPopover');
|
|
2357
|
+
setActivePath('');
|
|
2358
|
+
setIsPending(true);
|
|
2359
|
+
}
|
|
2360
|
+
}, label: 'Add filter' }), (0, jsx_runtime_1.jsx)(PopoverComponent, { isOpen: openPopover === 'AddFilterPopover', setIsOpen: (isOpen) => {
|
|
2361
|
+
if (!isOpen) {
|
|
2362
|
+
// delay onClose callback so onClick no-ops
|
|
2363
|
+
setTimeout(() => {
|
|
2229
2364
|
setIsPending(false);
|
|
2230
2365
|
setActivePath(null);
|
|
2231
2366
|
setOpenPopover(null);
|
|
2232
2367
|
clearCheckboxes();
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2368
|
+
setActiveEditItem(null);
|
|
2369
|
+
}, 200);
|
|
2370
|
+
}
|
|
2371
|
+
}, popoverTitle: "Add filter", popoverChildren: (0, jsx_runtime_1.jsx)(ui_1.AddFilterPopover, { onSave: () => {
|
|
2372
|
+
if ((0, util_1.isNodeEmptyCollection)(activeEditItem)) {
|
|
2238
2373
|
setIsPending(false);
|
|
2239
|
-
handleInsertion(activeEditItem, 'AND', false);
|
|
2240
2374
|
setActivePath(null);
|
|
2241
2375
|
setOpenPopover(null);
|
|
2242
2376
|
clearCheckboxes();
|
|
@@ -2244,45 +2378,57 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
2244
2378
|
setActiveEditItem(null);
|
|
2245
2379
|
}, 300);
|
|
2246
2380
|
}
|
|
2247
|
-
|
|
2248
|
-
false && ( // temp removed the AddConditionPopover
|
|
2249
|
-
(0, jsx_runtime_1.jsx)(Popover, { isOpen: openPopover === 'AddConditionPopover', trigger: (0, jsx_runtime_1.jsx)(SecondaryButton, { onClick: () => {
|
|
2250
|
-
if (!openPopover) {
|
|
2251
|
-
setActiveEditItem((0, util_1.deepCopy)(constants_1.defaultEntry));
|
|
2252
|
-
setOpenPopover('AddConditionPopover');
|
|
2253
|
-
setActivePath('');
|
|
2254
|
-
setIsPending(true);
|
|
2255
|
-
}
|
|
2256
|
-
}, label: 'Add condition' }), onClose: () => {
|
|
2257
|
-
// delay onClose callback so onClick no-ops
|
|
2258
|
-
setTimeout(() => {
|
|
2259
|
-
setIsPending(false);
|
|
2260
|
-
setActiveEditItem(null);
|
|
2261
|
-
setActivePath(null);
|
|
2262
|
-
setOpenPopover(null);
|
|
2263
|
-
clearCheckboxes();
|
|
2264
|
-
}, 200);
|
|
2265
|
-
}, children: (0, jsx_runtime_1.jsx)(AddConditionPopover, { onSave: () => {
|
|
2266
|
-
if ((0, util_1.isNodeEmptyCollection)(activeEditItem)) {
|
|
2381
|
+
else {
|
|
2267
2382
|
setIsPending(false);
|
|
2268
|
-
|
|
2269
|
-
setActiveEditItem(null);
|
|
2270
|
-
}, 300);
|
|
2383
|
+
handleInsertion(activeEditItem, 'AND', false);
|
|
2271
2384
|
setActivePath(null);
|
|
2272
2385
|
setOpenPopover(null);
|
|
2273
2386
|
clearCheckboxes();
|
|
2274
|
-
}
|
|
2275
|
-
else {
|
|
2276
|
-
setIsPending(false);
|
|
2277
|
-
handleInsertion(activeEditItem, topLevelBinaryOperator, true);
|
|
2278
2387
|
setTimeout(() => {
|
|
2279
2388
|
setActiveEditItem(null);
|
|
2280
2389
|
}, 300);
|
|
2281
|
-
setActivePath(null);
|
|
2282
|
-
setOpenPopover(null);
|
|
2283
|
-
clearCheckboxes();
|
|
2284
2390
|
}
|
|
2285
|
-
}
|
|
2391
|
+
}, Button: ButtonComponent, renderNode: renderNode, activeEditItem: activeEditItem }) }), baseAst?.where &&
|
|
2392
|
+
false && ( // temp removed the AddConditionPopover
|
|
2393
|
+
(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { onClick: () => {
|
|
2394
|
+
if (!openPopover) {
|
|
2395
|
+
setActiveEditItem((0, util_1.deepCopy)(constants_1.defaultEntry));
|
|
2396
|
+
setOpenPopover('AddConditionPopover');
|
|
2397
|
+
setActivePath('');
|
|
2398
|
+
setIsPending(true);
|
|
2399
|
+
}
|
|
2400
|
+
}, label: 'Add condition' }), (0, jsx_runtime_1.jsx)(PopoverComponent, { isOpen: openPopover === 'AddConditionPopover', setIsOpen: (isOpen) => {
|
|
2401
|
+
if (!isOpen) {
|
|
2402
|
+
// delay onClose callback so onClick no-ops
|
|
2403
|
+
setTimeout(() => {
|
|
2404
|
+
setIsPending(false);
|
|
2405
|
+
setActiveEditItem(null);
|
|
2406
|
+
setActivePath(null);
|
|
2407
|
+
setOpenPopover(null);
|
|
2408
|
+
clearCheckboxes();
|
|
2409
|
+
}, 200);
|
|
2410
|
+
}
|
|
2411
|
+
}, popoverChildren: (0, jsx_runtime_1.jsx)(AddConditionPopover, { onSave: () => {
|
|
2412
|
+
if ((0, util_1.isNodeEmptyCollection)(activeEditItem)) {
|
|
2413
|
+
setIsPending(false);
|
|
2414
|
+
setTimeout(() => {
|
|
2415
|
+
setActiveEditItem(null);
|
|
2416
|
+
}, 300);
|
|
2417
|
+
setActivePath(null);
|
|
2418
|
+
setOpenPopover(null);
|
|
2419
|
+
clearCheckboxes();
|
|
2420
|
+
}
|
|
2421
|
+
else {
|
|
2422
|
+
setIsPending(false);
|
|
2423
|
+
handleInsertion(activeEditItem, topLevelBinaryOperator, true);
|
|
2424
|
+
setTimeout(() => {
|
|
2425
|
+
setActiveEditItem(null);
|
|
2426
|
+
}, 300);
|
|
2427
|
+
setActivePath(null);
|
|
2428
|
+
setOpenPopover(null);
|
|
2429
|
+
clearCheckboxes();
|
|
2430
|
+
}
|
|
2431
|
+
} }) })] }))] }), (0, jsx_runtime_1.jsx)("div", { style: { height: 28, width: '100%' } }), (0, jsx_runtime_1.jsx)(SidebarHeadingComponent, { label: "Pivot" }), (0, jsx_runtime_1.jsx)("div", { style: { height: 4, width: '100%' } }), (0, jsx_runtime_1.jsx)(PivotModal_1.PivotModal, { pivotRowField: pivotRowField, setPivotRowField: setPivotRowField, pivotColumnField: pivotColumnField, setPivotColumnField: setPivotColumnField, pivotValueField: pivotValueField, setPivotValueField: setPivotValueField, pivotAggregation: pivotAggregation, setPivotAggregation: setPivotAggregation, createdPivots: createdPivots, setCreatedPivots: setCreatedPivots, recommendedPivots: recommendedPivots, setRecommendedPivots: setRecommendedPivots, popUpTitle: pivotPopUpTitle, setPopUpTitle: setPivotPopUpTitle, selectedTable: initialTableName, SelectComponent: SelectComponent, ButtonComponent: ButtonComponent, CardComponent: CardComponent, SecondaryButtonComponent: SecondaryButtonComponent, PopoverComponent: PopoverComponent, TextComponent: TextComponent, isOpen: showPivotPopover, setIsOpen: setShowPivotPopover, showUpdatePivot: isEdittingPivot, setShowUpdatePivot: setIsEdittingPivot, parentRef: parentRef, data: rows, columns: processColumnsForChartBuilder(Object.keys(rows[0] ?? {})), triggerButtonText: 'Add pivot', selectedPivotIndex: selectedPivotIndex, setSelectedPivotIndex: setSelectedPivotIndex, removePivot: () => {
|
|
2286
2432
|
setPivot(null);
|
|
2287
2433
|
setPivotData(null);
|
|
2288
2434
|
}, selectPivot: (pivot) => {
|
|
@@ -2298,7 +2444,7 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
2298
2444
|
setPivot(pivot);
|
|
2299
2445
|
const pivotedData = (0, PivotModal_1.generatePivotTable)(pivot, rows, [null, null, null], false);
|
|
2300
2446
|
setPivotData(pivotedData || []);
|
|
2301
|
-
}, selectPivotOnEdit: true, showTrigger: !pivot, theme: theme, LabelComponent:
|
|
2447
|
+
}, selectPivotOnEdit: true, showTrigger: !pivot, theme: theme, LabelComponent: LabelComponent, HeaderComponent: HeaderComponent, dateRange: [null, null, null], recommendPivotCount: 3 }), pivot && ((0, jsx_runtime_1.jsx)(PivotList_1.PivotCard, { pivotTable: {
|
|
2302
2448
|
pivot: pivot,
|
|
2303
2449
|
rows: pivotData?.rows || [],
|
|
2304
2450
|
columns: pivotData?.columns || [],
|
|
@@ -2310,11 +2456,11 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
2310
2456
|
setPivotValueField(pivot?.valueField);
|
|
2311
2457
|
setPivotAggregation(pivot?.aggregationType);
|
|
2312
2458
|
setPivotPopUpTitle('Edit Pivot');
|
|
2313
|
-
}, selectedPivotIndex: -1, onEditPivot: () => { }, ButtonComponent:
|
|
2459
|
+
}, selectedPivotIndex: -1, onEditPivot: () => { }, ButtonComponent: ButtonComponent, HeaderComponent: HeaderComponent, CardComponent: CardComponent, showEdit: false, onClose: () => {
|
|
2314
2460
|
setPivot(null);
|
|
2315
2461
|
setPivotData(null);
|
|
2316
2462
|
setBaseAst((0, util_1.deepCopy)(baseAst));
|
|
2317
|
-
}, minHeight: 180, LabelComponent:
|
|
2463
|
+
}, minHeight: 180, LabelComponent: LabelComponent, TextComponent: TextComponent })), (0, jsx_runtime_1.jsx)("div", { style: { height: 28, width: '100%' } }), (0, jsx_runtime_1.jsx)(SidebarHeadingComponent, { label: "Sort" }), (0, jsx_runtime_1.jsx)("div", { style: { height: 4, width: '100%' } }), pivot && pivot.sort && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
2318
2464
|
display: 'flex',
|
|
2319
2465
|
flexDirection: 'column',
|
|
2320
2466
|
gap: 8,
|
|
@@ -2322,7 +2468,7 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
2322
2468
|
}, children: (0, jsx_runtime_1.jsx)(AddSortPopover_1.SortSentence, { sortData: {
|
|
2323
2469
|
type: pivot.sortDirection,
|
|
2324
2470
|
expr: { type: 'column_ref', column: pivot.rowField },
|
|
2325
|
-
}, columns: pivot ? [`.${pivot.rowField}`] : selectedColumns, setIsPending: setIsPending, setEditPopoverKey: setEditPopoverKey, setActiveEditItem: setActiveEditItem, setOpenPopover: setOpenPopover, SortPopover:
|
|
2471
|
+
}, columns: pivot ? [`.${pivot.rowField}`] : selectedColumns, setIsPending: setIsPending, setEditPopoverKey: setEditPopoverKey, setActiveEditItem: setActiveEditItem, setActivePath: setActivePath, setOpenPopover: setOpenPopover, SortPopover: SortPopoverComponent, EditPopover: AddSortPopover_1.AddSortPopover, handleDelete: () => {
|
|
2326
2472
|
if (pivot) {
|
|
2327
2473
|
setPivot({ ...pivot, sort: false });
|
|
2328
2474
|
const pivotedData = (0, PivotModal_1.generatePivotTable)({ ...pivot, sort: false }, rows, [null, null, null], false);
|
|
@@ -2341,12 +2487,12 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
2341
2487
|
setOpenPopover(null);
|
|
2342
2488
|
setBaseAst((0, util_1.deepCopy)(baseAst));
|
|
2343
2489
|
fetchSqlQuery((0, util_1.deepCopy)(baseAst));
|
|
2344
|
-
}, Select:
|
|
2490
|
+
}, Select: SelectComponent, Button: ButtonComponent, SecondaryButton: SecondaryButtonComponent }, `sort-sentence-pivot`) })), baseAst && baseAst.orderby && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
2345
2491
|
display: 'flex',
|
|
2346
2492
|
flexDirection: 'column',
|
|
2347
2493
|
gap: 8,
|
|
2348
2494
|
marginBottom: 12,
|
|
2349
|
-
}, children: baseAst.orderby.map((sortData, id) => ((0, jsx_runtime_1.jsx)(AddSortPopover_1.SortSentence, { sortData: sortData, columns: selectedColumns, setIsPending: setIsPending, setEditPopoverKey: setEditPopoverKey, setActiveEditItem: setActiveEditItem, setOpenPopover: setOpenPopover, SortPopover:
|
|
2495
|
+
}, children: baseAst.orderby.map((sortData, id) => ((0, jsx_runtime_1.jsx)(AddSortPopover_1.SortSentence, { sortData: sortData, columns: selectedColumns, setIsPending: setIsPending, setEditPopoverKey: setEditPopoverKey, setActiveEditItem: setActiveEditItem, setActivePath: setActivePath, setOpenPopover: setOpenPopover, SortPopover: SortPopoverComponent, EditPopover: AddSortPopover_1.AddSortPopover, handleDelete: () => {
|
|
2350
2496
|
if (pivot) {
|
|
2351
2497
|
setPivot({ ...pivot, sort: false });
|
|
2352
2498
|
return;
|
|
@@ -2383,19 +2529,21 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
2383
2529
|
setOpenPopover(null);
|
|
2384
2530
|
setBaseAst((0, util_1.deepCopy)(newAst));
|
|
2385
2531
|
fetchSqlQuery((0, util_1.deepCopy)(newAst));
|
|
2386
|
-
}, Select:
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2532
|
+
}, Select: SelectComponent, Button: ButtonComponent, SecondaryButton: SecondaryButtonComponent }, `sort-sentence-${id}`))) })), (0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { onClick: () => {
|
|
2533
|
+
if (!selectedColumns || selectedColumns.length === 0) {
|
|
2534
|
+
return;
|
|
2535
|
+
}
|
|
2536
|
+
if (!openPopover) {
|
|
2537
|
+
setOpenPopover('AddSortPopover');
|
|
2538
|
+
}
|
|
2539
|
+
}, label: 'Add sort' }), (0, jsx_runtime_1.jsx)(PopoverComponent, { isOpen: openPopover === 'AddSortPopover', setIsOpen: (isOpen) => {
|
|
2540
|
+
if (!isOpen) {
|
|
2541
|
+
setIsPending(false);
|
|
2542
|
+
setActiveEditItem(null);
|
|
2543
|
+
setActivePath(null);
|
|
2544
|
+
setOpenPopover(null);
|
|
2545
|
+
}
|
|
2546
|
+
}, popoverTitle: "Sort by", popoverChildren: (0, jsx_runtime_1.jsx)(AddSortPopover_1.AddSortPopover, { columns: pivot ? [`.${pivot.rowField}`] : selectedColumns, Select: SelectComponent, Button: ButtonComponent, SecondaryButton: SecondaryButtonComponent, onSave: (column, direction) => {
|
|
2399
2547
|
if (column === '')
|
|
2400
2548
|
return;
|
|
2401
2549
|
if (pivot) {
|
|
@@ -2419,12 +2567,12 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
2419
2567
|
setOpenPopover(null);
|
|
2420
2568
|
setBaseAst((0, util_1.deepCopy)(newAst));
|
|
2421
2569
|
fetchSqlQuery((0, util_1.deepCopy)(newAst));
|
|
2422
|
-
} }) }), (0, jsx_runtime_1.jsx)("div", { style: { height: 28, width: '100%' } }), (0, jsx_runtime_1.jsx)(
|
|
2570
|
+
} }) }), (0, jsx_runtime_1.jsx)("div", { style: { height: 28, width: '100%' } }), (0, jsx_runtime_1.jsx)(SidebarHeadingComponent, { label: "Limit" }), (0, jsx_runtime_1.jsx)("div", { style: { height: 4, width: '100%' } }), baseAst && baseAst.limit ? ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
2423
2571
|
display: 'flex',
|
|
2424
2572
|
flexDirection: 'column',
|
|
2425
2573
|
gap: 8,
|
|
2426
2574
|
marginBottom: 12,
|
|
2427
|
-
}, children: (0, jsx_runtime_1.jsx)(AddLimitPopover_1.LimitSentence, { limit: baseAst.limit, setOpenPopover: setOpenPopover, LimitPopover:
|
|
2575
|
+
}, children: (0, jsx_runtime_1.jsx)(AddLimitPopover_1.LimitSentence, { limit: baseAst.limit, setOpenPopover: setOpenPopover, LimitPopover: LimitPopoverComponent, EditPopover: AddLimitPopover_1.AddLimitPopover, handleDelete: () => {
|
|
2428
2576
|
const newAst = { ...baseAst };
|
|
2429
2577
|
newAst.limit = null;
|
|
2430
2578
|
setBaseAst((0, util_1.deepCopy)(newAst));
|
|
@@ -2443,36 +2591,38 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
2443
2591
|
setOpenPopover(null);
|
|
2444
2592
|
setBaseAst((0, util_1.deepCopy)(newAst));
|
|
2445
2593
|
fetchSqlQuery((0, util_1.deepCopy)(newAst));
|
|
2446
|
-
}, TextInput:
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2594
|
+
}, TextInput: TextInputComponent, Button: ButtonComponent, SecondaryButton: SecondaryButtonComponent }) })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { onClick: () => {
|
|
2595
|
+
if (!selectedColumns || selectedColumns.length === 0) {
|
|
2596
|
+
return;
|
|
2597
|
+
}
|
|
2598
|
+
if (!baseAst) {
|
|
2599
|
+
return;
|
|
2600
|
+
}
|
|
2601
|
+
if (!openPopover) {
|
|
2602
|
+
setOpenPopover('AddLimitPopover');
|
|
2603
|
+
}
|
|
2604
|
+
}, label: 'Add limit' }), (0, jsx_runtime_1.jsx)(PopoverComponent, { isOpen: openPopover === 'AddLimitPopover', setIsOpen: (isOpen) => {
|
|
2605
|
+
if (!isOpen) {
|
|
2606
|
+
setIsPending(false);
|
|
2607
|
+
setActiveEditItem(null);
|
|
2608
|
+
setActivePath(null);
|
|
2609
|
+
setOpenPopover(null);
|
|
2610
|
+
}
|
|
2611
|
+
}, popoverTitle: "Limit", popoverChildren: (0, jsx_runtime_1.jsx)(AddLimitPopover_1.AddLimitPopover, { TextInput: TextInputComponent, Button: ButtonComponent, SecondaryButton: SecondaryButtonComponent, onSave: (limit) => {
|
|
2612
|
+
const newAst = { ...baseAst };
|
|
2613
|
+
newAst.limit = {
|
|
2614
|
+
seperator: '',
|
|
2615
|
+
value: [
|
|
2616
|
+
{
|
|
2617
|
+
type: 'number',
|
|
2618
|
+
value: Number(limit),
|
|
2619
|
+
},
|
|
2620
|
+
],
|
|
2621
|
+
};
|
|
2622
|
+
setOpenPopover(null);
|
|
2623
|
+
setBaseAst((0, util_1.deepCopy)(newAst));
|
|
2624
|
+
fetchSqlQuery((0, util_1.deepCopy)(newAst));
|
|
2625
|
+
} }) })] }))] }), (0, jsx_runtime_1.jsxs)(ContainerComponent, { children: [isAIEnabled && ((0, jsx_runtime_1.jsxs)("form", { ref: askAIContainerRef, onSubmit: (event) => {
|
|
2476
2626
|
event.preventDefault();
|
|
2477
2627
|
handleAsk();
|
|
2478
2628
|
}, style: {
|
|
@@ -2480,14 +2630,14 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
2480
2630
|
flexDirection: 'row',
|
|
2481
2631
|
gap: 12,
|
|
2482
2632
|
padding: 1,
|
|
2483
|
-
}, children: [(0, jsx_runtime_1.jsx)(
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2633
|
+
}, children: [(0, jsx_runtime_1.jsx)(TextInputComponent, { id: "ask_ai_input_bar", value: aiPrompt, width: askAIInputWidth, onChange: (e) => setAiPrompt(e.target.value), placeholder: baseAst ? 'Ask a follow-up question...' : 'Ask a question...' }), (0, jsx_runtime_1.jsx)(ButtonComponent, { onClick: handleAsk, label: 'Ask AI' }), baseAst && ((0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { label: 'New report', onClick: clearAllState }))] })), baseAst && ((0, jsx_runtime_1.jsx)(TableComponent, { isLoading: loading && errorMessage.length === 0, rows: applyFormatting({
|
|
2634
|
+
rows: pivotData?.rows || rows,
|
|
2635
|
+
fields: pivotData?.fields || fields,
|
|
2636
|
+
}, baseAst?.columns ?? []), columns: pivot
|
|
2637
|
+
? pivotData?.columns || emptyPivotColumns()
|
|
2638
|
+
: enforceOrderOnColumns(Object.keys(rows[0] ?? {})).map((c) => {
|
|
2639
|
+
return { label: (0, textProcessing_1.snakeCaseToTitleCase)(c), field: c };
|
|
2640
|
+
}) })), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
2491
2641
|
display: 'flex',
|
|
2492
2642
|
flexDirection: 'row',
|
|
2493
2643
|
gap: '12px',
|
|
@@ -2496,11 +2646,8 @@ function ReportBuilder({ initialTableName = '', onAddToDashboardComplete = () =>
|
|
|
2496
2646
|
fontSize: 14,
|
|
2497
2647
|
padding: '12px',
|
|
2498
2648
|
whiteSpace: 'nowrap',
|
|
2499
|
-
}, children: errorMessage })), (0, jsx_runtime_1.jsx)("div", { style: { width: '100%' } }), baseAst && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(
|
|
2649
|
+
}, children: errorMessage })), (0, jsx_runtime_1.jsx)("div", { style: { width: '100%' } }), baseAst && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { label: isCopying ? '✅ Copied' : 'Copy SQL', onClick: () => copyToClipboard(activeQuery) }), (0, jsx_runtime_1.jsx)(ButtonComponent, { onClick: () => {
|
|
2500
2650
|
setIsChartBuilderOpen(true);
|
|
2501
|
-
}, label: 'Add to dashboard' })] }))] })] }), (0, jsx_runtime_1.jsx)("style", { children: `body{margin:0;}` }), (0, jsx_runtime_1.jsx)(ChartBuilder_1.ChartBuilderWithModal, { rows:
|
|
2502
|
-
// TODO: Modal={Modal}
|
|
2503
|
-
// TODO: Popover={Popover}
|
|
2504
|
-
DeleteButton: DeleteButton })] }));
|
|
2651
|
+
}, label: 'Add to dashboard' })] }))] })] }), (0, jsx_runtime_1.jsx)("style", { children: `body{margin:0;}` }), (0, jsx_runtime_1.jsx)(ChartBuilder_1.ChartBuilderWithModal, { rows: rows, columns: processColumnsForChartBuilder(Object.keys(rows[0] ?? {})), fields: fields, pivot: pivot, query: activeQuery, showTableFormatOptions: isAdminEnabled, showDateFieldOptions: isAdminEnabled, showAccessControlOptions: isAdminEnabled, title: "Add to dashboard", isOpen: isChartBuilderOpen, setIsOpen: setIsChartBuilderOpen, onAddToDashboardComplete: onSubmitChartBuilder, destinationDashboard: destinationDashboard, organizationName: organizationName, pivotData: pivotData, SelectComponent: SelectComponent, TextInputComponent: TextInputComponent, ButtonComponent: ButtonComponent, SecondaryButtonComponent: SecondaryButtonComponent, HeaderComponent: HeaderComponent, LabelComponent: LabelComponent, TextComponent: TextComponent, CardComponent: CardComponent, ModalComponent: ModalComponent, PopoverComponent: PopoverComponent, DeleteButtonComponent: DeleteButtonComponent })] }));
|
|
2505
2652
|
}
|
|
2506
2653
|
exports.default = ReportBuilder;
|