@grafana/plugin-ui 0.10.10 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/dist/cjs/index.cjs +1785 -1324
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs/index.d.cts +94 -46
  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 +54 -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 +3 -2
  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 +44 -37
  89. package/dist/esm/components/QueryEditor/QueryEditor.js.map +1 -1
  90. package/dist/esm/components/QueryEditor/QueryHeader.js +172 -95
  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/SchemaSelector.js +56 -0
  95. package/dist/esm/components/QueryEditor/SchemaSelector.js.map +1 -0
  96. package/dist/esm/components/QueryEditor/Space.js +2 -2
  97. package/dist/esm/components/QueryEditor/Space.js.map +1 -1
  98. package/dist/esm/components/QueryEditor/TableSelector.js +21 -7
  99. package/dist/esm/components/QueryEditor/TableSelector.js.map +1 -1
  100. package/dist/esm/components/QueryEditor/query-editor-raw/QueryEditorRaw.js +6 -5
  101. package/dist/esm/components/QueryEditor/query-editor-raw/QueryEditorRaw.js.map +1 -1
  102. package/dist/esm/components/QueryEditor/query-editor-raw/QueryToolbox.js +26 -18
  103. package/dist/esm/components/QueryEditor/query-editor-raw/QueryToolbox.js.map +1 -1
  104. package/dist/esm/components/QueryEditor/query-editor-raw/QueryValidator.js +19 -2
  105. package/dist/esm/components/QueryEditor/query-editor-raw/QueryValidator.js.map +1 -1
  106. package/dist/esm/components/QueryEditor/query-editor-raw/RawEditor.js +42 -38
  107. package/dist/esm/components/QueryEditor/query-editor-raw/RawEditor.js.map +1 -1
  108. package/dist/esm/components/QueryEditor/types.js +1 -0
  109. package/dist/esm/components/QueryEditor/types.js.map +1 -1
  110. package/dist/esm/components/QueryEditor/visual-query-builder/AwesomeQueryBuilder.js +8 -8
  111. package/dist/esm/components/QueryEditor/visual-query-builder/AwesomeQueryBuilder.js.map +1 -1
  112. package/dist/esm/components/QueryEditor/visual-query-builder/EditorField.js +11 -3
  113. package/dist/esm/components/QueryEditor/visual-query-builder/EditorField.js.map +1 -1
  114. package/dist/esm/components/QueryEditor/visual-query-builder/EditorRow.js +2 -2
  115. package/dist/esm/components/QueryEditor/visual-query-builder/EditorRow.js.map +1 -1
  116. package/dist/esm/components/QueryEditor/visual-query-builder/EditorRows.js +2 -2
  117. package/dist/esm/components/QueryEditor/visual-query-builder/EditorRows.js.map +1 -1
  118. package/dist/esm/components/QueryEditor/visual-query-builder/GroupByRow.js +16 -12
  119. package/dist/esm/components/QueryEditor/visual-query-builder/GroupByRow.js.map +1 -1
  120. package/dist/esm/components/QueryEditor/visual-query-builder/OrderByRow.js +29 -20
  121. package/dist/esm/components/QueryEditor/visual-query-builder/OrderByRow.js.map +1 -1
  122. package/dist/esm/components/QueryEditor/visual-query-builder/Preview.js +7 -4
  123. package/dist/esm/components/QueryEditor/visual-query-builder/Preview.js.map +1 -1
  124. package/dist/esm/components/QueryEditor/visual-query-builder/SQLGroupByRow.js +2 -2
  125. package/dist/esm/components/QueryEditor/visual-query-builder/SQLGroupByRow.js.map +1 -1
  126. package/dist/esm/components/QueryEditor/visual-query-builder/SQLOrderByRow.js +2 -2
  127. package/dist/esm/components/QueryEditor/visual-query-builder/SQLOrderByRow.js.map +1 -1
  128. package/dist/esm/components/QueryEditor/visual-query-builder/SQLSelectRow.js +2 -2
  129. package/dist/esm/components/QueryEditor/visual-query-builder/SQLSelectRow.js.map +1 -1
  130. package/dist/esm/components/QueryEditor/visual-query-builder/SQLWhereRow.js +4 -4
  131. package/dist/esm/components/QueryEditor/visual-query-builder/SQLWhereRow.js.map +1 -1
  132. package/dist/esm/components/QueryEditor/visual-query-builder/SelectRow.js +52 -44
  133. package/dist/esm/components/QueryEditor/visual-query-builder/SelectRow.js.map +1 -1
  134. package/dist/esm/components/QueryEditor/visual-query-builder/VisualEditor.js +11 -2
  135. package/dist/esm/components/QueryEditor/visual-query-builder/VisualEditor.js.map +1 -1
  136. package/dist/esm/components/QueryEditor/visual-query-builder/WhereRow.js +4 -3
  137. package/dist/esm/components/QueryEditor/visual-query-builder/WhereRow.js.map +1 -1
  138. package/dist/esm/components/QueryEditorRow/QueryEditorRow.js +6 -2
  139. package/dist/esm/components/QueryEditorRow/QueryEditorRow.js.map +1 -1
  140. package/dist/esm/components/SQLEditor/components/SQLEditor.js +37 -33
  141. package/dist/esm/components/SQLEditor/components/SQLEditor.js.map +1 -1
  142. package/dist/esm/components/SQLEditor/standardSql/definition.js +1 -0
  143. package/dist/esm/components/SQLEditor/standardSql/definition.js.map +1 -1
  144. package/dist/esm/components/Segment/Segment.js +4 -3
  145. package/dist/esm/components/Segment/Segment.js.map +1 -1
  146. package/dist/esm/components/VisualQueryBuilder/components/LabelFilterItem.js +105 -99
  147. package/dist/esm/components/VisualQueryBuilder/components/LabelFilterItem.js.map +1 -1
  148. package/dist/esm/components/VisualQueryBuilder/components/LabelFilters.js +28 -27
  149. package/dist/esm/components/VisualQueryBuilder/components/LabelFilters.js.map +1 -1
  150. package/dist/esm/components/VisualQueryBuilder/components/OperationEditor.js +31 -26
  151. package/dist/esm/components/VisualQueryBuilder/components/OperationEditor.js.map +1 -1
  152. package/dist/esm/components/VisualQueryBuilder/components/OperationEditorBody.js +70 -55
  153. package/dist/esm/components/VisualQueryBuilder/components/OperationEditorBody.js.map +1 -1
  154. package/dist/esm/components/VisualQueryBuilder/components/OperationExplainedBox.js +11 -2
  155. package/dist/esm/components/VisualQueryBuilder/components/OperationExplainedBox.js.map +1 -1
  156. package/dist/esm/components/VisualQueryBuilder/components/OperationHeader.js +75 -62
  157. package/dist/esm/components/VisualQueryBuilder/components/OperationHeader.js.map +1 -1
  158. package/dist/esm/components/VisualQueryBuilder/components/OperationInfoButton.js +39 -28
  159. package/dist/esm/components/VisualQueryBuilder/components/OperationInfoButton.js.map +1 -1
  160. package/dist/esm/components/VisualQueryBuilder/components/OperationList.js +38 -31
  161. package/dist/esm/components/VisualQueryBuilder/components/OperationList.js.map +1 -1
  162. package/dist/esm/components/VisualQueryBuilder/components/OperationListExplained.js +15 -14
  163. package/dist/esm/components/VisualQueryBuilder/components/OperationListExplained.js.map +1 -1
  164. package/dist/esm/components/VisualQueryBuilder/components/OperationParamEditor.js +35 -31
  165. package/dist/esm/components/VisualQueryBuilder/components/OperationParamEditor.js.map +1 -1
  166. package/dist/esm/components/VisualQueryBuilder/components/OperationsEditorRow.js +3 -2
  167. package/dist/esm/components/VisualQueryBuilder/components/OperationsEditorRow.js.map +1 -1
  168. package/dist/esm/components/VisualQueryBuilder/components/QueryBuilderHints.js +12 -9
  169. package/dist/esm/components/VisualQueryBuilder/components/QueryBuilderHints.js.map +1 -1
  170. package/dist/esm/components/VisualQueryBuilder/components/QueryEditorModeToggle.js +2 -2
  171. package/dist/esm/components/VisualQueryBuilder/components/QueryEditorModeToggle.js.map +1 -1
  172. package/dist/esm/components/VisualQueryBuilder/components/QueryHeaderSwitch.js +6 -2
  173. package/dist/esm/components/VisualQueryBuilder/components/QueryHeaderSwitch.js.map +1 -1
  174. package/dist/esm/components/VisualQueryBuilder/components/QueryOptionGroup.js +20 -12
  175. package/dist/esm/components/VisualQueryBuilder/components/QueryOptionGroup.js.map +1 -1
  176. package/dist/esm/components/VisualQueryBuilder/components/RawQuery.js +2 -2
  177. package/dist/esm/components/VisualQueryBuilder/components/RawQuery.js.map +1 -1
  178. package/dist/esm/index.d.ts +94 -46
  179. package/dist/esm/index.js +4 -0
  180. package/dist/esm/index.js.map +1 -1
  181. 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) => {
@@ -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,16 +5841,25 @@ 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
 
@@ -5832,7 +5897,7 @@ const DatasetSelector = ({
5832
5897
  }
5833
5898
  }
5834
5899
  }, [state.value, value, applyDefault, onChange]);
