@perses-dev/plugin-system 0.54.0-beta.1 → 0.54.0-beta.10

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 (261) hide show
  1. package/dist/cjs/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js +283 -0
  2. package/dist/cjs/components/Annotations/AnnotationEditorForm/AnnotationPreview.js +197 -0
  3. package/dist/cjs/components/Annotations/AnnotationEditorForm/index.js +30 -0
  4. package/dist/cjs/components/Annotations/constants.js +23 -0
  5. package/dist/cjs/components/Annotations/index.js +31 -0
  6. package/dist/cjs/components/MultiQueryEditor/QueryEditorContainer.js +97 -12
  7. package/dist/cjs/components/MultiQueryEditor/index.js +1 -0
  8. package/dist/cjs/components/MultiQueryEditor/utils.js +36 -0
  9. package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +3 -6
  10. package/dist/cjs/components/PluginRegistry/PluginRegistry.js +11 -15
  11. package/dist/cjs/components/PluginRegistry/getPluginSearchHelper.js +92 -0
  12. package/dist/cjs/components/PluginRegistry/plugin-indexes.js +16 -13
  13. package/dist/cjs/components/Variables/variable-model.js +115 -29
  14. package/dist/cjs/components/index.js +1 -0
  15. package/dist/cjs/context/ValidationProvider.js +10 -4
  16. package/dist/cjs/model/alerts-queries.js +16 -0
  17. package/dist/cjs/model/annotations.js +16 -0
  18. package/dist/cjs/model/index.js +3 -0
  19. package/dist/cjs/model/log-volume-utils.js +10 -10
  20. package/dist/cjs/model/plugin-loading.js +24 -8
  21. package/dist/cjs/model/plugins.js +10 -0
  22. package/dist/cjs/model/silences-queries.js +16 -0
  23. package/dist/cjs/remote/PluginRuntime.js +46 -10
  24. package/dist/cjs/remote/remotePluginLoader.js +28 -5
  25. package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +33 -24
  26. package/dist/cjs/runtime/DataQueriesProvider/model.js +3 -93
  27. package/dist/cjs/runtime/UsageMetricsProvider.js +2 -2
  28. package/dist/cjs/runtime/alerts-queries.js +101 -0
  29. package/dist/cjs/runtime/annotations.js +148 -0
  30. package/dist/cjs/runtime/index.js +3 -1
  31. package/dist/cjs/runtime/item-actions.js +3 -3
  32. package/dist/cjs/runtime/log-queries.js +4 -1
  33. package/dist/cjs/runtime/plugin-registry.js +12 -3
  34. package/dist/cjs/runtime/profile-queries.js +4 -1
  35. package/dist/cjs/runtime/silences-queries.js +101 -0
  36. package/dist/cjs/runtime/time-series-queries.js +4 -1
  37. package/dist/cjs/runtime/trace-queries.js +4 -1
  38. package/dist/cjs/test/mock-data.js +51 -0
  39. package/dist/cjs/test/test-plugins/bert/index.js +9 -12
  40. package/dist/cjs/test/test-plugins/ernie/index.js +9 -12
  41. package/dist/cjs/test/test-plugins/index.js +2 -2
  42. package/dist/cjs/test-utils/mock-plugin-registry.js +8 -2
  43. package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.d.ts +16 -0
  44. package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.d.ts.map +1 -0
  45. package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js +270 -0
  46. package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js.map +1 -0
  47. package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.d.ts +8 -0
  48. package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.d.ts.map +1 -0
  49. package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.js +184 -0
  50. package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.js.map +1 -0
  51. package/dist/components/Annotations/AnnotationEditorForm/index.d.ts +2 -0
  52. package/dist/components/Annotations/AnnotationEditorForm/index.d.ts.map +1 -0
  53. package/dist/{runtime/QueryCountProvider.js → components/Annotations/AnnotationEditorForm/index.js} +2 -13
  54. package/dist/components/Annotations/AnnotationEditorForm/index.js.map +1 -0
  55. package/dist/components/Annotations/constants.d.ts +2 -0
  56. package/dist/components/Annotations/constants.d.ts.map +1 -0
  57. package/dist/components/Annotations/constants.js +15 -0
  58. package/dist/components/Annotations/constants.js.map +1 -0
  59. package/dist/components/Annotations/index.d.ts +3 -0
  60. package/dist/components/Annotations/index.d.ts.map +1 -0
  61. package/dist/components/Annotations/index.js +16 -0
  62. package/dist/components/Annotations/index.js.map +1 -0
  63. package/dist/components/CalculationSelector/CalculationSelector.js +1 -1
  64. package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -1
  65. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts +1 -2
  66. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -1
  67. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +1 -1
  68. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
  69. package/dist/components/DatasourceSelect/DatasourceSelect.js +2 -2
  70. package/dist/components/DatasourceSelect/DatasourceSelect.js.map +1 -1
  71. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts +1 -1
  72. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts.map +1 -1
  73. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js +2 -2
  74. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -1
  75. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js +1 -1
  76. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js.map +1 -1
  77. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +1 -1
  78. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
  79. package/dist/components/MetricLabelInput/MetricLabelInput.js +1 -1
  80. package/dist/components/MetricLabelInput/MetricLabelInput.js.map +1 -1
  81. package/dist/components/MultiQueryEditor/MultiQueryEditor.js +1 -1
  82. package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -1
  83. package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts.map +1 -1
  84. package/dist/components/MultiQueryEditor/QueryEditorContainer.js +100 -15
  85. package/dist/components/MultiQueryEditor/QueryEditorContainer.js.map +1 -1
  86. package/dist/components/MultiQueryEditor/index.d.ts +1 -0
  87. package/dist/components/MultiQueryEditor/index.d.ts.map +1 -1
  88. package/dist/components/MultiQueryEditor/index.js +1 -0
  89. package/dist/components/MultiQueryEditor/index.js.map +1 -1
  90. package/dist/components/MultiQueryEditor/utils.d.ts +8 -0
  91. package/dist/components/MultiQueryEditor/utils.d.ts.map +1 -0
  92. package/dist/components/MultiQueryEditor/utils.js +23 -0
  93. package/dist/components/MultiQueryEditor/utils.js.map +1 -0
  94. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +1 -1
  95. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -1
  96. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +1 -1
  97. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -1
  98. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +1 -1
  99. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
  100. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
  101. package/dist/components/PanelSpecEditor/PanelSpecEditor.js +5 -8
  102. package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
  103. package/dist/components/PluginEditor/PluginEditor.js +1 -1
  104. package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
  105. package/dist/components/PluginKindSelect/PluginKindSelect.js +1 -1
  106. package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
  107. package/dist/components/PluginRegistry/PluginRegistry.d.ts.map +1 -1
  108. package/dist/components/PluginRegistry/PluginRegistry.js +12 -16
  109. package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
  110. package/dist/components/PluginRegistry/getPluginSearchHelper.d.ts +12 -0
  111. package/dist/components/PluginRegistry/getPluginSearchHelper.d.ts.map +1 -0
  112. package/dist/components/PluginRegistry/getPluginSearchHelper.js +88 -0
  113. package/dist/components/PluginRegistry/getPluginSearchHelper.js.map +1 -0
  114. package/dist/components/PluginRegistry/plugin-indexes.d.ts +4 -6
  115. package/dist/components/PluginRegistry/plugin-indexes.d.ts.map +1 -1
  116. package/dist/components/PluginRegistry/plugin-indexes.js +15 -13
  117. package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
  118. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts.map +1 -1
  119. package/dist/components/PluginSpecEditor/PluginSpecEditor.js +1 -1
  120. package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
  121. package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.js +1 -1
  122. package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.js.map +1 -1
  123. package/dist/components/TimeRangeControls/TimeRangeControls.js +1 -1
  124. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
  125. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +1 -1
  126. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  127. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +1 -1
  128. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  129. package/dist/components/Variables/VariableEditorForm/VariablePreview.js +1 -1
  130. package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
  131. package/dist/components/Variables/variable-model.d.ts +9 -1
  132. package/dist/components/Variables/variable-model.d.ts.map +1 -1
  133. package/dist/components/Variables/variable-model.js +117 -31
  134. package/dist/components/Variables/variable-model.js.map +1 -1
  135. package/dist/components/index.d.ts +1 -0
  136. package/dist/components/index.d.ts.map +1 -1
  137. package/dist/components/index.js +1 -0
  138. package/dist/components/index.js.map +1 -1
  139. package/dist/context/ValidationProvider.d.ts +4 -2
  140. package/dist/context/ValidationProvider.d.ts.map +1 -1
  141. package/dist/context/ValidationProvider.js +10 -4
  142. package/dist/context/ValidationProvider.js.map +1 -1
  143. package/dist/model/alerts-queries.d.ts +33 -0
  144. package/dist/model/alerts-queries.d.ts.map +1 -0
  145. package/dist/model/alerts-queries.js +15 -0
  146. package/dist/model/alerts-queries.js.map +1 -0
  147. package/dist/model/annotations.d.ts +28 -0
  148. package/dist/model/annotations.d.ts.map +1 -0
  149. package/dist/model/annotations.js +17 -0
  150. package/dist/model/annotations.js.map +1 -0
  151. package/dist/model/datasource.d.ts +1 -8
  152. package/dist/model/datasource.d.ts.map +1 -1
  153. package/dist/model/datasource.js +1 -1
  154. package/dist/model/datasource.js.map +1 -1
  155. package/dist/model/index.d.ts +3 -0
  156. package/dist/model/index.d.ts.map +1 -1
  157. package/dist/model/index.js +3 -0
  158. package/dist/model/index.js.map +1 -1
  159. package/dist/model/log-queries.d.ts +2 -1
  160. package/dist/model/log-queries.d.ts.map +1 -1
  161. package/dist/model/log-queries.js.map +1 -1
  162. package/dist/model/plugin-loading.d.ts.map +1 -1
  163. package/dist/model/plugin-loading.js +24 -8
  164. package/dist/model/plugin-loading.js.map +1 -1
  165. package/dist/model/plugins.d.ts +23 -0
  166. package/dist/model/plugins.d.ts.map +1 -1
  167. package/dist/model/plugins.js +4 -1
  168. package/dist/model/plugins.js.map +1 -1
  169. package/dist/model/silences-queries.d.ts +33 -0
  170. package/dist/model/silences-queries.d.ts.map +1 -0
  171. package/dist/model/silences-queries.js +15 -0
  172. package/dist/model/silences-queries.js.map +1 -0
  173. package/dist/model/trace-queries.d.ts +2 -3
  174. package/dist/model/trace-queries.d.ts.map +1 -1
  175. package/dist/model/trace-queries.js.map +1 -1
  176. package/dist/remote/PersesPlugin.types.d.ts +2 -0
  177. package/dist/remote/PersesPlugin.types.d.ts.map +1 -1
  178. package/dist/remote/PersesPlugin.types.js.map +1 -1
  179. package/dist/remote/PluginLoaderComponent.js +1 -1
  180. package/dist/remote/PluginLoaderComponent.js.map +1 -1
  181. package/dist/remote/PluginRuntime.d.ts +7 -1
  182. package/dist/remote/PluginRuntime.d.ts.map +1 -1
  183. package/dist/remote/PluginRuntime.js +46 -10
  184. package/dist/remote/PluginRuntime.js.map +1 -1
  185. package/dist/remote/remotePluginLoader.d.ts.map +1 -1
  186. package/dist/remote/remotePluginLoader.js +28 -5
  187. package/dist/remote/remotePluginLoader.js.map +1 -1
  188. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
  189. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +35 -26
  190. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
  191. package/dist/runtime/DataQueriesProvider/model.d.ts +4 -4
  192. package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
  193. package/dist/runtime/DataQueriesProvider/model.js +0 -82
  194. package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
  195. package/dist/runtime/RouterProvider.js +1 -1
  196. package/dist/runtime/RouterProvider.js.map +1 -1
  197. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +1 -1
  198. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
  199. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +1 -1
  200. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js.map +1 -1
  201. package/dist/runtime/UsageMetricsProvider.js +2 -2
  202. package/dist/runtime/UsageMetricsProvider.js.map +1 -1
  203. package/dist/runtime/alerts-queries.d.ts +11 -0
  204. package/dist/runtime/alerts-queries.d.ts.map +1 -0
  205. package/dist/runtime/alerts-queries.js +89 -0
  206. package/dist/runtime/alerts-queries.js.map +1 -0
  207. package/dist/runtime/annotations.d.ts +6 -0
  208. package/dist/runtime/annotations.d.ts.map +1 -0
  209. package/dist/runtime/annotations.js +129 -0
  210. package/dist/runtime/annotations.js.map +1 -0
  211. package/dist/runtime/datasources.d.ts +6 -0
  212. package/dist/runtime/datasources.d.ts.map +1 -1
  213. package/dist/runtime/datasources.js.map +1 -1
  214. package/dist/runtime/index.d.ts +3 -1
  215. package/dist/runtime/index.d.ts.map +1 -1
  216. package/dist/runtime/index.js +3 -1
  217. package/dist/runtime/index.js.map +1 -1
  218. package/dist/runtime/item-actions.js +1 -1
  219. package/dist/runtime/item-actions.js.map +1 -1
  220. package/dist/runtime/log-queries.js +4 -1
  221. package/dist/runtime/log-queries.js.map +1 -1
  222. package/dist/runtime/plugin-registry.d.ts +2 -2
  223. package/dist/runtime/plugin-registry.d.ts.map +1 -1
  224. package/dist/runtime/plugin-registry.js +12 -3
  225. package/dist/runtime/plugin-registry.js.map +1 -1
  226. package/dist/runtime/profile-queries.js +4 -1
  227. package/dist/runtime/profile-queries.js.map +1 -1
  228. package/dist/runtime/silences-queries.d.ts +11 -0
  229. package/dist/runtime/silences-queries.d.ts.map +1 -0
  230. package/dist/runtime/silences-queries.js +89 -0
  231. package/dist/runtime/silences-queries.js.map +1 -0
  232. package/dist/runtime/time-series-queries.js +4 -1
  233. package/dist/runtime/time-series-queries.js.map +1 -1
  234. package/dist/runtime/trace-queries.js +4 -1
  235. package/dist/runtime/trace-queries.js.map +1 -1
  236. package/dist/test/mock-data.d.ts +3 -1
  237. package/dist/test/mock-data.d.ts.map +1 -1
  238. package/dist/test/mock-data.js +45 -0
  239. package/dist/test/mock-data.js.map +1 -1
  240. package/dist/test/render.js +1 -1
  241. package/dist/test/render.js.map +1 -1
  242. package/dist/test/test-plugins/bert/index.d.ts +12 -6
  243. package/dist/test/test-plugins/bert/index.d.ts.map +1 -1
  244. package/dist/test/test-plugins/bert/index.js +6 -2
  245. package/dist/test/test-plugins/bert/index.js.map +1 -1
  246. package/dist/test/test-plugins/ernie/index.d.ts +8 -6
  247. package/dist/test/test-plugins/ernie/index.d.ts.map +1 -1
  248. package/dist/test/test-plugins/ernie/index.js +6 -2
  249. package/dist/test/test-plugins/ernie/index.js.map +1 -1
  250. package/dist/test/test-plugins/index.js +2 -2
  251. package/dist/test/test-plugins/index.js.map +1 -1
  252. package/dist/test/utils.js +1 -1
  253. package/dist/test/utils.js.map +1 -1
  254. package/dist/test-utils/mock-plugin-registry.d.ts.map +1 -1
  255. package/dist/test-utils/mock-plugin-registry.js +8 -2
  256. package/dist/test-utils/mock-plugin-registry.js.map +1 -1
  257. package/package.json +7 -6
  258. package/dist/cjs/runtime/QueryCountProvider.js +0 -83
  259. package/dist/runtime/QueryCountProvider.d.ts +0 -9
  260. package/dist/runtime/QueryCountProvider.d.ts.map +0 -1
  261. package/dist/runtime/QueryCountProvider.js.map +0 -1
