@grafana/plugin-ui 0.10.10 → 0.11.1

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