5835
- return /* @__PURE__ */ React__namespace.default.createElement(
5900
+ return /* @__PURE__ */ jsxRuntime.jsx(
5836
5901
  ui.Select,
5837
5902
  {
5838
5903
  inputId,
@@ -5848,20 +5913,128 @@ const DatasetSelector = ({
5848
5913
  );
5849
5914
  };
5850
5915
 
5851
- const TableSelector = ({ db, dataset, value, className, onChange, inputId }) => {
5916
+ const CatalogSelector = ({ db, inputId, value, onChange }) => {
5917
+ const [catalogs, setCatalogs] = React.useState([]);
5918
+ const [isLoading, setIsLoading] = React.useState(false);
5919
+ const loadCatalogs = React.useCallback(async () => {
5920
+ if (!db.catalogs) {
5921
+ return;
5922
+ }
5923
+ setIsLoading(true);
5924
+ try {
5925
+ const catalogList = await db.catalogs();
5926
+ const catalogOptions = catalogList.map((catalog) => ({
5927
+ label: catalog,
5928
+ value: catalog
5929
+ }));
5930
+ setCatalogs(catalogOptions);
5931
+ } catch (error) {
5932
+ console.error("Error loading catalogs:", error);
5933
+ setCatalogs([]);
5934
+ } finally {
5935
+ setIsLoading(false);
5936
+ }
5937
+ }, [db]);
5938
+ React.useEffect(() => {
5939
+ loadCatalogs();
5940
+ }, [db, loadCatalogs]);
5941
+ const handleChange = (selectable) => {
5942
+ onChange((selectable == null ? undefined : selectable.value) || null);
5943
+ };
5944
+ const selectedValue = catalogs.find((catalog) => catalog.value === value) || null;
5945
+ return /* @__PURE__ */ jsxRuntime.jsx(
5946
+ ui.Select,
5947
+ {
5948
+ inputId,
5949
+ options: catalogs,
5950
+ value: selectedValue,
5951
+ onChange: handleChange,
5952
+ isLoading,
5953
+ placeholder: "Select catalog",
5954
+ isClearable: true,
5955
+ allowCustomValue: true,
5956
+ disabled: isLoading,
5957
+ menuShouldPortal: true
5958
+ }
5959
+ );
5960
+ };
5961
+
5962
+ const SchemaSelector = ({ db, inputId, catalog, value, onChange }) => {
5963
+ const [schemas, setSchemas] = React.useState([]);
5964
+ const [isLoading, setIsLoading] = React.useState(false);
5965
+ const loadSchemas = React.useCallback(async () => {
5966
+ if (!db.schemas || !catalog) {
5967
+ setSchemas([]);
5968
+ return;
5969
+ }
5970
+ setIsLoading(true);
5971
+ try {
5972
+ const schemaList = await db.schemas(catalog);
5973
+ const schemaOptions = schemaList.map((schema) => ({
5974
+ label: schema,
5975
+ value: schema
5976
+ }));
5977
+ setSchemas(schemaOptions);
5978
+ } catch (error) {
5979
+ console.error("Error loading schemas:", error);
5980
+ setSchemas([]);
5981
+ } finally {
5982
+ setIsLoading(false);
5983
+ }
5984
+ }, [db, catalog]);
5985
+ React.useEffect(() => {
5986
+ loadSchemas();
5987
+ }, [db, catalog, loadSchemas]);
5988
+ const handleChange = (selectable) => {
5989
+ onChange((selectable == null ? undefined : selectable.value) || null);
5990
+ };
5991
+ const selectedValue = schemas.find((schema) => schema.value === value) || null;
5992
+ const isDisabled = isLoading || !catalog;
5993
+ return /* @__PURE__ */ jsxRuntime.jsx(
5994
+ ui.Select,
5995
+ {
5996
+ inputId,
5997
+ options: schemas,
5998
+ value: selectedValue,
5999
+ onChange: handleChange,
6000
+ isLoading,
6001
+ placeholder: "Select schema",
6002
+ isClearable: true,
6003
+ allowCustomValue: true,
6004
+ disabled: isDisabled,
6005
+ menuShouldPortal: true
6006
+ }
6007
+ );
6008
+ };
6009
+
6010
+ const TableSelector = ({
6011
+ db,
6012
+ dataset,
6013
+ catalog,
6014
+ schema,
6015
+ value,
6016
+ className,
6017
+ onChange,
6018
+ inputId,
6019
+ enableCatalogs
6020
+ }) => {
5852
6021
  const state = reactUse.useAsync(async () => {
5853
- if (!dataset) {
6022
+ if (!dataset && !catalog) {
5854
6023
  return [];
5855
6024
  }
5856
- const tables = await db.tables(dataset);
6025
+ if (enableCatalogs && (!catalog || !schema)) {
6026
+ return [];
6027
+ }
6028
+ const tables = await db.tables(dataset, catalog, schema);
5857
6029
  return tables.map(data.toOption);
5858
- }, [dataset]);
5859
- return /* @__PURE__ */ React__namespace.default.createElement(
6030
+ }, [dataset, catalog, schema, enableCatalogs]);
6031
+ const isDisabled = state.loading || enableCatalogs && (!catalog || !schema);
6032
+ return /* @__PURE__ */ jsxRuntime.jsx(
5860
6033
  ui.Select,
5861
6034
  {
5862
6035
  inputId,
5863
6036
  className,
5864
- disabled: state.loading,
6037
+ disabled: isDisabled,
5865
6038
  "aria-label": "Table selector",
5866
6039
  value,
5867
6040
  options: state.value,
@@ -5886,7 +6059,7 @@ const RunQueryButton = ({
5886
6059
  if (queryRunning) {
5887
6060
  icon = "fa fa-spinner";
5888
6061
  }
5889
- const RunButton = /* @__PURE__ */ React__namespace.default.createElement(
6062
+ const RunButton = /* @__PURE__ */ jsxRuntime.jsx(
5890
6063
  ui.Button,
5891
6064
  {
5892
6065
  "aria-label": ariaLabel,
@@ -5895,18 +6068,22 @@ const RunQueryButton = ({
5895
6068
  icon,
5896
6069
  disabled: disabled || queryRunning,
5897
6070
  onClick,
5898
- "data-testid": dataTestId
5899
- },
5900
- "Run query"
6071
+ "data-testid": dataTestId,
6072
+ children: "Run query"
6073
+ }
5901
6074
  );
5902
- return queryInvalid ? /* @__PURE__ */ React__namespace.default.createElement(
6075
+ return queryInvalid ? /* @__PURE__ */ jsxRuntime.jsx(
5903
6076
  ui.Tooltip,
5904
6077
  {
5905
6078
  theme: "error",
5906
6079
  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
6080
+ content: invalidQueryTooltip != null ? invalidQueryTooltip : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6081
+ "Your query is invalid. Check below for details. ",
6082
+ /* @__PURE__ */ jsxRuntime.jsx("br", {}),
6083
+ "However, you can still run this query."
6084
+ ] }),
6085
+ children: RunButton
6086
+ }
5910
6087
  ) : RunButton;
5911
6088
  };
5912
6089
 
@@ -5918,6 +6095,7 @@ function QueryHeader({
5918
6095
  db,
5919
6096
  defaultDataset,
5920
6097
  enableDatasets,
6098
+ enableCatalogs,
5921
6099
  query,
5922
6100
  queryRowFilter,
5923
6101
  onChange,
@@ -5931,6 +6109,7 @@ function QueryHeader({
5931
6109
  const [showConfirm, setShowConfirm] = React.useState(false);
5932
6110
  const toRawSql = getRawSqlFn(db);
5933
6111
  const htmlId = React.useId();
6112
+ const catalogsEnabled = enableCatalogs != null ? enableCatalogs : db.disableCatalogs === false;
5934
6113
  const onEditorModeChange = React.useCallback(
5935
6114
  (newEditorMode) => {
5936
6115
  if (editorMode === EditorMode.Code) {
@@ -5958,6 +6137,33 @@ function QueryHeader({
5958
6137
  };
5959
6138
  onChange(next);
5960
6139
  };
6140
+ const onCatalogChange = (catalog) => {
6141
+ if (catalog === query.catalog) {
6142
+ return;
6143
+ }
6144
+ const next = {
6145
+ ...query,
6146
+ catalog: catalog || undefined,
6147
+ schema: undefined,
6148
+ table: undefined,
6149
+ sql: undefined,
6150
+ rawSql: ""
6151
+ };
6152
+ onChange(next);
6153
+ };
6154
+ const onSchemaChange = (schema) => {
6155
+ if (schema === query.schema) {
6156
+ return;
6157
+ }
6158
+ const next = {
6159
+ ...query,
6160
+ schema: schema || undefined,
6161
+ table: undefined,
6162
+ sql: undefined,
6163
+ rawSql: ""
6164
+ };
6165
+ onChange(next);
6166
+ };
5961
6167
  const onTableChange = (e) => {
5962
6168
  if (e.value === query.table) {
5963
6169
  return;
@@ -5970,100 +6176,145 @@ function QueryHeader({
5970
6176
  };
5971
6177
  onChange(next);
5972
6178
  };
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
- )))));
6179
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6180
+ /* @__PURE__ */ jsxRuntime.jsxs(EditorHeader, { children: [
6181
+ /* @__PURE__ */ jsxRuntime.jsx(
6182
+ InlineSelect,
6183
+ {
6184
+ label: "Format",
6185
+ value: query.format,
6186
+ placeholder: "Select format",
6187
+ menuShouldPortal: true,
6188
+ onChange: onFormatChange,
6189
+ options: QUERY_FORMAT_OPTIONS
6190
+ }
6191
+ ),
6192
+ editorMode === EditorMode.Builder && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6193
+ /* @__PURE__ */ jsxRuntime.jsx(
6194
+ ui.InlineSwitch,
6195
+ {
6196
+ id: `sql-filter-${htmlId}`,
6197
+ label: "Filter",
6198
+ transparent: true,
6199
+ showLabel: true,
6200
+ value: queryRowFilter.filter,
6201
+ onChange: (ev) => ev.target instanceof HTMLInputElement && onQueryRowChange({ ...queryRowFilter, filter: ev.target.checked })
6202
+ }
6203
+ ),
6204
+ /* @__PURE__ */ jsxRuntime.jsx(
6205
+ ui.InlineSwitch,
6206
+ {
6207
+ id: `sql-group-${htmlId}`,
6208
+ label: "Group",
6209
+ transparent: true,
6210
+ showLabel: true,
6211
+ value: queryRowFilter.group,
6212
+ onChange: (ev) => ev.target instanceof HTMLInputElement && onQueryRowChange({ ...queryRowFilter, group: ev.target.checked })
6213
+ }
6214
+ ),
6215
+ /* @__PURE__ */ jsxRuntime.jsx(
6216
+ ui.InlineSwitch,
6217
+ {
6218
+ id: `sql-order-${htmlId}`,
6219
+ label: "Order",
6220
+ transparent: true,
6221
+ showLabel: true,
6222
+ value: queryRowFilter.order,
6223
+ onChange: (ev) => ev.target instanceof HTMLInputElement && onQueryRowChange({ ...queryRowFilter, order: ev.target.checked })
6224
+ }
6225
+ ),
6226
+ /* @__PURE__ */ jsxRuntime.jsx(
6227
+ ui.InlineSwitch,
6228
+ {
6229
+ id: `sql-preview-${htmlId}`,
6230
+ label: "Preview",
6231
+ transparent: true,
6232
+ showLabel: true,
6233
+ value: queryRowFilter.preview,
6234
+ onChange: (ev) => ev.target instanceof HTMLInputElement && onQueryRowChange({ ...queryRowFilter, preview: ev.target.checked })
6235
+ }
6236
+ )
6237
+ ] }),
6238
+ /* @__PURE__ */ jsxRuntime.jsx(FlexItem, { grow: 1 }),
6239
+ /* @__PURE__ */ jsxRuntime.jsx(RunQueryButton, { queryInvalid: !isQueryRunnable, onClick: () => onRunQuery() }),
6240
+ /* @__PURE__ */ jsxRuntime.jsx(ui.RadioButtonGroup, { options: editorModes$1, size: "sm", value: editorMode, onChange: onEditorModeChange }),
6241
+ /* @__PURE__ */ jsxRuntime.jsx(
6242
+ ConfirmModal,
6243
+ {
6244
+ isOpen: showConfirm,
6245
+ onCopy: () => {
6246
+ setShowConfirm(false);
6247
+ copyToClipboard(query.rawSql);
6248
+ onChange({
6249
+ ...query,
6250
+ rawSql: toRawSql(query),
6251
+ editorMode: EditorMode.Builder
6252
+ });
6253
+ },
6254
+ onDiscard: () => {
6255
+ setShowConfirm(false);
6256
+ onChange({
6257
+ ...query,
6258
+ rawSql: toRawSql(query),
6259
+ editorMode: EditorMode.Builder
6260
+ });
6261
+ },
6262
+ onCancel: () => setShowConfirm(false)
6263
+ }
6264
+ )
6265
+ ] }),
6266
+ editorMode === EditorMode.Builder && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6267
+ /* @__PURE__ */ jsxRuntime.jsx(Space, { v: 0.5 }),
6268
+ /* @__PURE__ */ jsxRuntime.jsxs(EditorRow$1, { children: [
6269
+ enableDatasets === true && !catalogsEnabled && /* @__PURE__ */ jsxRuntime.jsx(EditorField$1, { label: labels.get("dataset") || "Dataset", width: 25, children: /* @__PURE__ */ jsxRuntime.jsx(
6270
+ DatasetSelector,
6271
+ {
6272
+ db,
6273
+ inputId: `sql-dataset-${htmlId}`,
6274
+ dataset: defaultDataset,
6275
+ value: query.dataset === undefined ? null : query.dataset,
6276
+ onChange: onDatasetChange
6277
+ }
6278
+ ) }),
6279
+ catalogsEnabled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6280
+ /* @__PURE__ */ jsxRuntime.jsx(EditorField$1, { label: labels.get("catalog") || "Catalog", width: 25, children: /* @__PURE__ */ jsxRuntime.jsx(
6281
+ CatalogSelector,
6282
+ {
6283
+ db,
6284
+ inputId: `sql-catalog-${htmlId}`,
6285
+ value: query.catalog === undefined ? null : query.catalog,
6286
+ onChange: onCatalogChange
6287
+ }
6288
+ ) }),
6289
+ /* @__PURE__ */ jsxRuntime.jsx(EditorField$1, { label: labels.get("schema") || "Schema", width: 25, children: /* @__PURE__ */ jsxRuntime.jsx(
6290
+ SchemaSelector,
6291
+ {
6292
+ db,
6293
+ inputId: `sql-schema-${htmlId}`,
6294
+ catalog: query.catalog,
6295
+ value: query.schema === undefined ? null : query.schema,
6296
+ onChange: onSchemaChange
6297
+ }
6298
+ ) })
6299
+ ] }),
6300
+ /* @__PURE__ */ jsxRuntime.jsx(EditorField$1, { label: "Table", width: 25, children: /* @__PURE__ */ jsxRuntime.jsx(
6301
+ TableSelector,
6302
+ {
6303
+ db,
6304
+ inputId: `sql-table-${htmlId}`,
6305
+ dataset: catalogsEnabled ? undefined : query.dataset || defaultDataset,
6306
+ catalog: catalogsEnabled ? query.catalog : undefined,
6307
+ schema: catalogsEnabled ? query.schema : undefined,
6308
+ query,
6309
+ value: query.table === undefined ? null : query.table,
6310
+ onChange: onTableChange,
6311
+ enableCatalogs: catalogsEnabled,
6312
+ applyDefault: true
6313
+ }
6314
+ ) })
6315
+ ] })
6316
+ ] })
6317
+ ] });
6067
6318
  }
6068
6319
 
6069
6320
  function formatSQL(q) {
@@ -6088,16 +6339,16 @@ function QueryEditorRaw({ children, onChange, query, width, height, completionPr
6088
6339
  },
6089
6340
  [onChange]
6090
6341
  );
6091
- return /* @__PURE__ */ React__namespace.default.createElement(
6342
+ return /* @__PURE__ */ jsxRuntime.jsx(
6092
6343
  SQLEditor,
6093
6344
  {
6094
6345
  width,
6095
6346
  height,
6096
6347
  query: query.rawSql,
6097
6348
  onChange: onRawQueryChange,
6098
- language: { id: "sql", completionProvider, formatter: formatSQL }
6099
- },
6100
- children
6349
+ language: { id: "sql", completionProvider, formatter: formatSQL },
6350
+ children
6351
+ }
6101
6352
  );
6102
6353
  }
6103
6354
 
@@ -6154,7 +6405,23 @@ function QueryValidator({ db, query, onValidate, range }) {
6154
6405
  return null;
6155
6406
  }
6156
6407
  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))));
6408
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6409
+ state.loading && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.info, children: [
6410
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Spinner, { inline: true, size: 12 }),
6411
+ " Validating query..."
6412
+ ] }),
6413
+ !state.loading && state.value && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6414
+ /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: state.value.isValid && state.value.statistics && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.valid, children: [
6415
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Icon, { name: "check" }),
6416
+ " This query will process",
6417
+ " ",
6418
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { children: data.formattedValueToString(valueFormatter(state.value.statistics.TotalBytesProcessed)) }),
6419
+ " ",
6420
+ "when run."
6421
+ ] }) }),
6422
+ /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: state.value.isError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.error, children: error }) })
6423
+ ] })
6424
+ ] });
6158
6425
  }
6159
6426
  function processErrorMessage(error) {
6160
6427
  const splat = error.split(":");
@@ -6200,24 +6467,31 @@ function QueryToolbox({ showTools, onFormatCode, onExpand, isExpanded, ...valida
6200
6467
  if (!showTools && validationResult === undefined) {
6201
6468
  style = { height: 0, padding: 0, visibility: "hidden" };
6202
6469
  }
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);
6470
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.container, style, children: [
6471
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: validatorProps.onValidate && /* @__PURE__ */ jsxRuntime.jsx(
6472
+ QueryValidator,
6473
+ {
6474
+ ...validatorProps,
6475
+ onValidate: (result) => {
6476
+ setValidationResult(result);
6477
+ validatorProps.onValidate(result);
6478
+ }
6210
6479
  }
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" })))));
6480
+ ) }),
6481
+ showTools && /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsxs(ui.HorizontalGroup, { spacing: "sm", children: [
6482
+ onFormatCode && /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { onClick: onFormatCode, name: "brackets-curly", size: "xs", tooltip: "Format query" }),
6483
+ onExpand && /* @__PURE__ */ jsxRuntime.jsx(
6484
+ ui.IconButton,
6485
+ {
6486
+ onClick: () => onExpand(!isExpanded),
6487
+ name: isExpanded ? "angle-up" : "angle-down",
6488
+ size: "xs",
6489
+ tooltip: isExpanded ? "Collapse editor" : "Expand editor"
6490
+ }
6491
+ ),
6492
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { content: "Hit CTRL/CMD+Return to run query", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Icon, { className: styles.hint, name: "keyboard" }) })
6493
+ ] }) })
6494
+ ] });
6221
6495
  }
6222
6496
 
6223
6497
  function RawEditor({ db, query, onChange, onRunQuery, onValidate, queryToValidate, range }) {
@@ -6228,39 +6502,39 @@ function RawEditor({ db, query, onChange, onRunQuery, onValidate, queryToValidat
6228
6502
  const [editorRef, editorMeasure] = reactUse.useMeasure();
6229
6503
  const completionProvider = React.useMemo(() => db.getSqlCompletionProvider(), [db]);
6230
6504
  const renderQueryEditor = (width, height) => {
6231
- return /* @__PURE__ */ React__namespace.default.createElement(
6505
+ return /* @__PURE__ */ jsxRuntime.jsx(
6232
6506
  QueryEditorRaw,
6233
6507
  {
6234
6508
  completionProvider,
6235
6509
  query,
6236
6510
  width,
6237
6511
  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
- ));
6512
+ onChange,
6513
+ children: ({ formatQuery }) => {
6514
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: toolboxRef, children: /* @__PURE__ */ jsxRuntime.jsx(
6515
+ QueryToolbox,
6516
+ {
6517
+ db,
6518
+ query: queryToValidate,
6519
+ onValidate,
6520
+ onFormatCode: formatQuery,
6521
+ showTools: true,
6522
+ range,
6523
+ onExpand: setIsExpanded,
6524
+ isExpanded
6525
+ }
6526
+ ) });
6527
+ }
6254
6528
  }
6255
6529
  );
6256
6530
  };