@@ -29,7 +29,11 @@ const _ChevronRight = /*#__PURE__*/ _interop_require_default(require("mdi-materi
29
29
  const _react = require("react");
30
30
  const _Alert = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Alert"));
31
31
  const _components = require("@perses-dev/components");
32
+ const _Pencil = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Pencil"));
33
+ const _Check = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Check"));
34
+ const _Close = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Close"));
32
35
  const _PluginEditor = require("../PluginEditor");
36
+ const _utils = require("./utils");
33
37
  function _interop_require_default(obj) {
34
38
  return obj && obj.__esModule ? obj : {
35
39
  default: obj
@@ -37,6 +41,16 @@ function _interop_require_default(obj) {
37
41
  }
38
42
  const QueryEditorContainer = /*#__PURE__*/ (0, _react.forwardRef)((props, ref)=>{
39
43
  const { queryTypes, index, query, queryResult, filteredQueryPlugins, isCollapsed, onDelete, onChange, onQueryRun, onCollapseExpand } = props;
44
+ // The displayed name is always derived from props so it stays in sync with the
45
+ // current query/index, even when queries are added, removed or reordered.
46
+ const displayedName = query.spec.name ?? (0, _utils.defaultQueryName)(index);
47
+ const [isEditingName, setIsEditingName] = (0, _react.useState)(false);
48
+ function handleNameSave(name) {
49
+ setIsEditingName(false);
50
+ onChange(index, (0, _immer.produce)(query, (draft)=>{
51
+ draft.spec.name = name;
52
+ }));
53
+ }
40
54
  return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
41
55
  spacing: 1,
42
56
  children: [
@@ -49,19 +63,40 @@ const QueryEditorContainer = /*#__PURE__*/ (0, _react.forwardRef)((props, ref)=>
49
63
  children: [
50
64
  /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
51
65
  direction: "row",
66
+ gap: 1,
67
+ sx: {
68
+ width: '100%'
69
+ },
52
70
  children: [
53
71
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
54
72
  size: "small",
73
+ sx: {
74
+ width: 'fit-content',
75
+ height: 'fit-content'
76
+ },
55
77
  onClick: ()=>onCollapseExpand(index),
56
78
  children: isCollapsed ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_ChevronRight.default, {}) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_ChevronDown.default, {})
57
79
  }),
58
- /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Typography, {
59
- variant: "overline",
60
- component: "h4",
61
- children: [
62
- "Query #",
63
- index + 1
64
- ]
80
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
81
+ direction: "row",
82
+ gap: 1,
83
+ alignItems: "center",
84
+ alignContent: "center",
85
+ sx: {
86
+ width: '100%',
87
+ '&:hover button': {
88
+ visibility: 'visible'
89
+ }
90
+ },
91
+ children: isEditingName ? /*#__PURE__*/ (0, _jsxruntime.jsx)(QueryNameInput, {
92
+ initialName: displayedName,
93
+ onSave: handleNameSave,
94
+ onCancel: ()=>setIsEditingName(false)
95
+ }, displayedName) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
96
+ variant: "overline",
97
+ component: "h4",
98
+ children: displayedName
99
+ })
65
100
  })
66
101
  ]
67
102
  }),
