@grafana/plugin-ui 0.13.1 → 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 +199 -200
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +1 -1
- 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 +2 -2
- 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 -2
- 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 -3
- 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 -5
- package/dist/esm/components/VisualQueryBuilder/components/OperationParamEditor.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/OperationsEditorRow.js +2 -2
- 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 -2
- package/dist/esm/components/VisualQueryBuilder/components/QueryHeaderSwitch.js.map +1 -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 +1 -1
- 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 +10 -26
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
|
};
|
|
@@ -5747,7 +5747,7 @@ function ConfirmModal({ isOpen, onCancel, onDiscard, onCopy }) {
|
|
|
5747
5747
|
React.useEffect(() => {
|
|
5748
5748
|
var _a;
|
|
5749
5749
|
if (isOpen) {
|
|
5750
|
-
(_a = buttonRef.current) == null ?
|
|
5750
|
+
(_a = buttonRef.current) == null ? void 0 : _a.focus();
|
|
5751
5751
|
}
|
|
5752
5752
|
}, [isOpen]);
|
|
5753
5753
|
return /* @__PURE__ */ React__default.default.createElement(
|
|
@@ -5793,7 +5793,7 @@ const DatasetSelector = ({
|
|
|
5793
5793
|
onChange(state.value[0]);
|
|
5794
5794
|
}
|
|
5795
5795
|
} else {
|
|
5796
|
-
if (state.value && state.value.find((v) => v.value === value) ===
|
|
5796
|
+
if (state.value && state.value.find((v) => v.value === value) === void 0) {
|
|
5797
5797
|
if (state.value.length > 0) {
|
|
5798
5798
|
onChange(state.value[0]);
|
|
5799
5799
|
}
|
|
@@ -5844,7 +5844,7 @@ const CatalogSelector = ({ db, inputId, value, onChange }) => {
|
|
|
5844
5844
|
loadCatalogs();
|
|
5845
5845
|
}, [db, loadCatalogs]);
|
|
5846
5846
|
const handleChange = (selectable) => {
|
|
5847
|
-
onChange((selectable == null ?
|
|
5847
|
+
onChange((selectable == null ? void 0 : selectable.value) || null);
|
|
5848
5848
|
};
|
|
5849
5849
|
const selectedValue = catalogs.find((catalog) => catalog.value === value) || null;
|
|
5850
5850
|
return /* @__PURE__ */ React__default.default.createElement(
|
|
@@ -5908,7 +5908,7 @@ const RunQueryButton = ({
|
|
|
5908
5908
|
onClick,
|
|
5909
5909
|
dataTestId
|
|
5910
5910
|
}) => {
|
|
5911
|
-
let icon = queryInvalid ? "exclamation-triangle" :
|
|
5911
|
+
let icon = queryInvalid ? "exclamation-triangle" : void 0;
|
|
5912
5912
|
if (queryRunning) {
|
|
5913
5913
|
icon = "fa fa-spinner";
|
|
5914
5914
|
}
|
|
@@ -5971,35 +5971,35 @@ function QueryHeader({
|
|
|
5971
5971
|
[editorMode, onChange, query]
|
|
5972
5972
|
);
|
|
5973
5973
|
const onFormatChange = (e) => {
|
|
5974
|
-
const next = { ...query, format: e.value !==
|
|
5974
|
+
const next = { ...query, format: e.value !== void 0 ? e.value : QueryFormat.Table };
|
|
5975
5975
|
onChange(next);
|
|
5976
5976
|
};
|
|
5977
5977
|
const onDatasetChange = (e) => {
|
|
5978
|
-
const datasetValue = e.value ||
|
|
5978
|
+
const datasetValue = e.value || void 0;
|
|
5979
5979
|
if (datasetValue === query.dataset) {
|
|
5980
5980
|
return;
|
|
5981
5981
|
}
|
|
5982
5982
|
const next = {
|
|
5983
5983
|
...query,
|
|
5984
5984
|
dataset: datasetValue,
|
|
5985
|
-
table:
|
|
5986
|
-
sql:
|
|
5985
|
+
table: void 0,
|
|
5986
|
+
sql: void 0,
|
|
5987
5987
|
rawSql: ""
|
|
5988
5988
|
};
|
|
5989
5989
|
onChange(next);
|
|
5990
5990
|
};
|
|
5991
5991
|
const onCatalogChange = (catalog) => {
|
|
5992
|
-
const catalogValue = catalog ||
|
|
5992
|
+
const catalogValue = catalog || void 0;
|
|
5993
5993
|
if (catalogValue === query.catalog) {
|
|
5994
5994
|
return;
|
|
5995
5995
|
}
|
|
5996
5996
|
const next = {
|
|
5997
5997
|
...query,
|
|
5998
5998
|
catalog: catalogValue,
|
|
5999
|
-
dataset:
|
|
5999
|
+
dataset: void 0,
|
|
6000
6000
|
// Reset dataset (which acts as schema when catalog is present)
|
|
6001
|
-
table:
|
|
6002
|
-
sql:
|
|
6001
|
+
table: void 0,
|
|
6002
|
+
sql: void 0,
|
|
6003
6003
|
rawSql: ""
|
|
6004
6004
|
};
|
|
6005
6005
|
onChange(next);
|
|
@@ -6011,7 +6011,7 @@ function QueryHeader({
|
|
|
6011
6011
|
const next = {
|
|
6012
6012
|
...query,
|
|
6013
6013
|
table: e.value,
|
|
6014
|
-
sql:
|
|
6014
|
+
sql: void 0,
|
|
6015
6015
|
rawSql: ""
|
|
6016
6016
|
};
|
|
6017
6017
|
onChange(next);
|
|
@@ -6094,7 +6094,7 @@ function QueryHeader({
|
|
|
6094
6094
|
{
|
|
6095
6095
|
db,
|
|
6096
6096
|
inputId: `sql-catalog-${htmlId}`,
|
|
6097
|
-
value: query.catalog ===
|
|
6097
|
+
value: query.catalog === void 0 ? null : query.catalog,
|
|
6098
6098
|
onChange: onCatalogChange
|
|
6099
6099
|
}
|
|
6100
6100
|
)), effectiveEnableDatasets && /* @__PURE__ */ React__default.default.createElement(
|
|
@@ -6109,10 +6109,10 @@ function QueryHeader({
|
|
|
6109
6109
|
db,
|
|
6110
6110
|
inputId: catalogsEnabled ? `sql-schema-${htmlId}` : `sql-dataset-${htmlId}`,
|
|
6111
6111
|
"data-testid": catalogsEnabled ? "schema-selector" : "dataset-selector",
|
|
6112
|
-
dataset: catalogsEnabled ?
|
|
6113
|
-
value: query.dataset ===
|
|
6112
|
+
dataset: catalogsEnabled ? void 0 : defaultDataset,
|
|
6113
|
+
value: query.dataset === void 0 ? null : query.dataset,
|
|
6114
6114
|
onChange: onDatasetChange,
|
|
6115
|
-
catalog: catalogsEnabled ? query.catalog :
|
|
6115
|
+
catalog: catalogsEnabled ? query.catalog : void 0
|
|
6116
6116
|
}
|
|
6117
6117
|
)
|
|
6118
6118
|
), /* @__PURE__ */ React__default.default.createElement(EditorField$1, { label: labels.get("table") || "Table", width: 25 }, /* @__PURE__ */ React__default.default.createElement(
|
|
@@ -6120,10 +6120,10 @@ function QueryHeader({
|
|
|
6120
6120
|
{
|
|
6121
6121
|
db,
|
|
6122
6122
|
inputId: `sql-table-${htmlId}`,
|
|
6123
|
-
dataset: query.dataset || (catalogsEnabled ?
|
|
6124
|
-
catalog: catalogsEnabled ? query.catalog :
|
|
6123
|
+
dataset: query.dataset || (catalogsEnabled ? void 0 : defaultDataset),
|
|
6124
|
+
catalog: catalogsEnabled ? query.catalog : void 0,
|
|
6125
6125
|
query,
|
|
6126
|
-
value: query.table ===
|
|
6126
|
+
value: query.table === void 0 ? null : query.table,
|
|
6127
6127
|
onChange: onTableChange,
|
|
6128
6128
|
enableCatalogs: catalogsEnabled,
|
|
6129
6129
|
applyDefault: true
|
|
@@ -6189,7 +6189,7 @@ function QueryValidator({ db, query, onValidate, range }) {
|
|
|
6189
6189
|
const [state, validateQuery] = reactUse.useAsyncFn(
|
|
6190
6190
|
async (q) => {
|
|
6191
6191
|
var _a2;
|
|
6192
|
-
if (((_a2 = q.rawSql) == null ?
|
|
6192
|
+
if (((_a2 = q.rawSql) == null ? void 0 : _a2.trim()) === "") {
|
|
6193
6193
|
return null;
|
|
6194
6194
|
}
|
|
6195
6195
|
return await db.validateQuery(q, range);
|
|
@@ -6208,17 +6208,17 @@ function QueryValidator({ db, query, onValidate, range }) {
|
|
|
6208
6208
|
[query, validateQuery]
|
|
6209
6209
|
);
|
|
6210
6210
|
React.useEffect(() => {
|
|
6211
|
-
if (validationResult == null ?
|
|
6211
|
+
if (validationResult == null ? void 0 : validationResult.isError) {
|
|
6212
6212
|
onValidate(false);
|
|
6213
6213
|
}
|
|
6214
|
-
if (validationResult == null ?
|
|
6214
|
+
if (validationResult == null ? void 0 : validationResult.isValid) {
|
|
6215
6215
|
onValidate(true);
|
|
6216
6216
|
}
|
|
6217
6217
|
}, [validationResult, onValidate]);
|
|
6218
6218
|
if (!state.value && !state.loading) {
|
|
6219
6219
|
return null;
|
|
6220
6220
|
}
|
|
6221
|
-
const error = ((_a = state.value) == null ?
|
|
6221
|
+
const error = ((_a = state.value) == null ? void 0 : _a.error) ? processErrorMessage(state.value.error) : "";
|
|
6222
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))));
|
|
6223
6223
|
}
|
|
6224
6224
|
function processErrorMessage(error) {
|
|
@@ -6262,7 +6262,7 @@ function QueryToolbox({ showTools, onFormatCode, onExpand, isExpanded, ...valida
|
|
|
6262
6262
|
};
|
|
6263
6263
|
}, [theme]);
|
|
6264
6264
|
let style = {};
|
|
6265
|
-
if (!showTools && validationResult ===
|
|
6265
|
+
if (!showTools && validationResult === void 0) {
|
|
6266
6266
|
style = { height: 0, padding: 0, visibility: "hidden" };
|
|
6267
6267
|
}
|
|
6268
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(
|
|
@@ -6299,7 +6299,7 @@ function RawEditor({ db, query, onChange, onRunQuery, onValidate, queryToValidat
|
|
|
6299
6299
|
completionProvider,
|
|
6300
6300
|
query,
|
|
6301
6301
|
width,
|
|
6302
|
-
height: height ? height - toolboxMeasure.height :
|
|
6302
|
+
height: height ? height - toolboxMeasure.height : void 0,
|
|
6303
6303
|
onChange
|
|
6304
6304
|
},
|
|
6305
6305
|
({ formatQuery }) => {
|
|
@@ -6446,9 +6446,9 @@ function OrderByRow({ sql, onSqlChange, columns, showOffset }) {
|
|
|
6446
6446
|
);
|
|
6447
6447
|
const onOrderByChange = React.useCallback(
|
|
6448
6448
|
(item) => {
|
|
6449
|
-
const newSql = { ...sql, orderBy: setPropertyField(item == null ?
|
|
6449
|
+
const newSql = { ...sql, orderBy: setPropertyField(item == null ? void 0 : item.value) };
|
|
6450
6450
|
if (item === null) {
|
|
6451
|
-
newSql.orderByDirection =
|
|
6451
|
+
newSql.orderByDirection = void 0;
|
|
6452
6452
|
}
|
|
6453
6453
|
onSqlChange(newSql);
|
|
6454
6454
|
},
|
|
@@ -6459,7 +6459,7 @@ function OrderByRow({ sql, onSqlChange, columns, showOffset }) {
|
|
|
6459
6459
|
{
|
|
6460
6460
|
"aria-label": "Order by",
|
|
6461
6461
|
options: columns,
|
|
6462
|
-
value: ((_a = sql.orderBy) == null ?
|
|
6462
|
+
value: ((_a = sql.orderBy) == null ? void 0 : _a.property.name) ? data.toOption(sql.orderBy.property.name) : null,
|
|
6463
6463
|
isClearable: true,
|
|
6464
6464
|
menuShouldPortal: true,
|
|
6465
6465
|
onChange: onOrderByChange
|
|
@@ -6468,7 +6468,7 @@ function OrderByRow({ sql, onSqlChange, columns, showOffset }) {
|
|
|
6468
6468
|
ui.RadioButtonGroup,
|
|
6469
6469
|
{
|
|
6470
6470
|
options: sortOrderOptions,
|
|
6471
|
-
disabled: !((_b = sql == null ?
|
|
6471
|
+
disabled: !((_b = sql == null ? void 0 : sql.orderBy) == null ? void 0 : _b.property.name),
|
|
6472
6472
|
value: sql.orderByDirection,
|
|
6473
6473
|
onChange: onSortOrderChange
|
|
6474
6474
|
}
|
|
@@ -6480,9 +6480,9 @@ function SQLOrderByRow({ fields, query, onQueryChange, db }) {
|
|
|
6480
6480
|
const { onSqlChange } = useSqlChange({ query, onQueryChange, db });
|
|
6481
6481
|
let columnsWithIndices = [];
|
|
6482
6482
|
if (fields) {
|
|
6483
|
-
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) => {
|
|
6484
6484
|
var _a2, _b2;
|
|
6485
|
-
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);
|
|
6486
6486
|
return {
|
|
6487
6487
|
value,
|
|
6488
6488
|
label: `${i + 1} - ${value}`
|
|
@@ -6510,7 +6510,7 @@ function SelectRow({ sql, columns, onSqlChange, functions }) {
|
|
|
6510
6510
|
(item, index) => (column) => {
|
|
6511
6511
|
var _a2, _b;
|
|
6512
6512
|
let modifiedItem = { ...item };
|
|
6513
|
-
if (!((_a2 = item.parameters) == null ?
|
|
6513
|
+
if (!((_a2 = item.parameters) == null ? void 0 : _a2.length)) {
|
|
6514
6514
|
modifiedItem.parameters = [{ type: QueryEditorExpressionType.FunctionParameter, name: column.value }];
|
|
6515
6515
|
} else {
|
|
6516
6516
|
modifiedItem.parameters = item.parameters.map(
|
|
@@ -6519,7 +6519,7 @@ function SelectRow({ sql, columns, onSqlChange, functions }) {
|
|
|
6519
6519
|
}
|
|
6520
6520
|
const newSql = {
|
|
6521
6521
|
...sql,
|
|
6522
|
-
columns: (_b = sql.columns) == null ?
|
|
6522
|
+
columns: (_b = sql.columns) == null ? void 0 : _b.map((c, i) => i === index ? modifiedItem : c)
|
|
6523
6523
|
};
|
|
6524
6524
|
onSqlChange(newSql);
|
|
6525
6525
|
},
|
|
@@ -6530,11 +6530,11 @@ function SelectRow({ sql, columns, onSqlChange, functions }) {
|
|
|
6530
6530
|
var _a2;
|
|
6531
6531
|
const newItem = {
|
|
6532
6532
|
...item,
|
|
6533
|
-
name: aggregation == null ?
|
|
6533
|
+
name: aggregation == null ? void 0 : aggregation.value
|
|
6534
6534
|
};
|
|
6535
6535
|
const newSql = {
|
|
6536
6536
|
...sql,
|
|
6537
|
-
columns: (_a2 = sql.columns) == null ?
|
|
6537
|
+
columns: (_a2 = sql.columns) == null ? void 0 : _a2.map((c, i) => i === index ? newItem : c)
|
|
6538
6538
|
};
|
|
6539
6539
|
onSqlChange(newSql);
|
|
6540
6540
|
},
|
|
@@ -6556,7 +6556,7 @@ function SelectRow({ sql, columns, onSqlChange, functions }) {
|
|
|
6556
6556
|
const newSql = { ...sql, columns: [...sql.columns, createFunctionField()] };
|
|
6557
6557
|
onSqlChange(newSql);
|
|
6558
6558
|
}, [onSqlChange, sql]);
|
|
6559
|
-
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(
|
|
6560
6560
|
ui.Select,
|
|
6561
6561
|
{
|
|
6562
6562
|
value: getColumnValue(item),
|
|
@@ -6604,8 +6604,8 @@ const getStyles$f = () => {
|
|
|
6604
6604
|
return { addButton: css.css({ alignSelf: "flex-start" }) };
|
|
6605
6605
|
};
|
|
6606
6606
|
function getColumnValue({ parameters }) {
|
|
6607
|
-
const column = parameters == null ?
|
|
6608
|
-
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) {
|
|
6609
6609
|
return data.toOption(column.name);
|
|
6610
6610
|
}
|
|
6611
6611
|
return null;
|
|
@@ -6626,7 +6626,6 @@ const buttonLabels = {
|
|
|
6626
6626
|
};
|
|
6627
6627
|
({
|
|
6628
6628
|
id: ui$1.Utils.uuid(),
|
|
6629
|
-
type: "group",
|
|
6630
6629
|
children1: [
|
|
6631
6630
|
{
|
|
6632
6631
|
id: ui$1.Utils.uuid(),
|
|
@@ -6664,9 +6663,9 @@ const widgets = {
|
|
|
6664
6663
|
return /* @__PURE__ */ React__default.default.createElement(
|
|
6665
6664
|
ui.Input,
|
|
6666
6665
|
{
|
|
6667
|
-
value: (props == null ?
|
|
6668
|
-
placeholder: props == null ?
|
|
6669
|
-
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)
|
|
6670
6669
|
}
|
|
6671
6670
|
);
|
|
6672
6671
|
}
|
|
@@ -6677,10 +6676,10 @@ const widgets = {
|
|
|
6677
6676
|
return /* @__PURE__ */ React__default.default.createElement(
|
|
6678
6677
|
ui.Input,
|
|
6679
6678
|
{
|
|
6680
|
-
value: props == null ?
|
|
6681
|
-
placeholder: props == null ?
|
|
6679
|
+
value: props == null ? void 0 : props.value,
|
|
6680
|
+
placeholder: props == null ? void 0 : props.placeholder,
|
|
6682
6681
|
type: "number",
|
|
6683
|
-
onChange: (e) => props == null ?
|
|
6682
|
+
onChange: (e) => props == null ? void 0 : props.setValue(Number.parseInt(e.currentTarget.value, 10))
|
|
6684
6683
|
}
|
|
6685
6684
|
);
|
|
6686
6685
|
}
|
|
@@ -6692,9 +6691,9 @@ const widgets = {
|
|
|
6692
6691
|
ui.DateTimePicker,
|
|
6693
6692
|
{
|
|
6694
6693
|
onChange: (e) => {
|
|
6695
|
-
props == null ?
|
|
6694
|
+
props == null ? void 0 : props.setValue(e == null ? void 0 : e.format(ui$1.BasicConfig.widgets.datetime.valueFormat));
|
|
6696
6695
|
},
|
|
6697
|
-
date: data.dateTime(props == null ?
|
|
6696
|
+
date: data.dateTime(props == null ? void 0 : props.value).utc()
|
|
6698
6697
|
}
|
|
6699
6698
|
);
|
|
6700
6699
|
}
|
|
@@ -6712,37 +6711,37 @@ const settings = {
|
|
|
6712
6711
|
return /* @__PURE__ */ React__default.default.createElement(
|
|
6713
6712
|
ui.Select,
|
|
6714
6713
|
{
|
|
6715
|
-
id: conjProps == null ?
|
|
6714
|
+
id: conjProps == null ? void 0 : conjProps.id,
|
|
6716
6715
|
"aria-label": "Conjunction",
|
|
6717
6716
|
menuShouldPortal: true,
|
|
6718
|
-
options: (conjProps == null ?
|
|
6719
|
-
value: conjProps == null ?
|
|
6720
|
-
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)
|
|
6721
6720
|
}
|
|
6722
6721
|
);
|
|
6723
6722
|
},
|
|
6724
6723
|
renderField: function Field(fieldProps) {
|
|
6725
6724
|
var _a;
|
|
6726
|
-
const fields = ((_a = fieldProps == null ?
|
|
6725
|
+
const fields = ((_a = fieldProps == null ? void 0 : fieldProps.config) == null ? void 0 : _a.fields) || {};
|
|
6727
6726
|
return /* @__PURE__ */ React__default.default.createElement(
|
|
6728
6727
|
ui.Select,
|
|
6729
6728
|
{
|
|
6730
|
-
id: fieldProps == null ?
|
|
6729
|
+
id: fieldProps == null ? void 0 : fieldProps.id,
|
|
6731
6730
|
width: 25,
|
|
6732
6731
|
"aria-label": "Field",
|
|
6733
6732
|
menuShouldPortal: true,
|
|
6734
|
-
options: fieldProps == null ?
|
|
6733
|
+
options: fieldProps == null ? void 0 : fieldProps.items.map((f) => {
|
|
6735
6734
|
var _a2, _b;
|
|
6736
|
-
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;
|
|
6737
6736
|
return {
|
|
6738
6737
|
label: f.label,
|
|
6739
6738
|
value: f.key,
|
|
6740
6739
|
icon
|
|
6741
6740
|
};
|
|
6742
6741
|
}),
|
|
6743
|
-
value: fieldProps == null ?
|
|
6742
|
+
value: fieldProps == null ? void 0 : fieldProps.selectedKey,
|
|
6744
6743
|
onChange: (val) => {
|
|
6745
|
-
fieldProps == null ?
|
|
6744
|
+
fieldProps == null ? void 0 : fieldProps.setField(val.label);
|
|
6746
6745
|
}
|
|
6747
6746
|
}
|
|
6748
6747
|
);
|
|
@@ -6752,11 +6751,11 @@ const settings = {
|
|
|
6752
6751
|
ui.Button,
|
|
6753
6752
|
{
|
|
6754
6753
|
type: "button",
|
|
6755
|
-
title: `${buttonProps == null ?
|
|
6756
|
-
onClick: buttonProps == null ?
|
|
6754
|
+
title: `${buttonProps == null ? void 0 : buttonProps.label} filter`,
|
|
6755
|
+
onClick: buttonProps == null ? void 0 : buttonProps.onClick,
|
|
6757
6756
|
variant: "secondary",
|
|
6758
6757
|
size: "md",
|
|
6759
|
-
icon: (buttonProps == null ?
|
|
6758
|
+
icon: (buttonProps == null ? void 0 : buttonProps.label) === buttonLabels.add ? "plus" : "times"
|
|
6760
6759
|
}
|
|
6761
6760
|
);
|
|
6762
6761
|
},
|
|
@@ -6764,12 +6763,12 @@ const settings = {
|
|
|
6764
6763
|
return /* @__PURE__ */ React__default.default.createElement(
|
|
6765
6764
|
ui.Select,
|
|
6766
6765
|
{
|
|
6767
|
-
options: operatorProps == null ?
|
|
6766
|
+
options: operatorProps == null ? void 0 : operatorProps.items.map((op) => ({ label: op.label, value: op.key })),
|
|
6768
6767
|
"aria-label": "Operator",
|
|
6769
6768
|
menuShouldPortal: true,
|
|
6770
|
-
value: operatorProps == null ?
|
|
6769
|
+
value: operatorProps == null ? void 0 : operatorProps.selectedKey,
|
|
6771
6770
|
onChange: (val) => {
|
|
6772
|
-
operatorProps == null ?
|
|
6771
|
+
operatorProps == null ? void 0 : operatorProps.setField(val.value || "");
|
|
6773
6772
|
}
|
|
6774
6773
|
}
|
|
6775
6774
|
);
|
|
@@ -6965,7 +6964,7 @@ const EditorField = (props) => {
|
|
|
6965
6964
|
const { label, optional, tooltip, children, width, ...fieldProps } = props;
|
|
6966
6965
|
const theme = ui.useTheme2();
|
|
6967
6966
|
const styles = getStyles$d(theme, width);
|
|
6968
|
-
const childInputId = (fieldProps == null ?
|
|
6967
|
+
const childInputId = (fieldProps == null ? void 0 : fieldProps.htmlFor) || ((_a = ui.ReactUtils) == null ? void 0 : _a.getChildId(children));
|
|
6969
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 }));
|
|
6970
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));
|
|
6971
6970
|
};
|
|
@@ -7108,7 +7107,7 @@ class SqlDatasource extends runtime.DataSourceWithBackend {
|
|
|
7108
7107
|
return this.getResponseParser().transformMetricFindResponse(response);
|
|
7109
7108
|
}
|
|
7110
7109
|
async runSql(query, options) {
|
|
7111
|
-
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);
|
|
7112
7111
|
return new data.DataFrameView(frame);
|
|
7113
7112
|
}
|
|
7114
7113
|
runMetaQuery(request, options) {
|
|
@@ -7120,8 +7119,8 @@ class SqlDatasource extends runtime.DataSourceWithBackend {
|
|
|
7120
7119
|
url: "/api/ds/query",
|
|
7121
7120
|
method: "POST",
|
|
7122
7121
|
data: {
|
|
7123
|
-
from: (_a = options == null ?
|
|
7124
|
-
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(),
|
|
7125
7124
|
queries
|
|
7126
7125
|
},
|
|
7127
7126
|
requestId: refId
|
|
@@ -7164,7 +7163,7 @@ class SqlDatasource extends runtime.DataSourceWithBackend {
|
|
|
7164
7163
|
targetContainsTemplate(target) {
|
|
7165
7164
|
let queryWithoutMacros = target.rawSql;
|
|
7166
7165
|
MACRO_NAMES.forEach((value) => {
|
|
7167
|
-
queryWithoutMacros = (queryWithoutMacros == null ?
|
|
7166
|
+
queryWithoutMacros = (queryWithoutMacros == null ? void 0 : queryWithoutMacros.replace(value, "")) || "";
|
|
7168
7167
|
});
|
|
7169
7168
|
return this.templateSrv.containsTemplate(queryWithoutMacros);
|
|
7170
7169
|
}
|
|
@@ -7194,22 +7193,22 @@ function SqlQueryEditor({ datasource, query, onChange, onRunQuery, range }) {
|
|
|
7194
7193
|
const defaultDataset = datasource.dataset;
|
|
7195
7194
|
const { loading, error } = reactUse.useAsync(async () => {
|
|
7196
7195
|
return () => {
|
|
7197
|
-
if (datasource.getDB(datasource.id).init !==
|
|
7196
|
+
if (datasource.getDB(datasource.id).init !== void 0) {
|
|
7198
7197
|
datasource.getDB(datasource.id).init();
|
|
7199
7198
|
}
|
|
7200
7199
|
};
|
|
7201
7200
|
}, [datasource]);
|
|
7202
7201
|
const queryWithDefaults = applyQueryDefaults(query);
|
|
7203
7202
|
const [queryRowFilter, setQueryRowFilter] = React.useState({
|
|
7204
|
-
filter: !!((_a = queryWithDefaults.sql) == null ?
|
|
7205
|
-
group: !!((_d = (_c = (_b = queryWithDefaults.sql) == null ?
|
|
7206
|
-
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),
|
|
7207
7206
|
preview: true
|
|
7208
7207
|
});
|
|
7209
7208
|
const [queryToValidate, setQueryToValidate] = React.useState(queryWithDefaults);
|
|
7210
7209
|
React.useEffect(() => {
|
|
7211
7210
|
return () => {
|
|
7212
|
-
if (datasource.getDB(datasource.id).dispose !==
|
|
7211
|
+
if (datasource.getDB(datasource.id).dispose !== void 0) {
|
|
7213
7212
|
datasource.getDB(datasource.id).dispose();
|
|
7214
7213
|
}
|
|
7215
7214
|
};
|
|
@@ -7226,7 +7225,7 @@ function SqlQueryEditor({ datasource, query, onChange, onRunQuery, range }) {
|
|
|
7226
7225
|
var _a2, _b2;
|
|
7227
7226
|
setQueryToValidate(q);
|
|
7228
7227
|
onChange(q);
|
|
7229
|
-
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) {
|
|
7230
7229
|
setQueryRowFilter({ ...queryRowFilter, group: true });
|
|
7231
7230
|
}
|
|
7232
7231
|
if (process) {
|
|
@@ -7256,7 +7255,7 @@ function SqlQueryEditor({ datasource, query, onChange, onRunQuery, range }) {
|
|
|
7256
7255
|
queryRowFilter,
|
|
7257
7256
|
query: queryWithDefaults,
|
|
7258
7257
|
isQueryRunnable,
|
|
7259
|
-
labels: (_g = datasource.getDB(datasource.id)) == null ?
|
|
7258
|
+
labels: (_g = datasource.getDB(datasource.id)) == null ? void 0 : _g.labels
|
|
7260
7259
|
}
|
|
7261
7260
|
), /* @__PURE__ */ React__default.default.createElement(Space, { v: 0.5 }), queryWithDefaults.editorMode !== EditorMode.Code && /* @__PURE__ */ React__default.default.createElement(
|
|
7262
7261
|
VisualEditor,
|
|
@@ -7576,7 +7575,7 @@ const AuthMethodSettings = ({
|
|
|
7576
7575
|
AuthMethod.BasicAuth,
|
|
7577
7576
|
AuthMethod.OAuthForward,
|
|
7578
7577
|
AuthMethod.NoAuth,
|
|
7579
|
-
...(_a2 = customMethods == null ?
|
|
7578
|
+
...(_a2 = customMethods == null ? void 0 : customMethods.map((m) => m.id)) != null ? _a2 : []
|
|
7580
7579
|
];
|
|
7581
7580
|
},
|
|
7582
7581
|
[customMethods, visibleMethodsFromProps]
|
|
@@ -7584,7 +7583,7 @@ const AuthMethodSettings = ({
|
|
|
7584
7583
|
const hasSelect = visibleMethods.length > 1;
|
|
7585
7584
|
const preparedOptions = React.useMemo(() => {
|
|
7586
7585
|
var _a2;
|
|
7587
|
-
const customOptions = (_a2 = customMethods == null ?
|
|
7586
|
+
const customOptions = (_a2 = customMethods == null ? void 0 : customMethods.reduce((acc, method) => {
|
|
7588
7587
|
acc[method.id] = {
|
|
7589
7588
|
label: method.label,
|
|
7590
7589
|
value: method.id,
|
|
@@ -7597,7 +7596,7 @@ const AuthMethodSettings = ({
|
|
|
7597
7596
|
for (k in defaultOptions) {
|
|
7598
7597
|
preparedDefaultOptions[k] = {
|
|
7599
7598
|
...defaultOptions[k],
|
|
7600
|
-
...defaultOptionsOverrides == null ?
|
|
7599
|
+
...defaultOptionsOverrides == null ? void 0 : defaultOptionsOverrides[k]
|
|
7601
7600
|
};
|
|
7602
7601
|
}
|
|
7603
7602
|
const allOptions = {
|
|
@@ -7625,7 +7624,7 @@ const AuthMethodSettings = ({
|
|
|
7625
7624
|
if (selected === AuthMethod.BasicAuth && basicAuth) {
|
|
7626
7625
|
AuthFieldsComponent = /* @__PURE__ */ React__default.default.createElement(BasicAuth, { ...basicAuth, readOnly });
|
|
7627
7626
|
} else if (selected.startsWith("custom-")) {
|
|
7628
|
-
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;
|
|
7629
7628
|
}
|
|
7630
7629
|
const title = hasSelect ? "Authentication methods" : (_c = preparedOptions[0].label) != null ? _c : "";
|
|
7631
7630
|
const description = hasSelect ? "Choose an authentication method to access the data source" : (_d = preparedOptions[0].description) != null ? _d : "";
|
|
@@ -7710,7 +7709,7 @@ const SelfSignedCertificate = ({
|
|
|
7710
7709
|
{
|
|
7711
7710
|
label: "CA Certificate",
|
|
7712
7711
|
labelWidth: 24,
|
|
7713
|
-
tooltip: (_a = tooltips == null ?
|
|
7712
|
+
tooltip: (_a = tooltips == null ? void 0 : tooltips.certificateLabel) != null ? _a : "Your self-signed certificate",
|
|
7714
7713
|
required: true,
|
|
7715
7714
|
htmlFor: "self-signed-certificate-input",
|
|
7716
7715
|
interactive: true,
|
|
@@ -7765,7 +7764,7 @@ const TLSClientAuth = ({
|
|
|
7765
7764
|
{
|
|
7766
7765
|
label: "ServerName",
|
|
7767
7766
|
labelWidth: 24,
|
|
7768
|
-
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",
|
|
7769
7768
|
required: true,
|
|
7770
7769
|
htmlFor: "client-auth-servername-input",
|
|
7771
7770
|
interactive: true,
|
|
@@ -7789,7 +7788,7 @@ const TLSClientAuth = ({
|
|
|
7789
7788
|
{
|
|
7790
7789
|
label: "Client Certificate",
|
|
7791
7790
|
labelWidth: 24,
|
|
7792
|
-
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",
|
|
7793
7792
|
required: true,
|
|
7794
7793
|
htmlFor: "client-auth-client-certificate-input",
|
|
7795
7794
|
interactive: true,
|
|
@@ -7816,7 +7815,7 @@ const TLSClientAuth = ({
|
|
|
7816
7815
|
{
|
|
7817
7816
|
label: "Client Key",
|
|
7818
7817
|
labelWidth: 24,
|
|
7819
|
-
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",
|
|
7820
7819
|
required: true,
|
|
7821
7820
|
htmlFor: "client-auth-client-key-input",
|
|
7822
7821
|
interactive: true,
|
|
@@ -7972,7 +7971,7 @@ const CustomHeaders = ({ headers: headersFromProps, onChange, readOnly }) => {
|
|
|
7972
7971
|
let changed = false;
|
|
7973
7972
|
const newHeaders = headers2.map((header) => {
|
|
7974
7973
|
var _a;
|
|
7975
|
-
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;
|
|
7976
7975
|
if (typeof configured !== "undefined" && header.configured !== configured) {
|
|
7977
7976
|
changed = true;
|
|
7978
7977
|
return { ...header, configured };
|
|
@@ -8150,7 +8149,7 @@ function getTLSProps(config, onChange) {
|
|
|
8150
8149
|
return {
|
|
8151
8150
|
selfSignedCertificate: {
|
|
8152
8151
|
enabled: Boolean(config.jsonData.tlsAuthWithCACert),
|
|
8153
|
-
certificateConfigured: !!((_a = config.secureJsonFields) == null ?
|
|
8152
|
+
certificateConfigured: !!((_a = config.secureJsonFields) == null ? void 0 : _a.tlsCACert),
|
|
8154
8153
|
onToggle: (enabled) => enabled ? onChange({
|
|
8155
8154
|
...config,
|
|
8156
8155
|
jsonData: { ...config.jsonData, tlsAuthWithCACert: enabled }
|
|
@@ -8173,8 +8172,8 @@ function getTLSProps(config, onChange) {
|
|
|
8173
8172
|
TLSClientAuth: {
|
|
8174
8173
|
enabled: config.jsonData.tlsAuth,
|
|
8175
8174
|
serverName: config.jsonData.serverName,
|
|
8176
|
-
clientCertificateConfigured: !!((_b = config.secureJsonFields) == null ?
|
|
8177
|
-
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),
|
|
8178
8177
|
onToggle: (enabled) => enabled ? onChange({
|
|
8179
8178
|
...config,
|
|
8180
8179
|
jsonData: { ...config.jsonData, tlsAuth: enabled }
|
|
@@ -8282,7 +8281,7 @@ const ConnectionSettings = ({
|
|
|
8282
8281
|
urlLabel,
|
|
8283
8282
|
className
|
|
8284
8283
|
}) => {
|
|
8285
|
-
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);
|
|
8286
8285
|
const styles = {
|
|
8287
8286
|
container: css.css({
|
|
8288
8287
|
maxWidth: 578
|
|
@@ -8529,7 +8528,7 @@ class CustomHeadersSettings extends React.PureComponent {
|
|
|
8529
8528
|
return {
|
|
8530
8529
|
id: lodash.uniqueId(),
|
|
8531
8530
|
name: jsonData[key],
|
|
8532
|
-
value: secureJsonData !==
|
|
8531
|
+
value: secureJsonData !== void 0 ? secureJsonData[key] : "",
|
|
8533
8532
|
configured: secureJsonFields && secureJsonFields[`httpHeaderValue${index + 1}`] || false
|
|
8534
8533
|
};
|
|
8535
8534
|
})
|
|
@@ -8600,8 +8599,8 @@ class QueryModellerBase {
|
|
|
8600
8599
|
hasBinaryOp(query) {
|
|
8601
8600
|
return query.operations.find((op) => {
|
|
8602
8601
|
const def = this.getOperationDefinition(op.id);
|
|
8603
|
-
return (def == null ?
|
|
8604
|
-
}) !==
|
|
8602
|
+
return (def == null ? void 0 : def.category) === BINARY_OPERATIONS_KEY;
|
|
8603
|
+
}) !== void 0;
|
|
8605
8604
|
}
|
|
8606
8605
|
}
|
|
8607
8606
|
|
|
@@ -8624,7 +8623,7 @@ function LabelFilterItem({
|
|
|
8624
8623
|
const [labelValuesMenuOpen, setLabelValuesMenuOpen] = React.useState(false);
|
|
8625
8624
|
const isMultiSelect = (operator = item.op) => {
|
|
8626
8625
|
var _a2;
|
|
8627
|
-
return (_a2 = operators.find((op) => op.label === operator)) == null ?
|
|
8626
|
+
return (_a2 = operators.find((op) => op.label === operator)) == null ? void 0 : _a2.isMultiValue;
|
|
8628
8627
|
};
|
|
8629
8628
|
const getSelectOptionsFromString = (item2) => {
|
|
8630
8629
|
if (item2) {
|
|
@@ -8637,12 +8636,12 @@ function LabelFilterItem({
|
|
|
8637
8636
|
};
|
|
8638
8637
|
const getOptions = () => {
|
|
8639
8638
|
const labelValues = state.labelValues ? [...state.labelValues] : [];
|
|
8640
|
-
const selectedOptions = getSelectOptionsFromString(item == null ?
|
|
8639
|
+
const selectedOptions = getSelectOptionsFromString(item == null ? void 0 : item.value).map(data.toOption);
|
|
8641
8640
|
return lodash.uniqBy([...selectedOptions, ...labelValues], "value");
|
|
8642
8641
|
};
|
|
8643
8642
|
const isConflicting = isConflictingLabelFilter(item, items);
|
|
8644
8643
|
const { current: id } = React.useRef(uuid.v4());
|
|
8645
|
-
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(
|
|
8646
8645
|
ui.Select,
|
|
8647
8646
|
{
|
|
8648
8647
|
placeholder: "Select label",
|
|
@@ -8655,7 +8654,7 @@ function LabelFilterItem({
|
|
|
8655
8654
|
setState({ isLoadingLabelNames: true });
|
|
8656
8655
|
const labelNames = await onGetLabelNames(item);
|
|
8657
8656
|
setLabelNamesMenuOpen(true);
|
|
8658
|
-
setState({ labelNames, isLoadingLabelNames:
|
|
8657
|
+
setState({ labelNames, isLoadingLabelNames: void 0 });
|
|
8659
8658
|
},
|
|
8660
8659
|
onCloseMenu: () => {
|
|
8661
8660
|
setLabelNamesMenuOpen(false);
|
|
@@ -8687,7 +8686,7 @@ function LabelFilterItem({
|
|
|
8687
8686
|
onChange({
|
|
8688
8687
|
...item,
|
|
8689
8688
|
op: change.value,
|
|
8690
|
-
value: isMultiSelect(change.value) ? item.value : getSelectOptionsFromString(item == null ?
|
|
8689
|
+
value: isMultiSelect(change.value) ? item.value : getSelectOptionsFromString(item == null ? void 0 : item.value)[0]
|
|
8691
8690
|
});
|
|
8692
8691
|
}
|
|
8693
8692
|
},
|
|
@@ -8700,7 +8699,7 @@ function LabelFilterItem({
|
|
|
8700
8699
|
"data-testid": e2eSelectors.selectors.components.QueryBuilder.valueSelect,
|
|
8701
8700
|
inputId: `visual-query-builder-dimensions-filter-item-value-${id}`,
|
|
8702
8701
|
width: "auto",
|
|
8703
|
-
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],
|
|
8704
8703
|
allowCustomValue: true,
|
|
8705
8704
|
onOpenMenu: async () => {
|
|
8706
8705
|
setState({ isLoadingLabelValues: true });
|
|
@@ -8708,7 +8707,7 @@ function LabelFilterItem({
|
|
|
8708
8707
|
setState({
|
|
8709
8708
|
...state,
|
|
8710
8709
|
labelValues,
|
|
8711
|
-
isLoadingLabelValues:
|
|
8710
|
+
isLoadingLabelValues: void 0
|
|
8712
8711
|
});
|
|
8713
8712
|
setLabelValuesMenuOpen(true);
|
|
8714
8713
|
},
|
|
@@ -8732,9 +8731,9 @@ function LabelFilterItem({
|
|
|
8732
8731
|
if (change2.value) {
|
|
8733
8732
|
return change2.value;
|
|
8734
8733
|
} else {
|
|
8735
|
-
return
|
|
8734
|
+
return void 0;
|
|
8736
8735
|
}
|
|
8737
|
-
}).filter((val) => val !==
|
|
8736
|
+
}).filter((val) => val !== void 0).join(multiValueSeparator);
|
|
8738
8737
|
onChange({ ...item, value: changes, op: (_b = item.op) != null ? _b : defaultOp });
|
|
8739
8738
|
}
|
|
8740
8739
|
},
|
|
@@ -8761,10 +8760,10 @@ function isConflictingLabelFilter(newLabel, labels) {
|
|
|
8761
8760
|
);
|
|
8762
8761
|
const conflict = candidates.some((candidate) => {
|
|
8763
8762
|
var _a, _b;
|
|
8764
|
-
if (operationIsNegative && ((_a = candidate == null ?
|
|
8763
|
+
if (operationIsNegative && ((_a = candidate == null ? void 0 : candidate.op) == null ? void 0 : _a.toString().startsWith("!")) === false) {
|
|
8765
8764
|
return true;
|
|
8766
8765
|
}
|
|
8767
|
-
if (operationIsNegative === false && ((_b = candidate == null ?
|
|
8766
|
+
if (operationIsNegative === false && ((_b = candidate == null ? void 0 : candidate.op) == null ? void 0 : _b.toString().startsWith("!"))) {
|
|
8768
8767
|
return true;
|
|
8769
8768
|
}
|
|
8770
8769
|
return false;
|
|
@@ -8793,7 +8792,7 @@ function LabelFilters({
|
|
|
8793
8792
|
const onLabelsChange = (newItems) => {
|
|
8794
8793
|
setItems(newItems);
|
|
8795
8794
|
const newLabels = newItems.filter(
|
|
8796
|
-
(item) => item.label !==
|
|
8795
|
+
(item) => item.label !== void 0 && item.value !== void 0
|
|
8797
8796
|
);
|
|
8798
8797
|
if (!lodash.isEqual(newLabels, labelsFilters)) {
|
|
8799
8798
|
onChange(newLabels);
|
|
@@ -8834,7 +8833,7 @@ function LabelFilters({
|
|
|
8834
8833
|
|
|
8835
8834
|
function OperationExplainedBox({ title, stepNumber, markdown, children }) {
|
|
8836
8835
|
const styles = ui.useStyles2(getStyles$b);
|
|
8837
|
-
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)));
|
|
8838
8837
|
}
|
|
8839
8838
|
const getStyles$b = (theme) => {
|
|
8840
8839
|
return {
|
|
@@ -9077,7 +9076,7 @@ function SimpleInputParamEditor(props) {
|
|
|
9077
9076
|
ui.AutoSizeInput,
|
|
9078
9077
|
{
|
|
9079
9078
|
id: getOperationParamId(props.operationId, props.index),
|
|
9080
|
-
defaultValue: (_a = props.value) == null ?
|
|
9079
|
+
defaultValue: (_a = props.value) == null ? void 0 : _a.toString(),
|
|
9081
9080
|
minWidth: props.paramDef.minWidth,
|
|
9082
9081
|
placeholder: props.paramDef.placeholder,
|
|
9083
9082
|
title: props.paramDef.description,
|
|
@@ -9111,7 +9110,7 @@ function SelectInputParamEditor({
|
|
|
9111
9110
|
var _a, _b;
|
|
9112
9111
|
const styles = ui.useStyles2(getStyles$8);
|
|
9113
9112
|
let selectOptions = paramDef.options;
|
|
9114
|
-
if (!((_a = selectOptions[0]) == null ?
|
|
9113
|
+
if (!((_a = selectOptions[0]) == null ? void 0 : _a.label)) {
|
|
9115
9114
|
selectOptions = paramDef.options.map((option) => ({
|
|
9116
9115
|
label: option.toString(),
|
|
9117
9116
|
value: option
|
|
@@ -9416,9 +9415,9 @@ function OperationEditor({
|
|
|
9416
9415
|
}
|
|
9417
9416
|
const isInvalid = (isDragging) => {
|
|
9418
9417
|
if (isDragging) {
|
|
9419
|
-
return
|
|
9418
|
+
return void 0;
|
|
9420
9419
|
}
|
|
9421
|
-
return isConflicting ? true :
|
|
9420
|
+
return isConflicting ? true : void 0;
|
|
9422
9421
|
};
|
|
9423
9422
|
return /* @__PURE__ */ React__default.default.createElement(dnd.Draggable, { draggableId: `operation-${index}`, index }, (provided, snapshot) => /* @__PURE__ */ React__default.default.createElement(
|
|
9424
9423
|
ui.InlineField,
|
|
@@ -9572,7 +9571,7 @@ function useOperationsHighlight(operations) {
|
|
|
9572
9571
|
} else {
|
|
9573
9572
|
newOps = operations.map((op, index) => {
|
|
9574
9573
|
var _a;
|
|
9575
|
-
return !isSameOp(op.id, (_a = prevOperations[index]) == null ?
|
|
9574
|
+
return !isSameOp(op.id, (_a = prevOperations[index]) == null ? void 0 : _a.id);
|
|
9576
9575
|
});
|
|
9577
9576
|
}
|
|
9578
9577
|
return newOps;
|
|
@@ -9644,8 +9643,8 @@ function OperationListExplained({
|
|
|
9644
9643
|
"div",
|
|
9645
9644
|
{
|
|
9646
9645
|
key: index,
|
|
9647
|
-
onMouseEnter: () => onMouseEnter == null ?
|
|
9648
|
-
onMouseLeave: () => onMouseLeave == null ?
|
|
9646
|
+
onMouseEnter: () => onMouseEnter == null ? void 0 : onMouseEnter(op, index),
|
|
9647
|
+
onMouseLeave: () => onMouseLeave == null ? void 0 : onMouseLeave(op, index)
|
|
9649
9648
|
},
|
|
9650
9649
|
/* @__PURE__ */ React__default.default.createElement(
|
|
9651
9650
|
OperationExplainedBox,
|
|
@@ -9687,15 +9686,15 @@ const QueryBuilderHints = ({
|
|
|
9687
9686
|
const hints = React.useMemo(() => {
|
|
9688
9687
|
var _a;
|
|
9689
9688
|
const dataQuery = buildDataQueryFromQueryString(queryModeller.renderQuery(visualQuery));
|
|
9690
|
-
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) => {
|
|
9691
9690
|
var _a2;
|
|
9692
|
-
return (_a2 = hint.fix) == null ?
|
|
9691
|
+
return (_a2 = hint.fix) == null ? void 0 : _a2.action;
|
|
9693
9692
|
});
|
|
9694
9693
|
return hints2 != null ? hints2 : [];
|
|
9695
9694
|
}, [datasource, visualQuery, data, queryModeller, buildDataQueryFromQueryString]);
|
|
9696
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) => {
|
|
9697
9696
|
var _a, _b, _c, _d;
|
|
9698
|
-
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(
|
|
9699
9698
|
ui.Button,
|
|
9700
9699
|
{
|
|
9701
9700
|
onClick: () => {
|
|
@@ -9704,9 +9703,9 @@ const QueryBuilderHints = ({
|
|
|
9704
9703
|
hint: hint.type,
|
|
9705
9704
|
datasourceType: datasource.type
|
|
9706
9705
|
});
|
|
9707
|
-
if ((_a2 = hint == null ?
|
|
9706
|
+
if ((_a2 = hint == null ? void 0 : hint.fix) == null ? void 0 : _a2.action) {
|
|
9708
9707
|
const dataQuery = buildDataQueryFromQueryString(queryModeller.renderQuery(visualQuery));
|
|
9709
|
-
const newQuery = (_b2 = datasource.modifyQuery) == null ?
|
|
9708
|
+
const newQuery = (_b2 = datasource.modifyQuery) == null ? void 0 : _b2.call(datasource, dataQuery, hint.fix.action);
|
|
9710
9709
|
if (newQuery) {
|
|
9711
9710
|
const newVisualQuery = buildVisualQueryFromString(
|
|
9712
9711
|
(_c2 = buildQueryStringFromDataQuery(newQuery)) != null ? _c2 : ""
|
|
@@ -9720,7 +9719,7 @@ const QueryBuilderHints = ({
|
|
|
9720
9719
|
className: styles.hint
|
|
9721
9720
|
},
|
|
9722
9721
|
"hint: ",
|
|
9723
|
-
((_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("_", " "))
|
|
9724
9723
|
));
|
|
9725
9724
|
})));
|
|
9726
9725
|
};
|