6257
6531
  const renderEditor = (standalone = false) => {
6258
- return standalone ? /* @__PURE__ */ React__namespace.default.createElement(AutoSizer__default.default, null, ({ width, height }) => {
6532
+ return standalone ? /* @__PURE__ */ jsxRuntime.jsx(AutoSizer__default.default, { children: ({ width, height }) => {
6259
6533
  return renderQueryEditor(width, height);
6260
- }) : /* @__PURE__ */ React__namespace.default.createElement("div", { ref: editorRef }, renderQueryEditor());
6534
+ } }) : /* @__PURE__ */ jsxRuntime.jsx("div", { ref: editorRef, children: renderQueryEditor() });
6261
6535
  };
6262
6536
  const renderPlaceholder = () => {
6263
- return /* @__PURE__ */ React__namespace.default.createElement(
6537
+ return /* @__PURE__ */ jsxRuntime.jsx(
6264
6538
  "div",
6265
6539
  {
6266
6540
  style: {
@@ -6270,26 +6544,29 @@ function RawEditor({ db, query, onChange, onRunQuery, onValidate, queryToValidat
6270
6544
  display: "flex",
6271
6545
  alignItems: "center",
6272
6546
  justifyContent: "center"
6273
- }
6274
- },
6275
- "Editing in expanded code editor"
6547
+ },
6548
+ children: "Editing in expanded code editor"
6549
+ }
6276
6550
  );
6277
6551
  };
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);
6552
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6553
+ isExpanded ? renderPlaceholder() : renderEditor(),
6554
+ isExpanded && /* @__PURE__ */ jsxRuntime.jsx(
6555
+ ui.Modal,
6556
+ {
6557
+ title: `Query ${query.refId}`,
6558
+ closeOnBackdropClick: false,
6559
+ closeOnEscape: false,
6560
+ className: styles.modal,
6561
+ contentClassName: styles.modalContent,
6562
+ isOpen: isExpanded,
6563
+ onDismiss: () => {
6564
+ setIsExpanded(false);
6565
+ },
6566
+ children: renderEditor(true)
6289
6567
  }
6290
- },
6291
- renderEditor(true)
6292
- ));
6568
+ )
6569
+ ] });
6293
6570
  }
6294
6571
  function getStyles$h(theme) {
6295
6572
  return {
@@ -6307,8 +6584,11 @@ function getStyles$h(theme) {
6307
6584
  function Preview({ rawSql }) {
6308
6585
  const [_, copyToClipboard] = reactUse.useCopyToClipboard();
6309
6586
  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(
6587
+ const labelElement = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.labelWrapper, children: [
6588
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: styles.label, children: "Preview" }),
6589
+ /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { tooltip: "Copy to clipboard", onClick: () => copyToClipboard(rawSql), name: "copy" })
6590
+ ] });
6591
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.Field, { label: labelElement, className: styles.grow, children: /* @__PURE__ */ jsxRuntime.jsx(
6312
6592
  ui.CodeEditor,
6313
6593
  {
6314
6594
  language: "sql",
@@ -6318,7 +6598,7 @@ function Preview({ rawSql }) {
6318
6598
  readOnly: true,
6319
6599
  showMiniMap: false
6320
6600
  }
6321
- ));
6601
+ ) });
6322
6602
  }
6323
6603
  function getStyles$g(theme) {
6324
6604
  return {
@@ -6343,7 +6623,7 @@ function useSqlChange({ query, onQueryChange, db }) {
6343
6623
 
6344
6624
  function SQLGroupByRow({ fields, query, onQueryChange, db }) {
6345
6625
  const { onSqlChange } = useSqlChange({ query, onQueryChange, db });
6346
- return /* @__PURE__ */ React__namespace.default.createElement(GroupByRow, { columns: fields, sql: query.sql, onSqlChange });
6626
+ return /* @__PURE__ */ jsxRuntime.jsx(GroupByRow, { columns: fields, sql: query.sql, onSqlChange });
6347
6627
  }
6348
6628
 
6349
6629
  const sortOrderOptions = [
@@ -6383,25 +6663,33 @@ function OrderByRow({ sql, onSqlChange, columns, showOffset }) {
6383
6663
  },
6384
6664
  [onSqlChange, sql]
6385
6665
  );
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 })));
6666
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6667
+ /* @__PURE__ */ jsxRuntime.jsx(EditorField$1, { label: "Order by", width: 25, children: /* @__PURE__ */ jsxRuntime.jsxs(InputGroup, { children: [
6668
+ /* @__PURE__ */ jsxRuntime.jsx(
6669
+ ui.Select,
6670
+ {
6671
+ "aria-label": "Order by",
6672
+ options: columns,
6673
+ value: ((_a = sql.orderBy) == null ? undefined : _a.property.name) ? data.toOption(sql.orderBy.property.name) : null,
6674
+ isClearable: true,
6675
+ menuShouldPortal: true,
6676
+ onChange: onOrderByChange
6677
+ }
6678
+ ),
6679
+ /* @__PURE__ */ jsxRuntime.jsx(Space, { h: 1.5 }),
6680
+ /* @__PURE__ */ jsxRuntime.jsx(
6681
+ ui.RadioButtonGroup,
6682
+ {
6683
+ options: sortOrderOptions,
6684
+ disabled: !((_b = sql == null ? undefined : sql.orderBy) == null ? undefined : _b.property.name),
6685
+ value: sql.orderByDirection,
6686
+ onChange: onSortOrderChange
6687
+ }
6688
+ )
6689
+ ] }) }),
6690
+ /* @__PURE__ */ jsxRuntime.jsx(EditorField$1, { label: "Limit", optional: true, width: 25, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { type: "number", min: 0, id: lodash.uniqueId("limit-"), value: sql.limit || "", onChange: onLimitChange }) }),
6691
+ showOffset && /* @__PURE__ */ jsxRuntime.jsx(EditorField$1, { label: "Offset", optional: true, width: 25, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { type: "number", id: lodash.uniqueId("offset-"), value: sql.offset || "", onChange: onOffsetChange }) })
6692
+ ] });
6405
6693
  }
6406
6694
 
6407
6695
  function SQLOrderByRow({ fields, query, onQueryChange, db }) {
@@ -6427,7 +6715,7 @@ function SQLOrderByRow({ fields, query, onQueryChange, db }) {
6427
6715
  ...fields
6428
6716
  ];
6429
6717
  }
6430
- return /* @__PURE__ */ React__namespace.default.createElement(OrderByRow, { sql: query.sql, onSqlChange, columns: columnsWithIndices });
6718
+ return /* @__PURE__ */ jsxRuntime.jsx(OrderByRow, { sql: query.sql, onSqlChange, columns: columnsWithIndices });
6431
6719
  }
6432
6720
 
6433
6721
  const asteriskValue = { label: "*", value: "*" };
@@ -6485,49 +6773,56 @@ function SelectRow({ sql, columns, onSqlChange, functions }) {
6485
6773
  const newSql = { ...sql, columns: [...sql.columns, createFunctionField()] };
6486
6774
  onSqlChange(newSql);
6487
6775
  }, [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
- ));
6776
+ return /* @__PURE__ */ jsxRuntime.jsxs(EditorStack, { gap: 2, alignItems: "end", direction: "column", children: [
6777
+ (_a = sql.columns) == null ? undefined : _a.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsxs(EditorStack, { gap: 2, alignItems: "end", children: [
6778
+ /* @__PURE__ */ jsxRuntime.jsx(EditorField$1, { label: "Column", width: 25, children: /* @__PURE__ */ jsxRuntime.jsx(
6779
+ ui.Select,
6780
+ {
6781
+ value: getColumnValue(item),
6782
+ options: columnsWithAsterisk,
6783
+ inputId: `select-column-${index}-${lodash.uniqueId()}`,
6784
+ menuShouldPortal: true,
6785
+ allowCustomValue: true,
6786
+ onChange: onColumnChange(item, index)
6787
+ }
6788
+ ) }),
6789
+ /* @__PURE__ */ jsxRuntime.jsx(EditorField$1, { label: "Aggregation", optional: true, width: 25, children: /* @__PURE__ */ jsxRuntime.jsx(
6790
+ ui.Select,
6791
+ {
6792
+ value: item.name ? data.toOption(item.name) : null,
6793
+ inputId: `select-aggregation-${index}-${lodash.uniqueId()}`,
6794
+ isClearable: true,
6795
+ menuShouldPortal: true,
6796
+ allowCustomValue: true,
6797
+ options: functions,
6798
+ onChange: onAggregationChange(item, index)
6799
+ }
6800
+ ) }),
6801
+ /* @__PURE__ */ jsxRuntime.jsx(
6802
+ ui.Button,
6803
+ {
6804
+ "aria-label": "Remove",
6805
+ type: "button",
6806
+ icon: "trash-alt",
6807
+ variant: "secondary",
6808
+ size: "md",
6809
+ onClick: removeColumn(index)
6810
+ }
6811
+ )
6812
+ ] }) }, index)),
6813
+ /* @__PURE__ */ jsxRuntime.jsx(
6814
+ ui.Button,
6815
+ {
6816
+ type: "button",
6817
+ onClick: addColumn,
6818
+ variant: "secondary",
6819
+ size: "md",
6820
+ icon: "plus",
6821
+ "aria-label": "Add",
6822
+ className: styles.addButton
6823
+ }
6824
+ )
6825
+ ] });
6531
6826
  }
6532
6827
  const getStyles$f = () => {
6533
6828
  return { addButton: css.css({ alignSelf: "flex-start" }) };
@@ -6546,7 +6841,7 @@ function SQLSelectRow({ fields, query, onQueryChange, db }) {
6546
6841
  const functions = await db.functions();
6547
6842
  return functions.map((f) => data.toOption(f.name));
6548
6843
  }, [db]);
6549
- return /* @__PURE__ */ React__namespace.default.createElement(SelectRow, { columns: fields, sql: query.sql, functions: state.value, onSqlChange });
6844
+ return /* @__PURE__ */ jsxRuntime.jsx(SelectRow, { columns: fields, sql: query.sql, functions: state.value, onSqlChange });
6550
6845
  }
6551
6846
 
