@perses-dev/plugin-system 0.39.0 → 0.40.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (253) hide show
  1. package/dist/cjs/components/CalculationSelector/CalculationSelector.js +6 -4
  2. package/dist/cjs/components/CalculationSelector/index.js +10 -8
  3. package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +381 -0
  4. package/dist/cjs/components/DatasourceEditorForm/index.js +30 -0
  5. package/dist/cjs/components/DatasourceSelect.js +119 -21
  6. package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +18 -16
  7. package/dist/cjs/components/LegendOptionsEditor/index.js +10 -8
  8. package/dist/cjs/components/OptionsEditorRadios/OptionsEditorRadios.js +23 -28
  9. package/dist/cjs/components/OptionsEditorRadios/index.js +10 -8
  10. package/dist/cjs/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +6 -4
  11. package/dist/cjs/components/OptionsEditorTabPanel/index.js +10 -8
  12. package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.js +10 -8
  13. package/dist/cjs/components/OptionsEditorTabs/index.js +10 -8
  14. package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +13 -11
  15. package/dist/cjs/components/PanelSpecEditor/index.js +10 -8
  16. package/dist/cjs/components/PluginEditor/PluginEditor.js +24 -31
  17. package/dist/cjs/components/PluginEditor/index.js +11 -9
  18. package/dist/cjs/components/PluginEditor/plugin-editor-api.js +5 -3
  19. package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +23 -12
  20. package/dist/cjs/components/PluginKindSelect/index.js +10 -8
  21. package/dist/cjs/components/PluginRegistry/PluginRegistry.js +11 -9
  22. package/dist/cjs/components/PluginRegistry/index.js +10 -8
  23. package/dist/cjs/components/PluginRegistry/plugin-indexes.js +6 -2
  24. package/dist/cjs/components/PluginSpecEditor/PluginSpecEditor.js +6 -4
  25. package/dist/cjs/components/PluginSpecEditor/index.js +10 -8
  26. package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +15 -13
  27. package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +21 -19
  28. package/dist/cjs/components/TimeSeriesQueryEditor/index.js +10 -8
  29. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +257 -166
  30. package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +32 -28
  31. package/dist/cjs/components/Variables/VariableEditorForm/index.js +11 -9
  32. package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +28 -32
  33. package/dist/cjs/components/Variables/index.js +11 -9
  34. package/dist/cjs/components/Variables/variable-model.js +17 -9
  35. package/dist/cjs/components/index.js +22 -19
  36. package/dist/cjs/constants/index.js +10 -8
  37. package/dist/cjs/constants/user-interface-text.js +3 -1
  38. package/dist/cjs/index.js +16 -13
  39. package/dist/cjs/model/index.js +17 -15
  40. package/dist/cjs/model/legend.js +32 -20
  41. package/dist/cjs/model/panels.js +2 -2
  42. package/dist/cjs/model/plugin-base.js +2 -2
  43. package/dist/cjs/model/plugin-loading.js +3 -1
  44. package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +19 -11
  45. package/dist/cjs/runtime/DataQueriesProvider/index.js +11 -9
  46. package/dist/cjs/runtime/DataQueriesProvider/model.js +12 -8
  47. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +19 -11
  48. package/dist/cjs/runtime/TimeRangeProvider/index.js +11 -9
  49. package/dist/cjs/runtime/TimeRangeProvider/query-params.js +36 -18
  50. package/dist/cjs/runtime/builtin-variables.js +81 -0
  51. package/dist/cjs/runtime/datasources.js +29 -11
  52. package/dist/cjs/runtime/index.js +16 -13
  53. package/dist/cjs/runtime/plugin-registry.js +41 -11
  54. package/dist/cjs/runtime/template-variables.js +42 -12
  55. package/dist/cjs/runtime/time-series-queries.js +39 -27
  56. package/dist/cjs/stories/shared-utils/decorators/WithDataQueries.js +7 -5
  57. package/dist/cjs/stories/shared-utils/decorators/WithPluginRegistry.js +16 -14
  58. package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +42 -0
  59. package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +19 -13
  60. package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js +6 -4
  61. package/dist/cjs/stories/shared-utils/decorators/WithTimeRange.js +7 -5
  62. package/dist/cjs/stories/shared-utils/decorators/index.js +15 -12
  63. package/dist/cjs/stories/shared-utils/index.js +10 -8
  64. package/dist/cjs/test/index.js +11 -9
  65. package/dist/cjs/test/mock-data.js +3 -1
  66. package/dist/cjs/test/render.js +13 -11
  67. package/dist/cjs/test/test-plugins/bert/index.js +14 -10
  68. package/dist/cjs/test/test-plugins/ernie/index.js +13 -9
  69. package/dist/cjs/test/test-plugins/index.js +11 -9
  70. package/dist/cjs/test-utils/index.js +10 -8
  71. package/dist/cjs/test-utils/mock-plugin-registry.js +8 -4
  72. package/dist/cjs/utils/action.js +43 -0
  73. package/dist/cjs/utils/index.js +11 -8
  74. package/dist/cjs/utils/variables.js +26 -8
  75. package/dist/cjs/validation/datasource.js +30 -0
  76. package/dist/cjs/validation/index.js +32 -0
  77. package/dist/cjs/validation/resource.js +24 -0
  78. package/dist/cjs/validation/variable.js +29 -0
  79. package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -1
  80. package/dist/components/CalculationSelector/index.js.map +1 -1
  81. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts +15 -0
  82. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -0
  83. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +334 -0
  84. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -0
  85. package/dist/components/DatasourceEditorForm/index.d.ts +2 -0
  86. package/dist/components/DatasourceEditorForm/index.d.ts.map +1 -0
  87. package/dist/components/DatasourceEditorForm/index.js +15 -0
  88. package/dist/components/DatasourceEditorForm/index.js.map +1 -0
  89. package/dist/components/DatasourceSelect.d.ts +5 -0
  90. package/dist/components/DatasourceSelect.d.ts.map +1 -1
  91. package/dist/components/DatasourceSelect.js +102 -19
  92. package/dist/components/DatasourceSelect.js.map +1 -1
  93. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +2 -2
  94. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
  95. package/dist/components/LegendOptionsEditor/index.js.map +1 -1
  96. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts +2 -2
  97. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts.map +1 -1
  98. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +16 -23
  99. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -1
  100. package/dist/components/OptionsEditorRadios/index.js.map +1 -1
  101. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -1
  102. package/dist/components/OptionsEditorTabPanel/index.js.map +1 -1
  103. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
  104. package/dist/components/OptionsEditorTabs/index.js.map +1 -1
  105. package/dist/components/PanelSpecEditor/PanelSpecEditor.js +2 -2
  106. package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
  107. package/dist/components/PanelSpecEditor/index.js.map +1 -1
  108. package/dist/components/PluginEditor/PluginEditor.js +15 -24
  109. package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
  110. package/dist/components/PluginEditor/index.js.map +1 -1
  111. package/dist/components/PluginEditor/plugin-editor-api.d.ts +1 -1
  112. package/dist/components/PluginEditor/plugin-editor-api.js +2 -2
  113. package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
  114. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +3 -3
  115. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts.map +1 -1
  116. package/dist/components/PluginKindSelect/PluginKindSelect.js +21 -12
  117. package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
  118. package/dist/components/PluginKindSelect/index.js.map +1 -1
  119. package/dist/components/PluginRegistry/PluginRegistry.js +3 -3
  120. package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
  121. package/dist/components/PluginRegistry/index.js.map +1 -1
  122. package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
  123. package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
  124. package/dist/components/PluginSpecEditor/index.js.map +1 -1
  125. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +4 -4
  126. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js.map +1 -1
  127. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +1 -1
  128. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js.map +1 -1
  129. package/dist/components/TimeSeriesQueryEditor/index.js.map +1 -1
  130. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +10 -7
  131. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  132. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +201 -112
  133. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  134. package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
  135. package/dist/components/Variables/VariableEditorForm/index.js.map +1 -1
  136. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +5 -4
  137. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
  138. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +22 -30
  139. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
  140. package/dist/components/Variables/index.js.map +1 -1
  141. package/dist/components/Variables/variable-model.js +3 -3
  142. package/dist/components/Variables/variable-model.js.map +1 -1
  143. package/dist/components/index.d.ts +1 -0
  144. package/dist/components/index.d.ts.map +1 -1
  145. package/dist/components/index.js +1 -0
  146. package/dist/components/index.js.map +1 -1
  147. package/dist/constants/index.js.map +1 -1
  148. package/dist/constants/user-interface-text.js.map +1 -1
  149. package/dist/index.d.ts +1 -0
  150. package/dist/index.d.ts.map +1 -1
  151. package/dist/index.js +1 -0
  152. package/dist/index.js.map +1 -1
  153. package/dist/model/datasource.d.ts +2 -1
  154. package/dist/model/datasource.d.ts.map +1 -1
  155. package/dist/model/datasource.js.map +1 -1
  156. package/dist/model/index.js.map +1 -1
  157. package/dist/model/legend.d.ts +1 -1
  158. package/dist/model/legend.d.ts.map +1 -1
  159. package/dist/model/legend.js +14 -14
  160. package/dist/model/legend.js.map +1 -1
  161. package/dist/model/panels.js.map +1 -1
  162. package/dist/model/plugin-base.js.map +1 -1
  163. package/dist/model/plugin-loading.js.map +1 -1
  164. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +4 -4
  165. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
  166. package/dist/runtime/DataQueriesProvider/index.js.map +1 -1
  167. package/dist/runtime/DataQueriesProvider/model.d.ts +3 -2
  168. package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
  169. package/dist/runtime/DataQueriesProvider/model.js +4 -4
  170. package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
  171. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
  172. package/dist/runtime/TimeRangeProvider/index.js.map +1 -1
  173. package/dist/runtime/TimeRangeProvider/query-params.js +1 -1
  174. package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
  175. package/dist/runtime/builtin-variables.d.ts +11 -0
  176. package/dist/runtime/builtin-variables.d.ts.map +1 -0
  177. package/dist/runtime/builtin-variables.js +59 -0
  178. package/dist/runtime/builtin-variables.js.map +1 -0
  179. package/dist/runtime/datasources.d.ts +14 -6
  180. package/dist/runtime/datasources.d.ts.map +1 -1
  181. package/dist/runtime/datasources.js +13 -6
  182. package/dist/runtime/datasources.js.map +1 -1
  183. package/dist/runtime/index.d.ts +1 -0
  184. package/dist/runtime/index.d.ts.map +1 -1
  185. package/dist/runtime/index.js +1 -0
  186. package/dist/runtime/index.js.map +1 -1
  187. package/dist/runtime/plugin-registry.d.ts +2 -0
  188. package/dist/runtime/plugin-registry.d.ts.map +1 -1
  189. package/dist/runtime/plugin-registry.js +19 -2
  190. package/dist/runtime/plugin-registry.js.map +1 -1
  191. package/dist/runtime/template-variables.d.ts +2 -1
  192. package/dist/runtime/template-variables.d.ts.map +1 -1
  193. package/dist/runtime/template-variables.js +27 -8
  194. package/dist/runtime/template-variables.js.map +1 -1
  195. package/dist/runtime/time-series-queries.d.ts +3 -3
  196. package/dist/runtime/time-series-queries.d.ts.map +1 -1
  197. package/dist/runtime/time-series-queries.js +14 -12
  198. package/dist/runtime/time-series-queries.js.map +1 -1
  199. package/dist/stories/shared-utils/decorators/WithDataQueries.js.map +1 -1
  200. package/dist/stories/shared-utils/decorators/WithPluginRegistry.js.map +1 -1
  201. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts +13 -0
  202. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts.map +1 -0
  203. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +39 -0
  204. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js.map +1 -0
  205. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts.map +1 -1
  206. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +11 -7
  207. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js.map +1 -1
  208. package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js.map +1 -1
  209. package/dist/stories/shared-utils/decorators/WithTimeRange.js.map +1 -1
  210. package/dist/stories/shared-utils/decorators/index.d.ts +1 -0
  211. package/dist/stories/shared-utils/decorators/index.d.ts.map +1 -1
  212. package/dist/stories/shared-utils/decorators/index.js +1 -0
  213. package/dist/stories/shared-utils/decorators/index.js.map +1 -1
  214. package/dist/stories/shared-utils/index.js.map +1 -1
  215. package/dist/test/index.js.map +1 -1
  216. package/dist/test/mock-data.js.map +1 -1
  217. package/dist/test/render.js +2 -2
  218. package/dist/test/render.js.map +1 -1
  219. package/dist/test/setup-tests.js.map +1 -1
  220. package/dist/test/test-plugins/bert/index.js.map +1 -1
  221. package/dist/test/test-plugins/ernie/index.js.map +1 -1
  222. package/dist/test/test-plugins/index.js.map +1 -1
  223. package/dist/test-utils/index.js.map +1 -1
  224. package/dist/test-utils/mock-plugin-registry.js +2 -2
  225. package/dist/test-utils/mock-plugin-registry.js.map +1 -1
  226. package/dist/utils/action.d.ts +4 -0
  227. package/dist/utils/action.d.ts.map +1 -0
  228. package/dist/utils/action.js +27 -0
  229. package/dist/utils/action.js.map +1 -0
  230. package/dist/utils/index.d.ts +1 -0
  231. package/dist/utils/index.d.ts.map +1 -1
  232. package/dist/utils/index.js +1 -0
  233. package/dist/utils/index.js.map +1 -1
  234. package/dist/utils/variables.d.ts.map +1 -1
  235. package/dist/utils/variables.js +17 -5
  236. package/dist/utils/variables.js.map +1 -1
  237. package/dist/validation/datasource.d.ts +19 -0
  238. package/dist/validation/datasource.d.ts.map +1 -0
  239. package/dist/validation/datasource.js +22 -0
  240. package/dist/validation/datasource.js.map +1 -0
  241. package/dist/validation/index.d.ts +4 -0
  242. package/dist/validation/index.d.ts.map +1 -0
  243. package/dist/validation/index.js +17 -0
  244. package/dist/validation/index.js.map +1 -0
  245. package/dist/validation/resource.d.ts +3 -0
  246. package/dist/validation/resource.d.ts.map +1 -0
  247. package/dist/validation/resource.js +16 -0
  248. package/dist/validation/resource.js.map +1 -0
  249. package/dist/validation/variable.d.ts +19 -0
  250. package/dist/validation/variable.d.ts.map +1 -0
  251. package/dist/validation/variable.js +21 -0
  252. package/dist/validation/variable.js.map +1 -0
  253. package/package.json +8 -6
