@grafana/plugin-ui 0.13.0 → 0.14.0-dev.1
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/index.cjs +214 -224
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +2 -9
- package/dist/cjs/test-utils.cjs +2 -2
- package/dist/cjs/test-utils.cjs.map +1 -1
- package/dist/cjs/test-utils.d.cts +1 -1
- package/dist/esm/components/ConfigEditor/AdvancedSettings/AdvancedHttpSettings.js.map +1 -1
- package/dist/esm/components/ConfigEditor/Auth/Auth.js.map +1 -1
- package/dist/esm/components/ConfigEditor/Auth/auth-method/AuthMethodSettings.js +4 -4
- package/dist/esm/components/ConfigEditor/Auth/auth-method/AuthMethodSettings.js.map +1 -1
- package/dist/esm/components/ConfigEditor/Auth/auth-method/BasicAuth.js.map +1 -1
- package/dist/esm/components/ConfigEditor/Auth/custom-headers/CustomHeader.js.map +1 -1
- package/dist/esm/components/ConfigEditor/Auth/custom-headers/CustomHeaders.js +1 -1
- package/dist/esm/components/ConfigEditor/Auth/custom-headers/CustomHeaders.js.map +1 -1
- package/dist/esm/components/ConfigEditor/Auth/styles.js.map +1 -1
- package/dist/esm/components/ConfigEditor/Auth/tls/SelfSignedCertificate.js +1 -1
- package/dist/esm/components/ConfigEditor/Auth/tls/SelfSignedCertificate.js.map +1 -1
- package/dist/esm/components/ConfigEditor/Auth/tls/SkipTLSVerification.js.map +1 -1
- package/dist/esm/components/ConfigEditor/Auth/tls/TLSClientAuth.js +3 -3
- package/dist/esm/components/ConfigEditor/Auth/tls/TLSClientAuth.js.map +1 -1
- package/dist/esm/components/ConfigEditor/Auth/tls/TLSSettings.js.map +1 -1
- package/dist/esm/components/ConfigEditor/Auth/tls/TLSSettingsSection.js.map +1 -1
- package/dist/esm/components/ConfigEditor/Auth/types.js.map +1 -1
- package/dist/esm/components/ConfigEditor/Auth/utils.js +3 -3
- package/dist/esm/components/ConfigEditor/Auth/utils.js.map +1 -1
- package/dist/esm/components/ConfigEditor/ConfigSection/ConfigDescriptionLink.js +2 -2
- package/dist/esm/components/ConfigEditor/ConfigSection/ConfigDescriptionLink.js.map +1 -1
- package/dist/esm/components/ConfigEditor/ConfigSection/ConfigSection.js.map +1 -1
- package/dist/esm/components/ConfigEditor/ConfigSection/ConfigSubSection.js.map +1 -1
- package/dist/esm/components/ConfigEditor/ConfigSection/GenericConfigSection.js.map +1 -1
- package/dist/esm/components/ConfigEditor/Connection/ConnectionSettings.js +1 -1
- package/dist/esm/components/ConfigEditor/Connection/ConnectionSettings.js.map +1 -1
- package/dist/esm/components/ConfigEditor/DataSourceDescription.js.map +1 -1
- package/dist/esm/components/ConfigEditor/SecureSocksProxyToggle.js.map +1 -1
- package/dist/esm/components/CustomHeadersSettings/CustomHeadersSettings.js +11 -11
- package/dist/esm/components/CustomHeadersSettings/CustomHeadersSettings.js.map +1 -1
- package/dist/esm/components/DataLinks/DataLink.js +4 -4
- package/dist/esm/components/DataLinks/DataLink.js.map +1 -1
- package/dist/esm/components/DataLinks/DataLinks.js +3 -3
- package/dist/esm/components/DataLinks/DataLinks.js.map +1 -1
- package/dist/esm/components/DataSourcePicker/DataSourcePicker.js +8 -8
- package/dist/esm/components/DataSourcePicker/DataSourcePicker.js.map +1 -1
- package/dist/esm/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/esm/components/DatePicker/styles.js +2 -2
- package/dist/esm/components/DatePicker/styles.js.map +1 -1
- package/dist/esm/components/DatePickerWithInput/DatePickerWithInput.js.map +1 -1
- package/dist/esm/components/DatePickerWithInput/styles.js +2 -2
- package/dist/esm/components/DatePickerWithInput/styles.js.map +1 -1
- package/dist/esm/components/DebounceInput/DebounceInput.js.map +1 -1
- package/dist/esm/components/Plugins/PluginSignatureBadge.js.map +1 -1
- package/dist/esm/components/QueryEditor/AccessoryButton.js.map +1 -1
- package/dist/esm/components/QueryEditor/CatalogSelector.js +1 -1
- package/dist/esm/components/QueryEditor/CatalogSelector.js.map +1 -1
- package/dist/esm/components/QueryEditor/ConfirmModal.js +1 -1
- package/dist/esm/components/QueryEditor/ConfirmModal.js.map +1 -1
- package/dist/esm/components/QueryEditor/DatasetSelector.js +1 -1
- package/dist/esm/components/QueryEditor/DatasetSelector.js.map +1 -1
- package/dist/esm/components/QueryEditor/EditorField.js +5 -5
- package/dist/esm/components/QueryEditor/EditorField.js.map +1 -1
- package/dist/esm/components/QueryEditor/EditorFieldGroup.js.map +1 -1
- package/dist/esm/components/QueryEditor/EditorHeader.js +2 -2
- package/dist/esm/components/QueryEditor/EditorHeader.js.map +1 -1
- package/dist/esm/components/QueryEditor/EditorList.js.map +1 -1
- package/dist/esm/components/QueryEditor/EditorRow.js +4 -4
- package/dist/esm/components/QueryEditor/EditorRow.js.map +1 -1
- package/dist/esm/components/QueryEditor/EditorRows.js +2 -2
- package/dist/esm/components/QueryEditor/EditorRows.js.map +1 -1
- package/dist/esm/components/QueryEditor/EditorStack.js +1 -1
- package/dist/esm/components/QueryEditor/EditorStack.js.map +1 -1
- package/dist/esm/components/QueryEditor/EditorSwitch.js +2 -2
- package/dist/esm/components/QueryEditor/EditorSwitch.js.map +1 -1
- package/dist/esm/components/QueryEditor/FlexItem.js.map +1 -1
- package/dist/esm/components/QueryEditor/InlineSelect.js.map +1 -1
- package/dist/esm/components/QueryEditor/InputGroup.js +2 -2
- package/dist/esm/components/QueryEditor/InputGroup.js.map +1 -1
- package/dist/esm/components/QueryEditor/QueryEditor.js +7 -7
- package/dist/esm/components/QueryEditor/QueryEditor.js.map +1 -1
- package/dist/esm/components/QueryEditor/QueryHeader.js +18 -18
- package/dist/esm/components/QueryEditor/QueryHeader.js.map +1 -1
- package/dist/esm/components/QueryEditor/RunQueryButton.js +1 -1
- package/dist/esm/components/QueryEditor/RunQueryButton.js.map +1 -1
- package/dist/esm/components/QueryEditor/Space.js +17 -26
- package/dist/esm/components/QueryEditor/Space.js.map +1 -1
- package/dist/esm/components/QueryEditor/TableSelector.js.map +1 -1
- package/dist/esm/components/QueryEditor/defaults.js +7 -7
- package/dist/esm/components/QueryEditor/defaults.js.map +1 -1
- package/dist/esm/components/QueryEditor/expressions.js.map +1 -1
- package/dist/esm/components/QueryEditor/query-editor-raw/QueryEditorRaw.js.map +1 -1
- package/dist/esm/components/QueryEditor/query-editor-raw/QueryToolbox.js +1 -1
- package/dist/esm/components/QueryEditor/query-editor-raw/QueryToolbox.js.map +1 -1
- package/dist/esm/components/QueryEditor/query-editor-raw/QueryValidator.js +4 -4
- package/dist/esm/components/QueryEditor/query-editor-raw/QueryValidator.js.map +1 -1
- package/dist/esm/components/QueryEditor/query-editor-raw/RawEditor.js +3 -3
- package/dist/esm/components/QueryEditor/query-editor-raw/RawEditor.js.map +1 -1
- package/dist/esm/components/QueryEditor/types.js.map +1 -1
- package/dist/esm/components/QueryEditor/utils/formatSQL.js.map +1 -1
- package/dist/esm/components/QueryEditor/utils/sql.utils.js +8 -8
- package/dist/esm/components/QueryEditor/utils/sql.utils.js.map +1 -1
- package/dist/esm/components/QueryEditor/utils/useSqlChange.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/AwesomeQueryBuilder.js +26 -27
- package/dist/esm/components/QueryEditor/visual-query-builder/AwesomeQueryBuilder.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/EditorField.js +3 -3
- package/dist/esm/components/QueryEditor/visual-query-builder/EditorField.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/EditorRow.js +2 -2
- package/dist/esm/components/QueryEditor/visual-query-builder/EditorRow.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/EditorRows.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/GroupByRow.js +2 -2
- package/dist/esm/components/QueryEditor/visual-query-builder/GroupByRow.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/OrderByRow.js +4 -4
- package/dist/esm/components/QueryEditor/visual-query-builder/OrderByRow.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/Preview.js +2 -2
- package/dist/esm/components/QueryEditor/visual-query-builder/Preview.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/SQLGroupByRow.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/SQLOrderByRow.js +2 -2
- package/dist/esm/components/QueryEditor/visual-query-builder/SQLOrderByRow.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/SQLSelectRow.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/SQLWhereRow.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/SelectRow.js +9 -9
- package/dist/esm/components/QueryEditor/visual-query-builder/SelectRow.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/VisualEditor.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/WhereRow.js.map +1 -1
- package/dist/esm/components/QueryEditorRow/QueryEditorRow.js.map +1 -1
- package/dist/esm/components/SQLEditor/components/SQLEditor.js +13 -13
- package/dist/esm/components/SQLEditor/components/SQLEditor.js.map +1 -1
- package/dist/esm/components/SQLEditor/hooks/useLatestCallback.js +1 -1
- package/dist/esm/components/SQLEditor/hooks/useLatestCallback.js.map +1 -1
- package/dist/esm/components/SQLEditor/mocks/Monaco.js.map +1 -1
- package/dist/esm/components/SQLEditor/mocks/TextModel.js.map +1 -1
- package/dist/esm/components/SQLEditor/mocks/queries/multiLineFullQuery.js.map +1 -1
- package/dist/esm/components/SQLEditor/mocks/queries/multiLineFullQueryWithAggregation.js.map +1 -1
- package/dist/esm/components/SQLEditor/mocks/queries/multiLineMultipleColumns.js.map +1 -1
- package/dist/esm/components/SQLEditor/mocks/queries/singleLineEmptyQuery.js.map +1 -1
- package/dist/esm/components/SQLEditor/mocks/queries/singleLineFullQuery.js.map +1 -1
- package/dist/esm/components/SQLEditor/mocks/queries/singleLineFullQueryWithAggregation.js.map +1 -1
- package/dist/esm/components/SQLEditor/mocks/queries/singleLineMultipleColumns.js.map +1 -1
- package/dist/esm/components/SQLEditor/mocks/queries/singleLineTwoQueries.js.map +1 -1
- package/dist/esm/components/SQLEditor/mocks/queries/singleLineTwoQueriesWithAggregation.js.map +1 -1
- package/dist/esm/components/SQLEditor/standardSql/definition.js.map +1 -1
- package/dist/esm/components/SQLEditor/standardSql/getStandardSuggestions.js +2 -2
- package/dist/esm/components/SQLEditor/standardSql/getStandardSuggestions.js.map +1 -1
- package/dist/esm/components/SQLEditor/standardSql/getStatementPosition.js +3 -3
- package/dist/esm/components/SQLEditor/standardSql/getStatementPosition.js.map +1 -1
- package/dist/esm/components/SQLEditor/standardSql/language.js.map +1 -1
- package/dist/esm/components/SQLEditor/standardSql/macros.js.map +1 -1
- package/dist/esm/components/SQLEditor/standardSql/standardSQLCompletionItemProvider.js +2 -2
- package/dist/esm/components/SQLEditor/standardSql/standardSQLCompletionItemProvider.js.map +1 -1
- package/dist/esm/components/SQLEditor/standardSql/standardSuggestionsRegistry.js +1 -1
- package/dist/esm/components/SQLEditor/standardSql/standardSuggestionsRegistry.js.map +1 -1
- package/dist/esm/components/SQLEditor/standardSql/statementPositionResolversRegistry.js +25 -25
- package/dist/esm/components/SQLEditor/standardSql/statementPositionResolversRegistry.js.map +1 -1
- package/dist/esm/components/SQLEditor/standardSql/suggestionsKindRegistry.js +1 -1
- package/dist/esm/components/SQLEditor/standardSql/suggestionsKindRegistry.js.map +1 -1
- package/dist/esm/components/SQLEditor/test-utils/index.js.map +1 -1
- package/dist/esm/components/SQLEditor/test-utils/statementPosition.js.map +1 -1
- package/dist/esm/components/SQLEditor/types.js.map +1 -1
- package/dist/esm/components/SQLEditor/utils/LinkedToken.js +7 -7
- package/dist/esm/components/SQLEditor/utils/LinkedToken.js.map +1 -1
- package/dist/esm/components/SQLEditor/utils/commands.js.map +1 -1
- package/dist/esm/components/SQLEditor/utils/debugger.js +1 -1
- package/dist/esm/components/SQLEditor/utils/debugger.js.map +1 -1
- package/dist/esm/components/SQLEditor/utils/getSuggestionKind.js.map +1 -1
- package/dist/esm/components/SQLEditor/utils/linkedTokenBuilder.js +1 -1
- package/dist/esm/components/SQLEditor/utils/linkedTokenBuilder.js.map +1 -1
- package/dist/esm/components/SQLEditor/utils/toCompletionItem.js +1 -1
- package/dist/esm/components/SQLEditor/utils/toCompletionItem.js.map +1 -1
- package/dist/esm/components/SQLEditor/utils/tokenUtils.js +9 -9
- package/dist/esm/components/SQLEditor/utils/tokenUtils.js.map +1 -1
- package/dist/esm/components/Segment/Segment.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/QueryModellerBase.js +2 -2
- package/dist/esm/components/VisualQueryBuilder/QueryModellerBase.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/LabelFilterItem.js +11 -11
- package/dist/esm/components/VisualQueryBuilder/components/LabelFilterItem.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/LabelFilters.js +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/LabelFilters.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/OperationEditor.js +4 -4
- package/dist/esm/components/VisualQueryBuilder/components/OperationEditor.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/OperationEditorBody.js +2 -3
- package/dist/esm/components/VisualQueryBuilder/components/OperationEditorBody.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/OperationExplainedBox.js +3 -3
- package/dist/esm/components/VisualQueryBuilder/components/OperationExplainedBox.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/OperationHeader.js +2 -2
- package/dist/esm/components/VisualQueryBuilder/components/OperationHeader.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/OperationInfoButton.js +2 -2
- package/dist/esm/components/VisualQueryBuilder/components/OperationInfoButton.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/OperationList.js +3 -4
- package/dist/esm/components/VisualQueryBuilder/components/OperationList.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/OperationListExplained.js +2 -2
- package/dist/esm/components/VisualQueryBuilder/components/OperationListExplained.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/OperationParamEditor.js +5 -6
- package/dist/esm/components/VisualQueryBuilder/components/OperationParamEditor.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/OperationsEditorRow.js +2 -3
- package/dist/esm/components/VisualQueryBuilder/components/OperationsEditorRow.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/QueryBuilderHints.js +8 -8
- package/dist/esm/components/VisualQueryBuilder/components/QueryBuilderHints.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/QueryEditorModeToggle.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/QueryHeaderSwitch.js +2 -3
- package/dist/esm/components/VisualQueryBuilder/components/QueryHeaderSwitch.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/QueryOptionGroup.js +0 -1
- package/dist/esm/components/VisualQueryBuilder/components/QueryOptionGroup.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/RawQuery.js +2 -2
- package/dist/esm/components/VisualQueryBuilder/components/RawQuery.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/types.js.map +1 -1
- package/dist/esm/datasource/SqlDatasource.js +14 -14
- package/dist/esm/datasource/SqlDatasource.js.map +1 -1
- package/dist/esm/datasource/constants.js.map +1 -1
- package/dist/esm/hooks/useDebounce.js.map +1 -1
- package/dist/esm/index.d.ts +2 -9
- package/dist/esm/test/mocks/DataQuery.js.map +1 -1
- package/dist/esm/test/mocks/Datasource.js +1 -1
- package/dist/esm/test/mocks/Datasource.js.map +1 -1
- package/dist/esm/test/mocks/Plugin.js +1 -1
- package/dist/esm/test/mocks/Plugin.js.map +1 -1
- package/dist/esm/test/mocks/QueryEditorProps.js.map +1 -1
- package/dist/esm/test/mocks/utils.js +2 -2
- package/dist/esm/test/mocks/utils.js.map +1 -1
- package/dist/esm/test-utils.d.ts +1 -1
- package/package.json +13 -29
package/dist/cjs/index.cjs
CHANGED
|
@@ -351,7 +351,7 @@ class DataSourcePicker extends React.PureComponent {
|
|
|
351
351
|
const dsSettings = this.dataSourceSrv.getInstanceSettings(item.value);
|
|
352
352
|
if (dsSettings) {
|
|
353
353
|
this.props.onChange(dsSettings);
|
|
354
|
-
this.setState({ error:
|
|
354
|
+
this.setState({ error: void 0 });
|
|
355
355
|
}
|
|
356
356
|
});
|
|
357
357
|
}
|
|
@@ -535,7 +535,7 @@ const DataLink = (props) => {
|
|
|
535
535
|
if (showInternalLink) {
|
|
536
536
|
onChange({
|
|
537
537
|
...value,
|
|
538
|
-
datasourceUid:
|
|
538
|
+
datasourceUid: void 0
|
|
539
539
|
});
|
|
540
540
|
}
|
|
541
541
|
setShowInternalLink(!showInternalLink);
|
|
@@ -661,17 +661,17 @@ function toRawSql({ sql, dataset, catalog, table }, disableDatasets) {
|
|
|
661
661
|
if (sql.whereString) {
|
|
662
662
|
rawQuery += `WHERE ${sql.whereString} `;
|
|
663
663
|
}
|
|
664
|
-
if ((_b = (_a = sql.groupBy) == null ?
|
|
664
|
+
if ((_b = (_a = sql.groupBy) == null ? void 0 : _a[0]) == null ? void 0 : _b.property.name) {
|
|
665
665
|
const groupBy = sql.groupBy.map((g) => g.property.name).filter((g) => !lodash.isEmpty(g));
|
|
666
666
|
rawQuery += `GROUP BY ${groupBy.join(", ")} `;
|
|
667
667
|
}
|
|
668
|
-
if ((_c = sql.orderBy) == null ?
|
|
668
|
+
if ((_c = sql.orderBy) == null ? void 0 : _c.property.name) {
|
|
669
669
|
rawQuery += `ORDER BY ${sql.orderBy.property.name} `;
|
|
670
670
|
}
|
|
671
|
-
if (((_d = sql.orderBy) == null ?
|
|
671
|
+
if (((_d = sql.orderBy) == null ? void 0 : _d.property.name) && sql.orderByDirection) {
|
|
672
672
|
rawQuery += `${sql.orderByDirection} `;
|
|
673
673
|
}
|
|
674
|
-
if (sql.limit !==
|
|
674
|
+
if (sql.limit !== void 0 && sql.limit >= 0) {
|
|
675
675
|
rawQuery += `LIMIT ${sql.limit} `;
|
|
676
676
|
}
|
|
677
677
|
return rawQuery;
|
|
@@ -681,9 +681,9 @@ function createSelectClause(sqlColumns) {
|
|
|
681
681
|
var _a, _b;
|
|
682
682
|
let rawColumn = "";
|
|
683
683
|
if (c.name) {
|
|
684
|
-
rawColumn += `${c.name}(${(_a = c.parameters) == null ?
|
|
684
|
+
rawColumn += `${c.name}(${(_a = c.parameters) == null ? void 0 : _a.map((p) => `${p.name}`)})`;
|
|
685
685
|
} else {
|
|
686
|
-
rawColumn += `${(_b = c.parameters) == null ?
|
|
686
|
+
rawColumn += `${(_b = c.parameters) == null ? void 0 : _b.map((p) => `${p.name}`)}`;
|
|
687
687
|
}
|
|
688
688
|
return rawColumn;
|
|
689
689
|
});
|
|
@@ -695,7 +695,7 @@ function haveColumns(columns) {
|
|
|
695
695
|
}
|
|
696
696
|
const haveColumn = columns.some((c) => {
|
|
697
697
|
var _a, _b;
|
|
698
|
-
return ((_a = c.parameters) == null ?
|
|
698
|
+
return ((_a = c.parameters) == null ? void 0 : _a.length) || ((_b = c.parameters) == null ? void 0 : _b.some((p) => p.name));
|
|
699
699
|
});
|
|
700
700
|
const haveFunction = columns.some((c) => c.name);
|
|
701
701
|
return haveColumn || haveFunction;
|
|
@@ -727,17 +727,17 @@ function createFunctionField(functionName) {
|
|
|
727
727
|
}
|
|
728
728
|
|
|
729
729
|
function applyQueryDefaults(q) {
|
|
730
|
-
let editorMode = (q == null ?
|
|
731
|
-
if ((q == null ?
|
|
730
|
+
let editorMode = (q == null ? void 0 : q.editorMode) || EditorMode.Builder;
|
|
731
|
+
if ((q == null ? void 0 : q.editorMode) === void 0 && (q == null ? void 0 : q.rawSql) !== void 0) {
|
|
732
732
|
editorMode = EditorMode.Code;
|
|
733
733
|
}
|
|
734
734
|
const result = {
|
|
735
735
|
...q,
|
|
736
|
-
refId: (q == null ?
|
|
737
|
-
format: (q == null ?
|
|
738
|
-
rawSql: (q == null ?
|
|
736
|
+
refId: (q == null ? void 0 : q.refId) || "A",
|
|
737
|
+
format: (q == null ? void 0 : q.format) !== void 0 ? q.format : QueryFormat.Table,
|
|
738
|
+
rawSql: (q == null ? void 0 : q.rawSql) || "",
|
|
739
739
|
editorMode,
|
|
740
|
-
sql: (q == null ?
|
|
740
|
+
sql: (q == null ? void 0 : q.sql) || {
|
|
741
741
|
columns: [createFunctionField()],
|
|
742
742
|
groupBy: [setGroupByField()],
|
|
743
743
|
limit: 50
|
|
@@ -789,7 +789,7 @@ class LinkedToken {
|
|
|
789
789
|
}
|
|
790
790
|
is(type, value) {
|
|
791
791
|
const isType = this.type === type;
|
|
792
|
-
return value !==
|
|
792
|
+
return value !== void 0 ? isType && compareTokenWithValue(type, this, value) : isType;
|
|
793
793
|
}
|
|
794
794
|
getPreviousNonWhiteSpaceToken() {
|
|
795
795
|
let curr = this.previous;
|
|
@@ -805,7 +805,7 @@ class LinkedToken {
|
|
|
805
805
|
let curr = this.previous;
|
|
806
806
|
while (curr != null) {
|
|
807
807
|
const isType = curr.type === type;
|
|
808
|
-
if (value !==
|
|
808
|
+
if (value !== void 0 ? isType && compareTokenWithValue(type, curr, value) : isType) {
|
|
809
809
|
return curr;
|
|
810
810
|
}
|
|
811
811
|
curr = curr.previous;
|
|
@@ -816,12 +816,12 @@ class LinkedToken {
|
|
|
816
816
|
let tokens = [];
|
|
817
817
|
let curr = this.previous;
|
|
818
818
|
while (curr != null) {
|
|
819
|
-
if (ignoreTypes.some((t) => t === (curr == null ?
|
|
819
|
+
if (ignoreTypes.some((t) => t === (curr == null ? void 0 : curr.type))) {
|
|
820
820
|
curr = curr.previous;
|
|
821
821
|
continue;
|
|
822
822
|
}
|
|
823
823
|
const isType = curr.type === type;
|
|
824
|
-
if (value !==
|
|
824
|
+
if (value !== void 0 ? isType && compareTokenWithValue(type, curr, value) : isType) {
|
|
825
825
|
return tokens;
|
|
826
826
|
}
|
|
827
827
|
if (!curr.isWhiteSpace()) {
|
|
@@ -835,12 +835,12 @@ class LinkedToken {
|
|
|
835
835
|
let tokens = [];
|
|
836
836
|
let curr = this.next;
|
|
837
837
|
while (curr != null) {
|
|
838
|
-
if (ignoreTypes.some((t) => t === (curr == null ?
|
|
838
|
+
if (ignoreTypes.some((t) => t === (curr == null ? void 0 : curr.type))) {
|
|
839
839
|
curr = curr.next;
|
|
840
840
|
continue;
|
|
841
841
|
}
|
|
842
842
|
const isType = curr.type === type;
|
|
843
|
-
if (value !==
|
|
843
|
+
if (value !== void 0 ? isType && compareTokenWithValue(type, curr, value) : isType) {
|
|
844
844
|
return tokens;
|
|
845
845
|
}
|
|
846
846
|
if (!curr.isWhiteSpace()) {
|
|
@@ -874,7 +874,7 @@ class LinkedToken {
|
|
|
874
874
|
let curr = this.next;
|
|
875
875
|
while (curr != null) {
|
|
876
876
|
const isType = curr.type === type;
|
|
877
|
-
if (value !==
|
|
877
|
+
if (value !== void 0 ? isType && compareTokenWithValue(type, curr, value) : isType) {
|
|
878
878
|
return curr;
|
|
879
879
|
}
|
|
880
880
|
curr = curr.next;
|
|
@@ -1023,9 +1023,9 @@ var SQLEditorMode = /* @__PURE__ */ ((SQLEditorMode2) => {
|
|
|
1023
1023
|
|
|
1024
1024
|
function getStatementPosition(currentToken, statementPositionResolversRegistry) {
|
|
1025
1025
|
var _a;
|
|
1026
|
-
const previousNonWhiteSpace = currentToken == null ?
|
|
1027
|
-
const previousKeyword = currentToken == null ?
|
|
1028
|
-
const previousIsSlash = (_a = currentToken == null ?
|
|
1026
|
+
const previousNonWhiteSpace = currentToken == null ? void 0 : currentToken.getPreviousNonWhiteSpaceToken();
|
|
1027
|
+
const previousKeyword = currentToken == null ? void 0 : currentToken.getPreviousKeyword();
|
|
1028
|
+
const previousIsSlash = (_a = currentToken == null ? void 0 : currentToken.getPreviousNonWhiteSpaceToken()) == null ? void 0 : _a.is(TokenType.Operator, "/");
|
|
1029
1029
|
const resolvers = statementPositionResolversRegistry.list();
|
|
1030
1030
|
const positions = [];
|
|
1031
1031
|
for (const resolver of resolvers) {
|
|
@@ -1053,8 +1053,8 @@ const toCompletionItem = (value, range, rest = {}) => {
|
|
|
1053
1053
|
|
|
1054
1054
|
const getStandardSuggestions = async (monaco, currentToken, suggestionKinds, positionContext, suggestionsRegistry) => {
|
|
1055
1055
|
let suggestions = [];
|
|
1056
|
-
const invalidRangeToken = (currentToken == null ?
|
|
1057
|
-
const range = invalidRangeToken || !(currentToken == null ?
|
|
1056
|
+
const invalidRangeToken = (currentToken == null ? void 0 : currentToken.isWhiteSpace()) || (currentToken == null ? void 0 : currentToken.isParenthesis()) || (currentToken == null ? void 0 : currentToken.isIdentifier()) && currentToken.value.endsWith(".");
|
|
1057
|
+
const range = invalidRangeToken || !(currentToken == null ? void 0 : currentToken.range) ? monaco.Range.fromPositions(positionContext.position) : currentToken == null ? void 0 : currentToken.range;
|
|
1058
1058
|
for (const suggestion of [...new Set(suggestionKinds)]) {
|
|
1059
1059
|
const registeredSuggestions = suggestionsRegistry.getIfExists(suggestion);
|
|
1060
1060
|
if (registeredSuggestions) {
|
|
@@ -1235,7 +1235,7 @@ function linkedTokenBuilder(monaco, model, position, languageId = "sql") {
|
|
|
1235
1235
|
offset: 0,
|
|
1236
1236
|
type: TokenType.Whitespace,
|
|
1237
1237
|
language: languageId,
|
|
1238
|
-
_tokenBrand:
|
|
1238
|
+
_tokenBrand: void 0
|
|
1239
1239
|
};
|
|
1240
1240
|
tokens.push(token);
|
|
1241
1241
|
}
|
|
@@ -2159,31 +2159,31 @@ var language$1 = /*#__PURE__*/Object.freeze({
|
|
|
2159
2159
|
|
|
2160
2160
|
const getSelectToken = (currentToken) => {
|
|
2161
2161
|
var _a;
|
|
2162
|
-
return (_a = currentToken == null ?
|
|
2162
|
+
return (_a = currentToken == null ? void 0 : currentToken.getPreviousOfType(TokenType.Keyword, SELECT)) != null ? _a : null;
|
|
2163
2163
|
};
|
|
2164
2164
|
const getFromKeywordToken = (currentToken) => {
|
|
2165
2165
|
const selectToken = getSelectToken(currentToken);
|
|
2166
|
-
return selectToken == null ?
|
|
2166
|
+
return selectToken == null ? void 0 : selectToken.getNextOfType(TokenType.Keyword, FROM);
|
|
2167
2167
|
};
|
|
2168
2168
|
const getTableToken = (currentToken) => {
|
|
2169
2169
|
var _a;
|
|
2170
2170
|
const fromToken = getFromKeywordToken(currentToken);
|
|
2171
|
-
const nextNonWhiteSpace = fromToken == null ?
|
|
2172
|
-
if (nextNonWhiteSpace == null ?
|
|
2171
|
+
const nextNonWhiteSpace = fromToken == null ? void 0 : fromToken.getNextNonWhiteSpaceToken();
|
|
2172
|
+
if (nextNonWhiteSpace == null ? void 0 : nextNonWhiteSpace.isVariable()) {
|
|
2173
2173
|
return null;
|
|
2174
|
-
} else if ((nextNonWhiteSpace == null ?
|
|
2174
|
+
} else if ((nextNonWhiteSpace == null ? void 0 : nextNonWhiteSpace.isKeyword()) && ((_a = nextNonWhiteSpace.next) == null ? void 0 : _a.is(TokenType.Parenthesis, "("))) {
|
|
2175
2175
|
return null;
|
|
2176
2176
|
} else {
|
|
2177
2177
|
return nextNonWhiteSpace;
|
|
2178
2178
|
}
|
|
2179
2179
|
};
|
|
2180
2180
|
const defaultTableNameParser = (token) => {
|
|
2181
|
-
const parts = token == null ?
|
|
2182
|
-
if ((parts == null ?
|
|
2181
|
+
const parts = token == null ? void 0 : token.value.split(".");
|
|
2182
|
+
if ((parts == null ? void 0 : parts.length) === 1) {
|
|
2183
2183
|
return { table: parts[0] };
|
|
2184
|
-
} else if ((parts == null ?
|
|
2184
|
+
} else if ((parts == null ? void 0 : parts.length) === 2) {
|
|
2185
2185
|
return { schema: parts[0], table: parts[1] };
|
|
2186
|
-
} else if ((parts == null ?
|
|
2186
|
+
} else if ((parts == null ? void 0 : parts.length) === 3) {
|
|
2187
2187
|
return { catalog: parts[0], schema: parts[1], table: parts[2] };
|
|
2188
2188
|
}
|
|
2189
2189
|
return null;
|
|
@@ -2558,7 +2558,7 @@ function initStatementPositionResolvers() {
|
|
|
2558
2558
|
id: StatementPosition.SelectKeyword,
|
|
2559
2559
|
name: StatementPosition.SelectKeyword,
|
|
2560
2560
|
resolve: (currentToken, previousKeyword, previousNonWhiteSpace, previousIsSlash) => Boolean(
|
|
2561
|
-
currentToken === null || currentToken.isWhiteSpace() && currentToken.previous === null || currentToken.is(TokenType.Keyword, SELECT) || currentToken.is(TokenType.Keyword, SELECT) && currentToken.previous === null || previousIsSlash || currentToken.isIdentifier() && (previousIsSlash || (currentToken == null ?
|
|
2561
|
+
currentToken === null || currentToken.isWhiteSpace() && currentToken.previous === null || currentToken.is(TokenType.Keyword, SELECT) || currentToken.is(TokenType.Keyword, SELECT) && currentToken.previous === null || previousIsSlash || currentToken.isIdentifier() && (previousIsSlash || (currentToken == null ? void 0 : currentToken.previous) === null) || currentToken.isIdentifier() && SELECT.startsWith(currentToken.value.toLowerCase())
|
|
2562
2562
|
)
|
|
2563
2563
|
},
|
|
2564
2564
|
{
|
|
@@ -2571,13 +2571,13 @@ function initStatementPositionResolvers() {
|
|
|
2571
2571
|
{
|
|
2572
2572
|
id: StatementPosition.AfterSelectKeyword,
|
|
2573
2573
|
name: StatementPosition.AfterSelectKeyword,
|
|
2574
|
-
resolve: (currentToken, previousKeyword, previousNonWhiteSpace, previousIsSlash) => Boolean((previousNonWhiteSpace == null ?
|
|
2574
|
+
resolve: (currentToken, previousKeyword, previousNonWhiteSpace, previousIsSlash) => Boolean((previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.value.toLowerCase()) === SELECT)
|
|
2575
2575
|
},
|
|
2576
2576
|
{
|
|
2577
2577
|
id: StatementPosition.AfterSelectArguments,
|
|
2578
2578
|
name: StatementPosition.AfterSelectArguments,
|
|
2579
2579
|
resolve: (currentToken, previousKeyword, previousNonWhiteSpace, previousIsSlash) => {
|
|
2580
|
-
return Boolean((previousKeyword == null ?
|
|
2580
|
+
return Boolean((previousKeyword == null ? void 0 : previousKeyword.value.toLowerCase()) === SELECT && (previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.value) === ",");
|
|
2581
2581
|
}
|
|
2582
2582
|
},
|
|
2583
2583
|
{
|
|
@@ -2585,7 +2585,7 @@ function initStatementPositionResolvers() {
|
|
|
2585
2585
|
name: StatementPosition.AfterSelectFuncFirstArgument,
|
|
2586
2586
|
resolve: (currentToken, previousKeyword, previousNonWhiteSpace, previousIsSlash) => {
|
|
2587
2587
|
return Boolean(
|
|
2588
|
-
((previousKeyword == null ?
|
|
2588
|
+
((previousKeyword == null ? void 0 : previousKeyword.value.toLowerCase()) === SELECT || (previousKeyword == null ? void 0 : previousKeyword.value.toLowerCase()) === AS) && ((previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.is(TokenType.Parenthesis, "(")) || (currentToken == null ? void 0 : currentToken.is(TokenType.Parenthesis, "()")))
|
|
2589
2589
|
);
|
|
2590
2590
|
}
|
|
2591
2591
|
},
|
|
@@ -2594,7 +2594,7 @@ function initStatementPositionResolvers() {
|
|
|
2594
2594
|
name: StatementPosition.AfterWhereFunctionArgument,
|
|
2595
2595
|
resolve: (currentToken, previousKeyword, previousNonWhiteSpace, previousIsSlash) => {
|
|
2596
2596
|
return Boolean(
|
|
2597
|
-
(previousKeyword == null ?
|
|
2597
|
+
(previousKeyword == null ? void 0 : previousKeyword.is(TokenType.Keyword, WHERE)) && ((previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.is(TokenType.Parenthesis, "(")) || (currentToken == null ? void 0 : currentToken.is(TokenType.Parenthesis, "()")))
|
|
2598
2598
|
);
|
|
2599
2599
|
}
|
|
2600
2600
|
},
|
|
@@ -2604,7 +2604,7 @@ function initStatementPositionResolvers() {
|
|
|
2604
2604
|
resolve: (currentToken, previousKeyword, previousNonWhiteSpace, previousIsSlash) => {
|
|
2605
2605
|
var _a;
|
|
2606
2606
|
return Boolean(
|
|
2607
|
-
(previousKeyword == null ?
|
|
2607
|
+
(previousKeyword == null ? void 0 : previousKeyword.is(TokenType.Keyword, BY)) && ((_a = previousKeyword == null ? void 0 : previousKeyword.getPreviousKeyword()) == null ? void 0 : _a.is(TokenType.Keyword, GROUP)) && ((previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.isIdentifier()) || (previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.isDoubleQuotedString()) || (previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.is(TokenType.Parenthesis, ")")) || (previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.is(TokenType.Parenthesis, "()")))
|
|
2608
2608
|
);
|
|
2609
2609
|
}
|
|
2610
2610
|
},
|
|
@@ -2612,7 +2612,7 @@ function initStatementPositionResolvers() {
|
|
|
2612
2612
|
id: StatementPosition.SelectAlias,
|
|
2613
2613
|
name: StatementPosition.SelectAlias,
|
|
2614
2614
|
resolve: (currentToken, previousKeyword, previousNonWhiteSpace, previousIsSlash) => {
|
|
2615
|
-
if ((previousNonWhiteSpace == null ?
|
|
2615
|
+
if ((previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.value) === "," && (previousKeyword == null ? void 0 : previousKeyword.value.toLowerCase()) === AS) {
|
|
2616
2616
|
return true;
|
|
2617
2617
|
}
|
|
2618
2618
|
return false;
|
|
@@ -2623,25 +2623,25 @@ function initStatementPositionResolvers() {
|
|
|
2623
2623
|
name: StatementPosition.FromKeyword,
|
|
2624
2624
|
resolve: (currentToken, previousKeyword, previousNonWhiteSpace, previousIsSlash) => {
|
|
2625
2625
|
return Boolean(
|
|
2626
|
-
(previousKeyword == null ?
|
|
2626
|
+
(previousKeyword == null ? void 0 : previousKeyword.value.toLowerCase()) === SELECT && (previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.value) !== "," || ((currentToken == null ? void 0 : currentToken.isKeyword()) || (currentToken == null ? void 0 : currentToken.isIdentifier())) && FROM.toLowerCase().startsWith(currentToken.value.toLowerCase())
|
|
2627
2627
|
);
|
|
2628
2628
|
}
|
|
2629
2629
|
},
|
|
2630
2630
|
{
|
|
2631
2631
|
id: StatementPosition.AfterFromKeyword,
|
|
2632
2632
|
name: StatementPosition.AfterFromKeyword,
|
|
2633
|
-
resolve: (currentToken, previousKeyword, previousNonWhiteSpace, previousIsSlash) => Boolean(!(currentToken == null ?
|
|
2633
|
+
resolve: (currentToken, previousKeyword, previousNonWhiteSpace, previousIsSlash) => Boolean(!(currentToken == null ? void 0 : currentToken.value.includes(".")) && (previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.value.toLowerCase()) === FROM)
|
|
2634
2634
|
},
|
|
2635
2635
|
{
|
|
2636
2636
|
id: StatementPosition.AfterSchema,
|
|
2637
2637
|
name: StatementPosition.AfterSchema,
|
|
2638
2638
|
resolve: (currentToken, previousKeyword, previousNonWhiteSpace, previousIsSlash) => {
|
|
2639
|
-
if ((currentToken == null ?
|
|
2640
|
-
currentToken = currentToken == null ?
|
|
2639
|
+
if ((currentToken == null ? void 0 : currentToken.isWhiteSpace()) && (currentToken == null ? void 0 : currentToken.next)) {
|
|
2640
|
+
currentToken = currentToken == null ? void 0 : currentToken.previous;
|
|
2641
2641
|
previousNonWhiteSpace = currentToken.getPreviousNonWhiteSpaceToken();
|
|
2642
2642
|
}
|
|
2643
2643
|
return Boolean(
|
|
2644
|
-
(currentToken == null ?
|
|
2644
|
+
(currentToken == null ? void 0 : currentToken.isIdentifier()) && (currentToken == null ? void 0 : currentToken.value.endsWith(".")) && (previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.value.toLowerCase()) === FROM
|
|
2645
2645
|
);
|
|
2646
2646
|
}
|
|
2647
2647
|
},
|
|
@@ -2649,7 +2649,7 @@ function initStatementPositionResolvers() {
|
|
|
2649
2649
|
id: StatementPosition.AfterFrom,
|
|
2650
2650
|
name: StatementPosition.AfterFrom,
|
|
2651
2651
|
resolve: (currentToken, previousKeyword, previousNonWhiteSpace, previousIsSlash) => Boolean(
|
|
2652
|
-
(previousKeyword == null ?
|
|
2652
|
+
(previousKeyword == null ? void 0 : previousKeyword.value.toLowerCase()) === FROM && (previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.isDoubleQuotedString()) || (previousKeyword == null ? void 0 : previousKeyword.value.toLowerCase()) === FROM && (previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.isIdentifier()) || (previousKeyword == null ? void 0 : previousKeyword.value.toLowerCase()) === FROM && (previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.isVariable())
|
|
2653
2653
|
// cloudwatch specific
|
|
2654
2654
|
// (previousKeyword?.value === SCHEMA && previousNonWhiteSpace?.is(TokenType.Parenthesis, ')'))
|
|
2655
2655
|
)
|
|
@@ -2659,7 +2659,7 @@ function initStatementPositionResolvers() {
|
|
|
2659
2659
|
name: StatementPosition.AfterTable,
|
|
2660
2660
|
resolve: (currentToken, previousKeyword, previousNonWhiteSpace, previousIsSlash) => {
|
|
2661
2661
|
return Boolean(
|
|
2662
|
-
(previousKeyword == null ?
|
|
2662
|
+
(previousKeyword == null ? void 0 : previousKeyword.value.toLowerCase()) === FROM && ((previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.isVariable()) || (previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.value) !== "" && (previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.value.toLowerCase()) !== FROM)
|
|
2663
2663
|
);
|
|
2664
2664
|
}
|
|
2665
2665
|
},
|
|
@@ -2667,7 +2667,7 @@ function initStatementPositionResolvers() {
|
|
|
2667
2667
|
id: StatementPosition.WhereKeyword,
|
|
2668
2668
|
name: StatementPosition.WhereKeyword,
|
|
2669
2669
|
resolve: (currentToken, previousKeyword, previousNonWhiteSpace, previousIsSlash) => Boolean(
|
|
2670
|
-
(previousKeyword == null ?
|
|
2670
|
+
(previousKeyword == null ? void 0 : previousKeyword.value.toLowerCase()) === WHERE && ((previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.isKeyword()) || (previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.is(TokenType.Parenthesis, "(")) || (previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.is(TokenType.Operator, AND)))
|
|
2671
2671
|
)
|
|
2672
2672
|
},
|
|
2673
2673
|
{
|
|
@@ -2676,14 +2676,14 @@ function initStatementPositionResolvers() {
|
|
|
2676
2676
|
resolve: (currentToken, previousKeyword, previousNonWhiteSpace, previousIsSlash) => {
|
|
2677
2677
|
var _a;
|
|
2678
2678
|
return Boolean(
|
|
2679
|
-
(previousKeyword == null ?
|
|
2679
|
+
(previousKeyword == null ? void 0 : previousKeyword.value.toLowerCase()) === WHERE && !((_a = previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.getPreviousNonWhiteSpaceToken()) == null ? void 0 : _a.isOperator()) && !(currentToken == null ? void 0 : currentToken.is(TokenType.Delimiter, ".")) && !(currentToken == null ? void 0 : currentToken.isParenthesis()) && ((previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.isIdentifier()) || (previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.isDoubleQuotedString()))
|
|
2680
2680
|
);
|
|
2681
2681
|
}
|
|
2682
2682
|
},
|
|
2683
2683
|
{
|
|
2684
2684
|
id: StatementPosition.WhereValue,
|
|
2685
2685
|
name: StatementPosition.WhereValue,
|
|
2686
|
-
resolve: (currentToken, previousKeyword, previousNonWhiteSpace, previousIsSlash) => Boolean((previousKeyword == null ?
|
|
2686
|
+
resolve: (currentToken, previousKeyword, previousNonWhiteSpace, previousIsSlash) => Boolean((previousKeyword == null ? void 0 : previousKeyword.value.toLowerCase()) === WHERE && (previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.isOperator()))
|
|
2687
2687
|
},
|
|
2688
2688
|
{
|
|
2689
2689
|
id: StatementPosition.AfterWhereValue,
|
|
@@ -2691,7 +2691,7 @@ function initStatementPositionResolvers() {
|
|
|
2691
2691
|
resolve: (currentToken, previousKeyword, previousNonWhiteSpace, previousIsSlash) => {
|
|
2692
2692
|
var _a, _b, _c;
|
|
2693
2693
|
return Boolean(
|
|
2694
|
-
(previousKeyword == null ?
|
|
2694
|
+
(previousKeyword == null ? void 0 : previousKeyword.value.toLowerCase()) === WHERE && ((previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.is(TokenType.Operator, "and")) || (previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.is(TokenType.Operator, "or")) || (previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.isString()) || (previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.isNumber()) || (previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.is(TokenType.Parenthesis, ")")) || (previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.is(TokenType.Parenthesis, "()")) || (previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.isTemplateVariable()) || (previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.is(TokenType.IdentifierQuote)) && ((_a = previousNonWhiteSpace.getPreviousNonWhiteSpaceToken()) == null ? void 0 : _a.is(TokenType.Identifier)) && ((_c = (_b = previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.getPreviousNonWhiteSpaceToken()) == null ? void 0 : _b.getPreviousNonWhiteSpaceToken()) == null ? void 0 : _c.is(TokenType.IdentifierQuote)))
|
|
2695
2695
|
);
|
|
2696
2696
|
}
|
|
2697
2697
|
},
|
|
@@ -2701,7 +2701,7 @@ function initStatementPositionResolvers() {
|
|
|
2701
2701
|
resolve: (currentToken, previousKeyword, previousNonWhiteSpace, previousIsSlash) => {
|
|
2702
2702
|
var _a;
|
|
2703
2703
|
return Boolean(
|
|
2704
|
-
(previousKeyword == null ?
|
|
2704
|
+
(previousKeyword == null ? void 0 : previousKeyword.is(TokenType.Keyword, BY)) && ((_a = previousKeyword == null ? void 0 : previousKeyword.getPreviousKeyword()) == null ? void 0 : _a.is(TokenType.Keyword, GROUP)) && ((previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.is(TokenType.Keyword, BY)) || (previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.is(TokenType.Delimiter, ",")))
|
|
2705
2705
|
);
|
|
2706
2706
|
}
|
|
2707
2707
|
},
|
|
@@ -2711,7 +2711,7 @@ function initStatementPositionResolvers() {
|
|
|
2711
2711
|
resolve: (currentToken, previousKeyword, previousNonWhiteSpace, previousIsSlash) => {
|
|
2712
2712
|
var _a;
|
|
2713
2713
|
return Boolean(
|
|
2714
|
-
(previousKeyword == null ?
|
|
2714
|
+
(previousKeyword == null ? void 0 : previousKeyword.is(TokenType.Keyword, BY)) && ((_a = previousKeyword == null ? void 0 : previousKeyword.getPreviousKeyword()) == null ? void 0 : _a.is(TokenType.Keyword, GROUP)) && ((previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.is(TokenType.Parenthesis, "(")) || (currentToken == null ? void 0 : currentToken.is(TokenType.Parenthesis, "()")))
|
|
2715
2715
|
);
|
|
2716
2716
|
}
|
|
2717
2717
|
},
|
|
@@ -2721,7 +2721,7 @@ function initStatementPositionResolvers() {
|
|
|
2721
2721
|
resolve: (currentToken, previousKeyword, previousNonWhiteSpace, previousIsSlash) => {
|
|
2722
2722
|
var _a;
|
|
2723
2723
|
return Boolean(
|
|
2724
|
-
(previousNonWhiteSpace == null ?
|
|
2724
|
+
(previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.is(TokenType.Keyword, BY)) && ((_a = previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.getPreviousKeyword()) == null ? void 0 : _a.is(TokenType.Keyword, ORDER))
|
|
2725
2725
|
);
|
|
2726
2726
|
}
|
|
2727
2727
|
},
|
|
@@ -2731,20 +2731,20 @@ function initStatementPositionResolvers() {
|
|
|
2731
2731
|
resolve: (currentToken, previousKeyword, previousNonWhiteSpace, previousIsSlash) => {
|
|
2732
2732
|
var _a, _b;
|
|
2733
2733
|
return Boolean(
|
|
2734
|
-
(previousKeyword == null ?
|
|
2734
|
+
(previousKeyword == null ? void 0 : previousKeyword.is(TokenType.Keyword, BY)) && ((_a = previousKeyword == null ? void 0 : previousKeyword.getPreviousKeyword()) == null ? void 0 : _a.is(TokenType.Keyword, ORDER)) && (previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.is(TokenType.Parenthesis)) && ((_b = previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.getPreviousNonWhiteSpaceToken()) == null ? void 0 : _b.is(TokenType.Function))
|
|
2735
2735
|
);
|
|
2736
2736
|
}
|
|
2737
2737
|
},
|
|
2738
2738
|
{
|
|
2739
2739
|
id: StatementPosition.AfterOrderByDirection,
|
|
2740
2740
|
name: StatementPosition.AfterOrderByDirection,
|
|
2741
|
-
resolve: (currentToken, previousKeyword, previousNonWhiteSpace, previousIsSlash) => Boolean((previousKeyword == null ?
|
|
2741
|
+
resolve: (currentToken, previousKeyword, previousNonWhiteSpace, previousIsSlash) => Boolean((previousKeyword == null ? void 0 : previousKeyword.is(TokenType.Keyword, DESC)) || (previousKeyword == null ? void 0 : previousKeyword.is(TokenType.Keyword, ASC)))
|
|
2742
2742
|
},
|
|
2743
2743
|
{
|
|
2744
2744
|
id: StatementPosition.AfterIsOperator,
|
|
2745
2745
|
name: StatementPosition.AfterIsOperator,
|
|
2746
2746
|
resolve: (currentToken, previousKeyword, previousNonWhiteSpace, previousIsSlash) => {
|
|
2747
|
-
return Boolean(previousNonWhiteSpace == null ?
|
|
2747
|
+
return Boolean(previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.is(TokenType.Operator, "IS"));
|
|
2748
2748
|
}
|
|
2749
2749
|
},
|
|
2750
2750
|
{
|
|
@@ -2753,7 +2753,7 @@ function initStatementPositionResolvers() {
|
|
|
2753
2753
|
resolve: (currentToken, previousKeyword, previousNonWhiteSpace, previousIsSlash) => {
|
|
2754
2754
|
var _a;
|
|
2755
2755
|
return Boolean(
|
|
2756
|
-
(previousNonWhiteSpace == null ?
|
|
2756
|
+
(previousNonWhiteSpace == null ? void 0 : previousNonWhiteSpace.is(TokenType.Operator, "NOT")) && ((_a = previousNonWhiteSpace.getPreviousNonWhiteSpaceToken()) == null ? void 0 : _a.is(TokenType.Operator, "IS"))
|
|
2757
2757
|
);
|
|
2758
2758
|
}
|
|
2759
2759
|
}
|
|
@@ -2767,7 +2767,7 @@ let sqlEditorLog = () => {
|
|
|
2767
2767
|
if (ui.attachDebugger && ui.createLogger) {
|
|
2768
2768
|
sqlEditorLogger = ui.createLogger("SQLEditor");
|
|
2769
2769
|
sqlEditorLog = sqlEditorLogger.logger;
|
|
2770
|
-
ui.attachDebugger("sqleditor",
|
|
2770
|
+
ui.attachDebugger("sqleditor", void 0, sqlEditorLogger);
|
|
2771
2771
|
}
|
|
2772
2772
|
|
|
2773
2773
|
const COLUMN = "column", RELATIVE_TIME_STRING = "'5m'";
|
|
@@ -2829,7 +2829,7 @@ function getStandardSQLCompletionProvider(monaco, language) {
|
|
|
2829
2829
|
provider.supportedFunctions = () => language.builtinFunctions.map((f) => ({ id: f, name: f }));
|
|
2830
2830
|
}
|
|
2831
2831
|
const operators = [];
|
|
2832
|
-
if ((_a = language == null ?
|
|
2832
|
+
if ((_a = language == null ? void 0 : language.comparisonOperators) == null ? void 0 : _a.length) {
|
|
2833
2833
|
operators.push(
|
|
2834
2834
|
...language.comparisonOperators.map((f) => ({
|
|
2835
2835
|
id: f.toLocaleLowerCase(),
|
|
@@ -2839,7 +2839,7 @@ function getStandardSQLCompletionProvider(monaco, language) {
|
|
|
2839
2839
|
);
|
|
2840
2840
|
}
|
|
2841
2841
|
language.logicalOperators = (_b = language.logicalOperators) != null ? _b : language.operators;
|
|
2842
|
-
if ((_c = language == null ?
|
|
2842
|
+
if ((_c = language == null ? void 0 : language.logicalOperators) == null ? void 0 : _c.length) {
|
|
2843
2843
|
operators.push(
|
|
2844
2844
|
...language.logicalOperators.map((f) => ({ id: f.toLocaleLowerCase(), operator: f, type: OperatorType.Logical }))
|
|
2845
2845
|
);
|
|
@@ -2865,7 +2865,7 @@ function useLatestCallback(callback) {
|
|
|
2865
2865
|
});
|
|
2866
2866
|
const hasCallback = Boolean(callback);
|
|
2867
2867
|
return React.useMemo(
|
|
2868
|
-
() => hasCallback ? ((...args) => ref.current(...args)) :
|
|
2868
|
+
() => hasCallback ? ((...args) => ref.current(...args)) : void 0,
|
|
2869
2869
|
[hasCallback]
|
|
2870
2870
|
);
|
|
2871
2871
|
}
|
|
@@ -2912,7 +2912,7 @@ const SQLEditor = ({
|
|
|
2912
2912
|
ui.CodeEditor,
|
|
2913
2913
|
{
|
|
2914
2914
|
height: height || "240px",
|
|
2915
|
-
width: width ? `${width - 2}px` :
|
|
2915
|
+
width: width ? `${width - 2}px` : void 0,
|
|
2916
2916
|
language: id,
|
|
2917
2917
|
value: query,
|
|
2918
2918
|
onBlur: onSqlBlur,
|
|
@@ -2943,12 +2943,12 @@ const SQLEditor = ({
|
|
|
2943
2943
|
), children && children({ formatQuery }));
|
|
2944
2944
|
};
|
|
2945
2945
|
const resolveLanguage = (monaco, languageDefinitionProp) => {
|
|
2946
|
-
if ((languageDefinitionProp == null ?
|
|
2947
|
-
sqlEditorLog(`Loading language '${languageDefinitionProp == null ?
|
|
2946
|
+
if ((languageDefinitionProp == null ? void 0 : languageDefinitionProp.id) !== STANDARD_SQL_LANGUAGE && !languageDefinitionProp.loader) {
|
|
2947
|
+
sqlEditorLog(`Loading language '${languageDefinitionProp == null ? void 0 : languageDefinitionProp.id}' from Monaco registry`, false);
|
|
2948
2948
|
const allLangs = monaco.languages.getLanguages();
|
|
2949
|
-
const custom = allLangs.find(({ id }) => id === (languageDefinitionProp == null ?
|
|
2949
|
+
const custom = allLangs.find(({ id }) => id === (languageDefinitionProp == null ? void 0 : languageDefinitionProp.id));
|
|
2950
2950
|
if (!custom) {
|
|
2951
|
-
throw Error(`Unknown Monaco language ${languageDefinitionProp == null ?
|
|
2951
|
+
throw Error(`Unknown Monaco language ${languageDefinitionProp == null ? void 0 : languageDefinitionProp.id}`);
|
|
2952
2952
|
}
|
|
2953
2953
|
return { completionProvider: getStandardSQLCompletionProvider, ...custom, ...languageDefinitionProp };
|
|
2954
2954
|
}
|
|
@@ -2970,7 +2970,7 @@ const registerLanguageAndSuggestions = async (monaco, l, lid) => {
|
|
|
2970
2970
|
monaco.languages.registerDocumentFormattingEditProvider(lid, {
|
|
2971
2971
|
provideDocumentFormattingEdits: (model) => {
|
|
2972
2972
|
var _a;
|
|
2973
|
-
const formatted = (_a = l.formatter) == null ?
|
|
2973
|
+
const formatted = (_a = l.formatter) == null ? void 0 : _a.call(l, model.getValue());
|
|
2974
2974
|
return [
|
|
2975
2975
|
{
|
|
2976
2976
|
range: model.getFullModelRange(),
|
|
@@ -3077,7 +3077,7 @@ function extendStandardRegistries(id, lid, customProvider) {
|
|
|
3077
3077
|
}
|
|
3078
3078
|
if (customProvider.customSuggestionKinds) {
|
|
3079
3079
|
for (const kind of customProvider.customSuggestionKinds()) {
|
|
3080
|
-
(_a = kind.applyTo) == null ?
|
|
3080
|
+
(_a = kind.applyTo) == null ? void 0 : _a.forEach((applyTo) => {
|
|
3081
3081
|
const exists = languageRegistries.suggestionKinds.getIfExists(applyTo);
|
|
3082
3082
|
if (exists) {
|
|
3083
3083
|
if (exists.kind.indexOf(kind.id) === -1) {
|
|
@@ -3087,7 +3087,7 @@ function extendStandardRegistries(id, lid, customProvider) {
|
|
|
3087
3087
|
});
|
|
3088
3088
|
if (kind.overrideDefault) {
|
|
3089
3089
|
const stbBehavior = instanceSuggestionsRegistry.get(kind.id);
|
|
3090
|
-
if (stbBehavior !==
|
|
3090
|
+
if (stbBehavior !== void 0) {
|
|
3091
3091
|
stbBehavior.suggestions = kind.suggestionsResolver;
|
|
3092
3092
|
continue;
|
|
3093
3093
|
}
|
|
@@ -3129,9 +3129,9 @@ function extendStandardRegistries(id, lid, customProvider) {
|
|
|
3129
3129
|
var _a2, _b, _c, _d, _e;
|
|
3130
3130
|
const o = await s(ctx, m);
|
|
3131
3131
|
const tableToken = getTableToken(ctx.currentToken);
|
|
3132
|
-
const tableNameParser = (_b = (_a2 = customProvider.tables) == null ?
|
|
3132
|
+
const tableNameParser = (_b = (_a2 = customProvider.tables) == null ? void 0 : _a2.parseName) != null ? _b : defaultTableNameParser;
|
|
3133
3133
|
const tableIdentifier = tableNameParser(tableToken);
|
|
3134
|
-
const oo = ((_e = await ((_d = (_c = customProvider.tables) == null ?
|
|
3134
|
+
const oo = ((_e = await ((_d = (_c = customProvider.tables) == null ? void 0 : _c.resolve) == null ? void 0 : _d.call(_c, tableIdentifier))) != null ? _e : []).map((x) => {
|
|
3135
3135
|
var _a3;
|
|
3136
3136
|
return {
|
|
3137
3137
|
label: x.name,
|
|
@@ -3154,13 +3154,13 @@ function extendStandardRegistries(id, lid, customProvider) {
|
|
|
3154
3154
|
const o = await s(ctx, m);
|
|
3155
3155
|
const tableToken = getTableToken(ctx.currentToken);
|
|
3156
3156
|
let tableIdentifier;
|
|
3157
|
-
const tableNameParser = (_b = (_a2 = customProvider.tables) == null ?
|
|
3157
|
+
const tableNameParser = (_b = (_a2 = customProvider.tables) == null ? void 0 : _a2.parseName) != null ? _b : defaultTableNameParser;
|
|
3158
3158
|
if (tableToken && tableToken.value) {
|
|
3159
3159
|
tableIdentifier = tableNameParser(tableToken);
|
|
3160
3160
|
}
|
|
3161
3161
|
let oo = [];
|
|
3162
3162
|
if (tableIdentifier) {
|
|
3163
|
-
const columns = await ((_c = customProvider.columns) == null ?
|
|
3163
|
+
const columns = await ((_c = customProvider.columns) == null ? void 0 : _c.resolve(tableIdentifier));
|
|
3164
3164
|
oo = columns ? columns.map((x) => {
|
|
3165
3165
|
var _a3;
|
|
3166
3166
|
return {
|
|
@@ -5458,7 +5458,7 @@ const toOption = (_a = data.toOption) != null ? _a : backWardToOption;
|
|
|
5458
5458
|
|
|
5459
5459
|
const EditorStack = ({ children, wrap: wrapItems = true, ...props }) => {
|
|
5460
5460
|
var _a, _b;
|
|
5461
|
-
return /* @__PURE__ */ React__default.default.createElement(ui.Stack, { wrap: wrapItems ? "wrap" :
|
|
5461
|
+
return /* @__PURE__ */ React__default.default.createElement(ui.Stack, { wrap: wrapItems ? "wrap" : void 0, direction: (_a = props.direction) != null ? _a : "row", gap: (_b = props.gap) != null ? _b : 2, ...props }, children);
|
|
5462
5462
|
};
|
|
5463
5463
|
|
|
5464
5464
|
const EditorList = React.forwardRef(function EditorList2({ items, renderItem, onChange }, ref) {
|
|
@@ -5556,7 +5556,7 @@ function GroupByRow({ sql, columns, onSqlChange }) {
|
|
|
5556
5556
|
(item) => {
|
|
5557
5557
|
const cleaned = item.map((v) => {
|
|
5558
5558
|
var _a;
|
|
5559
|
-
return setGroupByField((_a = v.property) == null ?
|
|
5559
|
+
return setGroupByField((_a = v.property) == null ? void 0 : _a.name);
|
|
5560
5560
|
});
|
|
5561
5561
|
const newSql = { ...sql, groupBy: cleaned };
|
|
5562
5562
|
onSqlChange(newSql);
|
|
@@ -5580,7 +5580,7 @@ function makeRenderColumn({ options }) {
|
|
|
5580
5580
|
return /* @__PURE__ */ React__default.default.createElement(InputGroup, null, /* @__PURE__ */ React__default.default.createElement(
|
|
5581
5581
|
ui.Select,
|
|
5582
5582
|
{
|
|
5583
|
-
value: ((_a = item.property) == null ?
|
|
5583
|
+
value: ((_a = item.property) == null ? void 0 : _a.name) ? data.toOption(item.property.name) : null,
|
|
5584
5584
|
"aria-label": "Group by",
|
|
5585
5585
|
options,
|
|
5586
5586
|
menuShouldPortal: true,
|
|
@@ -5613,7 +5613,7 @@ const EditorField$1 = (props) => {
|
|
|
5613
5613
|
var _a;
|
|
5614
5614
|
const { label, optional, tooltip, tooltipInteractive, children, width, ...fieldProps } = props;
|
|
5615
5615
|
const styles = ui.useStyles2(getStyles$l, width);
|
|
5616
|
-
const childInputId = (fieldProps == null ?
|
|
5616
|
+
const childInputId = (fieldProps == null ? void 0 : fieldProps.htmlFor) || ((_a = ui.ReactUtils) == null ? void 0 : _a.getChildId(children));
|
|
5617
5617
|
const labelEl = /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, /* @__PURE__ */ React__default.default.createElement("label", { className: styles.label, htmlFor: childInputId }, label, optional && /* @__PURE__ */ React__default.default.createElement("span", { className: styles.optional }, " - optional"), tooltip && /* @__PURE__ */ React__default.default.createElement(ui.Tooltip, { placement: "top", content: tooltip, theme: "info", interactive: tooltipInteractive }, /* @__PURE__ */ React__default.default.createElement(ui.Icon, { tabIndex: 0, name: "info-circle", size: "sm", className: styles.icon }))), /* @__PURE__ */ React__default.default.createElement(ui.Space, { v: 0.5 }));
|
|
5618
5618
|
return /* @__PURE__ */ React__default.default.createElement("div", { className: styles.root }, /* @__PURE__ */ React__default.default.createElement(ui.Field, { className: styles.field, label: labelEl, ...fieldProps }, children));
|
|
5619
5619
|
};
|
|
@@ -5723,32 +5723,23 @@ const getSelectStyles = (theme) => ({
|
|
|
5723
5723
|
})
|
|
5724
5724
|
});
|
|
5725
5725
|
|
|
5726
|
-
const Space = (
|
|
5727
|
-
const
|
|
5728
|
-
const styles = getStyles$i(theme, props);
|
|
5726
|
+
const Space = ({ v = 0, h = 0, layout = "block" }) => {
|
|
5727
|
+
const styles = ui.useStyles2(getStyles$i, v, h, layout);
|
|
5729
5728
|
return /* @__PURE__ */ React__default.default.createElement("span", { className: css.cx(styles.wrapper) });
|
|
5730
5729
|
};
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
props.layout === "inline" && {
|
|
5745
|
-
display: "inline-block"
|
|
5746
|
-
},
|
|
5747
|
-
props.layout === "block" && {
|
|
5748
|
-
display: "block"
|
|
5749
|
-
}
|
|
5750
|
-
])
|
|
5751
|
-
};
|
|
5730
|
+
const getStyles$i = (theme, v, h, layout) => ({
|
|
5731
|
+
wrapper: css.css([
|
|
5732
|
+
{
|
|
5733
|
+
paddingRight: theme.spacing(h != null ? h : 0),
|
|
5734
|
+
paddingBottom: theme.spacing(v != null ? v : 0)
|
|
5735
|
+
},
|
|
5736
|
+
layout === "inline" && {
|
|
5737
|
+
display: "inline-block"
|
|
5738
|
+
},
|
|
5739
|
+
layout === "block" && {
|
|
5740
|
+
display: "block"
|
|
5741
|
+
}
|
|
5742
|
+
])
|
|
5752
5743
|
});
|
|
5753
5744
|
|
|
5754
5745
|
function ConfirmModal({ isOpen, onCancel, onDiscard, onCopy }) {
|
|
@@ -5756,7 +5747,7 @@ function ConfirmModal({ isOpen, onCancel, onDiscard, onCopy }) {
|
|
|
5756
5747
|
React.useEffect(() => {
|
|
5757
5748
|
var _a;
|
|
5758
5749
|
if (isOpen) {
|
|
5759
|
-
(_a = buttonRef.current) == null ?
|
|
5750
|
+
(_a = buttonRef.current) == null ? void 0 : _a.focus();
|
|
5760
5751
|
}
|
|
5761
5752
|
}, [isOpen]);
|
|
5762
5753
|
return /* @__PURE__ */ React__default.default.createElement(
|
|
@@ -5802,7 +5793,7 @@ const DatasetSelector = ({
|
|
|
5802
5793
|
onChange(state.value[0]);
|
|
5803
5794
|
}
|
|
5804
5795
|
} else {
|
|
5805
|
-
if (state.value && state.value.find((v) => v.value === value) ===
|
|
5796
|
+
if (state.value && state.value.find((v) => v.value === value) === void 0) {
|
|
5806
5797
|
if (state.value.length > 0) {
|
|
5807
5798
|
onChange(state.value[0]);
|
|
5808
5799
|
}
|
|
@@ -5853,7 +5844,7 @@ const CatalogSelector = ({ db, inputId, value, onChange }) => {
|
|
|
5853
5844
|
loadCatalogs();
|
|
5854
5845
|
}, [db, loadCatalogs]);
|
|
5855
5846
|
const handleChange = (selectable) => {
|
|
5856
|
-
onChange((selectable == null ?
|
|
5847
|
+
onChange((selectable == null ? void 0 : selectable.value) || null);
|
|
5857
5848
|
};
|
|
5858
5849
|
const selectedValue = catalogs.find((catalog) => catalog.value === value) || null;
|
|
5859
5850
|
return /* @__PURE__ */ React__default.default.createElement(
|
|
@@ -5917,7 +5908,7 @@ const RunQueryButton = ({
|
|
|
5917
5908
|
onClick,
|
|
5918
5909
|
dataTestId
|
|
5919
5910
|
}) => {
|
|
5920
|
-
let icon = queryInvalid ? "exclamation-triangle" :
|
|
5911
|
+
let icon = queryInvalid ? "exclamation-triangle" : void 0;
|
|
5921
5912
|
if (queryRunning) {
|
|
5922
5913
|
icon = "fa fa-spinner";
|
|
5923
5914
|
}
|
|
@@ -5980,35 +5971,35 @@ function QueryHeader({
|
|
|
5980
5971
|
[editorMode, onChange, query]
|
|
5981
5972
|
);
|
|
5982
5973
|
const onFormatChange = (e) => {
|
|
5983
|
-
const next = { ...query, format: e.value !==
|
|
5974
|
+
const next = { ...query, format: e.value !== void 0 ? e.value : QueryFormat.Table };
|
|
5984
5975
|
onChange(next);
|
|
5985
5976
|
};
|
|
5986
5977
|
const onDatasetChange = (e) => {
|
|
5987
|
-
const datasetValue = e.value ||
|
|
5978
|
+
const datasetValue = e.value || void 0;
|
|
5988
5979
|
if (datasetValue === query.dataset) {
|
|
5989
5980
|
return;
|
|
5990
5981
|
}
|
|
5991
5982
|
const next = {
|
|
5992
5983
|
...query,
|
|
5993
5984
|
dataset: datasetValue,
|
|
5994
|
-
table:
|
|
5995
|
-
sql:
|
|
5985
|
+
table: void 0,
|
|
5986
|
+
sql: void 0,
|
|
5996
5987
|
rawSql: ""
|
|
5997
5988
|
};
|
|
5998
5989
|
onChange(next);
|
|
5999
5990
|
};
|
|
6000
5991
|
const onCatalogChange = (catalog) => {
|
|
6001
|
-
const catalogValue = catalog ||
|
|
5992
|
+
const catalogValue = catalog || void 0;
|
|
6002
5993
|
if (catalogValue === query.catalog) {
|
|
6003
5994
|
return;
|
|
6004
5995
|
}
|
|
6005
5996
|
const next = {
|
|
6006
5997
|
...query,
|
|
6007
5998
|
catalog: catalogValue,
|
|
6008
|
-
dataset:
|
|
5999
|
+
dataset: void 0,
|
|
6009
6000
|
// Reset dataset (which acts as schema when catalog is present)
|
|
6010
|
-
table:
|
|
6011
|
-
sql:
|
|
6001
|
+
table: void 0,
|
|
6002
|
+
sql: void 0,
|
|
6012
6003
|
rawSql: ""
|
|
6013
6004
|
};
|
|
6014
6005
|
onChange(next);
|
|
@@ -6020,7 +6011,7 @@ function QueryHeader({
|
|
|
6020
6011
|
const next = {
|
|
6021
6012
|
...query,
|
|
6022
6013
|
table: e.value,
|
|
6023
|
-
sql:
|
|
6014
|
+
sql: void 0,
|
|
6024
6015
|
rawSql: ""
|
|
6025
6016
|
};
|
|
6026
6017
|
onChange(next);
|
|
@@ -6103,7 +6094,7 @@ function QueryHeader({
|
|
|
6103
6094
|
{
|
|
6104
6095
|
db,
|
|
6105
6096
|
inputId: `sql-catalog-${htmlId}`,
|
|
6106
|
-
value: query.catalog ===
|
|
6097
|
+
value: query.catalog === void 0 ? null : query.catalog,
|
|
6107
6098
|
onChange: onCatalogChange
|
|
6108
6099
|
}
|
|
6109
6100
|
)), effectiveEnableDatasets && /* @__PURE__ */ React__default.default.createElement(
|
|
@@ -6118,10 +6109,10 @@ function QueryHeader({
|
|
|
6118
6109
|
db,
|
|
6119
6110
|
inputId: catalogsEnabled ? `sql-schema-${htmlId}` : `sql-dataset-${htmlId}`,
|
|
6120
6111
|
"data-testid": catalogsEnabled ? "schema-selector" : "dataset-selector",
|
|
6121
|
-
dataset: catalogsEnabled ?
|
|
6122
|
-
value: query.dataset ===
|
|
6112
|
+
dataset: catalogsEnabled ? void 0 : defaultDataset,
|
|
6113
|
+
value: query.dataset === void 0 ? null : query.dataset,
|
|
6123
6114
|
onChange: onDatasetChange,
|
|
6124
|
-
catalog: catalogsEnabled ? query.catalog :
|
|
6115
|
+
catalog: catalogsEnabled ? query.catalog : void 0
|
|
6125
6116
|
}
|
|
6126
6117
|
)
|
|
6127
6118
|
), /* @__PURE__ */ React__default.default.createElement(EditorField$1, { label: labels.get("table") || "Table", width: 25 }, /* @__PURE__ */ React__default.default.createElement(
|
|
@@ -6129,10 +6120,10 @@ function QueryHeader({
|
|
|
6129
6120
|
{
|
|
6130
6121
|
db,
|
|
6131
6122
|
inputId: `sql-table-${htmlId}`,
|
|
6132
|
-
dataset: query.dataset || (catalogsEnabled ?
|
|
6133
|
-
catalog: catalogsEnabled ? query.catalog :
|
|
6123
|
+
dataset: query.dataset || (catalogsEnabled ? void 0 : defaultDataset),
|
|
6124
|
+
catalog: catalogsEnabled ? query.catalog : void 0,
|
|
6134
6125
|
query,
|
|
6135
|
-
value: query.table ===
|
|
6126
|
+
value: query.table === void 0 ? null : query.table,
|
|
6136
6127
|
onChange: onTableChange,
|
|
6137
6128
|
enableCatalogs: catalogsEnabled,
|
|
6138
6129
|
applyDefault: true
|
|
@@ -6198,7 +6189,7 @@ function QueryValidator({ db, query, onValidate, range }) {
|
|
|
6198
6189
|
const [state, validateQuery] = reactUse.useAsyncFn(
|
|
6199
6190
|
async (q) => {
|
|
6200
6191
|
var _a2;
|
|
6201
|
-
if (((_a2 = q.rawSql) == null ?
|
|
6192
|
+
if (((_a2 = q.rawSql) == null ? void 0 : _a2.trim()) === "") {
|
|
6202
6193
|
return null;
|
|
6203
6194
|
}
|
|
6204
6195
|
return await db.validateQuery(q, range);
|
|
@@ -6217,17 +6208,17 @@ function QueryValidator({ db, query, onValidate, range }) {
|
|
|
6217
6208
|
[query, validateQuery]
|
|
6218
6209
|
);
|
|
6219
6210
|
React.useEffect(() => {
|
|
6220
|
-
if (validationResult == null ?
|
|
6211
|
+
if (validationResult == null ? void 0 : validationResult.isError) {
|
|
6221
6212
|
onValidate(false);
|
|
6222
6213
|
}
|
|
6223
|
-
if (validationResult == null ?
|
|
6214
|
+
if (validationResult == null ? void 0 : validationResult.isValid) {
|
|
6224
6215
|
onValidate(true);
|
|
6225
6216
|
}
|
|
6226
6217
|
}, [validationResult, onValidate]);
|
|
6227
6218
|
if (!state.value && !state.loading) {
|
|
6228
6219
|
return null;
|
|
6229
6220
|
}
|
|
6230
|
-
const error = ((_a = state.value) == null ?
|
|
6221
|
+
const error = ((_a = state.value) == null ? void 0 : _a.error) ? processErrorMessage(state.value.error) : "";
|
|
6231
6222
|
return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, state.loading && /* @__PURE__ */ React__default.default.createElement("div", { className: styles.info }, /* @__PURE__ */ React__default.default.createElement(ui.Spinner, { inline: true, size: 12 }), " Validating query..."), !state.loading && state.value && /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, state.value.isValid && state.value.statistics && /* @__PURE__ */ React__default.default.createElement("div", { className: styles.valid }, /* @__PURE__ */ React__default.default.createElement(ui.Icon, { name: "check" }), " This query will process", " ", /* @__PURE__ */ React__default.default.createElement("strong", null, data.formattedValueToString(valueFormatter(state.value.statistics.TotalBytesProcessed))), " ", "when run.")), /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, state.value.isError && /* @__PURE__ */ React__default.default.createElement("div", { className: styles.error }, error))));
|
|
6232
6223
|
}
|
|
6233
6224
|
function processErrorMessage(error) {
|
|
@@ -6271,7 +6262,7 @@ function QueryToolbox({ showTools, onFormatCode, onExpand, isExpanded, ...valida
|
|
|
6271
6262
|
};
|
|
6272
6263
|
}, [theme]);
|
|
6273
6264
|
let style = {};
|
|
6274
|
-
if (!showTools && validationResult ===
|
|
6265
|
+
if (!showTools && validationResult === void 0) {
|
|
6275
6266
|
style = { height: 0, padding: 0, visibility: "hidden" };
|
|
6276
6267
|
}
|
|
6277
6268
|
return /* @__PURE__ */ React__default.default.createElement("div", { className: styles.container, style }, /* @__PURE__ */ React__default.default.createElement("div", null, validatorProps.onValidate && /* @__PURE__ */ React__default.default.createElement(
|
|
@@ -6308,7 +6299,7 @@ function RawEditor({ db, query, onChange, onRunQuery, onValidate, queryToValidat
|
|
|
6308
6299
|
completionProvider,
|
|
6309
6300
|
query,
|
|
6310
6301
|
width,
|
|
6311
|
-
height: height ? height - toolboxMeasure.height :
|
|
6302
|
+
height: height ? height - toolboxMeasure.height : void 0,
|
|
6312
6303
|
onChange
|
|
6313
6304
|
},
|
|
6314
6305
|
({ formatQuery }) => {
|
|
@@ -6455,9 +6446,9 @@ function OrderByRow({ sql, onSqlChange, columns, showOffset }) {
|
|
|
6455
6446
|
);
|
|
6456
6447
|
const onOrderByChange = React.useCallback(
|
|
6457
6448
|
(item) => {
|
|
6458
|
-
const newSql = { ...sql, orderBy: setPropertyField(item == null ?
|
|
6449
|
+
const newSql = { ...sql, orderBy: setPropertyField(item == null ? void 0 : item.value) };
|
|
6459
6450
|
if (item === null) {
|
|
6460
|
-
newSql.orderByDirection =
|
|
6451
|
+
newSql.orderByDirection = void 0;
|
|
6461
6452
|
}
|
|
6462
6453
|
onSqlChange(newSql);
|
|
6463
6454
|
},
|
|
@@ -6468,7 +6459,7 @@ function OrderByRow({ sql, onSqlChange, columns, showOffset }) {
|
|
|
6468
6459
|
{
|
|
6469
6460
|
"aria-label": "Order by",
|
|
6470
6461
|
options: columns,
|
|
6471
|
-
value: ((_a = sql.orderBy) == null ?
|
|
6462
|
+
value: ((_a = sql.orderBy) == null ? void 0 : _a.property.name) ? data.toOption(sql.orderBy.property.name) : null,
|
|
6472
6463
|
isClearable: true,
|
|
6473
6464
|
menuShouldPortal: true,
|
|
6474
6465
|
onChange: onOrderByChange
|
|
@@ -6477,7 +6468,7 @@ function OrderByRow({ sql, onSqlChange, columns, showOffset }) {
|
|
|
6477
6468
|
ui.RadioButtonGroup,
|
|
6478
6469
|
{
|
|
6479
6470
|
options: sortOrderOptions,
|
|
6480
|
-
disabled: !((_b = sql == null ?
|
|
6471
|
+
disabled: !((_b = sql == null ? void 0 : sql.orderBy) == null ? void 0 : _b.property.name),
|
|
6481
6472
|
value: sql.orderByDirection,
|
|
6482
6473
|
onChange: onSortOrderChange
|
|
6483
6474
|
}
|
|
@@ -6489,9 +6480,9 @@ function SQLOrderByRow({ fields, query, onQueryChange, db }) {
|
|
|
6489
6480
|
const { onSqlChange } = useSqlChange({ query, onQueryChange, db });
|
|
6490
6481
|
let columnsWithIndices = [];
|
|
6491
6482
|
if (fields) {
|
|
6492
|
-
const options = (_b = (_a = query.sql) == null ?
|
|
6483
|
+
const options = (_b = (_a = query.sql) == null ? void 0 : _a.columns) == null ? void 0 : _b.map((c, i) => {
|
|
6493
6484
|
var _a2, _b2;
|
|
6494
|
-
const value = c.name ? `${c.name}(${(_a2 = c.parameters) == null ?
|
|
6485
|
+
const value = c.name ? `${c.name}(${(_a2 = c.parameters) == null ? void 0 : _a2.map((p) => p.name)})` : (_b2 = c.parameters) == null ? void 0 : _b2.map((p) => p.name);
|
|
6495
6486
|
return {
|
|
6496
6487
|
value,
|
|
6497
6488
|
label: `${i + 1} - ${value}`
|
|
@@ -6519,7 +6510,7 @@ function SelectRow({ sql, columns, onSqlChange, functions }) {
|
|
|
6519
6510
|
(item, index) => (column) => {
|
|
6520
6511
|
var _a2, _b;
|
|
6521
6512
|
let modifiedItem = { ...item };
|
|
6522
|
-
if (!((_a2 = item.parameters) == null ?
|
|
6513
|
+
if (!((_a2 = item.parameters) == null ? void 0 : _a2.length)) {
|
|
6523
6514
|
modifiedItem.parameters = [{ type: QueryEditorExpressionType.FunctionParameter, name: column.value }];
|
|
6524
6515
|
} else {
|
|
6525
6516
|
modifiedItem.parameters = item.parameters.map(
|
|
@@ -6528,7 +6519,7 @@ function SelectRow({ sql, columns, onSqlChange, functions }) {
|
|
|
6528
6519
|
}
|
|
6529
6520
|
const newSql = {
|
|
6530
6521
|
...sql,
|
|
6531
|
-
columns: (_b = sql.columns) == null ?
|
|
6522
|
+
columns: (_b = sql.columns) == null ? void 0 : _b.map((c, i) => i === index ? modifiedItem : c)
|
|
6532
6523
|
};
|
|
6533
6524
|
onSqlChange(newSql);
|
|
6534
6525
|
},
|
|
@@ -6539,11 +6530,11 @@ function SelectRow({ sql, columns, onSqlChange, functions }) {
|
|
|
6539
6530
|
var _a2;
|
|
6540
6531
|
const newItem = {
|
|
6541
6532
|
...item,
|
|
6542
|
-
name: aggregation == null ?
|
|
6533
|
+
name: aggregation == null ? void 0 : aggregation.value
|
|
6543
6534
|
};
|
|
6544
6535
|
const newSql = {
|
|
6545
6536
|
...sql,
|
|
6546
|
-
columns: (_a2 = sql.columns) == null ?
|
|
6537
|
+
columns: (_a2 = sql.columns) == null ? void 0 : _a2.map((c, i) => i === index ? newItem : c)
|
|
6547
6538
|
};
|
|
6548
6539
|
onSqlChange(newSql);
|
|
6549
6540
|
},
|
|
@@ -6565,7 +6556,7 @@ function SelectRow({ sql, columns, onSqlChange, functions }) {
|
|
|
6565
6556
|
const newSql = { ...sql, columns: [...sql.columns, createFunctionField()] };
|
|
6566
6557
|
onSqlChange(newSql);
|
|
6567
6558
|
}, [onSqlChange, sql]);
|
|
6568
|
-
return /* @__PURE__ */ React__default.default.createElement(EditorStack, { gap: 2, alignItems: "end", direction: "column" }, (_a = sql.columns) == null ?
|
|
6559
|
+
return /* @__PURE__ */ React__default.default.createElement(EditorStack, { gap: 2, alignItems: "end", direction: "column" }, (_a = sql.columns) == null ? void 0 : _a.map((item, index) => /* @__PURE__ */ React__default.default.createElement("div", { key: index }, /* @__PURE__ */ React__default.default.createElement(EditorStack, { gap: 2, alignItems: "end" }, /* @__PURE__ */ React__default.default.createElement(EditorField$1, { label: "Column", width: 25 }, /* @__PURE__ */ React__default.default.createElement(
|
|
6569
6560
|
ui.Select,
|
|
6570
6561
|
{
|
|
6571
6562
|
value: getColumnValue(item),
|
|
@@ -6613,8 +6604,8 @@ const getStyles$f = () => {
|
|
|
6613
6604
|
return { addButton: css.css({ alignSelf: "flex-start" }) };
|
|
6614
6605
|
};
|
|
6615
6606
|
function getColumnValue({ parameters }) {
|
|
6616
|
-
const column = parameters == null ?
|
|
6617
|
-
if (column == null ?
|
|
6607
|
+
const column = parameters == null ? void 0 : parameters.find((p) => p.type === QueryEditorExpressionType.FunctionParameter);
|
|
6608
|
+
if (column == null ? void 0 : column.name) {
|
|
6618
6609
|
return data.toOption(column.name);
|
|
6619
6610
|
}
|
|
6620
6611
|
return null;
|
|
@@ -6635,7 +6626,6 @@ const buttonLabels = {
|
|
|
6635
6626
|
};
|
|
6636
6627
|
({
|
|
6637
6628
|
id: ui$1.Utils.uuid(),
|
|
6638
|
-
type: "group",
|
|
6639
6629
|
children1: [
|
|
6640
6630
|
{
|
|
6641
6631
|
id: ui$1.Utils.uuid(),
|
|
@@ -6673,9 +6663,9 @@ const widgets = {
|
|
|
6673
6663
|
return /* @__PURE__ */ React__default.default.createElement(
|
|
6674
6664
|
ui.Input,
|
|
6675
6665
|
{
|
|
6676
|
-
value: (props == null ?
|
|
6677
|
-
placeholder: props == null ?
|
|
6678
|
-
onChange: (e) => props == null ?
|
|
6666
|
+
value: (props == null ? void 0 : props.value) || "",
|
|
6667
|
+
placeholder: props == null ? void 0 : props.placeholder,
|
|
6668
|
+
onChange: (e) => props == null ? void 0 : props.setValue(e.currentTarget.value)
|
|
6679
6669
|
}
|
|
6680
6670
|
);
|
|
6681
6671
|
}
|
|
@@ -6686,10 +6676,10 @@ const widgets = {
|
|
|
6686
6676
|
return /* @__PURE__ */ React__default.default.createElement(
|
|
6687
6677
|
ui.Input,
|
|
6688
6678
|
{
|
|
6689
|
-
value: props == null ?
|
|
6690
|
-
placeholder: props == null ?
|
|
6679
|
+
value: props == null ? void 0 : props.value,
|
|
6680
|
+
placeholder: props == null ? void 0 : props.placeholder,
|
|
6691
6681
|
type: "number",
|
|
6692
|
-
onChange: (e) => props == null ?
|
|
6682
|
+
onChange: (e) => props == null ? void 0 : props.setValue(Number.parseInt(e.currentTarget.value, 10))
|
|
6693
6683
|
}
|
|
6694
6684
|
);
|
|
6695
6685
|
}
|
|
@@ -6701,9 +6691,9 @@ const widgets = {
|
|
|
6701
6691
|
ui.DateTimePicker,
|
|
6702
6692
|
{
|
|
6703
6693
|
onChange: (e) => {
|
|
6704
|
-
props == null ?
|
|
6694
|
+
props == null ? void 0 : props.setValue(e == null ? void 0 : e.format(ui$1.BasicConfig.widgets.datetime.valueFormat));
|
|
6705
6695
|
},
|
|
6706
|
-
date: data.dateTime(props == null ?
|
|
6696
|
+
date: data.dateTime(props == null ? void 0 : props.value).utc()
|
|
6707
6697
|
}
|
|
6708
6698
|
);
|
|
6709
6699
|
}
|
|
@@ -6721,37 +6711,37 @@ const settings = {
|
|
|
6721
6711
|
return /* @__PURE__ */ React__default.default.createElement(
|
|
6722
6712
|
ui.Select,
|
|
6723
6713
|
{
|
|
6724
|
-
id: conjProps == null ?
|
|
6714
|
+
id: conjProps == null ? void 0 : conjProps.id,
|
|
6725
6715
|
"aria-label": "Conjunction",
|
|
6726
6716
|
menuShouldPortal: true,
|
|
6727
|
-
options: (conjProps == null ?
|
|
6728
|
-
value: conjProps == null ?
|
|
6729
|
-
onChange: (val) => conjProps == null ?
|
|
6717
|
+
options: (conjProps == null ? void 0 : conjProps.conjunctionOptions) ? Object.keys(conjProps == null ? void 0 : conjProps.conjunctionOptions).map(data.toOption) : void 0,
|
|
6718
|
+
value: conjProps == null ? void 0 : conjProps.selectedConjunction,
|
|
6719
|
+
onChange: (val) => conjProps == null ? void 0 : conjProps.setConjunction(val.value)
|
|
6730
6720
|
}
|
|
6731
6721
|
);
|
|
6732
6722
|
},
|
|
6733
6723
|
renderField: function Field(fieldProps) {
|
|
6734
6724
|
var _a;
|
|
6735
|
-
const fields = ((_a = fieldProps == null ?
|
|
6725
|
+
const fields = ((_a = fieldProps == null ? void 0 : fieldProps.config) == null ? void 0 : _a.fields) || {};
|
|
6736
6726
|
return /* @__PURE__ */ React__default.default.createElement(
|
|
6737
6727
|
ui.Select,
|
|
6738
6728
|
{
|
|
6739
|
-
id: fieldProps == null ?
|
|
6729
|
+
id: fieldProps == null ? void 0 : fieldProps.id,
|
|
6740
6730
|
width: 25,
|
|
6741
6731
|
"aria-label": "Field",
|
|
6742
6732
|
menuShouldPortal: true,
|
|
6743
|
-
options: fieldProps == null ?
|
|
6733
|
+
options: fieldProps == null ? void 0 : fieldProps.items.map((f) => {
|
|
6744
6734
|
var _a2, _b;
|
|
6745
|
-
const icon = (_b = (_a2 = fields[f.key].mainWidgetProps) == null ?
|
|
6735
|
+
const icon = (_b = (_a2 = fields[f.key].mainWidgetProps) == null ? void 0 : _a2.customProps) == null ? void 0 : _b.icon;
|
|
6746
6736
|
return {
|
|
6747
6737
|
label: f.label,
|
|
6748
6738
|
value: f.key,
|
|
6749
6739
|
icon
|
|
6750
6740
|
};
|
|
6751
6741
|
}),
|
|
6752
|
-
value: fieldProps == null ?
|
|
6742
|
+
value: fieldProps == null ? void 0 : fieldProps.selectedKey,
|
|
6753
6743
|
onChange: (val) => {
|
|
6754
|
-
fieldProps == null ?
|
|
6744
|
+
fieldProps == null ? void 0 : fieldProps.setField(val.label);
|
|
6755
6745
|
}
|
|
6756
6746
|
}
|
|
6757
6747
|
);
|
|
@@ -6761,11 +6751,11 @@ const settings = {
|
|
|
6761
6751
|
ui.Button,
|
|
6762
6752
|
{
|
|
6763
6753
|
type: "button",
|
|
6764
|
-
title: `${buttonProps == null ?
|
|
6765
|
-
onClick: buttonProps == null ?
|
|
6754
|
+
title: `${buttonProps == null ? void 0 : buttonProps.label} filter`,
|
|
6755
|
+
onClick: buttonProps == null ? void 0 : buttonProps.onClick,
|
|
6766
6756
|
variant: "secondary",
|
|
6767
6757
|
size: "md",
|
|
6768
|
-
icon: (buttonProps == null ?
|
|
6758
|
+
icon: (buttonProps == null ? void 0 : buttonProps.label) === buttonLabels.add ? "plus" : "times"
|
|
6769
6759
|
}
|
|
6770
6760
|
);
|
|
6771
6761
|
},
|
|
@@ -6773,12 +6763,12 @@ const settings = {
|
|
|
6773
6763
|
return /* @__PURE__ */ React__default.default.createElement(
|
|
6774
6764
|
ui.Select,
|
|
6775
6765
|
{
|
|
6776
|
-
options: operatorProps == null ?
|
|
6766
|
+
options: operatorProps == null ? void 0 : operatorProps.items.map((op) => ({ label: op.label, value: op.key })),
|
|
6777
6767
|
"aria-label": "Operator",
|
|
6778
6768
|
menuShouldPortal: true,
|
|
6779
|
-
value: operatorProps == null ?
|
|
6769
|
+
value: operatorProps == null ? void 0 : operatorProps.selectedKey,
|
|
6780
6770
|
onChange: (val) => {
|
|
6781
|
-
operatorProps == null ?
|
|
6771
|
+
operatorProps == null ? void 0 : operatorProps.setField(val.value || "");
|
|
6782
6772
|
}
|
|
6783
6773
|
}
|
|
6784
6774
|
);
|
|
@@ -6974,7 +6964,7 @@ const EditorField = (props) => {
|
|
|
6974
6964
|
const { label, optional, tooltip, children, width, ...fieldProps } = props;
|
|
6975
6965
|
const theme = ui.useTheme2();
|
|
6976
6966
|
const styles = getStyles$d(theme, width);
|
|
6977
|
-
const childInputId = (fieldProps == null ?
|
|
6967
|
+
const childInputId = (fieldProps == null ? void 0 : fieldProps.htmlFor) || ((_a = ui.ReactUtils) == null ? void 0 : _a.getChildId(children));
|
|
6978
6968
|
const labelEl = /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, /* @__PURE__ */ React__default.default.createElement("label", { className: styles.label, htmlFor: childInputId }, label, optional && /* @__PURE__ */ React__default.default.createElement("span", { className: styles.optional }, " - optional"), tooltip && /* @__PURE__ */ React__default.default.createElement(ui.Tooltip, { placement: "top", content: tooltip, theme: "info" }, /* @__PURE__ */ React__default.default.createElement(ui.Icon, { name: "info-circle", size: "sm", className: styles.icon }))), /* @__PURE__ */ React__default.default.createElement(Space, { v: 0.5 }));
|
|
6979
6969
|
return /* @__PURE__ */ React__default.default.createElement("div", { className: styles.root }, /* @__PURE__ */ React__default.default.createElement(ui.Field, { className: styles.field, label: labelEl, ...fieldProps }, children));
|
|
6980
6970
|
};
|
|
@@ -7117,7 +7107,7 @@ class SqlDatasource extends runtime.DataSourceWithBackend {
|
|
|
7117
7107
|
return this.getResponseParser().transformMetricFindResponse(response);
|
|
7118
7108
|
}
|
|
7119
7109
|
async runSql(query, options) {
|
|
7120
|
-
const frame = await this.runMetaQuery({ rawSql: query, format: QueryFormat.Table, refId: options == null ?
|
|
7110
|
+
const frame = await this.runMetaQuery({ rawSql: query, format: QueryFormat.Table, refId: options == null ? void 0 : options.refId }, options);
|
|
7121
7111
|
return new data.DataFrameView(frame);
|
|
7122
7112
|
}
|
|
7123
7113
|
runMetaQuery(request, options) {
|
|
@@ -7129,8 +7119,8 @@ class SqlDatasource extends runtime.DataSourceWithBackend {
|
|
|
7129
7119
|
url: "/api/ds/query",
|
|
7130
7120
|
method: "POST",
|
|
7131
7121
|
data: {
|
|
7132
|
-
from: (_a = options == null ?
|
|
7133
|
-
to: (_b = options == null ?
|
|
7122
|
+
from: (_a = options == null ? void 0 : options.range) == null ? void 0 : _a.from.valueOf().toString(),
|
|
7123
|
+
to: (_b = options == null ? void 0 : options.range) == null ? void 0 : _b.to.valueOf().toString(),
|
|
7134
7124
|
queries
|
|
7135
7125
|
},
|
|
7136
7126
|
requestId: refId
|
|
@@ -7173,7 +7163,7 @@ class SqlDatasource extends runtime.DataSourceWithBackend {
|
|
|
7173
7163
|
targetContainsTemplate(target) {
|
|
7174
7164
|
let queryWithoutMacros = target.rawSql;
|
|
7175
7165
|
MACRO_NAMES.forEach((value) => {
|
|
7176
|
-
queryWithoutMacros = (queryWithoutMacros == null ?
|
|
7166
|
+
queryWithoutMacros = (queryWithoutMacros == null ? void 0 : queryWithoutMacros.replace(value, "")) || "";
|
|
7177
7167
|
});
|
|
7178
7168
|
return this.templateSrv.containsTemplate(queryWithoutMacros);
|
|
7179
7169
|
}
|
|
@@ -7203,22 +7193,22 @@ function SqlQueryEditor({ datasource, query, onChange, onRunQuery, range }) {
|
|
|
7203
7193
|
const defaultDataset = datasource.dataset;
|
|
7204
7194
|
const { loading, error } = reactUse.useAsync(async () => {
|
|
7205
7195
|
return () => {
|
|
7206
|
-
if (datasource.getDB(datasource.id).init !==
|
|
7196
|
+
if (datasource.getDB(datasource.id).init !== void 0) {
|
|
7207
7197
|
datasource.getDB(datasource.id).init();
|
|
7208
7198
|
}
|
|
7209
7199
|
};
|
|
7210
7200
|
}, [datasource]);
|
|
7211
7201
|
const queryWithDefaults = applyQueryDefaults(query);
|
|
7212
7202
|
const [queryRowFilter, setQueryRowFilter] = React.useState({
|
|
7213
|
-
filter: !!((_a = queryWithDefaults.sql) == null ?
|
|
7214
|
-
group: !!((_d = (_c = (_b = queryWithDefaults.sql) == null ?
|
|
7215
|
-
order: !!((_f = (_e = queryWithDefaults.sql) == null ?
|
|
7203
|
+
filter: !!((_a = queryWithDefaults.sql) == null ? void 0 : _a.whereString),
|
|
7204
|
+
group: !!((_d = (_c = (_b = queryWithDefaults.sql) == null ? void 0 : _b.groupBy) == null ? void 0 : _c[0]) == null ? void 0 : _d.property.name),
|
|
7205
|
+
order: !!((_f = (_e = queryWithDefaults.sql) == null ? void 0 : _e.orderBy) == null ? void 0 : _f.property.name),
|
|
7216
7206
|
preview: true
|
|
7217
7207
|
});
|
|
7218
7208
|
const [queryToValidate, setQueryToValidate] = React.useState(queryWithDefaults);
|
|
7219
7209
|
React.useEffect(() => {
|
|
7220
7210
|
return () => {
|
|
7221
|
-
if (datasource.getDB(datasource.id).dispose !==
|
|
7211
|
+
if (datasource.getDB(datasource.id).dispose !== void 0) {
|
|
7222
7212
|
datasource.getDB(datasource.id).dispose();
|
|
7223
7213
|
}
|
|
7224
7214
|
};
|
|
@@ -7235,7 +7225,7 @@ function SqlQueryEditor({ datasource, query, onChange, onRunQuery, range }) {
|
|
|
7235
7225
|
var _a2, _b2;
|
|
7236
7226
|
setQueryToValidate(q);
|
|
7237
7227
|
onChange(q);
|
|
7238
|
-
if (haveColumns((_a2 = q.sql) == null ?
|
|
7228
|
+
if (haveColumns((_a2 = q.sql) == null ? void 0 : _a2.columns) && ((_b2 = q.sql) == null ? void 0 : _b2.columns.some((c) => c.name)) && !queryRowFilter.group) {
|
|
7239
7229
|
setQueryRowFilter({ ...queryRowFilter, group: true });
|
|
7240
7230
|
}
|
|
7241
7231
|
if (process) {
|
|
@@ -7265,7 +7255,7 @@ function SqlQueryEditor({ datasource, query, onChange, onRunQuery, range }) {
|
|
|
7265
7255
|
queryRowFilter,
|
|
7266
7256
|
query: queryWithDefaults,
|
|
7267
7257
|
isQueryRunnable,
|
|
7268
|
-
labels: (_g = datasource.getDB(datasource.id)) == null ?
|
|
7258
|
+
labels: (_g = datasource.getDB(datasource.id)) == null ? void 0 : _g.labels
|
|
7269
7259
|
}
|
|
7270
7260
|
), /* @__PURE__ */ React__default.default.createElement(Space, { v: 0.5 }), queryWithDefaults.editorMode !== EditorMode.Code && /* @__PURE__ */ React__default.default.createElement(
|
|
7271
7261
|
VisualEditor,
|
|
@@ -7585,7 +7575,7 @@ const AuthMethodSettings = ({
|
|
|
7585
7575
|
AuthMethod.BasicAuth,
|
|
7586
7576
|
AuthMethod.OAuthForward,
|
|
7587
7577
|
AuthMethod.NoAuth,
|
|
7588
|
-
...(_a2 = customMethods == null ?
|
|
7578
|
+
...(_a2 = customMethods == null ? void 0 : customMethods.map((m) => m.id)) != null ? _a2 : []
|
|
7589
7579
|
];
|
|
7590
7580
|
},
|
|
7591
7581
|
[customMethods, visibleMethodsFromProps]
|
|
@@ -7593,7 +7583,7 @@ const AuthMethodSettings = ({
|
|
|
7593
7583
|
const hasSelect = visibleMethods.length > 1;
|
|
7594
7584
|
const preparedOptions = React.useMemo(() => {
|
|
7595
7585
|
var _a2;
|
|
7596
|
-
const customOptions = (_a2 = customMethods == null ?
|
|
7586
|
+
const customOptions = (_a2 = customMethods == null ? void 0 : customMethods.reduce((acc, method) => {
|
|
7597
7587
|
acc[method.id] = {
|
|
7598
7588
|
label: method.label,
|
|
7599
7589
|
value: method.id,
|
|
@@ -7606,7 +7596,7 @@ const AuthMethodSettings = ({
|
|
|
7606
7596
|
for (k in defaultOptions) {
|
|
7607
7597
|
preparedDefaultOptions[k] = {
|
|
7608
7598
|
...defaultOptions[k],
|
|
7609
|
-
...defaultOptionsOverrides == null ?
|
|
7599
|
+
...defaultOptionsOverrides == null ? void 0 : defaultOptionsOverrides[k]
|
|
7610
7600
|
};
|
|
7611
7601
|
}
|
|
7612
7602
|
const allOptions = {
|
|
@@ -7634,7 +7624,7 @@ const AuthMethodSettings = ({
|
|
|
7634
7624
|
if (selected === AuthMethod.BasicAuth && basicAuth) {
|
|
7635
7625
|
AuthFieldsComponent = /* @__PURE__ */ React__default.default.createElement(BasicAuth, { ...basicAuth, readOnly });
|
|
7636
7626
|
} else if (selected.startsWith("custom-")) {
|
|
7637
|
-
AuthFieldsComponent = (_b = (_a = customMethods == null ?
|
|
7627
|
+
AuthFieldsComponent = (_b = (_a = customMethods == null ? void 0 : customMethods.find((m) => m.id === selected)) == null ? void 0 : _a.component) != null ? _b : null;
|
|
7638
7628
|
}
|
|
7639
7629
|
const title = hasSelect ? "Authentication methods" : (_c = preparedOptions[0].label) != null ? _c : "";
|
|
7640
7630
|
const description = hasSelect ? "Choose an authentication method to access the data source" : (_d = preparedOptions[0].description) != null ? _d : "";
|
|
@@ -7719,7 +7709,7 @@ const SelfSignedCertificate = ({
|
|
|
7719
7709
|
{
|
|
7720
7710
|
label: "CA Certificate",
|
|
7721
7711
|
labelWidth: 24,
|
|
7722
|
-
tooltip: (_a = tooltips == null ?
|
|
7712
|
+
tooltip: (_a = tooltips == null ? void 0 : tooltips.certificateLabel) != null ? _a : "Your self-signed certificate",
|
|
7723
7713
|
required: true,
|
|
7724
7714
|
htmlFor: "self-signed-certificate-input",
|
|
7725
7715
|
interactive: true,
|
|
@@ -7774,7 +7764,7 @@ const TLSClientAuth = ({
|
|
|
7774
7764
|
{
|
|
7775
7765
|
label: "ServerName",
|
|
7776
7766
|
labelWidth: 24,
|
|
7777
|
-
tooltip: (_a = tooltips == null ?
|
|
7767
|
+
tooltip: (_a = tooltips == null ? void 0 : tooltips.serverNameLabel) != null ? _a : "A Servername is used to verify the hostname on the returned certificate",
|
|
7778
7768
|
required: true,
|
|
7779
7769
|
htmlFor: "client-auth-servername-input",
|
|
7780
7770
|
interactive: true,
|
|
@@ -7798,7 +7788,7 @@ const TLSClientAuth = ({
|
|
|
7798
7788
|
{
|
|
7799
7789
|
label: "Client Certificate",
|
|
7800
7790
|
labelWidth: 24,
|
|
7801
|
-
tooltip: (_b = tooltips == null ?
|
|
7791
|
+
tooltip: (_b = tooltips == null ? void 0 : tooltips.certificateLabel) != null ? _b : "The client certificate can be generated from a Certificate Authority or be self-signed",
|
|
7802
7792
|
required: true,
|
|
7803
7793
|
htmlFor: "client-auth-client-certificate-input",
|
|
7804
7794
|
interactive: true,
|
|
@@ -7825,7 +7815,7 @@ const TLSClientAuth = ({
|
|
|
7825
7815
|
{
|
|
7826
7816
|
label: "Client Key",
|
|
7827
7817
|
labelWidth: 24,
|
|
7828
|
-
tooltip: (_c = tooltips == null ?
|
|
7818
|
+
tooltip: (_c = tooltips == null ? void 0 : tooltips.keyLabel) != null ? _c : "The client key can be generated from a Certificate Authority or be self-signed",
|
|
7829
7819
|
required: true,
|
|
7830
7820
|
htmlFor: "client-auth-client-key-input",
|
|
7831
7821
|
interactive: true,
|
|
@@ -7981,7 +7971,7 @@ const CustomHeaders = ({ headers: headersFromProps, onChange, readOnly }) => {
|
|
|
7981
7971
|
let changed = false;
|
|
7982
7972
|
const newHeaders = headers2.map((header) => {
|
|
7983
7973
|
var _a;
|
|
7984
|
-
const configured = (_a = headersFromProps.find((h) => h.name === header.name)) == null ?
|
|
7974
|
+
const configured = (_a = headersFromProps.find((h) => h.name === header.name)) == null ? void 0 : _a.configured;
|
|
7985
7975
|
if (typeof configured !== "undefined" && header.configured !== configured) {
|
|
7986
7976
|
changed = true;
|
|
7987
7977
|
return { ...header, configured };
|
|
@@ -8159,7 +8149,7 @@ function getTLSProps(config, onChange) {
|
|
|
8159
8149
|
return {
|
|
8160
8150
|
selfSignedCertificate: {
|
|
8161
8151
|
enabled: Boolean(config.jsonData.tlsAuthWithCACert),
|
|
8162
|
-
certificateConfigured: !!((_a = config.secureJsonFields) == null ?
|
|
8152
|
+
certificateConfigured: !!((_a = config.secureJsonFields) == null ? void 0 : _a.tlsCACert),
|
|
8163
8153
|
onToggle: (enabled) => enabled ? onChange({
|
|
8164
8154
|
...config,
|
|
8165
8155
|
jsonData: { ...config.jsonData, tlsAuthWithCACert: enabled }
|
|
@@ -8182,8 +8172,8 @@ function getTLSProps(config, onChange) {
|
|
|
8182
8172
|
TLSClientAuth: {
|
|
8183
8173
|
enabled: config.jsonData.tlsAuth,
|
|
8184
8174
|
serverName: config.jsonData.serverName,
|
|
8185
|
-
clientCertificateConfigured: !!((_b = config.secureJsonFields) == null ?
|
|
8186
|
-
clientKeyConfigured: !!((_c = config.secureJsonFields) == null ?
|
|
8175
|
+
clientCertificateConfigured: !!((_b = config.secureJsonFields) == null ? void 0 : _b.tlsClientCert),
|
|
8176
|
+
clientKeyConfigured: !!((_c = config.secureJsonFields) == null ? void 0 : _c.tlsClientKey),
|
|
8187
8177
|
onToggle: (enabled) => enabled ? onChange({
|
|
8188
8178
|
...config,
|
|
8189
8179
|
jsonData: { ...config.jsonData, tlsAuth: enabled }
|
|
@@ -8291,7 +8281,7 @@ const ConnectionSettings = ({
|
|
|
8291
8281
|
urlLabel,
|
|
8292
8282
|
className
|
|
8293
8283
|
}) => {
|
|
8294
|
-
const isValidUrl = config.url !==
|
|
8284
|
+
const isValidUrl = config.url !== void 0 && /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/.test(config.url);
|
|
8295
8285
|
const styles = {
|
|
8296
8286
|
container: css.css({
|
|
8297
8287
|
maxWidth: 578
|
|
@@ -8538,7 +8528,7 @@ class CustomHeadersSettings extends React.PureComponent {
|
|
|
8538
8528
|
return {
|
|
8539
8529
|
id: lodash.uniqueId(),
|
|
8540
8530
|
name: jsonData[key],
|
|
8541
|
-
value: secureJsonData !==
|
|
8531
|
+
value: secureJsonData !== void 0 ? secureJsonData[key] : "",
|
|
8542
8532
|
configured: secureJsonFields && secureJsonFields[`httpHeaderValue${index + 1}`] || false
|
|
8543
8533
|
};
|
|
8544
8534
|
})
|
|
@@ -8609,8 +8599,8 @@ class QueryModellerBase {
|
|
|
8609
8599
|
hasBinaryOp(query) {
|
|
8610
8600
|
return query.operations.find((op) => {
|
|
8611
8601
|
const def = this.getOperationDefinition(op.id);
|
|
8612
|
-
return (def == null ?
|
|
8613
|
-
}) !==
|
|
8602
|
+
return (def == null ? void 0 : def.category) === BINARY_OPERATIONS_KEY;
|
|
8603
|
+
}) !== void 0;
|
|
8614
8604
|
}
|
|
8615
8605
|
}
|
|
8616
8606
|
|
|
@@ -8633,7 +8623,7 @@ function LabelFilterItem({
|
|
|
8633
8623
|
const [labelValuesMenuOpen, setLabelValuesMenuOpen] = React.useState(false);
|
|
8634
8624
|
const isMultiSelect = (operator = item.op) => {
|
|
8635
8625
|
var _a2;
|
|
8636
|
-
return (_a2 = operators.find((op) => op.label === operator)) == null ?
|
|
8626
|
+
return (_a2 = operators.find((op) => op.label === operator)) == null ? void 0 : _a2.isMultiValue;
|
|
8637
8627
|
};
|
|
8638
8628
|
const getSelectOptionsFromString = (item2) => {
|
|
8639
8629
|
if (item2) {
|
|
@@ -8646,12 +8636,12 @@ function LabelFilterItem({
|
|
|
8646
8636
|
};
|
|
8647
8637
|
const getOptions = () => {
|
|
8648
8638
|
const labelValues = state.labelValues ? [...state.labelValues] : [];
|
|
8649
|
-
const selectedOptions = getSelectOptionsFromString(item == null ?
|
|
8639
|
+
const selectedOptions = getSelectOptionsFromString(item == null ? void 0 : item.value).map(data.toOption);
|
|
8650
8640
|
return lodash.uniqBy([...selectedOptions, ...labelValues], "value");
|
|
8651
8641
|
};
|
|
8652
8642
|
const isConflicting = isConflictingLabelFilter(item, items);
|
|
8653
8643
|
const { current: id } = React.useRef(uuid.v4());
|
|
8654
|
-
return /* @__PURE__ */ React__default.default.createElement("div", { "data-testid": "visual-query-builder-dimensions-filter-item" }, /* @__PURE__ */ React__default.default.createElement(ui.InlineField, { error: CONFLICTING_LABEL_FILTER_ERROR_MESSAGE, invalid: isConflicting ? true :
|
|
8644
|
+
return /* @__PURE__ */ React__default.default.createElement("div", { "data-testid": "visual-query-builder-dimensions-filter-item" }, /* @__PURE__ */ React__default.default.createElement(ui.InlineField, { error: CONFLICTING_LABEL_FILTER_ERROR_MESSAGE, invalid: isConflicting ? true : void 0 }, /* @__PURE__ */ React__default.default.createElement(InputGroup, null, /* @__PURE__ */ React__default.default.createElement(
|
|
8655
8645
|
ui.Select,
|
|
8656
8646
|
{
|
|
8657
8647
|
placeholder: "Select label",
|
|
@@ -8664,7 +8654,7 @@ function LabelFilterItem({
|
|
|
8664
8654
|
setState({ isLoadingLabelNames: true });
|
|
8665
8655
|
const labelNames = await onGetLabelNames(item);
|
|
8666
8656
|
setLabelNamesMenuOpen(true);
|
|
8667
|
-
setState({ labelNames, isLoadingLabelNames:
|
|
8657
|
+
setState({ labelNames, isLoadingLabelNames: void 0 });
|
|
8668
8658
|
},
|
|
8669
8659
|
onCloseMenu: () => {
|
|
8670
8660
|
setLabelNamesMenuOpen(false);
|
|
@@ -8696,7 +8686,7 @@ function LabelFilterItem({
|
|
|
8696
8686
|
onChange({
|
|
8697
8687
|
...item,
|
|
8698
8688
|
op: change.value,
|
|
8699
|
-
value: isMultiSelect(change.value) ? item.value : getSelectOptionsFromString(item == null ?
|
|
8689
|
+
value: isMultiSelect(change.value) ? item.value : getSelectOptionsFromString(item == null ? void 0 : item.value)[0]
|
|
8700
8690
|
});
|
|
8701
8691
|
}
|
|
8702
8692
|
},
|
|
@@ -8709,7 +8699,7 @@ function LabelFilterItem({
|
|
|
8709
8699
|
"data-testid": e2eSelectors.selectors.components.QueryBuilder.valueSelect,
|
|
8710
8700
|
inputId: `visual-query-builder-dimensions-filter-item-value-${id}`,
|
|
8711
8701
|
width: "auto",
|
|
8712
|
-
value: isMultiSelect() ? getSelectOptionsFromString(item == null ?
|
|
8702
|
+
value: isMultiSelect() ? getSelectOptionsFromString(item == null ? void 0 : item.value).map(data.toOption) : getSelectOptionsFromString(item == null ? void 0 : item.value).map(data.toOption)[0],
|
|
8713
8703
|
allowCustomValue: true,
|
|
8714
8704
|
onOpenMenu: async () => {
|
|
8715
8705
|
setState({ isLoadingLabelValues: true });
|
|
@@ -8717,7 +8707,7 @@ function LabelFilterItem({
|
|
|
8717
8707
|
setState({
|
|
8718
8708
|
...state,
|
|
8719
8709
|
labelValues,
|
|
8720
|
-
isLoadingLabelValues:
|
|
8710
|
+
isLoadingLabelValues: void 0
|
|
8721
8711
|
});
|
|
8722
8712
|
setLabelValuesMenuOpen(true);
|
|
8723
8713
|
},
|
|
@@ -8741,9 +8731,9 @@ function LabelFilterItem({
|
|
|
8741
8731
|
if (change2.value) {
|
|
8742
8732
|
return change2.value;
|
|
8743
8733
|
} else {
|
|
8744
|
-
return
|
|
8734
|
+
return void 0;
|
|
8745
8735
|
}
|
|
8746
|
-
}).filter((val) => val !==
|
|
8736
|
+
}).filter((val) => val !== void 0).join(multiValueSeparator);
|
|
8747
8737
|
onChange({ ...item, value: changes, op: (_b = item.op) != null ? _b : defaultOp });
|
|
8748
8738
|
}
|
|
8749
8739
|
},
|
|
@@ -8770,10 +8760,10 @@ function isConflictingLabelFilter(newLabel, labels) {
|
|
|
8770
8760
|
);
|
|
8771
8761
|
const conflict = candidates.some((candidate) => {
|
|
8772
8762
|
var _a, _b;
|
|
8773
|
-
if (operationIsNegative && ((_a = candidate == null ?
|
|
8763
|
+
if (operationIsNegative && ((_a = candidate == null ? void 0 : candidate.op) == null ? void 0 : _a.toString().startsWith("!")) === false) {
|
|
8774
8764
|
return true;
|
|
8775
8765
|
}
|
|
8776
|
-
if (operationIsNegative === false && ((_b = candidate == null ?
|
|
8766
|
+
if (operationIsNegative === false && ((_b = candidate == null ? void 0 : candidate.op) == null ? void 0 : _b.toString().startsWith("!"))) {
|
|
8777
8767
|
return true;
|
|
8778
8768
|
}
|
|
8779
8769
|
return false;
|
|
@@ -8802,7 +8792,7 @@ function LabelFilters({
|
|
|
8802
8792
|
const onLabelsChange = (newItems) => {
|
|
8803
8793
|
setItems(newItems);
|
|
8804
8794
|
const newLabels = newItems.filter(
|
|
8805
|
-
(item) => item.label !==
|
|
8795
|
+
(item) => item.label !== void 0 && item.value !== void 0
|
|
8806
8796
|
);
|
|
8807
8797
|
if (!lodash.isEqual(newLabels, labelsFilters)) {
|
|
8808
8798
|
onChange(newLabels);
|
|
@@ -8843,7 +8833,7 @@ function LabelFilters({
|
|
|
8843
8833
|
|
|
8844
8834
|
function OperationExplainedBox({ title, stepNumber, markdown, children }) {
|
|
8845
8835
|
const styles = ui.useStyles2(getStyles$b);
|
|
8846
|
-
return /* @__PURE__ */ React__default.default.createElement("div", { className: styles.box }, stepNumber !==
|
|
8836
|
+
return /* @__PURE__ */ React__default.default.createElement("div", { className: styles.box }, stepNumber !== void 0 && /* @__PURE__ */ React__default.default.createElement("div", { className: styles.stepNumber }, stepNumber), /* @__PURE__ */ React__default.default.createElement("div", { className: styles.boxInner }, title && /* @__PURE__ */ React__default.default.createElement("div", { className: styles.header }, /* @__PURE__ */ React__default.default.createElement("span", null, title)), /* @__PURE__ */ React__default.default.createElement("div", { className: styles.body }, markdown && /* @__PURE__ */ React__default.default.createElement("div", { dangerouslySetInnerHTML: { __html: data.renderMarkdown(markdown) } }), children)));
|
|
8847
8837
|
}
|
|
8848
8838
|
const getStyles$b = (theme) => {
|
|
8849
8839
|
return {
|
|
@@ -9086,7 +9076,7 @@ function SimpleInputParamEditor(props) {
|
|
|
9086
9076
|
ui.AutoSizeInput,
|
|
9087
9077
|
{
|
|
9088
9078
|
id: getOperationParamId(props.operationId, props.index),
|
|
9089
|
-
defaultValue: (_a = props.value) == null ?
|
|
9079
|
+
defaultValue: (_a = props.value) == null ? void 0 : _a.toString(),
|
|
9090
9080
|
minWidth: props.paramDef.minWidth,
|
|
9091
9081
|
placeholder: props.paramDef.placeholder,
|
|
9092
9082
|
title: props.paramDef.description,
|
|
@@ -9120,7 +9110,7 @@ function SelectInputParamEditor({
|
|
|
9120
9110
|
var _a, _b;
|
|
9121
9111
|
const styles = ui.useStyles2(getStyles$8);
|
|
9122
9112
|
let selectOptions = paramDef.options;
|
|
9123
|
-
if (!((_a = selectOptions[0]) == null ?
|
|
9113
|
+
if (!((_a = selectOptions[0]) == null ? void 0 : _a.label)) {
|
|
9124
9114
|
selectOptions = paramDef.options.map((option) => ({
|
|
9125
9115
|
label: option.toString(),
|
|
9126
9116
|
value: option
|
|
@@ -9425,9 +9415,9 @@ function OperationEditor({
|
|
|
9425
9415
|
}
|
|
9426
9416
|
const isInvalid = (isDragging) => {
|
|
9427
9417
|
if (isDragging) {
|
|
9428
|
-
return
|
|
9418
|
+
return void 0;
|
|
9429
9419
|
}
|
|
9430
|
-
return isConflicting ? true :
|
|
9420
|
+
return isConflicting ? true : void 0;
|
|
9431
9421
|
};
|
|
9432
9422
|
return /* @__PURE__ */ React__default.default.createElement(dnd.Draggable, { draggableId: `operation-${index}`, index }, (provided, snapshot) => /* @__PURE__ */ React__default.default.createElement(
|
|
9433
9423
|
ui.InlineField,
|
|
@@ -9581,7 +9571,7 @@ function useOperationsHighlight(operations) {
|
|
|
9581
9571
|
} else {
|
|
9582
9572
|
newOps = operations.map((op, index) => {
|
|
9583
9573
|
var _a;
|
|
9584
|
-
return !isSameOp(op.id, (_a = prevOperations[index]) == null ?
|
|
9574
|
+
return !isSameOp(op.id, (_a = prevOperations[index]) == null ? void 0 : _a.id);
|
|
9585
9575
|
});
|
|
9586
9576
|
}
|
|
9587
9577
|
return newOps;
|
|
@@ -9653,8 +9643,8 @@ function OperationListExplained({
|
|
|
9653
9643
|
"div",
|
|
9654
9644
|
{
|
|
9655
9645
|
key: index,
|
|
9656
|
-
onMouseEnter: () => onMouseEnter == null ?
|
|
9657
|
-
onMouseLeave: () => onMouseLeave == null ?
|
|
9646
|
+
onMouseEnter: () => onMouseEnter == null ? void 0 : onMouseEnter(op, index),
|
|
9647
|
+
onMouseLeave: () => onMouseLeave == null ? void 0 : onMouseLeave(op, index)
|
|
9658
9648
|
},
|
|
9659
9649
|
/* @__PURE__ */ React__default.default.createElement(
|
|
9660
9650
|
OperationExplainedBox,
|
|
@@ -9696,15 +9686,15 @@ const QueryBuilderHints = ({
|
|
|
9696
9686
|
const hints = React.useMemo(() => {
|
|
9697
9687
|
var _a;
|
|
9698
9688
|
const dataQuery = buildDataQueryFromQueryString(queryModeller.renderQuery(visualQuery));
|
|
9699
|
-
const hints2 = (_a = datasource.getQueryHints) == null ?
|
|
9689
|
+
const hints2 = (_a = datasource.getQueryHints) == null ? void 0 : _a.call(datasource, dataQuery, (data == null ? void 0 : data.series) || []).filter((hint) => {
|
|
9700
9690
|
var _a2;
|
|
9701
|
-
return (_a2 = hint.fix) == null ?
|
|
9691
|
+
return (_a2 = hint.fix) == null ? void 0 : _a2.action;
|
|
9702
9692
|
});
|
|
9703
9693
|
return hints2 != null ? hints2 : [];
|
|
9704
9694
|
}, [datasource, visualQuery, data, queryModeller, buildDataQueryFromQueryString]);
|
|
9705
9695
|
return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, hints.length > 0 && /* @__PURE__ */ React__default.default.createElement("div", { className: styles.container }, hints.map((hint) => {
|
|
9706
9696
|
var _a, _b, _c, _d;
|
|
9707
|
-
return /* @__PURE__ */ React__default.default.createElement(ui.Tooltip, { content: `${hint.label} ${(_a = hint.fix) == null ?
|
|
9697
|
+
return /* @__PURE__ */ React__default.default.createElement(ui.Tooltip, { content: `${hint.label} ${(_a = hint.fix) == null ? void 0 : _a.label}`, key: hint.type }, /* @__PURE__ */ React__default.default.createElement(
|
|
9708
9698
|
ui.Button,
|
|
9709
9699
|
{
|
|
9710
9700
|
onClick: () => {
|
|
@@ -9713,9 +9703,9 @@ const QueryBuilderHints = ({
|
|
|
9713
9703
|
hint: hint.type,
|
|
9714
9704
|
datasourceType: datasource.type
|
|
9715
9705
|
});
|
|
9716
|
-
if ((_a2 = hint == null ?
|
|
9706
|
+
if ((_a2 = hint == null ? void 0 : hint.fix) == null ? void 0 : _a2.action) {
|
|
9717
9707
|
const dataQuery = buildDataQueryFromQueryString(queryModeller.renderQuery(visualQuery));
|
|
9718
|
-
const newQuery = (_b2 = datasource.modifyQuery) == null ?
|
|
9708
|
+
const newQuery = (_b2 = datasource.modifyQuery) == null ? void 0 : _b2.call(datasource, dataQuery, hint.fix.action);
|
|
9719
9709
|
if (newQuery) {
|
|
9720
9710
|
const newVisualQuery = buildVisualQueryFromString(
|
|
9721
9711
|
(_c2 = buildQueryStringFromDataQuery(newQuery)) != null ? _c2 : ""
|
|
@@ -9729,7 +9719,7 @@ const QueryBuilderHints = ({
|
|
|
9729
9719
|
className: styles.hint
|
|
9730
9720
|
},
|
|
9731
9721
|
"hint: ",
|
|
9732
|
-
((_b = hint.fix) == null ?
|
|
9722
|
+
((_b = hint.fix) == null ? void 0 : _b.title) || ((_d = (_c = hint.fix) == null ? void 0 : _c.action) == null ? void 0 : _d.type.toLowerCase().replace("_", " "))
|
|
9733
9723
|
));
|
|
9734
9724
|
})));
|
|
9735
9725
|
};
|