@@ -105,11 +140,24 @@ const QueryEditorContainer = /*#__PURE__*/ (0, _react.forwardRef)((props, ref)=>
105
140
  ]
106
141
  })
107
142
  }),
108
- onDelete && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
109
- "aria-label": "delete query",
110
- size: "small",
111
- onClick: ()=>onDelete && onDelete(index),
112
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_DeleteOutline.default, {})
143
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
144
+ direction: "row",
145
+ children: [
146
+ !isEditingName && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
147
+ "aria-label": "edit query name",
148
+ size: "small",
149
+ onClick: ()=>setIsEditingName(true),
150
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Pencil.default, {
151
+ fontSize: "small"
152
+ })
153
+ }),
154
+ onDelete && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
155
+ "aria-label": "delete query",
156
+ size: "small",
157
+ onClick: ()=>onDelete && onDelete(index),
158
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_DeleteOutline.default, {})
159
+ })
160
+ ]
113
161
  })
114
162
  ]
115
163
  })
@@ -127,6 +175,43 @@ const QueryEditorContainer = /*#__PURE__*/ (0, _react.forwardRef)((props, ref)=>
127
175
  }, index);
128
176
  });
129
177
  QueryEditorContainer.displayName = 'QueryEditorContainer';
178
+ /**
179
+ * Self-contained input to edit a query name. The draft value is local state seeded from
180
+ * `initialName`; callers reset it by changing the `key` (remounting) rather than syncing
181
+ * with an useEffect.
182
+ */ function QueryNameInput({ initialName, onSave, onCancel }) {
183
+ const [draftName, setDraftName] = (0, _react.useState)(initialName);
184
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
185
+ size: "small",
186
+ variant: "outlined",
187
+ label: "Query name",
188
+ "aria-label": "query name",
189
+ value: draftName,
190
+ onChange: (e)=>setDraftName(e.target.value),
191
+ fullWidth: true,
192
+ InputProps: {
193
+ endAdornment: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.InputAdornment, {
194
+ position: "end",
195
+ children: [
196
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
197
+ size: "small",
198
+ "aria-label": "cancel edit",
199
+ onClick: onCancel,
200
+ edge: "end",
201
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Close.default, {})
202
+ }),
203
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
204
+ size: "small",
205
+ "aria-label": "save query name",
206
+ onClick: ()=>onSave(draftName),
207
+ edge: "end",
208
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Check.default, {})
209
+ })
210
+ ]
211
+ })
212
+ }
213
+ });
214
+ }
130
215
  /**
131
216
  * Editor for a query definition. This component is responsible for rendering the plugin editor for the given query.
132
217
  * This will allow user to select a plugin extending from the given supported query types, and then edit the plugin
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", {
15
15
  value: true
16
16
  });
17
17
  _export_star(require("./MultiQueryEditor"), exports);
18
+ _export_star(require("./utils"), exports);
18
19
  function _export_star(from, to) {
19
20
  Object.keys(from).forEach(function(k) {
20
21
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
@@ -0,0 +1,36 @@
1
+ // Copyright 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: Object.getOwnPropertyDescriptor(all, name).get
21
+ });
22
+ }
23
+ _export(exports, {
24
+ get defaultQueryName () {
25
+ return defaultQueryName;
26
+ },
27
+ get generateQueryNames () {
28
+ return generateQueryNames;
29
+ }
30
+ });
31
+ function defaultQueryName(index) {
32
+ return `Query #${index + 1}`;
33
+ }
34
+ function generateQueryNames(definitions) {
35
+ return definitions.map((queryDef, index)=>queryDef.spec.name ?? defaultQueryName(index));
36
+ }
@@ -109,11 +109,8 @@ const PanelSpecEditor = /*#__PURE__*/ (0, _react.forwardRef)((props, ref)=>{
109
109
  })
