@grafana/plugin-ui 0.10.10 → 0.11.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 +1748 -1339
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +87 -47
- package/dist/esm/components/ConfigEditor/AdvancedSettings/AdvancedHttpSettings.js +42 -38
- package/dist/esm/components/ConfigEditor/AdvancedSettings/AdvancedHttpSettings.js.map +1 -1
- package/dist/esm/components/ConfigEditor/Auth/Auth.js +19 -14
- package/dist/esm/components/ConfigEditor/Auth/Auth.js.map +1 -1
- package/dist/esm/components/ConfigEditor/Auth/auth-method/AuthMethodSettings.js +19 -15
- package/dist/esm/components/ConfigEditor/Auth/auth-method/AuthMethodSettings.js.map +1 -1
- package/dist/esm/components/ConfigEditor/Auth/auth-method/BasicAuth.js +52 -49
- package/dist/esm/components/ConfigEditor/Auth/auth-method/BasicAuth.js.map +1 -1
- package/dist/esm/components/ConfigEditor/Auth/custom-headers/CustomHeader.js +59 -55
- package/dist/esm/components/ConfigEditor/Auth/custom-headers/CustomHeader.js.map +1 -1
- package/dist/esm/components/ConfigEditor/Auth/custom-headers/CustomHeaders.js +20 -17
- package/dist/esm/components/ConfigEditor/Auth/custom-headers/CustomHeaders.js.map +1 -1
- package/dist/esm/components/ConfigEditor/Auth/tls/SelfSignedCertificate.js +28 -28
- package/dist/esm/components/ConfigEditor/Auth/tls/SelfSignedCertificate.js.map +1 -1
- package/dist/esm/components/ConfigEditor/Auth/tls/SkipTLSVerification.js +2 -2
- package/dist/esm/components/ConfigEditor/Auth/tls/SkipTLSVerification.js.map +1 -1
- package/dist/esm/components/ConfigEditor/Auth/tls/TLSClientAuth.js +84 -82
- package/dist/esm/components/ConfigEditor/Auth/tls/TLSClientAuth.js.map +1 -1
- package/dist/esm/components/ConfigEditor/Auth/tls/TLSSettings.js +10 -7
- package/dist/esm/components/ConfigEditor/Auth/tls/TLSSettings.js.map +1 -1
- package/dist/esm/components/ConfigEditor/Auth/tls/TLSSettingsSection.js +8 -2
- package/dist/esm/components/ConfigEditor/Auth/tls/TLSSettingsSection.js.map +1 -1
- package/dist/esm/components/ConfigEditor/Auth/utils.js +2 -1
- package/dist/esm/components/ConfigEditor/Auth/utils.js.map +1 -1
- package/dist/esm/components/ConfigEditor/ConfigSection/ConfigDescriptionLink.js +14 -11
- package/dist/esm/components/ConfigEditor/ConfigSection/ConfigDescriptionLink.js.map +1 -1
- package/dist/esm/components/ConfigEditor/ConfigSection/ConfigSection.js +2 -2
- package/dist/esm/components/ConfigEditor/ConfigSection/ConfigSection.js.map +1 -1
- package/dist/esm/components/ConfigEditor/ConfigSection/ConfigSubSection.js +2 -2
- package/dist/esm/components/ConfigEditor/ConfigSection/ConfigSubSection.js.map +1 -1
- package/dist/esm/components/ConfigEditor/ConfigSection/GenericConfigSection.js +19 -11
- package/dist/esm/components/ConfigEditor/ConfigSection/GenericConfigSection.js.map +1 -1
- package/dist/esm/components/ConfigEditor/Connection/ConnectionSettings.js +24 -19
- package/dist/esm/components/ConfigEditor/Connection/ConnectionSettings.js.map +1 -1
- package/dist/esm/components/ConfigEditor/DataSourceDescription.js +12 -2
- package/dist/esm/components/ConfigEditor/DataSourceDescription.js.map +1 -1
- package/dist/esm/components/ConfigEditor/SecureSocksProxyToggle.js +24 -20
- package/dist/esm/components/ConfigEditor/SecureSocksProxyToggle.js.map +1 -1
- package/dist/esm/components/CustomHeadersSettings/CustomHeadersSettings.js +69 -60
- package/dist/esm/components/CustomHeadersSettings/CustomHeadersSettings.js.map +1 -1
- package/dist/esm/components/DataLinks/DataLink.js +104 -89
- package/dist/esm/components/DataLinks/DataLink.js.map +1 -1
- package/dist/esm/components/DataLinks/DataLinks.js +48 -41
- package/dist/esm/components/DataLinks/DataLinks.js.map +1 -1
- package/dist/esm/components/DataSourcePicker/DataSourcePicker.js +9 -4
- package/dist/esm/components/DataSourcePicker/DataSourcePicker.js.map +1 -1
- package/dist/esm/components/DatePicker/DatePicker.js +6 -5
- package/dist/esm/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/esm/components/DatePickerWithInput/DatePickerWithInput.js +19 -15
- package/dist/esm/components/DatePickerWithInput/DatePickerWithInput.js.map +1 -1
- package/dist/esm/components/DebounceInput/DebounceInput.js +6 -5
- package/dist/esm/components/DebounceInput/DebounceInput.js.map +1 -1
- package/dist/esm/components/Plugins/PluginSignatureBadge.js +3 -2
- package/dist/esm/components/Plugins/PluginSignatureBadge.js.map +1 -1
- package/dist/esm/components/QueryEditor/AccessoryButton.js +2 -2
- package/dist/esm/components/QueryEditor/AccessoryButton.js.map +1 -1
- package/dist/esm/components/QueryEditor/CatalogSelector.js +53 -0
- package/dist/esm/components/QueryEditor/CatalogSelector.js.map +1 -0
- package/dist/esm/components/QueryEditor/ConfirmModal.js +18 -8
- package/dist/esm/components/QueryEditor/ConfirmModal.js.map +1 -1
- package/dist/esm/components/QueryEditor/DatasetSelector.js +12 -6
- package/dist/esm/components/QueryEditor/DatasetSelector.js.map +1 -1
- package/dist/esm/components/QueryEditor/EditorField.js +11 -3
- package/dist/esm/components/QueryEditor/EditorField.js.map +1 -1
- package/dist/esm/components/QueryEditor/EditorFieldGroup.js +2 -2
- 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 +11 -7
- package/dist/esm/components/QueryEditor/EditorList.js.map +1 -1
- package/dist/esm/components/QueryEditor/EditorRow.js +2 -2
- 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 +2 -2
- package/dist/esm/components/QueryEditor/EditorStack.js.map +1 -1
- package/dist/esm/components/QueryEditor/EditorSwitch.js +3 -2
- package/dist/esm/components/QueryEditor/EditorSwitch.js.map +1 -1
- package/dist/esm/components/QueryEditor/FlexItem.js +2 -2
- package/dist/esm/components/QueryEditor/FlexItem.js.map +1 -1
- package/dist/esm/components/QueryEditor/InlineSelect.js +12 -4
- package/dist/esm/components/QueryEditor/InlineSelect.js.map +1 -1
- package/dist/esm/components/QueryEditor/InputGroup.js +3 -2
- package/dist/esm/components/QueryEditor/InputGroup.js.map +1 -1
- package/dist/esm/components/QueryEditor/QueryEditor.js +47 -37
- package/dist/esm/components/QueryEditor/QueryEditor.js.map +1 -1
- package/dist/esm/components/QueryEditor/QueryHeader.js +160 -97
- package/dist/esm/components/QueryEditor/QueryHeader.js.map +1 -1
- package/dist/esm/components/QueryEditor/RunQueryButton.js +13 -9
- 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 +18 -7
- package/dist/esm/components/QueryEditor/TableSelector.js.map +1 -1
- package/dist/esm/components/QueryEditor/query-editor-raw/QueryEditorRaw.js +6 -5
- package/dist/esm/components/QueryEditor/query-editor-raw/QueryEditorRaw.js.map +1 -1
- package/dist/esm/components/QueryEditor/query-editor-raw/QueryToolbox.js +26 -18
- package/dist/esm/components/QueryEditor/query-editor-raw/QueryToolbox.js.map +1 -1
- package/dist/esm/components/QueryEditor/query-editor-raw/QueryValidator.js +19 -2
- package/dist/esm/components/QueryEditor/query-editor-raw/QueryValidator.js.map +1 -1
- package/dist/esm/components/QueryEditor/query-editor-raw/RawEditor.js +42 -38
- package/dist/esm/components/QueryEditor/query-editor-raw/RawEditor.js.map +1 -1
- package/dist/esm/components/QueryEditor/types.js +1 -0
- package/dist/esm/components/QueryEditor/types.js.map +1 -1
- package/dist/esm/components/QueryEditor/utils/sql.utils.js +7 -9
- package/dist/esm/components/QueryEditor/utils/sql.utils.js.map +1 -1
- package/dist/esm/components/QueryEditor/utils/useSqlChange.js +7 -1
- package/dist/esm/components/QueryEditor/utils/useSqlChange.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/AwesomeQueryBuilder.js +8 -8
- package/dist/esm/components/QueryEditor/visual-query-builder/AwesomeQueryBuilder.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/EditorField.js +11 -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 +2 -2
- package/dist/esm/components/QueryEditor/visual-query-builder/EditorRows.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/GroupByRow.js +16 -12
- package/dist/esm/components/QueryEditor/visual-query-builder/GroupByRow.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/OrderByRow.js +29 -20
- package/dist/esm/components/QueryEditor/visual-query-builder/OrderByRow.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/Preview.js +7 -4
- package/dist/esm/components/QueryEditor/visual-query-builder/Preview.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/SQLGroupByRow.js +2 -2
- 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 +2 -2
- package/dist/esm/components/QueryEditor/visual-query-builder/SQLSelectRow.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/SQLWhereRow.js +4 -4
- package/dist/esm/components/QueryEditor/visual-query-builder/SQLWhereRow.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/SelectRow.js +52 -44
- package/dist/esm/components/QueryEditor/visual-query-builder/SelectRow.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/VisualEditor.js +11 -2
- package/dist/esm/components/QueryEditor/visual-query-builder/VisualEditor.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/WhereRow.js +4 -3
- package/dist/esm/components/QueryEditor/visual-query-builder/WhereRow.js.map +1 -1
- package/dist/esm/components/QueryEditorRow/QueryEditorRow.js +6 -2
- package/dist/esm/components/QueryEditorRow/QueryEditorRow.js.map +1 -1
- package/dist/esm/components/SQLEditor/components/SQLEditor.js +37 -33
- package/dist/esm/components/SQLEditor/components/SQLEditor.js.map +1 -1
- package/dist/esm/components/SQLEditor/standardSql/definition.js +1 -0
- package/dist/esm/components/SQLEditor/standardSql/definition.js.map +1 -1
- package/dist/esm/components/SQLEditor/types.js.map +1 -1
- package/dist/esm/components/SQLEditor/utils/tokenUtils.js +2 -0
- package/dist/esm/components/SQLEditor/utils/tokenUtils.js.map +1 -1
- package/dist/esm/components/Segment/Segment.js +4 -3
- package/dist/esm/components/Segment/Segment.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/LabelFilterItem.js +105 -99
- package/dist/esm/components/VisualQueryBuilder/components/LabelFilterItem.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/LabelFilters.js +28 -27
- package/dist/esm/components/VisualQueryBuilder/components/LabelFilters.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/OperationEditor.js +31 -26
- package/dist/esm/components/VisualQueryBuilder/components/OperationEditor.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/OperationEditorBody.js +70 -55
- package/dist/esm/components/VisualQueryBuilder/components/OperationEditorBody.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/OperationExplainedBox.js +11 -2
- package/dist/esm/components/VisualQueryBuilder/components/OperationExplainedBox.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/OperationHeader.js +75 -62
- package/dist/esm/components/VisualQueryBuilder/components/OperationHeader.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/OperationInfoButton.js +39 -28
- package/dist/esm/components/VisualQueryBuilder/components/OperationInfoButton.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/OperationList.js +38 -31
- package/dist/esm/components/VisualQueryBuilder/components/OperationList.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/OperationListExplained.js +15 -14
- package/dist/esm/components/VisualQueryBuilder/components/OperationListExplained.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/OperationParamEditor.js +35 -31
- package/dist/esm/components/VisualQueryBuilder/components/OperationParamEditor.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/OperationsEditorRow.js +3 -2
- package/dist/esm/components/VisualQueryBuilder/components/OperationsEditorRow.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/QueryBuilderHints.js +12 -9
- package/dist/esm/components/VisualQueryBuilder/components/QueryBuilderHints.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/QueryEditorModeToggle.js +2 -2
- package/dist/esm/components/VisualQueryBuilder/components/QueryEditorModeToggle.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/QueryHeaderSwitch.js +6 -2
- package/dist/esm/components/VisualQueryBuilder/components/QueryHeaderSwitch.js.map +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/QueryOptionGroup.js +20 -12
- 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/index.d.ts +87 -47
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
6
|
var React = require('react');
|
|
6
7
|
var ui = require('@grafana/ui');
|
|
7
8
|
var data = require('@grafana/data');
|
|
@@ -55,7 +56,11 @@ const QueryEditorRow = (props) => {
|
|
|
55
56
|
var _a, _b;
|
|
56
57
|
const className = (_a = props.className) != null ? _a : "width-8";
|
|
57
58
|
const noFillEnd = (_b = props.noFillEnd) != null ? _b : false;
|
|
58
|
-
return /* @__PURE__ */
|
|
59
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "gf-form", children: [
|
|
60
|
+
props.label && /* @__PURE__ */ jsxRuntime.jsx("label", { className: `gf-form-label query-keyword ${className}`, children: props.label }),
|
|
61
|
+
props.children,
|
|
62
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "gf-form--grow", children: noFillEnd || /* @__PURE__ */ jsxRuntime.jsx("div", { className: "gf-form-label gf-form-label--grow" }) })
|
|
63
|
+
] });
|
|
59
64
|
};
|
|
60
65
|
|
|
61
66
|
const DEFAULT_DELAY = 275;
|
|
@@ -74,20 +79,20 @@ const useDebounce = (value, delay = DEFAULT_DELAY) => {
|
|
|
74
79
|
|
|
75
80
|
const DebounceInput = (props) => {
|
|
76
81
|
const { delay, onDebounce, value, ...rest } = props;
|
|
77
|
-
const [input, setInput] =
|
|
82
|
+
const [input, setInput] = React.useState(value);
|
|
78
83
|
const debouncedInput = useDebounce(input, delay);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return /* @__PURE__ */
|
|
84
|
+
React.useEffect(() => onDebounce(debouncedInput), [debouncedInput]);
|
|
85
|
+
React.useEffect(() => setInput(value), [value]);
|
|
86
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { onChange: (ev) => setInput(ev.currentTarget.value), value: input, ...rest });
|
|
82
87
|
};
|
|
83
88
|
|
|
84
89
|
function Segment(props) {
|
|
85
90
|
const { delay, onDebounce, value, options, ...rest } = props;
|
|
86
|
-
const [input, setInput] =
|
|
91
|
+
const [input, setInput] = React.useState(value);
|
|
87
92
|
const debouncedSegment = useDebounce(input, delay);
|
|
88
93
|
React.useEffect(() => onDebounce(debouncedSegment), [debouncedSegment]);
|
|
89
94
|
React.useEffect(() => setInput(value), [value]);
|
|
90
|
-
return /* @__PURE__ */
|
|
95
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
91
96
|
ui.Segment,
|
|
92
97
|
{
|
|
93
98
|
options,
|
|
@@ -253,20 +258,20 @@ const DatePicker = React.memo((props) => {
|
|
|
253
258
|
if (!isOpen) {
|
|
254
259
|
return null;
|
|
255
260
|
}
|
|
256
|
-
return /* @__PURE__ */
|
|
261
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.ClickOutsideWrapper, { useCapture: true, includeButtonPress: false, onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.modal, "data-testid": "date-picker", children: /* @__PURE__ */ jsxRuntime.jsx(Body, { ...props }) }) });
|
|
257
262
|
});
|
|
258
263
|
DatePicker.displayName = "DatePicker";
|
|
259
264
|
const Body = React.memo(({ value, onChange }) => {
|
|
260
265
|
const theme = ui.useTheme2();
|
|
261
266
|
const styles = getBodyStyles(theme);
|
|
262
|
-
return /* @__PURE__ */
|
|
267
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
263
268
|
Calendar__default.default,
|
|
264
269
|
{
|
|
265
270
|
className: styles.body,
|
|
266
271
|
tileClassName: styles.title,
|
|
267
272
|
value: value || /* @__PURE__ */ new Date(),
|
|
268
|
-
nextLabel: /* @__PURE__ */
|
|
269
|
-
prevLabel: /* @__PURE__ */
|
|
273
|
+
nextLabel: /* @__PURE__ */ jsxRuntime.jsx(ui.Icon, { name: "angle-right" }),
|
|
274
|
+
prevLabel: /* @__PURE__ */ jsxRuntime.jsx(ui.Icon, { name: "angle-left" }),
|
|
270
275
|
onChange: (ev) => {
|
|
271
276
|
if (!Array.isArray(ev)) {
|
|
272
277
|
onChange(ev);
|
|
@@ -293,26 +298,29 @@ function getStyles$q() {
|
|
|
293
298
|
const formatDate = (date) => date.toISOString().split("T")[0];
|
|
294
299
|
const DatePickerWithInput = (props) => {
|
|
295
300
|
const { value, onChange, className, ...rest } = props;
|
|
296
|
-
const [open, setOpen] =
|
|
301
|
+
const [open, setOpen] = React.useState(false);
|
|
297
302
|
const styles = getStyles$q();
|
|
298
|
-
return /* @__PURE__ */
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
303
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
304
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
305
|
+
ui.Input,
|
|
306
|
+
{
|
|
307
|
+
type: "date",
|
|
308
|
+
placeholder: "Date",
|
|
309
|
+
value: formatDate(value || /* @__PURE__ */ new Date()),
|
|
310
|
+
onClick: () => setOpen(true),
|
|
311
|
+
onChange: () => {
|
|
312
|
+
},
|
|
313
|
+
className: css.cx(styles.input, className),
|
|
314
|
+
...rest
|
|
315
|
+
}
|
|
316
|
+
),
|
|
317
|
+
/* @__PURE__ */ jsxRuntime.jsx(DatePicker, { isOpen: open, value, onChange: (ev) => onChange(ev), onClose: () => setOpen(false) })
|
|
318
|
+
] });
|
|
311
319
|
};
|
|
312
320
|
|
|
313
321
|
const PluginSignatureBadge = ({ status, ...otherProps }) => {
|
|
314
322
|
const display = getSignatureDisplayModel(status);
|
|
315
|
-
return /* @__PURE__ */
|
|
323
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
316
324
|
ui.Badge,
|
|
317
325
|
{
|
|
318
326
|
text: display.text,
|
|
@@ -422,7 +430,7 @@ class DataSourcePicker extends React.PureComponent {
|
|
|
422
430
|
const { error } = this.state;
|
|
423
431
|
const options = this.getDataSourceOptions();
|
|
424
432
|
const value = this.getCurrentValue();
|
|
425
|
-
return /* @__PURE__ */
|
|
433
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { "aria-label": e2eSelectors.selectors.components.DataSourcePicker.container, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
426
434
|
ui.Select,
|
|
427
435
|
{
|
|
428
436
|
className: "ds-picker select-container",
|
|
@@ -441,12 +449,16 @@ class DataSourcePicker extends React.PureComponent {
|
|
|
441
449
|
invalid: !!error,
|
|
442
450
|
getOptionLabel: (o) => {
|
|
443
451
|
if (o.meta && isUnsignedPluginSignature(o.meta.signature) && o !== value) {
|
|
444
|
-
return /* @__PURE__ */
|
|
452
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.HorizontalGroup, { align: "center", justify: "space-between", children: [
|
|
453
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: o.label }),
|
|
454
|
+
" ",
|
|
455
|
+
/* @__PURE__ */ jsxRuntime.jsx(PluginSignatureBadge, { status: o.meta.signature })
|
|
456
|
+
] });
|
|
445
457
|
}
|
|
446
458
|
return o.label || "";
|
|
447
459
|
}
|
|
448
460
|
}
|
|
449
|
-
));
|
|
461
|
+
) });
|
|
450
462
|
}
|
|
451
463
|
}
|
|
452
464
|
__publicField$4(DataSourcePicker, "defaultProps", {
|
|
@@ -481,100 +493,114 @@ const DataLink = (props) => {
|
|
|
481
493
|
[field]: event.currentTarget.value
|
|
482
494
|
});
|
|
483
495
|
};
|
|
484
|
-
return /* @__PURE__ */
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
labelWidth: 6,
|
|
489
|
-
inputWidth: null,
|
|
490
|
-
label: "Field",
|
|
491
|
-
type: "text",
|
|
492
|
-
value: value.field,
|
|
493
|
-
tooltip: "Can be exact field name or a regex pattern that will match on the field name.",
|
|
494
|
-
onChange: handleChange("field")
|
|
495
|
-
}
|
|
496
|
-
), /* @__PURE__ */ React__namespace.default.createElement(
|
|
497
|
-
ui.Button,
|
|
498
|
-
{
|
|
499
|
-
variant: "destructive",
|
|
500
|
-
title: "Remove field",
|
|
501
|
-
icon: "times",
|
|
502
|
-
onClick: (event) => {
|
|
503
|
-
event.preventDefault();
|
|
504
|
-
onDelete();
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
)), /* @__PURE__ */ React__namespace.default.createElement("div", { className: "gf-form" }, /* @__PURE__ */ React__namespace.default.createElement(
|
|
508
|
-
FormField,
|
|
509
|
-
{
|
|
510
|
-
className: styles.nameField,
|
|
511
|
-
inputWidth: null,
|
|
512
|
-
label: "Label",
|
|
513
|
-
type: "text",
|
|
514
|
-
value: value.label,
|
|
515
|
-
onChange: handleChange("label"),
|
|
516
|
-
tooltip: "Use to provide a meaningful label to the data matched in the regex"
|
|
517
|
-
}
|
|
518
|
-
), /* @__PURE__ */ React__namespace.default.createElement(
|
|
519
|
-
FormField,
|
|
520
|
-
{
|
|
521
|
-
className: styles.regexField,
|
|
522
|
-
inputWidth: null,
|
|
523
|
-
label: "Regex",
|
|
524
|
-
type: "text",
|
|
525
|
-
value: value.matcherRegex,
|
|
526
|
-
onChange: handleChange("matcherRegex"),
|
|
527
|
-
tooltip: "Use to parse and capture some part of the log message. You can use the captured groups in the template."
|
|
528
|
-
}
|
|
529
|
-
)), /* @__PURE__ */ React__namespace.default.createElement("div", { className: "gf-form" }, /* @__PURE__ */ React__namespace.default.createElement(
|
|
530
|
-
FormField,
|
|
531
|
-
{
|
|
532
|
-
label: showInternalLink ? "Query" : "URL",
|
|
533
|
-
labelWidth: 6,
|
|
534
|
-
inputEl: /* @__PURE__ */ React__namespace.default.createElement(
|
|
535
|
-
ui.DataLinkInput,
|
|
496
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, children: [
|
|
497
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.firstRow + " gf-form", children: [
|
|
498
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
499
|
+
FormField,
|
|
536
500
|
{
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
501
|
+
className: styles.nameField,
|
|
502
|
+
labelWidth: 6,
|
|
503
|
+
inputWidth: null,
|
|
504
|
+
label: "Field",
|
|
505
|
+
type: "text",
|
|
506
|
+
value: value.field,
|
|
507
|
+
tooltip: "Can be exact field name or a regex pattern that will match on the field name.",
|
|
508
|
+
onChange: handleChange("field")
|
|
544
509
|
}
|
|
545
510
|
),
|
|
546
|
-
|
|
511
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
512
|
+
ui.Button,
|
|
513
|
+
{
|
|
514
|
+
variant: "destructive",
|
|
515
|
+
title: "Remove field",
|
|
516
|
+
icon: "times",
|
|
517
|
+
onClick: (event) => {
|
|
518
|
+
event.preventDefault();
|
|
519
|
+
onDelete();
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
)
|
|
523
|
+
] }),
|
|
524
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "gf-form", children: [
|
|
525
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
526
|
+
FormField,
|
|
527
|
+
{
|
|
528
|
+
className: styles.nameField,
|
|
529
|
+
inputWidth: null,
|
|
530
|
+
label: "Label",
|
|
531
|
+
type: "text",
|
|
532
|
+
value: value.label,
|
|
533
|
+
onChange: handleChange("label"),
|
|
534
|
+
tooltip: "Use to provide a meaningful label to the data matched in the regex"
|
|
535
|
+
}
|
|
536
|
+
),
|
|
537
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
538
|
+
FormField,
|
|
539
|
+
{
|
|
540
|
+
className: styles.regexField,
|
|
541
|
+
inputWidth: null,
|
|
542
|
+
label: "Regex",
|
|
543
|
+
type: "text",
|
|
544
|
+
value: value.matcherRegex,
|
|
545
|
+
onChange: handleChange("matcherRegex"),
|
|
546
|
+
tooltip: "Use to parse and capture some part of the log message. You can use the captured groups in the template."
|
|
547
|
+
}
|
|
548
|
+
)
|
|
549
|
+
] }),
|
|
550
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "gf-form", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
551
|
+
FormField,
|
|
552
|
+
{
|
|
553
|
+
label: showInternalLink ? "Query" : "URL",
|
|
554
|
+
labelWidth: 6,
|
|
555
|
+
inputEl: /* @__PURE__ */ jsxRuntime.jsx(
|
|
556
|
+
ui.DataLinkInput,
|
|
557
|
+
{
|
|
558
|
+
placeholder: showInternalLink ? "${__value.raw}" : "http://example.com/${__value.raw}",
|
|
559
|
+
value: value.url || "",
|
|
560
|
+
onChange: (newValue) => onChange({
|
|
561
|
+
...value,
|
|
562
|
+
url: newValue
|
|
563
|
+
}),
|
|
564
|
+
suggestions
|
|
565
|
+
}
|
|
566
|
+
),
|
|
567
|
+
className: css.css`
|
|
547
568
|
width: 100%;
|
|
548
569
|
`
|
|
549
|
-
}
|
|
550
|
-
)), /* @__PURE__ */ React__namespace.default.createElement("div", { className: styles.row }, /* @__PURE__ */ React__namespace.default.createElement(
|
|
551
|
-
Switch,
|
|
552
|
-
{
|
|
553
|
-
labelClass: "width-6",
|
|
554
|
-
label: "Internal link",
|
|
555
|
-
checked: showInternalLink,
|
|
556
|
-
onChange: () => {
|
|
557
|
-
if (showInternalLink) {
|
|
558
|
-
onChange({
|
|
559
|
-
...value,
|
|
560
|
-
datasourceUid: undefined
|
|
561
|
-
});
|
|
562
|
-
}
|
|
563
|
-
setShowInternalLink(!showInternalLink);
|
|
564
570
|
}
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
571
|
+
) }),
|
|
572
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.row, children: [
|
|
573
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
574
|
+
Switch,
|
|
575
|
+
{
|
|
576
|
+
labelClass: "width-6",
|
|
577
|
+
label: "Internal link",
|
|
578
|
+
checked: showInternalLink,
|
|
579
|
+
onChange: () => {
|
|
580
|
+
if (showInternalLink) {
|
|
581
|
+
onChange({
|
|
582
|
+
...value,
|
|
583
|
+
datasourceUid: undefined
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
setShowInternalLink(!showInternalLink);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
),
|
|
590
|
+
showInternalLink && /* @__PURE__ */ jsxRuntime.jsx(
|
|
591
|
+
DataSourcePicker,
|
|
592
|
+
{
|
|
593
|
+
onChange: (ds) => {
|
|
594
|
+
onChange({
|
|
595
|
+
...value,
|
|
596
|
+
datasourceUid: ds.uid
|
|
597
|
+
});
|
|
598
|
+
},
|
|
599
|
+
current: value.datasourceUid
|
|
600
|
+
}
|
|
601
|
+
)
|
|
602
|
+
] })
|
|
603
|
+
] });
|
|
578
604
|
};
|
|
579
605
|
function useInternalLink(datasourceUid) {
|
|
580
606
|
const [showInternalLink, setShowInternalLink] = React.useState(!!datasourceUid);
|
|
@@ -603,49 +629,56 @@ const DataLinks = (props) => {
|
|
|
603
629
|
const { value, onChange } = props;
|
|
604
630
|
const theme = ui.useTheme2();
|
|
605
631
|
const styles = getStyles$o(theme);
|
|
606
|
-
return /* @__PURE__ */
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
onChange: (newField) => {
|
|
614
|
-
const newDataLinks = [...value];
|
|
615
|
-
newDataLinks.splice(index, 1, newField);
|
|
616
|
-
onChange(newDataLinks);
|
|
617
|
-
},
|
|
618
|
-
onDelete: () => {
|
|
619
|
-
const newDataLinks = [...value];
|
|
620
|
-
newDataLinks.splice(index, 1);
|
|
621
|
-
onChange(newDataLinks);
|
|
622
|
-
},
|
|
623
|
-
suggestions: [
|
|
632
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
633
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "page-heading", children: "Data links" }),
|
|
634
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.infoText, children: "Add links to existing fields. Links will be shown in log row details next to the field value." }),
|
|
635
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "gf-form-group", children: [
|
|
636
|
+
value && value.map((field, index) => {
|
|
637
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
638
|
+
DataLink,
|
|
624
639
|
{
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
640
|
+
className: styles.dataLink,
|
|
641
|
+
value: field,
|
|
642
|
+
onChange: (newField) => {
|
|
643
|
+
const newDataLinks = [...value];
|
|
644
|
+
newDataLinks.splice(index, 1, newField);
|
|
645
|
+
onChange(newDataLinks);
|
|
646
|
+
},
|
|
647
|
+
onDelete: () => {
|
|
648
|
+
const newDataLinks = [...value];
|
|
649
|
+
newDataLinks.splice(index, 1);
|
|
650
|
+
onChange(newDataLinks);
|
|
651
|
+
},
|
|
652
|
+
suggestions: [
|
|
653
|
+
{
|
|
654
|
+
value: data.DataLinkBuiltInVars.valueRaw,
|
|
655
|
+
label: "Raw value",
|
|
656
|
+
documentation: "Raw value of the field",
|
|
657
|
+
origin: data.VariableOrigin.Value
|
|
658
|
+
}
|
|
659
|
+
]
|
|
660
|
+
},
|
|
661
|
+
index
|
|
662
|
+
);
|
|
663
|
+
}),
|
|
664
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
665
|
+
ui.Button,
|
|
666
|
+
{
|
|
667
|
+
variant: "secondary",
|
|
668
|
+
className: css.css`
|
|
638
669
|
margin-right: 10px;
|
|
639
670
|
`,
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
671
|
+
icon: "plus",
|
|
672
|
+
onClick: (event) => {
|
|
673
|
+
event.preventDefault();
|
|
674
|
+
const newDataLinks = [...value || [], { field: "", label: "", matcherRegex: "", url: "" }];
|
|
675
|
+
onChange(newDataLinks);
|
|
676
|
+
},
|
|
677
|
+
children: "Add"
|
|
678
|
+
}
|
|
679
|
+
) })
|
|
680
|
+
] })
|
|
681
|
+
] });
|
|
649
682
|
};
|
|
650
683
|
|
|
651
684
|
var QueryEditorPropertyType = /* @__PURE__ */ ((QueryEditorPropertyType2) => {
|
|
@@ -666,21 +699,19 @@ var QueryEditorExpressionType = /* @__PURE__ */ ((QueryEditorExpressionType2) =>
|
|
|
666
699
|
function getRawSqlFn(db) {
|
|
667
700
|
return db.toRawSql ? db.toRawSql : (query) => toRawSql(query, Boolean(db.disableDatasets));
|
|
668
701
|
}
|
|
669
|
-
function toRawSql({ sql, dataset, table }, disableDatasets) {
|
|
702
|
+
function toRawSql({ sql, dataset, catalog, table }, disableDatasets) {
|
|
670
703
|
var _a, _b, _c, _d;
|
|
671
704
|
let rawQuery = "";
|
|
672
705
|
if (!sql || !haveColumns(sql.columns)) {
|
|
673
706
|
return rawQuery;
|
|
674
707
|
}
|
|
675
708
|
rawQuery += createSelectClause(sql.columns);
|
|
676
|
-
if (
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
}
|
|
680
|
-
} else {
|
|
681
|
-
|
|
682
|
-
rawQuery += `FROM ${dataset}.${table} `;
|
|
683
|
-
}
|
|
709
|
+
if (catalog && dataset && table) {
|
|
710
|
+
rawQuery += `FROM ${catalog}.${dataset}.${table} `;
|
|
711
|
+
} else if (!disableDatasets && dataset && table) {
|
|
712
|
+
rawQuery += `FROM ${dataset}.${table} `;
|
|
713
|
+
} else if (table) {
|
|
714
|
+
rawQuery += `FROM ${table} `;
|
|
684
715
|
}
|
|
685
716
|
if (sql.whereString) {
|
|
686
717
|
rawQuery += `WHERE ${sql.whereString} `;
|
|
@@ -2207,6 +2238,8 @@ const defaultTableNameParser = (token) => {
|
|
|
2207
2238
|
return { table: parts[0] };
|
|
2208
2239
|
} else if ((parts == null ? undefined : parts.length) === 2) {
|
|
2209
2240
|
return { schema: parts[0], table: parts[1] };
|
|
2241
|
+
} else if ((parts == null ? undefined : parts.length) === 3) {
|
|
2242
|
+
return { catalog: parts[0], schema: parts[1], table: parts[2] };
|
|
2210
2243
|
}
|
|
2211
2244
|
return null;
|
|
2212
2245
|
};
|
|
@@ -2930,39 +2963,42 @@ const SQLEditor = ({
|
|
|
2930
2963
|
stableOnChange && stableOnChange(text, false);
|
|
2931
2964
|
onBlur && onBlur(text);
|
|
2932
2965
|
};
|
|
2933
|
-
return /* @__PURE__ */
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
stableOnChange
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
stableOnChange
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2966
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width }, children: [
|
|
2967
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2968
|
+
ui.CodeEditor,
|
|
2969
|
+
{
|
|
2970
|
+
height: height || "240px",
|
|
2971
|
+
width: width ? `${width - 2}px` : undefined,
|
|
2972
|
+
language: id,
|
|
2973
|
+
value: query,
|
|
2974
|
+
onBlur: onSqlBlur,
|
|
2975
|
+
showMiniMap: false,
|
|
2976
|
+
showLineNumbers: true,
|
|
2977
|
+
onEditorDidMount: (editor, m) => {
|
|
2978
|
+
monacoRef.current = editor;
|
|
2979
|
+
editor.onDidChangeModelContent((e) => {
|
|
2980
|
+
const text = editor.getValue();
|
|
2981
|
+
if (stableOnChange) {
|
|
2982
|
+
stableOnChange(text, false);
|
|
2983
|
+
}
|
|
2984
|
+
});
|
|
2985
|
+
editor.addCommand(m.KeyMod.CtrlCmd | m.KeyCode.Enter, () => {
|
|
2986
|
+
const text = editor.getValue();
|
|
2987
|
+
if (stableOnChange) {
|
|
2988
|
+
stableOnChange(text, true);
|
|
2989
|
+
}
|
|
2990
|
+
});
|
|
2991
|
+
editor.onKeyUp((e) => {
|
|
2992
|
+
if (e.keyCode === 84) {
|
|
2993
|
+
editor.trigger(TRIGGER_SUGGEST.id, TRIGGER_SUGGEST.id, {});
|
|
2994
|
+
}
|
|
2995
|
+
});
|
|
2996
|
+
registerLanguageAndSuggestions(m, language, id);
|
|
2997
|
+
}
|
|
2963
2998
|
}
|
|
2964
|
-
|
|
2965
|
-
|
|
2999
|
+
),
|
|
3000
|
+
children && children({ formatQuery })
|
|
3001
|
+
] });
|
|
2966
3002
|
};
|
|
2967
3003
|
const resolveLanguage = (monaco, languageDefinitionProp) => {
|
|
2968
3004
|
if ((languageDefinitionProp == null ? undefined : languageDefinitionProp.id) !== STANDARD_SQL_LANGUAGE && !languageDefinitionProp.loader) {
|
|
@@ -5480,10 +5516,10 @@ const toOption = (_a = data.toOption) != null ? _a : backWardToOption;
|
|
|
5480
5516
|
|
|
5481
5517
|
const EditorStack = ({ children, wrap: wrapItems = true, ...props }) => {
|
|
5482
5518
|
var _a, _b;
|
|
5483
|
-
return /* @__PURE__ */
|
|
5519
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { wrap: wrapItems ? "wrap" : undefined, direction: (_a = props.direction) != null ? _a : "row", gap: (_b = props.gap) != null ? _b : 2, ...props, children });
|
|
5484
5520
|
};
|
|
5485
5521
|
|
|
5486
|
-
const EditorList =
|
|
5522
|
+
const EditorList = React.forwardRef(function EditorList2({ items, renderItem, onChange }, ref) {
|
|
5487
5523
|
const onAddItem = () => {
|
|
5488
5524
|
const newItems = [...items, {}];
|
|
5489
5525
|
onChange(newItems);
|
|
@@ -5498,16 +5534,19 @@ const EditorList = React__namespace.default.forwardRef(function EditorList2({ it
|
|
|
5498
5534
|
newItems.splice(itemIndex, 1);
|
|
5499
5535
|
onChange(newItems);
|
|
5500
5536
|
};
|
|
5501
|
-
return /* @__PURE__ */
|
|
5502
|
-
item,
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5537
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(EditorStack, { children: [
|
|
5538
|
+
items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx("div", { children: renderItem(
|
|
5539
|
+
item,
|
|
5540
|
+
(newItem) => onChangeItem(index, newItem),
|
|
5541
|
+
() => onDeleteItem(index)
|
|
5542
|
+
) }, index)),
|
|
5543
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { ref, onClick: onAddItem, variant: "secondary", size: "md", icon: "plus", "aria-label": "Add", type: "button" })
|
|
5544
|
+
] });
|
|
5506
5545
|
});
|
|
5507
5546
|
|
|
5508
5547
|
const AccessoryButton = ({ className, ...props }) => {
|
|
5509
5548
|
const styles = ui.useStyles2(getButtonStyles);
|
|
5510
|
-
return /* @__PURE__ */
|
|
5549
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { ...props, className: css.cx(className, styles.button) });
|
|
5511
5550
|
};
|
|
5512
5551
|
const getButtonStyles = (theme) => ({
|
|
5513
5552
|
button: css.css({
|
|
@@ -5524,7 +5563,7 @@ const InputGroup = ({ children }) => {
|
|
|
5524
5563
|
}
|
|
5525
5564
|
return child;
|
|
5526
5565
|
});
|
|
5527
|
-
return /* @__PURE__ */
|
|
5566
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.root, children: modifiedChildren });
|
|
5528
5567
|
};
|
|
5529
5568
|
const borderPriority = [
|
|
5530
5569
|
"",
|
|
@@ -5585,7 +5624,7 @@ function GroupByRow({ sql, columns, onSqlChange }) {
|
|
|
5585
5624
|
},
|
|
5586
5625
|
[onSqlChange, sql]
|
|
5587
5626
|
);
|
|
5588
|
-
return /* @__PURE__ */
|
|
5627
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5589
5628
|
EditorList,
|
|
5590
5629
|
{
|
|
5591
5630
|
items: sql.groupBy,
|
|
@@ -5599,27 +5638,30 @@ function GroupByRow({ sql, columns, onSqlChange }) {
|
|
|
5599
5638
|
function makeRenderColumn({ options }) {
|
|
5600
5639
|
const renderColumn = function(item, onChangeItem, onDeleteItem) {
|
|
5601
5640
|
var _a;
|
|
5602
|
-
return /* @__PURE__ */
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5641
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(InputGroup, { children: [
|
|
5642
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5643
|
+
ui.Select,
|
|
5644
|
+
{
|
|
5645
|
+
value: ((_a = item.property) == null ? undefined : _a.name) ? data.toOption(item.property.name) : null,
|
|
5646
|
+
"aria-label": "Group by",
|
|
5647
|
+
options,
|
|
5648
|
+
menuShouldPortal: true,
|
|
5649
|
+
onChange: ({ value }) => value && onChangeItem(setGroupByField(value))
|
|
5650
|
+
}
|
|
5651
|
+
),
|
|
5652
|
+
/* @__PURE__ */ jsxRuntime.jsx(AccessoryButton, { "aria-label": "Remove group by column", icon: "times", variant: "secondary", onClick: onDeleteItem })
|
|
5653
|
+
] });
|
|
5612
5654
|
};
|
|
5613
5655
|
return renderColumn;
|
|
5614
5656
|
}
|
|
5615
5657
|
|
|
5616
5658
|
const EditorFieldGroup = ({ children }) => {
|
|
5617
|
-
return /* @__PURE__ */
|
|
5659
|
+
return /* @__PURE__ */ jsxRuntime.jsx(EditorStack, { gap: 1, children });
|
|
5618
5660
|
};
|
|
5619
5661
|
|
|
5620
5662
|
const EditorHeader = ({ children }) => {
|
|
5621
5663
|
const styles = ui.useStyles2(getStyles$m);
|
|
5622
|
-
return /* @__PURE__ */
|
|
5664
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.root, children });
|
|
5623
5665
|
};
|
|
5624
5666
|
const getStyles$m = (theme) => ({
|
|
5625
5667
|
root: css.css({
|
|
@@ -5636,8 +5678,15 @@ const EditorField$1 = (props) => {
|
|
|
5636
5678
|
const { label, optional, tooltip, tooltipInteractive, children, width, ...fieldProps } = props;
|
|
5637
5679
|
const styles = ui.useStyles2(getStyles$l, width);
|
|
5638
5680
|
const childInputId = (fieldProps == null ? undefined : fieldProps.htmlFor) || ((_a = ui.ReactUtils) == null ? undefined : _a.getChildId(children));
|
|
5639
|
-
const labelEl = /* @__PURE__ */
|
|
5640
|
-
|
|
5681
|
+
const labelEl = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5682
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: styles.label, htmlFor: childInputId, children: [
|
|
5683
|
+
label,
|
|
5684
|
+
optional && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.optional, children: " - optional" }),
|
|
5685
|
+
tooltip && /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { placement: "top", content: tooltip, theme: "info", interactive: tooltipInteractive, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Icon, { tabIndex: 0, name: "info-circle", size: "sm", className: styles.icon }) })
|
|
5686
|
+
] }),
|
|
5687
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Space, { v: 0.5 })
|
|
5688
|
+
] });
|
|
5689
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.root, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Field, { className: styles.field, label: labelEl, ...fieldProps, children }) });
|
|
5641
5690
|
};
|
|
5642
5691
|
const getStyles$l = (theme, width) => {
|
|
5643
5692
|
return {
|
|
@@ -5668,7 +5717,7 @@ const getStyles$l = (theme, width) => {
|
|
|
5668
5717
|
|
|
5669
5718
|
const EditorRow$1 = ({ children }) => {
|
|
5670
5719
|
const styles = ui.useStyles2(getStyles$k);
|
|
5671
|
-
return /* @__PURE__ */
|
|
5720
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.root, children: /* @__PURE__ */ jsxRuntime.jsx(EditorStack, { gap: 2, children }) });
|
|
5672
5721
|
};
|
|
5673
5722
|
const getStyles$k = (theme) => {
|
|
5674
5723
|
return {
|
|
@@ -5681,12 +5730,12 @@ const getStyles$k = (theme) => {
|
|
|
5681
5730
|
};
|
|
5682
5731
|
|
|
5683
5732
|
const EditorRows$1 = ({ children }) => {
|
|
5684
|
-
return /* @__PURE__ */
|
|
5733
|
+
return /* @__PURE__ */ jsxRuntime.jsx(EditorStack, { gap: 0.5, direction: "column", children });
|
|
5685
5734
|
};
|
|
5686
5735
|
|
|
5687
5736
|
const EditorSwitch = (props) => {
|
|
5688
5737
|
const styles = getStyles$j();
|
|
5689
|
-
return /* @__PURE__ */
|
|
5738
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.switch, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Switch, { ...props }) });
|
|
5690
5739
|
};
|
|
5691
5740
|
const getStyles$j = () => {
|
|
5692
5741
|
return {
|
|
@@ -5699,7 +5748,7 @@ const getStyles$j = () => {
|
|
|
5699
5748
|
};
|
|
5700
5749
|
|
|
5701
5750
|
const FlexItem = ({ grow, shrink }) => {
|
|
5702
|
-
return /* @__PURE__ */
|
|
5751
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "block", flexGrow: grow, flexShrink: shrink } });
|
|
5703
5752
|
};
|
|
5704
5753
|
|
|
5705
5754
|
function getDefaultExportFromCjs (x) {
|
|
@@ -5714,17 +5763,24 @@ function InlineSelect({ label: labelProp, ...props }) {
|
|
|
5714
5763
|
ValueContainer,
|
|
5715
5764
|
SingleValue: ValueContainer
|
|
5716
5765
|
};
|
|
5717
|
-
return /* @__PURE__ */
|
|
5766
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.root, children: [
|
|
5767
|
+
labelProp && /* @__PURE__ */ jsxRuntime.jsxs("label", { className: styles.label, htmlFor: id, children: [
|
|
5768
|
+
labelProp,
|
|
5769
|
+
":",
|
|
5770
|
+
"\xA0"
|
|
5771
|
+
] }),
|
|
5772
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Select, { openMenuOnFocus: true, inputId: id, ...props, components })
|
|
5773
|
+
] });
|
|
5718
5774
|
}
|
|
5719
5775
|
const SelectContainer = (props) => {
|
|
5720
5776
|
const { children } = props;
|
|
5721
5777
|
const styles = ui.useStyles2(getSelectStyles);
|
|
5722
|
-
return /* @__PURE__ */
|
|
5778
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.SelectContainer, { ...props, className: css.cx(props.className, styles.container), children });
|
|
5723
5779
|
};
|
|
5724
5780
|
const ValueContainer = (props) => {
|
|
5725
5781
|
const { className, children } = props;
|
|
5726
5782
|
const styles = ui.useStyles2(getSelectStyles);
|
|
5727
|
-
return /* @__PURE__ */
|
|
5783
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: css.cx(className, styles.valueContainer), children });
|
|
5728
5784
|
};
|
|
5729
5785
|
const getSelectStyles = (theme) => ({
|
|
5730
5786
|
root: css.css({
|
|
@@ -5752,7 +5808,7 @@ const getSelectStyles = (theme) => ({
|
|
|
5752
5808
|
const Space = (props) => {
|
|
5753
5809
|
const theme = ui.useTheme2();
|
|
5754
5810
|
const styles = getStyles$i(theme, props);
|
|
5755
|
-
return /* @__PURE__ */
|
|
5811
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: css.cx(styles.wrapper) });
|
|
5756
5812
|
};
|
|
5757
5813
|
Space.defaultProps = {
|
|
5758
5814
|
v: 0,
|
|
@@ -5785,37 +5841,49 @@ function ConfirmModal({ isOpen, onCancel, onDiscard, onCopy }) {
|
|
|
5785
5841
|
(_a = buttonRef.current) == null ? undefined : _a.focus();
|
|
5786
5842
|
}
|
|
5787
5843
|
}, [isOpen]);
|
|
5788
|
-
return /* @__PURE__ */
|
|
5844
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5789
5845
|
ui.Modal,
|
|
5790
5846
|
{
|
|
5791
|
-
title: /* @__PURE__ */
|
|
5847
|
+
title: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "modal-header-title", children: [
|
|
5848
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Icon, { name: "exclamation-triangle", size: "lg" }),
|
|
5849
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "p-l-1", children: "Warning" })
|
|
5850
|
+
] }),
|
|
5792
5851
|
onDismiss: onCancel,
|
|
5793
|
-
isOpen
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5852
|
+
isOpen,
|
|
5853
|
+
children: [
|
|
5854
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { children: "Builder mode does not display changes made in code. The query builder will display the last changes you made in builder mode." }),
|
|
5855
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { children: "Do you want to copy your code to the clipboard?" }),
|
|
5856
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Modal.ButtonRow, { children: [
|
|
5857
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { type: "button", variant: "secondary", onClick: onCancel, fill: "outline", children: "Cancel" }),
|
|
5858
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "destructive", type: "button", onClick: onDiscard, ref: buttonRef, children: "Discard code and switch" }),
|
|
5859
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: onCopy, children: "Copy code and switch" })
|
|
5860
|
+
] })
|
|
5861
|
+
]
|
|
5862
|
+
}
|
|
5798
5863
|
);
|
|
5799
5864
|
}
|
|
5800
5865
|
|
|
5801
5866
|
const DatasetSelector = ({
|
|
5802
5867
|
db,
|
|
5803
5868
|
dataset,
|
|
5869
|
+
catalog,
|
|
5804
5870
|
value,
|
|
5805
5871
|
onChange,
|
|
5806
5872
|
disabled,
|
|
5807
5873
|
className,
|
|
5808
5874
|
applyDefault,
|
|
5809
|
-
inputId
|
|
5875
|
+
inputId,
|
|
5876
|
+
enableCatalogs,
|
|
5877
|
+
"data-testid": dataTestId
|
|
5810
5878
|
}) => {
|
|
5811
5879
|
const state = reactUse.useAsync(async () => {
|
|
5812
5880
|
if (dataset) {
|
|
5813
5881
|
onChange(toOption(dataset));
|
|
5814
5882
|
return [toOption(dataset)];
|
|
5815
5883
|
}
|
|
5816
|
-
const datasets = await db.datasets();
|
|
5884
|
+
const datasets = await db.datasets(catalog);
|
|
5817
5885
|
return datasets.map(toOption);
|
|
5818
|
-
}, []);
|
|
5886
|
+
}, [catalog]);
|
|
5819
5887
|
React.useEffect(() => {
|
|
5820
5888
|
if (!applyDefault) {
|
|
5821
5889
|
return;
|
|
@@ -5832,7 +5900,7 @@ const DatasetSelector = ({
|
|
|
5832
5900
|
}
|
|
5833
5901
|
}
|
|
5834
5902
|
}, [state.value, value, applyDefault, onChange]);
|
|
5835
|
-
return /* @__PURE__ */
|
|
5903
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5836
5904
|
ui.Select,
|
|
5837
5905
|
{
|
|
5838
5906
|
inputId,
|
|
@@ -5843,25 +5911,83 @@ const DatasetSelector = ({
|
|
|
5843
5911
|
onChange,
|
|
5844
5912
|
disabled,
|
|
5845
5913
|
isLoading: state.loading,
|
|
5914
|
+
menuShouldPortal: true,
|
|
5915
|
+
"data-testid": dataTestId,
|
|
5916
|
+
placeholder: enableCatalogs ? "Select schema" : "Select dataset"
|
|
5917
|
+
}
|
|
5918
|
+
);
|
|
5919
|
+
};
|
|
5920
|
+
|
|
5921
|
+
const CatalogSelector = ({ db, inputId, value, onChange }) => {
|
|
5922
|
+
const [catalogs, setCatalogs] = React.useState([]);
|
|
5923
|
+
const [isLoading, setIsLoading] = React.useState(false);
|
|
5924
|
+
const loadCatalogs = React.useCallback(async () => {
|
|
5925
|
+
if (!db.catalogs) {
|
|
5926
|
+
return;
|
|
5927
|
+
}
|
|
5928
|
+
setIsLoading(true);
|
|
5929
|
+
try {
|
|
5930
|
+
const catalogList = await db.catalogs();
|
|
5931
|
+
const catalogOptions = catalogList.map((catalog) => ({
|
|
5932
|
+
label: catalog,
|
|
5933
|
+
value: catalog
|
|
5934
|
+
}));
|
|
5935
|
+
setCatalogs(catalogOptions);
|
|
5936
|
+
} catch (error) {
|
|
5937
|
+
console.error("Error loading catalogs:", error);
|
|
5938
|
+
setCatalogs([]);
|
|
5939
|
+
} finally {
|
|
5940
|
+
setIsLoading(false);
|
|
5941
|
+
}
|
|
5942
|
+
}, [db]);
|
|
5943
|
+
React.useEffect(() => {
|
|
5944
|
+
loadCatalogs();
|
|
5945
|
+
}, [db, loadCatalogs]);
|
|
5946
|
+
const handleChange = (selectable) => {
|
|
5947
|
+
onChange((selectable == null ? undefined : selectable.value) || null);
|
|
5948
|
+
};
|
|
5949
|
+
const selectedValue = catalogs.find((catalog) => catalog.value === value) || null;
|
|
5950
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5951
|
+
ui.Select,
|
|
5952
|
+
{
|
|
5953
|
+
inputId,
|
|
5954
|
+
options: catalogs,
|
|
5955
|
+
value: selectedValue,
|
|
5956
|
+
onChange: handleChange,
|
|
5957
|
+
isLoading,
|
|
5958
|
+
placeholder: "Select catalog",
|
|
5959
|
+
isClearable: true,
|
|
5960
|
+
allowCustomValue: true,
|
|
5846
5961
|
menuShouldPortal: true
|
|
5847
5962
|
}
|
|
5848
5963
|
);
|
|
5849
5964
|
};
|
|
5850
5965
|
|
|
5851
|
-
const TableSelector = ({
|
|
5966
|
+
const TableSelector = ({
|
|
5967
|
+
db,
|
|
5968
|
+
dataset,
|
|
5969
|
+
catalog,
|
|
5970
|
+
value,
|
|
5971
|
+
className,
|
|
5972
|
+
onChange,
|
|
5973
|
+
inputId,
|
|
5974
|
+
enableCatalogs
|
|
5975
|
+
}) => {
|
|
5852
5976
|
const state = reactUse.useAsync(async () => {
|
|
5853
|
-
if (!dataset) {
|
|
5977
|
+
if (!dataset && !catalog) {
|
|
5978
|
+
return [];
|
|
5979
|
+
}
|
|
5980
|
+
if (enableCatalogs && (!catalog || !dataset)) {
|
|
5854
5981
|
return [];
|
|
5855
5982
|
}
|
|
5856
|
-
const tables = await db.tables(dataset);
|
|
5983
|
+
const tables = await db.tables(dataset, catalog);
|
|
5857
5984
|
return tables.map(data.toOption);
|
|
5858
|
-
}, [dataset]);
|
|
5859
|
-
return /* @__PURE__ */
|
|
5985
|
+
}, [dataset, catalog, enableCatalogs]);
|
|
5986
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5860
5987
|
ui.Select,
|
|
5861
5988
|
{
|
|
5862
5989
|
inputId,
|
|
5863
5990
|
className,
|
|
5864
|
-
disabled: state.loading,
|
|
5865
5991
|
"aria-label": "Table selector",
|
|
5866
5992
|
value,
|
|
5867
5993
|
options: state.value,
|
|
@@ -5886,7 +6012,7 @@ const RunQueryButton = ({
|
|
|
5886
6012
|
if (queryRunning) {
|
|
5887
6013
|
icon = "fa fa-spinner";
|
|
5888
6014
|
}
|
|
5889
|
-
const RunButton = /* @__PURE__ */
|
|
6015
|
+
const RunButton = /* @__PURE__ */ jsxRuntime.jsx(
|
|
5890
6016
|
ui.Button,
|
|
5891
6017
|
{
|
|
5892
6018
|
"aria-label": ariaLabel,
|
|
@@ -5895,18 +6021,22 @@ const RunQueryButton = ({
|
|
|
5895
6021
|
icon,
|
|
5896
6022
|
disabled: disabled || queryRunning,
|
|
5897
6023
|
onClick,
|
|
5898
|
-
"data-testid": dataTestId
|
|
5899
|
-
|
|
5900
|
-
|
|
6024
|
+
"data-testid": dataTestId,
|
|
6025
|
+
children: "Run query"
|
|
6026
|
+
}
|
|
5901
6027
|
);
|
|
5902
|
-
return queryInvalid ? /* @__PURE__ */
|
|
6028
|
+
return queryInvalid ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5903
6029
|
ui.Tooltip,
|
|
5904
6030
|
{
|
|
5905
6031
|
theme: "error",
|
|
5906
6032
|
placement: "top",
|
|
5907
|
-
content: invalidQueryTooltip != null ? invalidQueryTooltip : /* @__PURE__ */
|
|
5908
|
-
|
|
5909
|
-
|
|
6033
|
+
content: invalidQueryTooltip != null ? invalidQueryTooltip : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6034
|
+
"Your query is invalid. Check below for details. ",
|
|
6035
|
+
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
6036
|
+
"However, you can still run this query."
|
|
6037
|
+
] }),
|
|
6038
|
+
children: RunButton
|
|
6039
|
+
}
|
|
5910
6040
|
) : RunButton;
|
|
5911
6041
|
};
|
|
5912
6042
|
|
|
@@ -5918,6 +6048,7 @@ function QueryHeader({
|
|
|
5918
6048
|
db,
|
|
5919
6049
|
defaultDataset,
|
|
5920
6050
|
enableDatasets,
|
|
6051
|
+
enableCatalogs,
|
|
5921
6052
|
query,
|
|
5922
6053
|
queryRowFilter,
|
|
5923
6054
|
onChange,
|
|
@@ -5931,6 +6062,8 @@ function QueryHeader({
|
|
|
5931
6062
|
const [showConfirm, setShowConfirm] = React.useState(false);
|
|
5932
6063
|
const toRawSql = getRawSqlFn(db);
|
|
5933
6064
|
const htmlId = React.useId();
|
|
6065
|
+
const catalogsEnabled = enableCatalogs != null ? enableCatalogs : db.disableCatalogs === false;
|
|
6066
|
+
const effectiveEnableDatasets = catalogsEnabled ? true : enableDatasets;
|
|
5934
6067
|
const onEditorModeChange = React.useCallback(
|
|
5935
6068
|
(newEditorMode) => {
|
|
5936
6069
|
if (editorMode === EditorMode.Code) {
|
|
@@ -5946,12 +6079,29 @@ function QueryHeader({
|
|
|
5946
6079
|
onChange(next);
|
|
5947
6080
|
};
|
|
5948
6081
|
const onDatasetChange = (e) => {
|
|
5949
|
-
|
|
6082
|
+
const datasetValue = e.value || undefined;
|
|
6083
|
+
if (datasetValue === query.dataset) {
|
|
5950
6084
|
return;
|
|
5951
6085
|
}
|
|
5952
6086
|
const next = {
|
|
5953
6087
|
...query,
|
|
5954
|
-
dataset:
|
|
6088
|
+
dataset: datasetValue,
|
|
6089
|
+
table: undefined,
|
|
6090
|
+
sql: undefined,
|
|
6091
|
+
rawSql: ""
|
|
6092
|
+
};
|
|
6093
|
+
onChange(next);
|
|
6094
|
+
};
|
|
6095
|
+
const onCatalogChange = (catalog) => {
|
|
6096
|
+
const catalogValue = catalog || undefined;
|
|
6097
|
+
if (catalogValue === query.catalog) {
|
|
6098
|
+
return;
|
|
6099
|
+
}
|
|
6100
|
+
const next = {
|
|
6101
|
+
...query,
|
|
6102
|
+
catalog: catalogValue,
|
|
6103
|
+
dataset: undefined,
|
|
6104
|
+
// Reset dataset (which acts as schema when catalog is present)
|
|
5955
6105
|
table: undefined,
|
|
5956
6106
|
sql: undefined,
|
|
5957
6107
|
rawSql: ""
|
|
@@ -5970,100 +6120,141 @@ function QueryHeader({
|
|
|
5970
6120
|
};
|
|
5971
6121
|
onChange(next);
|
|
5972
6122
|
};
|
|
5973
|
-
return /* @__PURE__ */
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6123
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6124
|
+
/* @__PURE__ */ jsxRuntime.jsxs(EditorHeader, { children: [
|
|
6125
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6126
|
+
InlineSelect,
|
|
6127
|
+
{
|
|
6128
|
+
label: "Format",
|
|
6129
|
+
value: query.format,
|
|
6130
|
+
placeholder: "Select format",
|
|
6131
|
+
menuShouldPortal: true,
|
|
6132
|
+
onChange: onFormatChange,
|
|
6133
|
+
options: QUERY_FORMAT_OPTIONS
|
|
6134
|
+
}
|
|
6135
|
+
),
|
|
6136
|
+
editorMode === EditorMode.Builder && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6137
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6138
|
+
ui.InlineSwitch,
|
|
6139
|
+
{
|
|
6140
|
+
id: `sql-filter-${htmlId}`,
|
|
6141
|
+
label: "Filter",
|
|
6142
|
+
transparent: true,
|
|
6143
|
+
showLabel: true,
|
|
6144
|
+
value: queryRowFilter.filter,
|
|
6145
|
+
onChange: (ev) => ev.target instanceof HTMLInputElement && onQueryRowChange({ ...queryRowFilter, filter: ev.target.checked })
|
|
6146
|
+
}
|
|
6147
|
+
),
|
|
6148
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6149
|
+
ui.InlineSwitch,
|
|
6150
|
+
{
|
|
6151
|
+
id: `sql-group-${htmlId}`,
|
|
6152
|
+
label: "Group",
|
|
6153
|
+
transparent: true,
|
|
6154
|
+
showLabel: true,
|
|
6155
|
+
value: queryRowFilter.group,
|
|
6156
|
+
onChange: (ev) => ev.target instanceof HTMLInputElement && onQueryRowChange({ ...queryRowFilter, group: ev.target.checked })
|
|
6157
|
+
}
|
|
6158
|
+
),
|
|
6159
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6160
|
+
ui.InlineSwitch,
|
|
6161
|
+
{
|
|
6162
|
+
id: `sql-order-${htmlId}`,
|
|
6163
|
+
label: "Order",
|
|
6164
|
+
transparent: true,
|
|
6165
|
+
showLabel: true,
|
|
6166
|
+
value: queryRowFilter.order,
|
|
6167
|
+
onChange: (ev) => ev.target instanceof HTMLInputElement && onQueryRowChange({ ...queryRowFilter, order: ev.target.checked })
|
|
6168
|
+
}
|
|
6169
|
+
),
|
|
6170
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6171
|
+
ui.InlineSwitch,
|
|
6172
|
+
{
|
|
6173
|
+
id: `sql-preview-${htmlId}`,
|
|
6174
|
+
label: "Preview",
|
|
6175
|
+
transparent: true,
|
|
6176
|
+
showLabel: true,
|
|
6177
|
+
value: queryRowFilter.preview,
|
|
6178
|
+
onChange: (ev) => ev.target instanceof HTMLInputElement && onQueryRowChange({ ...queryRowFilter, preview: ev.target.checked })
|
|
6179
|
+
}
|
|
6180
|
+
)
|
|
6181
|
+
] }),
|
|
6182
|
+
/* @__PURE__ */ jsxRuntime.jsx(FlexItem, { grow: 1 }),
|
|
6183
|
+
/* @__PURE__ */ jsxRuntime.jsx(RunQueryButton, { queryInvalid: !isQueryRunnable, onClick: () => onRunQuery() }),
|
|
6184
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.RadioButtonGroup, { options: editorModes$1, size: "sm", value: editorMode, onChange: onEditorModeChange }),
|
|
6185
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6186
|
+
ConfirmModal,
|
|
6187
|
+
{
|
|
6188
|
+
isOpen: showConfirm,
|
|
6189
|
+
onCopy: () => {
|
|
6190
|
+
setShowConfirm(false);
|
|
6191
|
+
copyToClipboard(query.rawSql);
|
|
6192
|
+
onChange({
|
|
6193
|
+
...query,
|
|
6194
|
+
rawSql: toRawSql(query),
|
|
6195
|
+
editorMode: EditorMode.Builder
|
|
6196
|
+
});
|
|
6197
|
+
},
|
|
6198
|
+
onDiscard: () => {
|
|
6199
|
+
setShowConfirm(false);
|
|
6200
|
+
onChange({
|
|
6201
|
+
...query,
|
|
6202
|
+
rawSql: toRawSql(query),
|
|
6203
|
+
editorMode: EditorMode.Builder
|
|
6204
|
+
});
|
|
6205
|
+
},
|
|
6206
|
+
onCancel: () => setShowConfirm(false)
|
|
6207
|
+
}
|
|
6208
|
+
)
|
|
6209
|
+
] }),
|
|
6210
|
+
editorMode === EditorMode.Builder && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6211
|
+
/* @__PURE__ */ jsxRuntime.jsx(Space, { v: 0.5 }),
|
|
6212
|
+
/* @__PURE__ */ jsxRuntime.jsxs(EditorRow$1, { children: [
|
|
6213
|
+
catalogsEnabled && /* @__PURE__ */ jsxRuntime.jsx(EditorField$1, { label: labels.get("catalog") || "Catalog", width: 25, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6214
|
+
CatalogSelector,
|
|
6215
|
+
{
|
|
6216
|
+
db,
|
|
6217
|
+
inputId: `sql-catalog-${htmlId}`,
|
|
6218
|
+
value: query.catalog === undefined ? null : query.catalog,
|
|
6219
|
+
onChange: onCatalogChange
|
|
6220
|
+
}
|
|
6221
|
+
) }),
|
|
6222
|
+
effectiveEnableDatasets && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6223
|
+
EditorField$1,
|
|
6224
|
+
{
|
|
6225
|
+
label: catalogsEnabled ? labels.get("schema") || "Schema" : labels.get("dataset") || "Dataset",
|
|
6226
|
+
width: 25,
|
|
6227
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6228
|
+
DatasetSelector,
|
|
6229
|
+
{
|
|
6230
|
+
db,
|
|
6231
|
+
inputId: catalogsEnabled ? `sql-schema-${htmlId}` : `sql-dataset-${htmlId}`,
|
|
6232
|
+
"data-testid": catalogsEnabled ? "schema-selector" : "dataset-selector",
|
|
6233
|
+
dataset: catalogsEnabled ? undefined : defaultDataset,
|
|
6234
|
+
value: query.dataset === undefined ? null : query.dataset,
|
|
6235
|
+
onChange: onDatasetChange,
|
|
6236
|
+
catalog: catalogsEnabled ? query.catalog : undefined
|
|
6237
|
+
}
|
|
6238
|
+
)
|
|
6239
|
+
}
|
|
6240
|
+
),
|
|
6241
|
+
/* @__PURE__ */ jsxRuntime.jsx(EditorField$1, { label: labels.get("table") || "Table", width: 25, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6242
|
+
TableSelector,
|
|
6243
|
+
{
|
|
6244
|
+
db,
|
|
6245
|
+
inputId: `sql-table-${htmlId}`,
|
|
6246
|
+
dataset: query.dataset || (catalogsEnabled ? undefined : defaultDataset),
|
|
6247
|
+
catalog: catalogsEnabled ? query.catalog : undefined,
|
|
6248
|
+
query,
|
|
6249
|
+
value: query.table === undefined ? null : query.table,
|
|
6250
|
+
onChange: onTableChange,
|
|
6251
|
+
enableCatalogs: catalogsEnabled,
|
|
6252
|
+
applyDefault: true
|
|
6253
|
+
}
|
|
6254
|
+
) })
|
|
6255
|
+
] })
|
|
6256
|
+
] })
|
|
6257
|
+
] });
|
|
6067
6258
|
}
|
|
6068
6259
|
|
|
6069
6260
|
function formatSQL(q) {
|
|
@@ -6088,16 +6279,16 @@ function QueryEditorRaw({ children, onChange, query, width, height, completionPr
|
|
|
6088
6279
|
},
|
|
6089
6280
|
[onChange]
|
|
6090
6281
|
);
|
|
6091
|
-
return /* @__PURE__ */
|
|
6282
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6092
6283
|
SQLEditor,
|
|
6093
6284
|
{
|
|
6094
6285
|
width,
|
|
6095
6286
|
height,
|
|
6096
6287
|
query: query.rawSql,
|
|
6097
6288
|
onChange: onRawQueryChange,
|
|
6098
|
-
language: { id: "sql", completionProvider, formatter: formatSQL }
|
|
6099
|
-
|
|
6100
|
-
|
|
6289
|
+
language: { id: "sql", completionProvider, formatter: formatSQL },
|
|
6290
|
+
children
|
|
6291
|
+
}
|
|
6101
6292
|
);
|
|
6102
6293
|
}
|
|
6103
6294
|
|
|
@@ -6154,7 +6345,23 @@ function QueryValidator({ db, query, onValidate, range }) {
|
|
|
6154
6345
|
return null;
|
|
6155
6346
|
}
|
|
6156
6347
|
const error = ((_a = state.value) == null ? undefined : _a.error) ? processErrorMessage(state.value.error) : "";
|
|
6157
|
-
return /* @__PURE__ */
|
|
6348
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6349
|
+
state.loading && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.info, children: [
|
|
6350
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Spinner, { inline: true, size: 12 }),
|
|
6351
|
+
" Validating query..."
|
|
6352
|
+
] }),
|
|
6353
|
+
!state.loading && state.value && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6354
|
+
/* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: state.value.isValid && state.value.statistics && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.valid, children: [
|
|
6355
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Icon, { name: "check" }),
|
|
6356
|
+
" This query will process",
|
|
6357
|
+
" ",
|
|
6358
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: data.formattedValueToString(valueFormatter(state.value.statistics.TotalBytesProcessed)) }),
|
|
6359
|
+
" ",
|
|
6360
|
+
"when run."
|
|
6361
|
+
] }) }),
|
|
6362
|
+
/* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: state.value.isError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.error, children: error }) })
|
|
6363
|
+
] })
|
|
6364
|
+
] });
|
|
6158
6365
|
}
|
|
6159
6366
|
function processErrorMessage(error) {
|
|
6160
6367
|
const splat = error.split(":");
|
|
@@ -6200,24 +6407,31 @@ function QueryToolbox({ showTools, onFormatCode, onExpand, isExpanded, ...valida
|
|
|
6200
6407
|
if (!showTools && validationResult === undefined) {
|
|
6201
6408
|
style = { height: 0, padding: 0, visibility: "hidden" };
|
|
6202
6409
|
}
|
|
6203
|
-
return /* @__PURE__ */
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6410
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.container, style, children: [
|
|
6411
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: validatorProps.onValidate && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6412
|
+
QueryValidator,
|
|
6413
|
+
{
|
|
6414
|
+
...validatorProps,
|
|
6415
|
+
onValidate: (result) => {
|
|
6416
|
+
setValidationResult(result);
|
|
6417
|
+
validatorProps.onValidate(result);
|
|
6418
|
+
}
|
|
6210
6419
|
}
|
|
6211
|
-
}
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6420
|
+
) }),
|
|
6421
|
+
showTools && /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsxs(ui.HorizontalGroup, { spacing: "sm", children: [
|
|
6422
|
+
onFormatCode && /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { onClick: onFormatCode, name: "brackets-curly", size: "xs", tooltip: "Format query" }),
|
|
6423
|
+
onExpand && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6424
|
+
ui.IconButton,
|
|
6425
|
+
{
|
|
6426
|
+
onClick: () => onExpand(!isExpanded),
|
|
6427
|
+
name: isExpanded ? "angle-up" : "angle-down",
|
|
6428
|
+
size: "xs",
|
|
6429
|
+
tooltip: isExpanded ? "Collapse editor" : "Expand editor"
|
|
6430
|
+
}
|
|
6431
|
+
),
|
|
6432
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { content: "Hit CTRL/CMD+Return to run query", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Icon, { className: styles.hint, name: "keyboard" }) })
|
|
6433
|
+
] }) })
|
|
6434
|
+
] });
|
|
6221
6435
|
}
|
|
6222
6436
|
|
|
6223
6437
|
function RawEditor({ db, query, onChange, onRunQuery, onValidate, queryToValidate, range }) {
|
|
@@ -6228,39 +6442,39 @@ function RawEditor({ db, query, onChange, onRunQuery, onValidate, queryToValidat
|
|
|
6228
6442
|
const [editorRef, editorMeasure] = reactUse.useMeasure();
|
|
6229
6443
|
const completionProvider = React.useMemo(() => db.getSqlCompletionProvider(), [db]);
|
|
6230
6444
|
const renderQueryEditor = (width, height) => {
|
|
6231
|
-
return /* @__PURE__ */
|
|
6445
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6232
6446
|
QueryEditorRaw,
|
|
6233
6447
|
{
|
|
6234
6448
|
completionProvider,
|
|
6235
6449
|
query,
|
|
6236
6450
|
width,
|
|
6237
6451
|
height: height ? height - toolboxMeasure.height : undefined,
|
|
6238
|
-
onChange
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
}
|
|
6253
|
-
|
|
6452
|
+
onChange,
|
|
6453
|
+
children: ({ formatQuery }) => {
|
|
6454
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: toolboxRef, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6455
|
+
QueryToolbox,
|
|
6456
|
+
{
|
|
6457
|
+
db,
|
|
6458
|
+
query: queryToValidate,
|
|
6459
|
+
onValidate,
|
|
6460
|
+
onFormatCode: formatQuery,
|
|
6461
|
+
showTools: true,
|
|
6462
|
+
range,
|
|
6463
|
+
onExpand: setIsExpanded,
|
|
6464
|
+
isExpanded
|
|
6465
|
+
}
|
|
6466
|
+
) });
|
|
6467
|
+
}
|
|
6254
6468
|
}
|
|
6255
6469
|
);
|
|
6256
6470
|
};
|
|
6257
6471
|
const renderEditor = (standalone = false) => {
|
|
6258
|
-
return standalone ? /* @__PURE__ */
|
|
6472
|
+
return standalone ? /* @__PURE__ */ jsxRuntime.jsx(AutoSizer__default.default, { children: ({ width, height }) => {
|
|
6259
6473
|
return renderQueryEditor(width, height);
|
|
6260
|
-
}) : /* @__PURE__ */
|
|
6474
|
+
} }) : /* @__PURE__ */ jsxRuntime.jsx("div", { ref: editorRef, children: renderQueryEditor() });
|
|
6261
6475
|
};
|
|
6262
6476
|
const renderPlaceholder = () => {
|
|
6263
|
-
return /* @__PURE__ */
|
|
6477
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6264
6478
|
"div",
|
|
6265
6479
|
{
|
|
6266
6480
|
style: {
|
|
@@ -6270,26 +6484,29 @@ function RawEditor({ db, query, onChange, onRunQuery, onValidate, queryToValidat
|
|
|
6270
6484
|
display: "flex",
|
|
6271
6485
|
alignItems: "center",
|
|
6272
6486
|
justifyContent: "center"
|
|
6273
|
-
}
|
|
6274
|
-
|
|
6275
|
-
|
|
6487
|
+
},
|
|
6488
|
+
children: "Editing in expanded code editor"
|
|
6489
|
+
}
|
|
6276
6490
|
);
|
|
6277
6491
|
};
|
|
6278
|
-
return /* @__PURE__ */
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6492
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6493
|
+
isExpanded ? renderPlaceholder() : renderEditor(),
|
|
6494
|
+
isExpanded && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6495
|
+
ui.Modal,
|
|
6496
|
+
{
|
|
6497
|
+
title: `Query ${query.refId}`,
|
|
6498
|
+
closeOnBackdropClick: false,
|
|
6499
|
+
closeOnEscape: false,
|
|
6500
|
+
className: styles.modal,
|
|
6501
|
+
contentClassName: styles.modalContent,
|
|
6502
|
+
isOpen: isExpanded,
|
|
6503
|
+
onDismiss: () => {
|
|
6504
|
+
setIsExpanded(false);
|
|
6505
|
+
},
|
|
6506
|
+
children: renderEditor(true)
|
|
6289
6507
|
}
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
));
|
|
6508
|
+
)
|
|
6509
|
+
] });
|
|
6293
6510
|
}
|
|
6294
6511
|
function getStyles$h(theme) {
|
|
6295
6512
|
return {
|
|
@@ -6307,8 +6524,11 @@ function getStyles$h(theme) {
|
|
|
6307
6524
|
function Preview({ rawSql }) {
|
|
6308
6525
|
const [_, copyToClipboard] = reactUse.useCopyToClipboard();
|
|
6309
6526
|
const styles = ui.useStyles2(getStyles$g);
|
|
6310
|
-
const labelElement = /* @__PURE__ */
|
|
6311
|
-
|
|
6527
|
+
const labelElement = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.labelWrapper, children: [
|
|
6528
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { className: styles.label, children: "Preview" }),
|
|
6529
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { tooltip: "Copy to clipboard", onClick: () => copyToClipboard(rawSql), name: "copy" })
|
|
6530
|
+
] });
|
|
6531
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Field, { label: labelElement, className: styles.grow, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6312
6532
|
ui.CodeEditor,
|
|
6313
6533
|
{
|
|
6314
6534
|
language: "sql",
|
|
@@ -6318,7 +6538,7 @@ function Preview({ rawSql }) {
|
|
|
6318
6538
|
readOnly: true,
|
|
6319
6539
|
showMiniMap: false
|
|
6320
6540
|
}
|
|
6321
|
-
));
|
|
6541
|
+
) });
|
|
6322
6542
|
}
|
|
6323
6543
|
function getStyles$g(theme) {
|
|
6324
6544
|
return {
|
|
@@ -6332,7 +6552,13 @@ function useSqlChange({ query, onQueryChange, db }) {
|
|
|
6332
6552
|
const onSqlChange = React.useCallback(
|
|
6333
6553
|
(sql) => {
|
|
6334
6554
|
const toRawSql = getRawSqlFn(db);
|
|
6335
|
-
const rawSql = toRawSql({
|
|
6555
|
+
const rawSql = toRawSql({
|
|
6556
|
+
sql,
|
|
6557
|
+
catalog: query.catalog,
|
|
6558
|
+
dataset: query.dataset,
|
|
6559
|
+
table: query.table,
|
|
6560
|
+
refId: query.refId
|
|
6561
|
+
});
|
|
6336
6562
|
const newQuery = { ...query, sql, rawSql };
|
|
6337
6563
|
onQueryChange(newQuery);
|
|
6338
6564
|
},
|
|
@@ -6343,7 +6569,7 @@ function useSqlChange({ query, onQueryChange, db }) {
|
|
|
6343
6569
|
|
|
6344
6570
|
function SQLGroupByRow({ fields, query, onQueryChange, db }) {
|
|
6345
6571
|
const { onSqlChange } = useSqlChange({ query, onQueryChange, db });
|
|
6346
|
-
return /* @__PURE__ */
|
|
6572
|
+
return /* @__PURE__ */ jsxRuntime.jsx(GroupByRow, { columns: fields, sql: query.sql, onSqlChange });
|
|
6347
6573
|
}
|
|
6348
6574
|
|
|
6349
6575
|
const sortOrderOptions = [
|
|
@@ -6383,25 +6609,33 @@ function OrderByRow({ sql, onSqlChange, columns, showOffset }) {
|
|
|
6383
6609
|
},
|
|
6384
6610
|
[onSqlChange, sql]
|
|
6385
6611
|
);
|
|
6386
|
-
return /* @__PURE__ */
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6612
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6613
|
+
/* @__PURE__ */ jsxRuntime.jsx(EditorField$1, { label: "Order by", width: 25, children: /* @__PURE__ */ jsxRuntime.jsxs(InputGroup, { children: [
|
|
6614
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6615
|
+
ui.Select,
|
|
6616
|
+
{
|
|
6617
|
+
"aria-label": "Order by",
|
|
6618
|
+
options: columns,
|
|
6619
|
+
value: ((_a = sql.orderBy) == null ? undefined : _a.property.name) ? data.toOption(sql.orderBy.property.name) : null,
|
|
6620
|
+
isClearable: true,
|
|
6621
|
+
menuShouldPortal: true,
|
|
6622
|
+
onChange: onOrderByChange
|
|
6623
|
+
}
|
|
6624
|
+
),
|
|
6625
|
+
/* @__PURE__ */ jsxRuntime.jsx(Space, { h: 1.5 }),
|
|
6626
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6627
|
+
ui.RadioButtonGroup,
|
|
6628
|
+
{
|
|
6629
|
+
options: sortOrderOptions,
|
|
6630
|
+
disabled: !((_b = sql == null ? undefined : sql.orderBy) == null ? undefined : _b.property.name),
|
|
6631
|
+
value: sql.orderByDirection,
|
|
6632
|
+
onChange: onSortOrderChange
|
|
6633
|
+
}
|
|
6634
|
+
)
|
|
6635
|
+
] }) }),
|
|
6636
|
+
/* @__PURE__ */ jsxRuntime.jsx(EditorField$1, { label: "Limit", optional: true, width: 25, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { type: "number", min: 0, id: lodash.uniqueId("limit-"), value: sql.limit || "", onChange: onLimitChange }) }),
|
|
6637
|
+
showOffset && /* @__PURE__ */ jsxRuntime.jsx(EditorField$1, { label: "Offset", optional: true, width: 25, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { type: "number", id: lodash.uniqueId("offset-"), value: sql.offset || "", onChange: onOffsetChange }) })
|
|
6638
|
+
] });
|
|
6405
6639
|
}
|
|
6406
6640
|
|
|
6407
6641
|
function SQLOrderByRow({ fields, query, onQueryChange, db }) {
|
|
@@ -6427,7 +6661,7 @@ function SQLOrderByRow({ fields, query, onQueryChange, db }) {
|
|
|
6427
6661
|
...fields
|
|
6428
6662
|
];
|
|
6429
6663
|
}
|
|
6430
|
-
return /* @__PURE__ */
|
|
6664
|
+
return /* @__PURE__ */ jsxRuntime.jsx(OrderByRow, { sql: query.sql, onSqlChange, columns: columnsWithIndices });
|
|
6431
6665
|
}
|
|
6432
6666
|
|
|
6433
6667
|
const asteriskValue = { label: "*", value: "*" };
|
|
@@ -6485,49 +6719,56 @@ function SelectRow({ sql, columns, onSqlChange, functions }) {
|
|
|
6485
6719
|
const newSql = { ...sql, columns: [...sql.columns, createFunctionField()] };
|
|
6486
6720
|
onSqlChange(newSql);
|
|
6487
6721
|
}, [onSqlChange, sql]);
|
|
6488
|
-
return /* @__PURE__ */
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6722
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(EditorStack, { gap: 2, alignItems: "end", direction: "column", children: [
|
|
6723
|
+
(_a = sql.columns) == null ? undefined : _a.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsxs(EditorStack, { gap: 2, alignItems: "end", children: [
|
|
6724
|
+
/* @__PURE__ */ jsxRuntime.jsx(EditorField$1, { label: "Column", width: 25, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6725
|
+
ui.Select,
|
|
6726
|
+
{
|
|
6727
|
+
value: getColumnValue(item),
|
|
6728
|
+
options: columnsWithAsterisk,
|
|
6729
|
+
inputId: `select-column-${index}-${lodash.uniqueId()}`,
|
|
6730
|
+
menuShouldPortal: true,
|
|
6731
|
+
allowCustomValue: true,
|
|
6732
|
+
onChange: onColumnChange(item, index)
|
|
6733
|
+
}
|
|
6734
|
+
) }),
|
|
6735
|
+
/* @__PURE__ */ jsxRuntime.jsx(EditorField$1, { label: "Aggregation", optional: true, width: 25, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6736
|
+
ui.Select,
|
|
6737
|
+
{
|
|
6738
|
+
value: item.name ? data.toOption(item.name) : null,
|
|
6739
|
+
inputId: `select-aggregation-${index}-${lodash.uniqueId()}`,
|
|
6740
|
+
isClearable: true,
|
|
6741
|
+
menuShouldPortal: true,
|
|
6742
|
+
allowCustomValue: true,
|
|
6743
|
+
options: functions,
|
|
6744
|
+
onChange: onAggregationChange(item, index)
|
|
6745
|
+
}
|
|
6746
|
+
) }),
|
|
6747
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6748
|
+
ui.Button,
|
|
6749
|
+
{
|
|
6750
|
+
"aria-label": "Remove",
|
|
6751
|
+
type: "button",
|
|
6752
|
+
icon: "trash-alt",
|
|
6753
|
+
variant: "secondary",
|
|
6754
|
+
size: "md",
|
|
6755
|
+
onClick: removeColumn(index)
|
|
6756
|
+
}
|
|
6757
|
+
)
|
|
6758
|
+
] }) }, index)),
|
|
6759
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6760
|
+
ui.Button,
|
|
6761
|
+
{
|
|
6762
|
+
type: "button",
|
|
6763
|
+
onClick: addColumn,
|
|
6764
|
+
variant: "secondary",
|
|
6765
|
+
size: "md",
|
|
6766
|
+
icon: "plus",
|
|
6767
|
+
"aria-label": "Add",
|
|
6768
|
+
className: styles.addButton
|
|
6769
|
+
}
|
|
6770
|
+
)
|
|
6771
|
+
] });
|
|
6531
6772
|
}
|
|
6532
6773
|
const getStyles$f = () => {
|
|
6533
6774
|
return { addButton: css.css({ alignSelf: "flex-start" }) };
|
|
@@ -6546,7 +6787,7 @@ function SQLSelectRow({ fields, query, onQueryChange, db }) {
|
|
|
6546
6787
|
const functions = await db.functions();
|
|
6547
6788
|
return functions.map((f) => data.toOption(f.name));
|
|
6548
6789
|
}, [db]);
|
|
6549
|
-
return /* @__PURE__ */
|
|
6790
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SelectRow, { columns: fields, sql: query.sql, functions: state.value, onSqlChange });
|
|
6550
6791
|
}
|
|
6551
6792
|
|
|
6552
6793
|
const buttonLabels = {
|
|
@@ -6590,7 +6831,7 @@ const widgets = {
|
|
|
6590
6831
|
text: {
|
|
6591
6832
|
...ui$1.BasicConfig.widgets.text,
|
|
6592
6833
|
factory: function TextInput(props) {
|
|
6593
|
-
return /* @__PURE__ */
|
|
6834
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6594
6835
|
ui.Input,
|
|
6595
6836
|
{
|
|
6596
6837
|
value: (props == null ? undefined : props.value) || "",
|
|
@@ -6603,7 +6844,7 @@ const widgets = {
|
|
|
6603
6844
|
number: {
|
|
6604
6845
|
...ui$1.BasicConfig.widgets.number,
|
|
6605
6846
|
factory: function NumberInput(props) {
|
|
6606
|
-
return /* @__PURE__ */
|
|
6847
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6607
6848
|
ui.Input,
|
|
6608
6849
|
{
|
|
6609
6850
|
value: props == null ? undefined : props.value,
|
|
@@ -6617,7 +6858,7 @@ const widgets = {
|
|
|
6617
6858
|
datetime: {
|
|
6618
6859
|
...ui$1.BasicConfig.widgets.datetime,
|
|
6619
6860
|
factory: function DateTimeInput(props) {
|
|
6620
|
-
return /* @__PURE__ */
|
|
6861
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6621
6862
|
ui.DateTimePicker,
|
|
6622
6863
|
{
|
|
6623
6864
|
onChange: (e) => {
|
|
@@ -6638,7 +6879,7 @@ const settings = {
|
|
|
6638
6879
|
addRuleLabel: buttonLabels.add,
|
|
6639
6880
|
deleteLabel: buttonLabels.remove,
|
|
6640
6881
|
renderConjs: function Conjunctions(conjProps) {
|
|
6641
|
-
return /* @__PURE__ */
|
|
6882
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6642
6883
|
ui.Select,
|
|
6643
6884
|
{
|
|
6644
6885
|
id: conjProps == null ? undefined : conjProps.id,
|
|
@@ -6653,7 +6894,7 @@ const settings = {
|
|
|
6653
6894
|
renderField: function Field(fieldProps) {
|
|
6654
6895
|
var _a;
|
|
6655
6896
|
const fields = ((_a = fieldProps == null ? undefined : fieldProps.config) == null ? undefined : _a.fields) || {};
|
|
6656
|
-
return /* @__PURE__ */
|
|
6897
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6657
6898
|
ui.Select,
|
|
6658
6899
|
{
|
|
6659
6900
|
id: fieldProps == null ? undefined : fieldProps.id,
|
|
@@ -6677,7 +6918,7 @@ const settings = {
|
|
|
6677
6918
|
);
|
|
6678
6919
|
},
|
|
6679
6920
|
renderButton: function RAQBButton(buttonProps) {
|
|
6680
|
-
return /* @__PURE__ */
|
|
6921
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6681
6922
|
ui.Button,
|
|
6682
6923
|
{
|
|
6683
6924
|
type: "button",
|
|
@@ -6690,7 +6931,7 @@ const settings = {
|
|
|
6690
6931
|
);
|
|
6691
6932
|
},
|
|
6692
6933
|
renderOperator: function Operator(operatorProps) {
|
|
6693
|
-
return /* @__PURE__ */
|
|
6934
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6694
6935
|
ui.Select,
|
|
6695
6936
|
{
|
|
6696
6937
|
options: operatorProps == null ? undefined : operatorProps.items.map((op) => ({ label: op.label, value: op.key })),
|
|
@@ -6805,13 +7046,13 @@ function WhereRow({ sql, config, onSqlChange }) {
|
|
|
6805
7046
|
if (!tree) {
|
|
6806
7047
|
return null;
|
|
6807
7048
|
}
|
|
6808
|
-
return /* @__PURE__ */
|
|
7049
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6809
7050
|
ui$1.Query,
|
|
6810
7051
|
{
|
|
6811
7052
|
...configWithDefaults,
|
|
6812
7053
|
value: tree,
|
|
6813
7054
|
onChange: onTreeChange,
|
|
6814
|
-
renderBuilder: (props) => /* @__PURE__ */
|
|
7055
|
+
renderBuilder: (props) => /* @__PURE__ */ jsxRuntime.jsx(ui$1.Builder, { ...props })
|
|
6815
7056
|
}
|
|
6816
7057
|
);
|
|
6817
7058
|
}
|
|
@@ -6851,16 +7092,16 @@ function SQLWhereRow({ query, fields, onQueryChange, db }) {
|
|
|
6851
7092
|
return mapFieldsToTypes(fields);
|
|
6852
7093
|
}, [fields]);
|
|
6853
7094
|
const { onSqlChange } = useSqlChange({ query, onQueryChange, db });
|
|
6854
|
-
return /* @__PURE__ */
|
|
7095
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6855
7096
|
WhereRow,
|
|
6856
7097
|
{
|
|
6857
|
-
key: JSON.stringify(state.value),
|
|
6858
7098
|
config: { fields: state.value || {} },
|
|
6859
7099
|
sql: query.sql,
|
|
6860
7100
|
onSqlChange: (val) => {
|
|
6861
7101
|
onSqlChange(val);
|
|
6862
7102
|
}
|
|
6863
|
-
}
|
|
7103
|
+
},
|
|
7104
|
+
JSON.stringify(state.value)
|
|
6864
7105
|
);
|
|
6865
7106
|
}
|
|
6866
7107
|
function mapFieldsToTypes(columns) {
|
|
@@ -6877,7 +7118,7 @@ function mapFieldsToTypes(columns) {
|
|
|
6877
7118
|
|
|
6878
7119
|
const EditorRow = ({ children }) => {
|
|
6879
7120
|
const styles = ui.useStyles2(getStyles$e);
|
|
6880
|
-
return /* @__PURE__ */
|
|
7121
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.root, children: /* @__PURE__ */ jsxRuntime.jsx(EditorStack, { gap: 2, children }) });
|
|
6881
7122
|
};
|
|
6882
7123
|
const getStyles$e = (theme) => {
|
|
6883
7124
|
return {
|
|
@@ -6895,8 +7136,15 @@ const EditorField = (props) => {
|
|
|
6895
7136
|
const theme = ui.useTheme2();
|
|
6896
7137
|
const styles = getStyles$d(theme, width);
|
|
6897
7138
|
const childInputId = (fieldProps == null ? undefined : fieldProps.htmlFor) || ((_a = ui.ReactUtils) == null ? undefined : _a.getChildId(children));
|
|
6898
|
-
const labelEl = /* @__PURE__ */
|
|
6899
|
-
|
|
7139
|
+
const labelEl = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7140
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: styles.label, htmlFor: childInputId, children: [
|
|
7141
|
+
label,
|
|
7142
|
+
optional && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.optional, children: " - optional" }),
|
|
7143
|
+
tooltip && /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { placement: "top", content: tooltip, theme: "info", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Icon, { name: "info-circle", size: "sm", className: styles.icon }) })
|
|
7144
|
+
] }),
|
|
7145
|
+
/* @__PURE__ */ jsxRuntime.jsx(Space, { v: 0.5 })
|
|
7146
|
+
] });
|
|
7147
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.root, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Field, { className: styles.field, label: labelEl, ...fieldProps, children }) });
|
|
6900
7148
|
};
|
|
6901
7149
|
const getStyles$d = ui.stylesFactory((theme, width) => {
|
|
6902
7150
|
return {
|
|
@@ -6926,7 +7174,7 @@ const getStyles$d = ui.stylesFactory((theme, width) => {
|
|
|
6926
7174
|
});
|
|
6927
7175
|
|
|
6928
7176
|
const EditorRows = ({ children }) => {
|
|
6929
|
-
return /* @__PURE__ */
|
|
7177
|
+
return /* @__PURE__ */ jsxRuntime.jsx(EditorStack, { gap: 0.5, direction: "column", children });
|
|
6930
7178
|
};
|
|
6931
7179
|
|
|
6932
7180
|
const VisualEditor = ({ query, db, queryRowFilter, onChange, onValidate, range }) => {
|
|
@@ -6934,7 +7182,16 @@ const VisualEditor = ({ query, db, queryRowFilter, onChange, onValidate, range }
|
|
|
6934
7182
|
const fields = await db.fields(query);
|
|
6935
7183
|
return fields;
|
|
6936
7184
|
}, [db, query.dataset, query.table]);
|
|
6937
|
-
return /* @__PURE__ */
|
|
7185
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7186
|
+
/* @__PURE__ */ jsxRuntime.jsxs(EditorRows, { children: [
|
|
7187
|
+
/* @__PURE__ */ jsxRuntime.jsx(EditorRow, { children: /* @__PURE__ */ jsxRuntime.jsx(SQLSelectRow, { fields: state.value || [], query, onQueryChange: onChange, db }) }),
|
|
7188
|
+
queryRowFilter.filter && /* @__PURE__ */ jsxRuntime.jsx(EditorRow, { children: /* @__PURE__ */ jsxRuntime.jsx(EditorField, { label: "Filter by column value", optional: true, children: /* @__PURE__ */ jsxRuntime.jsx(SQLWhereRow, { fields: state.value || [], query, onQueryChange: onChange, db }) }) }),
|
|
7189
|
+
queryRowFilter.group && /* @__PURE__ */ jsxRuntime.jsx(EditorRow, { children: /* @__PURE__ */ jsxRuntime.jsx(EditorField, { label: "Group by column", children: /* @__PURE__ */ jsxRuntime.jsx(SQLGroupByRow, { fields: state.value || [], query, onQueryChange: onChange, db }) }) }),
|
|
7190
|
+
queryRowFilter.order && /* @__PURE__ */ jsxRuntime.jsx(EditorRow, { children: /* @__PURE__ */ jsxRuntime.jsx(SQLOrderByRow, { fields: state.value || [], query, onQueryChange: onChange, db }) }),
|
|
7191
|
+
queryRowFilter.preview && query.rawSql && /* @__PURE__ */ jsxRuntime.jsx(EditorRow, { children: /* @__PURE__ */ jsxRuntime.jsx(Preview, { rawSql: query.rawSql }) })
|
|
7192
|
+
] }),
|
|
7193
|
+
/* @__PURE__ */ jsxRuntime.jsx(QueryToolbox, { db, query, onValidate, range })
|
|
7194
|
+
] });
|
|
6938
7195
|
};
|
|
6939
7196
|
|
|
6940
7197
|
const MACRO_NAMES = [
|
|
@@ -7169,42 +7426,51 @@ function SqlQueryEditor({ datasource, query, onChange, onRunQuery, range }) {
|
|
|
7169
7426
|
if (loading || error) {
|
|
7170
7427
|
return null;
|
|
7171
7428
|
}
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7200
|
-
|
|
7201
|
-
|
|
7202
|
-
|
|
7203
|
-
|
|
7204
|
-
|
|
7205
|
-
|
|
7206
|
-
|
|
7207
|
-
|
|
7429
|
+
const catalogsEnabled = db.disableCatalogs === false;
|
|
7430
|
+
const datasetsEnabled = !db.disableDatasets;
|
|
7431
|
+
const effectiveEnableDatasets = catalogsEnabled ? true : datasetsEnabled;
|
|
7432
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7433
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7434
|
+
QueryHeader,
|
|
7435
|
+
{
|
|
7436
|
+
db,
|
|
7437
|
+
defaultDataset: defaultDataset || "",
|
|
7438
|
+
enableDatasets: effectiveEnableDatasets,
|
|
7439
|
+
enableCatalogs: catalogsEnabled,
|
|
7440
|
+
onChange: onQueryHeaderChange,
|
|
7441
|
+
onRunQuery,
|
|
7442
|
+
onQueryRowChange: setQueryRowFilter,
|
|
7443
|
+
queryRowFilter,
|
|
7444
|
+
query: queryWithDefaults,
|
|
7445
|
+
isQueryRunnable,
|
|
7446
|
+
labels: (_g = datasource.getDB(datasource.id)) == null ? undefined : _g.labels
|
|
7447
|
+
}
|
|
7448
|
+
),
|
|
7449
|
+
/* @__PURE__ */ jsxRuntime.jsx(Space, { v: 0.5 }),
|
|
7450
|
+
queryWithDefaults.editorMode !== EditorMode.Code && /* @__PURE__ */ jsxRuntime.jsx(
|
|
7451
|
+
VisualEditor,
|
|
7452
|
+
{
|
|
7453
|
+
db,
|
|
7454
|
+
query: queryWithDefaults,
|
|
7455
|
+
onChange: (q) => onQueryChange(q, false),
|
|
7456
|
+
queryRowFilter,
|
|
7457
|
+
onValidate: setIsQueryRunnable,
|
|
7458
|
+
range
|
|
7459
|
+
}
|
|
7460
|
+
),
|
|
7461
|
+
queryWithDefaults.editorMode === EditorMode.Code && /* @__PURE__ */ jsxRuntime.jsx(
|
|
7462
|
+
RawEditor,
|
|
7463
|
+
{
|
|
7464
|
+
db,
|
|
7465
|
+
query: queryWithDefaults,
|
|
7466
|
+
queryToValidate,
|
|
7467
|
+
onChange: onQueryChange,
|
|
7468
|
+
onRunQuery,
|
|
7469
|
+
onValidate: setIsQueryRunnable,
|
|
7470
|
+
range
|
|
7471
|
+
}
|
|
7472
|
+
)
|
|
7473
|
+
] });
|
|
7208
7474
|
}
|
|
7209
7475
|
const isQueryValid = (q) => {
|
|
7210
7476
|
return Boolean(q.rawSql);
|
|
@@ -7221,31 +7487,35 @@ const SecureSocksProxyToggle = ({ labelWidth = 10, ...props }) => {
|
|
|
7221
7487
|
}
|
|
7222
7488
|
});
|
|
7223
7489
|
};
|
|
7224
|
-
return runtime.config.secureSocksDSProxyEnabled && /* @__PURE__ */
|
|
7490
|
+
return runtime.config.secureSocksDSProxyEnabled && /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "gf-form", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "gf-form gf-form-inline", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7225
7491
|
ui.InlineField,
|
|
7226
7492
|
{
|
|
7227
7493
|
htmlFor: "secureSocksProxyEnabled",
|
|
7228
7494
|
label: "Secure Socks Proxy Enabled",
|
|
7229
7495
|
labelWidth,
|
|
7230
|
-
tooltip: /* @__PURE__ */
|
|
7231
|
-
"a",
|
|
7496
|
+
tooltip: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7497
|
+
"Proxy the datasource connection through the secure socks proxy to a different network. To learn more about configuring the datasource connection proxy,",
|
|
7498
|
+
" ",
|
|
7499
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7500
|
+
"a",
|
|
7501
|
+
{
|
|
7502
|
+
href: "https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/proxy/",
|
|
7503
|
+
target: "_blank",
|
|
7504
|
+
rel: "noopener noreferrer",
|
|
7505
|
+
children: "click here."
|
|
7506
|
+
}
|
|
7507
|
+
)
|
|
7508
|
+
] }),
|
|
7509
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7510
|
+
ui.InlineSwitch,
|
|
7232
7511
|
{
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
}
|
|
7237
|
-
|
|
7238
|
-
|
|
7239
|
-
|
|
7240
|
-
/* @__PURE__ */ React__namespace.default.createElement(
|
|
7241
|
-
ui.InlineSwitch,
|
|
7242
|
-
{
|
|
7243
|
-
id: "secureSocksProxyEnabled",
|
|
7244
|
-
value: dataSourceConfig.jsonData.enableSecureSocksProxy,
|
|
7245
|
-
onChange: handleSwitchChange
|
|
7246
|
-
}
|
|
7247
|
-
)
|
|
7248
|
-
))));
|
|
7512
|
+
id: "secureSocksProxyEnabled",
|
|
7513
|
+
value: dataSourceConfig.jsonData.enableSecureSocksProxy,
|
|
7514
|
+
onChange: handleSwitchChange
|
|
7515
|
+
}
|
|
7516
|
+
)
|
|
7517
|
+
}
|
|
7518
|
+
) }) }) });
|
|
7249
7519
|
};
|
|
7250
7520
|
|
|
7251
7521
|
const DataSourceDescription = ({ dataSourceName, docsLink, hasRequiredFields = true, className }) => {
|
|
@@ -7271,7 +7541,17 @@ const DataSourceDescription = ({ dataSourceName, docsLink, hasRequiredFields = t
|
|
|
7271
7541
|
})
|
|
7272
7542
|
})
|
|
7273
7543
|
};
|
|
7274
|
-
return /* @__PURE__ */
|
|
7544
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: css.cx(styles.container, className), children: [
|
|
7545
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: styles.text, children: [
|
|
7546
|
+
"Before you can use the ",
|
|
7547
|
+
dataSourceName,
|
|
7548
|
+
" data source, you must configure it below or in the config file. For detailed instructions,",
|
|
7549
|
+
" ",
|
|
7550
|
+
/* @__PURE__ */ jsxRuntime.jsx("a", { href: docsLink, target: "_blank", rel: "noreferrer", children: "view the documentation" }),
|
|
7551
|
+
"."
|
|
7552
|
+
] }),
|
|
7553
|
+
hasRequiredFields && /* @__PURE__ */ jsxRuntime.jsx("p", { className: styles.text, children: /* @__PURE__ */ jsxRuntime.jsx("i", { children: "Fields marked with * are required" }) })
|
|
7554
|
+
] });
|
|
7275
7555
|
};
|
|
7276
7556
|
|
|
7277
7557
|
const GenericConfigSection = ({
|
|
@@ -7311,40 +7591,50 @@ const GenericConfigSection = ({
|
|
|
7311
7591
|
marginTop: spacing(2)
|
|
7312
7592
|
})
|
|
7313
7593
|
};
|
|
7314
|
-
return /* @__PURE__ */
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7594
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, children: [
|
|
7595
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.header, children: [
|
|
7596
|
+
kind === "section" ? /* @__PURE__ */ jsxRuntime.jsx("h3", { className: styles.title, children: title }) : /* @__PURE__ */ jsxRuntime.jsx("h6", { className: styles.subtitle, children: title }),
|
|
7597
|
+
isCollapsible && /* @__PURE__ */ jsxRuntime.jsx(
|
|
7598
|
+
ui.IconButton,
|
|
7599
|
+
{
|
|
7600
|
+
name: iconName,
|
|
7601
|
+
onClick: () => setIsOpen(!isOpen),
|
|
7602
|
+
type: "button",
|
|
7603
|
+
size: "xl",
|
|
7604
|
+
"aria-label": collapsibleButtonAriaLabel
|
|
7605
|
+
}
|
|
7606
|
+
)
|
|
7607
|
+
] }),
|
|
7608
|
+
description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: styles.descriptionText, children: description }),
|
|
7609
|
+
isOpen && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.content, children })
|
|
7610
|
+
] });
|
|
7324
7611
|
};
|
|
7325
7612
|
|
|
7326
7613
|
const ConfigSection = ({ children, ...props }) => {
|
|
7327
|
-
return /* @__PURE__ */
|
|
7614
|
+
return /* @__PURE__ */ jsxRuntime.jsx(GenericConfigSection, { ...props, kind: "section", children });
|
|
7328
7615
|
};
|
|
7329
7616
|
|
|
7330
7617
|
const ConfigSubSection = ({ children, ...props }) => {
|
|
7331
|
-
return /* @__PURE__ */
|
|
7618
|
+
return /* @__PURE__ */ jsxRuntime.jsx(GenericConfigSection, { ...props, kind: "sub-section", children });
|
|
7332
7619
|
};
|
|
7333
7620
|
|
|
7334
7621
|
function ConfigDescriptionLink(props) {
|
|
7335
7622
|
const { description, suffix, feature } = props;
|
|
7336
7623
|
const text = `Learn more about ${feature}`;
|
|
7337
7624
|
const styles = ui.useStyles2(getStyles$c);
|
|
7338
|
-
return /* @__PURE__ */
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
"
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7625
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles.container, children: [
|
|
7626
|
+
description,
|
|
7627
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7628
|
+
"a",
|
|
7629
|
+
{
|
|
7630
|
+
"aria-label": text,
|
|
7631
|
+
href: `https://grafana.com/docs/grafana/next/datasources/${suffix}`,
|
|
7632
|
+
rel: "noreferrer",
|
|
7633
|
+
target: "_blank",
|
|
7634
|
+
children: text
|
|
7635
|
+
}
|
|
7636
|
+
)
|
|
7637
|
+
] });
|
|
7348
7638
|
}
|
|
7349
7639
|
const getStyles$c = (theme) => {
|
|
7350
7640
|
return {
|
|
@@ -7404,59 +7694,62 @@ const BasicAuth = ({
|
|
|
7404
7694
|
marginBottom: 0
|
|
7405
7695
|
})
|
|
7406
7696
|
};
|
|
7407
|
-
return /* @__PURE__ */
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
className: commonStyles.inlineFieldNoMarginRight,
|
|
7411
|
-
label: userLabel,
|
|
7412
|
-
labelWidth: 24,
|
|
7413
|
-
tooltip: userTooltip,
|
|
7414
|
-
required: true,
|
|
7415
|
-
htmlFor: "basic-auth-user-input",
|
|
7416
|
-
interactive: true,
|
|
7417
|
-
grow: true,
|
|
7418
|
-
disabled: readOnly
|
|
7419
|
-
},
|
|
7420
|
-
/* @__PURE__ */ React__namespace.default.createElement(
|
|
7421
|
-
ui.Input,
|
|
7697
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7698
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7699
|
+
ui.InlineField,
|
|
7422
7700
|
{
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
required: true
|
|
7701
|
+
className: commonStyles.inlineFieldNoMarginRight,
|
|
7702
|
+
label: userLabel,
|
|
7703
|
+
labelWidth: 24,
|
|
7704
|
+
tooltip: userTooltip,
|
|
7705
|
+
required: true,
|
|
7706
|
+
htmlFor: "basic-auth-user-input",
|
|
7707
|
+
interactive: true,
|
|
7708
|
+
grow: true,
|
|
7709
|
+
disabled: readOnly,
|
|
7710
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7711
|
+
ui.Input,
|
|
7712
|
+
{
|
|
7713
|
+
id: "basic-auth-user-input",
|
|
7714
|
+
placeholder: userPlaceholder,
|
|
7715
|
+
value: user,
|
|
7716
|
+
onChange: (e) => onUserChange(e.currentTarget.value),
|
|
7717
|
+
required: true
|
|
7718
|
+
}
|
|
7719
|
+
)
|
|
7428
7720
|
}
|
|
7429
|
-
)
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
7450
|
-
|
|
7451
|
-
|
|
7452
|
-
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
|
|
7721
|
+
),
|
|
7722
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7723
|
+
ui.InlineField,
|
|
7724
|
+
{
|
|
7725
|
+
className: css.cx(
|
|
7726
|
+
commonStyles.inlineFieldNoMarginRight,
|
|
7727
|
+
commonStyles.inlineFieldWithSecret,
|
|
7728
|
+
styles.lastInlineField
|
|
7729
|
+
),
|
|
7730
|
+
label: passwordLabel,
|
|
7731
|
+
labelWidth: 24,
|
|
7732
|
+
tooltip: passwordTooltip,
|
|
7733
|
+
required: true,
|
|
7734
|
+
htmlFor: "basic-auth-password-input",
|
|
7735
|
+
interactive: true,
|
|
7736
|
+
grow: true,
|
|
7737
|
+
disabled: readOnly,
|
|
7738
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7739
|
+
ui.SecretInput,
|
|
7740
|
+
{
|
|
7741
|
+
id: "basic-auth-password-input",
|
|
7742
|
+
isConfigured: passwordConfigured,
|
|
7743
|
+
onReset: readOnly ? () => {
|
|
7744
|
+
} : onPasswordReset,
|
|
7745
|
+
placeholder: passwordPlaceholder,
|
|
7746
|
+
onChange: (e) => onPasswordChange(e.currentTarget.value),
|
|
7747
|
+
required: true
|
|
7748
|
+
}
|
|
7749
|
+
)
|
|
7457
7750
|
}
|
|
7458
7751
|
)
|
|
7459
|
-
)
|
|
7752
|
+
] });
|
|
7460
7753
|
};
|
|
7461
7754
|
|
|
7462
7755
|
const defaultOptions = {
|
|
@@ -7548,7 +7841,7 @@ const AuthMethodSettings = ({
|
|
|
7548
7841
|
}
|
|
7549
7842
|
let AuthFieldsComponent = null;
|
|
7550
7843
|
if (selected === AuthMethod.BasicAuth && basicAuth) {
|
|
7551
|
-
AuthFieldsComponent = /* @__PURE__ */
|
|
7844
|
+
AuthFieldsComponent = /* @__PURE__ */ jsxRuntime.jsx(BasicAuth, { ...basicAuth, readOnly });
|
|
7552
7845
|
} else if (selected.startsWith("custom-")) {
|
|
7553
7846
|
AuthFieldsComponent = (_b = (_a = customMethods == null ? undefined : customMethods.find((m) => m.id === selected)) == null ? undefined : _a.component) != null ? _b : null;
|
|
7554
7847
|
}
|
|
@@ -7566,19 +7859,22 @@ const AuthMethodSettings = ({
|
|
|
7566
7859
|
marginTop: spacing(1.5)
|
|
7567
7860
|
})
|
|
7568
7861
|
};
|
|
7569
|
-
return /* @__PURE__ */
|
|
7570
|
-
ui.
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
|
|
7862
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ConfigSubSection, { title, description, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.authMethods, children: [
|
|
7863
|
+
hasSelect && /* @__PURE__ */ jsxRuntime.jsx(ui.Field, { label: "Authentication method", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7864
|
+
ui.Select,
|
|
7865
|
+
{
|
|
7866
|
+
inputId: "auth-method-select",
|
|
7867
|
+
options: preparedOptions,
|
|
7868
|
+
value: selected,
|
|
7869
|
+
onChange: (option) => {
|
|
7870
|
+
setAuthMethodChanged(true);
|
|
7871
|
+
onAuthMethodSelect(option.value);
|
|
7872
|
+
},
|
|
7873
|
+
disabled: readOnly
|
|
7874
|
+
}
|
|
7875
|
+
) }),
|
|
7876
|
+
AuthFieldsComponent && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.selectedMethodFields, children: AuthFieldsComponent })
|
|
7877
|
+
] }) });
|
|
7582
7878
|
};
|
|
7583
7879
|
|
|
7584
7880
|
const TLSSettingsSection = ({
|
|
@@ -7607,7 +7903,13 @@ const TLSSettingsSection = ({
|
|
|
7607
7903
|
margin: spacing(1, 0, 2, 3)
|
|
7608
7904
|
})
|
|
7609
7905
|
};
|
|
7610
|
-
return /* @__PURE__ */
|
|
7906
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.container, children: [
|
|
7907
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.checkboxContainer, children: [
|
|
7908
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Checkbox, { value: enabled, label, onChange: () => onToggle(!enabled), disabled: readOnly }),
|
|
7909
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { placement: "top", content: tooltipText, interactive: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Icon, { name: "info-circle", className: styles.infoIcon, size: "sm" }) })
|
|
7910
|
+
] }),
|
|
7911
|
+
enabled && children && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.content, children })
|
|
7912
|
+
] });
|
|
7611
7913
|
};
|
|
7612
7914
|
|
|
7613
7915
|
const SelfSignedCertificate = ({
|
|
@@ -7621,42 +7923,42 @@ const SelfSignedCertificate = ({
|
|
|
7621
7923
|
}) => {
|
|
7622
7924
|
var _a;
|
|
7623
7925
|
const commonStyles = useCommonStyles();
|
|
7624
|
-
return /* @__PURE__ */
|
|
7926
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7625
7927
|
TLSSettingsSection,
|
|
7626
7928
|
{
|
|
7627
7929
|
enabled,
|
|
7628
7930
|
label: "Add self-signed certificate",
|
|
7629
7931
|
tooltipText: "Add your own Certificate Authority (CA) certificate on top of one generated by the certificate authorities for additional security measures",
|
|
7630
7932
|
onToggle: (newEnabled) => onToggle(newEnabled),
|
|
7631
|
-
readOnly
|
|
7632
|
-
|
|
7633
|
-
|
|
7634
|
-
ui.InlineField,
|
|
7635
|
-
{
|
|
7636
|
-
label: "CA Certificate",
|
|
7637
|
-
labelWidth: 24,
|
|
7638
|
-
tooltip: (_a = tooltips == null ? undefined : tooltips.certificateLabel) != null ? _a : "Your self-signed certificate",
|
|
7639
|
-
required: true,
|
|
7640
|
-
htmlFor: "self-signed-certificate-input",
|
|
7641
|
-
interactive: true,
|
|
7642
|
-
grow: true,
|
|
7643
|
-
className: css.cx(commonStyles.inlineFieldNoMarginRight, commonStyles.inlineFieldWithSecret),
|
|
7644
|
-
disabled: readOnly
|
|
7645
|
-
},
|
|
7646
|
-
/* @__PURE__ */ React__namespace.default.createElement(
|
|
7647
|
-
ui.SecretTextArea,
|
|
7933
|
+
readOnly,
|
|
7934
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7935
|
+
ui.InlineField,
|
|
7648
7936
|
{
|
|
7649
|
-
|
|
7650
|
-
|
|
7651
|
-
|
|
7652
|
-
|
|
7653
|
-
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
|
|
7937
|
+
label: "CA Certificate",
|
|
7938
|
+
labelWidth: 24,
|
|
7939
|
+
tooltip: (_a = tooltips == null ? undefined : tooltips.certificateLabel) != null ? _a : "Your self-signed certificate",
|
|
7940
|
+
required: true,
|
|
7941
|
+
htmlFor: "self-signed-certificate-input",
|
|
7942
|
+
interactive: true,
|
|
7943
|
+
grow: true,
|
|
7944
|
+
className: css.cx(commonStyles.inlineFieldNoMarginRight, commonStyles.inlineFieldWithSecret),
|
|
7945
|
+
disabled: readOnly,
|
|
7946
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7947
|
+
ui.SecretTextArea,
|
|
7948
|
+
{
|
|
7949
|
+
id: "self-signed-certificate-input",
|
|
7950
|
+
isConfigured: certificateConfigured,
|
|
7951
|
+
onChange: (e) => onCertificateChange(e.currentTarget.value),
|
|
7952
|
+
onReset: readOnly ? () => {
|
|
7953
|
+
} : onCertificateReset,
|
|
7954
|
+
placeholder: "Begins with --- BEGIN CERTIFICATE ---",
|
|
7955
|
+
rows: 6,
|
|
7956
|
+
required: true
|
|
7957
|
+
}
|
|
7958
|
+
)
|
|
7657
7959
|
}
|
|
7658
7960
|
)
|
|
7659
|
-
|
|
7961
|
+
}
|
|
7660
7962
|
);
|
|
7661
7963
|
};
|
|
7662
7964
|
|
|
@@ -7676,98 +7978,100 @@ const TLSClientAuth = ({
|
|
|
7676
7978
|
}) => {
|
|
7677
7979
|
var _a, _b, _c;
|
|
7678
7980
|
const commonStyles = useCommonStyles();
|
|
7679
|
-
return /* @__PURE__ */
|
|
7981
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7680
7982
|
TLSSettingsSection,
|
|
7681
7983
|
{
|
|
7682
7984
|
enabled,
|
|
7683
7985
|
label: "TLS Client Authentication",
|
|
7684
7986
|
tooltipText: "Validate using TLS client authentication, in which the server authenticates the client",
|
|
7685
7987
|
onToggle: (newEnabled) => onToggle(newEnabled),
|
|
7686
|
-
readOnly
|
|
7687
|
-
|
|
7688
|
-
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
7704
|
-
|
|
7705
|
-
|
|
7706
|
-
|
|
7707
|
-
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
|
|
7988
|
+
readOnly,
|
|
7989
|
+
children: [
|
|
7990
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7991
|
+
ui.InlineField,
|
|
7992
|
+
{
|
|
7993
|
+
label: "ServerName",
|
|
7994
|
+
labelWidth: 24,
|
|
7995
|
+
tooltip: (_a = tooltips == null ? undefined : tooltips.serverNameLabel) != null ? _a : "A Servername is used to verify the hostname on the returned certificate",
|
|
7996
|
+
required: true,
|
|
7997
|
+
htmlFor: "client-auth-servername-input",
|
|
7998
|
+
interactive: true,
|
|
7999
|
+
grow: true,
|
|
8000
|
+
className: commonStyles.inlineFieldNoMarginRight,
|
|
8001
|
+
disabled: readOnly,
|
|
8002
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8003
|
+
ui.Input,
|
|
8004
|
+
{
|
|
8005
|
+
id: "client-auth-servername-input",
|
|
8006
|
+
placeholder: "domain.example.com",
|
|
8007
|
+
value: serverName,
|
|
8008
|
+
onChange: (e) => onServerNameChange(e.currentTarget.value),
|
|
8009
|
+
required: true
|
|
8010
|
+
}
|
|
8011
|
+
)
|
|
8012
|
+
}
|
|
8013
|
+
),
|
|
8014
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8015
|
+
ui.InlineField,
|
|
8016
|
+
{
|
|
8017
|
+
label: "Client Certificate",
|
|
8018
|
+
labelWidth: 24,
|
|
8019
|
+
tooltip: (_b = tooltips == null ? undefined : tooltips.certificateLabel) != null ? _b : "The client certificate can be generated from a Certificate Authority or be self-signed",
|
|
8020
|
+
required: true,
|
|
8021
|
+
htmlFor: "client-auth-client-certificate-input",
|
|
8022
|
+
interactive: true,
|
|
8023
|
+
grow: true,
|
|
8024
|
+
className: css.cx(commonStyles.inlineFieldNoMarginRight, commonStyles.inlineFieldWithSecret),
|
|
8025
|
+
disabled: readOnly,
|
|
8026
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8027
|
+
ui.SecretTextArea,
|
|
8028
|
+
{
|
|
8029
|
+
id: "client-auth-client-certificate-input",
|
|
8030
|
+
isConfigured: clientCertificateConfigured,
|
|
8031
|
+
onChange: (e) => onClientCertificateChange(e.currentTarget.value),
|
|
8032
|
+
onReset: readOnly ? () => {
|
|
8033
|
+
} : onClientCertificateReset,
|
|
8034
|
+
placeholder: "Begins with --- BEGIN CERTIFICATE ---",
|
|
8035
|
+
rows: 6,
|
|
8036
|
+
required: true
|
|
8037
|
+
}
|
|
8038
|
+
)
|
|
8039
|
+
}
|
|
8040
|
+
),
|
|
8041
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8042
|
+
ui.InlineField,
|
|
8043
|
+
{
|
|
8044
|
+
label: "Client Key",
|
|
8045
|
+
labelWidth: 24,
|
|
8046
|
+
tooltip: (_c = tooltips == null ? undefined : tooltips.keyLabel) != null ? _c : "The client key can be generated from a Certificate Authority or be self-signed",
|
|
8047
|
+
required: true,
|
|
8048
|
+
htmlFor: "client-auth-client-key-input",
|
|
8049
|
+
interactive: true,
|
|
8050
|
+
grow: true,
|
|
8051
|
+
className: css.cx(commonStyles.inlineFieldNoMarginRight, commonStyles.inlineFieldWithSecret),
|
|
8052
|
+
disabled: readOnly,
|
|
8053
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8054
|
+
ui.SecretTextArea,
|
|
8055
|
+
{
|
|
8056
|
+
id: "client-auth-client-key-input",
|
|
8057
|
+
isConfigured: clientKeyConfigured,
|
|
8058
|
+
onChange: (e) => onClientKeyChange(e.currentTarget.value),
|
|
8059
|
+
onReset: readOnly ? () => {
|
|
8060
|
+
} : onClientKeyReset,
|
|
8061
|
+
placeholder: `Begins with --- RSA PRIVATE KEY CERTIFICATE ---`,
|
|
8062
|
+
rows: 6,
|
|
8063
|
+
required: true
|
|
8064
|
+
}
|
|
8065
|
+
)
|
|
8066
|
+
}
|
|
8067
|
+
)
|
|
8068
|
+
]
|
|
8069
|
+
}
|
|
7766
8070
|
);
|
|
7767
8071
|
};
|
|
7768
8072
|
|
|
7769
8073
|
const SkipTLSVerification = ({ enabled, onToggle, readOnly }) => {
|
|
7770
|
-
return /* @__PURE__ */
|
|
8074
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7771
8075
|
TLSSettingsSection,
|
|
7772
8076
|
{
|
|
7773
8077
|
enabled,
|
|
@@ -7786,16 +8090,18 @@ const TLSSettings = ({ selfSignedCertificate, TLSClientAuth: TLSClientAuth$1, sk
|
|
|
7786
8090
|
marginTop: spacing(3)
|
|
7787
8091
|
})
|
|
7788
8092
|
};
|
|
7789
|
-
return /* @__PURE__ */
|
|
8093
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7790
8094
|
ConfigSubSection,
|
|
7791
8095
|
{
|
|
7792
8096
|
className: styles.container,
|
|
7793
8097
|
title: "TLS settings",
|
|
7794
|
-
description: "Additional security measures that can be applied on top of authentication"
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
8098
|
+
description: "Additional security measures that can be applied on top of authentication",
|
|
8099
|
+
children: [
|
|
8100
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelfSignedCertificate, { ...selfSignedCertificate, readOnly }),
|
|
8101
|
+
/* @__PURE__ */ jsxRuntime.jsx(TLSClientAuth, { ...TLSClientAuth$1, readOnly }),
|
|
8102
|
+
/* @__PURE__ */ jsxRuntime.jsx(SkipTLSVerification, { ...skipTLSVerification, readOnly })
|
|
8103
|
+
]
|
|
8104
|
+
}
|
|
7799
8105
|
);
|
|
7800
8106
|
};
|
|
7801
8107
|
|
|
@@ -7822,65 +8128,69 @@ const CustomHeader = ({ header, onChange, onBlur, onDelete, readOnly }) => {
|
|
|
7822
8128
|
margin: `0 0 3px 10px`
|
|
7823
8129
|
})
|
|
7824
8130
|
};
|
|
7825
|
-
return /* @__PURE__ */
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
label: "Header",
|
|
7829
|
-
labelWidth: 9,
|
|
7830
|
-
grow: true,
|
|
7831
|
-
className: styles.headerNameField,
|
|
7832
|
-
htmlFor: `custom-header-${header.id}-name-input`,
|
|
7833
|
-
disabled: readOnly
|
|
7834
|
-
},
|
|
7835
|
-
/* @__PURE__ */ React__namespace.default.createElement(
|
|
7836
|
-
ui.Input,
|
|
8131
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(ui.InlineFieldRow, { className: styles.container, children: [
|
|
8132
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8133
|
+
ui.InlineField,
|
|
7837
8134
|
{
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
8135
|
+
label: "Header",
|
|
8136
|
+
labelWidth: 9,
|
|
8137
|
+
grow: true,
|
|
8138
|
+
className: styles.headerNameField,
|
|
8139
|
+
htmlFor: `custom-header-${header.id}-name-input`,
|
|
8140
|
+
disabled: readOnly,
|
|
8141
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8142
|
+
ui.Input,
|
|
8143
|
+
{
|
|
8144
|
+
id: `custom-header-${header.id}-name-input`,
|
|
8145
|
+
placeholder: "X-Custom-Header",
|
|
8146
|
+
value: header.name,
|
|
8147
|
+
width: 12,
|
|
8148
|
+
onChange: (e) => onChange({ ...header, name: e.currentTarget.value }),
|
|
8149
|
+
onBlur,
|
|
8150
|
+
className: styles.input
|
|
8151
|
+
}
|
|
8152
|
+
)
|
|
7845
8153
|
}
|
|
7846
|
-
)
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
{
|
|
7850
|
-
label: "Value",
|
|
7851
|
-
labelWidth: 9,
|
|
7852
|
-
grow: true,
|
|
7853
|
-
className: css.cx(commonStyles.inlineFieldWithSecret, styles.headerValueField),
|
|
7854
|
-
htmlFor: `custom-header-${header.id}-value-input`,
|
|
7855
|
-
disabled: readOnly
|
|
7856
|
-
},
|
|
7857
|
-
/* @__PURE__ */ React__namespace.default.createElement(
|
|
7858
|
-
ui.SecretInput,
|
|
8154
|
+
),
|
|
8155
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8156
|
+
ui.InlineField,
|
|
7859
8157
|
{
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
8158
|
+
label: "Value",
|
|
8159
|
+
labelWidth: 9,
|
|
8160
|
+
grow: true,
|
|
8161
|
+
className: css.cx(commonStyles.inlineFieldWithSecret, styles.headerValueField),
|
|
8162
|
+
htmlFor: `custom-header-${header.id}-value-input`,
|
|
8163
|
+
disabled: readOnly,
|
|
8164
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8165
|
+
ui.SecretInput,
|
|
8166
|
+
{
|
|
8167
|
+
id: `custom-header-${header.id}-value-input`,
|
|
8168
|
+
isConfigured: header.configured,
|
|
8169
|
+
placeholder: "Header value",
|
|
8170
|
+
value: header.value,
|
|
8171
|
+
width: 12,
|
|
8172
|
+
onChange: (e) => onChange({ ...header, value: e.currentTarget.value }),
|
|
8173
|
+
onReset: readOnly ? () => {
|
|
8174
|
+
} : () => onChange({ ...header, configured: false, value: "" }),
|
|
8175
|
+
onBlur,
|
|
8176
|
+
className: styles.input
|
|
8177
|
+
}
|
|
8178
|
+
)
|
|
8179
|
+
}
|
|
8180
|
+
),
|
|
8181
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8182
|
+
ui.IconButton,
|
|
8183
|
+
{
|
|
8184
|
+
name: "trash-alt",
|
|
8185
|
+
tooltip: "Remove header",
|
|
8186
|
+
tooltipPlacement: "top",
|
|
8187
|
+
className: styles.removeHeaderBtn,
|
|
8188
|
+
onClick: onDelete,
|
|
8189
|
+
type: "button",
|
|
8190
|
+
disabled: readOnly
|
|
7870
8191
|
}
|
|
7871
8192
|
)
|
|
7872
|
-
)
|
|
7873
|
-
ui.IconButton,
|
|
7874
|
-
{
|
|
7875
|
-
name: "trash-alt",
|
|
7876
|
-
tooltip: "Remove header",
|
|
7877
|
-
tooltipPlacement: "top",
|
|
7878
|
-
className: styles.removeHeaderBtn,
|
|
7879
|
-
onClick: onDelete,
|
|
7880
|
-
type: "button",
|
|
7881
|
-
disabled: readOnly
|
|
7882
|
-
}
|
|
7883
|
-
)));
|
|
8193
|
+
] }) });
|
|
7884
8194
|
};
|
|
7885
8195
|
|
|
7886
8196
|
const CustomHeaders = ({ headers: headersFromProps, onChange, readOnly }) => {
|
|
@@ -7949,27 +8259,29 @@ const CustomHeaders = ({ headers: headersFromProps, onChange, readOnly }) => {
|
|
|
7949
8259
|
marginTop: spacing(1.5)
|
|
7950
8260
|
})
|
|
7951
8261
|
};
|
|
7952
|
-
return /* @__PURE__ */
|
|
8262
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.container, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7953
8263
|
ConfigSubSection,
|
|
7954
8264
|
{
|
|
7955
8265
|
title: "HTTP headers",
|
|
7956
8266
|
description: "Pass along additional context and metadata about the request/response",
|
|
7957
8267
|
isCollapsible: true,
|
|
7958
|
-
isInitiallyOpen: headers.length > 0
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
8268
|
+
isInitiallyOpen: headers.length > 0,
|
|
8269
|
+
children: [
|
|
8270
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: headers.map((header) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
8271
|
+
CustomHeader,
|
|
8272
|
+
{
|
|
8273
|
+
header,
|
|
8274
|
+
onChange: (header2) => onHeaderChange(header2.id, header2),
|
|
8275
|
+
onDelete: () => onHeaderDelete(header.id),
|
|
8276
|
+
onBlur,
|
|
8277
|
+
readOnly
|
|
8278
|
+
},
|
|
8279
|
+
header.id
|
|
8280
|
+
)) }),
|
|
8281
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.addHeaderButton, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { icon: "plus", variant: "secondary", fill: "outline", onClick: onHeaderAdd, disabled: readOnly, children: headers.length === 0 ? "Add header" : "Add another header" }) })
|
|
8282
|
+
]
|
|
8283
|
+
}
|
|
8284
|
+
) });
|
|
7973
8285
|
};
|
|
7974
8286
|
function uniqueId() {
|
|
7975
8287
|
return Math.random().toString(16).slice(2);
|
|
@@ -7992,19 +8304,23 @@ const Auth = ({
|
|
|
7992
8304
|
maxWidth: 578
|
|
7993
8305
|
})
|
|
7994
8306
|
};
|
|
7995
|
-
return /* @__PURE__ */
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
|
|
7999
|
-
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
|
|
8307
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.container, children: /* @__PURE__ */ jsxRuntime.jsxs(ConfigSection, { title: "Authentication", children: [
|
|
8308
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8309
|
+
AuthMethodSettings,
|
|
8310
|
+
{
|
|
8311
|
+
selectedMethod,
|
|
8312
|
+
mostCommonMethod,
|
|
8313
|
+
customMethods,
|
|
8314
|
+
visibleMethods,
|
|
8315
|
+
defaultOptionsOverrides,
|
|
8316
|
+
onAuthMethodSelect,
|
|
8317
|
+
basicAuth,
|
|
8318
|
+
readOnly
|
|
8319
|
+
}
|
|
8320
|
+
),
|
|
8321
|
+
TLS && /* @__PURE__ */ jsxRuntime.jsx(TLSSettings, { ...TLS, readOnly }),
|
|
8322
|
+
customHeaders && /* @__PURE__ */ jsxRuntime.jsx(CustomHeaders, { ...customHeaders, readOnly })
|
|
8323
|
+
] }) });
|
|
8008
8324
|
};
|
|
8009
8325
|
|
|
8010
8326
|
const headerNamePrefix = "httpHeaderName";
|
|
@@ -8213,34 +8529,38 @@ const ConnectionSettings = ({
|
|
|
8213
8529
|
maxWidth: 578
|
|
8214
8530
|
})
|
|
8215
8531
|
};
|
|
8216
|
-
return /* @__PURE__ */
|
|
8532
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(ConfigSection, { title: "Connection", description, className: css.cx(styles.container, className), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8217
8533
|
ui.InlineField,
|
|
8218
8534
|
{
|
|
8219
8535
|
htmlFor: "connection-url",
|
|
8220
8536
|
label: urlLabel || "URL",
|
|
8221
8537
|
labelWidth: 24,
|
|
8222
|
-
tooltip: urlTooltip || /* @__PURE__ */
|
|
8538
|
+
tooltip: urlTooltip || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8539
|
+
"Specify a complete HTTP URL",
|
|
8540
|
+
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
8541
|
+
"(for example https://example.com:8080)"
|
|
8542
|
+
] }),
|
|
8223
8543
|
grow: true,
|
|
8224
8544
|
disabled: config.readOnly,
|
|
8225
8545
|
required: true,
|
|
8226
8546
|
invalid: !isValidUrl && !config.readOnly,
|
|
8227
8547
|
error: isValidUrl ? "" : "Please enter a valid URL",
|
|
8228
|
-
interactive: true
|
|
8229
|
-
|
|
8230
|
-
|
|
8231
|
-
|
|
8232
|
-
|
|
8233
|
-
|
|
8234
|
-
|
|
8235
|
-
|
|
8236
|
-
|
|
8237
|
-
|
|
8238
|
-
|
|
8239
|
-
|
|
8240
|
-
|
|
8241
|
-
|
|
8242
|
-
|
|
8243
|
-
)));
|
|
8548
|
+
interactive: true,
|
|
8549
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8550
|
+
ui.Input,
|
|
8551
|
+
{
|
|
8552
|
+
id: "connection-url",
|
|
8553
|
+
"aria-label": "Data source connection URL",
|
|
8554
|
+
onChange: (event) => onChange({
|
|
8555
|
+
...config,
|
|
8556
|
+
url: event.currentTarget.value
|
|
8557
|
+
}),
|
|
8558
|
+
value: config.url || "",
|
|
8559
|
+
placeholder: urlPlaceholder || "URL"
|
|
8560
|
+
}
|
|
8561
|
+
)
|
|
8562
|
+
}
|
|
8563
|
+
) }) });
|
|
8244
8564
|
};
|
|
8245
8565
|
|
|
8246
8566
|
const AdvancedHttpSettings = ({
|
|
@@ -8271,48 +8591,51 @@ const AdvancedHttpSettings = ({
|
|
|
8271
8591
|
maxWidth: 578
|
|
8272
8592
|
})
|
|
8273
8593
|
};
|
|
8274
|
-
return /* @__PURE__ */
|
|
8275
|
-
|
|
8276
|
-
|
|
8277
|
-
htmlFor: "advanced-http-cookies",
|
|
8278
|
-
label: "Allowed cookies",
|
|
8279
|
-
labelWidth: 24,
|
|
8280
|
-
tooltip: "Grafana proxy deletes forwarded cookies by default. Specify cookies by name that should be forwarded to the data source.",
|
|
8281
|
-
disabled: config.readOnly,
|
|
8282
|
-
grow: true
|
|
8283
|
-
},
|
|
8284
|
-
/* @__PURE__ */ React__namespace.default.createElement(
|
|
8285
|
-
ui.TagsInput,
|
|
8594
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ConfigSubSection, { title: "Advanced HTTP settings", className: css.cx(styles.container, className), children: [
|
|
8595
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8596
|
+
ui.InlineField,
|
|
8286
8597
|
{
|
|
8287
|
-
|
|
8288
|
-
|
|
8289
|
-
|
|
8290
|
-
|
|
8598
|
+
htmlFor: "advanced-http-cookies",
|
|
8599
|
+
label: "Allowed cookies",
|
|
8600
|
+
labelWidth: 24,
|
|
8601
|
+
tooltip: "Grafana proxy deletes forwarded cookies by default. Specify cookies by name that should be forwarded to the data source.",
|
|
8602
|
+
disabled: config.readOnly,
|
|
8603
|
+
grow: true,
|
|
8604
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8605
|
+
ui.TagsInput,
|
|
8606
|
+
{
|
|
8607
|
+
id: "advanced-http-cookies",
|
|
8608
|
+
placeholder: "New cookie (hit enter to add)",
|
|
8609
|
+
tags: config.jsonData.keepCookies,
|
|
8610
|
+
onChange: onCookiesChange
|
|
8611
|
+
}
|
|
8612
|
+
)
|
|
8291
8613
|
}
|
|
8292
|
-
)
|
|
8293
|
-
|
|
8294
|
-
|
|
8295
|
-
{
|
|
8296
|
-
htmlFor: "advanced-http-timeout",
|
|
8297
|
-
label: "Timeout",
|
|
8298
|
-
labelWidth: 24,
|
|
8299
|
-
tooltip: "HTTP request timeout in seconds",
|
|
8300
|
-
disabled: config.readOnly,
|
|
8301
|
-
grow: true
|
|
8302
|
-
},
|
|
8303
|
-
/* @__PURE__ */ React__namespace.default.createElement(
|
|
8304
|
-
ui.Input,
|
|
8614
|
+
),
|
|
8615
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8616
|
+
ui.InlineField,
|
|
8305
8617
|
{
|
|
8306
|
-
|
|
8307
|
-
|
|
8308
|
-
|
|
8309
|
-
|
|
8310
|
-
|
|
8311
|
-
|
|
8312
|
-
|
|
8618
|
+
htmlFor: "advanced-http-timeout",
|
|
8619
|
+
label: "Timeout",
|
|
8620
|
+
labelWidth: 24,
|
|
8621
|
+
tooltip: "HTTP request timeout in seconds",
|
|
8622
|
+
disabled: config.readOnly,
|
|
8623
|
+
grow: true,
|
|
8624
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8625
|
+
ui.Input,
|
|
8626
|
+
{
|
|
8627
|
+
id: "advanced-http-timeout",
|
|
8628
|
+
type: "number",
|
|
8629
|
+
min: 0,
|
|
8630
|
+
placeholder: "Timeout in seconds",
|
|
8631
|
+
"aria-label": "Timeout in seconds",
|
|
8632
|
+
value: config.jsonData.timeout,
|
|
8633
|
+
onChange: onTimeoutChange
|
|
8634
|
+
}
|
|
8635
|
+
)
|
|
8313
8636
|
}
|
|
8314
8637
|
)
|
|
8315
|
-
)
|
|
8638
|
+
] });
|
|
8316
8639
|
};
|
|
8317
8640
|
|
|
8318
8641
|
var __defProp$2 = Object.defineProperty;
|
|
@@ -8338,43 +8661,47 @@ const getCustomHeaderRowStyles = ui.stylesFactory(() => {
|
|
|
8338
8661
|
});
|
|
8339
8662
|
const CustomHeaderRow = ({ header, onBlur, onChange, onRemove, onReset }) => {
|
|
8340
8663
|
const styles = getCustomHeaderRowStyles();
|
|
8341
|
-
return /* @__PURE__ */
|
|
8342
|
-
|
|
8343
|
-
|
|
8344
|
-
|
|
8345
|
-
|
|
8346
|
-
|
|
8347
|
-
|
|
8348
|
-
|
|
8349
|
-
|
|
8350
|
-
|
|
8351
|
-
|
|
8352
|
-
|
|
8353
|
-
|
|
8354
|
-
|
|
8355
|
-
|
|
8356
|
-
|
|
8357
|
-
|
|
8358
|
-
|
|
8359
|
-
|
|
8360
|
-
|
|
8361
|
-
|
|
8362
|
-
|
|
8363
|
-
|
|
8364
|
-
|
|
8365
|
-
|
|
8366
|
-
|
|
8367
|
-
|
|
8368
|
-
|
|
8369
|
-
|
|
8370
|
-
|
|
8371
|
-
|
|
8372
|
-
|
|
8373
|
-
|
|
8374
|
-
|
|
8375
|
-
|
|
8376
|
-
|
|
8377
|
-
|
|
8664
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.layout, children: [
|
|
8665
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8666
|
+
ui.LegacyForms.FormField,
|
|
8667
|
+
{
|
|
8668
|
+
label: "Header",
|
|
8669
|
+
name: "name",
|
|
8670
|
+
placeholder: "X-Custom-Header",
|
|
8671
|
+
labelWidth: 5,
|
|
8672
|
+
value: header.name || "",
|
|
8673
|
+
onChange: (e) => onChange({ ...header, name: e.target.value }),
|
|
8674
|
+
onBlur
|
|
8675
|
+
}
|
|
8676
|
+
),
|
|
8677
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8678
|
+
ui.LegacyForms.SecretFormField,
|
|
8679
|
+
{
|
|
8680
|
+
label: "Value",
|
|
8681
|
+
"aria-label": "Value",
|
|
8682
|
+
name: "value",
|
|
8683
|
+
isConfigured: header.configured,
|
|
8684
|
+
value: header.value,
|
|
8685
|
+
labelWidth: 5,
|
|
8686
|
+
inputWidth: header.configured ? 11 : 12,
|
|
8687
|
+
placeholder: "Header Value",
|
|
8688
|
+
onReset: () => onReset(header.id),
|
|
8689
|
+
onChange: (e) => onChange({ ...header, value: e.target.value }),
|
|
8690
|
+
onBlur
|
|
8691
|
+
}
|
|
8692
|
+
),
|
|
8693
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8694
|
+
ui.Button,
|
|
8695
|
+
{
|
|
8696
|
+
type: "button",
|
|
8697
|
+
"aria-label": "Remove header",
|
|
8698
|
+
variant: "secondary",
|
|
8699
|
+
size: "xs",
|
|
8700
|
+
onClick: (_e) => onRemove(header.id),
|
|
8701
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Icon, { name: "trash-alt" })
|
|
8702
|
+
}
|
|
8703
|
+
)
|
|
8704
|
+
] });
|
|
8378
8705
|
};
|
|
8379
8706
|
CustomHeaderRow.displayName = "CustomHeaderRow";
|
|
8380
8707
|
class CustomHeadersSettings extends React.PureComponent {
|
|
@@ -8462,30 +8789,34 @@ class CustomHeadersSettings extends React.PureComponent {
|
|
|
8462
8789
|
}
|
|
8463
8790
|
render() {
|
|
8464
8791
|
const { headers } = this.state;
|
|
8465
|
-
return /* @__PURE__ */
|
|
8466
|
-
|
|
8467
|
-
{
|
|
8468
|
-
|
|
8469
|
-
|
|
8470
|
-
|
|
8471
|
-
|
|
8792
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "gf-form-group", children: [
|
|
8793
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "gf-form", children: /* @__PURE__ */ jsxRuntime.jsx("h6", { children: "Custom HTTP Headers" }) }),
|
|
8794
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: headers.map((header, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
8795
|
+
CustomHeaderRow,
|
|
8796
|
+
{
|
|
8797
|
+
header,
|
|
8798
|
+
onChange: (h) => {
|
|
8799
|
+
this.onHeaderChange(i, h);
|
|
8800
|
+
},
|
|
8801
|
+
onBlur: this.updateSettings,
|
|
8802
|
+
onRemove: this.onHeaderRemove,
|
|
8803
|
+
onReset: this.onHeaderReset
|
|
8472
8804
|
},
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
|
|
8476
|
-
|
|
8477
|
-
|
|
8478
|
-
|
|
8479
|
-
|
|
8480
|
-
|
|
8481
|
-
|
|
8482
|
-
|
|
8483
|
-
|
|
8484
|
-
|
|
8805
|
+
header.id
|
|
8806
|
+
)) }),
|
|
8807
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "gf-form", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8808
|
+
ui.Button,
|
|
8809
|
+
{
|
|
8810
|
+
variant: "secondary",
|
|
8811
|
+
icon: "plus",
|
|
8812
|
+
type: "button",
|
|
8813
|
+
onClick: (e) => {
|
|
8814
|
+
this.onHeaderAdd();
|
|
8815
|
+
},
|
|
8816
|
+
children: "Add header"
|
|
8485
8817
|
}
|
|
8486
|
-
}
|
|
8487
|
-
|
|
8488
|
-
)));
|
|
8818
|
+
) })
|
|
8819
|
+
] });
|
|
8489
8820
|
}
|
|
8490
8821
|
}
|
|
8491
8822
|
|
|
@@ -8567,105 +8898,110 @@ function LabelFilterItem({
|
|
|
8567
8898
|
};
|
|
8568
8899
|
const isConflicting = isConflictingLabelFilter(item, items);
|
|
8569
8900
|
const { current: id } = React.useRef(uuid.v4());
|
|
8570
|
-
return /* @__PURE__ */
|
|
8571
|
-
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8578
|
-
|
|
8579
|
-
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
|
|
8590
|
-
|
|
8591
|
-
|
|
8592
|
-
|
|
8593
|
-
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8617
|
-
|
|
8618
|
-
|
|
8619
|
-
|
|
8620
|
-
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
labelValues
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
|
|
8639
|
-
|
|
8640
|
-
onCloseMenu: () => {
|
|
8641
|
-
setLabelValuesMenuOpen(false);
|
|
8642
|
-
},
|
|
8643
|
-
isOpen: labelValuesMenuOpen,
|
|
8644
|
-
isMulti: isMultiSelect(),
|
|
8645
|
-
isLoading: state.isLoadingLabelValues,
|
|
8646
|
-
options: getOptions(),
|
|
8647
|
-
onChange: (change) => {
|
|
8648
|
-
var _a2, _b;
|
|
8649
|
-
if (change.value) {
|
|
8650
|
-
onChange({
|
|
8651
|
-
...item,
|
|
8652
|
-
value: change.value,
|
|
8653
|
-
op: (_a2 = item.op) != null ? _a2 : defaultOp
|
|
8901
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-testid": "visual-query-builder-dimensions-filter-item", children: /* @__PURE__ */ jsxRuntime.jsx(ui.InlineField, { error: CONFLICTING_LABEL_FILTER_ERROR_MESSAGE, invalid: isConflicting ? true : undefined, children: /* @__PURE__ */ jsxRuntime.jsxs(InputGroup, { children: [
|
|
8902
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8903
|
+
ui.Select,
|
|
8904
|
+
{
|
|
8905
|
+
placeholder: "Select label",
|
|
8906
|
+
"data-testid": e2eSelectors.selectors.components.QueryBuilder.labelSelect,
|
|
8907
|
+
inputId: `visual-query-builder-dimensions-filter-item-key-${id}`,
|
|
8908
|
+
width: "auto",
|
|
8909
|
+
value: item.label ? data.toOption(item.label) : null,
|
|
8910
|
+
allowCustomValue: true,
|
|
8911
|
+
onOpenMenu: async () => {
|
|
8912
|
+
setState({ isLoadingLabelNames: true });
|
|
8913
|
+
const labelNames = await onGetLabelNames(item);
|
|
8914
|
+
setLabelNamesMenuOpen(true);
|
|
8915
|
+
setState({ labelNames, isLoadingLabelNames: undefined });
|
|
8916
|
+
},
|
|
8917
|
+
onCloseMenu: () => {
|
|
8918
|
+
setLabelNamesMenuOpen(false);
|
|
8919
|
+
},
|
|
8920
|
+
isOpen: labelNamesMenuOpen,
|
|
8921
|
+
isLoading: state.isLoadingLabelNames,
|
|
8922
|
+
options: state.labelNames,
|
|
8923
|
+
onChange: (change) => {
|
|
8924
|
+
var _a2;
|
|
8925
|
+
if (change.value) {
|
|
8926
|
+
onChange({
|
|
8927
|
+
...item,
|
|
8928
|
+
op: (_a2 = item.op) != null ? _a2 : defaultOp,
|
|
8929
|
+
label: change.value
|
|
8930
|
+
});
|
|
8931
|
+
}
|
|
8932
|
+
},
|
|
8933
|
+
invalid: isConflicting || invalidLabel
|
|
8934
|
+
}
|
|
8935
|
+
),
|
|
8936
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8937
|
+
ui.Select,
|
|
8938
|
+
{
|
|
8939
|
+
"data-testid": e2eSelectors.selectors.components.QueryBuilder.matchOperatorSelect,
|
|
8940
|
+
value: data.toOption((_a = item.op) != null ? _a : defaultOp),
|
|
8941
|
+
options: operators,
|
|
8942
|
+
width: "auto",
|
|
8943
|
+
onChange: (change) => {
|
|
8944
|
+
if (change.value) {
|
|
8945
|
+
onChange({
|
|
8946
|
+
...item,
|
|
8947
|
+
op: change.value,
|
|
8948
|
+
value: isMultiSelect(change.value) ? item.value : getSelectOptionsFromString(item == null ? undefined : item.value)[0]
|
|
8949
|
+
});
|
|
8950
|
+
}
|
|
8951
|
+
},
|
|
8952
|
+
invalid: isConflicting
|
|
8953
|
+
}
|
|
8954
|
+
),
|
|
8955
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8956
|
+
ui.Select,
|
|
8957
|
+
{
|
|
8958
|
+
placeholder: "Select value",
|
|
8959
|
+
"data-testid": e2eSelectors.selectors.components.QueryBuilder.valueSelect,
|
|
8960
|
+
inputId: `visual-query-builder-dimensions-filter-item-value-${id}`,
|
|
8961
|
+
width: "auto",
|
|
8962
|
+
value: isMultiSelect() ? getSelectOptionsFromString(item == null ? undefined : item.value).map(data.toOption) : getSelectOptionsFromString(item == null ? undefined : item.value).map(data.toOption)[0],
|
|
8963
|
+
allowCustomValue: true,
|
|
8964
|
+
onOpenMenu: async () => {
|
|
8965
|
+
setState({ isLoadingLabelValues: true });
|
|
8966
|
+
const labelValues = await onGetLabelValues(item);
|
|
8967
|
+
setState({
|
|
8968
|
+
...state,
|
|
8969
|
+
labelValues,
|
|
8970
|
+
isLoadingLabelValues: undefined
|
|
8654
8971
|
});
|
|
8655
|
-
|
|
8656
|
-
|
|
8657
|
-
|
|
8658
|
-
|
|
8659
|
-
|
|
8660
|
-
|
|
8661
|
-
|
|
8662
|
-
|
|
8663
|
-
|
|
8664
|
-
|
|
8665
|
-
|
|
8666
|
-
|
|
8667
|
-
|
|
8668
|
-
|
|
8972
|
+
setLabelValuesMenuOpen(true);
|
|
8973
|
+
},
|
|
8974
|
+
onCloseMenu: () => {
|
|
8975
|
+
setLabelValuesMenuOpen(false);
|
|
8976
|
+
},
|
|
8977
|
+
isOpen: labelValuesMenuOpen,
|
|
8978
|
+
isMulti: isMultiSelect(),
|
|
8979
|
+
isLoading: state.isLoadingLabelValues,
|
|
8980
|
+
options: getOptions(),
|
|
8981
|
+
onChange: (change) => {
|
|
8982
|
+
var _a2, _b;
|
|
8983
|
+
if (change.value) {
|
|
8984
|
+
onChange({
|
|
8985
|
+
...item,
|
|
8986
|
+
value: change.value,
|
|
8987
|
+
op: (_a2 = item.op) != null ? _a2 : defaultOp
|
|
8988
|
+
});
|
|
8989
|
+
} else {
|
|
8990
|
+
const changes = change.map((change2) => {
|
|
8991
|
+
if (change2.value) {
|
|
8992
|
+
return change2.value;
|
|
8993
|
+
} else {
|
|
8994
|
+
return undefined;
|
|
8995
|
+
}
|
|
8996
|
+
}).filter((val) => val !== undefined).join(multiValueSeparator);
|
|
8997
|
+
onChange({ ...item, value: changes, op: (_b = item.op) != null ? _b : defaultOp });
|
|
8998
|
+
}
|
|
8999
|
+
},
|
|
9000
|
+
invalid: isConflicting || invalidValue
|
|
9001
|
+
}
|
|
9002
|
+
),
|
|
9003
|
+
/* @__PURE__ */ jsxRuntime.jsx(AccessoryButton, { "aria-label": "remove", icon: "times", variant: "secondary", onClick: onDelete })
|
|
9004
|
+
] }) }) });
|
|
8669
9005
|
}
|
|
8670
9006
|
const operators = [
|
|
8671
9007
|
{ label: "=", value: "=", description: "Equals", isMultiValue: false },
|
|
@@ -8725,41 +9061,50 @@ function LabelFilters({
|
|
|
8725
9061
|
}
|
|
8726
9062
|
};
|
|
8727
9063
|
const hasLabelFilter = items.some((item) => item.label && item.value);
|
|
8728
|
-
return /* @__PURE__ */
|
|
9064
|
+
return /* @__PURE__ */ jsxRuntime.jsx(EditorFieldGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8729
9065
|
EditorField$1,
|
|
8730
9066
|
{
|
|
8731
9067
|
label: "Label filters",
|
|
8732
9068
|
error: MISSING_LABEL_FILTER_ERROR_MESSAGE,
|
|
8733
|
-
invalid: labelFilterRequired && !hasLabelFilter
|
|
8734
|
-
|
|
8735
|
-
|
|
8736
|
-
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
|
|
8742
|
-
|
|
8743
|
-
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
|
|
8753
|
-
|
|
8754
|
-
|
|
8755
|
-
|
|
8756
|
-
|
|
8757
|
-
));
|
|
9069
|
+
invalid: labelFilterRequired && !hasLabelFilter,
|
|
9070
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9071
|
+
EditorList,
|
|
9072
|
+
{
|
|
9073
|
+
items,
|
|
9074
|
+
onChange: onLabelsChange,
|
|
9075
|
+
renderItem: (item, onChangeItem, onDelete) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
9076
|
+
LabelFilterItem,
|
|
9077
|
+
{
|
|
9078
|
+
item,
|
|
9079
|
+
items,
|
|
9080
|
+
defaultOp,
|
|
9081
|
+
onChange: onChangeItem,
|
|
9082
|
+
onDelete,
|
|
9083
|
+
onGetLabelNames,
|
|
9084
|
+
onGetLabelValues,
|
|
9085
|
+
invalidLabel: labelFilterRequired && !item.label,
|
|
9086
|
+
invalidValue: labelFilterRequired && !item.value,
|
|
9087
|
+
multiValueSeparator
|
|
9088
|
+
}
|
|
9089
|
+
)
|
|
9090
|
+
}
|
|
9091
|
+
)
|
|
9092
|
+
}
|
|
9093
|
+
) });
|
|
8758
9094
|
}
|
|
8759
9095
|
|
|
8760
9096
|
function OperationExplainedBox({ title, stepNumber, markdown, children }) {
|
|
8761
9097
|
const styles = ui.useStyles2(getStyles$b);
|
|
8762
|
-
return /* @__PURE__ */
|
|
9098
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.box, children: [
|
|
9099
|
+
stepNumber !== undefined && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.stepNumber, children: stepNumber }),
|
|
9100
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.boxInner, children: [
|
|
9101
|
+
title && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.header, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: title }) }),
|
|
9102
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.body, children: [
|
|
9103
|
+
markdown && /* @__PURE__ */ jsxRuntime.jsx("div", { dangerouslySetInnerHTML: { __html: data.renderMarkdown(markdown) } }),
|
|
9104
|
+
children
|
|
9105
|
+
] })
|
|
9106
|
+
] })
|
|
9107
|
+
] });
|
|
8763
9108
|
}
|
|
8764
9109
|
const getStyles$b = (theme) => {
|
|
8765
9110
|
return {
|
|
@@ -8805,7 +9150,7 @@ const getStyles$b = (theme) => {
|
|
|
8805
9150
|
};
|
|
8806
9151
|
};
|
|
8807
9152
|
|
|
8808
|
-
const OperationInfoButton =
|
|
9153
|
+
const OperationInfoButton = React.memo(({ definition, operation, innerQueryPlaceholder }) => {
|
|
8809
9154
|
const styles = ui.useStyles2(getStyles$a);
|
|
8810
9155
|
const [show, setShow] = React.useState(false);
|
|
8811
9156
|
const { getTooltipProps, setTooltipRef, setTriggerRef, visible } = reactPopperTooltip.usePopperTooltip({
|
|
@@ -8816,32 +9161,42 @@ const OperationInfoButton = React__namespace.default.memo(({ definition, operati
|
|
|
8816
9161
|
interactive: true,
|
|
8817
9162
|
trigger: ["click"]
|
|
8818
9163
|
});
|
|
8819
|
-
return /* @__PURE__ */
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
{
|
|
8832
|
-
|
|
8833
|
-
|
|
8834
|
-
|
|
8835
|
-
|
|
8836
|
-
|
|
8837
|
-
|
|
8838
|
-
|
|
8839
|
-
|
|
8840
|
-
|
|
8841
|
-
|
|
8842
|
-
|
|
8843
|
-
|
|
8844
|
-
|
|
9164
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
9165
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9166
|
+
ui.Button,
|
|
9167
|
+
{
|
|
9168
|
+
title: "Click to show description",
|
|
9169
|
+
ref: setTriggerRef,
|
|
9170
|
+
icon: "info-circle",
|
|
9171
|
+
size: "sm",
|
|
9172
|
+
variant: "secondary",
|
|
9173
|
+
fill: "text"
|
|
9174
|
+
}
|
|
9175
|
+
),
|
|
9176
|
+
visible && /* @__PURE__ */ jsxRuntime.jsx(ui.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: setTooltipRef, ...getTooltipProps(), className: styles.docBox, children: [
|
|
9177
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.docBoxHeader, children: [
|
|
9178
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: definition.renderer(operation, definition, innerQueryPlaceholder) }),
|
|
9179
|
+
/* @__PURE__ */ jsxRuntime.jsx(FlexItem, { grow: 1 }),
|
|
9180
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9181
|
+
ui.Button,
|
|
9182
|
+
{
|
|
9183
|
+
icon: "times",
|
|
9184
|
+
onClick: () => setShow(false),
|
|
9185
|
+
fill: "text",
|
|
9186
|
+
variant: "secondary",
|
|
9187
|
+
title: "Remove operation"
|
|
9188
|
+
}
|
|
9189
|
+
)
|
|
9190
|
+
] }),
|
|
9191
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9192
|
+
"div",
|
|
9193
|
+
{
|
|
9194
|
+
className: styles.docBoxBody,
|
|
9195
|
+
dangerouslySetInnerHTML: { __html: getOperationDocs(definition, operation) }
|
|
9196
|
+
}
|
|
9197
|
+
)
|
|
9198
|
+
] }) })
|
|
9199
|
+
] });
|
|
8845
9200
|
});
|
|
8846
9201
|
OperationInfoButton.displayName = "OperationDocs";
|
|
8847
9202
|
const getStyles$a = (theme) => {
|
|
@@ -8883,7 +9238,7 @@ function getOperationDocs(def, op) {
|
|
|
8883
9238
|
return data.renderMarkdown(def.explainHandler ? def.explainHandler(op, def) : (_a = def.documentation) != null ? _a : "no docs");
|
|
8884
9239
|
}
|
|
8885
9240
|
|
|
8886
|
-
const OperationHeader =
|
|
9241
|
+
const OperationHeader = React.memo(
|
|
8887
9242
|
({ operation, definition, index, onChange, onRemove, onToggle, queryModeller, dragHandleProps }) => {
|
|
8888
9243
|
var _a;
|
|
8889
9244
|
const styles = ui.useStyles2(getStyles$9);
|
|
@@ -8896,70 +9251,82 @@ const OperationHeader = React__namespace.default.memo(
|
|
|
8896
9251
|
setState({ isOpen: true, alternatives });
|
|
8897
9252
|
}
|
|
8898
9253
|
};
|
|
8899
|
-
return /* @__PURE__ */
|
|
8900
|
-
|
|
8901
|
-
|
|
8902
|
-
|
|
8903
|
-
|
|
8904
|
-
|
|
8905
|
-
|
|
8906
|
-
|
|
8907
|
-
|
|
8908
|
-
|
|
8909
|
-
|
|
8910
|
-
|
|
8911
|
-
|
|
8912
|
-
|
|
8913
|
-
|
|
8914
|
-
|
|
8915
|
-
|
|
8916
|
-
|
|
8917
|
-
|
|
8918
|
-
|
|
8919
|
-
|
|
8920
|
-
|
|
8921
|
-
|
|
8922
|
-
|
|
8923
|
-
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
|
|
8927
|
-
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
|
|
8934
|
-
|
|
8935
|
-
|
|
8936
|
-
|
|
8937
|
-
|
|
8938
|
-
|
|
8939
|
-
|
|
8940
|
-
|
|
8941
|
-
|
|
8942
|
-
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
|
|
8951
|
-
|
|
9254
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.header, children: [
|
|
9255
|
+
!state.isOpen && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
9256
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ...dragHandleProps, children: (_a = definition.name) != null ? _a : definition.id }),
|
|
9257
|
+
/* @__PURE__ */ jsxRuntime.jsx(FlexItem, { grow: 1 }),
|
|
9258
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${styles.operationHeaderButtons} operation-header-show-on-hover`, children: [
|
|
9259
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9260
|
+
ui.Button,
|
|
9261
|
+
{
|
|
9262
|
+
icon: "angle-down",
|
|
9263
|
+
size: "sm",
|
|
9264
|
+
onClick: onToggleSwitcher,
|
|
9265
|
+
fill: "text",
|
|
9266
|
+
variant: "secondary",
|
|
9267
|
+
title: "Click to view alternative operations"
|
|
9268
|
+
}
|
|
9269
|
+
),
|
|
9270
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9271
|
+
OperationInfoButton,
|
|
9272
|
+
{
|
|
9273
|
+
definition,
|
|
9274
|
+
operation,
|
|
9275
|
+
innerQueryPlaceholder: queryModeller.innerQueryPlaceholder
|
|
9276
|
+
}
|
|
9277
|
+
),
|
|
9278
|
+
definition.toggleable && /* @__PURE__ */ jsxRuntime.jsx(
|
|
9279
|
+
ui.Button,
|
|
9280
|
+
{
|
|
9281
|
+
icon: operation.disabled ? "eye-slash" : "eye",
|
|
9282
|
+
size: "sm",
|
|
9283
|
+
onClick: () => onToggle(index),
|
|
9284
|
+
fill: "text",
|
|
9285
|
+
variant: "secondary",
|
|
9286
|
+
title: operation.disabled ? "Enable operation" : "Disable operation"
|
|
9287
|
+
}
|
|
9288
|
+
),
|
|
9289
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9290
|
+
ui.Button,
|
|
9291
|
+
{
|
|
9292
|
+
icon: "times",
|
|
9293
|
+
size: "sm",
|
|
9294
|
+
onClick: () => onRemove(index),
|
|
9295
|
+
fill: "text",
|
|
9296
|
+
variant: "secondary",
|
|
9297
|
+
title: "Remove operation"
|
|
9298
|
+
}
|
|
9299
|
+
)
|
|
9300
|
+
] })
|
|
9301
|
+
] }),
|
|
9302
|
+
state.isOpen && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.selectWrapper, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9303
|
+
ui.Select,
|
|
9304
|
+
{
|
|
9305
|
+
autoFocus: true,
|
|
9306
|
+
openMenuOnFocus: true,
|
|
9307
|
+
placeholder: "Replace with",
|
|
9308
|
+
options: state.alternatives,
|
|
9309
|
+
isOpen: true,
|
|
9310
|
+
onCloseMenu: onToggleSwitcher,
|
|
9311
|
+
onChange: (value) => {
|
|
9312
|
+
if (value.value) {
|
|
9313
|
+
const newDef = queryModeller.getOperationDefinition(value.value.id);
|
|
9314
|
+
const newParams = [...newDef.defaultParams];
|
|
9315
|
+
for (let i = 0; i < Math.min(operation.params.length, newParams.length); i++) {
|
|
9316
|
+
if (newDef.params[i].type === definition.params[i].type) {
|
|
9317
|
+
newParams[i] = operation.params[i];
|
|
9318
|
+
}
|
|
8952
9319
|
}
|
|
9320
|
+
const changedOp = { ...operation, params: newParams, id: value.value.id };
|
|
9321
|
+
onChange(
|
|
9322
|
+
index,
|
|
9323
|
+
definition.changeTypeHandler ? definition.changeTypeHandler(changedOp, newDef) : changedOp
|
|
9324
|
+
);
|
|
8953
9325
|
}
|
|
8954
|
-
const changedOp = { ...operation, params: newParams, id: value.value.id };
|
|
8955
|
-
onChange(
|
|
8956
|
-
index,
|
|
8957
|
-
definition.changeTypeHandler ? definition.changeTypeHandler(changedOp, newDef) : changedOp
|
|
8958
|
-
);
|
|
8959
9326
|
}
|
|
8960
9327
|
}
|
|
8961
|
-
}
|
|
8962
|
-
)
|
|
9328
|
+
) })
|
|
9329
|
+
] });
|
|
8963
9330
|
}
|
|
8964
9331
|
);
|
|
8965
9332
|
OperationHeader.displayName = "OperationHeader";
|
|
@@ -8998,7 +9365,7 @@ function getOperationParamEditor(paramDef) {
|
|
|
8998
9365
|
}
|
|
8999
9366
|
function SimpleInputParamEditor(props) {
|
|
9000
9367
|
var _a;
|
|
9001
|
-
return /* @__PURE__ */
|
|
9368
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9002
9369
|
ui.AutoSizeInput,
|
|
9003
9370
|
{
|
|
9004
9371
|
id: getOperationParamId(props.operationId, props.index),
|
|
@@ -9017,7 +9384,7 @@ function SimpleInputParamEditor(props) {
|
|
|
9017
9384
|
);
|
|
9018
9385
|
}
|
|
9019
9386
|
function BoolInputParamEditor(props) {
|
|
9020
|
-
return /* @__PURE__ */
|
|
9387
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9021
9388
|
ui.Checkbox,
|
|
9022
9389
|
{
|
|
9023
9390
|
id: getOperationParamId(props.operationId, props.index),
|
|
@@ -9044,41 +9411,44 @@ function SelectInputParamEditor({
|
|
|
9044
9411
|
}
|
|
9045
9412
|
let valueOption = (_b = selectOptions.find((x) => x.value === value)) != null ? _b : data.toOption(value);
|
|
9046
9413
|
if (!value && paramDef.optional) {
|
|
9047
|
-
return /* @__PURE__ */
|
|
9414
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.optionalParam, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9048
9415
|
ui.Button,
|
|
9049
9416
|
{
|
|
9050
9417
|
size: "sm",
|
|
9051
9418
|
variant: "secondary",
|
|
9052
9419
|
title: `Add ${paramDef.name}`,
|
|
9053
9420
|
icon: "plus",
|
|
9054
|
-
onClick: () => onChange(index, selectOptions[0].value)
|
|
9055
|
-
|
|
9056
|
-
|
|
9057
|
-
));
|
|
9421
|
+
onClick: () => onChange(index, selectOptions[0].value),
|
|
9422
|
+
children: paramDef.name
|
|
9423
|
+
}
|
|
9424
|
+
) });
|
|
9058
9425
|
}
|
|
9059
|
-
return /* @__PURE__ */
|
|
9060
|
-
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
|
|
9064
|
-
|
|
9065
|
-
|
|
9066
|
-
|
|
9067
|
-
|
|
9068
|
-
|
|
9069
|
-
|
|
9070
|
-
|
|
9071
|
-
|
|
9072
|
-
|
|
9073
|
-
|
|
9074
|
-
|
|
9075
|
-
|
|
9076
|
-
|
|
9077
|
-
|
|
9078
|
-
|
|
9079
|
-
|
|
9080
|
-
|
|
9081
|
-
|
|
9426
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(EditorStack, { gap: 0.5, direction: "row", alignItems: "center", children: [
|
|
9427
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9428
|
+
ui.Select,
|
|
9429
|
+
{
|
|
9430
|
+
id: getOperationParamId(operationId, index),
|
|
9431
|
+
value: valueOption,
|
|
9432
|
+
options: selectOptions,
|
|
9433
|
+
placeholder: paramDef.placeholder,
|
|
9434
|
+
allowCustomValue: true,
|
|
9435
|
+
onChange: (value2) => onChange(index, value2.value),
|
|
9436
|
+
width: paramDef.minWidth || "auto"
|
|
9437
|
+
}
|
|
9438
|
+
),
|
|
9439
|
+
paramDef.optional && /* @__PURE__ */ jsxRuntime.jsx(
|
|
9440
|
+
ui.Button,
|
|
9441
|
+
{
|
|
9442
|
+
"data-testid": `operations.${index}.remove-param`,
|
|
9443
|
+
size: "sm",
|
|
9444
|
+
fill: "text",
|
|
9445
|
+
icon: "times",
|
|
9446
|
+
variant: "secondary",
|
|
9447
|
+
title: `Remove ${paramDef.name}`,
|
|
9448
|
+
onClick: () => onChange(index, "")
|
|
9449
|
+
}
|
|
9450
|
+
)
|
|
9451
|
+
] });
|
|
9082
9452
|
}
|
|
9083
9453
|
const getStyles$8 = (theme) => {
|
|
9084
9454
|
return {
|
|
@@ -9135,7 +9505,7 @@ function OperationEditorBody({
|
|
|
9135
9505
|
restParam = renderAddRestParamButton(lastParamDef, onAddRestParam, index, operation.params.length, styles);
|
|
9136
9506
|
}
|
|
9137
9507
|
}
|
|
9138
|
-
return /* @__PURE__ */
|
|
9508
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9139
9509
|
"div",
|
|
9140
9510
|
{
|
|
9141
9511
|
className: css.cx(styles.card, {
|
|
@@ -9145,54 +9515,68 @@ function OperationEditorBody({
|
|
|
9145
9515
|
}),
|
|
9146
9516
|
ref: provided.innerRef,
|
|
9147
9517
|
...provided.draggableProps,
|
|
9148
|
-
"data-testid": `operations.${index}.wrapper
|
|
9149
|
-
|
|
9150
|
-
|
|
9151
|
-
|
|
9152
|
-
|
|
9153
|
-
|
|
9154
|
-
|
|
9155
|
-
|
|
9156
|
-
|
|
9157
|
-
|
|
9158
|
-
|
|
9159
|
-
|
|
9160
|
-
|
|
9161
|
-
|
|
9162
|
-
|
|
9163
|
-
|
|
9164
|
-
|
|
9165
|
-
|
|
9166
|
-
|
|
9167
|
-
|
|
9168
|
-
|
|
9169
|
-
|
|
9170
|
-
|
|
9171
|
-
|
|
9172
|
-
|
|
9173
|
-
|
|
9174
|
-
|
|
9175
|
-
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
|
|
9183
|
-
|
|
9184
|
-
|
|
9185
|
-
|
|
9186
|
-
|
|
9187
|
-
|
|
9188
|
-
|
|
9189
|
-
|
|
9190
|
-
|
|
9191
|
-
|
|
9192
|
-
|
|
9193
|
-
|
|
9194
|
-
|
|
9195
|
-
|
|
9518
|
+
"data-testid": `operations.${index}.wrapper`,
|
|
9519
|
+
children: [
|
|
9520
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9521
|
+
OperationHeader,
|
|
9522
|
+
{
|
|
9523
|
+
operation,
|
|
9524
|
+
dragHandleProps: provided.dragHandleProps,
|
|
9525
|
+
definition,
|
|
9526
|
+
index,
|
|
9527
|
+
onChange,
|
|
9528
|
+
onRemove,
|
|
9529
|
+
onToggle,
|
|
9530
|
+
queryModeller
|
|
9531
|
+
}
|
|
9532
|
+
),
|
|
9533
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.body, children: operation.params.map((param, paramIndex) => {
|
|
9534
|
+
const paramDef = definition.params[Math.min(definition.params.length - 1, paramIndex)];
|
|
9535
|
+
const Editor = getOperationParamEditor(paramDef);
|
|
9536
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.paramRow, children: [
|
|
9537
|
+
!paramDef.hideName && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.paramName, children: [
|
|
9538
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: getOperationParamId(id, paramIndex), children: paramDef.name }),
|
|
9539
|
+
paramDef.description && /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { placement: "top", content: paramDef.description, theme: "info", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Icon, { name: "info-circle", size: "sm", className: styles.infoIcon }) })
|
|
9540
|
+
] }),
|
|
9541
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.paramValue, children: /* @__PURE__ */ jsxRuntime.jsxs(EditorStack, { gap: 0.5, direction: "row", alignItems: "center", wrap: false, children: [
|
|
9542
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9543
|
+
Editor,
|
|
9544
|
+
{
|
|
9545
|
+
index: paramIndex,
|
|
9546
|
+
paramDef,
|
|
9547
|
+
value: operation.params[paramIndex],
|
|
9548
|
+
operation,
|
|
9549
|
+
operationId: id,
|
|
9550
|
+
onChange: onParamValueChanged,
|
|
9551
|
+
onRunQuery,
|
|
9552
|
+
query,
|
|
9553
|
+
datasource,
|
|
9554
|
+
timeRange,
|
|
9555
|
+
queryModeller
|
|
9556
|
+
}
|
|
9557
|
+
),
|
|
9558
|
+
paramDef.restParam && (operation.params.length > definition.params.length || paramDef.optional) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
9559
|
+
ui.Button,
|
|
9560
|
+
{
|
|
9561
|
+
"data-testid": `operations.${index}.remove-rest-param`,
|
|
9562
|
+
size: "sm",
|
|
9563
|
+
fill: "text",
|
|
9564
|
+
icon: "times",
|
|
9565
|
+
variant: "secondary",
|
|
9566
|
+
title: `Remove ${paramDef.name}`,
|
|
9567
|
+
onClick: () => onRemoveRestParam(paramIndex)
|
|
9568
|
+
}
|
|
9569
|
+
)
|
|
9570
|
+
] }) })
|
|
9571
|
+
] }, `${paramIndex}-1`);
|
|
9572
|
+
}) }),
|
|
9573
|
+
restParam,
|
|
9574
|
+
index < query.operations.length - 1 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.arrow, children: [
|
|
9575
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.arrowLine }),
|
|
9576
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.arrowArrow })
|
|
9577
|
+
] })
|
|
9578
|
+
]
|
|
9579
|
+
}
|
|
9196
9580
|
);
|
|
9197
9581
|
}
|
|
9198
9582
|
const getStyles$7 = (theme, isConflicting) => {
|
|
@@ -9303,7 +9687,7 @@ function callParamChangedThenOnChange(def, operation, operationIndex, paramIndex
|
|
|
9303
9687
|
}
|
|
9304
9688
|
}
|
|
9305
9689
|
function renderAddRestParamButton(paramDef, onAddRestParam, operationIndex, paramIndex, styles) {
|
|
9306
|
-
return /* @__PURE__ */
|
|
9690
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.restParam, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9307
9691
|
ui.Button,
|
|
9308
9692
|
{
|
|
9309
9693
|
size: "sm",
|
|
@@ -9311,10 +9695,10 @@ function renderAddRestParamButton(paramDef, onAddRestParam, operationIndex, para
|
|
|
9311
9695
|
title: `Add ${paramDef.name}`.trimEnd(),
|
|
9312
9696
|
variant: "secondary",
|
|
9313
9697
|
onClick: onAddRestParam,
|
|
9314
|
-
"data-testid": `operations.${operationIndex}.add-rest-param
|
|
9315
|
-
|
|
9316
|
-
|
|
9317
|
-
));
|
|
9698
|
+
"data-testid": `operations.${operationIndex}.add-rest-param`,
|
|
9699
|
+
children: paramDef.name
|
|
9700
|
+
}
|
|
9701
|
+
) }, `${paramIndex}-2`);
|
|
9318
9702
|
}
|
|
9319
9703
|
|
|
9320
9704
|
function OperationEditor({
|
|
@@ -9337,7 +9721,11 @@ function OperationEditor({
|
|
|
9337
9721
|
const isConflicting = isConflictingOperation ? isConflictingOperation(operation, query.operations) : false;
|
|
9338
9722
|
const styles = getStyles$6(theme);
|
|
9339
9723
|
if (!def) {
|
|
9340
|
-
return /* @__PURE__ */
|
|
9724
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
9725
|
+
"Operation ",
|
|
9726
|
+
operation.id,
|
|
9727
|
+
" not found"
|
|
9728
|
+
] });
|
|
9341
9729
|
}
|
|
9342
9730
|
const isInvalid = (isDragging) => {
|
|
9343
9731
|
if (isDragging) {
|
|
@@ -9345,34 +9733,34 @@ function OperationEditor({
|
|
|
9345
9733
|
}
|
|
9346
9734
|
return isConflicting ? true : undefined;
|
|
9347
9735
|
};
|
|
9348
|
-
return /* @__PURE__ */
|
|
9736
|
+
return /* @__PURE__ */ jsxRuntime.jsx(dnd.Draggable, { draggableId: `operation-${index}`, index, children: (provided, snapshot) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
9349
9737
|
ui.InlineField,
|
|
9350
9738
|
{
|
|
9351
9739
|
error: "You have conflicting label filters",
|
|
9352
9740
|
invalid: isInvalid(snapshot.isDragging),
|
|
9353
|
-
className: css.cx(styles.error, styles.cardWrapper)
|
|
9354
|
-
|
|
9355
|
-
|
|
9356
|
-
|
|
9357
|
-
|
|
9358
|
-
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
|
|
9368
|
-
|
|
9369
|
-
|
|
9370
|
-
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
));
|
|
9741
|
+
className: css.cx(styles.error, styles.cardWrapper),
|
|
9742
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9743
|
+
OperationEditorBody,
|
|
9744
|
+
{
|
|
9745
|
+
provided,
|
|
9746
|
+
flash,
|
|
9747
|
+
highlight,
|
|
9748
|
+
isConflicting,
|
|
9749
|
+
index,
|
|
9750
|
+
operation,
|
|
9751
|
+
definition: def,
|
|
9752
|
+
onChange,
|
|
9753
|
+
onRemove,
|
|
9754
|
+
onToggle,
|
|
9755
|
+
queryModeller,
|
|
9756
|
+
query,
|
|
9757
|
+
timeRange,
|
|
9758
|
+
onRunQuery,
|
|
9759
|
+
datasource
|
|
9760
|
+
}
|
|
9761
|
+
)
|
|
9762
|
+
}
|
|
9763
|
+
) });
|
|
9376
9764
|
}
|
|
9377
9765
|
const getStyles$6 = (theme, isConflicting) => {
|
|
9378
9766
|
return {
|
|
@@ -9443,38 +9831,44 @@ function OperationList({
|
|
|
9443
9831
|
const onCascaderBlur = () => {
|
|
9444
9832
|
setCascaderOpen(false);
|
|
9445
9833
|
};
|
|
9446
|
-
return /* @__PURE__ */
|
|
9447
|
-
|
|
9448
|
-
|
|
9449
|
-
|
|
9450
|
-
|
|
9451
|
-
|
|
9452
|
-
|
|
9453
|
-
|
|
9454
|
-
|
|
9455
|
-
|
|
9456
|
-
|
|
9457
|
-
|
|
9458
|
-
|
|
9459
|
-
|
|
9460
|
-
|
|
9461
|
-
|
|
9462
|
-
|
|
9463
|
-
|
|
9834
|
+
return /* @__PURE__ */ jsxRuntime.jsx(EditorStack, { gap: 1, direction: "column", children: /* @__PURE__ */ jsxRuntime.jsxs(EditorStack, { gap: 1, children: [
|
|
9835
|
+
operations.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(dnd.DragDropContext, { onDragEnd, children: /* @__PURE__ */ jsxRuntime.jsx(dnd.Droppable, { droppableId: "sortable-field-mappings", direction: "horizontal", children: (provided) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.operationList, ref: provided.innerRef, ...provided.droppableProps, children: [
|
|
9836
|
+
operations.map((op, index) => {
|
|
9837
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9838
|
+
OperationEditor,
|
|
9839
|
+
{
|
|
9840
|
+
queryModeller,
|
|
9841
|
+
index,
|
|
9842
|
+
operation: op,
|
|
9843
|
+
query,
|
|
9844
|
+
datasource,
|
|
9845
|
+
onChange: onOperationChange,
|
|
9846
|
+
onRemove,
|
|
9847
|
+
onToggle,
|
|
9848
|
+
onRunQuery,
|
|
9849
|
+
flash: opsToHighlight[index],
|
|
9850
|
+
highlight: highlightedOp === op,
|
|
9851
|
+
timeRange,
|
|
9852
|
+
isConflictingOperation
|
|
9853
|
+
},
|
|
9854
|
+
op.id + JSON.stringify(op.params) + index
|
|
9855
|
+
);
|
|
9856
|
+
}),
|
|
9857
|
+
provided.placeholder
|
|
9858
|
+
] }) }) }),
|
|
9859
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.addButton, children: cascaderOpen ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
9860
|
+
ui.Cascader,
|
|
9861
|
+
{
|
|
9862
|
+
options: addOptions,
|
|
9863
|
+
onSelect: onAddOperation,
|
|
9864
|
+
onBlur: onCascaderBlur,
|
|
9865
|
+
autoFocus: true,
|
|
9866
|
+
alwaysOpen: true,
|
|
9867
|
+
hideActiveLevelLabel: true,
|
|
9868
|
+
placeholder: "Search"
|
|
9464
9869
|
}
|
|
9465
|
-
)
|
|
9466
|
-
})
|
|
9467
|
-
ui.Cascader,
|
|
9468
|
-
{
|
|
9469
|
-
options: addOptions,
|
|
9470
|
-
onSelect: onAddOperation,
|
|
9471
|
-
onBlur: onCascaderBlur,
|
|
9472
|
-
autoFocus: true,
|
|
9473
|
-
alwaysOpen: true,
|
|
9474
|
-
hideActiveLevelLabel: true,
|
|
9475
|
-
placeholder: "Search"
|
|
9476
|
-
}
|
|
9477
|
-
) : /* @__PURE__ */ React__namespace.default.createElement(ui.Button, { icon: "plus", variant: "secondary", onClick: () => setCascaderOpen(true), title: "Add operation" }, "Operations"))));
|
|
9870
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { icon: "plus", variant: "secondary", onClick: () => setCascaderOpen(true), title: "Add operation", children: "Operations" }) })
|
|
9871
|
+
] }) });
|
|
9478
9872
|
}
|
|
9479
9873
|
function useOperationsHighlight(operations) {
|
|
9480
9874
|
const isMounted = reactUse.useMountedState();
|
|
@@ -9531,7 +9925,7 @@ function RawQuery({ query, language, className }) {
|
|
|
9531
9925
|
const theme = ui.useTheme2();
|
|
9532
9926
|
const styles = getStyles$4(theme);
|
|
9533
9927
|
const highlighted = Prism__default.default.highlight(query, language.grammar, language.name);
|
|
9534
|
-
return /* @__PURE__ */
|
|
9928
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9535
9929
|
"div",
|
|
9536
9930
|
{
|
|
9537
9931
|
className: css.cx(styles.editorField, "prism-syntax-highlight", className),
|
|
@@ -9557,7 +9951,7 @@ function OperationListExplained({
|
|
|
9557
9951
|
onMouseEnter,
|
|
9558
9952
|
onMouseLeave
|
|
9559
9953
|
}) {
|
|
9560
|
-
return /* @__PURE__ */
|
|
9954
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: query.operations.map((op, index) => {
|
|
9561
9955
|
var _a;
|
|
9562
9956
|
const def = queryModeller.getOperationDefinition(op.id);
|
|
9563
9957
|
if (!def) {
|
|
@@ -9565,28 +9959,28 @@ function OperationListExplained({
|
|
|
9565
9959
|
}
|
|
9566
9960
|
const title = def.renderer(op, def, queryModeller.innerQueryPlaceholder);
|
|
9567
9961
|
const body = def.explainHandler ? def.explainHandler(op, def) : (_a = def.documentation) != null ? _a : "no docs";
|
|
9568
|
-
return /* @__PURE__ */
|
|
9962
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9569
9963
|
"div",
|
|
9570
9964
|
{
|
|
9571
|
-
key: index,
|
|
9572
9965
|
onMouseEnter: () => onMouseEnter == null ? undefined : onMouseEnter(op, index),
|
|
9573
|
-
onMouseLeave: () => onMouseLeave == null ? undefined : onMouseLeave(op, index)
|
|
9966
|
+
onMouseLeave: () => onMouseLeave == null ? undefined : onMouseLeave(op, index),
|
|
9967
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9968
|
+
OperationExplainedBox,
|
|
9969
|
+
{
|
|
9970
|
+
stepNumber: index + stepNumber,
|
|
9971
|
+
title: /* @__PURE__ */ jsxRuntime.jsx(RawQuery, { query: title, language }),
|
|
9972
|
+
markdown: body
|
|
9973
|
+
}
|
|
9974
|
+
)
|
|
9574
9975
|
},
|
|
9575
|
-
|
|
9576
|
-
OperationExplainedBox,
|
|
9577
|
-
{
|
|
9578
|
-
stepNumber: index + stepNumber,
|
|
9579
|
-
title: /* @__PURE__ */ React__namespace.default.createElement(RawQuery, { query: title, language }),
|
|
9580
|
-
markdown: body
|
|
9581
|
-
}
|
|
9582
|
-
)
|
|
9976
|
+
index
|
|
9583
9977
|
);
|
|
9584
|
-
}));
|
|
9978
|
+
}) });
|
|
9585
9979
|
}
|
|
9586
9980
|
|
|
9587
9981
|
function OperationsEditorRow({ children }) {
|
|
9588
9982
|
const styles = ui.useStyles2(getStyles$3);
|
|
9589
|
-
return /* @__PURE__ */
|
|
9983
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.root, children: /* @__PURE__ */ jsxRuntime.jsx(EditorStack, { gap: 1, children }) });
|
|
9590
9984
|
}
|
|
9591
9985
|
const getStyles$3 = (theme) => {
|
|
9592
9986
|
return {
|
|
@@ -9618,9 +10012,9 @@ const QueryBuilderHints = ({
|
|
|
9618
10012
|
});
|
|
9619
10013
|
return hints2 != null ? hints2 : [];
|
|
9620
10014
|
}, [datasource, visualQuery, data, queryModeller, buildDataQueryFromQueryString]);
|
|
9621
|
-
return /* @__PURE__ */
|
|
10015
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: hints.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.container, children: hints.map((hint) => {
|
|
9622
10016
|
var _a, _b, _c, _d;
|
|
9623
|
-
return /* @__PURE__ */
|
|
10017
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { content: `${hint.label} ${(_a = hint.fix) == null ? undefined : _a.label}`, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9624
10018
|
ui.Button,
|
|
9625
10019
|
{
|
|
9626
10020
|
onClick: () => {
|
|
@@ -9642,12 +10036,14 @@ const QueryBuilderHints = ({
|
|
|
9642
10036
|
},
|
|
9643
10037
|
fill: "outline",
|
|
9644
10038
|
size: "sm",
|
|
9645
|
-
className: styles.hint
|
|
9646
|
-
|
|
9647
|
-
|
|
9648
|
-
|
|
9649
|
-
|
|
9650
|
-
|
|
10039
|
+
className: styles.hint,
|
|
10040
|
+
children: [
|
|
10041
|
+
"hint: ",
|
|
10042
|
+
((_b = hint.fix) == null ? undefined : _b.title) || ((_d = (_c = hint.fix) == null ? undefined : _c.action) == null ? undefined : _d.type.toLowerCase().replace("_", " "))
|
|
10043
|
+
]
|
|
10044
|
+
}
|
|
10045
|
+
) }, hint.type);
|
|
10046
|
+
}) }) });
|
|
9651
10047
|
};
|
|
9652
10048
|
QueryBuilderHints.displayName = "QueryBuilderHints";
|
|
9653
10049
|
const getStyles$2 = (theme) => {
|
|
@@ -9667,14 +10063,17 @@ const editorModes = [
|
|
|
9667
10063
|
{ label: "Code", value: QueryEditorMode.Code }
|
|
9668
10064
|
];
|
|
9669
10065
|
function QueryEditorModeToggle({ mode, onChange }) {
|
|
9670
|
-
return /* @__PURE__ */
|
|
10066
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-testid": "QueryEditorModeToggle", children: /* @__PURE__ */ jsxRuntime.jsx(ui.RadioButtonGroup, { options: editorModes, size: "sm", value: mode, onChange }) });
|
|
9671
10067
|
}
|
|
9672
10068
|
|
|
9673
10069
|
function QueryHeaderSwitch({ label, ...inputProps }) {
|
|
9674
10070
|
const dashedLabel = label.replace(" ", "-");
|
|
9675
10071
|
const switchIdRef = React.useRef(lodash.uniqueId(`switch-${dashedLabel}`));
|
|
9676
10072
|
const styles = ui.useStyles2(getStyles$1);
|
|
9677
|
-
return /* @__PURE__ */
|
|
10073
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(EditorStack, { gap: 1, children: [
|
|
10074
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: switchIdRef.current, className: styles.switchLabel, children: label }),
|
|
10075
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Switch, { ...inputProps, id: switchIdRef.current })
|
|
10076
|
+
] });
|
|
9678
10077
|
}
|
|
9679
10078
|
const getStyles$1 = (theme) => {
|
|
9680
10079
|
return {
|
|
@@ -9692,17 +10091,24 @@ const getStyles$1 = (theme) => {
|
|
|
9692
10091
|
function QueryOptionGroup({ title, children, collapsedInfo, queryStats }) {
|
|
9693
10092
|
const [isOpen, toggleOpen] = reactUse.useToggle(false);
|
|
9694
10093
|
const styles = ui.useStyles2(getStyles);
|
|
9695
|
-
return /* @__PURE__ */
|
|
9696
|
-
|
|
9697
|
-
|
|
9698
|
-
|
|
9699
|
-
|
|
9700
|
-
|
|
9701
|
-
|
|
9702
|
-
|
|
9703
|
-
|
|
9704
|
-
|
|
9705
|
-
|
|
10094
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.wrapper, children: [
|
|
10095
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10096
|
+
ui.Collapse,
|
|
10097
|
+
{
|
|
10098
|
+
className: styles.collapse,
|
|
10099
|
+
collapsible: true,
|
|
10100
|
+
isOpen,
|
|
10101
|
+
onToggle: toggleOpen,
|
|
10102
|
+
label: /* @__PURE__ */ jsxRuntime.jsxs(EditorStack, { gap: 0, children: [
|
|
10103
|
+
/* @__PURE__ */ jsxRuntime.jsx("h6", { className: styles.title, children: title }),
|
|
10104
|
+
!isOpen && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.description, children: collapsedInfo.map((x, i) => /* @__PURE__ */ jsxRuntime.jsx("span", { children: x }, i)) })
|
|
10105
|
+
] }),
|
|
10106
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.body, children })
|
|
10107
|
+
}
|
|
10108
|
+
),
|
|
10109
|
+
queryStats && runtime.config.featureToggles.lokiQuerySplitting && /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { content: "Note: the query will be split into multiple parts and executed in sequence. Query limits will only apply each individual part.", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Icon, { tabIndex: 0, name: "info-circle", className: styles.tooltip, size: "sm" }) }),
|
|
10110
|
+
queryStats && /* @__PURE__ */ jsxRuntime.jsx("p", { className: styles.stats, children: generateQueryStats(queryStats) })
|
|
10111
|
+
] });
|
|
9706
10112
|
}
|
|
9707
10113
|
const getStyles = (theme) => {
|
|
9708
10114
|
return {
|
|
@@ -40008,6 +40414,7 @@ exports.AdvancedHttpSettings = AdvancedHttpSettings;
|
|
|
40008
40414
|
exports.Auth = Auth;
|
|
40009
40415
|
exports.AuthMethod = AuthMethod;
|
|
40010
40416
|
exports.BINARY_OPERATIONS_KEY = BINARY_OPERATIONS_KEY;
|
|
40417
|
+
exports.CatalogSelector = CatalogSelector;
|
|
40011
40418
|
exports.CompletionItemInsertTextRule = CompletionItemInsertTextRule;
|
|
40012
40419
|
exports.CompletionItemKind = CompletionItemKind;
|
|
40013
40420
|
exports.CompletionItemPriority = CompletionItemPriority;
|
|
@@ -40020,6 +40427,7 @@ exports.DataLink = DataLink;
|
|
|
40020
40427
|
exports.DataLinks = DataLinks;
|
|
40021
40428
|
exports.DataSourceDescription = DataSourceDescription;
|
|
40022
40429
|
exports.DataSourcePicker = DataSourcePicker;
|
|
40430
|
+
exports.DatasetSelector = DatasetSelector;
|
|
40023
40431
|
exports.DatePicker = DatePicker;
|
|
40024
40432
|
exports.DatePickerWithInput = DatePickerWithInput;
|
|
40025
40433
|
exports.DebounceInput = DebounceInput;
|
|
@@ -40066,6 +40474,7 @@ exports.SqlQueryEditor = SqlQueryEditor;
|
|
|
40066
40474
|
exports.StatementPosition = StatementPosition;
|
|
40067
40475
|
exports.SuggestionKind = SuggestionKind;
|
|
40068
40476
|
exports.TLSSettings = TLSSettings;
|
|
40477
|
+
exports.TableSelector = TableSelector;
|
|
40069
40478
|
exports.TokenType = TokenType;
|
|
40070
40479
|
exports.convertLegacyAuthProps = convertLegacyAuthProps;
|
|
40071
40480
|
exports.formatDate = formatDate;
|