@@ -16,13 +16,15 @@ Object.defineProperty(exports, "__esModule", {
16
16
  });
17
17
  Object.defineProperty(exports, "renderWithContext", {
18
18
  enumerable: true,
19
- get: ()=>renderWithContext
19
+ get: function() {
20
+ return renderWithContext;
21
+ }
20
22
  });
21
- const _jsxRuntime = require("react/jsx-runtime");
23
+ const _jsxruntime = require("react/jsx-runtime");
22
24
  const _react = require("@testing-library/react");
23
- const _reactQuery = require("@tanstack/react-query");
24
- const _pluginRegistry = require("../components/PluginRegistry");
25
- const _testPlugins = require("./test-plugins");
25
+ const _reactquery = require("@tanstack/react-query");
26
+ const _PluginRegistry = require("../components/PluginRegistry");
27
+ const _testplugins = require("./test-plugins");
26
28
  const testLogger = {
27
29
  log: console.log,
28
30
  warn: console.warn,
@@ -32,7 +34,7 @@ const testLogger = {
32
34
  };
33
35
  function renderWithContext(ui, renderOptions, contextOptions) {
34
36
  // Create a new QueryClient for each test to avoid caching issues
35
- const queryClient = new _reactQuery.QueryClient({
37
+ const queryClient = new _reactquery.QueryClient({
36
38
  defaultOptions: {
37
39
  queries: {
38
40
  refetchOnWindowFocus: false,
@@ -41,12 +43,12 @@ function renderWithContext(ui, renderOptions, contextOptions) {
41
43
  },
42
44
  logger: testLogger
43
45
  });
44
- var ref;
45
- return (0, _react.render)(/*#__PURE__*/ (0, _jsxRuntime.jsx)(_reactQuery.QueryClientProvider, {
46
+ var _contextOptions_defaultPluginKinds;
47
+ return (0, _react.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactquery.QueryClientProvider, {
46
48
  client: queryClient,
47
- children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pluginRegistry.PluginRegistry, {
48
- pluginLoader: _testPlugins.testPluginLoader,
49
- defaultPluginKinds: (ref = contextOptions === null || contextOptions === void 0 ? void 0 : contextOptions.defaultPluginKinds) !== null && ref !== void 0 ? ref : {
49
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_PluginRegistry.PluginRegistry, {
50
+ pluginLoader: _testplugins.testPluginLoader,
51
+ defaultPluginKinds: (_contextOptions_defaultPluginKinds = contextOptions === null || contextOptions === void 0 ? void 0 : contextOptions.defaultPluginKinds) !== null && _contextOptions_defaultPluginKinds !== void 0 ? _contextOptions_defaultPluginKinds : {
50
52
  TimeSeriesQuery: 'PrometheusTimeSeriesQuery'
51
53
  },
52
54
  children: ui
@@ -21,18 +21,22 @@ function _export(target, all) {
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
- BertPanel1: ()=>BertPanel1,
25
- BertPanel2: ()=>BertPanel2
24
+ BertPanel1: function() {
25
+ return BertPanel1;
26
+ },
27
+ BertPanel2: function() {
28
+ return BertPanel2;
29
+ }
26
30
  });
27
- const _jsxRuntime = require("react/jsx-runtime");
31
+ const _jsxruntime = require("react/jsx-runtime");
28
32
  function BertPanel1Editor({ value , onChange }) {
29
- return /*#__PURE__*/ (0, _jsxRuntime.jsxs)("div", {
33
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
30
34
  children: [
31
- /*#__PURE__*/ (0, _jsxRuntime.jsx)("label", {
35
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("label", {
32
36
  htmlFor: "editor-input",
33
37
  children: "BertPanel1 editor"
34
38
  }),
35
- /*#__PURE__*/ (0, _jsxRuntime.jsx)("input", {
39
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("input", {
36
40
  type: "text",
37
41
  id: "editor-input",
38
42
  value: value.option1,
@@ -62,13 +66,13 @@ const BertPanel2 = {
62
66
  {
63
67
  label: 'Settings',
64
68
  content: function BertPanel2Editor({ value , onChange }) {
65
- return /*#__PURE__*/ (0, _jsxRuntime.jsxs)("div", {
69
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
66
70
  children: [
67
- /*#__PURE__*/ (0, _jsxRuntime.jsx)("label", {
71
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("label", {
68
72
  htmlFor: "editor-input",
69
73
  children: "BertPanel2 editor"
70
74
  }),
71
- /*#__PURE__*/ (0, _jsxRuntime.jsx)("input", {
75
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("input", {
72
76
  type: "text",
73
77
  id: "editor-input",
74
78
  value: value.option2,
@@ -84,7 +88,7 @@ const BertPanel2 = {
84
88
  {
85
89
  label: 'Custom Tab',
86
90
  content: function Editor() {
87
- return /*#__PURE__*/ (0, _jsxRuntime.jsx)("div", {
91
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
88
92
  children: "custom content"
89
93
  });
90
94
  }
@@ -21,10 +21,14 @@ function _export(target, all) {
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
- ErnieVariable1: ()=>ErnieVariable1,
25
- ErnieVariable2: ()=>ErnieVariable2
24
+ ErnieVariable1: function() {
25
+ return ErnieVariable1;
26
+ },
27
+ ErnieVariable2: function() {
28
+ return ErnieVariable2;
29
+ }
26
30
  });
27
- const _jsxRuntime = require("react/jsx-runtime");
31
+ const _jsxruntime = require("react/jsx-runtime");
28
32
  const data = [
29
33
  {
30
34
  label: 'Grover',
@@ -40,13 +44,13 @@ const ErnieVariable1 = {
40
44
  data
41
45
  }),
42
46
  OptionsEditorComponent: function ErnieVariableEditor({ value , onChange }) {
43
- return /*#__PURE__*/ (0, _jsxRuntime.jsxs)("div", {
47
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
44
48
  children: [
45
- /*#__PURE__*/ (0, _jsxRuntime.jsx)("label", {
49
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("label", {
46
50
  htmlFor: "editor-input",
47
51
  children: "ErnieVariable editor"
48
52
  }),
49
- /*#__PURE__*/ (0, _jsxRuntime.jsx)("input", {
53
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("input", {
50
54
  type: "text",
51
55
  id: "editor-input",
52
56
  value: value.variableOption,
@@ -67,13 +71,13 @@ const ErnieVariable2 = {
67
71
  data
68
72
  }),
69
73
  OptionsEditorComponent: function ErnieVariableEditor({ value , onChange }) {
70
- return /*#__PURE__*/ (0, _jsxRuntime.jsxs)("div", {
74
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
71
75
  children: [
72
- /*#__PURE__*/ (0, _jsxRuntime.jsx)("label", {
76
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("label", {
73
77
  htmlFor: "editor-input",
74
78
  children: "ErnieVariable2 editor"
75
79
  }),
76
- /*#__PURE__*/ (0, _jsxRuntime.jsx)("input", {
80
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("input", {
77
81
  type: "text",
78
82
  id: "editor-input",
79
83
  value: value.variableOption2,
@@ -16,12 +16,14 @@ Object.defineProperty(exports, "__esModule", {
16
16
  });
17
17
  Object.defineProperty(exports, "testPluginLoader", {
18
18
  enumerable: true,
19
- get: ()=>testPluginLoader
19
+ get: function() {
20
+ return testPluginLoader;
21
+ }
20
22
  });
21
23
  const _model = require("../../model");
22
- const _pluginJson = /*#__PURE__*/ _interopRequireDefault(require("./bert/plugin.json"));
23
- const _pluginJson1 = /*#__PURE__*/ _interopRequireDefault(require("./ernie/plugin.json"));
24
- function _interopRequireDefault(obj) {
24
+ const _pluginjson = /*#__PURE__*/ _interop_require_default(require("./bert/plugin.json"));
25
+ const _pluginjson1 = /*#__PURE__*/ _interop_require_default(require("./ernie/plugin.json"));
26
+ function _interop_require_default(obj) {
25
27
  return obj && obj.__esModule ? obj : {
26
28
  default: obj
27
29
  };
@@ -34,7 +36,7 @@ function _getRequireWildcardCache(nodeInterop) {
34
36
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
35
37
  })(nodeInterop);
36
38
  }
37
- function _interopRequireWildcard(obj, nodeInterop) {
39
+ function _interop_require_wildcard(obj, nodeInterop) {
38
40
  if (!nodeInterop && obj && obj.__esModule) {
39
41
  return obj;
40
42
  }
@@ -67,11 +69,11 @@ function _interopRequireWildcard(obj, nodeInterop) {
67
69
  }
68
70
  const testPluginLoader = (0, _model.dynamicImportPluginLoader)([
69
71
  {
70
- resource: _pluginJson.default,
71
- importPlugin: ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interopRequireWildcard(require("./bert")))
72
+ resource: _pluginjson.default,
73
+ importPlugin: ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("./bert")))
72
74
  },
73
75
  {
74
- resource: _pluginJson1.default,
75
- importPlugin: ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interopRequireWildcard(require("./ernie")))
76
+ resource: _pluginjson1.default,
77
+ importPlugin: ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("./ernie")))
76
78
  }
77
79
  ]);
@@ -14,15 +14,17 @@
14
14
  Object.defineProperty(exports, "__esModule", {
15
15
  value: true
16
16
  });
17
- _exportStar(require("./mock-plugin-registry"), exports);
18
- function _exportStar(from, to) {
17
+ _export_star(require("./mock-plugin-registry"), exports);
18
+ function _export_star(from, to) {
19
19
  Object.keys(from).forEach(function(k) {
20
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
21
- enumerable: true,
22
- get: function() {
23
- return from[k];
24
- }
25
- });
20
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
21
+ Object.defineProperty(to, k, {
22
+ enumerable: true,
23
+ get: function() {
24
+ return from[k];
25
+ }
26
+ });
27
+ }
26
28
  });
27
29
  return from;
28
30
  }
@@ -21,16 +21,20 @@ function _export(target, all) {
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
- mockPluginRegistry: ()=>mockPluginRegistry,
25
- getMockPluginName: ()=>getMockPluginName
24
+ mockPluginRegistry: function() {
25
+ return mockPluginRegistry;
26
+ },
27
+ getMockPluginName: function() {
28
+ return getMockPluginName;
29
+ }
26
30
  });
27
31
  function mockPluginRegistry(...mockPlugins) {
28
32
  const mockPluginResource = {
29
33
  kind: 'PluginModule',
30
34
  metadata: {
31
35
  name: 'Fake Plugin Module for Tests',
32
- created_at: '',
33
- updated_at: '',
36
+ createdAt: '',
37
+ updatedAt: '',
34
38
  version: 0
35
39
  },
36
40
  spec: {
@@ -0,0 +1,43 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ getTitleAction: function() {
25
+ return getTitleAction;
26
+ },
27
+ getSubmitText: function() {
28
+ return getSubmitText;
29
+ }
30
+ });
31
+ function getTitleAction(action, isDraft) {
32
+ if (action === 'read') return 'View';
33
+ if (isDraft && action === 'create') return 'Add';
34
+ if (!isDraft && action === 'create') return 'Create';
35
+ if (action === 'update') return 'Edit';
36
+ return '';
37
+ }
38
+ function getSubmitText(action, isDraft) {
39
+ if (isDraft && action === 'create') return 'Add';
40
+ if (isDraft && action === 'update') return 'Apply';
41
+ if (!isDraft) return 'Save';
42
+ return '';
43
+ }
@@ -14,15 +14,18 @@
14
14
  Object.defineProperty(exports, "__esModule", {
15
15
  value: true
16
16
  });
17
- _exportStar(require("./variables"), exports);
18
- function _exportStar(from, to) {
17
+ _export_star(require("./action"), exports);
18
+ _export_star(require("./variables"), exports);
19
+ function _export_star(from, to) {
19
20
  Object.keys(from).forEach(function(k) {
20
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
21
- enumerable: true,
22
- get: function() {
23
- return from[k];
24
- }
25
- });
21
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
22
+ Object.defineProperty(to, k, {
23
+ enumerable: true,
24
+ get: function() {
25
+ return from[k];
26
+ }
27
+ });
28
+ }
26
29
  });
27
30
  return from;
28
31
  }
@@ -21,14 +21,23 @@ function _export(target, all) {
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
- replaceTemplateVariables: ()=>replaceTemplateVariables,
25
- replaceTemplateVariable: ()=>replaceTemplateVariable,
26
- parseTemplateVariables: ()=>parseTemplateVariables
24
+ replaceTemplateVariables: function() {
25
+ return replaceTemplateVariables;
26
+ },
27
+ replaceTemplateVariable: function() {
28
+ return replaceTemplateVariable;
29
+ },
30
+ parseTemplateVariables: function() {
31
+ return parseTemplateVariables;
32
+ }
27
33
  });
28
34
  function replaceTemplateVariables(text, variableState) {
29
35
  const variables = parseTemplateVariables(text);
30
36
  let finalText = text;
31
- variables.forEach((v)=>{
37
+ variables// Sorting variables by their length.
38
+ // In order to not have a variable name have contained in another variable name.
39
+ // i.e.: $__range replacing $__range_ms => '3600_ms' instead of '3600000'
40
+ .sort((a, b)=>b.length - a.length).forEach((v)=>{
32
41
  const variable = variableState[v];
33
42
  if (variable && (variable === null || variable === void 0 ? void 0 : variable.value)) {
34
43
  finalText = replaceTemplateVariable(finalText, v, variable === null || variable === void 0 ? void 0 : variable.value);
@@ -38,6 +47,7 @@ function replaceTemplateVariables(text, variableState) {
38
47
  }
39
48
  function replaceTemplateVariable(text, varName, templateVariableValue) {
40
49
  const variableTemplate = '$' + varName;
50
+ const bracketsVariableTemplate = '${' + varName + '}';
41
51
  let replaceString = '';
42
52
  if (Array.isArray(templateVariableValue)) {
43
53
  replaceString = `(${templateVariableValue.join('|')})`; // regex style
@@ -45,12 +55,14 @@ function replaceTemplateVariable(text, varName, templateVariableValue) {
45
55
  if (typeof templateVariableValue === 'string') {
46
56
  replaceString = templateVariableValue;
47
57
  }
48
- return text.replaceAll(variableTemplate, replaceString);
58
+ text = text.replaceAll(variableTemplate, replaceString);
59
+ return text.replaceAll(bracketsVariableTemplate, replaceString);
49
60
  }
50
61
  // This regular expression is designed to identify variable references in a template string.
51
62
  // It supports two formats for referencing variables:
52
63
  // 1. $variableName - This is a simpler format, and the regular expression captures the variable name (\w+ matches one or more word characters).
53
- // 2. [COMING SOON] ${variableName:value} - This is a more complex format that allows specifying a format function as well.
64
+ // 2. ${variableName} - This is a more complex format and the regular expression captures the variable name (\w+ matches one or more word characters) in the curly braces.
65
+ // 3. [COMING SOON] ${variableName:value} - This is a more complex format that allows specifying a format function as well.
54
66
  // TODO: Fix this lint error
55
67
  // eslint-disable-next-line no-useless-escape
56
68
  const TEMPLATE_VARIABLE_REGEX = /\$(\w+)|\${(\w+)(?:\.([^:^\}]+))?(?::([^\}]+))?}/gm;
@@ -59,8 +71,14 @@ const parseTemplateVariables = (text)=>{
59
71
  const matches = new Set();
60
72
  let match;
61
73
  while((match = regex.exec(text)) !== null){
62
- if (match && match.length > 1 && match[1]) {
63
- matches.add(match[1]);
74
+ if (match) {
75
+ if (match[1]) {
76
+ // \$(\w+)\
77
+ matches.add(match[1]);
78
+ } else if (match[2]) {
79
+ // \${(\w+)}\
80
+ matches.add(match[2]);
81
+ }
64
82
  }
65
83
  }
66
84
  // return unique matches
@@ -0,0 +1,30 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "datasourceEditValidationSchema", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return datasourceEditValidationSchema;
21
+ }
22
+ });
23
+ const _zod = require("zod");
24
+ const _resource = require("./resource");
25
+ const datasourceEditValidationSchema = _zod.z.object({
26
+ name: _resource.resourceIdValidationSchema,
27
+ title: _zod.z.string().optional(),
28
+ description: _zod.z.string().optional(),
29
+ default: _zod.z.boolean()
30
+ });
@@ -0,0 +1,32 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ _export_star(require("./datasource"), exports);
18
+ _export_star(require("./resource"), exports);
19
+ _export_star(require("./variable"), exports);
20
+ function _export_star(from, to) {
21
+ Object.keys(from).forEach(function(k) {
22
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
23
+ Object.defineProperty(to, k, {
24
+ enumerable: true,
25
+ get: function() {
26
+ return from[k];
27
+ }
28
+ });
29
+ }
30
+ });
31
+ return from;
32
+ }
@@ -0,0 +1,24 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "resourceIdValidationSchema", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return resourceIdValidationSchema;
21
+ }
22
+ });
23
+ const _zod = require("zod");
24
+ const resourceIdValidationSchema = _zod.z.string().nonempty('Required').max(75, 'Must be 75 or fewer characters long').regex(/^[a-zA-Z0-9_.-]+$/, 'Must only contains alphanumerical characters and special characters _ . -');
@@ -0,0 +1,29 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "variableEditValidationSchema", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return variableEditValidationSchema;
21
+ }
22
+ });
23
+ const _zod = require("zod");
24
+ const variableEditValidationSchema = _zod.z.object({
25
+ name: _zod.z.string().nonempty('Required').regex(/^\w+$/, 'Must only contains alphanumerical characters and underscores').refine((val)=>!val.startsWith('__'), '__ prefix is reserved to builtin variables'),
26
+ title: _zod.z.string().optional(),
27
+ description: _zod.z.string().optional(),
28
+ kind: _zod.z.string().nonempty('Required')
29
+ });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/CalculationSelector/CalculationSelector.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { OptionsEditorControl, SettingsAutocomplete } from '@perses-dev/components';\nimport { CALCULATIONS_CONFIG, CalculationConfig, CalculationType } from '@perses-dev/core';\n\ntype AutocompleteCalculationOption = CalculationConfig & { id: CalculationType };\nconst CALC_OPTIONS: AutocompleteCalculationOption[] = Object.entries(CALCULATIONS_CONFIG).map(([id, config]) => {\n return {\n id: id as CalculationType,\n ...config,\n };\n});\n\nexport interface CalculationSelectorProps {\n value: CalculationType;\n onChange: (unit: CalculationType) => void;\n}\n\nexport function CalculationSelector({ value, onChange }: CalculationSelectorProps) {\n const handleCalculationChange = (_: unknown, newValue: AutocompleteCalculationOption) => {\n onChange(newValue.id);\n };\n\n const calcConfig = CALCULATIONS_CONFIG[value];\n\n return (\n <OptionsEditorControl\n label=\"Calculation\"\n control={\n <SettingsAutocomplete\n value={{\n ...calcConfig,\n id: value,\n }}\n options={CALC_OPTIONS}\n onChange={handleCalculationChange}\n disableClearable\n ></SettingsAutocomplete>\n }\n />\n );\n}\n"],"names":["OptionsEditorControl","SettingsAutocomplete","CALCULATIONS_CONFIG","CALC_OPTIONS","Object","entries","map","id","config","CalculationSelector","value","onChange","handleCalculationChange","_","newValue","calcConfig","label","control","options","disableClearable"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,SAASA,oBAAoB,EAAEC,oBAAoB,QAAQ,wBAAwB,CAAC;AACpF,SAASC,mBAAmB,QAA4C,kBAAkB,CAAC;AAG3F,MAAMC,YAAY,GAAoCC,MAAM,CAACC,OAAO,CAACH,mBAAmB,CAAC,CAACI,GAAG,CAAC,CAAC,CAACC,EAAE,EAAEC,MAAM,CAAC,GAAK;IAC9G,OAAO;QACLD,EAAE,EAAEA,EAAE;QACN,GAAGC,MAAM;KACV,CAAC;AACJ,CAAC,CAAC,AAAC;AAOH,OAAO,SAASC,mBAAmB,CAAC,EAAEC,KAAK,CAAA,EAAEC,QAAQ,CAAA,EAA4B,EAAE;IACjF,MAAMC,uBAAuB,GAAG,CAACC,CAAU,EAAEC,QAAuC,GAAK;QACvFH,QAAQ,CAACG,QAAQ,CAACP,EAAE,CAAC,CAAC;IACxB,CAAC,AAAC;IAEF,MAAMQ,UAAU,GAAGb,mBAAmB,CAACQ,KAAK,CAAC,AAAC;IAE9C,qBACE,KAACV,oBAAoB;QACnBgB,KAAK,EAAC,aAAa;QACnBC,OAAO,gBACL,KAAChB,oBAAoB;YACnBS,KAAK,EAAE;gBACL,GAAGK,UAAU;gBACbR,EAAE,EAAEG,KAAK;aACV;YACDQ,OAAO,EAAEf,YAAY;YACrBQ,QAAQ,EAAEC,uBAAuB;YACjCO,gBAAgB;UACM;MAE1B,CACF;AACJ,CAAC"}
1
+ {"version":3,"sources":["../../../src/components/CalculationSelector/CalculationSelector.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { OptionsEditorControl, SettingsAutocomplete } from '@perses-dev/components';\nimport { CALCULATIONS_CONFIG, CalculationConfig, CalculationType } from '@perses-dev/core';\n\ntype AutocompleteCalculationOption = CalculationConfig & { id: CalculationType };\nconst CALC_OPTIONS: AutocompleteCalculationOption[] = Object.entries(CALCULATIONS_CONFIG).map(([id, config]) => {\n return {\n id: id as CalculationType,\n ...config,\n };\n});\n\nexport interface CalculationSelectorProps {\n value: CalculationType;\n onChange: (unit: CalculationType) => void;\n}\n\nexport function CalculationSelector({ value, onChange }: CalculationSelectorProps) {\n const handleCalculationChange = (_: unknown, newValue: AutocompleteCalculationOption) => {\n onChange(newValue.id);\n };\n\n const calcConfig = CALCULATIONS_CONFIG[value];\n\n return (\n <OptionsEditorControl\n label=\"Calculation\"\n control={\n <SettingsAutocomplete\n value={{\n ...calcConfig,\n id: value,\n }}\n options={CALC_OPTIONS}\n onChange={handleCalculationChange}\n disableClearable\n ></SettingsAutocomplete>\n }\n />\n );\n}\n"],"names":["OptionsEditorControl","SettingsAutocomplete","CALCULATIONS_CONFIG","CALC_OPTIONS","Object","entries","map","id","config","CalculationSelector","value","onChange","handleCalculationChange","_","newValue","calcConfig","label","control","options","disableClearable"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,oBAAoB,EAAEC,oBAAoB,QAAQ,yBAAyB;AACpF,SAASC,mBAAmB,QAA4C,mBAAmB;AAG3F,MAAMC,eAAgDC,OAAOC,QAAQH,qBAAqBI,IAAI,CAAC,CAACC,IAAIC,OAAO;IACzG,OAAO;QACLD,IAAIA;QACJ,GAAGC,MAAM;IACX;AACF;AAOA,OAAO,SAASC,oBAAoB,EAAEC,MAAK,EAAEC,SAAQ,EAA4B;IAC/E,MAAMC,0BAA0B,CAACC,GAAYC;QAC3CH,SAASG,SAASP;IACpB;IAEA,MAAMQ,aAAab,mBAAmB,CAACQ,MAAM;IAE7C,qBACE,KAACV;QACCgB,OAAM;QACNC,uBACE,KAAChB;YACCS,OAAO;gBACL,GAAGK,UAAU;gBACbR,IAAIG;YACN;YACAQ,SAASf;YACTQ,UAAUC;YACVO,gBAAgB;;;AAK1B"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/CalculationSelector/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './CalculationSelector';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"sources":["../../../src/components/CalculationSelector/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './CalculationSelector';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,wBAAwB"}
@@ -0,0 +1,15 @@
1
+ import { Datasource } from '@perses-dev/core';
2
+ import { Dispatch, DispatchWithoutAction } from 'react';
3
+ import { Action } from '../../utils';
4
+ interface DatasourceEditorFormProps<T extends Datasource> {
5
+ initialDatasource: T;
6
+ initialAction: Action;
7
+ isDraft: boolean;
8
+ isReadonly?: boolean;
9
+ onSave: Dispatch<T>;
10
+ onClose: DispatchWithoutAction;
11
+ onDelete?: DispatchWithoutAction;
12
+ }
13
+ export declare function DatasourceEditorForm<T extends Datasource>(props: DatasourceEditorFormProps<T>): JSX.Element;
14
+ export {};
15
+ //# sourceMappingURL=DatasourceEditorForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DatasourceEditorForm.d.ts","sourceRoot":"","sources":["../../../src/components/DatasourceEditorForm/DatasourceEditorForm.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAW,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAc,EAAE,QAAQ,EAAE,qBAAqB,EAAyB,MAAM,OAAO,CAAC;AAKtF,OAAO,EAAE,MAAM,EAAiC,MAAM,aAAa,CAAC;AAsBpE,UAAU,yBAAyB,CAAC,CAAC,SAAS,UAAU;IACtD,iBAAiB,EAAE,CAAC,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IACpB,OAAO,EAAE,qBAAqB,CAAC;IAC/B,QAAQ,CAAC,EAAE,qBAAqB,CAAC;CAClC;AAED,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,UAAU,EAAE,KAAK,EAAE,yBAAyB,CAAC,CAAC,CAAC,eAiO7F"}