110
110
  })
111
111
  });
112
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_runtime.QueryCountProvider, {
113
- queryCount: (panelDefinition.spec.queries ?? []).length,
114
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_OptionsEditorTabs.OptionsEditorTabs, {
115
- tabs: tabs
116
- }, tabs.length)
117
- });
112
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_OptionsEditorTabs.OptionsEditorTabs, {
113
+ tabs: tabs
114
+ }, tabs.length);
118
115
  });
119
116
  PanelSpecEditor.displayName = 'PanelSpecEditor';
@@ -25,6 +25,7 @@ const _react = require("react");
25
25
  const _runtime = require("../../runtime");
26
26
  const _utils = require("../../utils");
27
27
  const _pluginindexes = require("./plugin-indexes");
28
+ const _getPluginSearchHelper = require("./getPluginSearchHelper");
28
29
  function PluginRegistry(props) {
29
30
  const { pluginLoader: { getInstalledPlugins, importPluginModule }, children, defaultPluginKinds } = props;
30
31
  const getPluginIndexes = (0, _pluginindexes.usePluginIndexes)(getInstalledPlugins);
@@ -42,23 +43,18 @@ function PluginRegistry(props) {
42
43
  }
43
44
  return request;
44
45
  });
45
- const getPlugin = (0, _react.useCallback)(async (kind, name)=>{
46
- // Get the indexes of the installed plugins
46
+ const getPlugin = (0, _react.useCallback)(async (compoundKeyObj)=>{
47
47
  const pluginIndexes = await getPluginIndexes();
48
- // Figure out what module the plugin is in by looking in the index
49
- const typeAndKindKey = (0, _pluginindexes.getTypeAndKindKey)(kind, name);
50
- const resource = pluginIndexes.pluginResourcesByNameAndKind.get(typeAndKindKey);
51
- if (resource === undefined) {
52
- throw new Error(`A ${name} plugin for kind '${kind}' is not installed`);
48
+ const { kind, name } = compoundKeyObj;
49
+ const candidateKeys = (0, _getPluginSearchHelper.resolvePluginKeys)(pluginIndexes.pluginResourcesByNameKindRegistryVersion.keys(), compoundKeyObj);
50
+ for (const resourceKey of candidateKeys){
51
+ const resource = pluginIndexes.pluginResourcesByNameKindRegistryVersion.get(resourceKey);
52
+ if (!resource) continue;
53
+ const pluginModule = await loadPluginModule(resource);
54
+ const plugin = pluginModule?.[resourceKey];
55
+ if (plugin) return plugin;
53
56
  }
54
- // Treat the plugin module as a bunch of named exports that have plugins
55
- const pluginModule = await loadPluginModule(resource);
56
- // We currently assume that plugin modules will have named exports that match the kinds they handle
57
- const plugin = pluginModule[name];
58
- if (plugin === undefined) {
59
- throw new Error(`The ${name} plugin for kind '${kind}' is missing from the ${resource.metadata.name} plugin module`);
60
- }
61
- return plugin;
57
+ throw new Error(`A ${name} plugin for kind '${kind}' is not installed`);
62
58
  }, [
63
59
  getPluginIndexes,
64
60
  loadPluginModule
@@ -0,0 +1,92 @@
1
+ // Copyright 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, "resolvePluginKeys", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return resolvePluginKeys;
21
+ }
22
+ });
23
+ const _semver = require("semver");
24
+ const _model = require("../../model");
25
+ const PLUGIN_LOOKUP_PRECEDENCE_LOGIC = {
26
+ registryOverVersion: false
27
+ };
28
+ const resolvePluginKeys = (allKeys, query, precedenceLogic = PLUGIN_LOOKUP_PRECEDENCE_LOGIC)=>{
29
+ const { kind, name, version, registry } = query;
30
+ const candidates = [];
31
+ // Exact match first when version or registry is specified
32
+ if (version || registry) {
33
+ candidates.push((0, _model.getPluginModuleCompoundKey)({
34
+ kind,
35
+ name,
36
+ registry,
37
+ version
38
+ }));
39
+ }
40
+ const latestWithRegistry = {
41
+ key: '',
42
+ version: ''
43
+ };
44
+ const latestWithoutRegistry = {
45
+ key: '',
46
+ version: ''
47
+ };
48
+ const prefix = `${kind}:${name}:`;
49
+ for (const key of allKeys){
50
+ if (!key.startsWith(prefix)) continue;
51
+ const split = key.split(':');
52
+ if (split.length !== 4) {
53
+ console.warn(`An invalid Plugin Resource key detected during default plugin lookup: ${key}`);
54
+ continue;
55
+ }
56
+ const [, , reg, ver] = split;
57
+ if (!ver) {
58
+ console.warn(`An invalid Plugin Resource key detected during default plugin lookup: ${key}`);
59
+ continue;
60
+ }
61
+ if (reg) {
62
+ if (!latestWithRegistry.key || (0, _semver.gt)(ver, latestWithRegistry.version)) {
63
+ latestWithRegistry.key = key;
64
+ latestWithRegistry.version = ver;
65
+ }
66
+ } else {
67
+ if (!latestWithoutRegistry.key || (0, _semver.gt)(ver, latestWithoutRegistry.version)) {
68
+ latestWithoutRegistry.key = key;
69
+ latestWithoutRegistry.version = ver;
70
+ }
71
+ }
72
+ }
73
+ // Determine the best fallback key from the two buckets
74
+ let fallbackKey;
75
+ if (latestWithRegistry.key && latestWithoutRegistry.key) {
76
+ const { registryOverVersion } = precedenceLogic;
77
+ if ((0, _semver.gt)(latestWithRegistry.version, latestWithoutRegistry.version)) {
78
+ fallbackKey = latestWithRegistry.key;
79
+ } else if ((0, _semver.gt)(latestWithoutRegistry.version, latestWithRegistry.version)) {
80
+ fallbackKey = latestWithoutRegistry.key;
81
+ } else {
82
+ // Versions are equal — use the tie-breaker
83
+ fallbackKey = registryOverVersion ? latestWithRegistry.key : latestWithoutRegistry.key;
84
+ }
85
+ } else {
86
+ fallbackKey = latestWithRegistry.key || latestWithoutRegistry.key || undefined;
87
+ }
88
+ if (fallbackKey && !candidates.includes(fallbackKey)) {
89
+ candidates.push(fallbackKey);
90
+ }
91
+ return candidates;
92
+ };
@@ -21,14 +21,15 @@ function _export(target, all) {
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
- get getTypeAndKindKey () {
25
- return getTypeAndKindKey;
24
+ get getPluginModuleCompoundKey () {
25
+ return _model.getPluginModuleCompoundKey;
26
26
  },
27
27
  get usePluginIndexes () {
28
28
  return usePluginIndexes;
29
29
  }
30
30
  });
31
31
  const _react = require("react");
32
+ const _model = require("../../model");
32
33
  const _utils = require("../../utils");
33
34
  function usePluginIndexes(getInstalledPlugins) {
34
35
  // Creates indexes from the installed plugins data (does useEvent because this accesses the getInstalledPlugins prop
@@ -36,17 +37,22 @@ function usePluginIndexes(getInstalledPlugins) {
36
37
  const createPluginIndexes = (0, _utils.useEvent)(async ()=>{
37
38
  const installedPlugins = await getInstalledPlugins();
38
39
  // Create the two indexes from the installed plugins
39
- const pluginResourcesByNameAndKind = new Map();
40
+ const pluginResourcesByNameKindRegistryVersion = new Map();
40
41
  const pluginMetadataByKind = new Map();
41
42
  for (const resource of installedPlugins){
43
+ const { metadata: { version, registry } } = resource;
42
44
  for (const pluginMetadata of resource.spec.plugins){
43
45
  const { kind, spec: { name } } = pluginMetadata;
44
- // Index the plugin by type and kind to point at the module that contains it
45
- const key = getTypeAndKindKey(kind, name);
46
- if (pluginResourcesByNameAndKind.has(key)) {
47
- console.warn(`Got more than one ${kind} plugin for kind ${name}`);
46
+ const key = (0, _model.getPluginModuleCompoundKey)({
47
+ kind,
48
+ name,
49
+ registry,
50
+ version
51
+ });
52
+ if (pluginResourcesByNameKindRegistryVersion.has(key)) {
53
+ console.warn(`Got more than one ${kind} plugin for kind ${name}, registry '${registry || 'undefined'}', and version '${version || 'undefined'}'`);
48
54
  }
49
- pluginResourcesByNameAndKind.set(key, resource);
55
+ pluginResourcesByNameKindRegistryVersion.set(key, resource);
50
56
  // Index the metadata by plugin type
51
57
  let list = pluginMetadataByKind.get(kind);
52
58
  if (list === undefined) {
@@ -60,7 +66,7 @@ function usePluginIndexes(getInstalledPlugins) {
60
66
  }
61
67
  }
62
68
  return {
63
- pluginResourcesByNameAndKind,
69
+ pluginResourcesByNameKindRegistryVersion,
64
70
  pluginMetadataByKind
65
71
  };
66
72
  });
@@ -72,7 +78,7 @@ function usePluginIndexes(getInstalledPlugins) {
72
78
  request = createPluginIndexes();
73
79
  pluginIndexesCache.current = request;
74
80
  // Remove failed requests from the cache so they can potentially be retried
75
- request.catch(()=>pluginIndexesCache.current === undefined);
81
+ request.catch(()=>pluginIndexesCache.current = undefined);
76
82
  }
77
83
  return request;
78
84
  }, [
@@ -80,6 +86,3 @@ function usePluginIndexes(getInstalledPlugins) {
80
86
  ]);
81
87
  return getPluginIndexes;
82
88
  }
83
- function getTypeAndKindKey(kind, name) {
84
- return `${kind}:${name}`;
85
- }
@@ -32,9 +32,13 @@ _export(exports, {
32
32
  },
33
33
  get useListVariablePluginValues () {
34
34
  return useListVariablePluginValues;
35
+ },
36
+ get useResolveListVariableValues () {
37
+ return useResolveListVariableValues;
35
38
  }
36
39
  });
37
40
  const _reactquery = require("@tanstack/react-query");
41
+ const _react = require("react");
38
42
  const _runtime = require("../../runtime");
39
43
  function filterVariableList(data, capturedRegexp) {
40
44
  const result = [];
@@ -61,54 +65,136 @@ function filterVariableList(data, capturedRegexp) {
61
65
  }
62
66
  return result;
63
67
  }
64
- function useListVariablePluginValues(definition) {
65
- const { data: variablePlugin } = (0, _runtime.usePlugin)('Variable', definition.spec.plugin.kind);
68
+ function useVariablePluginContext() {
66
69
  const datasourceStore = (0, _runtime.useDatasourceStore)();
67
70
  const allVariables = (0, _runtime.useAllVariableValues)();
68
71
  const { absoluteTimeRange: timeRange } = (0, _runtime.useTimeRange)();
69
- const variablePluginCtx = {
72
+ return {
70
73
  timeRange,
71
74
  datasourceStore,
72
75
  variables: allVariables
73
76
  };
74
- const spec = definition.spec.plugin.spec;
77
+ }
78
+ const getVariableQueryConfig = (definition, variablePluginCtx, variablePlugin, enabled, onFetched)=>{
75
79
  const capturingRegexp = definition.spec.capturingRegexp !== undefined ? new RegExp(definition.spec.capturingRegexp, 'g') : undefined;
76
- let dependsOnVariables = Object.keys(allVariables); // Default to all variables
77
- if (variablePlugin?.dependsOn) {
78
- const dependencies = variablePlugin.dependsOn(spec, variablePluginCtx);
79
- dependsOnVariables = dependencies.variables ? dependencies.variables : dependsOnVariables;
80
- }
81
- // Exclude self variable to avoid circular dependency
82
- dependsOnVariables = dependsOnVariables.filter((v)=>v !== definition.spec.name);
83
- const variables = (0, _runtime.useAllVariableValues)(dependsOnVariables);
84
- let waitToLoad = false;
85
- if (dependsOnVariables) {
86
- waitToLoad = dependsOnVariables.some((v)=>variables[v]?.loading);
87
- }
88
- const variablesValueKey = getVariableValuesKey(variables);
89
- return (0, _reactquery.useQuery)({
80
+ const variablesValueKey = getVariableValuesKey(variablePluginCtx.variables);
81
+ return {
90
82
  queryKey: [
91
83
  'variable',
92
84
  definition,
93
- timeRange,
85
+ variablePluginCtx.timeRange,
94
86
  variablesValueKey
95
87
  ],
96
88
  queryFn: async ({ signal })=>{
97
- const resp = await variablePlugin?.getVariableOptions(spec, {
98
- datasourceStore,
99
- variables,
100
- timeRange
101
- }, signal);
89
+ const resp = await variablePlugin?.getVariableOptions(definition.spec.plugin.spec, variablePluginCtx, signal);
102
90
  if (!resp?.data?.length) {
91
+ onFetched?.(definition.spec.name, [], definition);
103
92
  return [];
104
93
  }
105
- if (!capturingRegexp) {
106
- return resp.data;
107
- }
108
- return filterVariableList(resp.data, capturingRegexp);
94
+ const options = capturingRegexp ? filterVariableList(resp.data, capturingRegexp) : resp.data;
95
+ onFetched?.(definition.spec.name, options, definition);
96
+ return options;
109
97
  },
110
- enabled: !!variablePlugin || waitToLoad
98
+ enabled
99
+ };
100
+ };
101
+ function resolveDependsOnVariables(variablePlugin, variablePluginCtx, definition) {
102
+ if (variablePlugin?.dependsOn) {
103
+ const dependencies = variablePlugin.dependsOn(definition.spec.plugin.spec, variablePluginCtx);
104
+ return dependencies.variables ? dependencies.variables.filter((v)=>v !== definition.spec.name) : []; // Exclude self variable to avoid circular dependency and default to empty array to avoid deadlock
105
+ }
106
+ return [];
107
+ }
108
+ function useListVariablePluginValues(definition) {
109
+ const { data: variablePlugin } = (0, _runtime.usePlugin)('Variable', definition.spec.plugin.kind);
110
+ const variablePluginCtx = useVariablePluginContext();
111
+ const dependsOnVariables = resolveDependsOnVariables(variablePlugin, variablePluginCtx, definition);
112
+ const dependentVariables = (0, _runtime.useAllVariableValues)(dependsOnVariables);
113
+ const waitToLoad = dependsOnVariables.some((v)=>dependentVariables[v]?.loading);
114
+ const ctx = {
115
+ ...variablePluginCtx,
116
+ variables: dependentVariables
117
+ };
118
+ return (0, _reactquery.useQuery)(getVariableQueryConfig(definition, ctx, variablePlugin, !!variablePlugin && !waitToLoad));
119
+ }
120
+ function resolveDefaultValue(definition, options) {
121
+ const { defaultValue, allowMultiple } = definition.spec;
122
+ if (defaultValue !== undefined && defaultValue !== null) {
123
+ return defaultValue;
124
+ }
125
+ if (options[0]?.value) {
126
+ const first = options[0].value;
127
+ return allowMultiple ? [
128
+ first
129
+ ] : first;
130
+ }
131
+ return allowMultiple ? [] : '';
132
+ }
133
+ function useResolveListVariableValues(variableDefinitions) {
134
+ const { timeRange, datasourceStore, variables: outerVariableValues } = useVariablePluginContext();
135
+ const listVariables = (0, _react.useMemo)(()=>variableDefinitions.filter((v)=>v.kind === 'ListVariable'), [
136
+ variableDefinitions
137
+ ]);
138
+ const pluginResults = (0, _runtime.usePlugins)('Variable', listVariables.map((d)=>({
139
+ kind: d.spec.plugin.kind
140
+ })));
141
+ // Resolved variable state. Updated by onFetched when queries resolve.
142
+ // Needed because of dependencies between variables that require multiple rounds of fetching.
143
+ const [resolvedVariables, setResolvedVariables] = (0, _react.useState)({});
144
+ const allVariables = (0, _react.useMemo)(()=>{
145
+ return {
146
+ ...outerVariableValues,
147
+ ...resolvedVariables
148
+ };
149
+ }, [
150
+ outerVariableValues,
151
+ resolvedVariables
152
+ ]);
153
+ const onFetched = (0, _react.useCallback)((name, options, definition)=>{
154
+ setResolvedVariables((prev)=>({
155
+ ...prev,
156
+ [name]: {
157
+ value: resolveDefaultValue(definition, options),
158
+ loading: false,
159
+ options
160
+ }
161
+ }));
162
+ }, []);
163
+ const queryResults = (0, _reactquery.useQueries)({
164
+ queries: listVariables.map((definition, index)=>{
165
+ const plugin = pluginResults[index]?.data;
166
+ const isPluginLoading = pluginResults[index]?.isLoading ?? true;
167
+ const dependsOn = resolveDependsOnVariables(plugin, {
168
+ timeRange,
169
+ datasourceStore,
170
+ variables: allVariables
171
+ }, definition);
172
+ const hasPendingDeps = dependsOn.some((v)=>resolvedVariables[v] === undefined && listVariables.some((lv)=>lv.spec.name === v) || allVariables[v]?.loading);
173
+ const dependentVariables = {};
174
+ for (const v of dependsOn){
175
+ const state = allVariables[v];
176
+ if (state) {
177
+ dependentVariables[v] = state;
178
+ }
179
+ }
180
+ const ctx = {
181
+ timeRange,
182
+ datasourceStore,
183
+ variables: dependentVariables
184
+ };
185
+ return getVariableQueryConfig(definition, ctx, plugin, !hasPendingDeps && !isPluginLoading, onFetched);
186
+ })
111
187
  });
188
+ const initialVariableValues = (0, _react.useMemo)(()=>Object.fromEntries(Object.entries(allVariables).filter(([, state])=>state?.value !== undefined).map(([name, state])=>[
189
+ name,
190
+ state.value
191
+ ])), [
192
+ allVariables
193
+ ]);
194
+ return {
195
+ initialVariableValues,
196
+ isLoading: queryResults.some((r)=>r.isLoading)
197
+ };
112
198
  }
113
199
  function getVariableValuesKey(v) {
114
200
  return Object.values(v).map((v)=>JSON.stringify(v.value)).join(',');
@@ -14,6 +14,7 @@
14
14
  Object.defineProperty(exports, "__esModule", {
15
15
  value: true
16
16
  });
17
+ _export_star(require("./Annotations"), exports);
17
18
  _export_star(require("./CalculationSelector"), exports);
18
19
  _export_star(require("./DatasourceEditorForm"), exports);
19
20
  _export_star(require("./DatasourceSelect"), exports);
@@ -34,7 +34,7 @@ _export(exports, {
34
34
  const _jsxruntime = require("react/jsx-runtime");
35
35
  const _react = require("react");
36
36
  const _spec = require("@perses-dev/spec");
37
- const _core = require("@perses-dev/core");
37
+ const _client = require("@perses-dev/client");
38
38
  const ValidationSchemasContext = /*#__PURE__*/ (0, _react.createContext)(undefined);
39
39
  function useValidationSchemas() {
40
40
  const ctx = (0, _react.useContext)(ValidationSchemasContext);
@@ -44,11 +44,12 @@ function useValidationSchemas() {
44
44
  return ctx;
45
45
  }
46
46
  function ValidationProvider({ children }) {
47
- const [datasourceEditorSchema, setDatasourceEditorSchema] = (0, _react.useState)(_core.datasourceDefinitionSchema);
47
+ const [datasourceEditorSchema, setDatasourceEditorSchema] = (0, _react.useState)(_client.datasourceDefinitionSchema);
48
48
  const [panelEditorSchema, setPanelEditorSchema] = (0, _react.useState)(_spec.panelEditorSchema); // TODO I don't get why this does not compile
49
49
  const [variableEditorSchema, setVariableEditorSchema] = (0, _react.useState)(_spec.variableDefinitionSchema);
50
+ const [annotationEditorSchema, setAnnotationEditorSchema] = (0, _react.useState)(_spec.annotationSpecSchema);
50
51
  function setDatasourceEditorSchemaPlugin(pluginSchema) {
51
- setDatasourceEditorSchema((0, _core.buildDatasourceDefinitionSchema)(pluginSchema));
52
+ setDatasourceEditorSchema((0, _client.buildDatasourceDefinitionSchema)(pluginSchema));
52
53
  }
53
54
  function setPanelEditorSchemaPlugin(pluginSchema) {
54
55
  setPanelEditorSchema((0, _spec.buildPanelEditorSchema)(pluginSchema));
@@ -56,14 +57,19 @@ function ValidationProvider({ children }) {
56
57
  function setVariableEditorSchemaPlugin(pluginSchema) {
57
58
  setVariableEditorSchema((0, _spec.buildVariableDefinitionSchema)(pluginSchema));
58
59
  }
60
+ function setAnnotationEditorSchemaPlugin(pluginSchema) {
61
+ setAnnotationEditorSchema((0, _spec.buildAnnotationSpecSchema)(pluginSchema));
62
+ }
59
63
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(ValidationSchemasContext.Provider, {
60
64
  value: {
61
65
  datasourceEditorSchema,
62
66
  panelEditorSchema,
63
67
  variableEditorSchema,
68
+ annotationEditorSchema,
64
69
  setDatasourceEditorSchemaPlugin,
65
70
  setPanelEditorSchemaPlugin,
66
- setVariableEditorSchemaPlugin
71
+ setVariableEditorSchemaPlugin,
72
+ setAnnotationEditorSchemaPlugin
67
73
  },
68
74
  children: children
69
75
  });