6552
6847
  const buttonLabels = {
@@ -6590,7 +6885,7 @@ const widgets = {
6590
6885
  text: {
6591
6886
  ...ui$1.BasicConfig.widgets.text,
6592
6887
  factory: function TextInput(props) {
6593
- return /* @__PURE__ */ React__namespace.default.createElement(
6888
+ return /* @__PURE__ */ jsxRuntime.jsx(
6594
6889
  ui.Input,
6595
6890
  {
6596
6891
  value: (props == null ? undefined : props.value) || "",
@@ -6603,7 +6898,7 @@ const widgets = {
6603
6898
  number: {
6604
6899
  ...ui$1.BasicConfig.widgets.number,
6605
6900
  factory: function NumberInput(props) {
6606
- return /* @__PURE__ */ React__namespace.default.createElement(
6901
+ return /* @__PURE__ */ jsxRuntime.jsx(
6607
6902
  ui.Input,
6608
6903
  {
6609
6904
  value: props == null ? undefined : props.value,
@@ -6617,7 +6912,7 @@ const widgets = {
6617
6912
  datetime: {
6618
6913
  ...ui$1.BasicConfig.widgets.datetime,
6619
6914
  factory: function DateTimeInput(props) {
6620
- return /* @__PURE__ */ React__namespace.default.createElement(
6915
+ return /* @__PURE__ */ jsxRuntime.jsx(
6621
6916
  ui.DateTimePicker,
6622
6917
  {
6623
6918
  onChange: (e) => {
@@ -6638,7 +6933,7 @@ const settings = {
6638
6933
  addRuleLabel: buttonLabels.add,
6639
6934
  deleteLabel: buttonLabels.remove,
6640
6935
  renderConjs: function Conjunctions(conjProps) {
6641
- return /* @__PURE__ */ React__namespace.default.createElement(
6936
+ return /* @__PURE__ */ jsxRuntime.jsx(
6642
6937
  ui.Select,
6643
6938
  {
6644
6939
  id: conjProps == null ? undefined : conjProps.id,
@@ -6653,7 +6948,7 @@ const settings = {
6653
6948
  renderField: function Field(fieldProps) {
6654
6949
  var _a;
6655
6950
  const fields = ((_a = fieldProps == null ? undefined : fieldProps.config) == null ? undefined : _a.fields) || {};
6656
- return /* @__PURE__ */ React__namespace.default.createElement(
6951
+ return /* @__PURE__ */ jsxRuntime.jsx(
6657
6952
  ui.Select,
6658
6953
  {
6659
6954
  id: fieldProps == null ? undefined : fieldProps.id,
@@ -6677,7 +6972,7 @@ const settings = {
6677
6972
  );
6678
6973
  },
6679
6974
  renderButton: function RAQBButton(buttonProps) {
6680
- return /* @__PURE__ */ React__namespace.default.createElement(
6975
+ return /* @__PURE__ */ jsxRuntime.jsx(
6681
6976
  ui.Button,
6682
6977
  {
6683
6978
  type: "button",
@@ -6690,7 +6985,7 @@ const settings = {
6690
6985
  );
6691
6986
  },
6692
6987
  renderOperator: function Operator(operatorProps) {
6693
- return /* @__PURE__ */ React__namespace.default.createElement(
6988
+ return /* @__PURE__ */ jsxRuntime.jsx(
6694
6989
  ui.Select,
6695
6990
  {
6696
6991
  options: operatorProps == null ? undefined : operatorProps.items.map((op) => ({ label: op.label, value: op.key })),
@@ -6805,13 +7100,13 @@ function WhereRow({ sql, config, onSqlChange }) {
6805
7100
  if (!tree) {
6806
7101
  return null;
6807
7102
  }
6808
- return /* @__PURE__ */ React__namespace.default.createElement(
7103
+ return /* @__PURE__ */ jsxRuntime.jsx(
6809
7104
  ui$1.Query,
6810
7105
  {
6811
7106
  ...configWithDefaults,
6812
7107
  value: tree,
6813
7108
  onChange: onTreeChange,
6814
- renderBuilder: (props) => /* @__PURE__ */ React__namespace.default.createElement(ui$1.Builder, { ...props })
7109
+ renderBuilder: (props) => /* @__PURE__ */ jsxRuntime.jsx(ui$1.Builder, { ...props })
6815
7110
  }
6816
7111
  );
6817
7112
  }
@@ -6851,16 +7146,16 @@ function SQLWhereRow({ query, fields, onQueryChange, db }) {
6851
7146
  return mapFieldsToTypes(fields);
6852
7147
  }, [fields]);
6853
7148
  const { onSqlChange } = useSqlChange({ query, onQueryChange, db });
6854
- return /* @__PURE__ */ React__namespace.default.createElement(
7149
+ return /* @__PURE__ */ jsxRuntime.jsx(
6855
7150
  WhereRow,
6856
7151
  {
6857
- key: JSON.stringify(state.value),
6858
7152
  config: { fields: state.value || {} },
6859
7153
  sql: query.sql,
6860
7154
  onSqlChange: (val) => {
6861
7155
  onSqlChange(val);
6862
7156
  }
6863
- }
7157
+ },
7158
+ JSON.stringify(state.value)
6864
7159
  );
6865
7160
  }
6866
7161
  function mapFieldsToTypes(columns) {
@@ -6877,7 +7172,7 @@ function mapFieldsToTypes(columns) {
6877
7172
 
6878
7173
  const EditorRow = ({ children }) => {
6879
7174
  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));
7175
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.root, children: /* @__PURE__ */ jsxRuntime.jsx(EditorStack, { gap: 2, children }) });
6881
7176
  };
6882
7177
  const getStyles$e = (theme) => {
6883
7178
  return {
@@ -6895,8 +7190,15 @@ const EditorField = (props) => {
6895
7190
  const theme = ui.useTheme2();
6896
7191
  const styles = getStyles$d(theme, width);
6897
7192
  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));
7193
+ const labelEl = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7194
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { className: styles.label, htmlFor: childInputId, children: [
7195
+ label,
7196
+ optional && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.optional, children: " - optional" }),
7197
+ tooltip && /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { placement: "top", content: tooltip, theme: "info", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Icon, { name: "info-circle", size: "sm", className: styles.icon }) })
7198
+ ] }),
7199
+ /* @__PURE__ */ jsxRuntime.jsx(Space, { v: 0.5 })
7200
+ ] });
7201
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.root, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Field, { className: styles.field, label: labelEl, ...fieldProps, children }) });
6900
7202
  };
6901
7203
  const getStyles$d = ui.stylesFactory((theme, width) => {
6902
7204
  return {
@@ -6926,7 +7228,7 @@ const getStyles$d = ui.stylesFactory((theme, width) => {
6926
7228
  });
6927
7229
 
6928
7230
  const EditorRows = ({ children }) => {
6929
- return /* @__PURE__ */ React__namespace.default.createElement(EditorStack, { gap: 0.5, direction: "column" }, children);
7231
+ return /* @__PURE__ */ jsxRuntime.jsx(EditorStack, { gap: 0.5, direction: "column", children });
6930
7232
  };
6931
7233
 
6932
7234
  const VisualEditor = ({ query, db, queryRowFilter, onChange, onValidate, range }) => {
@@ -6934,7 +7236,16 @@ const VisualEditor = ({ query, db, queryRowFilter, onChange, onValidate, range }
6934
7236
  const fields = await db.fields(query);
6935
7237
  return fields;
6936
7238
  }, [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 }));
7239
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7240
+ /* @__PURE__ */ jsxRuntime.jsxs(EditorRows, { children: [
7241
+ /* @__PURE__ */ jsxRuntime.jsx(EditorRow, { children: /* @__PURE__ */ jsxRuntime.jsx(SQLSelectRow, { fields: state.value || [], query, onQueryChange: onChange, db }) }),
7242
+ queryRowFilter.filter && /* @__PURE__ */ jsxRuntime.jsx(EditorRow, { children: /* @__PURE__ */ jsxRuntime.jsx(EditorField, { label: "Filter by column value", optional: true, children: /* @__PURE__ */ jsxRuntime.jsx(SQLWhereRow, { fields: state.value || [], query, onQueryChange: onChange, db }) }) }),
7243
+ queryRowFilter.group && /* @__PURE__ */ jsxRuntime.jsx(EditorRow, { children: /* @__PURE__ */ jsxRuntime.jsx(EditorField, { label: "Group by column", children: /* @__PURE__ */ jsxRuntime.jsx(SQLGroupByRow, { fields: state.value || [], query, onQueryChange: onChange, db }) }) }),
7244
+ queryRowFilter.order && /* @__PURE__ */ jsxRuntime.jsx(EditorRow, { children: /* @__PURE__ */ jsxRuntime.jsx(SQLOrderByRow, { fields: state.value || [], query, onQueryChange: onChange, db }) }),
7245
+ queryRowFilter.preview && query.rawSql && /* @__PURE__ */ jsxRuntime.jsx(EditorRow, { children: /* @__PURE__ */ jsxRuntime.jsx(Preview, { rawSql: query.rawSql }) })
7246
+ ] }),
7247
+ /* @__PURE__ */ jsxRuntime.jsx(QueryToolbox, { db, query, onValidate, range })
7248
+ ] });
6938
7249
  };
6939
7250
 
6940
7251
  const MACRO_NAMES = [
@@ -7169,42 +7480,48 @@ function SqlQueryEditor({ datasource, query, onChange, onRunQuery, range }) {
7169
7480
  if (loading || error) {
7170
7481
  return null;
7171
7482
  }
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
- ));
7483
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7484
+ /* @__PURE__ */ jsxRuntime.jsx(
7485
+ QueryHeader,
7486
+ {
7487
+ db,
7488
+ defaultDataset: defaultDataset || "",
7489
+ enableDatasets: !db.disableDatasets,
7490
+ enableCatalogs: db.disableCatalogs === false,
7491
+ onChange: onQueryHeaderChange,
7492
+ onRunQuery,
7493
+ onQueryRowChange: setQueryRowFilter,
7494
+ queryRowFilter,
7495
+ query: queryWithDefaults,
7496
+ isQueryRunnable,
7497
+ labels: (_g = datasource.getDB(datasource.id)) == null ? undefined : _g.labels
7498
+ }
7499
+ ),
7500
+ /* @__PURE__ */ jsxRuntime.jsx(Space, { v: 0.5 }),
7501
+ queryWithDefaults.editorMode !== EditorMode.Code && /* @__PURE__ */ jsxRuntime.jsx(
7502
+ VisualEditor,
7503
+ {
7504
+ db,
7505
+ query: queryWithDefaults,
7506
+ onChange: (q) => onQueryChange(q, false),
7507
+ queryRowFilter,
7508
+ onValidate: setIsQueryRunnable,
7509
+ range
7510
+ }
7511
+ ),
7512
+ queryWithDefaults.editorMode === EditorMode.Code && /* @__PURE__ */ jsxRuntime.jsx(
7513
+ RawEditor,
7514
+ {
7515
+ db,
7516
+ query: queryWithDefaults,
7517
+ queryToValidate,
7518
+ onChange: onQueryChange,
7519
+ onRunQuery,
7520
+ onValidate: setIsQueryRunnable,
7521
+ range
7522
+ }
7523
+ )
7524
+ ] });
7208
7525
  }
7209
7526
  const isQueryValid = (q) => {
7210
7527
  return Boolean(q.rawSql);
@@ -7221,31 +7538,35 @@ const SecureSocksProxyToggle = ({ labelWidth = 10, ...props }) => {
7221
7538
  }
7222
7539
  });
7223
7540
  };
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(
7541
+ return runtime.config.secureSocksDSProxyEnabled && /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "gf-form", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "gf-form gf-form-inline", children: /* @__PURE__ */ jsxRuntime.jsx(
7225
7542
  ui.InlineField,
7226
7543
  {
7227
7544
  htmlFor: "secureSocksProxyEnabled",
7228
7545
  label: "Secure Socks Proxy Enabled",
7229
7546
  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",
7547
+ tooltip: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7548
+ "Proxy the datasource connection through the secure socks proxy to a different network. To learn more about configuring the datasource connection proxy,",
7549
+ " ",
7550
+ /* @__PURE__ */ jsxRuntime.jsx(
7551
+ "a",
7552
+ {
7553
+ href: "https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/proxy/",
7554
+ target: "_blank",
7555
+ rel: "noopener noreferrer",
7556
+ children: "click here."
7557
+ }
7558
+ )
7559
+ ] }),
7560
+ children: /* @__PURE__ */ jsxRuntime.jsx(
7561
+ ui.InlineSwitch,
7232
7562
  {
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
- ))));
7563
+ id: "secureSocksProxyEnabled",
7564
+ value: dataSourceConfig.jsonData.enableSecureSocksProxy,
7565
+ onChange: handleSwitchChange
7566
+ }
7567
+ )
7568
+ }
7569
+ ) }) }) });
7249
7570
  };
7250
7571
 
7251
7572
  const DataSourceDescription = ({ dataSourceName, docsLink, hasRequiredFields = true, className }) => {
@@ -7271,7 +7592,17 @@ const DataSourceDescription = ({ dataSourceName, docsLink, hasRequiredFields = t
7271
7592
  })
7272
7593
  })
7273
7594
  };
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")));
7595
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: css.cx(styles.container, className), children: [
7596
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: styles.text, children: [
7597
+ "Before you can use the ",
7598
+ dataSourceName,
7599
+ " data source, you must configure it below or in the config file. For detailed instructions,",
7600
+ " ",
7601
+ /* @__PURE__ */ jsxRuntime.jsx("a", { href: docsLink, target: "_blank", rel: "noreferrer", children: "view the documentation" }),
7602
+ "."
7603
+ ] }),
7604
+ hasRequiredFields && /* @__PURE__ */ jsxRuntime.jsx("p", { className: styles.text, children: /* @__PURE__ */ jsxRuntime.jsx("i", { children: "Fields marked with * are required" }) })
7605
+ ] });
7275
7606
  };
7276
7607
 
7277
7608
  const GenericConfigSection = ({
@@ -7311,40 +7642,50 @@ const GenericConfigSection = ({
7311
7642
  marginTop: spacing(2)
7312
7643
  })
7313
7644
  };
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));
7645
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, children: [
7646
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.header, children: [
7647
+ kind === "section" ? /* @__PURE__ */ jsxRuntime.jsx("h3", { className: styles.title, children: title }) : /* @__PURE__ */ jsxRuntime.jsx("h6", { className: styles.subtitle, children: title }),
7648
+ isCollapsible && /* @__PURE__ */ jsxRuntime.jsx(
7649
+ ui.IconButton,
7650
+ {
7651
+ name: iconName,
7652
+ onClick: () => setIsOpen(!isOpen),
7653
+ type: "button",
7654
+ size: "xl",
7655
+ "aria-label": collapsibleButtonAriaLabel
7656
+ }
7657
+ )
7658
+ ] }),
7659
+ description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: styles.descriptionText, children: description }),
7660
+ isOpen && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.content, children })
7661
+ ] });
7324
7662
  };
7325
7663
 
7326
7664
  const ConfigSection = ({ children, ...props }) => {
7327
- return /* @__PURE__ */ React__namespace.default.createElement(GenericConfigSection, { ...props, kind: "section" }, children);
7665
+ return /* @__PURE__ */ jsxRuntime.jsx(GenericConfigSection, { ...props, kind: "section", children });
7328
7666
  };
7329
7667
 
7330
7668
  const ConfigSubSection = ({ children, ...props }) => {
7331
- return /* @__PURE__ */ React__namespace.default.createElement(GenericConfigSection, { ...props, kind: "sub-section" }, children);
7669
+ return /* @__PURE__ */ jsxRuntime.jsx(GenericConfigSection, { ...props, kind: "sub-section", children });
7332
7670
  };
7333
7671
 
7334
7672
  function ConfigDescriptionLink(props) {
7335
7673
  const { description, suffix, feature } = props;
7336
7674
  const text = `Learn more about ${feature}`;
7337
7675
  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
- ));
7676
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles.container, children: [
7677
+ description,
7678
+ /* @__PURE__ */ jsxRuntime.jsx(
7679
+ "a",
7680
+ {
7681
+ "aria-label": text,
7682
+ href: `https://grafana.com/docs/grafana/next/datasources/${suffix}`,
7683
+ rel: "noreferrer",
7684
+ target: "_blank",
7685
+ children: text
7686
+ }
7687
+ )
7688
+ ] });
7348
7689
  }
7349
7690
  const getStyles$c = (theme) => {
7350
7691
  return {
@@ -7404,59 +7745,62 @@ const BasicAuth = ({
7404
7745
  marginBottom: 0
7405
7746
  })
7406
7747
  };
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,
7748
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7749
+ /* @__PURE__ */ jsxRuntime.jsx(
7750
+ ui.InlineField,
7422
7751
  {
7423
- id: "basic-auth-user-input",
7424
- placeholder: userPlaceholder,
7425
- value: user,
7426
- onChange: (e) => onUserChange(e.currentTarget.value),
7427
- required: true
7752
+ className: commonStyles.inlineFieldNoMarginRight,
7753
+ label: userLabel,
7754
+ labelWidth: 24,
7755
+ tooltip: userTooltip,
7756
+ required: true,
7757
+ htmlFor: "basic-auth-user-input",
7758
+ interactive: true,
7759
+ grow: true,
7760
+ disabled: readOnly,
7761
+ children: /* @__PURE__ */ jsxRuntime.jsx(
7762
+ ui.Input,
7763
+ {
7764
+ id: "basic-auth-user-input",
7765
+ placeholder: userPlaceholder,
7766
+ value: user,
7767
+ onChange: (e) => onUserChange(e.currentTarget.value),
7768
+ required: true
7769
+ }
7770
+ )
7428
7771
  }
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
7772
+ ),
7773
+ /* @__PURE__ */ jsxRuntime.jsx(
7774
+ ui.InlineField,
7775
+ {
7776
+ className: css.cx(
7777
+ commonStyles.inlineFieldNoMarginRight,
7778
+ commonStyles.inlineFieldWithSecret,
7779
+ styles.lastInlineField
7780
+ ),
7781
+ label: passwordLabel,
7782
+ labelWidth: 24,
7783
+ tooltip: passwordTooltip,
7784
+ required: true,
7785
+ htmlFor: "basic-auth-password-input",
7786
+ interactive: true,
7787
+ grow: true,
7788
+ disabled: readOnly,
7789
+ children: /* @__PURE__ */ jsxRuntime.jsx(
7790
+ ui.SecretInput,
7791
+ {
7792
+ id: "basic-auth-password-input",
7793
+ isConfigured: passwordConfigured,
7794
+ onReset: readOnly ? () => {
7795
+ } : onPasswordReset,
7796
+ placeholder: passwordPlaceholder,
7797
+ onChange: (e) => onPasswordChange(e.currentTarget.value),
7798
+ required: true
7799
+ }
7800
+ )
7457
7801
  }
7458
7802
  )
7459
- ));
7803
+ ] });
7460
7804
  };
7461
7805
 
