@grafana/plugin-ui 0.10.9 → 0.11.0
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 +1799 -1325
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +94 -46
- 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 +54 -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 +3 -2
- 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 +44 -37
- package/dist/esm/components/QueryEditor/QueryEditor.js.map +1 -1
- package/dist/esm/components/QueryEditor/QueryHeader.js +172 -95
- 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/SchemaSelector.js +56 -0
- package/dist/esm/components/QueryEditor/SchemaSelector.js.map +1 -0
- 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 +21 -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/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 +40 -34
- package/dist/esm/components/SQLEditor/components/SQLEditor.js.map +1 -1
- package/dist/esm/components/SQLEditor/hooks/useLatestCallback.js +16 -0
- package/dist/esm/components/SQLEditor/hooks/useLatestCallback.js.map +1 -0
- 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/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 +94 -46
- package/dist/esm/index.js +4 -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")
|
|
509
|
+
}
|
|
510
|
+
),
|
|
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"
|
|
544
535
|
}
|
|
545
536
|
),
|
|
546
|
-
|
|
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) => {
|
|
@@ -2880,6 +2913,18 @@ const standardSQLLanguageDefinition = {
|
|
|
2880
2913
|
completionProvider: getStandardSQLCompletionProvider
|
|
2881
2914
|
};
|
|
2882
2915
|
|
|
2916
|
+
function useLatestCallback(callback) {
|
|
2917
|
+
const ref = React.useRef(callback);
|
|
2918
|
+
React.useEffect(() => {
|
|
2919
|
+
ref.current = callback;
|
|
2920
|
+
});
|
|
2921
|
+
const hasCallback = Boolean(callback);
|
|
2922
|
+
return React.useMemo(
|
|
2923
|
+
() => hasCallback ? (...args) => ref.current(...args) : undefined,
|
|
2924
|
+
[hasCallback]
|
|
2925
|
+
);
|
|
2926
|
+
}
|
|
2927
|
+
|
|
2883
2928
|
const STANDARD_SQL_LANGUAGE = "sql";
|
|
2884
2929
|
const LANGUAGES_CACHE = /* @__PURE__ */ new Map();
|
|
2885
2930
|
const INSTANCE_CACHE = /* @__PURE__ */ new Map();
|
|
@@ -2894,6 +2939,7 @@ const SQLEditor = ({
|
|
|
2894
2939
|
}) => {
|
|
2895
2940
|
const monacoRef = React.useRef(null);
|
|
2896
2941
|
const langUid = React.useRef();
|
|
2942
|
+
const stableOnChange = useLatestCallback(onChange);
|
|
2897
2943
|
const id = React.useMemo(() => {
|
|
2898
2944
|
const uid = uuid.v4();
|
|
2899
2945
|
const id2 = `${language.id}-${uid}`;
|
|
@@ -2914,42 +2960,45 @@ const SQLEditor = ({
|
|
|
2914
2960
|
}
|
|
2915
2961
|
}, []);
|
|
2916
2962
|
const onSqlBlur = (text) => {
|
|
2917
|
-
|
|
2963
|
+
stableOnChange && stableOnChange(text, false);
|
|
2918
2964
|
onBlur && onBlur(text);
|
|
2919
2965
|
};
|
|
2920
|
-
return /* @__PURE__ */
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
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
|
+
}
|
|
2950
2998
|
}
|
|
2951
|
-
|
|
2952
|
-
|
|
2999
|
+
),
|
|
3000
|
+
children && children({ formatQuery })
|
|
3001
|
+
] });
|
|
2953
3002
|
};
|
|
2954
3003
|
const resolveLanguage = (monaco, languageDefinitionProp) => {
|
|
2955
3004
|
if ((languageDefinitionProp == null ? undefined : languageDefinitionProp.id) !== STANDARD_SQL_LANGUAGE && !languageDefinitionProp.loader) {
|
|
@@ -5467,10 +5516,10 @@ const toOption = (_a = data.toOption) != null ? _a : backWardToOption;
|
|
|
5467
5516
|
|
|
5468
5517
|
const EditorStack = ({ children, wrap: wrapItems = true, ...props }) => {
|
|
5469
5518
|
var _a, _b;
|
|
5470
|
-
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 });
|
|
5471
5520
|
};
|
|
5472
5521
|
|
|
5473
|
-
const EditorList =
|
|
5522
|
+
const EditorList = React.forwardRef(function EditorList2({ items, renderItem, onChange }, ref) {
|
|
5474
5523
|
const onAddItem = () => {
|
|
5475
5524
|
const newItems = [...items, {}];
|
|
5476
5525
|
onChange(newItems);
|
|
@@ -5485,16 +5534,19 @@ const EditorList = React__namespace.default.forwardRef(function EditorList2({ it
|
|
|
5485
5534
|
newItems.splice(itemIndex, 1);
|
|
5486
5535
|
onChange(newItems);
|
|
5487
5536
|
};
|
|
5488
|
-
return /* @__PURE__ */
|
|
5489
|
-
item,
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
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
|
+
] });
|
|
5493
5545
|
});
|
|
5494
5546
|
|
|
5495
5547
|
const AccessoryButton = ({ className, ...props }) => {
|
|
5496
5548
|
const styles = ui.useStyles2(getButtonStyles);
|
|
5497
|
-
return /* @__PURE__ */
|
|
5549
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { ...props, className: css.cx(className, styles.button) });
|
|
5498
5550
|
};
|
|
5499
5551
|
const getButtonStyles = (theme) => ({
|
|
5500
5552
|
button: css.css({
|
|
@@ -5511,7 +5563,7 @@ const InputGroup = ({ children }) => {
|
|
|
5511
5563
|
}
|
|
5512
5564
|
return child;
|
|
5513
5565
|
});
|
|
5514
|
-
return /* @__PURE__ */
|
|
5566
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.root, children: modifiedChildren });
|
|
5515
5567
|
};
|
|
5516
5568
|
const borderPriority = [
|
|
5517
5569
|
"",
|
|
@@ -5572,7 +5624,7 @@ function GroupByRow({ sql, columns, onSqlChange }) {
|
|
|
5572
5624
|
},
|
|
5573
5625
|
[onSqlChange, sql]
|
|
5574
5626
|
);
|
|
5575
|
-
return /* @__PURE__ */
|
|
5627
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5576
5628
|
EditorList,
|
|
5577
5629
|
{
|
|
5578
5630
|
items: sql.groupBy,
|
|
@@ -5586,27 +5638,30 @@ function GroupByRow({ sql, columns, onSqlChange }) {
|
|
|
5586
5638
|
function makeRenderColumn({ options }) {
|
|
5587
5639
|
const renderColumn = function(item, onChangeItem, onDeleteItem) {
|
|
5588
5640
|
var _a;
|
|
5589
|
-
return /* @__PURE__ */
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
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
|
+
] });
|
|
5599
5654
|
};
|
|
5600
5655
|
return renderColumn;
|
|
5601
5656
|
}
|
|
5602
5657
|
|
|
5603
5658
|
const EditorFieldGroup = ({ children }) => {
|
|
5604
|
-
return /* @__PURE__ */
|
|
5659
|
+
return /* @__PURE__ */ jsxRuntime.jsx(EditorStack, { gap: 1, children });
|
|
5605
5660
|
};
|
|
5606
5661
|
|
|
5607
5662
|
const EditorHeader = ({ children }) => {
|
|
5608
5663
|
const styles = ui.useStyles2(getStyles$m);
|
|
5609
|
-
return /* @__PURE__ */
|
|
5664
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.root, children });
|
|
5610
5665
|
};
|
|
5611
5666
|
const getStyles$m = (theme) => ({
|
|
5612
5667
|
root: css.css({
|
|
@@ -5623,8 +5678,15 @@ const EditorField$1 = (props) => {
|
|
|
5623
5678
|
const { label, optional, tooltip, tooltipInteractive, children, width, ...fieldProps } = props;
|
|
5624
5679
|
const styles = ui.useStyles2(getStyles$l, width);
|
|
5625
5680
|
const childInputId = (fieldProps == null ? undefined : fieldProps.htmlFor) || ((_a = ui.ReactUtils) == null ? undefined : _a.getChildId(children));
|
|
5626
|
-
const labelEl = /* @__PURE__ */
|
|
5627
|
-
|
|
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 }) });
|
|
5628
5690
|
};
|
|
5629
5691
|
const getStyles$l = (theme, width) => {
|
|
5630
5692
|
return {
|
|
@@ -5655,7 +5717,7 @@ const getStyles$l = (theme, width) => {
|
|
|
5655
5717
|
|
|
5656
5718
|
const EditorRow$1 = ({ children }) => {
|
|
5657
5719
|
const styles = ui.useStyles2(getStyles$k);
|
|
5658
|
-
return /* @__PURE__ */
|
|
5720
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.root, children: /* @__PURE__ */ jsxRuntime.jsx(EditorStack, { gap: 2, children }) });
|
|
5659
5721
|
};
|
|
5660
5722
|
const getStyles$k = (theme) => {
|
|
5661
5723
|
return {
|
|
@@ -5668,12 +5730,12 @@ const getStyles$k = (theme) => {
|
|
|
5668
5730
|
};
|
|
5669
5731
|
|
|
5670
5732
|
const EditorRows$1 = ({ children }) => {
|
|
5671
|
-
return /* @__PURE__ */
|
|
5733
|
+
return /* @__PURE__ */ jsxRuntime.jsx(EditorStack, { gap: 0.5, direction: "column", children });
|
|
5672
5734
|
};
|
|
5673
5735
|
|
|
5674
5736
|
const EditorSwitch = (props) => {
|
|
5675
5737
|
const styles = getStyles$j();
|
|
5676
|
-
return /* @__PURE__ */
|
|
5738
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.switch, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Switch, { ...props }) });
|
|
5677
5739
|
};
|
|
5678
5740
|
const getStyles$j = () => {
|
|
5679
5741
|
return {
|
|
@@ -5686,7 +5748,7 @@ const getStyles$j = () => {
|
|
|
5686
5748
|
};
|
|
5687
5749
|
|
|
5688
5750
|
const FlexItem = ({ grow, shrink }) => {
|
|
5689
|
-
return /* @__PURE__ */
|
|
5751
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "block", flexGrow: grow, flexShrink: shrink } });
|
|
5690
5752
|
};
|
|
5691
5753
|
|
|
5692
5754
|
function getDefaultExportFromCjs (x) {
|
|
@@ -5701,17 +5763,24 @@ function InlineSelect({ label: labelProp, ...props }) {
|
|
|
5701
5763
|
ValueContainer,
|
|
5702
5764
|
SingleValue: ValueContainer
|
|
5703
5765
|
};
|
|
5704
|
-
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
|
+
] });
|
|
5705
5774
|
}
|
|
5706
5775
|
const SelectContainer = (props) => {
|
|
5707
5776
|
const { children } = props;
|
|
5708
5777
|
const styles = ui.useStyles2(getSelectStyles);
|
|
5709
|
-
return /* @__PURE__ */
|
|
5778
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.SelectContainer, { ...props, className: css.cx(props.className, styles.container), children });
|
|
5710
5779
|
};
|
|
5711
5780
|
const ValueContainer = (props) => {
|
|
5712
5781
|
const { className, children } = props;
|
|
5713
5782
|
const styles = ui.useStyles2(getSelectStyles);
|
|
5714
|
-
return /* @__PURE__ */
|
|
5783
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: css.cx(className, styles.valueContainer), children });
|
|
5715
5784
|
};
|
|
5716
5785
|
const getSelectStyles = (theme) => ({
|
|
5717
5786
|
root: css.css({
|
|
@@ -5739,7 +5808,7 @@ const getSelectStyles = (theme) => ({
|
|
|
5739
5808
|
const Space = (props) => {
|
|
5740
5809
|
const theme = ui.useTheme2();
|
|
5741
5810
|
const styles = getStyles$i(theme, props);
|
|
5742
|
-
return /* @__PURE__ */
|
|
5811
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: css.cx(styles.wrapper) });
|
|
5743
5812
|
};
|
|
5744
5813
|
Space.defaultProps = {
|
|
5745
5814
|
v: 0,
|
|
@@ -5772,16 +5841,25 @@ function ConfirmModal({ isOpen, onCancel, onDiscard, onCopy }) {
|
|
|
5772
5841
|
(_a = buttonRef.current) == null ? undefined : _a.focus();
|
|
5773
5842
|
}
|
|
5774
5843
|
}, [isOpen]);
|
|
5775
|
-
return /* @__PURE__ */
|
|
5844
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5776
5845
|
ui.Modal,
|
|
5777
5846
|
{
|
|
5778
|
-
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
|
+
] }),
|
|
5779
5851
|
onDismiss: onCancel,
|
|
5780
|
-
isOpen
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
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
|
+
}
|
|
5785
5863
|
);
|
|
5786
5864
|
}
|
|
5787
5865
|
|
|
@@ -5819,7 +5897,7 @@ const DatasetSelector = ({
|
|
|
5819
5897
|
}
|
|
5820
5898
|
}
|
|
5821
5899
|
}, [state.value, value, applyDefault, onChange]);
|
|
5822
|
-
return /* @__PURE__ */
|
|
5900
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5823
5901
|
ui.Select,
|
|
5824
5902
|
{
|
|
5825
5903
|
inputId,
|
|
@@ -5835,20 +5913,128 @@ const DatasetSelector = ({
|
|
|
5835
5913
|
);
|
|
5836
5914
|
};
|
|
5837
5915
|
|
|
5838
|
-
const
|
|
5916
|
+
const CatalogSelector = ({ db, inputId, value, onChange }) => {
|
|
5917
|
+
const [catalogs, setCatalogs] = React.useState([]);
|
|
5918
|
+
const [isLoading, setIsLoading] = React.useState(false);
|
|
5919
|
+
const loadCatalogs = React.useCallback(async () => {
|
|
5920
|
+
if (!db.catalogs) {
|
|
5921
|
+
return;
|
|
5922
|
+
}
|
|
5923
|
+
setIsLoading(true);
|
|
5924
|
+
try {
|
|
5925
|
+
const catalogList = await db.catalogs();
|
|
5926
|
+
const catalogOptions = catalogList.map((catalog) => ({
|
|
5927
|
+
label: catalog,
|
|
5928
|
+
value: catalog
|
|
5929
|
+
}));
|
|
5930
|
+
setCatalogs(catalogOptions);
|
|
5931
|
+
} catch (error) {
|
|
5932
|
+
console.error("Error loading catalogs:", error);
|
|
5933
|
+
setCatalogs([]);
|
|
5934
|
+
} finally {
|
|
5935
|
+
setIsLoading(false);
|
|
5936
|
+
}
|
|
5937
|
+
}, [db]);
|
|
5938
|
+
React.useEffect(() => {
|
|
5939
|
+
loadCatalogs();
|
|
5940
|
+
}, [db, loadCatalogs]);
|
|
5941
|
+
const handleChange = (selectable) => {
|
|
5942
|
+
onChange((selectable == null ? undefined : selectable.value) || null);
|
|
5943
|
+
};
|
|
5944
|
+
const selectedValue = catalogs.find((catalog) => catalog.value === value) || null;
|
|
5945
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5946
|
+
ui.Select,
|
|
5947
|
+
{
|
|
5948
|
+
inputId,
|
|
5949
|
+
options: catalogs,
|
|
5950
|
+
value: selectedValue,
|
|
5951
|
+
onChange: handleChange,
|
|
5952
|
+
isLoading,
|
|
5953
|
+
placeholder: "Select catalog",
|
|
5954
|
+
isClearable: true,
|
|
5955
|
+
allowCustomValue: true,
|
|
5956
|
+
disabled: isLoading,
|
|
5957
|
+
menuShouldPortal: true
|
|
5958
|
+
}
|
|
5959
|
+
);
|
|
5960
|
+
};
|
|
5961
|
+
|
|
5962
|
+
const SchemaSelector = ({ db, inputId, catalog, value, onChange }) => {
|
|
5963
|
+
const [schemas, setSchemas] = React.useState([]);
|
|
5964
|
+
const [isLoading, setIsLoading] = React.useState(false);
|
|
5965
|
+
const loadSchemas = React.useCallback(async () => {
|
|
5966
|
+
if (!db.schemas || !catalog) {
|
|
5967
|
+
setSchemas([]);
|
|
5968
|
+
return;
|
|
5969
|
+
}
|
|
5970
|
+
setIsLoading(true);
|
|
5971
|
+
try {
|
|
5972
|
+
const schemaList = await db.schemas(catalog);
|
|
5973
|
+
const schemaOptions = schemaList.map((schema) => ({
|
|
5974
|
+
label: schema,
|
|
5975
|
+
value: schema
|
|
5976
|
+
}));
|
|
5977
|
+
setSchemas(schemaOptions);
|
|
5978
|
+
} catch (error) {
|
|
5979
|
+
console.error("Error loading schemas:", error);
|
|
5980
|
+
setSchemas([]);
|
|
5981
|
+
} finally {
|
|
5982
|
+
setIsLoading(false);
|
|
5983
|
+
}
|
|
5984
|
+
}, [db, catalog]);
|
|
5985
|
+
React.useEffect(() => {
|
|
5986
|
+
loadSchemas();
|
|
5987
|
+
}, [db, catalog, loadSchemas]);
|
|
5988
|
+
const handleChange = (selectable) => {
|
|
5989
|
+
onChange((selectable == null ? undefined : selectable.value) || null);
|
|
5990
|
+
};
|
|
5991
|
+
const selectedValue = schemas.find((schema) => schema.value === value) || null;
|
|
5992
|
+
const isDisabled = isLoading || !catalog;
|
|
5993
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5994
|
+
ui.Select,
|
|
5995
|
+
{
|
|
5996
|
+
inputId,
|
|
5997
|
+
options: schemas,
|
|
5998
|
+
value: selectedValue,
|
|
5999
|
+
onChange: handleChange,
|
|
6000
|
+
isLoading,
|
|
6001
|
+
placeholder: "Select schema",
|
|
6002
|
+
isClearable: true,
|
|
6003
|
+
allowCustomValue: true,
|
|
6004
|
+
disabled: isDisabled,
|
|
6005
|
+
menuShouldPortal: true
|
|
6006
|
+
}
|
|
6007
|
+
);
|
|
6008
|
+
};
|
|
6009
|
+
|
|
6010
|
+
const TableSelector = ({
|
|
6011
|
+
db,
|
|
6012
|
+
dataset,
|
|
6013
|
+
catalog,
|
|
6014
|
+
schema,
|
|
6015
|
+
value,
|
|
6016
|
+
className,
|
|
6017
|
+
onChange,
|
|
6018
|
+
inputId,
|
|
6019
|
+
enableCatalogs
|
|
6020
|
+
}) => {
|
|
5839
6021
|
const state = reactUse.useAsync(async () => {
|
|
5840
|
-
if (!dataset) {
|
|
6022
|
+
if (!dataset && !catalog) {
|
|
6023
|
+
return [];
|
|
6024
|
+
}
|
|
6025
|
+
if (enableCatalogs && (!catalog || !schema)) {
|
|
5841
6026
|
return [];
|
|
5842
6027
|
}
|
|
5843
|
-
const tables = await db.tables(dataset);
|
|
6028
|
+
const tables = await db.tables(dataset, catalog, schema);
|
|
5844
6029
|
return tables.map(data.toOption);
|
|
5845
|
-
}, [dataset]);
|
|
5846
|
-
|
|
6030
|
+
}, [dataset, catalog, schema, enableCatalogs]);
|
|
6031
|
+
const isDisabled = state.loading || enableCatalogs && (!catalog || !schema);
|
|
6032
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5847
6033
|
ui.Select,
|
|
5848
6034
|
{
|
|
5849
6035
|
inputId,
|
|
5850
6036
|
className,
|
|
5851
|
-
disabled:
|
|
6037
|
+
disabled: isDisabled,
|
|
5852
6038
|
"aria-label": "Table selector",
|
|
5853
6039
|
value,
|
|
5854
6040
|
options: state.value,
|
|
@@ -5873,7 +6059,7 @@ const RunQueryButton = ({
|
|
|
5873
6059
|
if (queryRunning) {
|
|
5874
6060
|
icon = "fa fa-spinner";
|
|
5875
6061
|
}
|
|
5876
|
-
const RunButton = /* @__PURE__ */
|
|
6062
|
+
const RunButton = /* @__PURE__ */ jsxRuntime.jsx(
|
|
5877
6063
|
ui.Button,
|
|
5878
6064
|
{
|
|
5879
6065
|
"aria-label": ariaLabel,
|
|
@@ -5882,18 +6068,22 @@ const RunQueryButton = ({
|
|
|
5882
6068
|
icon,
|
|
5883
6069
|
disabled: disabled || queryRunning,
|
|
5884
6070
|
onClick,
|
|
5885
|
-
"data-testid": dataTestId
|
|
5886
|
-
|
|
5887
|
-
|
|
6071
|
+
"data-testid": dataTestId,
|
|
6072
|
+
children: "Run query"
|
|
6073
|
+
}
|
|
5888
6074
|
);
|
|
5889
|
-
return queryInvalid ? /* @__PURE__ */
|
|
6075
|
+
return queryInvalid ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5890
6076
|
ui.Tooltip,
|
|
5891
6077
|
{
|
|
5892
6078
|
theme: "error",
|
|
5893
6079
|
placement: "top",
|
|
5894
|
-
content: invalidQueryTooltip != null ? invalidQueryTooltip : /* @__PURE__ */
|
|
5895
|
-
|
|
5896
|
-
|
|
6080
|
+
content: invalidQueryTooltip != null ? invalidQueryTooltip : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6081
|
+
"Your query is invalid. Check below for details. ",
|
|
6082
|
+
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
6083
|
+
"However, you can still run this query."
|
|
6084
|
+
] }),
|
|
6085
|
+
children: RunButton
|
|
6086
|
+
}
|
|
5897
6087
|
) : RunButton;
|
|
5898
6088
|
};
|
|
5899
6089
|
|
|
@@ -5905,6 +6095,7 @@ function QueryHeader({
|
|
|
5905
6095
|
db,
|
|
5906
6096
|
defaultDataset,
|
|
5907
6097
|
enableDatasets,
|
|
6098
|
+
enableCatalogs,
|
|
5908
6099
|
query,
|
|
5909
6100
|
queryRowFilter,
|
|
5910
6101
|
onChange,
|
|
@@ -5918,6 +6109,7 @@ function QueryHeader({
|
|
|
5918
6109
|
const [showConfirm, setShowConfirm] = React.useState(false);
|
|
5919
6110
|
const toRawSql = getRawSqlFn(db);
|
|
5920
6111
|
const htmlId = React.useId();
|
|
6112
|
+
const catalogsEnabled = enableCatalogs != null ? enableCatalogs : db.disableCatalogs === false;
|
|
5921
6113
|
const onEditorModeChange = React.useCallback(
|
|
5922
6114
|
(newEditorMode) => {
|
|
5923
6115
|
if (editorMode === EditorMode.Code) {
|
|
@@ -5945,6 +6137,33 @@ function QueryHeader({
|
|
|
5945
6137
|
};
|
|
5946
6138
|
onChange(next);
|
|
5947
6139
|
};
|
|
6140
|
+
const onCatalogChange = (catalog) => {
|
|
6141
|
+
if (catalog === query.catalog) {
|
|
6142
|
+
return;
|
|
6143
|
+
}
|
|
6144
|
+
const next = {
|
|
6145
|
+
...query,
|
|
6146
|
+
catalog: catalog || undefined,
|
|
6147
|
+
schema: undefined,
|
|
6148
|
+
table: undefined,
|
|
6149
|
+
sql: undefined,
|
|
6150
|
+
rawSql: ""
|
|
6151
|
+
};
|
|
6152
|
+
onChange(next);
|
|
6153
|
+
};
|
|
6154
|
+
const onSchemaChange = (schema) => {
|
|
6155
|
+
if (schema === query.schema) {
|
|
6156
|
+
return;
|
|
6157
|
+
}
|
|
6158
|
+
const next = {
|
|
6159
|
+
...query,
|
|
6160
|
+
schema: schema || undefined,
|
|
6161
|
+
table: undefined,
|
|
6162
|
+
sql: undefined,
|
|
6163
|
+
rawSql: ""
|
|
6164
|
+
};
|
|
6165
|
+
onChange(next);
|
|
6166
|
+
};
|
|
5948
6167
|
const onTableChange = (e) => {
|
|
5949
6168
|
if (e.value === query.table) {
|
|
5950
6169
|
return;
|
|
@@ -5957,100 +6176,145 @@ function QueryHeader({
|
|
|
5957
6176
|
};
|
|
5958
6177
|
onChange(next);
|
|
5959
6178
|
};
|
|
5960
|
-
return /* @__PURE__ */
|
|
5961
|
-
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
|
|
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
|
-
|
|
6179
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6180
|
+
/* @__PURE__ */ jsxRuntime.jsxs(EditorHeader, { children: [
|
|
6181
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6182
|
+
InlineSelect,
|
|
6183
|
+
{
|
|
6184
|
+
label: "Format",
|
|
6185
|
+
value: query.format,
|
|
6186
|
+
placeholder: "Select format",
|
|
6187
|
+
menuShouldPortal: true,
|
|
6188
|
+
onChange: onFormatChange,
|
|
6189
|
+
options: QUERY_FORMAT_OPTIONS
|
|
6190
|
+
}
|
|
6191
|
+
),
|
|
6192
|
+
editorMode === EditorMode.Builder && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6193
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6194
|
+
ui.InlineSwitch,
|
|
6195
|
+
{
|
|
6196
|
+
id: `sql-filter-${htmlId}`,
|
|
6197
|
+
label: "Filter",
|
|
6198
|
+
transparent: true,
|
|
6199
|
+
showLabel: true,
|
|
6200
|
+
value: queryRowFilter.filter,
|
|
6201
|
+
onChange: (ev) => ev.target instanceof HTMLInputElement && onQueryRowChange({ ...queryRowFilter, filter: ev.target.checked })
|
|
6202
|
+
}
|
|
6203
|
+
),
|
|
6204
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6205
|
+
ui.InlineSwitch,
|
|
6206
|
+
{
|
|
6207
|
+
id: `sql-group-${htmlId}`,
|
|
6208
|
+
label: "Group",
|
|
6209
|
+
transparent: true,
|
|
6210
|
+
showLabel: true,
|
|
6211
|
+
value: queryRowFilter.group,
|
|
6212
|
+
onChange: (ev) => ev.target instanceof HTMLInputElement && onQueryRowChange({ ...queryRowFilter, group: ev.target.checked })
|
|
6213
|
+
}
|
|
6214
|
+
),
|
|
6215
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6216
|
+
ui.InlineSwitch,
|
|
6217
|
+
{
|
|
6218
|
+
id: `sql-order-${htmlId}`,
|
|
6219
|
+
label: "Order",
|
|
6220
|
+
transparent: true,
|
|
6221
|
+
showLabel: true,
|
|
6222
|
+
value: queryRowFilter.order,
|
|
6223
|
+
onChange: (ev) => ev.target instanceof HTMLInputElement && onQueryRowChange({ ...queryRowFilter, order: ev.target.checked })
|
|
6224
|
+
}
|
|
6225
|
+
),
|
|
6226
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6227
|
+
ui.InlineSwitch,
|
|
6228
|
+
{
|
|
6229
|
+
id: `sql-preview-${htmlId}`,
|
|
6230
|
+
label: "Preview",
|
|
6231
|
+
transparent: true,
|
|
6232
|
+
showLabel: true,
|
|
6233
|
+
value: queryRowFilter.preview,
|
|
6234
|
+
onChange: (ev) => ev.target instanceof HTMLInputElement && onQueryRowChange({ ...queryRowFilter, preview: ev.target.checked })
|
|
6235
|
+
}
|
|
6236
|
+
)
|
|
6237
|
+
] }),
|
|
6238
|
+
/* @__PURE__ */ jsxRuntime.jsx(FlexItem, { grow: 1 }),
|
|
6239
|
+
/* @__PURE__ */ jsxRuntime.jsx(RunQueryButton, { queryInvalid: !isQueryRunnable, onClick: () => onRunQuery() }),
|
|
6240
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.RadioButtonGroup, { options: editorModes$1, size: "sm", value: editorMode, onChange: onEditorModeChange }),
|
|
6241
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6242
|
+
ConfirmModal,
|
|
6243
|
+
{
|
|
6244
|
+
isOpen: showConfirm,
|
|
6245
|
+
onCopy: () => {
|
|
6246
|
+
setShowConfirm(false);
|
|
6247
|
+
copyToClipboard(query.rawSql);
|
|
6248
|
+
onChange({
|
|
6249
|
+
...query,
|
|
6250
|
+
rawSql: toRawSql(query),
|
|
6251
|
+
editorMode: EditorMode.Builder
|
|
6252
|
+
});
|
|
6253
|
+
},
|
|
6254
|
+
onDiscard: () => {
|
|
6255
|
+
setShowConfirm(false);
|
|
6256
|
+
onChange({
|
|
6257
|
+
...query,
|
|
6258
|
+
rawSql: toRawSql(query),
|
|
6259
|
+
editorMode: EditorMode.Builder
|
|
6260
|
+
});
|
|
6261
|
+
},
|
|
6262
|
+
onCancel: () => setShowConfirm(false)
|
|
6263
|
+
}
|
|
6264
|
+
)
|
|
6265
|
+
] }),
|
|
6266
|
+
editorMode === EditorMode.Builder && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6267
|
+
/* @__PURE__ */ jsxRuntime.jsx(Space, { v: 0.5 }),
|
|
6268
|
+
/* @__PURE__ */ jsxRuntime.jsxs(EditorRow$1, { children: [
|
|
6269
|
+
enableDatasets === true && !catalogsEnabled && /* @__PURE__ */ jsxRuntime.jsx(EditorField$1, { label: labels.get("dataset") || "Dataset", width: 25, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6270
|
+
DatasetSelector,
|
|
6271
|
+
{
|
|
6272
|
+
db,
|
|
6273
|
+
inputId: `sql-dataset-${htmlId}`,
|
|
6274
|
+
dataset: defaultDataset,
|
|
6275
|
+
value: query.dataset === undefined ? null : query.dataset,
|
|
6276
|
+
onChange: onDatasetChange
|
|
6277
|
+
}
|
|
6278
|
+
) }),
|
|
6279
|
+
catalogsEnabled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6280
|
+
/* @__PURE__ */ jsxRuntime.jsx(EditorField$1, { label: labels.get("catalog") || "Catalog", width: 25, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6281
|
+
CatalogSelector,
|
|
6282
|
+
{
|
|
6283
|
+
db,
|
|
6284
|
+
inputId: `sql-catalog-${htmlId}`,
|
|
6285
|
+
value: query.catalog === undefined ? null : query.catalog,
|
|
6286
|
+
onChange: onCatalogChange
|
|
6287
|
+
}
|
|
6288
|
+
) }),
|
|
6289
|
+
/* @__PURE__ */ jsxRuntime.jsx(EditorField$1, { label: labels.get("schema") || "Schema", width: 25, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6290
|
+
SchemaSelector,
|
|
6291
|
+
{
|
|
6292
|
+
db,
|
|
6293
|
+
inputId: `sql-schema-${htmlId}`,
|
|
6294
|
+
catalog: query.catalog,
|
|
6295
|
+
value: query.schema === undefined ? null : query.schema,
|
|
6296
|
+
onChange: onSchemaChange
|
|
6297
|
+
}
|
|
6298
|
+
) })
|
|
6299
|
+
] }),
|
|
6300
|
+
/* @__PURE__ */ jsxRuntime.jsx(EditorField$1, { label: "Table", width: 25, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6301
|
+
TableSelector,
|
|
6302
|
+
{
|
|
6303
|
+
db,
|
|
6304
|
+
inputId: `sql-table-${htmlId}`,
|
|
6305
|
+
dataset: catalogsEnabled ? undefined : query.dataset || defaultDataset,
|
|
6306
|
+
catalog: catalogsEnabled ? query.catalog : undefined,
|
|
6307
|
+
schema: catalogsEnabled ? query.schema : undefined,
|
|
6308
|
+
query,
|
|
6309
|
+
value: query.table === undefined ? null : query.table,
|
|
6310
|
+
onChange: onTableChange,
|
|
6311
|
+
enableCatalogs: catalogsEnabled,
|
|
6312
|
+
applyDefault: true
|
|
6313
|
+
}
|
|
6314
|
+
) })
|
|
6315
|
+
] })
|
|
6316
|
+
] })
|
|
6317
|
+
] });
|
|
6054
6318
|
}
|
|
6055
6319
|
|
|
6056
6320
|
function formatSQL(q) {
|
|
@@ -6075,16 +6339,16 @@ function QueryEditorRaw({ children, onChange, query, width, height, completionPr
|
|
|
6075
6339
|
},
|
|
6076
6340
|
[onChange]
|
|
6077
6341
|
);
|
|
6078
|
-
return /* @__PURE__ */
|
|
6342
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6079
6343
|
SQLEditor,
|
|
6080
6344
|
{
|
|
6081
6345
|
width,
|
|
6082
6346
|
height,
|
|
6083
6347
|
query: query.rawSql,
|
|
6084
6348
|
onChange: onRawQueryChange,
|
|
6085
|
-
language: { id: "sql", completionProvider, formatter: formatSQL }
|
|
6086
|
-
|
|
6087
|
-
|
|
6349
|
+
language: { id: "sql", completionProvider, formatter: formatSQL },
|
|
6350
|
+
children
|
|
6351
|
+
}
|
|
6088
6352
|
);
|
|
6089
6353
|
}
|
|
6090
6354
|
|
|
@@ -6141,7 +6405,23 @@ function QueryValidator({ db, query, onValidate, range }) {
|
|
|
6141
6405
|
return null;
|
|
6142
6406
|
}
|
|
6143
6407
|
const error = ((_a = state.value) == null ? undefined : _a.error) ? processErrorMessage(state.value.error) : "";
|
|
6144
|
-
return /* @__PURE__ */
|
|
6408
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6409
|
+
state.loading && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.info, children: [
|
|
6410
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Spinner, { inline: true, size: 12 }),
|
|
6411
|
+
" Validating query..."
|
|
6412
|
+
] }),
|
|
6413
|
+
!state.loading && state.value && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6414
|
+
/* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: state.value.isValid && state.value.statistics && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.valid, children: [
|
|
6415
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Icon, { name: "check" }),
|
|
6416
|
+
" This query will process",
|
|
6417
|
+
" ",
|
|
6418
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: data.formattedValueToString(valueFormatter(state.value.statistics.TotalBytesProcessed)) }),
|
|
6419
|
+
" ",
|
|
6420
|
+
"when run."
|
|
6421
|
+
] }) }),
|
|
6422
|
+
/* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: state.value.isError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.error, children: error }) })
|
|
6423
|
+
] })
|
|
6424
|
+
] });
|
|
6145
6425
|
}
|
|
6146
6426
|
function processErrorMessage(error) {
|
|
6147
6427
|
const splat = error.split(":");
|
|
@@ -6187,24 +6467,31 @@ function QueryToolbox({ showTools, onFormatCode, onExpand, isExpanded, ...valida
|
|
|
6187
6467
|
if (!showTools && validationResult === undefined) {
|
|
6188
6468
|
style = { height: 0, padding: 0, visibility: "hidden" };
|
|
6189
6469
|
}
|
|
6190
|
-
return /* @__PURE__ */
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6470
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.container, style, children: [
|
|
6471
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: validatorProps.onValidate && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6472
|
+
QueryValidator,
|
|
6473
|
+
{
|
|
6474
|
+
...validatorProps,
|
|
6475
|
+
onValidate: (result) => {
|
|
6476
|
+
setValidationResult(result);
|
|
6477
|
+
validatorProps.onValidate(result);
|
|
6478
|
+
}
|
|
6197
6479
|
}
|
|
6198
|
-
}
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6480
|
+
) }),
|
|
6481
|
+
showTools && /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsxs(ui.HorizontalGroup, { spacing: "sm", children: [
|
|
6482
|
+
onFormatCode && /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { onClick: onFormatCode, name: "brackets-curly", size: "xs", tooltip: "Format query" }),
|
|
6483
|
+
onExpand && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6484
|
+
ui.IconButton,
|
|
6485
|
+
{
|
|
6486
|
+
onClick: () => onExpand(!isExpanded),
|
|
6487
|
+
name: isExpanded ? "angle-up" : "angle-down",
|
|
6488
|
+
size: "xs",
|
|
6489
|
+
tooltip: isExpanded ? "Collapse editor" : "Expand editor"
|
|
6490
|
+
}
|
|
6491
|
+
),
|
|
6492
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { content: "Hit CTRL/CMD+Return to run query", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Icon, { className: styles.hint, name: "keyboard" }) })
|
|
6493
|
+
] }) })
|
|
6494
|
+
] });
|
|
6208
6495
|
}
|
|
6209
6496
|
|
|
6210
6497
|
function RawEditor({ db, query, onChange, onRunQuery, onValidate, queryToValidate, range }) {
|
|
@@ -6215,39 +6502,39 @@ function RawEditor({ db, query, onChange, onRunQuery, onValidate, queryToValidat
|
|
|
6215
6502
|
const [editorRef, editorMeasure] = reactUse.useMeasure();
|
|
6216
6503
|
const completionProvider = React.useMemo(() => db.getSqlCompletionProvider(), [db]);
|
|
6217
6504
|
const renderQueryEditor = (width, height) => {
|
|
6218
|
-
return /* @__PURE__ */
|
|
6505
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6219
6506
|
QueryEditorRaw,
|
|
6220
6507
|
{
|
|
6221
6508
|
completionProvider,
|
|
6222
6509
|
query,
|
|
6223
6510
|
width,
|
|
6224
6511
|
height: height ? height - toolboxMeasure.height : undefined,
|
|
6225
|
-
onChange
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
}
|
|
6240
|
-
|
|
6512
|
+
onChange,
|
|
6513
|
+
children: ({ formatQuery }) => {
|
|
6514
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: toolboxRef, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6515
|
+
QueryToolbox,
|
|
6516
|
+
{
|
|
6517
|
+
db,
|
|
6518
|
+
query: queryToValidate,
|
|
6519
|
+
onValidate,
|
|
6520
|
+
onFormatCode: formatQuery,
|
|
6521
|
+
showTools: true,
|
|
6522
|
+
range,
|
|
6523
|
+
onExpand: setIsExpanded,
|
|
6524
|
+
isExpanded
|
|
6525
|
+
}
|
|
6526
|
+
) });
|
|
6527
|
+
}
|
|
6241
6528
|
}
|
|
6242
6529
|
);
|
|
6243
6530
|
};
|
|
6244
6531
|
const renderEditor = (standalone = false) => {
|
|
6245
|
-
return standalone ? /* @__PURE__ */
|
|
6532
|
+
return standalone ? /* @__PURE__ */ jsxRuntime.jsx(AutoSizer__default.default, { children: ({ width, height }) => {
|
|
6246
6533
|
return renderQueryEditor(width, height);
|
|
6247
|
-
}) : /* @__PURE__ */
|
|
6534
|
+
} }) : /* @__PURE__ */ jsxRuntime.jsx("div", { ref: editorRef, children: renderQueryEditor() });
|
|
6248
6535
|
};
|
|
6249
6536
|
const renderPlaceholder = () => {
|
|
6250
|
-
return /* @__PURE__ */
|
|
6537
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6251
6538
|
"div",
|
|
6252
6539
|
{
|
|
6253
6540
|
style: {
|
|
@@ -6257,26 +6544,29 @@ function RawEditor({ db, query, onChange, onRunQuery, onValidate, queryToValidat
|
|
|
6257
6544
|
display: "flex",
|
|
6258
6545
|
alignItems: "center",
|
|
6259
6546
|
justifyContent: "center"
|
|
6260
|
-
}
|
|
6261
|
-
|
|
6262
|
-
|
|
6547
|
+
},
|
|
6548
|
+
children: "Editing in expanded code editor"
|
|
6549
|
+
}
|
|
6263
6550
|
);
|
|
6264
6551
|
};
|
|
6265
|
-
return /* @__PURE__ */
|
|
6266
|
-
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
|
|
6271
|
-
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6552
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6553
|
+
isExpanded ? renderPlaceholder() : renderEditor(),
|
|
6554
|
+
isExpanded && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6555
|
+
ui.Modal,
|
|
6556
|
+
{
|
|
6557
|
+
title: `Query ${query.refId}`,
|
|
6558
|
+
closeOnBackdropClick: false,
|
|
6559
|
+
closeOnEscape: false,
|
|
6560
|
+
className: styles.modal,
|
|
6561
|
+
contentClassName: styles.modalContent,
|
|
6562
|
+
isOpen: isExpanded,
|
|
6563
|
+
onDismiss: () => {
|
|
6564
|
+
setIsExpanded(false);
|
|
6565
|
+
},
|
|
6566
|
+
children: renderEditor(true)
|
|
6276
6567
|
}
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
));
|
|
6568
|
+
)
|
|
6569
|
+
] });
|
|
6280
6570
|
}
|
|
6281
6571
|
function getStyles$h(theme) {
|
|
6282
6572
|
return {
|
|
@@ -6294,8 +6584,11 @@ function getStyles$h(theme) {
|
|
|
6294
6584
|
function Preview({ rawSql }) {
|
|
6295
6585
|
const [_, copyToClipboard] = reactUse.useCopyToClipboard();
|
|
6296
6586
|
const styles = ui.useStyles2(getStyles$g);
|
|
6297
|
-
const labelElement = /* @__PURE__ */
|
|
6298
|
-
|
|
6587
|
+
const labelElement = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.labelWrapper, children: [
|
|
6588
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { className: styles.label, children: "Preview" }),
|
|
6589
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { tooltip: "Copy to clipboard", onClick: () => copyToClipboard(rawSql), name: "copy" })
|
|
6590
|
+
] });
|
|
6591
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Field, { label: labelElement, className: styles.grow, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6299
6592
|
ui.CodeEditor,
|
|
6300
6593
|
{
|
|
6301
6594
|
language: "sql",
|
|
@@ -6305,7 +6598,7 @@ function Preview({ rawSql }) {
|
|
|
6305
6598
|
readOnly: true,
|
|
6306
6599
|
showMiniMap: false
|
|
6307
6600
|
}
|
|
6308
|
-
));
|
|
6601
|
+
) });
|
|
6309
6602
|
}
|
|
6310
6603
|
function getStyles$g(theme) {
|
|
6311
6604
|
return {
|
|
@@ -6330,7 +6623,7 @@ function useSqlChange({ query, onQueryChange, db }) {
|
|
|
6330
6623
|
|
|
6331
6624
|
function SQLGroupByRow({ fields, query, onQueryChange, db }) {
|
|
6332
6625
|
const { onSqlChange } = useSqlChange({ query, onQueryChange, db });
|
|
6333
|
-
return /* @__PURE__ */
|
|
6626
|
+
return /* @__PURE__ */ jsxRuntime.jsx(GroupByRow, { columns: fields, sql: query.sql, onSqlChange });
|
|
6334
6627
|
}
|
|
6335
6628
|
|
|
6336
6629
|
const sortOrderOptions = [
|
|
@@ -6370,25 +6663,33 @@ function OrderByRow({ sql, onSqlChange, columns, showOffset }) {
|
|
|
6370
6663
|
},
|
|
6371
6664
|
[onSqlChange, sql]
|
|
6372
6665
|
);
|
|
6373
|
-
return /* @__PURE__ */
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6666
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6667
|
+
/* @__PURE__ */ jsxRuntime.jsx(EditorField$1, { label: "Order by", width: 25, children: /* @__PURE__ */ jsxRuntime.jsxs(InputGroup, { children: [
|
|
6668
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6669
|
+
ui.Select,
|
|
6670
|
+
{
|
|
6671
|
+
"aria-label": "Order by",
|
|
6672
|
+
options: columns,
|
|
6673
|
+
value: ((_a = sql.orderBy) == null ? undefined : _a.property.name) ? data.toOption(sql.orderBy.property.name) : null,
|
|
6674
|
+
isClearable: true,
|
|
6675
|
+
menuShouldPortal: true,
|
|
6676
|
+
onChange: onOrderByChange
|
|
6677
|
+
}
|
|
6678
|
+
),
|
|
6679
|
+
/* @__PURE__ */ jsxRuntime.jsx(Space, { h: 1.5 }),
|
|
6680
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6681
|
+
ui.RadioButtonGroup,
|
|
6682
|
+
{
|
|
6683
|
+
options: sortOrderOptions,
|
|
6684
|
+
disabled: !((_b = sql == null ? undefined : sql.orderBy) == null ? undefined : _b.property.name),
|
|
6685
|
+
value: sql.orderByDirection,
|
|
6686
|
+
onChange: onSortOrderChange
|
|
6687
|
+
}
|
|
6688
|
+
)
|
|
6689
|
+
] }) }),
|
|
6690
|
+
/* @__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 }) }),
|
|
6691
|
+
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 }) })
|
|
6692
|
+
] });
|
|
6392
6693
|
}
|
|
6393
6694
|
|
|
6394
6695
|
function SQLOrderByRow({ fields, query, onQueryChange, db }) {
|
|
@@ -6414,7 +6715,7 @@ function SQLOrderByRow({ fields, query, onQueryChange, db }) {
|
|
|
6414
6715
|
...fields
|
|
6415
6716
|
];
|
|
6416
6717
|
}
|
|
6417
|
-
return /* @__PURE__ */
|
|
6718
|
+
return /* @__PURE__ */ jsxRuntime.jsx(OrderByRow, { sql: query.sql, onSqlChange, columns: columnsWithIndices });
|
|
6418
6719
|
}
|
|
6419
6720
|
|
|
6420
6721
|
const asteriskValue = { label: "*", value: "*" };
|
|
@@ -6472,49 +6773,56 @@ function SelectRow({ sql, columns, onSqlChange, functions }) {
|
|
|
6472
6773
|
const newSql = { ...sql, columns: [...sql.columns, createFunctionField()] };
|
|
6473
6774
|
onSqlChange(newSql);
|
|
6474
6775
|
}, [onSqlChange, sql]);
|
|
6475
|
-
return /* @__PURE__ */
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
|
|
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
|
-
|
|
6776
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(EditorStack, { gap: 2, alignItems: "end", direction: "column", children: [
|
|
6777
|
+
(_a = sql.columns) == null ? undefined : _a.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsxs(EditorStack, { gap: 2, alignItems: "end", children: [
|
|
6778
|
+
/* @__PURE__ */ jsxRuntime.jsx(EditorField$1, { label: "Column", width: 25, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6779
|
+
ui.Select,
|
|
6780
|
+
{
|
|
6781
|
+
value: getColumnValue(item),
|
|
6782
|
+
options: columnsWithAsterisk,
|
|
6783
|
+
inputId: `select-column-${index}-${lodash.uniqueId()}`,
|
|
6784
|
+
menuShouldPortal: true,
|
|
6785
|
+
allowCustomValue: true,
|
|
6786
|
+
onChange: onColumnChange(item, index)
|
|
6787
|
+
}
|
|
6788
|
+
) }),
|
|
6789
|
+
/* @__PURE__ */ jsxRuntime.jsx(EditorField$1, { label: "Aggregation", optional: true, width: 25, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6790
|
+
ui.Select,
|
|
6791
|
+
{
|
|
6792
|
+
value: item.name ? data.toOption(item.name) : null,
|
|
6793
|
+
inputId: `select-aggregation-${index}-${lodash.uniqueId()}`,
|
|
6794
|
+
isClearable: true,
|
|
6795
|
+
menuShouldPortal: true,
|
|
6796
|
+
allowCustomValue: true,
|
|
6797
|
+
options: functions,
|
|
6798
|
+
onChange: onAggregationChange(item, index)
|
|
6799
|
+
}
|
|
6800
|
+
) }),
|
|
6801
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6802
|
+
ui.Button,
|
|
6803
|
+
{
|
|
6804
|
+
"aria-label": "Remove",
|
|
6805
|
+
type: "button",
|
|
6806
|
+
icon: "trash-alt",
|
|
6807
|
+
variant: "secondary",
|
|
6808
|
+
size: "md",
|
|
6809
|
+
onClick: removeColumn(index)
|
|
6810
|
+
}
|
|
6811
|
+
)
|
|
6812
|
+
] }) }, index)),
|
|
6813
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6814
|
+
ui.Button,
|
|
6815
|
+
{
|
|
6816
|
+
type: "button",
|
|
6817
|
+
onClick: addColumn,
|
|
6818
|
+
variant: "secondary",
|
|
6819
|
+
size: "md",
|
|
6820
|
+
icon: "plus",
|
|
6821
|
+
"aria-label": "Add",
|
|
6822
|
+
className: styles.addButton
|
|
6823
|
+
}
|
|
6824
|
+
)
|
|
6825
|
+
] });
|
|
6518
6826
|
}
|
|
6519
6827
|
const getStyles$f = () => {
|
|
6520
6828
|
return { addButton: css.css({ alignSelf: "flex-start" }) };
|
|
@@ -6533,7 +6841,7 @@ function SQLSelectRow({ fields, query, onQueryChange, db }) {
|
|
|
6533
6841
|
const functions = await db.functions();
|
|
6534
6842
|
return functions.map((f) => data.toOption(f.name));
|
|
6535
6843
|
}, [db]);
|
|
6536
|
-
return /* @__PURE__ */
|
|
6844
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SelectRow, { columns: fields, sql: query.sql, functions: state.value, onSqlChange });
|
|
6537
6845
|
}
|
|
6538
6846
|
|
|
6539
6847
|
const buttonLabels = {
|
|
@@ -6577,7 +6885,7 @@ const widgets = {
|
|
|
6577
6885
|
text: {
|
|
6578
6886
|
...ui$1.BasicConfig.widgets.text,
|
|
6579
6887
|
factory: function TextInput(props) {
|
|
6580
|
-
return /* @__PURE__ */
|
|
6888
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6581
6889
|
ui.Input,
|
|
6582
6890
|
{
|
|
6583
6891
|
value: (props == null ? undefined : props.value) || "",
|
|
@@ -6590,7 +6898,7 @@ const widgets = {
|
|
|
6590
6898
|
number: {
|
|
6591
6899
|
...ui$1.BasicConfig.widgets.number,
|
|
6592
6900
|
factory: function NumberInput(props) {
|
|
6593
|
-
return /* @__PURE__ */
|
|
6901
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6594
6902
|
ui.Input,
|
|
6595
6903
|
{
|
|
6596
6904
|
value: props == null ? undefined : props.value,
|
|
@@ -6604,7 +6912,7 @@ const widgets = {
|
|
|
6604
6912
|
datetime: {
|
|
6605
6913
|
...ui$1.BasicConfig.widgets.datetime,
|
|
6606
6914
|
factory: function DateTimeInput(props) {
|
|
6607
|
-
return /* @__PURE__ */
|
|
6915
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6608
6916
|
ui.DateTimePicker,
|
|
6609
6917
|
{
|
|
6610
6918
|
onChange: (e) => {
|
|
@@ -6625,7 +6933,7 @@ const settings = {
|
|
|
6625
6933
|
addRuleLabel: buttonLabels.add,
|
|
6626
6934
|
deleteLabel: buttonLabels.remove,
|
|
6627
6935
|
renderConjs: function Conjunctions(conjProps) {
|
|
6628
|
-
return /* @__PURE__ */
|
|
6936
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6629
6937
|
ui.Select,
|
|
6630
6938
|
{
|
|
6631
6939
|
id: conjProps == null ? undefined : conjProps.id,
|
|
@@ -6640,7 +6948,7 @@ const settings = {
|
|
|
6640
6948
|
renderField: function Field(fieldProps) {
|
|
6641
6949
|
var _a;
|
|
6642
6950
|
const fields = ((_a = fieldProps == null ? undefined : fieldProps.config) == null ? undefined : _a.fields) || {};
|
|
6643
|
-
return /* @__PURE__ */
|
|
6951
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6644
6952
|
ui.Select,
|
|
6645
6953
|
{
|
|
6646
6954
|
id: fieldProps == null ? undefined : fieldProps.id,
|
|
@@ -6664,7 +6972,7 @@ const settings = {
|
|
|
6664
6972
|
);
|
|
6665
6973
|
},
|
|
6666
6974
|
renderButton: function RAQBButton(buttonProps) {
|
|
6667
|
-
return /* @__PURE__ */
|
|
6975
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6668
6976
|
ui.Button,
|
|
6669
6977
|
{
|
|
6670
6978
|
type: "button",
|
|
@@ -6677,7 +6985,7 @@ const settings = {
|
|
|
6677
6985
|
);
|
|
6678
6986
|
},
|
|
6679
6987
|
renderOperator: function Operator(operatorProps) {
|
|
6680
|
-
return /* @__PURE__ */
|
|
6988
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6681
6989
|
ui.Select,
|
|
6682
6990
|
{
|
|
6683
6991
|
options: operatorProps == null ? undefined : operatorProps.items.map((op) => ({ label: op.label, value: op.key })),
|
|
@@ -6792,13 +7100,13 @@ function WhereRow({ sql, config, onSqlChange }) {
|
|
|
6792
7100
|
if (!tree) {
|
|
6793
7101
|
return null;
|
|
6794
7102
|
}
|
|
6795
|
-
return /* @__PURE__ */
|
|
7103
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6796
7104
|
ui$1.Query,
|
|
6797
7105
|
{
|
|
6798
7106
|
...configWithDefaults,
|
|
6799
7107
|
value: tree,
|
|
6800
7108
|
onChange: onTreeChange,
|
|
6801
|
-
renderBuilder: (props) => /* @__PURE__ */
|
|
7109
|
+
renderBuilder: (props) => /* @__PURE__ */ jsxRuntime.jsx(ui$1.Builder, { ...props })
|
|
6802
7110
|
}
|
|
6803
7111
|
);
|
|
6804
7112
|
}
|
|
@@ -6838,16 +7146,16 @@ function SQLWhereRow({ query, fields, onQueryChange, db }) {
|
|
|
6838
7146
|
return mapFieldsToTypes(fields);
|
|
6839
7147
|
}, [fields]);
|
|
6840
7148
|
const { onSqlChange } = useSqlChange({ query, onQueryChange, db });
|
|
6841
|
-
return /* @__PURE__ */
|
|
7149
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6842
7150
|
WhereRow,
|
|
6843
7151
|
{
|
|
6844
|
-
key: JSON.stringify(state.value),
|
|
6845
7152
|
config: { fields: state.value || {} },
|
|
6846
7153
|
sql: query.sql,
|
|
6847
7154
|
onSqlChange: (val) => {
|
|
6848
7155
|
onSqlChange(val);
|
|
6849
7156
|
}
|
|
6850
|
-
}
|
|
7157
|
+
},
|
|
7158
|
+
JSON.stringify(state.value)
|
|
6851
7159
|
);
|
|
6852
7160
|
}
|
|
6853
7161
|
function mapFieldsToTypes(columns) {
|
|
@@ -6864,7 +7172,7 @@ function mapFieldsToTypes(columns) {
|
|
|
6864
7172
|
|
|
6865
7173
|
const EditorRow = ({ children }) => {
|
|
6866
7174
|
const styles = ui.useStyles2(getStyles$e);
|
|
6867
|
-
return /* @__PURE__ */
|
|
7175
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.root, children: /* @__PURE__ */ jsxRuntime.jsx(EditorStack, { gap: 2, children }) });
|
|
6868
7176
|
};
|
|
6869
7177
|
const getStyles$e = (theme) => {
|
|
6870
7178
|
return {
|
|
@@ -6882,8 +7190,15 @@ const EditorField = (props) => {
|
|
|
6882
7190
|
const theme = ui.useTheme2();
|
|
6883
7191
|
const styles = getStyles$d(theme, width);
|
|
6884
7192
|
const childInputId = (fieldProps == null ? undefined : fieldProps.htmlFor) || ((_a = ui.ReactUtils) == null ? undefined : _a.getChildId(children));
|
|
6885
|
-
const labelEl = /* @__PURE__ */
|
|
6886
|
-
|
|
7193
|
+
const labelEl = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7194
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: styles.label, htmlFor: childInputId, children: [
|
|
7195
|
+
label,
|
|
7196
|
+
optional && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.optional, children: " - optional" }),
|
|
7197
|
+
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 }) })
|
|
7198
|
+
] }),
|
|
7199
|
+
/* @__PURE__ */ jsxRuntime.jsx(Space, { v: 0.5 })
|
|
7200
|
+
] });
|
|
7201
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.root, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Field, { className: styles.field, label: labelEl, ...fieldProps, children }) });
|
|
6887
7202
|
};
|
|
6888
7203
|
const getStyles$d = ui.stylesFactory((theme, width) => {
|
|
6889
7204
|
return {
|
|
@@ -6913,7 +7228,7 @@ const getStyles$d = ui.stylesFactory((theme, width) => {
|
|
|
6913
7228
|
});
|
|
6914
7229
|
|
|
6915
7230
|
const EditorRows = ({ children }) => {
|
|
6916
|
-
return /* @__PURE__ */
|
|
7231
|
+
return /* @__PURE__ */ jsxRuntime.jsx(EditorStack, { gap: 0.5, direction: "column", children });
|
|
6917
7232
|
};
|
|
6918
7233
|
|
|
6919
7234
|
const VisualEditor = ({ query, db, queryRowFilter, onChange, onValidate, range }) => {
|
|
@@ -6921,7 +7236,16 @@ const VisualEditor = ({ query, db, queryRowFilter, onChange, onValidate, range }
|
|
|
6921
7236
|
const fields = await db.fields(query);
|
|
6922
7237
|
return fields;
|
|
6923
7238
|
}, [db, query.dataset, query.table]);
|
|
6924
|
-
return /* @__PURE__ */
|
|
7239
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7240
|
+
/* @__PURE__ */ jsxRuntime.jsxs(EditorRows, { children: [
|
|
7241
|
+
/* @__PURE__ */ jsxRuntime.jsx(EditorRow, { children: /* @__PURE__ */ jsxRuntime.jsx(SQLSelectRow, { fields: state.value || [], query, onQueryChange: onChange, db }) }),
|
|
7242
|
+
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 }) }) }),
|
|
7243
|
+
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 }) }) }),
|
|
7244
|
+
queryRowFilter.order && /* @__PURE__ */ jsxRuntime.jsx(EditorRow, { children: /* @__PURE__ */ jsxRuntime.jsx(SQLOrderByRow, { fields: state.value || [], query, onQueryChange: onChange, db }) }),
|
|
7245
|
+
queryRowFilter.preview && query.rawSql && /* @__PURE__ */ jsxRuntime.jsx(EditorRow, { children: /* @__PURE__ */ jsxRuntime.jsx(Preview, { rawSql: query.rawSql }) })
|
|
7246
|
+
] }),
|
|
7247
|
+
/* @__PURE__ */ jsxRuntime.jsx(QueryToolbox, { db, query, onValidate, range })
|
|
7248
|
+
] });
|
|
6925
7249
|
};
|
|
6926
7250
|
|
|
6927
7251
|
const MACRO_NAMES = [
|
|
@@ -7156,42 +7480,48 @@ function SqlQueryEditor({ datasource, query, onChange, onRunQuery, range }) {
|
|
|
7156
7480
|
if (loading || error) {
|
|
7157
7481
|
return null;
|
|
7158
7482
|
}
|
|
7159
|
-
return /* @__PURE__ */
|
|
7160
|
-
|
|
7161
|
-
|
|
7162
|
-
|
|
7163
|
-
|
|
7164
|
-
|
|
7165
|
-
|
|
7166
|
-
|
|
7167
|
-
|
|
7168
|
-
|
|
7169
|
-
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
|
|
7483
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7484
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7485
|
+
QueryHeader,
|
|
7486
|
+
{
|
|
7487
|
+
db,
|
|
7488
|
+
defaultDataset: defaultDataset || "",
|
|
7489
|
+
enableDatasets: !db.disableDatasets,
|
|
7490
|
+
enableCatalogs: db.disableCatalogs === false,
|
|
7491
|
+
onChange: onQueryHeaderChange,
|
|
7492
|
+
onRunQuery,
|
|
7493
|
+
onQueryRowChange: setQueryRowFilter,
|
|
7494
|
+
queryRowFilter,
|
|
7495
|
+
query: queryWithDefaults,
|
|
7496
|
+
isQueryRunnable,
|
|
7497
|
+
labels: (_g = datasource.getDB(datasource.id)) == null ? undefined : _g.labels
|
|
7498
|
+
}
|
|
7499
|
+
),
|
|
7500
|
+
/* @__PURE__ */ jsxRuntime.jsx(Space, { v: 0.5 }),
|
|
7501
|
+
queryWithDefaults.editorMode !== EditorMode.Code && /* @__PURE__ */ jsxRuntime.jsx(
|
|
7502
|
+
VisualEditor,
|
|
7503
|
+
{
|
|
7504
|
+
db,
|
|
7505
|
+
query: queryWithDefaults,
|
|
7506
|
+
onChange: (q) => onQueryChange(q, false),
|
|
7507
|
+
queryRowFilter,
|
|
7508
|
+
onValidate: setIsQueryRunnable,
|
|
7509
|
+
range
|
|
7510
|
+
}
|
|
7511
|
+
),
|
|
7512
|
+
queryWithDefaults.editorMode === EditorMode.Code && /* @__PURE__ */ jsxRuntime.jsx(
|
|
7513
|
+
RawEditor,
|
|
7514
|
+
{
|
|
7515
|
+
db,
|
|
7516
|
+
query: queryWithDefaults,
|
|
7517
|
+
queryToValidate,
|
|
7518
|
+
onChange: onQueryChange,
|
|
7519
|
+
onRunQuery,
|
|
7520
|
+
onValidate: setIsQueryRunnable,
|
|
7521
|
+
range
|
|
7522
|
+
}
|
|
7523
|
+
)
|
|
7524
|
+
] });
|
|
7195
7525
|
}
|
|
7196
7526
|
const isQueryValid = (q) => {
|
|
7197
7527
|
return Boolean(q.rawSql);
|
|
@@ -7208,31 +7538,35 @@ const SecureSocksProxyToggle = ({ labelWidth = 10, ...props }) => {
|
|
|
7208
7538
|
}
|
|
7209
7539
|
});
|
|
7210
7540
|
};
|
|
7211
|
-
return runtime.config.secureSocksDSProxyEnabled && /* @__PURE__ */
|
|
7541
|
+
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(
|
|
7212
7542
|
ui.InlineField,
|
|
7213
7543
|
{
|
|
7214
7544
|
htmlFor: "secureSocksProxyEnabled",
|
|
7215
7545
|
label: "Secure Socks Proxy Enabled",
|
|
7216
7546
|
labelWidth,
|
|
7217
|
-
tooltip: /* @__PURE__ */
|
|
7218
|
-
"a",
|
|
7547
|
+
tooltip: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7548
|
+
"Proxy the datasource connection through the secure socks proxy to a different network. To learn more about configuring the datasource connection proxy,",
|
|
7549
|
+
" ",
|
|
7550
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7551
|
+
"a",
|
|
7552
|
+
{
|
|
7553
|
+
href: "https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/proxy/",
|
|
7554
|
+
target: "_blank",
|
|
7555
|
+
rel: "noopener noreferrer",
|
|
7556
|
+
children: "click here."
|
|
7557
|
+
}
|
|
7558
|
+
)
|
|
7559
|
+
] }),
|
|
7560
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7561
|
+
ui.InlineSwitch,
|
|
7219
7562
|
{
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
}
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
/* @__PURE__ */ React__namespace.default.createElement(
|
|
7228
|
-
ui.InlineSwitch,
|
|
7229
|
-
{
|
|
7230
|
-
id: "secureSocksProxyEnabled",
|
|
7231
|
-
value: dataSourceConfig.jsonData.enableSecureSocksProxy,
|
|
7232
|
-
onChange: handleSwitchChange
|
|
7233
|
-
}
|
|
7234
|
-
)
|
|
7235
|
-
))));
|
|
7563
|
+
id: "secureSocksProxyEnabled",
|
|
7564
|
+
value: dataSourceConfig.jsonData.enableSecureSocksProxy,
|
|
7565
|
+
onChange: handleSwitchChange
|
|
7566
|
+
}
|
|
7567
|
+
)
|
|
7568
|
+
}
|
|
7569
|
+
) }) }) });
|
|
7236
7570
|
};
|
|
7237
7571
|
|
|
7238
7572
|
const DataSourceDescription = ({ dataSourceName, docsLink, hasRequiredFields = true, className }) => {
|
|
@@ -7258,7 +7592,17 @@ const DataSourceDescription = ({ dataSourceName, docsLink, hasRequiredFields = t
|
|
|
7258
7592
|
})
|
|
7259
7593
|
})
|
|
7260
7594
|
};
|
|
7261
|
-
return /* @__PURE__ */
|
|
7595
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: css.cx(styles.container, className), children: [
|
|
7596
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: styles.text, children: [
|
|
7597
|
+
"Before you can use the ",
|
|
7598
|
+
dataSourceName,
|
|
7599
|
+
" data source, you must configure it below or in the config file. For detailed instructions,",
|
|
7600
|
+
" ",
|
|
7601
|
+
/* @__PURE__ */ jsxRuntime.jsx("a", { href: docsLink, target: "_blank", rel: "noreferrer", children: "view the documentation" }),
|
|
7602
|
+
"."
|
|
7603
|
+
] }),
|
|
7604
|
+
hasRequiredFields && /* @__PURE__ */ jsxRuntime.jsx("p", { className: styles.text, children: /* @__PURE__ */ jsxRuntime.jsx("i", { children: "Fields marked with * are required" }) })
|
|
7605
|
+
] });
|
|
7262
7606
|
};
|
|
7263
7607
|
|
|
7264
7608
|
const GenericConfigSection = ({
|
|
@@ -7298,40 +7642,50 @@ const GenericConfigSection = ({
|
|
|
7298
7642
|
marginTop: spacing(2)
|
|
7299
7643
|
})
|
|
7300
7644
|
};
|
|
7301
|
-
return /* @__PURE__ */
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7645
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, children: [
|
|
7646
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.header, children: [
|
|
7647
|
+
kind === "section" ? /* @__PURE__ */ jsxRuntime.jsx("h3", { className: styles.title, children: title }) : /* @__PURE__ */ jsxRuntime.jsx("h6", { className: styles.subtitle, children: title }),
|
|
7648
|
+
isCollapsible && /* @__PURE__ */ jsxRuntime.jsx(
|
|
7649
|
+
ui.IconButton,
|
|
7650
|
+
{
|
|
7651
|
+
name: iconName,
|
|
7652
|
+
onClick: () => setIsOpen(!isOpen),
|
|
7653
|
+
type: "button",
|
|
7654
|
+
size: "xl",
|
|
7655
|
+
"aria-label": collapsibleButtonAriaLabel
|
|
7656
|
+
}
|
|
7657
|
+
)
|
|
7658
|
+
] }),
|
|
7659
|
+
description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: styles.descriptionText, children: description }),
|
|
7660
|
+
isOpen && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.content, children })
|
|
7661
|
+
] });
|
|
7311
7662
|
};
|
|
7312
7663
|
|
|
7313
7664
|
const ConfigSection = ({ children, ...props }) => {
|
|
7314
|
-
return /* @__PURE__ */
|
|
7665
|
+
return /* @__PURE__ */ jsxRuntime.jsx(GenericConfigSection, { ...props, kind: "section", children });
|
|
7315
7666
|
};
|
|
7316
7667
|
|
|
7317
7668
|
const ConfigSubSection = ({ children, ...props }) => {
|
|
7318
|
-
return /* @__PURE__ */
|
|
7669
|
+
return /* @__PURE__ */ jsxRuntime.jsx(GenericConfigSection, { ...props, kind: "sub-section", children });
|
|
7319
7670
|
};
|
|
7320
7671
|
|
|
7321
7672
|
function ConfigDescriptionLink(props) {
|
|
7322
7673
|
const { description, suffix, feature } = props;
|
|
7323
7674
|
const text = `Learn more about ${feature}`;
|
|
7324
7675
|
const styles = ui.useStyles2(getStyles$c);
|
|
7325
|
-
return /* @__PURE__ */
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
"
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7676
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles.container, children: [
|
|
7677
|
+
description,
|
|
7678
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7679
|
+
"a",
|
|
7680
|
+
{
|
|
7681
|
+
"aria-label": text,
|
|
7682
|
+
href: `https://grafana.com/docs/grafana/next/datasources/${suffix}`,
|
|
7683
|
+
rel: "noreferrer",
|
|
7684
|
+
target: "_blank",
|
|
7685
|
+
children: text
|
|
7686
|
+
}
|
|
7687
|
+
)
|
|
7688
|
+
] });
|
|
7335
7689
|
}
|
|
7336
7690
|
const getStyles$c = (theme) => {
|
|
7337
7691
|
return {
|
|
@@ -7391,59 +7745,62 @@ const BasicAuth = ({
|
|
|
7391
7745
|
marginBottom: 0
|
|
7392
7746
|
})
|
|
7393
7747
|
};
|
|
7394
|
-
return /* @__PURE__ */
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
className: commonStyles.inlineFieldNoMarginRight,
|
|
7398
|
-
label: userLabel,
|
|
7399
|
-
labelWidth: 24,
|
|
7400
|
-
tooltip: userTooltip,
|
|
7401
|
-
required: true,
|
|
7402
|
-
htmlFor: "basic-auth-user-input",
|
|
7403
|
-
interactive: true,
|
|
7404
|
-
grow: true,
|
|
7405
|
-
disabled: readOnly
|
|
7406
|
-
},
|
|
7407
|
-
/* @__PURE__ */ React__namespace.default.createElement(
|
|
7408
|
-
ui.Input,
|
|
7748
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7749
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7750
|
+
ui.InlineField,
|
|
7409
7751
|
{
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
required: true
|
|
7752
|
+
className: commonStyles.inlineFieldNoMarginRight,
|
|
7753
|
+
label: userLabel,
|
|
7754
|
+
labelWidth: 24,
|
|
7755
|
+
tooltip: userTooltip,
|
|
7756
|
+
required: true,
|
|
7757
|
+
htmlFor: "basic-auth-user-input",
|
|
7758
|
+
interactive: true,
|
|
7759
|
+
grow: true,
|
|
7760
|
+
disabled: readOnly,
|
|
7761
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7762
|
+
ui.Input,
|
|
7763
|
+
{
|
|
7764
|
+
id: "basic-auth-user-input",
|
|
7765
|
+
placeholder: userPlaceholder,
|
|
7766
|
+
value: user,
|
|
7767
|
+
onChange: (e) => onUserChange(e.currentTarget.value),
|
|
7768
|
+
required: true
|
|
7769
|
+
}
|
|
7770
|
+
)
|
|
7415
7771
|
}
|
|
7416
|
-
)
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7772
|
+
),
|
|
7773
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7774
|
+
ui.InlineField,
|
|
7775
|
+
{
|
|
7776
|
+
className: css.cx(
|
|
7777
|
+
commonStyles.inlineFieldNoMarginRight,
|
|
7778
|
+
commonStyles.inlineFieldWithSecret,
|
|
7779
|
+
styles.lastInlineField
|
|
7780
|
+
),
|
|
7781
|
+
label: passwordLabel,
|
|
7782
|
+
labelWidth: 24,
|
|
7783
|
+
tooltip: passwordTooltip,
|
|
7784
|
+
required: true,
|
|
7785
|
+
htmlFor: "basic-auth-password-input",
|
|
7786
|
+
interactive: true,
|
|
7787
|
+
grow: true,
|
|
7788
|
+
disabled: readOnly,
|
|
7789
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7790
|
+
ui.SecretInput,
|
|
7791
|
+
{
|
|
7792
|
+
id: "basic-auth-password-input",
|
|
7793
|
+
isConfigured: passwordConfigured,
|
|
7794
|
+
onReset: readOnly ? () => {
|
|
7795
|
+
} : onPasswordReset,
|
|
7796
|
+
placeholder: passwordPlaceholder,
|
|
7797
|
+
onChange: (e) => onPasswordChange(e.currentTarget.value),
|
|
7798
|
+
required: true
|
|
7799
|
+
}
|
|
7800
|
+
)
|
|
7444
7801
|
}
|
|
7445
7802
|
)
|
|
7446
|
-
)
|
|
7803
|
+
] });
|
|
7447
7804
|
};
|
|
7448
7805
|
|
|
7449
7806
|
const defaultOptions = {
|
|
@@ -7535,7 +7892,7 @@ const AuthMethodSettings = ({
|
|
|
7535
7892
|
}
|
|
7536
7893
|
let AuthFieldsComponent = null;
|
|
7537
7894
|
if (selected === AuthMethod.BasicAuth && basicAuth) {
|
|
7538
|
-
AuthFieldsComponent = /* @__PURE__ */
|
|
7895
|
+
AuthFieldsComponent = /* @__PURE__ */ jsxRuntime.jsx(BasicAuth, { ...basicAuth, readOnly });
|
|
7539
7896
|
} else if (selected.startsWith("custom-")) {
|
|
7540
7897
|
AuthFieldsComponent = (_b = (_a = customMethods == null ? undefined : customMethods.find((m) => m.id === selected)) == null ? undefined : _a.component) != null ? _b : null;
|
|
7541
7898
|
}
|
|
@@ -7553,19 +7910,22 @@ const AuthMethodSettings = ({
|
|
|
7553
7910
|
marginTop: spacing(1.5)
|
|
7554
7911
|
})
|
|
7555
7912
|
};
|
|
7556
|
-
return /* @__PURE__ */
|
|
7557
|
-
ui.
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7913
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ConfigSubSection, { title, description, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.authMethods, children: [
|
|
7914
|
+
hasSelect && /* @__PURE__ */ jsxRuntime.jsx(ui.Field, { label: "Authentication method", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7915
|
+
ui.Select,
|
|
7916
|
+
{
|
|
7917
|
+
inputId: "auth-method-select",
|
|
7918
|
+
options: preparedOptions,
|
|
7919
|
+
value: selected,
|
|
7920
|
+
onChange: (option) => {
|
|
7921
|
+
setAuthMethodChanged(true);
|
|
7922
|
+
onAuthMethodSelect(option.value);
|
|
7923
|
+
},
|
|
7924
|
+
disabled: readOnly
|
|
7925
|
+
}
|
|
7926
|
+
) }),
|
|
7927
|
+
AuthFieldsComponent && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.selectedMethodFields, children: AuthFieldsComponent })
|
|
7928
|
+
] }) });
|
|
7569
7929
|
};
|
|
7570
7930
|
|
|
7571
7931
|
const TLSSettingsSection = ({
|
|
@@ -7594,7 +7954,13 @@ const TLSSettingsSection = ({
|
|
|
7594
7954
|
margin: spacing(1, 0, 2, 3)
|
|
7595
7955
|
})
|
|
7596
7956
|
};
|
|
7597
|
-
return /* @__PURE__ */
|
|
7957
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.container, children: [
|
|
7958
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.checkboxContainer, children: [
|
|
7959
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Checkbox, { value: enabled, label, onChange: () => onToggle(!enabled), disabled: readOnly }),
|
|
7960
|
+
/* @__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" }) })
|
|
7961
|
+
] }),
|
|
7962
|
+
enabled && children && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.content, children })
|
|
7963
|
+
] });
|
|
7598
7964
|
};
|
|
7599
7965
|
|
|
7600
7966
|
const SelfSignedCertificate = ({
|
|
@@ -7608,42 +7974,42 @@ const SelfSignedCertificate = ({
|
|
|
7608
7974
|
}) => {
|
|
7609
7975
|
var _a;
|
|
7610
7976
|
const commonStyles = useCommonStyles();
|
|
7611
|
-
return /* @__PURE__ */
|
|
7977
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7612
7978
|
TLSSettingsSection,
|
|
7613
7979
|
{
|
|
7614
7980
|
enabled,
|
|
7615
7981
|
label: "Add self-signed certificate",
|
|
7616
7982
|
tooltipText: "Add your own Certificate Authority (CA) certificate on top of one generated by the certificate authorities for additional security measures",
|
|
7617
7983
|
onToggle: (newEnabled) => onToggle(newEnabled),
|
|
7618
|
-
readOnly
|
|
7619
|
-
|
|
7620
|
-
|
|
7621
|
-
ui.InlineField,
|
|
7622
|
-
{
|
|
7623
|
-
label: "CA Certificate",
|
|
7624
|
-
labelWidth: 24,
|
|
7625
|
-
tooltip: (_a = tooltips == null ? undefined : tooltips.certificateLabel) != null ? _a : "Your self-signed certificate",
|
|
7626
|
-
required: true,
|
|
7627
|
-
htmlFor: "self-signed-certificate-input",
|
|
7628
|
-
interactive: true,
|
|
7629
|
-
grow: true,
|
|
7630
|
-
className: css.cx(commonStyles.inlineFieldNoMarginRight, commonStyles.inlineFieldWithSecret),
|
|
7631
|
-
disabled: readOnly
|
|
7632
|
-
},
|
|
7633
|
-
/* @__PURE__ */ React__namespace.default.createElement(
|
|
7634
|
-
ui.SecretTextArea,
|
|
7984
|
+
readOnly,
|
|
7985
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7986
|
+
ui.InlineField,
|
|
7635
7987
|
{
|
|
7636
|
-
|
|
7637
|
-
|
|
7638
|
-
|
|
7639
|
-
|
|
7640
|
-
|
|
7641
|
-
|
|
7642
|
-
|
|
7643
|
-
|
|
7988
|
+
label: "CA Certificate",
|
|
7989
|
+
labelWidth: 24,
|
|
7990
|
+
tooltip: (_a = tooltips == null ? undefined : tooltips.certificateLabel) != null ? _a : "Your self-signed certificate",
|
|
7991
|
+
required: true,
|
|
7992
|
+
htmlFor: "self-signed-certificate-input",
|
|
7993
|
+
interactive: true,
|
|
7994
|
+
grow: true,
|
|
7995
|
+
className: css.cx(commonStyles.inlineFieldNoMarginRight, commonStyles.inlineFieldWithSecret),
|
|
7996
|
+
disabled: readOnly,
|
|
7997
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7998
|
+
ui.SecretTextArea,
|
|
7999
|
+
{
|
|
8000
|
+
id: "self-signed-certificate-input",
|
|
8001
|
+
isConfigured: certificateConfigured,
|
|
8002
|
+
onChange: (e) => onCertificateChange(e.currentTarget.value),
|
|
8003
|
+
onReset: readOnly ? () => {
|
|
8004
|
+
} : onCertificateReset,
|
|
8005
|
+
placeholder: "Begins with --- BEGIN CERTIFICATE ---",
|
|
8006
|
+
rows: 6,
|
|
8007
|
+
required: true
|
|
8008
|
+
}
|
|
8009
|
+
)
|
|
7644
8010
|
}
|
|
7645
8011
|
)
|
|
7646
|
-
|
|
8012
|
+
}
|
|
7647
8013
|
);
|
|
7648
8014
|
};
|
|
7649
8015
|
|
|
@@ -7663,98 +8029,100 @@ const TLSClientAuth = ({
|
|
|
7663
8029
|
}) => {
|
|
7664
8030
|
var _a, _b, _c;
|
|
7665
8031
|
const commonStyles = useCommonStyles();
|
|
7666
|
-
return /* @__PURE__ */
|
|
8032
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7667
8033
|
TLSSettingsSection,
|
|
7668
8034
|
{
|
|
7669
8035
|
enabled,
|
|
7670
8036
|
label: "TLS Client Authentication",
|
|
7671
8037
|
tooltipText: "Validate using TLS client authentication, in which the server authenticates the client",
|
|
7672
8038
|
onToggle: (newEnabled) => onToggle(newEnabled),
|
|
7673
|
-
readOnly
|
|
7674
|
-
|
|
7675
|
-
|
|
7676
|
-
|
|
7677
|
-
|
|
7678
|
-
|
|
7679
|
-
|
|
7680
|
-
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
|
|
7684
|
-
|
|
7685
|
-
|
|
7686
|
-
|
|
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
|
-
|
|
8039
|
+
readOnly,
|
|
8040
|
+
children: [
|
|
8041
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8042
|
+
ui.InlineField,
|
|
8043
|
+
{
|
|
8044
|
+
label: "ServerName",
|
|
8045
|
+
labelWidth: 24,
|
|
8046
|
+
tooltip: (_a = tooltips == null ? undefined : tooltips.serverNameLabel) != null ? _a : "A Servername is used to verify the hostname on the returned certificate",
|
|
8047
|
+
required: true,
|
|
8048
|
+
htmlFor: "client-auth-servername-input",
|
|
8049
|
+
interactive: true,
|
|
8050
|
+
grow: true,
|
|
8051
|
+
className: commonStyles.inlineFieldNoMarginRight,
|
|
8052
|
+
disabled: readOnly,
|
|
8053
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8054
|
+
ui.Input,
|
|
8055
|
+
{
|
|
8056
|
+
id: "client-auth-servername-input",
|
|
8057
|
+
placeholder: "domain.example.com",
|
|
8058
|
+
value: serverName,
|
|
8059
|
+
onChange: (e) => onServerNameChange(e.currentTarget.value),
|
|
8060
|
+
required: true
|
|
8061
|
+
}
|
|
8062
|
+
)
|
|
8063
|
+
}
|
|
8064
|
+
),
|
|
8065
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8066
|
+
ui.InlineField,
|
|
8067
|
+
{
|
|
8068
|
+
label: "Client Certificate",
|
|
8069
|
+
labelWidth: 24,
|
|
8070
|
+
tooltip: (_b = tooltips == null ? undefined : tooltips.certificateLabel) != null ? _b : "The client certificate can be generated from a Certificate Authority or be self-signed",
|
|
8071
|
+
required: true,
|
|
8072
|
+
htmlFor: "client-auth-client-certificate-input",
|
|
8073
|
+
interactive: true,
|
|
8074
|
+
grow: true,
|
|
8075
|
+
className: css.cx(commonStyles.inlineFieldNoMarginRight, commonStyles.inlineFieldWithSecret),
|
|
8076
|
+
disabled: readOnly,
|
|
8077
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8078
|
+
ui.SecretTextArea,
|
|
8079
|
+
{
|
|
8080
|
+
id: "client-auth-client-certificate-input",
|
|
8081
|
+
isConfigured: clientCertificateConfigured,
|
|
8082
|
+
onChange: (e) => onClientCertificateChange(e.currentTarget.value),
|
|
8083
|
+
onReset: readOnly ? () => {
|
|
8084
|
+
} : onClientCertificateReset,
|
|
8085
|
+
placeholder: "Begins with --- BEGIN CERTIFICATE ---",
|
|
8086
|
+
rows: 6,
|
|
8087
|
+
required: true
|
|
8088
|
+
}
|
|
8089
|
+
)
|
|
8090
|
+
}
|
|
8091
|
+
),
|
|
8092
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8093
|
+
ui.InlineField,
|
|
8094
|
+
{
|
|
8095
|
+
label: "Client Key",
|
|
8096
|
+
labelWidth: 24,
|
|
8097
|
+
tooltip: (_c = tooltips == null ? undefined : tooltips.keyLabel) != null ? _c : "The client key can be generated from a Certificate Authority or be self-signed",
|
|
8098
|
+
required: true,
|
|
8099
|
+
htmlFor: "client-auth-client-key-input",
|
|
8100
|
+
interactive: true,
|
|
8101
|
+
grow: true,
|
|
8102
|
+
className: css.cx(commonStyles.inlineFieldNoMarginRight, commonStyles.inlineFieldWithSecret),
|
|
8103
|
+
disabled: readOnly,
|
|
8104
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8105
|
+
ui.SecretTextArea,
|
|
8106
|
+
{
|
|
8107
|
+
id: "client-auth-client-key-input",
|
|
8108
|
+
isConfigured: clientKeyConfigured,
|
|
8109
|
+
onChange: (e) => onClientKeyChange(e.currentTarget.value),
|
|
8110
|
+
onReset: readOnly ? () => {
|
|
8111
|
+
} : onClientKeyReset,
|
|
8112
|
+
placeholder: `Begins with --- RSA PRIVATE KEY CERTIFICATE ---`,
|
|
8113
|
+
rows: 6,
|
|
8114
|
+
required: true
|
|
8115
|
+
}
|
|
8116
|
+
)
|
|
8117
|
+
}
|
|
8118
|
+
)
|
|
8119
|
+
]
|
|
8120
|
+
}
|
|
7753
8121
|
);
|
|
7754
8122
|
};
|
|
7755
8123
|
|
|
7756
8124
|
const SkipTLSVerification = ({ enabled, onToggle, readOnly }) => {
|
|
7757
|
-
return /* @__PURE__ */
|
|
8125
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7758
8126
|
TLSSettingsSection,
|
|
7759
8127
|
{
|
|
7760
8128
|
enabled,
|
|
@@ -7773,16 +8141,18 @@ const TLSSettings = ({ selfSignedCertificate, TLSClientAuth: TLSClientAuth$1, sk
|
|
|
7773
8141
|
marginTop: spacing(3)
|
|
7774
8142
|
})
|
|
7775
8143
|
};
|
|
7776
|
-
return /* @__PURE__ */
|
|
8144
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7777
8145
|
ConfigSubSection,
|
|
7778
8146
|
{
|
|
7779
8147
|
className: styles.container,
|
|
7780
8148
|
title: "TLS settings",
|
|
7781
|
-
description: "Additional security measures that can be applied on top of authentication"
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
|
|
7785
|
-
|
|
8149
|
+
description: "Additional security measures that can be applied on top of authentication",
|
|
8150
|
+
children: [
|
|
8151
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelfSignedCertificate, { ...selfSignedCertificate, readOnly }),
|
|
8152
|
+
/* @__PURE__ */ jsxRuntime.jsx(TLSClientAuth, { ...TLSClientAuth$1, readOnly }),
|
|
8153
|
+
/* @__PURE__ */ jsxRuntime.jsx(SkipTLSVerification, { ...skipTLSVerification, readOnly })
|
|
8154
|
+
]
|
|
8155
|
+
}
|
|
7786
8156
|
);
|
|
7787
8157
|
};
|
|
7788
8158
|
|
|
@@ -7809,65 +8179,69 @@ const CustomHeader = ({ header, onChange, onBlur, onDelete, readOnly }) => {
|
|
|
7809
8179
|
margin: `0 0 3px 10px`
|
|
7810
8180
|
})
|
|
7811
8181
|
};
|
|
7812
|
-
return /* @__PURE__ */
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
label: "Header",
|
|
7816
|
-
labelWidth: 9,
|
|
7817
|
-
grow: true,
|
|
7818
|
-
className: styles.headerNameField,
|
|
7819
|
-
htmlFor: `custom-header-${header.id}-name-input`,
|
|
7820
|
-
disabled: readOnly
|
|
7821
|
-
},
|
|
7822
|
-
/* @__PURE__ */ React__namespace.default.createElement(
|
|
7823
|
-
ui.Input,
|
|
8182
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(ui.InlineFieldRow, { className: styles.container, children: [
|
|
8183
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8184
|
+
ui.InlineField,
|
|
7824
8185
|
{
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
8186
|
+
label: "Header",
|
|
8187
|
+
labelWidth: 9,
|
|
8188
|
+
grow: true,
|
|
8189
|
+
className: styles.headerNameField,
|
|
8190
|
+
htmlFor: `custom-header-${header.id}-name-input`,
|
|
8191
|
+
disabled: readOnly,
|
|
8192
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8193
|
+
ui.Input,
|
|
8194
|
+
{
|
|
8195
|
+
id: `custom-header-${header.id}-name-input`,
|
|
8196
|
+
placeholder: "X-Custom-Header",
|
|
8197
|
+
value: header.name,
|
|
8198
|
+
width: 12,
|
|
8199
|
+
onChange: (e) => onChange({ ...header, name: e.currentTarget.value }),
|
|
8200
|
+
onBlur,
|
|
8201
|
+
className: styles.input
|
|
8202
|
+
}
|
|
8203
|
+
)
|
|
7832
8204
|
}
|
|
7833
|
-
)
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
{
|
|
7837
|
-
label: "Value",
|
|
7838
|
-
labelWidth: 9,
|
|
7839
|
-
grow: true,
|
|
7840
|
-
className: css.cx(commonStyles.inlineFieldWithSecret, styles.headerValueField),
|
|
7841
|
-
htmlFor: `custom-header-${header.id}-value-input`,
|
|
7842
|
-
disabled: readOnly
|
|
7843
|
-
},
|
|
7844
|
-
/* @__PURE__ */ React__namespace.default.createElement(
|
|
7845
|
-
ui.SecretInput,
|
|
8205
|
+
),
|
|
8206
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8207
|
+
ui.InlineField,
|
|
7846
8208
|
{
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
8209
|
+
label: "Value",
|
|
8210
|
+
labelWidth: 9,
|
|
8211
|
+
grow: true,
|
|
8212
|
+
className: css.cx(commonStyles.inlineFieldWithSecret, styles.headerValueField),
|
|
8213
|
+
htmlFor: `custom-header-${header.id}-value-input`,
|
|
8214
|
+
disabled: readOnly,
|
|
8215
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8216
|
+
ui.SecretInput,
|
|
8217
|
+
{
|
|
8218
|
+
id: `custom-header-${header.id}-value-input`,
|
|
8219
|
+
isConfigured: header.configured,
|
|
8220
|
+
placeholder: "Header value",
|
|
8221
|
+
value: header.value,
|
|
8222
|
+
width: 12,
|
|
8223
|
+
onChange: (e) => onChange({ ...header, value: e.currentTarget.value }),
|
|
8224
|
+
onReset: readOnly ? () => {
|
|
8225
|
+
} : () => onChange({ ...header, configured: false, value: "" }),
|
|
8226
|
+
onBlur,
|
|
8227
|
+
className: styles.input
|
|
8228
|
+
}
|
|
8229
|
+
)
|
|
8230
|
+
}
|
|
8231
|
+
),
|
|
8232
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8233
|
+
ui.IconButton,
|
|
8234
|
+
{
|
|
8235
|
+
name: "trash-alt",
|
|
8236
|
+
tooltip: "Remove header",
|
|
8237
|
+
tooltipPlacement: "top",
|
|
8238
|
+
className: styles.removeHeaderBtn,
|
|
8239
|
+
onClick: onDelete,
|
|
8240
|
+
type: "button",
|
|
8241
|
+
disabled: readOnly
|
|
7857
8242
|
}
|
|
7858
8243
|
)
|
|
7859
|
-
)
|
|
7860
|
-
ui.IconButton,
|
|
7861
|
-
{
|
|
7862
|
-
name: "trash-alt",
|
|
7863
|
-
tooltip: "Remove header",
|
|
7864
|
-
tooltipPlacement: "top",
|
|
7865
|
-
className: styles.removeHeaderBtn,
|
|
7866
|
-
onClick: onDelete,
|
|
7867
|
-
type: "button",
|
|
7868
|
-
disabled: readOnly
|
|
7869
|
-
}
|
|
7870
|
-
)));
|
|
8244
|
+
] }) });
|
|
7871
8245
|
};
|
|
7872
8246
|
|
|
7873
8247
|
const CustomHeaders = ({ headers: headersFromProps, onChange, readOnly }) => {
|
|
@@ -7936,27 +8310,29 @@ const CustomHeaders = ({ headers: headersFromProps, onChange, readOnly }) => {
|
|
|
7936
8310
|
marginTop: spacing(1.5)
|
|
7937
8311
|
})
|
|
7938
8312
|
};
|
|
7939
|
-
return /* @__PURE__ */
|
|
8313
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.container, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7940
8314
|
ConfigSubSection,
|
|
7941
8315
|
{
|
|
7942
8316
|
title: "HTTP headers",
|
|
7943
8317
|
description: "Pass along additional context and metadata about the request/response",
|
|
7944
8318
|
isCollapsible: true,
|
|
7945
|
-
isInitiallyOpen: headers.length > 0
|
|
7946
|
-
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
8319
|
+
isInitiallyOpen: headers.length > 0,
|
|
8320
|
+
children: [
|
|
8321
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: headers.map((header) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
8322
|
+
CustomHeader,
|
|
8323
|
+
{
|
|
8324
|
+
header,
|
|
8325
|
+
onChange: (header2) => onHeaderChange(header2.id, header2),
|
|
8326
|
+
onDelete: () => onHeaderDelete(header.id),
|
|
8327
|
+
onBlur,
|
|
8328
|
+
readOnly
|
|
8329
|
+
},
|
|
8330
|
+
header.id
|
|
8331
|
+
)) }),
|
|
8332
|
+
/* @__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" }) })
|
|
8333
|
+
]
|
|
8334
|
+
}
|
|
8335
|
+
) });
|
|
7960
8336
|
};
|
|
7961
8337
|
function uniqueId() {
|
|
7962
8338
|
return Math.random().toString(16).slice(2);
|
|
@@ -7979,19 +8355,23 @@ const Auth = ({
|
|
|
7979
8355
|
maxWidth: 578
|
|
7980
8356
|
})
|
|
7981
8357
|
};
|
|
7982
|
-
return /* @__PURE__ */
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
|
|
8358
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.container, children: /* @__PURE__ */ jsxRuntime.jsxs(ConfigSection, { title: "Authentication", children: [
|
|
8359
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8360
|
+
AuthMethodSettings,
|
|
8361
|
+
{
|
|
8362
|
+
selectedMethod,
|
|
8363
|
+
mostCommonMethod,
|
|
8364
|
+
customMethods,
|
|
8365
|
+
visibleMethods,
|
|
8366
|
+
defaultOptionsOverrides,
|
|
8367
|
+
onAuthMethodSelect,
|
|
8368
|
+
basicAuth,
|
|
8369
|
+
readOnly
|
|
8370
|
+
}
|
|
8371
|
+
),
|
|
8372
|
+
TLS && /* @__PURE__ */ jsxRuntime.jsx(TLSSettings, { ...TLS, readOnly }),
|
|
8373
|
+
customHeaders && /* @__PURE__ */ jsxRuntime.jsx(CustomHeaders, { ...customHeaders, readOnly })
|
|
8374
|
+
] }) });
|
|
7995
8375
|
};
|
|
7996
8376
|
|
|
7997
8377
|
const headerNamePrefix = "httpHeaderName";
|
|
@@ -8200,34 +8580,38 @@ const ConnectionSettings = ({
|
|
|
8200
8580
|
maxWidth: 578
|
|
8201
8581
|
})
|
|
8202
8582
|
};
|
|
8203
|
-
return /* @__PURE__ */
|
|
8583
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(ConfigSection, { title: "Connection", description, className: css.cx(styles.container, className), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8204
8584
|
ui.InlineField,
|
|
8205
8585
|
{
|
|
8206
8586
|
htmlFor: "connection-url",
|
|
8207
8587
|
label: urlLabel || "URL",
|
|
8208
8588
|
labelWidth: 24,
|
|
8209
|
-
tooltip: urlTooltip || /* @__PURE__ */
|
|
8589
|
+
tooltip: urlTooltip || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8590
|
+
"Specify a complete HTTP URL",
|
|
8591
|
+
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
8592
|
+
"(for example https://example.com:8080)"
|
|
8593
|
+
] }),
|
|
8210
8594
|
grow: true,
|
|
8211
8595
|
disabled: config.readOnly,
|
|
8212
8596
|
required: true,
|
|
8213
8597
|
invalid: !isValidUrl && !config.readOnly,
|
|
8214
8598
|
error: isValidUrl ? "" : "Please enter a valid URL",
|
|
8215
|
-
interactive: true
|
|
8216
|
-
|
|
8217
|
-
|
|
8218
|
-
|
|
8219
|
-
|
|
8220
|
-
|
|
8221
|
-
|
|
8222
|
-
|
|
8223
|
-
|
|
8224
|
-
|
|
8225
|
-
|
|
8226
|
-
|
|
8227
|
-
|
|
8228
|
-
|
|
8229
|
-
|
|
8230
|
-
)));
|
|
8599
|
+
interactive: true,
|
|
8600
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8601
|
+
ui.Input,
|
|
8602
|
+
{
|
|
8603
|
+
id: "connection-url",
|
|
8604
|
+
"aria-label": "Data source connection URL",
|
|
8605
|
+
onChange: (event) => onChange({
|
|
8606
|
+
...config,
|
|
8607
|
+
url: event.currentTarget.value
|
|
8608
|
+
}),
|
|
8609
|
+
value: config.url || "",
|
|
8610
|
+
placeholder: urlPlaceholder || "URL"
|
|
8611
|
+
}
|
|
8612
|
+
)
|
|
8613
|
+
}
|
|
8614
|
+
) }) });
|
|
8231
8615
|
};
|
|
8232
8616
|
|
|
8233
8617
|
const AdvancedHttpSettings = ({
|
|
@@ -8258,48 +8642,51 @@ const AdvancedHttpSettings = ({
|
|
|
8258
8642
|
maxWidth: 578
|
|
8259
8643
|
})
|
|
8260
8644
|
};
|
|
8261
|
-
return /* @__PURE__ */
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
htmlFor: "advanced-http-cookies",
|
|
8265
|
-
label: "Allowed cookies",
|
|
8266
|
-
labelWidth: 24,
|
|
8267
|
-
tooltip: "Grafana proxy deletes forwarded cookies by default. Specify cookies by name that should be forwarded to the data source.",
|
|
8268
|
-
disabled: config.readOnly,
|
|
8269
|
-
grow: true
|
|
8270
|
-
},
|
|
8271
|
-
/* @__PURE__ */ React__namespace.default.createElement(
|
|
8272
|
-
ui.TagsInput,
|
|
8645
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ConfigSubSection, { title: "Advanced HTTP settings", className: css.cx(styles.container, className), children: [
|
|
8646
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8647
|
+
ui.InlineField,
|
|
8273
8648
|
{
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
|
|
8277
|
-
|
|
8649
|
+
htmlFor: "advanced-http-cookies",
|
|
8650
|
+
label: "Allowed cookies",
|
|
8651
|
+
labelWidth: 24,
|
|
8652
|
+
tooltip: "Grafana proxy deletes forwarded cookies by default. Specify cookies by name that should be forwarded to the data source.",
|
|
8653
|
+
disabled: config.readOnly,
|
|
8654
|
+
grow: true,
|
|
8655
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8656
|
+
ui.TagsInput,
|
|
8657
|
+
{
|
|
8658
|
+
id: "advanced-http-cookies",
|
|
8659
|
+
placeholder: "New cookie (hit enter to add)",
|
|
8660
|
+
tags: config.jsonData.keepCookies,
|
|
8661
|
+
onChange: onCookiesChange
|
|
8662
|
+
}
|
|
8663
|
+
)
|
|
8278
8664
|
}
|
|
8279
|
-
)
|
|
8280
|
-
|
|
8281
|
-
|
|
8282
|
-
{
|
|
8283
|
-
htmlFor: "advanced-http-timeout",
|
|
8284
|
-
label: "Timeout",
|
|
8285
|
-
labelWidth: 24,
|
|
8286
|
-
tooltip: "HTTP request timeout in seconds",
|
|
8287
|
-
disabled: config.readOnly,
|
|
8288
|
-
grow: true
|
|
8289
|
-
},
|
|
8290
|
-
/* @__PURE__ */ React__namespace.default.createElement(
|
|
8291
|
-
ui.Input,
|
|
8665
|
+
),
|
|
8666
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8667
|
+
ui.InlineField,
|
|
8292
8668
|
{
|
|
8293
|
-
|
|
8294
|
-
|
|
8295
|
-
|
|
8296
|
-
|
|
8297
|
-
|
|
8298
|
-
|
|
8299
|
-
|
|
8669
|
+
htmlFor: "advanced-http-timeout",
|
|
8670
|
+
label: "Timeout",
|
|
8671
|
+
labelWidth: 24,
|
|
8672
|
+
tooltip: "HTTP request timeout in seconds",
|
|
8673
|
+
disabled: config.readOnly,
|
|
8674
|
+
grow: true,
|
|
8675
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8676
|
+
ui.Input,
|
|
8677
|
+
{
|
|
8678
|
+
id: "advanced-http-timeout",
|
|
8679
|
+
type: "number",
|
|
8680
|
+
min: 0,
|
|
8681
|
+
placeholder: "Timeout in seconds",
|
|
8682
|
+
"aria-label": "Timeout in seconds",
|
|
8683
|
+
value: config.jsonData.timeout,
|
|
8684
|
+
onChange: onTimeoutChange
|
|
8685
|
+
}
|
|
8686
|
+
)
|
|
8300
8687
|
}
|
|
8301
8688
|
)
|
|
8302
|
-
)
|
|
8689
|
+
] });
|
|
8303
8690
|
};
|
|
8304
8691
|
|
|
8305
8692
|
var __defProp$2 = Object.defineProperty;
|
|
@@ -8325,43 +8712,47 @@ const getCustomHeaderRowStyles = ui.stylesFactory(() => {
|
|
|
8325
8712
|
});
|
|
8326
8713
|
const CustomHeaderRow = ({ header, onBlur, onChange, onRemove, onReset }) => {
|
|
8327
8714
|
const styles = getCustomHeaderRowStyles();
|
|
8328
|
-
return /* @__PURE__ */
|
|
8329
|
-
|
|
8330
|
-
|
|
8331
|
-
|
|
8332
|
-
|
|
8333
|
-
|
|
8334
|
-
|
|
8335
|
-
|
|
8336
|
-
|
|
8337
|
-
|
|
8338
|
-
|
|
8339
|
-
|
|
8340
|
-
|
|
8341
|
-
|
|
8342
|
-
|
|
8343
|
-
|
|
8344
|
-
|
|
8345
|
-
|
|
8346
|
-
|
|
8347
|
-
|
|
8348
|
-
|
|
8349
|
-
|
|
8350
|
-
|
|
8351
|
-
|
|
8352
|
-
|
|
8353
|
-
|
|
8354
|
-
|
|
8355
|
-
|
|
8356
|
-
|
|
8357
|
-
|
|
8358
|
-
|
|
8359
|
-
|
|
8360
|
-
|
|
8361
|
-
|
|
8362
|
-
|
|
8363
|
-
|
|
8364
|
-
|
|
8715
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.layout, children: [
|
|
8716
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8717
|
+
ui.LegacyForms.FormField,
|
|
8718
|
+
{
|
|
8719
|
+
label: "Header",
|
|
8720
|
+
name: "name",
|
|
8721
|
+
placeholder: "X-Custom-Header",
|
|
8722
|
+
labelWidth: 5,
|
|
8723
|
+
value: header.name || "",
|
|
8724
|
+
onChange: (e) => onChange({ ...header, name: e.target.value }),
|
|
8725
|
+
onBlur
|
|
8726
|
+
}
|
|
8727
|
+
),
|
|
8728
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8729
|
+
ui.LegacyForms.SecretFormField,
|
|
8730
|
+
{
|
|
8731
|
+
label: "Value",
|
|
8732
|
+
"aria-label": "Value",
|
|
8733
|
+
name: "value",
|
|
8734
|
+
isConfigured: header.configured,
|
|
8735
|
+
value: header.value,
|
|
8736
|
+
labelWidth: 5,
|
|
8737
|
+
inputWidth: header.configured ? 11 : 12,
|
|
8738
|
+
placeholder: "Header Value",
|
|
8739
|
+
onReset: () => onReset(header.id),
|
|
8740
|
+
onChange: (e) => onChange({ ...header, value: e.target.value }),
|
|
8741
|
+
onBlur
|
|
8742
|
+
}
|
|
8743
|
+
),
|
|
8744
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8745
|
+
ui.Button,
|
|
8746
|
+
{
|
|
8747
|
+
type: "button",
|
|
8748
|
+
"aria-label": "Remove header",
|
|
8749
|
+
variant: "secondary",
|
|
8750
|
+
size: "xs",
|
|
8751
|
+
onClick: (_e) => onRemove(header.id),
|
|
8752
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Icon, { name: "trash-alt" })
|
|
8753
|
+
}
|
|
8754
|
+
)
|
|
8755
|
+
] });
|
|
8365
8756
|
};
|
|
8366
8757
|
CustomHeaderRow.displayName = "CustomHeaderRow";
|
|
8367
8758
|
class CustomHeadersSettings extends React.PureComponent {
|
|
@@ -8449,30 +8840,34 @@ class CustomHeadersSettings extends React.PureComponent {
|
|
|
8449
8840
|
}
|
|
8450
8841
|
render() {
|
|
8451
8842
|
const { headers } = this.state;
|
|
8452
|
-
return /* @__PURE__ */
|
|
8453
|
-
|
|
8454
|
-
{
|
|
8455
|
-
|
|
8456
|
-
|
|
8457
|
-
|
|
8458
|
-
|
|
8843
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "gf-form-group", children: [
|
|
8844
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "gf-form", children: /* @__PURE__ */ jsxRuntime.jsx("h6", { children: "Custom HTTP Headers" }) }),
|
|
8845
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: headers.map((header, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
8846
|
+
CustomHeaderRow,
|
|
8847
|
+
{
|
|
8848
|
+
header,
|
|
8849
|
+
onChange: (h) => {
|
|
8850
|
+
this.onHeaderChange(i, h);
|
|
8851
|
+
},
|
|
8852
|
+
onBlur: this.updateSettings,
|
|
8853
|
+
onRemove: this.onHeaderRemove,
|
|
8854
|
+
onReset: this.onHeaderReset
|
|
8459
8855
|
},
|
|
8460
|
-
|
|
8461
|
-
|
|
8462
|
-
|
|
8463
|
-
|
|
8464
|
-
|
|
8465
|
-
|
|
8466
|
-
|
|
8467
|
-
|
|
8468
|
-
|
|
8469
|
-
|
|
8470
|
-
|
|
8471
|
-
|
|
8856
|
+
header.id
|
|
8857
|
+
)) }),
|
|
8858
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "gf-form", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8859
|
+
ui.Button,
|
|
8860
|
+
{
|
|
8861
|
+
variant: "secondary",
|
|
8862
|
+
icon: "plus",
|
|
8863
|
+
type: "button",
|
|
8864
|
+
onClick: (e) => {
|
|
8865
|
+
this.onHeaderAdd();
|
|
8866
|
+
},
|
|
8867
|
+
children: "Add header"
|
|
8472
8868
|
}
|
|
8473
|
-
}
|
|
8474
|
-
|
|
8475
|
-
)));
|
|
8869
|
+
) })
|
|
8870
|
+
] });
|
|
8476
8871
|
}
|
|
8477
8872
|
}
|
|
8478
8873
|
|
|
@@ -8554,105 +8949,110 @@ function LabelFilterItem({
|
|
|
8554
8949
|
};
|
|
8555
8950
|
const isConflicting = isConflictingLabelFilter(item, items);
|
|
8556
8951
|
const { current: id } = React.useRef(uuid.v4());
|
|
8557
|
-
return /* @__PURE__ */
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
|
|
8564
|
-
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
|
|
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
|
-
labelValues
|
|
8623
|
-
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
onCloseMenu: () => {
|
|
8628
|
-
setLabelValuesMenuOpen(false);
|
|
8629
|
-
},
|
|
8630
|
-
isOpen: labelValuesMenuOpen,
|
|
8631
|
-
isMulti: isMultiSelect(),
|
|
8632
|
-
isLoading: state.isLoadingLabelValues,
|
|
8633
|
-
options: getOptions(),
|
|
8634
|
-
onChange: (change) => {
|
|
8635
|
-
var _a2, _b;
|
|
8636
|
-
if (change.value) {
|
|
8637
|
-
onChange({
|
|
8638
|
-
...item,
|
|
8639
|
-
value: change.value,
|
|
8640
|
-
op: (_a2 = item.op) != null ? _a2 : defaultOp
|
|
8952
|
+
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: [
|
|
8953
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8954
|
+
ui.Select,
|
|
8955
|
+
{
|
|
8956
|
+
placeholder: "Select label",
|
|
8957
|
+
"data-testid": e2eSelectors.selectors.components.QueryBuilder.labelSelect,
|
|
8958
|
+
inputId: `visual-query-builder-dimensions-filter-item-key-${id}`,
|
|
8959
|
+
width: "auto",
|
|
8960
|
+
value: item.label ? data.toOption(item.label) : null,
|
|
8961
|
+
allowCustomValue: true,
|
|
8962
|
+
onOpenMenu: async () => {
|
|
8963
|
+
setState({ isLoadingLabelNames: true });
|
|
8964
|
+
const labelNames = await onGetLabelNames(item);
|
|
8965
|
+
setLabelNamesMenuOpen(true);
|
|
8966
|
+
setState({ labelNames, isLoadingLabelNames: undefined });
|
|
8967
|
+
},
|
|
8968
|
+
onCloseMenu: () => {
|
|
8969
|
+
setLabelNamesMenuOpen(false);
|
|
8970
|
+
},
|
|
8971
|
+
isOpen: labelNamesMenuOpen,
|
|
8972
|
+
isLoading: state.isLoadingLabelNames,
|
|
8973
|
+
options: state.labelNames,
|
|
8974
|
+
onChange: (change) => {
|
|
8975
|
+
var _a2;
|
|
8976
|
+
if (change.value) {
|
|
8977
|
+
onChange({
|
|
8978
|
+
...item,
|
|
8979
|
+
op: (_a2 = item.op) != null ? _a2 : defaultOp,
|
|
8980
|
+
label: change.value
|
|
8981
|
+
});
|
|
8982
|
+
}
|
|
8983
|
+
},
|
|
8984
|
+
invalid: isConflicting || invalidLabel
|
|
8985
|
+
}
|
|
8986
|
+
),
|
|
8987
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8988
|
+
ui.Select,
|
|
8989
|
+
{
|
|
8990
|
+
"data-testid": e2eSelectors.selectors.components.QueryBuilder.matchOperatorSelect,
|
|
8991
|
+
value: data.toOption((_a = item.op) != null ? _a : defaultOp),
|
|
8992
|
+
options: operators,
|
|
8993
|
+
width: "auto",
|
|
8994
|
+
onChange: (change) => {
|
|
8995
|
+
if (change.value) {
|
|
8996
|
+
onChange({
|
|
8997
|
+
...item,
|
|
8998
|
+
op: change.value,
|
|
8999
|
+
value: isMultiSelect(change.value) ? item.value : getSelectOptionsFromString(item == null ? undefined : item.value)[0]
|
|
9000
|
+
});
|
|
9001
|
+
}
|
|
9002
|
+
},
|
|
9003
|
+
invalid: isConflicting
|
|
9004
|
+
}
|
|
9005
|
+
),
|
|
9006
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9007
|
+
ui.Select,
|
|
9008
|
+
{
|
|
9009
|
+
placeholder: "Select value",
|
|
9010
|
+
"data-testid": e2eSelectors.selectors.components.QueryBuilder.valueSelect,
|
|
9011
|
+
inputId: `visual-query-builder-dimensions-filter-item-value-${id}`,
|
|
9012
|
+
width: "auto",
|
|
9013
|
+
value: isMultiSelect() ? getSelectOptionsFromString(item == null ? undefined : item.value).map(data.toOption) : getSelectOptionsFromString(item == null ? undefined : item.value).map(data.toOption)[0],
|
|
9014
|
+
allowCustomValue: true,
|
|
9015
|
+
onOpenMenu: async () => {
|
|
9016
|
+
setState({ isLoadingLabelValues: true });
|
|
9017
|
+
const labelValues = await onGetLabelValues(item);
|
|
9018
|
+
setState({
|
|
9019
|
+
...state,
|
|
9020
|
+
labelValues,
|
|
9021
|
+
isLoadingLabelValues: undefined
|
|
8641
9022
|
});
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
|
|
8651
|
-
|
|
8652
|
-
|
|
8653
|
-
|
|
8654
|
-
|
|
8655
|
-
|
|
9023
|
+
setLabelValuesMenuOpen(true);
|
|
9024
|
+
},
|
|
9025
|
+
onCloseMenu: () => {
|
|
9026
|
+
setLabelValuesMenuOpen(false);
|
|
9027
|
+
},
|
|
9028
|
+
isOpen: labelValuesMenuOpen,
|
|
9029
|
+
isMulti: isMultiSelect(),
|
|
9030
|
+
isLoading: state.isLoadingLabelValues,
|
|
9031
|
+
options: getOptions(),
|
|
9032
|
+
onChange: (change) => {
|
|
9033
|
+
var _a2, _b;
|
|
9034
|
+
if (change.value) {
|
|
9035
|
+
onChange({
|
|
9036
|
+
...item,
|
|
9037
|
+
value: change.value,
|
|
9038
|
+
op: (_a2 = item.op) != null ? _a2 : defaultOp
|
|
9039
|
+
});
|
|
9040
|
+
} else {
|
|
9041
|
+
const changes = change.map((change2) => {
|
|
9042
|
+
if (change2.value) {
|
|
9043
|
+
return change2.value;
|
|
9044
|
+
} else {
|
|
9045
|
+
return undefined;
|
|
9046
|
+
}
|
|
9047
|
+
}).filter((val) => val !== undefined).join(multiValueSeparator);
|
|
9048
|
+
onChange({ ...item, value: changes, op: (_b = item.op) != null ? _b : defaultOp });
|
|
9049
|
+
}
|
|
9050
|
+
},
|
|
9051
|
+
invalid: isConflicting || invalidValue
|
|
9052
|
+
}
|
|
9053
|
+
),
|
|
9054
|
+
/* @__PURE__ */ jsxRuntime.jsx(AccessoryButton, { "aria-label": "remove", icon: "times", variant: "secondary", onClick: onDelete })
|
|
9055
|
+
] }) }) });
|
|
8656
9056
|
}
|
|
8657
9057
|
const operators = [
|
|
8658
9058
|
{ label: "=", value: "=", description: "Equals", isMultiValue: false },
|
|
@@ -8712,41 +9112,50 @@ function LabelFilters({
|
|
|
8712
9112
|
}
|
|
8713
9113
|
};
|
|
8714
9114
|
const hasLabelFilter = items.some((item) => item.label && item.value);
|
|
8715
|
-
return /* @__PURE__ */
|
|
9115
|
+
return /* @__PURE__ */ jsxRuntime.jsx(EditorFieldGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8716
9116
|
EditorField$1,
|
|
8717
9117
|
{
|
|
8718
9118
|
label: "Label filters",
|
|
8719
9119
|
error: MISSING_LABEL_FILTER_ERROR_MESSAGE,
|
|
8720
|
-
invalid: labelFilterRequired && !hasLabelFilter
|
|
8721
|
-
|
|
8722
|
-
|
|
8723
|
-
|
|
8724
|
-
|
|
8725
|
-
|
|
8726
|
-
|
|
8727
|
-
|
|
8728
|
-
|
|
8729
|
-
|
|
8730
|
-
|
|
8731
|
-
|
|
8732
|
-
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
|
|
8736
|
-
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
|
|
8742
|
-
|
|
8743
|
-
|
|
8744
|
-
));
|
|
9120
|
+
invalid: labelFilterRequired && !hasLabelFilter,
|
|
9121
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9122
|
+
EditorList,
|
|
9123
|
+
{
|
|
9124
|
+
items,
|
|
9125
|
+
onChange: onLabelsChange,
|
|
9126
|
+
renderItem: (item, onChangeItem, onDelete) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
9127
|
+
LabelFilterItem,
|
|
9128
|
+
{
|
|
9129
|
+
item,
|
|
9130
|
+
items,
|
|
9131
|
+
defaultOp,
|
|
9132
|
+
onChange: onChangeItem,
|
|
9133
|
+
onDelete,
|
|
9134
|
+
onGetLabelNames,
|
|
9135
|
+
onGetLabelValues,
|
|
9136
|
+
invalidLabel: labelFilterRequired && !item.label,
|
|
9137
|
+
invalidValue: labelFilterRequired && !item.value,
|
|
9138
|
+
multiValueSeparator
|
|
9139
|
+
}
|
|
9140
|
+
)
|
|
9141
|
+
}
|
|
9142
|
+
)
|
|
9143
|
+
}
|
|
9144
|
+
) });
|
|
8745
9145
|
}
|
|
8746
9146
|
|
|
8747
9147
|
function OperationExplainedBox({ title, stepNumber, markdown, children }) {
|
|
8748
9148
|
const styles = ui.useStyles2(getStyles$b);
|
|
8749
|
-
return /* @__PURE__ */
|
|
9149
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.box, children: [
|
|
9150
|
+
stepNumber !== undefined && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.stepNumber, children: stepNumber }),
|
|
9151
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.boxInner, children: [
|
|
9152
|
+
title && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.header, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: title }) }),
|
|
9153
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.body, children: [
|
|
9154
|
+
markdown && /* @__PURE__ */ jsxRuntime.jsx("div", { dangerouslySetInnerHTML: { __html: data.renderMarkdown(markdown) } }),
|
|
9155
|
+
children
|
|
9156
|
+
] })
|
|
9157
|
+
] })
|
|
9158
|
+
] });
|
|
8750
9159
|
}
|
|
8751
9160
|
const getStyles$b = (theme) => {
|
|
8752
9161
|
return {
|
|
@@ -8792,7 +9201,7 @@ const getStyles$b = (theme) => {
|
|
|
8792
9201
|
};
|
|
8793
9202
|
};
|
|
8794
9203
|
|
|
8795
|
-
const OperationInfoButton =
|
|
9204
|
+
const OperationInfoButton = React.memo(({ definition, operation, innerQueryPlaceholder }) => {
|
|
8796
9205
|
const styles = ui.useStyles2(getStyles$a);
|
|
8797
9206
|
const [show, setShow] = React.useState(false);
|
|
8798
9207
|
const { getTooltipProps, setTooltipRef, setTriggerRef, visible } = reactPopperTooltip.usePopperTooltip({
|
|
@@ -8803,32 +9212,42 @@ const OperationInfoButton = React__namespace.default.memo(({ definition, operati
|
|
|
8803
9212
|
interactive: true,
|
|
8804
9213
|
trigger: ["click"]
|
|
8805
9214
|
});
|
|
8806
|
-
return /* @__PURE__ */
|
|
8807
|
-
|
|
8808
|
-
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
|
|
8812
|
-
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
|
|
8818
|
-
{
|
|
8819
|
-
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
9215
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
9216
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9217
|
+
ui.Button,
|
|
9218
|
+
{
|
|
9219
|
+
title: "Click to show description",
|
|
9220
|
+
ref: setTriggerRef,
|
|
9221
|
+
icon: "info-circle",
|
|
9222
|
+
size: "sm",
|
|
9223
|
+
variant: "secondary",
|
|
9224
|
+
fill: "text"
|
|
9225
|
+
}
|
|
9226
|
+
),
|
|
9227
|
+
visible && /* @__PURE__ */ jsxRuntime.jsx(ui.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: setTooltipRef, ...getTooltipProps(), className: styles.docBox, children: [
|
|
9228
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.docBoxHeader, children: [
|
|
9229
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: definition.renderer(operation, definition, innerQueryPlaceholder) }),
|
|
9230
|
+
/* @__PURE__ */ jsxRuntime.jsx(FlexItem, { grow: 1 }),
|
|
9231
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9232
|
+
ui.Button,
|
|
9233
|
+
{
|
|
9234
|
+
icon: "times",
|
|
9235
|
+
onClick: () => setShow(false),
|
|
9236
|
+
fill: "text",
|
|
9237
|
+
variant: "secondary",
|
|
9238
|
+
title: "Remove operation"
|
|
9239
|
+
}
|
|
9240
|
+
)
|
|
9241
|
+
] }),
|
|
9242
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9243
|
+
"div",
|
|
9244
|
+
{
|
|
9245
|
+
className: styles.docBoxBody,
|
|
9246
|
+
dangerouslySetInnerHTML: { __html: getOperationDocs(definition, operation) }
|
|
9247
|
+
}
|
|
9248
|
+
)
|
|
9249
|
+
] }) })
|
|
9250
|
+
] });
|
|
8832
9251
|
});
|
|
8833
9252
|
OperationInfoButton.displayName = "OperationDocs";
|
|
8834
9253
|
const getStyles$a = (theme) => {
|
|
@@ -8870,7 +9289,7 @@ function getOperationDocs(def, op) {
|
|
|
8870
9289
|
return data.renderMarkdown(def.explainHandler ? def.explainHandler(op, def) : (_a = def.documentation) != null ? _a : "no docs");
|
|
8871
9290
|
}
|
|
8872
9291
|
|
|
8873
|
-
const OperationHeader =
|
|
9292
|
+
const OperationHeader = React.memo(
|
|
8874
9293
|
({ operation, definition, index, onChange, onRemove, onToggle, queryModeller, dragHandleProps }) => {
|
|
8875
9294
|
var _a;
|
|
8876
9295
|
const styles = ui.useStyles2(getStyles$9);
|
|
@@ -8883,70 +9302,82 @@ const OperationHeader = React__namespace.default.memo(
|
|
|
8883
9302
|
setState({ isOpen: true, alternatives });
|
|
8884
9303
|
}
|
|
8885
9304
|
};
|
|
8886
|
-
return /* @__PURE__ */
|
|
8887
|
-
|
|
8888
|
-
|
|
8889
|
-
|
|
8890
|
-
|
|
8891
|
-
|
|
8892
|
-
|
|
8893
|
-
|
|
8894
|
-
|
|
8895
|
-
|
|
8896
|
-
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
|
|
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
|
-
|
|
9305
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.header, children: [
|
|
9306
|
+
!state.isOpen && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
9307
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ...dragHandleProps, children: (_a = definition.name) != null ? _a : definition.id }),
|
|
9308
|
+
/* @__PURE__ */ jsxRuntime.jsx(FlexItem, { grow: 1 }),
|
|
9309
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${styles.operationHeaderButtons} operation-header-show-on-hover`, children: [
|
|
9310
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9311
|
+
ui.Button,
|
|
9312
|
+
{
|
|
9313
|
+
icon: "angle-down",
|
|
9314
|
+
size: "sm",
|
|
9315
|
+
onClick: onToggleSwitcher,
|
|
9316
|
+
fill: "text",
|
|
9317
|
+
variant: "secondary",
|
|
9318
|
+
title: "Click to view alternative operations"
|
|
9319
|
+
}
|
|
9320
|
+
),
|
|
9321
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9322
|
+
OperationInfoButton,
|
|
9323
|
+
{
|
|
9324
|
+
definition,
|
|
9325
|
+
operation,
|
|
9326
|
+
innerQueryPlaceholder: queryModeller.innerQueryPlaceholder
|
|
9327
|
+
}
|
|
9328
|
+
),
|
|
9329
|
+
definition.toggleable && /* @__PURE__ */ jsxRuntime.jsx(
|
|
9330
|
+
ui.Button,
|
|
9331
|
+
{
|
|
9332
|
+
icon: operation.disabled ? "eye-slash" : "eye",
|
|
9333
|
+
size: "sm",
|
|
9334
|
+
onClick: () => onToggle(index),
|
|
9335
|
+
fill: "text",
|
|
9336
|
+
variant: "secondary",
|
|
9337
|
+
title: operation.disabled ? "Enable operation" : "Disable operation"
|
|
9338
|
+
}
|
|
9339
|
+
),
|
|
9340
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9341
|
+
ui.Button,
|
|
9342
|
+
{
|
|
9343
|
+
icon: "times",
|
|
9344
|
+
size: "sm",
|
|
9345
|
+
onClick: () => onRemove(index),
|
|
9346
|
+
fill: "text",
|
|
9347
|
+
variant: "secondary",
|
|
9348
|
+
title: "Remove operation"
|
|
9349
|
+
}
|
|
9350
|
+
)
|
|
9351
|
+
] })
|
|
9352
|
+
] }),
|
|
9353
|
+
state.isOpen && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.selectWrapper, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9354
|
+
ui.Select,
|
|
9355
|
+
{
|
|
9356
|
+
autoFocus: true,
|
|
9357
|
+
openMenuOnFocus: true,
|
|
9358
|
+
placeholder: "Replace with",
|
|
9359
|
+
options: state.alternatives,
|
|
9360
|
+
isOpen: true,
|
|
9361
|
+
onCloseMenu: onToggleSwitcher,
|
|
9362
|
+
onChange: (value) => {
|
|
9363
|
+
if (value.value) {
|
|
9364
|
+
const newDef = queryModeller.getOperationDefinition(value.value.id);
|
|
9365
|
+
const newParams = [...newDef.defaultParams];
|
|
9366
|
+
for (let i = 0; i < Math.min(operation.params.length, newParams.length); i++) {
|
|
9367
|
+
if (newDef.params[i].type === definition.params[i].type) {
|
|
9368
|
+
newParams[i] = operation.params[i];
|
|
9369
|
+
}
|
|
8939
9370
|
}
|
|
9371
|
+
const changedOp = { ...operation, params: newParams, id: value.value.id };
|
|
9372
|
+
onChange(
|
|
9373
|
+
index,
|
|
9374
|
+
definition.changeTypeHandler ? definition.changeTypeHandler(changedOp, newDef) : changedOp
|
|
9375
|
+
);
|
|
8940
9376
|
}
|
|
8941
|
-
const changedOp = { ...operation, params: newParams, id: value.value.id };
|
|
8942
|
-
onChange(
|
|
8943
|
-
index,
|
|
8944
|
-
definition.changeTypeHandler ? definition.changeTypeHandler(changedOp, newDef) : changedOp
|
|
8945
|
-
);
|
|
8946
9377
|
}
|
|
8947
9378
|
}
|
|
8948
|
-
}
|
|
8949
|
-
)
|
|
9379
|
+
) })
|
|
9380
|
+
] });
|
|
8950
9381
|
}
|
|
8951
9382
|
);
|
|
8952
9383
|
OperationHeader.displayName = "OperationHeader";
|
|
@@ -8985,7 +9416,7 @@ function getOperationParamEditor(paramDef) {
|
|
|
8985
9416
|
}
|
|
8986
9417
|
function SimpleInputParamEditor(props) {
|
|
8987
9418
|
var _a;
|
|
8988
|
-
return /* @__PURE__ */
|
|
9419
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8989
9420
|
ui.AutoSizeInput,
|
|
8990
9421
|
{
|
|
8991
9422
|
id: getOperationParamId(props.operationId, props.index),
|
|
@@ -9004,7 +9435,7 @@ function SimpleInputParamEditor(props) {
|
|
|
9004
9435
|
);
|
|
9005
9436
|
}
|
|
9006
9437
|
function BoolInputParamEditor(props) {
|
|
9007
|
-
return /* @__PURE__ */
|
|
9438
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9008
9439
|
ui.Checkbox,
|
|
9009
9440
|
{
|
|
9010
9441
|
id: getOperationParamId(props.operationId, props.index),
|
|
@@ -9031,41 +9462,44 @@ function SelectInputParamEditor({
|
|
|
9031
9462
|
}
|
|
9032
9463
|
let valueOption = (_b = selectOptions.find((x) => x.value === value)) != null ? _b : data.toOption(value);
|
|
9033
9464
|
if (!value && paramDef.optional) {
|
|
9034
|
-
return /* @__PURE__ */
|
|
9465
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.optionalParam, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9035
9466
|
ui.Button,
|
|
9036
9467
|
{
|
|
9037
9468
|
size: "sm",
|
|
9038
9469
|
variant: "secondary",
|
|
9039
9470
|
title: `Add ${paramDef.name}`,
|
|
9040
9471
|
icon: "plus",
|
|
9041
|
-
onClick: () => onChange(index, selectOptions[0].value)
|
|
9042
|
-
|
|
9043
|
-
|
|
9044
|
-
));
|
|
9472
|
+
onClick: () => onChange(index, selectOptions[0].value),
|
|
9473
|
+
children: paramDef.name
|
|
9474
|
+
}
|
|
9475
|
+
) });
|
|
9045
9476
|
}
|
|
9046
|
-
return /* @__PURE__ */
|
|
9047
|
-
|
|
9048
|
-
|
|
9049
|
-
|
|
9050
|
-
|
|
9051
|
-
|
|
9052
|
-
|
|
9053
|
-
|
|
9054
|
-
|
|
9055
|
-
|
|
9056
|
-
|
|
9057
|
-
|
|
9058
|
-
|
|
9059
|
-
|
|
9060
|
-
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
|
|
9064
|
-
|
|
9065
|
-
|
|
9066
|
-
|
|
9067
|
-
|
|
9068
|
-
|
|
9477
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(EditorStack, { gap: 0.5, direction: "row", alignItems: "center", children: [
|
|
9478
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9479
|
+
ui.Select,
|
|
9480
|
+
{
|
|
9481
|
+
id: getOperationParamId(operationId, index),
|
|
9482
|
+
value: valueOption,
|
|
9483
|
+
options: selectOptions,
|
|
9484
|
+
placeholder: paramDef.placeholder,
|
|
9485
|
+
allowCustomValue: true,
|
|
9486
|
+
onChange: (value2) => onChange(index, value2.value),
|
|
9487
|
+
width: paramDef.minWidth || "auto"
|
|
9488
|
+
}
|
|
9489
|
+
),
|
|
9490
|
+
paramDef.optional && /* @__PURE__ */ jsxRuntime.jsx(
|
|
9491
|
+
ui.Button,
|
|
9492
|
+
{
|
|
9493
|
+
"data-testid": `operations.${index}.remove-param`,
|
|
9494
|
+
size: "sm",
|
|
9495
|
+
fill: "text",
|
|
9496
|
+
icon: "times",
|
|
9497
|
+
variant: "secondary",
|
|
9498
|
+
title: `Remove ${paramDef.name}`,
|
|
9499
|
+
onClick: () => onChange(index, "")
|
|
9500
|
+
}
|
|
9501
|
+
)
|
|
9502
|
+
] });
|
|
9069
9503
|
}
|
|
9070
9504
|
const getStyles$8 = (theme) => {
|
|
9071
9505
|
return {
|
|
@@ -9122,7 +9556,7 @@ function OperationEditorBody({
|
|
|
9122
9556
|
restParam = renderAddRestParamButton(lastParamDef, onAddRestParam, index, operation.params.length, styles);
|
|
9123
9557
|
}
|
|
9124
9558
|
}
|
|
9125
|
-
return /* @__PURE__ */
|
|
9559
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9126
9560
|
"div",
|
|
9127
9561
|
{
|
|
9128
9562
|
className: css.cx(styles.card, {
|
|
@@ -9132,54 +9566,68 @@ function OperationEditorBody({
|
|
|
9132
9566
|
}),
|
|
9133
9567
|
ref: provided.innerRef,
|
|
9134
9568
|
...provided.draggableProps,
|
|
9135
|
-
"data-testid": `operations.${index}.wrapper
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
|
|
9140
|
-
|
|
9141
|
-
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
|
-
|
|
9147
|
-
|
|
9148
|
-
|
|
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
|
-
|
|
9569
|
+
"data-testid": `operations.${index}.wrapper`,
|
|
9570
|
+
children: [
|
|
9571
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9572
|
+
OperationHeader,
|
|
9573
|
+
{
|
|
9574
|
+
operation,
|
|
9575
|
+
dragHandleProps: provided.dragHandleProps,
|
|
9576
|
+
definition,
|
|
9577
|
+
index,
|
|
9578
|
+
onChange,
|
|
9579
|
+
onRemove,
|
|
9580
|
+
onToggle,
|
|
9581
|
+
queryModeller
|
|
9582
|
+
}
|
|
9583
|
+
),
|
|
9584
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.body, children: operation.params.map((param, paramIndex) => {
|
|
9585
|
+
const paramDef = definition.params[Math.min(definition.params.length - 1, paramIndex)];
|
|
9586
|
+
const Editor = getOperationParamEditor(paramDef);
|
|
9587
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.paramRow, children: [
|
|
9588
|
+
!paramDef.hideName && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.paramName, children: [
|
|
9589
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: getOperationParamId(id, paramIndex), children: paramDef.name }),
|
|
9590
|
+
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 }) })
|
|
9591
|
+
] }),
|
|
9592
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.paramValue, children: /* @__PURE__ */ jsxRuntime.jsxs(EditorStack, { gap: 0.5, direction: "row", alignItems: "center", wrap: false, children: [
|
|
9593
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9594
|
+
Editor,
|
|
9595
|
+
{
|
|
9596
|
+
index: paramIndex,
|
|
9597
|
+
paramDef,
|
|
9598
|
+
value: operation.params[paramIndex],
|
|
9599
|
+
operation,
|
|
9600
|
+
operationId: id,
|
|
9601
|
+
onChange: onParamValueChanged,
|
|
9602
|
+
onRunQuery,
|
|
9603
|
+
query,
|
|
9604
|
+
datasource,
|
|
9605
|
+
timeRange,
|
|
9606
|
+
queryModeller
|
|
9607
|
+
}
|
|
9608
|
+
),
|
|
9609
|
+
paramDef.restParam && (operation.params.length > definition.params.length || paramDef.optional) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
9610
|
+
ui.Button,
|
|
9611
|
+
{
|
|
9612
|
+
"data-testid": `operations.${index}.remove-rest-param`,
|
|
9613
|
+
size: "sm",
|
|
9614
|
+
fill: "text",
|
|
9615
|
+
icon: "times",
|
|
9616
|
+
variant: "secondary",
|
|
9617
|
+
title: `Remove ${paramDef.name}`,
|
|
9618
|
+
onClick: () => onRemoveRestParam(paramIndex)
|
|
9619
|
+
}
|
|
9620
|
+
)
|
|
9621
|
+
] }) })
|
|
9622
|
+
] }, `${paramIndex}-1`);
|
|
9623
|
+
}) }),
|
|
9624
|
+
restParam,
|
|
9625
|
+
index < query.operations.length - 1 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.arrow, children: [
|
|
9626
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.arrowLine }),
|
|
9627
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.arrowArrow })
|
|
9628
|
+
] })
|
|
9629
|
+
]
|
|
9630
|
+
}
|
|
9183
9631
|
);
|
|
9184
9632
|
}
|
|
9185
9633
|
const getStyles$7 = (theme, isConflicting) => {
|
|
@@ -9290,7 +9738,7 @@ function callParamChangedThenOnChange(def, operation, operationIndex, paramIndex
|
|
|
9290
9738
|
}
|
|
9291
9739
|
}
|
|
9292
9740
|
function renderAddRestParamButton(paramDef, onAddRestParam, operationIndex, paramIndex, styles) {
|
|
9293
|
-
return /* @__PURE__ */
|
|
9741
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.restParam, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9294
9742
|
ui.Button,
|
|
9295
9743
|
{
|
|
9296
9744
|
size: "sm",
|
|
@@ -9298,10 +9746,10 @@ function renderAddRestParamButton(paramDef, onAddRestParam, operationIndex, para
|
|
|
9298
9746
|
title: `Add ${paramDef.name}`.trimEnd(),
|
|
9299
9747
|
variant: "secondary",
|
|
9300
9748
|
onClick: onAddRestParam,
|
|
9301
|
-
"data-testid": `operations.${operationIndex}.add-rest-param
|
|
9302
|
-
|
|
9303
|
-
|
|
9304
|
-
));
|
|
9749
|
+
"data-testid": `operations.${operationIndex}.add-rest-param`,
|
|
9750
|
+
children: paramDef.name
|
|
9751
|
+
}
|
|
9752
|
+
) }, `${paramIndex}-2`);
|
|
9305
9753
|
}
|
|
9306
9754
|
|
|
9307
9755
|
function OperationEditor({
|
|
@@ -9324,7 +9772,11 @@ function OperationEditor({
|
|
|
9324
9772
|
const isConflicting = isConflictingOperation ? isConflictingOperation(operation, query.operations) : false;
|
|
9325
9773
|
const styles = getStyles$6(theme);
|
|
9326
9774
|
if (!def) {
|
|
9327
|
-
return /* @__PURE__ */
|
|
9775
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
9776
|
+
"Operation ",
|
|
9777
|
+
operation.id,
|
|
9778
|
+
" not found"
|
|
9779
|
+
] });
|
|
9328
9780
|
}
|
|
9329
9781
|
const isInvalid = (isDragging) => {
|
|
9330
9782
|
if (isDragging) {
|
|
@@ -9332,34 +9784,34 @@ function OperationEditor({
|
|
|
9332
9784
|
}
|
|
9333
9785
|
return isConflicting ? true : undefined;
|
|
9334
9786
|
};
|
|
9335
|
-
return /* @__PURE__ */
|
|
9787
|
+
return /* @__PURE__ */ jsxRuntime.jsx(dnd.Draggable, { draggableId: `operation-${index}`, index, children: (provided, snapshot) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
9336
9788
|
ui.InlineField,
|
|
9337
9789
|
{
|
|
9338
9790
|
error: "You have conflicting label filters",
|
|
9339
9791
|
invalid: isInvalid(snapshot.isDragging),
|
|
9340
|
-
className: css.cx(styles.error, styles.cardWrapper)
|
|
9341
|
-
|
|
9342
|
-
|
|
9343
|
-
|
|
9344
|
-
|
|
9345
|
-
|
|
9346
|
-
|
|
9347
|
-
|
|
9348
|
-
|
|
9349
|
-
|
|
9350
|
-
|
|
9351
|
-
|
|
9352
|
-
|
|
9353
|
-
|
|
9354
|
-
|
|
9355
|
-
|
|
9356
|
-
|
|
9357
|
-
|
|
9358
|
-
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
));
|
|
9792
|
+
className: css.cx(styles.error, styles.cardWrapper),
|
|
9793
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9794
|
+
OperationEditorBody,
|
|
9795
|
+
{
|
|
9796
|
+
provided,
|
|
9797
|
+
flash,
|
|
9798
|
+
highlight,
|
|
9799
|
+
isConflicting,
|
|
9800
|
+
index,
|
|
9801
|
+
operation,
|
|
9802
|
+
definition: def,
|
|
9803
|
+
onChange,
|
|
9804
|
+
onRemove,
|
|
9805
|
+
onToggle,
|
|
9806
|
+
queryModeller,
|
|
9807
|
+
query,
|
|
9808
|
+
timeRange,
|
|
9809
|
+
onRunQuery,
|
|
9810
|
+
datasource
|
|
9811
|
+
}
|
|
9812
|
+
)
|
|
9813
|
+
}
|
|
9814
|
+
) });
|
|
9363
9815
|
}
|
|
9364
9816
|
const getStyles$6 = (theme, isConflicting) => {
|
|
9365
9817
|
return {
|
|
@@ -9430,38 +9882,44 @@ function OperationList({
|
|
|
9430
9882
|
const onCascaderBlur = () => {
|
|
9431
9883
|
setCascaderOpen(false);
|
|
9432
9884
|
};
|
|
9433
|
-
return /* @__PURE__ */
|
|
9434
|
-
|
|
9435
|
-
|
|
9436
|
-
|
|
9437
|
-
|
|
9438
|
-
|
|
9439
|
-
|
|
9440
|
-
|
|
9441
|
-
|
|
9442
|
-
|
|
9443
|
-
|
|
9444
|
-
|
|
9445
|
-
|
|
9446
|
-
|
|
9447
|
-
|
|
9448
|
-
|
|
9449
|
-
|
|
9450
|
-
|
|
9885
|
+
return /* @__PURE__ */ jsxRuntime.jsx(EditorStack, { gap: 1, direction: "column", children: /* @__PURE__ */ jsxRuntime.jsxs(EditorStack, { gap: 1, children: [
|
|
9886
|
+
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: [
|
|
9887
|
+
operations.map((op, index) => {
|
|
9888
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9889
|
+
OperationEditor,
|
|
9890
|
+
{
|
|
9891
|
+
queryModeller,
|
|
9892
|
+
index,
|
|
9893
|
+
operation: op,
|
|
9894
|
+
query,
|
|
9895
|
+
datasource,
|
|
9896
|
+
onChange: onOperationChange,
|
|
9897
|
+
onRemove,
|
|
9898
|
+
onToggle,
|
|
9899
|
+
onRunQuery,
|
|
9900
|
+
flash: opsToHighlight[index],
|
|
9901
|
+
highlight: highlightedOp === op,
|
|
9902
|
+
timeRange,
|
|
9903
|
+
isConflictingOperation
|
|
9904
|
+
},
|
|
9905
|
+
op.id + JSON.stringify(op.params) + index
|
|
9906
|
+
);
|
|
9907
|
+
}),
|
|
9908
|
+
provided.placeholder
|
|
9909
|
+
] }) }) }),
|
|
9910
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.addButton, children: cascaderOpen ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
9911
|
+
ui.Cascader,
|
|
9912
|
+
{
|
|
9913
|
+
options: addOptions,
|
|
9914
|
+
onSelect: onAddOperation,
|
|
9915
|
+
onBlur: onCascaderBlur,
|
|
9916
|
+
autoFocus: true,
|
|
9917
|
+
alwaysOpen: true,
|
|
9918
|
+
hideActiveLevelLabel: true,
|
|
9919
|
+
placeholder: "Search"
|
|
9451
9920
|
}
|
|
9452
|
-
)
|
|
9453
|
-
})
|
|
9454
|
-
ui.Cascader,
|
|
9455
|
-
{
|
|
9456
|
-
options: addOptions,
|
|
9457
|
-
onSelect: onAddOperation,
|
|
9458
|
-
onBlur: onCascaderBlur,
|
|
9459
|
-
autoFocus: true,
|
|
9460
|
-
alwaysOpen: true,
|
|
9461
|
-
hideActiveLevelLabel: true,
|
|
9462
|
-
placeholder: "Search"
|
|
9463
|
-
}
|
|
9464
|
-
) : /* @__PURE__ */ React__namespace.default.createElement(ui.Button, { icon: "plus", variant: "secondary", onClick: () => setCascaderOpen(true), title: "Add operation" }, "Operations"))));
|
|
9921
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { icon: "plus", variant: "secondary", onClick: () => setCascaderOpen(true), title: "Add operation", children: "Operations" }) })
|
|
9922
|
+
] }) });
|
|
9465
9923
|
}
|
|
9466
9924
|
function useOperationsHighlight(operations) {
|
|
9467
9925
|
const isMounted = reactUse.useMountedState();
|
|
@@ -9518,7 +9976,7 @@ function RawQuery({ query, language, className }) {
|
|
|
9518
9976
|
const theme = ui.useTheme2();
|
|
9519
9977
|
const styles = getStyles$4(theme);
|
|
9520
9978
|
const highlighted = Prism__default.default.highlight(query, language.grammar, language.name);
|
|
9521
|
-
return /* @__PURE__ */
|
|
9979
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9522
9980
|
"div",
|
|
9523
9981
|
{
|
|
9524
9982
|
className: css.cx(styles.editorField, "prism-syntax-highlight", className),
|
|
@@ -9544,7 +10002,7 @@ function OperationListExplained({
|
|
|
9544
10002
|
onMouseEnter,
|
|
9545
10003
|
onMouseLeave
|
|
9546
10004
|
}) {
|
|
9547
|
-
return /* @__PURE__ */
|
|
10005
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: query.operations.map((op, index) => {
|
|
9548
10006
|
var _a;
|
|
9549
10007
|
const def = queryModeller.getOperationDefinition(op.id);
|
|
9550
10008
|
if (!def) {
|
|
@@ -9552,28 +10010,28 @@ function OperationListExplained({
|
|
|
9552
10010
|
}
|
|
9553
10011
|
const title = def.renderer(op, def, queryModeller.innerQueryPlaceholder);
|
|
9554
10012
|
const body = def.explainHandler ? def.explainHandler(op, def) : (_a = def.documentation) != null ? _a : "no docs";
|
|
9555
|
-
return /* @__PURE__ */
|
|
10013
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9556
10014
|
"div",
|
|
9557
10015
|
{
|
|
9558
|
-
key: index,
|
|
9559
10016
|
onMouseEnter: () => onMouseEnter == null ? undefined : onMouseEnter(op, index),
|
|
9560
|
-
onMouseLeave: () => onMouseLeave == null ? undefined : onMouseLeave(op, index)
|
|
10017
|
+
onMouseLeave: () => onMouseLeave == null ? undefined : onMouseLeave(op, index),
|
|
10018
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10019
|
+
OperationExplainedBox,
|
|
10020
|
+
{
|
|
10021
|
+
stepNumber: index + stepNumber,
|
|
10022
|
+
title: /* @__PURE__ */ jsxRuntime.jsx(RawQuery, { query: title, language }),
|
|
10023
|
+
markdown: body
|
|
10024
|
+
}
|
|
10025
|
+
)
|
|
9561
10026
|
},
|
|
9562
|
-
|
|
9563
|
-
OperationExplainedBox,
|
|
9564
|
-
{
|
|
9565
|
-
stepNumber: index + stepNumber,
|
|
9566
|
-
title: /* @__PURE__ */ React__namespace.default.createElement(RawQuery, { query: title, language }),
|
|
9567
|
-
markdown: body
|
|
9568
|
-
}
|
|
9569
|
-
)
|
|
10027
|
+
index
|
|
9570
10028
|
);
|
|
9571
|
-
}));
|
|
10029
|
+
}) });
|
|
9572
10030
|
}
|
|
9573
10031
|
|
|
9574
10032
|
function OperationsEditorRow({ children }) {
|
|
9575
10033
|
const styles = ui.useStyles2(getStyles$3);
|
|
9576
|
-
return /* @__PURE__ */
|
|
10034
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.root, children: /* @__PURE__ */ jsxRuntime.jsx(EditorStack, { gap: 1, children }) });
|
|
9577
10035
|
}
|
|
9578
10036
|
const getStyles$3 = (theme) => {
|
|
9579
10037
|
return {
|
|
@@ -9605,9 +10063,9 @@ const QueryBuilderHints = ({
|
|
|
9605
10063
|
});
|
|
9606
10064
|
return hints2 != null ? hints2 : [];
|
|
9607
10065
|
}, [datasource, visualQuery, data, queryModeller, buildDataQueryFromQueryString]);
|
|
9608
|
-
return /* @__PURE__ */
|
|
10066
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: hints.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.container, children: hints.map((hint) => {
|
|
9609
10067
|
var _a, _b, _c, _d;
|
|
9610
|
-
return /* @__PURE__ */
|
|
10068
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { content: `${hint.label} ${(_a = hint.fix) == null ? undefined : _a.label}`, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9611
10069
|
ui.Button,
|
|
9612
10070
|
{
|
|
9613
10071
|
onClick: () => {
|
|
@@ -9629,12 +10087,14 @@ const QueryBuilderHints = ({
|
|
|
9629
10087
|
},
|
|
9630
10088
|
fill: "outline",
|
|
9631
10089
|
size: "sm",
|
|
9632
|
-
className: styles.hint
|
|
9633
|
-
|
|
9634
|
-
|
|
9635
|
-
|
|
9636
|
-
|
|
9637
|
-
|
|
10090
|
+
className: styles.hint,
|
|
10091
|
+
children: [
|
|
10092
|
+
"hint: ",
|
|
10093
|
+
((_b = hint.fix) == null ? undefined : _b.title) || ((_d = (_c = hint.fix) == null ? undefined : _c.action) == null ? undefined : _d.type.toLowerCase().replace("_", " "))
|
|
10094
|
+
]
|
|
10095
|
+
}
|
|
10096
|
+
) }, hint.type);
|
|
10097
|
+
}) }) });
|
|
9638
10098
|
};
|
|
9639
10099
|
QueryBuilderHints.displayName = "QueryBuilderHints";
|
|
9640
10100
|
const getStyles$2 = (theme) => {
|
|
@@ -9654,14 +10114,17 @@ const editorModes = [
|
|
|
9654
10114
|
{ label: "Code", value: QueryEditorMode.Code }
|
|
9655
10115
|
];
|
|
9656
10116
|
function QueryEditorModeToggle({ mode, onChange }) {
|
|
9657
|
-
return /* @__PURE__ */
|
|
10117
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-testid": "QueryEditorModeToggle", children: /* @__PURE__ */ jsxRuntime.jsx(ui.RadioButtonGroup, { options: editorModes, size: "sm", value: mode, onChange }) });
|
|
9658
10118
|
}
|
|
9659
10119
|
|
|
9660
10120
|
function QueryHeaderSwitch({ label, ...inputProps }) {
|
|
9661
10121
|
const dashedLabel = label.replace(" ", "-");
|
|
9662
10122
|
const switchIdRef = React.useRef(lodash.uniqueId(`switch-${dashedLabel}`));
|
|
9663
10123
|
const styles = ui.useStyles2(getStyles$1);
|
|
9664
|
-
return /* @__PURE__ */
|
|
10124
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(EditorStack, { gap: 1, children: [
|
|
10125
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: switchIdRef.current, className: styles.switchLabel, children: label }),
|
|
10126
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Switch, { ...inputProps, id: switchIdRef.current })
|
|
10127
|
+
] });
|
|
9665
10128
|
}
|
|
9666
10129
|
const getStyles$1 = (theme) => {
|
|
9667
10130
|
return {
|
|
@@ -9679,17 +10142,24 @@ const getStyles$1 = (theme) => {
|
|
|
9679
10142
|
function QueryOptionGroup({ title, children, collapsedInfo, queryStats }) {
|
|
9680
10143
|
const [isOpen, toggleOpen] = reactUse.useToggle(false);
|
|
9681
10144
|
const styles = ui.useStyles2(getStyles);
|
|
9682
|
-
return /* @__PURE__ */
|
|
9683
|
-
|
|
9684
|
-
|
|
9685
|
-
|
|
9686
|
-
|
|
9687
|
-
|
|
9688
|
-
|
|
9689
|
-
|
|
9690
|
-
|
|
9691
|
-
|
|
9692
|
-
|
|
10145
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.wrapper, children: [
|
|
10146
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10147
|
+
ui.Collapse,
|
|
10148
|
+
{
|
|
10149
|
+
className: styles.collapse,
|
|
10150
|
+
collapsible: true,
|
|
10151
|
+
isOpen,
|
|
10152
|
+
onToggle: toggleOpen,
|
|
10153
|
+
label: /* @__PURE__ */ jsxRuntime.jsxs(EditorStack, { gap: 0, children: [
|
|
10154
|
+
/* @__PURE__ */ jsxRuntime.jsx("h6", { className: styles.title, children: title }),
|
|
10155
|
+
!isOpen && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.description, children: collapsedInfo.map((x, i) => /* @__PURE__ */ jsxRuntime.jsx("span", { children: x }, i)) })
|
|
10156
|
+
] }),
|
|
10157
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.body, children })
|
|
10158
|
+
}
|
|
10159
|
+
),
|
|
10160
|
+
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" }) }),
|
|
10161
|
+
queryStats && /* @__PURE__ */ jsxRuntime.jsx("p", { className: styles.stats, children: generateQueryStats(queryStats) })
|
|
10162
|
+
] });
|
|
9693
10163
|
}
|
|
9694
10164
|
const getStyles = (theme) => {
|
|
9695
10165
|
return {
|
|
@@ -39995,6 +40465,7 @@ exports.AdvancedHttpSettings = AdvancedHttpSettings;
|
|
|
39995
40465
|
exports.Auth = Auth;
|
|
39996
40466
|
exports.AuthMethod = AuthMethod;
|
|
39997
40467
|
exports.BINARY_OPERATIONS_KEY = BINARY_OPERATIONS_KEY;
|
|
40468
|
+
exports.CatalogSelector = CatalogSelector;
|
|
39998
40469
|
exports.CompletionItemInsertTextRule = CompletionItemInsertTextRule;
|
|
39999
40470
|
exports.CompletionItemKind = CompletionItemKind;
|
|
40000
40471
|
exports.CompletionItemPriority = CompletionItemPriority;
|
|
@@ -40007,6 +40478,7 @@ exports.DataLink = DataLink;
|
|
|
40007
40478
|
exports.DataLinks = DataLinks;
|
|
40008
40479
|
exports.DataSourceDescription = DataSourceDescription;
|
|
40009
40480
|
exports.DataSourcePicker = DataSourcePicker;
|
|
40481
|
+
exports.DatasetSelector = DatasetSelector;
|
|
40010
40482
|
exports.DatePicker = DatePicker;
|
|
40011
40483
|
exports.DatePickerWithInput = DatePickerWithInput;
|
|
40012
40484
|
exports.DebounceInput = DebounceInput;
|
|
@@ -40045,6 +40517,7 @@ exports.RunQueryButton = RunQueryButton;
|
|
|
40045
40517
|
exports.SQLEditor = SQLEditor;
|
|
40046
40518
|
exports.SQLEditorMode = SQLEditorMode;
|
|
40047
40519
|
exports.SQLEditorTestUtils = SQLEditorTestUtils;
|
|
40520
|
+
exports.SchemaSelector = SchemaSelector;
|
|
40048
40521
|
exports.SecureSocksProxyToggle = SecureSocksProxyToggle;
|
|
40049
40522
|
exports.Segment = Segment;
|
|
40050
40523
|
exports.Space = Space;
|
|
@@ -40053,6 +40526,7 @@ exports.SqlQueryEditor = SqlQueryEditor;
|
|
|
40053
40526
|
exports.StatementPosition = StatementPosition;
|
|
40054
40527
|
exports.SuggestionKind = SuggestionKind;
|
|
40055
40528
|
exports.TLSSettings = TLSSettings;
|
|
40529
|
+
exports.TableSelector = TableSelector;
|
|
40056
40530
|
exports.TokenType = TokenType;
|
|
40057
40531
|
exports.convertLegacyAuthProps = convertLegacyAuthProps;
|
|
40058
40532
|
exports.formatDate = formatDate;
|