7462
7806
  const defaultOptions = {
@@ -7548,7 +7892,7 @@ const AuthMethodSettings = ({
7548
7892
  }
7549
7893
  let AuthFieldsComponent = null;
7550
7894
  if (selected === AuthMethod.BasicAuth && basicAuth) {
7551
- AuthFieldsComponent = /* @__PURE__ */ React__namespace.default.createElement(BasicAuth, { ...basicAuth, readOnly });
7895
+ AuthFieldsComponent = /* @__PURE__ */ jsxRuntime.jsx(BasicAuth, { ...basicAuth, readOnly });
7552
7896
  } else if (selected.startsWith("custom-")) {
7553
7897
  AuthFieldsComponent = (_b = (_a = customMethods == null ? undefined : customMethods.find((m) => m.id === selected)) == null ? undefined : _a.component) != null ? _b : null;
7554
7898
  }
@@ -7566,19 +7910,22 @@ const AuthMethodSettings = ({
7566
7910
  marginTop: spacing(1.5)
7567
7911
  })
7568
7912
  };
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)));
7913
+ return /* @__PURE__ */ jsxRuntime.jsx(ConfigSubSection, { title, description, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.authMethods, children: [
7914
+ hasSelect && /* @__PURE__ */ jsxRuntime.jsx(ui.Field, { label: "Authentication method", children: /* @__PURE__ */ jsxRuntime.jsx(
7915
+ ui.Select,
7916
+ {
7917
+ inputId: "auth-method-select",
7918
+ options: preparedOptions,
7919
+ value: selected,
7920
+ onChange: (option) => {
7921
+ setAuthMethodChanged(true);
7922
+ onAuthMethodSelect(option.value);
7923
+ },
7924
+ disabled: readOnly
7925
+ }
7926
+ ) }),
7927
+ AuthFieldsComponent && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.selectedMethodFields, children: AuthFieldsComponent })
7928
+ ] }) });
7582
7929
  };
7583
7930
 
7584
7931
  const TLSSettingsSection = ({
@@ -7607,7 +7954,13 @@ const TLSSettingsSection = ({
7607
7954
  margin: spacing(1, 0, 2, 3)
7608
7955
  })
7609
7956
  };
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));
7957
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.container, children: [
7958
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.checkboxContainer, children: [
7959
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Checkbox, { value: enabled, label, onChange: () => onToggle(!enabled), disabled: readOnly }),
7960
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { placement: "top", content: tooltipText, interactive: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Icon, { name: "info-circle", className: styles.infoIcon, size: "sm" }) })
7961
+ ] }),
7962
+ enabled && children && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.content, children })
7963
+ ] });
7611
7964
  };
7612
7965
 
7613
7966
  const SelfSignedCertificate = ({
@@ -7621,42 +7974,42 @@ const SelfSignedCertificate = ({
7621
7974
  }) => {
7622
7975
  var _a;
7623
7976
  const commonStyles = useCommonStyles();
7624
- return /* @__PURE__ */ React__namespace.default.createElement(
7977
+ return /* @__PURE__ */ jsxRuntime.jsx(
7625
7978
  TLSSettingsSection,
7626
7979
  {
7627
7980
  enabled,
7628
7981
  label: "Add self-signed certificate",
7629
7982
  tooltipText: "Add your own Certificate Authority (CA) certificate on top of one generated by the certificate authorities for additional security measures",
7630
7983
  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,
7984
+ readOnly,
7985
+ children: /* @__PURE__ */ jsxRuntime.jsx(
7986
+ ui.InlineField,
7648
7987
  {
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
7988
+ label: "CA Certificate",
7989
+ labelWidth: 24,
7990
+ tooltip: (_a = tooltips == null ? undefined : tooltips.certificateLabel) != null ? _a : "Your self-signed certificate",
7991
+ required: true,
7992
+ htmlFor: "self-signed-certificate-input",
7993
+ interactive: true,
7994
+ grow: true,
7995
+ className: css.cx(commonStyles.inlineFieldNoMarginRight, commonStyles.inlineFieldWithSecret),
7996
+ disabled: readOnly,
7997
+ children: /* @__PURE__ */ jsxRuntime.jsx(
7998
+ ui.SecretTextArea,
7999
+ {
8000
+ id: "self-signed-certificate-input",
8001
+ isConfigured: certificateConfigured,
8002
+ onChange: (e) => onCertificateChange(e.currentTarget.value),
8003
+ onReset: readOnly ? () => {
8004
+ } : onCertificateReset,
8005
+ placeholder: "Begins with --- BEGIN CERTIFICATE ---",
8006
+ rows: 6,
8007
+ required: true
8008
+ }
8009
+ )
7657
8010
  }
7658
8011
  )
7659
- )
8012
+ }
7660
8013
  );
7661
8014
  };
7662
8015
 
@@ -7676,98 +8029,100 @@ const TLSClientAuth = ({
7676
8029
  }) => {
7677
8030
  var _a, _b, _c;
7678
8031
  const commonStyles = useCommonStyles();
7679
- return /* @__PURE__ */ React__namespace.default.createElement(
8032
+ return /* @__PURE__ */ jsxRuntime.jsxs(
7680
8033
  TLSSettingsSection,
7681
8034
  {
7682
8035
  enabled,
7683
8036
  label: "TLS Client Authentication",
7684
8037
  tooltipText: "Validate using TLS client authentication, in which the server authenticates the client",
7685
8038
  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
- )
8039
+ readOnly,
8040
+ children: [
8041
+ /* @__PURE__ */ jsxRuntime.jsx(
8042
+ ui.InlineField,
8043
+ {
8044
+ label: "ServerName",
8045
+ labelWidth: 24,
8046
+ tooltip: (_a = tooltips == null ? undefined : tooltips.serverNameLabel) != null ? _a : "A Servername is used to verify the hostname on the returned certificate",
8047
+ required: true,
8048
+ htmlFor: "client-auth-servername-input",
8049
+ interactive: true,
8050
+ grow: true,
8051
+ className: commonStyles.inlineFieldNoMarginRight,
8052
+ disabled: readOnly,
8053
+ children: /* @__PURE__ */ jsxRuntime.jsx(
8054
+ ui.Input,
8055
+ {
8056
+ id: "client-auth-servername-input",
8057
+ placeholder: "domain.example.com",
8058
+ value: serverName,
8059
+ onChange: (e) => onServerNameChange(e.currentTarget.value),
8060
+ required: true
8061
+ }
8062
+ )
8063
+ }
8064
+ ),
8065
+ /* @__PURE__ */ jsxRuntime.jsx(
8066
+ ui.InlineField,
8067
+ {
8068
+ label: "Client Certificate",
8069
+ labelWidth: 24,
8070
+ tooltip: (_b = tooltips == null ? undefined : tooltips.certificateLabel) != null ? _b : "The client certificate can be generated from a Certificate Authority or be self-signed",
8071
+ required: true,
8072
+ htmlFor: "client-auth-client-certificate-input",
8073
+ interactive: true,
8074
+ grow: true,
8075
+ className: css.cx(commonStyles.inlineFieldNoMarginRight, commonStyles.inlineFieldWithSecret),
8076
+ disabled: readOnly,
8077
+ children: /* @__PURE__ */ jsxRuntime.jsx(
8078
+ ui.SecretTextArea,
8079
+ {
8080
+ id: "client-auth-client-certificate-input",
8081
+ isConfigured: clientCertificateConfigured,
8082
+ onChange: (e) => onClientCertificateChange(e.currentTarget.value),
8083
+ onReset: readOnly ? () => {
8084
+ } : onClientCertificateReset,
8085
+ placeholder: "Begins with --- BEGIN CERTIFICATE ---",
8086
+ rows: 6,
8087
+ required: true
8088
+ }
8089
+ )
8090
+ }
8091
+ ),
8092
+ /* @__PURE__ */ jsxRuntime.jsx(
8093
+ ui.InlineField,
8094
+ {
8095
+ label: "Client Key",
8096
+ labelWidth: 24,
8097
+ tooltip: (_c = tooltips == null ? undefined : tooltips.keyLabel) != null ? _c : "The client key can be generated from a Certificate Authority or be self-signed",
8098
+ required: true,
8099
+ htmlFor: "client-auth-client-key-input",
8100
+ interactive: true,
8101
+ grow: true,
8102
+ className: css.cx(commonStyles.inlineFieldNoMarginRight, commonStyles.inlineFieldWithSecret),
8103
+ disabled: readOnly,
8104
+ children: /* @__PURE__ */ jsxRuntime.jsx(
8105
+ ui.SecretTextArea,
8106
+ {
8107
+ id: "client-auth-client-key-input",
8108
+ isConfigured: clientKeyConfigured,
8109
+ onChange: (e) => onClientKeyChange(e.currentTarget.value),
8110
+ onReset: readOnly ? () => {
8111
+ } : onClientKeyReset,
8112
+ placeholder: `Begins with --- RSA PRIVATE KEY CERTIFICATE ---`,
8113
+ rows: 6,
8114
+ required: true
8115
+ }
8116
+ )
8117
+ }
8118
+ )
8119
+ ]
8120
+ }
7766
8121
  );
7767
8122
  };
7768
8123
 
7769
8124
  const SkipTLSVerification = ({ enabled, onToggle, readOnly }) => {
7770
- return /* @__PURE__ */ React__namespace.default.createElement(
8125
+ return /* @__PURE__ */ jsxRuntime.jsx(
7771
8126
  TLSSettingsSection,
7772
8127
  {
7773
8128
  enabled,
@@ -7786,16 +8141,18 @@ const TLSSettings = ({ selfSignedCertificate, TLSClientAuth: TLSClientAuth$1, sk
7786
8141
  marginTop: spacing(3)
7787
8142
  })
7788
8143
  };
7789
- return /* @__PURE__ */ React__namespace.default.createElement(
8144
+ return /* @__PURE__ */ jsxRuntime.jsxs(
7790
8145
  ConfigSubSection,
7791
8146
  {
7792
8147
  className: styles.container,
7793
8148
  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 })
8149
+ description: "Additional security measures that can be applied on top of authentication",
8150
+ children: [
8151
+ /* @__PURE__ */ jsxRuntime.jsx(SelfSignedCertificate, { ...selfSignedCertificate, readOnly }),
8152
+ /* @__PURE__ */ jsxRuntime.jsx(TLSClientAuth, { ...TLSClientAuth$1, readOnly }),
8153
+ /* @__PURE__ */ jsxRuntime.jsx(SkipTLSVerification, { ...skipTLSVerification, readOnly })
8154
+ ]
8155
+ }
7799
8156
  );
7800
8157
  };
7801
8158
 
@@ -7822,65 +8179,69 @@ const CustomHeader = ({ header, onChange, onBlur, onDelete, readOnly }) => {
7822
8179
  margin: `0 0 3px 10px`
7823
8180
  })
7824
8181
  };
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,
8182
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(ui.InlineFieldRow, { className: styles.container, children: [
8183
+ /* @__PURE__ */ jsxRuntime.jsx(
8184
+ ui.InlineField,
7837
8185
  {
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
8186
+ label: "Header",
8187
+ labelWidth: 9,
8188
+ grow: true,
8189
+ className: styles.headerNameField,
8190
+ htmlFor: `custom-header-${header.id}-name-input`,
8191
+ disabled: readOnly,
8192
+ children: /* @__PURE__ */ jsxRuntime.jsx(
8193
+ ui.Input,
8194
+ {
8195
+ id: `custom-header-${header.id}-name-input`,
8196
+ placeholder: "X-Custom-Header",
8197
+ value: header.name,
8198
+ width: 12,
8199
+ onChange: (e) => onChange({ ...header, name: e.currentTarget.value }),
8200
+ onBlur,
8201
+ className: styles.input
8202
+ }
8203
+ )
7845
8204
  }
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,
8205
+ ),
8206
+ /* @__PURE__ */ jsxRuntime.jsx(
8207
+ ui.InlineField,
7859
8208
  {
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
8209
+ label: "Value",
8210
+ labelWidth: 9,
8211
+ grow: true,
8212
+ className: css.cx(commonStyles.inlineFieldWithSecret, styles.headerValueField),
8213
+ htmlFor: `custom-header-${header.id}-value-input`,
8214
+ disabled: readOnly,
8215
+ children: /* @__PURE__ */ jsxRuntime.jsx(
8216
+ ui.SecretInput,
8217
+ {
8218
+ id: `custom-header-${header.id}-value-input`,
8219
+ isConfigured: header.configured,
8220
+ placeholder: "Header value",
8221
+ value: header.value,
8222
+ width: 12,
8223
+ onChange: (e) => onChange({ ...header, value: e.currentTarget.value }),
8224
+ onReset: readOnly ? () => {
8225
+ } : () => onChange({ ...header, configured: false, value: "" }),
8226
+ onBlur,
8227
+ className: styles.input
8228
+ }
8229
+ )
8230
+ }
8231
+ ),
8232
+ /* @__PURE__ */ jsxRuntime.jsx(
8233
+ ui.IconButton,
8234
+ {
8235
+ name: "trash-alt",
8236
+ tooltip: "Remove header",
8237
+ tooltipPlacement: "top",
8238
+ className: styles.removeHeaderBtn,
8239
+ onClick: onDelete,
8240
+ type: "button",
8241
+ disabled: readOnly
7870
8242
  }
7871
8243
  )
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
- )));
8244
+ ] }) });
7884
8245
  };
7885
8246
 
7886
8247
  const CustomHeaders = ({ headers: headersFromProps, onChange, readOnly }) => {
@@ -7949,27 +8310,29 @@ const CustomHeaders = ({ headers: headersFromProps, onChange, readOnly }) => {
7949
8310
  marginTop: spacing(1.5)
7950
8311
  })
7951
8312
  };
7952
- return /* @__PURE__ */ React__namespace.default.createElement("div", { className: styles.container }, /* @__PURE__ */ React__namespace.default.createElement(
8313
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.container, children: /* @__PURE__ */ jsxRuntime.jsxs(
7953
8314
  ConfigSubSection,
7954
8315
  {
7955
8316
  title: "HTTP headers",
7956
8317
  description: "Pass along additional context and metadata about the request/response",
7957
8318
  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
- ));
8319
+ isInitiallyOpen: headers.length > 0,
8320
+ children: [
8321
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: headers.map((header) => /* @__PURE__ */ jsxRuntime.jsx(
8322
+ CustomHeader,
8323
+ {
8324
+ header,
8325
+ onChange: (header2) => onHeaderChange(header2.id, header2),
8326
+ onDelete: () => onHeaderDelete(header.id),
8327
+ onBlur,
8328
+ readOnly
8329
+ },
8330
+ header.id
8331
+ )) }),
8332
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.addHeaderButton, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { icon: "plus", variant: "secondary", fill: "outline", onClick: onHeaderAdd, disabled: readOnly, children: headers.length === 0 ? "Add header" : "Add another header" }) })
8333
+ ]
8334
+ }
8335
+ ) });
7973
8336
  };
7974
8337
  function uniqueId() {
7975
8338
  return Math.random().toString(16).slice(2);
@@ -7992,19 +8355,23 @@ const Auth = ({
7992
8355
  maxWidth: 578
7993
8356
  })
7994
8357
  };
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 })));
8358
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.container, children: /* @__PURE__ */ jsxRuntime.jsxs(ConfigSection, { title: "Authentication", children: [
8359
+ /* @__PURE__ */ jsxRuntime.jsx(
8360
+ AuthMethodSettings,
8361
+ {
8362
+ selectedMethod,
8363
+ mostCommonMethod,
8364
+ customMethods,
8365
+ visibleMethods,
8366
+ defaultOptionsOverrides,
8367
+ onAuthMethodSelect,
8368
+ basicAuth,
8369
+ readOnly
8370
+ }
8371
+ ),
8372
+ TLS && /* @__PURE__ */ jsxRuntime.jsx(TLSSettings, { ...TLS, readOnly }),
8373
+ customHeaders && /* @__PURE__ */ jsxRuntime.jsx(CustomHeaders, { ...customHeaders, readOnly })
8374
+ ] }) });
8008
8375
  };
8009
8376
 
8010
8377
  const headerNamePrefix = "httpHeaderName";
@@ -8213,34 +8580,38 @@ const ConnectionSettings = ({
8213
8580
  maxWidth: 578
8214
8581
  })
8215
8582
  };
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(
8583
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(ConfigSection, { title: "Connection", description, className: css.cx(styles.container, className), children: /* @__PURE__ */ jsxRuntime.jsx(
8217
8584
  ui.InlineField,
8218
8585
  {
8219
8586
  htmlFor: "connection-url",
8220
8587
  label: urlLabel || "URL",
8221
8588
  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)"),
8589
+ tooltip: urlTooltip || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8590
+ "Specify a complete HTTP URL",
8591
+ /* @__PURE__ */ jsxRuntime.jsx("br", {}),
8592
+ "(for example https://example.com:8080)"
8593
+ ] }),
8223
8594
  grow: true,
8224
8595
  disabled: config.readOnly,
8225
8596
  required: true,
8226
8597
  invalid: !isValidUrl && !config.readOnly,
8227
8598
  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
- )));
8599
+ interactive: true,
8600
+ children: /* @__PURE__ */ jsxRuntime.jsx(
8601
+ ui.Input,
8602
+ {
8603
+ id: "connection-url",
8604
+ "aria-label": "Data source connection URL",
8605
+ onChange: (event) => onChange({
8606
+ ...config,
8607
+ url: event.currentTarget.value
8608
+ }),
8609
+ value: config.url || "",
8610
+ placeholder: urlPlaceholder || "URL"
8611
+ }
8612
+ )
8613
+ }
8614
+ ) }) });
8244
8615
  };
8245
8616
 
8246
8617
  const AdvancedHttpSettings = ({
@@ -8271,48 +8642,51 @@ const AdvancedHttpSettings = ({
8271
8642
  maxWidth: 578
8272
8643
  })
8273
8644
  };
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,
8645
+ return /* @__PURE__ */ jsxRuntime.jsxs(ConfigSubSection, { title: "Advanced HTTP settings", className: css.cx(styles.container, className), children: [
8646
+ /* @__PURE__ */ jsxRuntime.jsx(
8647
+ ui.InlineField,
8286
8648
  {
8287
- id: "advanced-http-cookies",
8288
- placeholder: "New cookie (hit enter to add)",
8289
- tags: config.jsonData.keepCookies,
8290
- onChange: onCookiesChange
8649
+ htmlFor: "advanced-http-cookies",
8650
+ label: "Allowed cookies",
8651
+ labelWidth: 24,
8652
+ tooltip: "Grafana proxy deletes forwarded cookies by default. Specify cookies by name that should be forwarded to the data source.",
8653
+ disabled: config.readOnly,
8654
+ grow: true,
8655
+ children: /* @__PURE__ */ jsxRuntime.jsx(
8656
+ ui.TagsInput,
8657
+ {
8658
+ id: "advanced-http-cookies",
8659
+ placeholder: "New cookie (hit enter to add)",
8660
+ tags: config.jsonData.keepCookies,
8661
+ onChange: onCookiesChange
8662
+ }
8663
+ )
8291
8664
  }
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,
8665
+ ),
8666
+ /* @__PURE__ */ jsxRuntime.jsx(
8667
+ ui.InlineField,
8305
8668
  {
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
8669
+ htmlFor: "advanced-http-timeout",
8670
+ label: "Timeout",
8671
+ labelWidth: 24,
8672
+ tooltip: "HTTP request timeout in seconds",
8673
+ disabled: config.readOnly,
8674
+ grow: true,
8675
+ children: /* @__PURE__ */ jsxRuntime.jsx(
8676
+ ui.Input,
8677
+ {
8678
+ id: "advanced-http-timeout",
8679
+ type: "number",
8680
+ min: 0,
8681
+ placeholder: "Timeout in seconds",
8682
+ "aria-label": "Timeout in seconds",
8683
+ value: config.jsonData.timeout,
8684
+ onChange: onTimeoutChange
8685
+ }
8686
+ )
8313
8687
  }
8314
8688
  )
8315
- ));
8689
+ ] });
8316
8690
  };
8317
8691
 
8318
8692
  var __defProp$2 = Object.defineProperty;
@@ -8338,43 +8712,47 @@ const getCustomHeaderRowStyles = ui.stylesFactory(() => {
8338
8712
  });
8339
8713
  const CustomHeaderRow = ({ header, onBlur, onChange, onRemove, onReset }) => {
8340
8714
  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
- ));
8715
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.layout, children: [
8716
+ /* @__PURE__ */ jsxRuntime.jsx(
8717
+ ui.LegacyForms.FormField,
8718
+ {
8719
+ label: "Header",
8720
+ name: "name",
8721
+ placeholder: "X-Custom-Header",
8722
+ labelWidth: 5,
8723
+ value: header.name || "",
8724
+ onChange: (e) => onChange({ ...header, name: e.target.value }),
8725
+ onBlur
8726
+ }
8727
+ ),
8728
+ /* @__PURE__ */ jsxRuntime.jsx(
8729
+ ui.LegacyForms.SecretFormField,
8730
+ {
8731
+ label: "Value",
8732
+ "aria-label": "Value",
8733
+ name: "value",
8734
+ isConfigured: header.configured,
8735
+ value: header.value,
8736
+ labelWidth: 5,
8737
+ inputWidth: header.configured ? 11 : 12,
8738
+ placeholder: "Header Value",
8739
+ onReset: () => onReset(header.id),
8740
+ onChange: (e) => onChange({ ...header, value: e.target.value }),
8741
+ onBlur
8742
+ }
8743
+ ),
8744
+ /* @__PURE__ */ jsxRuntime.jsx(
8745
+ ui.Button,
8746
+ {
8747
+ type: "button",
8748
+ "aria-label": "Remove header",
8749
+ variant: "secondary",
8750
+ size: "xs",
8751
+ onClick: (_e) => onRemove(header.id),
8752
+ children: /* @__PURE__ */ jsxRuntime.jsx(ui.Icon, { name: "trash-alt" })
8753
+ }
8754
+ )
8755
+ ] });
8378
8756
  };
8379
8757
  CustomHeaderRow.displayName = "CustomHeaderRow";
8380
8758
  class CustomHeadersSettings extends React.PureComponent {
@@ -8462,30 +8840,34 @@ class CustomHeadersSettings extends React.PureComponent {
8462
8840
  }
8463
8841
  render() {
8464
8842
  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);
8843
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "gf-form-group", children: [
8844
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "gf-form", children: /* @__PURE__ */ jsxRuntime.jsx("h6", { children: "Custom HTTP Headers" }) }),
8845
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: headers.map((header, i) => /* @__PURE__ */ jsxRuntime.jsx(
8846
+ CustomHeaderRow,
8847
+ {
8848
+ header,
8849
+ onChange: (h) => {
8850
+ this.onHeaderChange(i, h);
8851
+ },
8852
+ onBlur: this.updateSettings,
8853
+ onRemove: this.onHeaderRemove,
8854
+ onReset: this.onHeaderReset
8472
8855
  },
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();
8856
+ header.id
8857
+ )) }),
8858
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "gf-form", children: /* @__PURE__ */ jsxRuntime.jsx(
8859
+ ui.Button,
8860
+ {
8861
+ variant: "secondary",
8862
+ icon: "plus",
8863
+ type: "button",
8864
+ onClick: (e) => {
8865
+ this.onHeaderAdd();
8866
+ },
8867
+ children: "Add header"
8485
8868
  }
8486
- },
8487
- "Add header"
8488
- )));
8869
+ ) })
8870
+ ] });
8489
8871
  }
8490
8872
  }
8491
8873
 
@@ -8567,105 +8949,110 @@ function LabelFilterItem({
8567
8949
  };
8568
8950
  const isConflicting = isConflictingLabelFilter(item, items);
8569
8951
  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
8952
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-testid": "visual-query-builder-dimensions-filter-item", children: /* @__PURE__ */ jsxRuntime.jsx(ui.InlineField, { error: CONFLICTING_LABEL_FILTER_ERROR_MESSAGE, invalid: isConflicting ? true : undefined, children: /* @__PURE__ */ jsxRuntime.jsxs(InputGroup, { children: [
8953
+ /* @__PURE__ */ jsxRuntime.jsx(
8954
+ ui.Select,
8955
+ {
8956
+ placeholder: "Select label",
8957
+ "data-testid": e2eSelectors.selectors.components.QueryBuilder.labelSelect,
8958
+ inputId: `visual-query-builder-dimensions-filter-item-key-${id}`,
8959
+ width: "auto",
8960
+ value: item.label ? data.toOption(item.label) : null,
8961
+ allowCustomValue: true,
8962
+ onOpenMenu: async () => {
8963
+ setState({ isLoadingLabelNames: true });
8964
+ const labelNames = await onGetLabelNames(item);
8965
+ setLabelNamesMenuOpen(true);
8966
+ setState({ labelNames, isLoadingLabelNames: undefined });
8967
+ },
8968
+ onCloseMenu: () => {
8969
+ setLabelNamesMenuOpen(false);
8970
+ },
8971
+ isOpen: labelNamesMenuOpen,
8972
+ isLoading: state.isLoadingLabelNames,
8973
+ options: state.labelNames,
8974
+ onChange: (change) => {
8975
+ var _a2;
8976
+ if (change.value) {
8977
+ onChange({
8978
+ ...item,
8979
+ op: (_a2 = item.op) != null ? _a2 : defaultOp,
8980
+ label: change.value
8981
+ });
8982
+ }
8983
+ },
8984
+ invalid: isConflicting || invalidLabel
8985
+ }
8986
+ ),
8987
+ /* @__PURE__ */ jsxRuntime.jsx(
8988
+ ui.Select,
8989
+ {
8990
+ "data-testid": e2eSelectors.selectors.components.QueryBuilder.matchOperatorSelect,
8991
+ value: data.toOption((_a = item.op) != null ? _a : defaultOp),
8992
+ options: operators,
8993
+ width: "auto",
8994
+ onChange: (change) => {
8995
+ if (change.value) {
8996
+ onChange({
8997
+ ...item,
8998
+ op: change.value,
8999
+ value: isMultiSelect(change.value) ? item.value : getSelectOptionsFromString(item == null ? undefined : item.value)[0]
9000
+ });
9001
+ }
9002
+ },
9003
+ invalid: isConflicting
9004
+ }
9005
+ ),
9006
+ /* @__PURE__ */ jsxRuntime.jsx(
9007
+ ui.Select,
9008
+ {
9009
+ placeholder: "Select value",
9010
+ "data-testid": e2eSelectors.selectors.components.QueryBuilder.valueSelect,
9011
+ inputId: `visual-query-builder-dimensions-filter-item-value-${id}`,
9012
+ width: "auto",
9013
+ value: isMultiSelect() ? getSelectOptionsFromString(item == null ? undefined : item.value).map(data.toOption) : getSelectOptionsFromString(item == null ? undefined : item.value).map(data.toOption)[0],
9014
+ allowCustomValue: true,
9015
+ onOpenMenu: async () => {
9016
+ setState({ isLoadingLabelValues: true });
9017
+ const labelValues = await onGetLabelValues(item);
9018
+ setState({
9019
+ ...state,
9020
+ labelValues,
9021
+ isLoadingLabelValues: undefined
8654
9022
  });
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 }))));
9023
+ setLabelValuesMenuOpen(true);
9024
+ },
9025
+ onCloseMenu: () => {
9026
+ setLabelValuesMenuOpen(false);
9027
+ },
9028
+ isOpen: labelValuesMenuOpen,
9029
+ isMulti: isMultiSelect(),
9030
+ isLoading: state.isLoadingLabelValues,
9031
+ options: getOptions(),
9032
+ onChange: (change) => {
9033
+ var _a2, _b;
9034
+ if (change.value) {
9035
+ onChange({
9036
+ ...item,
9037
+ value: change.value,
9038
+ op: (_a2 = item.op) != null ? _a2 : defaultOp
9039
+ });
9040
+ } else {
9041
+ const changes = change.map((change2) => {
9042
+ if (change2.value) {
9043
+ return change2.value;
9044
+ } else {
9045
+ return undefined;
9046
+ }
9047
+ }).filter((val) => val !== undefined).join(multiValueSeparator);
9048
+ onChange({ ...item, value: changes, op: (_b = item.op) != null ? _b : defaultOp });
9049
+ }
9050
+ },
9051
+ invalid: isConflicting || invalidValue
9052
+ }
9053
+ ),
9054
+ /* @__PURE__ */ jsxRuntime.jsx(AccessoryButton, { "aria-label": "remove", icon: "times", variant: "secondary", onClick: onDelete })
9055
+ ] }) }) });
8669
9056
  }
8670
9057
  const operators = [
8671
9058
  { label: "=", value: "=", description: "Equals", isMultiValue: false },
@@ -8725,41 +9112,50 @@ function LabelFilters({
8725
9112
  }
8726
9113
  };
8727
9114
  const hasLabelFilter = items.some((item) => item.label && item.value);
8728
- return /* @__PURE__ */ React__namespace.default.createElement(EditorFieldGroup, null, /* @__PURE__ */ React__namespace.default.createElement(
9115
+ return /* @__PURE__ */ jsxRuntime.jsx(EditorFieldGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(
8729
9116
  EditorField$1,
8730
9117
  {
8731
9118
  label: "Label filters",
8732
9119
  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
- ));
9120
+ invalid: labelFilterRequired && !hasLabelFilter,
9121
+ children: /* @__PURE__ */ jsxRuntime.jsx(
9122
+ EditorList,
9123
+ {
9124
+ items,
9125
+ onChange: onLabelsChange,
9126
+ renderItem: (item, onChangeItem, onDelete) => /* @__PURE__ */ jsxRuntime.jsx(
9127
+ LabelFilterItem,
9128
+ {
9129
+ item,
9130
+ items,
9131
+ defaultOp,
9132
+ onChange: onChangeItem,
9133
+ onDelete,
9134
+ onGetLabelNames,
9135
+ onGetLabelValues,
9136
+ invalidLabel: labelFilterRequired && !item.label,
9137
+ invalidValue: labelFilterRequired && !item.value,
9138
+ multiValueSeparator
9139
+ }
9140
+ )
9141
+ }
9142
+ )
9143
+ }
9144
+ ) });
8758
9145
  }
8759
9146
 
8760
9147
  function OperationExplainedBox({ title, stepNumber, markdown, children }) {
8761
9148
  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)));
9149
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.box, children: [
9150
+ stepNumber !== undefined && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.stepNumber, children: stepNumber }),
9151
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.boxInner, children: [
9152
+ title && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.header, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: title }) }),
9153
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.body, children: [
9154
+ markdown && /* @__PURE__ */ jsxRuntime.jsx("div", { dangerouslySetInnerHTML: { __html: data.renderMarkdown(markdown) } }),
9155
+ children
9156
+ ] })
9157
+ ] })
9158
+ ] });
8763
9159
  }
8764
9160
  const getStyles$b = (theme) => {
8765
9161
  return {
@@ -8805,7 +9201,7 @@ const getStyles$b = (theme) => {
8805
9201
  };
8806
9202
  };
8807
9203
 
8808
- const OperationInfoButton = React__namespace.default.memo(({ definition, operation, innerQueryPlaceholder }) => {
9204
+ const OperationInfoButton = React.memo(({ definition, operation, innerQueryPlaceholder }) => {
8809
9205
  const styles = ui.useStyles2(getStyles$a);
8810
9206
  const [show, setShow] = React.useState(false);
8811
9207
  const { getTooltipProps, setTooltipRef, setTriggerRef, visible } = reactPopperTooltip.usePopperTooltip({
@@ -8816,32 +9212,42 @@ const OperationInfoButton = React__namespace.default.memo(({ definition, operati
8816
9212
  interactive: true,
8817
9213
  trigger: ["click"]
8818
9214
  });
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
- ))));
9215
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9216
+ /* @__PURE__ */ jsxRuntime.jsx(
9217
+ ui.Button,
9218
+ {
9219
+ title: "Click to show description",
9220
+ ref: setTriggerRef,
9221
+ icon: "info-circle",
9222
+ size: "sm",
9223
+ variant: "secondary",
9224
+ fill: "text"
9225
+ }
9226
+ ),
9227
+ visible && /* @__PURE__ */ jsxRuntime.jsx(ui.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: setTooltipRef, ...getTooltipProps(), className: styles.docBox, children: [
9228
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.docBoxHeader, children: [
9229
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: definition.renderer(operation, definition, innerQueryPlaceholder) }),
9230
+ /* @__PURE__ */ jsxRuntime.jsx(FlexItem, { grow: 1 }),
9231
+ /* @__PURE__ */ jsxRuntime.jsx(
9232
+ ui.Button,
9233
+ {
9234
+ icon: "times",
9235
+ onClick: () => setShow(false),
9236
+ fill: "text",
9237
+ variant: "secondary",
9238
+ title: "Remove operation"
9239
+ }
9240
+ )
9241
+ ] }),
9242
+ /* @__PURE__ */ jsxRuntime.jsx(
9243
+ "div",
9244
+ {
9245
+ className: styles.docBoxBody,
9246
+ dangerouslySetInnerHTML: { __html: getOperationDocs(definition, operation) }
9247
+ }
9248
+ )
9249
+ ] }) })
9250
+ ] });
8845
9251
  });
8846
9252
  OperationInfoButton.displayName = "OperationDocs";
8847
9253
  const getStyles$a = (theme) => {
@@ -8883,7 +9289,7 @@ function getOperationDocs(def, op) {
8883
9289
  return data.renderMarkdown(def.explainHandler ? def.explainHandler(op, def) : (_a = def.documentation) != null ? _a : "no docs");
8884
9290
  }
8885
9291
 
8886
- const OperationHeader = React__namespace.default.memo(
9292
+ const OperationHeader = React.memo(
8887
9293
  ({ operation, definition, index, onChange, onRemove, onToggle, queryModeller, dragHandleProps }) => {
8888
9294
  var _a;
8889
9295
  const styles = ui.useStyles2(getStyles$9);
@@ -8896,70 +9302,82 @@ const OperationHeader = React__namespace.default.memo(
8896
9302
  setState({ isOpen: true, alternatives });
8897
9303
  }
8898
9304
  };
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];
9305
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.header, children: [
9306
+ !state.isOpen && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9307
+ /* @__PURE__ */ jsxRuntime.jsx("div", { ...dragHandleProps, children: (_a = definition.name) != null ? _a : definition.id }),
9308
+ /* @__PURE__ */ jsxRuntime.jsx(FlexItem, { grow: 1 }),
9309
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${styles.operationHeaderButtons} operation-header-show-on-hover`, children: [
9310
+ /* @__PURE__ */ jsxRuntime.jsx(
9311
+ ui.Button,
9312
+ {
9313
+ icon: "angle-down",
9314
+ size: "sm",
9315
+ onClick: onToggleSwitcher,
9316
+ fill: "text",
9317
+ variant: "secondary",
9318
+ title: "Click to view alternative operations"
9319
+ }
9320
+ ),
9321
+ /* @__PURE__ */ jsxRuntime.jsx(
9322
+ OperationInfoButton,
9323
+ {
9324
+ definition,
9325
+ operation,
9326
+ innerQueryPlaceholder: queryModeller.innerQueryPlaceholder
9327
+ }
9328
+ ),
9329
+ definition.toggleable && /* @__PURE__ */ jsxRuntime.jsx(
9330
+ ui.Button,
9331
+ {
9332
+ icon: operation.disabled ? "eye-slash" : "eye",
9333
+ size: "sm",
9334
+ onClick: () => onToggle(index),
9335
+ fill: "text",
9336
+ variant: "secondary",
9337
+ title: operation.disabled ? "Enable operation" : "Disable operation"
9338
+ }
9339
+ ),
9340
+ /* @__PURE__ */ jsxRuntime.jsx(
9341
+ ui.Button,
9342
+ {
9343
+ icon: "times",
9344
+ size: "sm",
9345
+ onClick: () => onRemove(index),
9346
+ fill: "text",
9347
+ variant: "secondary",
9348
+ title: "Remove operation"
9349
+ }
9350
+ )
9351
+ ] })
9352
+ ] }),
9353
+ state.isOpen && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.selectWrapper, children: /* @__PURE__ */ jsxRuntime.jsx(
9354
+ ui.Select,
9355
+ {
9356
+ autoFocus: true,
9357
+ openMenuOnFocus: true,
9358
+ placeholder: "Replace with",
9359
+ options: state.alternatives,
9360
+ isOpen: true,
9361
+ onCloseMenu: onToggleSwitcher,
9362
+ onChange: (value) => {
9363
+ if (value.value) {
9364
+ const newDef = queryModeller.getOperationDefinition(value.value.id);
9365
+ const newParams = [...newDef.defaultParams];
9366
+ for (let i = 0; i < Math.min(operation.params.length, newParams.length); i++) {
9367
+ if (newDef.params[i].type === definition.params[i].type) {
9368
+ newParams[i] = operation.params[i];
9369
+ }
8952
9370
  }
9371
+ const changedOp = { ...operation, params: newParams, id: value.value.id };
9372
+ onChange(
9373
+ index,
9374
+ definition.changeTypeHandler ? definition.changeTypeHandler(changedOp, newDef) : changedOp
9375
+ );
8953
9376
  }
8954
- const changedOp = { ...operation, params: newParams, id: value.value.id };
8955
- onChange(
8956
- index,
8957
- definition.changeTypeHandler ? definition.changeTypeHandler(changedOp, newDef) : changedOp
8958
- );
8959
9377
  }
8960
9378
  }
8961
- }
8962
- )));
9379
+ ) })
9380
+ ] });
8963
9381
  }
8964
9382
  );
8965
9383
  OperationHeader.displayName = "OperationHeader";
@@ -8998,7 +9416,7 @@ function getOperationParamEditor(paramDef) {
8998
9416
  }
8999
9417
  function SimpleInputParamEditor(props) {
9000
9418
  var _a;
9001
- return /* @__PURE__ */ React__namespace.default.createElement(
9419
+ return /* @__PURE__ */ jsxRuntime.jsx(
9002
9420
  ui.AutoSizeInput,
9003
9421
  {
9004
9422
  id: getOperationParamId(props.operationId, props.index),
@@ -9017,7 +9435,7 @@ function SimpleInputParamEditor(props) {
9017
9435
  );
9018
9436
  }
9019
9437
  function BoolInputParamEditor(props) {
9020
- return /* @__PURE__ */ React__namespace.default.createElement(
9438
+ return /* @__PURE__ */ jsxRuntime.jsx(
9021
9439
  ui.Checkbox,
9022
9440
  {
9023
9441
  id: getOperationParamId(props.operationId, props.index),
@@ -9044,41 +9462,44 @@ function SelectInputParamEditor({
9044
9462
  }
9045
9463
  let valueOption = (_b = selectOptions.find((x) => x.value === value)) != null ? _b : data.toOption(value);
9046
9464
  if (!value && paramDef.optional) {
9047
- return /* @__PURE__ */ React__namespace.default.createElement("div", { className: styles.optionalParam }, /* @__PURE__ */ React__namespace.default.createElement(
9465
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.optionalParam, children: /* @__PURE__ */ jsxRuntime.jsx(
9048
9466
  ui.Button,
9049
9467
  {
9050
9468
  size: "sm",
9051
9469
  variant: "secondary",
9052
9470
  title: `Add ${paramDef.name}`,
9053
9471
  icon: "plus",
9054
- onClick: () => onChange(index, selectOptions[0].value)
9055
- },
9056
- paramDef.name
9057
- ));
9472
+ onClick: () => onChange(index, selectOptions[0].value),
9473
+ children: paramDef.name
9474
+ }
9475
+ ) });
9058
9476
  }
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
- ));
9477
+ return /* @__PURE__ */ jsxRuntime.jsxs(EditorStack, { gap: 0.5, direction: "row", alignItems: "center", children: [
9478
+ /* @__PURE__ */ jsxRuntime.jsx(
9479
+ ui.Select,
9480
+ {
9481
+ id: getOperationParamId(operationId, index),
9482
+ value: valueOption,
9483
+ options: selectOptions,
9484
+ placeholder: paramDef.placeholder,
9485
+ allowCustomValue: true,
9486
+ onChange: (value2) => onChange(index, value2.value),
9487
+ width: paramDef.minWidth || "auto"
9488
+ }
9489
+ ),
9490
+ paramDef.optional && /* @__PURE__ */ jsxRuntime.jsx(
9491
+ ui.Button,
9492
+ {
9493
+ "data-testid": `operations.${index}.remove-param`,
9494
+ size: "sm",
9495
+ fill: "text",
9496
+ icon: "times",
9497
+ variant: "secondary",
9498
+ title: `Remove ${paramDef.name}`,
9499
+ onClick: () => onChange(index, "")
9500
+ }
9501
+ )
9502
+ ] });
9082
9503
  }
9083
9504
  const getStyles$8 = (theme) => {
9084
9505
  return {
@@ -9135,7 +9556,7 @@ function OperationEditorBody({
9135
9556
  restParam = renderAddRestParamButton(lastParamDef, onAddRestParam, index, operation.params.length, styles);
9136
9557
  }
9137
9558
  }
9138
- return /* @__PURE__ */ React__namespace.default.createElement(
9559
+ return /* @__PURE__ */ jsxRuntime.jsxs(
9139
9560
  "div",
9140
9561
  {
9141
9562
  className: css.cx(styles.card, {
@@ -9145,54 +9566,68 @@ function OperationEditorBody({
9145
9566
  }),
9146
9567
  ref: provided.innerRef,
9147
9568
  ...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 }))
9569
+ "data-testid": `operations.${index}.wrapper`,
9570
+ children: [
9571
+ /* @__PURE__ */ jsxRuntime.jsx(
9572
+ OperationHeader,
9573
+ {
9574
+ operation,
9575
+ dragHandleProps: provided.dragHandleProps,
9576
+ definition,
9577
+ index,
9578
+ onChange,
9579
+ onRemove,
9580
+ onToggle,
9581
+ queryModeller
9582
+ }
9583
+ ),
9584
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.body, children: operation.params.map((param, paramIndex) => {
9585
+ const paramDef = definition.params[Math.min(definition.params.length - 1, paramIndex)];
9586
+ const Editor = getOperationParamEditor(paramDef);
9587
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.paramRow, children: [
9588
+ !paramDef.hideName && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.paramName, children: [
9589
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: getOperationParamId(id, paramIndex), children: paramDef.name }),
9590
+ paramDef.description && /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { placement: "top", content: paramDef.description, theme: "info", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Icon, { name: "info-circle", size: "sm", className: styles.infoIcon }) })
9591
+ ] }),
9592
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.paramValue, children: /* @__PURE__ */ jsxRuntime.jsxs(EditorStack, { gap: 0.5, direction: "row", alignItems: "center", wrap: false, children: [
9593
+ /* @__PURE__ */ jsxRuntime.jsx(
9594
+ Editor,
9595
+ {
9596
+ index: paramIndex,
9597
+ paramDef,
9598
+ value: operation.params[paramIndex],
9599
+ operation,
9600
+ operationId: id,
9601
+ onChange: onParamValueChanged,
9602
+ onRunQuery,
9603
+ query,
9604
+ datasource,
9605
+ timeRange,
9606
+ queryModeller
9607
+ }
9608
+ ),
9609
+ paramDef.restParam && (operation.params.length > definition.params.length || paramDef.optional) && /* @__PURE__ */ jsxRuntime.jsx(
9610
+ ui.Button,
9611
+ {
9612
+ "data-testid": `operations.${index}.remove-rest-param`,
9613
+ size: "sm",
9614
+ fill: "text",
9615
+ icon: "times",
9616
+ variant: "secondary",
9617
+ title: `Remove ${paramDef.name}`,
9618
+ onClick: () => onRemoveRestParam(paramIndex)
9619
+ }
9620
+ )
9621
+ ] }) })
9622
+ ] }, `${paramIndex}-1`);
9623
+ }) }),
9624
+ restParam,
9625
+ index < query.operations.length - 1 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.arrow, children: [
9626
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.arrowLine }),
9627
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.arrowArrow })
9628
+ ] })
9629
+ ]
9630
+ }
9196
9631
  );
9197
9632
  }
9198
9633
  const getStyles$7 = (theme, isConflicting) => {
@@ -9303,7 +9738,7 @@ function callParamChangedThenOnChange(def, operation, operationIndex, paramIndex
9303
9738
  }
9304
9739
  }
9305
9740
  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(
9741
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.restParam, children: /* @__PURE__ */ jsxRuntime.jsx(
9307
9742
  ui.Button,
9308
9743
  {
9309
9744
  size: "sm",
@@ -9311,10 +9746,10 @@ function renderAddRestParamButton(paramDef, onAddRestParam, operationIndex, para
9311
9746
  title: `Add ${paramDef.name}`.trimEnd(),
9312
9747
  variant: "secondary",
9313
9748
  onClick: onAddRestParam,
9314
- "data-testid": `operations.${operationIndex}.add-rest-param`
9315
- },
9316
- paramDef.name
9317
- ));
9749
+ "data-testid": `operations.${operationIndex}.add-rest-param`,
9750
+ children: paramDef.name
9751
+ }
9752
+ ) }, `${paramIndex}-2`);
9318
9753
  }
9319
9754
 
9320
9755
  function OperationEditor({
@@ -9337,7 +9772,11 @@ function OperationEditor({
9337
9772
  const isConflicting = isConflictingOperation ? isConflictingOperation(operation, query.operations) : false;
9338
9773
  const styles = getStyles$6(theme);
9339
9774
  if (!def) {
9340
- return /* @__PURE__ */ React__namespace.default.createElement("span", null, "Operation ", operation.id, " not found");
9775
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
9776
+ "Operation ",
9777
+ operation.id,
9778
+ " not found"
9779
+ ] });
9341
9780
  }
9342
9781
  const isInvalid = (isDragging) => {
9343
9782
  if (isDragging) {
@@ -9345,34 +9784,34 @@ function OperationEditor({
9345
9784
  }
9346
9785
  return isConflicting ? true : undefined;
9347
9786
  };
9348
- return /* @__PURE__ */ React__namespace.default.createElement(dnd.Draggable, { draggableId: `operation-${index}`, index }, (provided, snapshot) => /* @__PURE__ */ React__namespace.default.createElement(
9787
+ return /* @__PURE__ */ jsxRuntime.jsx(dnd.Draggable, { draggableId: `operation-${index}`, index, children: (provided, snapshot) => /* @__PURE__ */ jsxRuntime.jsx(
9349
9788
  ui.InlineField,
9350
9789
  {
9351
9790
  error: "You have conflicting label filters",
9352
9791
  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
- ));
9792
+ className: css.cx(styles.error, styles.cardWrapper),
9793
+ children: /* @__PURE__ */ jsxRuntime.jsx(
9794
+ OperationEditorBody,
9795
+ {
9796
+ provided,
9797
+ flash,
9798
+ highlight,
9799
+ isConflicting,
9800
+ index,
9801
+ operation,
9802
+ definition: def,
9803
+ onChange,
9804
+ onRemove,
9805
+ onToggle,
9806
+ queryModeller,
9807
+ query,
9808
+ timeRange,
9809
+ onRunQuery,
9810
+ datasource
9811
+ }
9812
+ )
9813
+ }
9814
+ ) });
9376
9815
  }
9377
9816
  const getStyles$6 = (theme, isConflicting) => {
9378
9817
  return {
@@ -9443,38 +9882,44 @@ function OperationList({
9443
9882
  const onCascaderBlur = () => {
9444
9883
  setCascaderOpen(false);
9445
9884
  };
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
9885
+ return /* @__PURE__ */ jsxRuntime.jsx(EditorStack, { gap: 1, direction: "column", children: /* @__PURE__ */ jsxRuntime.jsxs(EditorStack, { gap: 1, children: [
9886
+ operations.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(dnd.DragDropContext, { onDragEnd, children: /* @__PURE__ */ jsxRuntime.jsx(dnd.Droppable, { droppableId: "sortable-field-mappings", direction: "horizontal", children: (provided) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.operationList, ref: provided.innerRef, ...provided.droppableProps, children: [
9887
+ operations.map((op, index) => {
9888
+ return /* @__PURE__ */ jsxRuntime.jsx(
9889
+ OperationEditor,
9890
+ {
9891
+ queryModeller,
9892
+ index,
9893
+ operation: op,
9894
+ query,
9895
+ datasource,
9896
+ onChange: onOperationChange,
9897
+ onRemove,
9898
+ onToggle,
9899
+ onRunQuery,
9900
+ flash: opsToHighlight[index],
9901
+ highlight: highlightedOp === op,
9902
+ timeRange,
9903
+ isConflictingOperation
9904
+ },
9905
+ op.id + JSON.stringify(op.params) + index
9906
+ );
9907
+ }),
9908
+ provided.placeholder
9909
+ ] }) }) }),
9910
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.addButton, children: cascaderOpen ? /* @__PURE__ */ jsxRuntime.jsx(
9911
+ ui.Cascader,
9912
+ {
9913
+ options: addOptions,
9914
+ onSelect: onAddOperation,
9915
+ onBlur: onCascaderBlur,
9916
+ autoFocus: true,
9917
+ alwaysOpen: true,
9918
+ hideActiveLevelLabel: true,
9919
+ placeholder: "Search"
9464
9920
  }
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"))));
9921
+ ) : /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { icon: "plus", variant: "secondary", onClick: () => setCascaderOpen(true), title: "Add operation", children: "Operations" }) })
9922
+ ] }) });
9478
9923
  }
9479
9924
  function useOperationsHighlight(operations) {
9480
9925
  const isMounted = reactUse.useMountedState();
@@ -9531,7 +9976,7 @@ function RawQuery({ query, language, className }) {
9531
9976
  const theme = ui.useTheme2();
9532
9977
  const styles = getStyles$4(theme);
9533
9978
  const highlighted = Prism__default.default.highlight(query, language.grammar, language.name);
9534
- return /* @__PURE__ */ React__namespace.default.createElement(
9979
+ return /* @__PURE__ */ jsxRuntime.jsx(
9535
9980
  "div",
9536
9981
  {
9537
9982
  className: css.cx(styles.editorField, "prism-syntax-highlight", className),
@@ -9557,7 +10002,7 @@ function OperationListExplained({
9557
10002
  onMouseEnter,
9558
10003
  onMouseLeave
9559
10004
  }) {
9560
- return /* @__PURE__ */ React__namespace.default.createElement(React__namespace.default.Fragment, null, query.operations.map((op, index) => {
10005
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: query.operations.map((op, index) => {
9561
10006
  var _a;
9562
10007
  const def = queryModeller.getOperationDefinition(op.id);
9563
10008
  if (!def) {
@@ -9565,28 +10010,28 @@ function OperationListExplained({
9565
10010
  }
9566
10011
  const title = def.renderer(op, def, queryModeller.innerQueryPlaceholder);
9567
10012
  const body = def.explainHandler ? def.explainHandler(op, def) : (_a = def.documentation) != null ? _a : "no docs";
9568
- return /* @__PURE__ */ React__namespace.default.createElement(
10013
+ return /* @__PURE__ */ jsxRuntime.jsx(
9569
10014
  "div",
9570
10015
  {
9571
- key: index,
9572
10016
  onMouseEnter: () => onMouseEnter == null ? undefined : onMouseEnter(op, index),
9573
- onMouseLeave: () => onMouseLeave == null ? undefined : onMouseLeave(op, index)
10017
+ onMouseLeave: () => onMouseLeave == null ? undefined : onMouseLeave(op, index),
10018
+ children: /* @__PURE__ */ jsxRuntime.jsx(
10019
+ OperationExplainedBox,
10020
+ {
10021
+ stepNumber: index + stepNumber,
10022
+ title: /* @__PURE__ */ jsxRuntime.jsx(RawQuery, { query: title, language }),
10023
+ markdown: body
10024
+ }
10025
+ )
9574
10026
  },
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
- )
10027
+ index
9583
10028
  );
9584
- }));
10029
+ }) });
9585
10030
  }
9586
10031
 
9587
10032
  function OperationsEditorRow({ children }) {
9588
10033
  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));
10034
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.root, children: /* @__PURE__ */ jsxRuntime.jsx(EditorStack, { gap: 1, children }) });
9590
10035
  }
9591
10036
  const getStyles$3 = (theme) => {
9592
10037
  return {
@@ -9618,9 +10063,9 @@ const QueryBuilderHints = ({
9618
10063
  });
9619
10064
  return hints2 != null ? hints2 : [];
9620
10065
  }, [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) => {
10066
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: hints.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.container, children: hints.map((hint) => {
9622
10067
  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(
10068
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { content: `${hint.label} ${(_a = hint.fix) == null ? undefined : _a.label}`, children: /* @__PURE__ */ jsxRuntime.jsxs(
9624
10069
  ui.Button,
9625
10070
  {
9626
10071
  onClick: () => {
@@ -9642,12 +10087,14 @@ const QueryBuilderHints = ({
9642
10087
  },
9643
10088
  fill: "outline",
9644
10089
  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
- })));
10090
+ className: styles.hint,
10091
+ children: [
10092
+ "hint: ",
10093
+ ((_b = hint.fix) == null ? undefined : _b.title) || ((_d = (_c = hint.fix) == null ? undefined : _c.action) == null ? undefined : _d.type.toLowerCase().replace("_", " "))
10094
+ ]
10095
+ }
10096
+ ) }, hint.type);
10097
+ }) }) });
9651
10098
  };
9652
10099
  QueryBuilderHints.displayName = "QueryBuilderHints";
9653
10100
  const getStyles$2 = (theme) => {
@@ -9667,14 +10114,17 @@ const editorModes = [
9667
10114
  { label: "Code", value: QueryEditorMode.Code }
9668
10115
  ];
9669
10116
  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 }));
10117
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-testid": "QueryEditorModeToggle", children: /* @__PURE__ */ jsxRuntime.jsx(ui.RadioButtonGroup, { options: editorModes, size: "sm", value: mode, onChange }) });
9671
10118
  }
9672
10119
 
9673
10120
  function QueryHeaderSwitch({ label, ...inputProps }) {
9674
10121
  const dashedLabel = label.replace(" ", "-");
9675
10122
  const switchIdRef = React.useRef(lodash.uniqueId(`switch-${dashedLabel}`));
9676
10123
  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 }));
10124
+ return /* @__PURE__ */ jsxRuntime.jsxs(EditorStack, { gap: 1, children: [
10125
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: switchIdRef.current, className: styles.switchLabel, children: label }),
10126
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Switch, { ...inputProps, id: switchIdRef.current })
10127
+ ] });
9678
10128
  }
9679
10129
  const getStyles$1 = (theme) => {
9680
10130
  return {
@@ -9692,17 +10142,24 @@ const getStyles$1 = (theme) => {
9692
10142
  function QueryOptionGroup({ title, children, collapsedInfo, queryStats }) {
9693
10143
  const [isOpen, toggleOpen] = reactUse.useToggle(false);
9694
10144
  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)));
10145
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.wrapper, children: [
10146
+ /* @__PURE__ */ jsxRuntime.jsx(
10147
+ ui.Collapse,
10148
+ {
10149
+ className: styles.collapse,
10150
+ collapsible: true,
10151
+ isOpen,
10152
+ onToggle: toggleOpen,
10153
+ label: /* @__PURE__ */ jsxRuntime.jsxs(EditorStack, { gap: 0, children: [
10154
+ /* @__PURE__ */ jsxRuntime.jsx("h6", { className: styles.title, children: title }),
10155
+ !isOpen && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.description, children: collapsedInfo.map((x, i) => /* @__PURE__ */ jsxRuntime.jsx("span", { children: x }, i)) })
10156
+ ] }),
10157
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.body, children })
10158
+ }
10159
+ ),
10160
+ queryStats && runtime.config.featureToggles.lokiQuerySplitting && /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { content: "Note: the query will be split into multiple parts and executed in sequence. Query limits will only apply each individual part.", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Icon, { tabIndex: 0, name: "info-circle", className: styles.tooltip, size: "sm" }) }),
10161
+ queryStats && /* @__PURE__ */ jsxRuntime.jsx("p", { className: styles.stats, children: generateQueryStats(queryStats) })
10162
+ ] });
9706
10163
  }
9707
10164
  const getStyles = (theme) => {
9708
10165
  return {
@@ -40008,6 +40465,7 @@ exports.AdvancedHttpSettings = AdvancedHttpSettings;
40008
40465
  exports.Auth = Auth;
40009
40466
  exports.AuthMethod = AuthMethod;
40010
40467
  exports.BINARY_OPERATIONS_KEY = BINARY_OPERATIONS_KEY;
40468
+ exports.CatalogSelector = CatalogSelector;
40011
40469
  exports.CompletionItemInsertTextRule = CompletionItemInsertTextRule;
40012
40470
  exports.CompletionItemKind = CompletionItemKind;
40013
40471
  exports.CompletionItemPriority = CompletionItemPriority;
@@ -40020,6 +40478,7 @@ exports.DataLink = DataLink;
40020
40478
  exports.DataLinks = DataLinks;
40021
40479
  exports.DataSourceDescription = DataSourceDescription;
40022
40480
  exports.DataSourcePicker = DataSourcePicker;
40481
+ exports.DatasetSelector = DatasetSelector;
40023
40482
  exports.DatePicker = DatePicker;
40024
40483
  exports.DatePickerWithInput = DatePickerWithInput;
40025
40484
  exports.DebounceInput = DebounceInput;
@@ -40058,6 +40517,7 @@ exports.RunQueryButton = RunQueryButton;
40058
40517
  exports.SQLEditor = SQLEditor;
40059
40518
  exports.SQLEditorMode = SQLEditorMode;
40060
40519
  exports.SQLEditorTestUtils = SQLEditorTestUtils;
40520
+ exports.SchemaSelector = SchemaSelector;
40061
40521
  exports.SecureSocksProxyToggle = SecureSocksProxyToggle;
40062
40522
  exports.Segment = Segment;
40063
40523
  exports.Space = Space;
@@ -40066,6 +40526,7 @@ exports.SqlQueryEditor = SqlQueryEditor;
40066
40526
  exports.StatementPosition = StatementPosition;
40067
40527
  exports.SuggestionKind = SuggestionKind;
40068
40528
  exports.TLSSettings = TLSSettings;
40529
+ exports.TableSelector = TableSelector;
40069
40530
  exports.TokenType = TokenType;
40070
40531
  exports.convertLegacyAuthProps = convertLegacyAuthProps;
40071
40532
  exports.formatDate = formatDate;