@perses-dev/plugin-system 0.38.0 → 0.40.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 (274) 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 +380 -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 +69 -0
  9. package/dist/cjs/components/OptionsEditorRadios/index.js +30 -0
  10. package/dist/cjs/components/{OptionsEditorTabs/TabPanel.js → OptionsEditorTabPanel/OptionsEditorTabPanel.js} +8 -6
  11. package/dist/cjs/components/OptionsEditorTabPanel/index.js +30 -0
  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 +256 -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 -18
  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 +55 -35
  45. package/dist/cjs/runtime/DataQueriesProvider/index.js +11 -9
  46. package/dist/cjs/runtime/DataQueriesProvider/model.js +61 -0
  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 +96 -4
  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 -8
  65. package/dist/cjs/test/mock-data.js +57 -0
  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 +333 -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 +16 -0
  97. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts.map +1 -0
  98. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +61 -0
  99. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -0
  100. package/dist/components/OptionsEditorRadios/index.d.ts +2 -0
  101. package/dist/components/OptionsEditorRadios/index.d.ts.map +1 -0
  102. package/dist/components/OptionsEditorRadios/index.js +15 -0
  103. package/dist/components/OptionsEditorRadios/index.js.map +1 -0
  104. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts +9 -0
  105. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts.map +1 -0
  106. package/dist/components/{OptionsEditorTabs/TabPanel.js → OptionsEditorTabPanel/OptionsEditorTabPanel.js} +2 -2
  107. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -0
  108. package/dist/components/OptionsEditorTabPanel/index.d.ts +2 -0
  109. package/dist/components/OptionsEditorTabPanel/index.d.ts.map +1 -0
  110. package/dist/components/OptionsEditorTabPanel/index.js +15 -0
  111. package/dist/components/OptionsEditorTabPanel/index.js.map +1 -0
  112. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +2 -2
  113. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
  114. package/dist/components/OptionsEditorTabs/index.js.map +1 -1
  115. package/dist/components/PanelSpecEditor/PanelSpecEditor.js +2 -2
  116. package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
  117. package/dist/components/PanelSpecEditor/index.js.map +1 -1
  118. package/dist/components/PluginEditor/PluginEditor.js +15 -24
  119. package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
  120. package/dist/components/PluginEditor/index.js.map +1 -1
  121. package/dist/components/PluginEditor/plugin-editor-api.d.ts +1 -1
  122. package/dist/components/PluginEditor/plugin-editor-api.js +2 -2
  123. package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
  124. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +3 -3
  125. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts.map +1 -1
  126. package/dist/components/PluginKindSelect/PluginKindSelect.js +21 -12
  127. package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
  128. package/dist/components/PluginKindSelect/index.js.map +1 -1
  129. package/dist/components/PluginRegistry/PluginRegistry.js +3 -3
  130. package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
  131. package/dist/components/PluginRegistry/index.js.map +1 -1
  132. package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
  133. package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
  134. package/dist/components/PluginSpecEditor/index.js.map +1 -1
  135. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +4 -4
  136. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js.map +1 -1
  137. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +1 -1
  138. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js.map +1 -1
  139. package/dist/components/TimeSeriesQueryEditor/index.js.map +1 -1
  140. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +10 -7
  141. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  142. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +200 -112
  143. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  144. package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
  145. package/dist/components/Variables/VariableEditorForm/index.js.map +1 -1
  146. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +5 -4
  147. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
  148. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +22 -30
  149. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
  150. package/dist/components/Variables/index.js.map +1 -1
  151. package/dist/components/Variables/variable-model.js +3 -3
  152. package/dist/components/Variables/variable-model.js.map +1 -1
  153. package/dist/components/index.d.ts +2 -0
  154. package/dist/components/index.d.ts.map +1 -1
  155. package/dist/components/index.js +2 -0
  156. package/dist/components/index.js.map +1 -1
  157. package/dist/constants/index.js.map +1 -1
  158. package/dist/constants/user-interface-text.js.map +1 -1
  159. package/dist/index.d.ts +1 -0
  160. package/dist/index.d.ts.map +1 -1
  161. package/dist/index.js +1 -0
  162. package/dist/index.js.map +1 -1
  163. package/dist/model/datasource.d.ts +2 -1
  164. package/dist/model/datasource.d.ts.map +1 -1
  165. package/dist/model/datasource.js.map +1 -1
  166. package/dist/model/index.js.map +1 -1
  167. package/dist/model/legend.d.ts +1 -1
  168. package/dist/model/legend.d.ts.map +1 -1
  169. package/dist/model/legend.js +14 -14
  170. package/dist/model/legend.js.map +1 -1
  171. package/dist/model/panels.js.map +1 -1
  172. package/dist/model/plugin-base.js.map +1 -1
  173. package/dist/model/plugin-loading.js.map +1 -1
  174. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts +5 -5
  175. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
  176. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +40 -28
  177. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
  178. package/dist/runtime/DataQueriesProvider/index.js.map +1 -1
  179. package/dist/runtime/DataQueriesProvider/model.d.ts +17 -12
  180. package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
  181. package/dist/runtime/DataQueriesProvider/model.js +47 -1
  182. package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
  183. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
  184. package/dist/runtime/TimeRangeProvider/index.js.map +1 -1
  185. package/dist/runtime/TimeRangeProvider/query-params.js +1 -1
  186. package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
  187. package/dist/runtime/builtin-variables.d.ts +11 -0
  188. package/dist/runtime/builtin-variables.d.ts.map +1 -0
  189. package/dist/runtime/builtin-variables.js +59 -0
  190. package/dist/runtime/builtin-variables.js.map +1 -0
  191. package/dist/runtime/datasources.d.ts +14 -6
  192. package/dist/runtime/datasources.d.ts.map +1 -1
  193. package/dist/runtime/datasources.js +13 -6
  194. package/dist/runtime/datasources.js.map +1 -1
  195. package/dist/runtime/index.d.ts +1 -0
  196. package/dist/runtime/index.d.ts.map +1 -1
  197. package/dist/runtime/index.js +1 -0
  198. package/dist/runtime/index.js.map +1 -1
  199. package/dist/runtime/plugin-registry.d.ts +2 -0
  200. package/dist/runtime/plugin-registry.d.ts.map +1 -1
  201. package/dist/runtime/plugin-registry.js +19 -2
  202. package/dist/runtime/plugin-registry.js.map +1 -1
  203. package/dist/runtime/template-variables.d.ts +62 -2
  204. package/dist/runtime/template-variables.d.ts.map +1 -1
  205. package/dist/runtime/template-variables.js +83 -1
  206. package/dist/runtime/template-variables.js.map +1 -1
  207. package/dist/runtime/time-series-queries.d.ts +3 -3
  208. package/dist/runtime/time-series-queries.d.ts.map +1 -1
  209. package/dist/runtime/time-series-queries.js +14 -12
  210. package/dist/runtime/time-series-queries.js.map +1 -1
  211. package/dist/stories/shared-utils/decorators/WithDataQueries.js.map +1 -1
  212. package/dist/stories/shared-utils/decorators/WithPluginRegistry.js.map +1 -1
  213. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts +13 -0
  214. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts.map +1 -0
  215. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +39 -0
  216. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js.map +1 -0
  217. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts.map +1 -1
  218. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +11 -7
  219. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js.map +1 -1
  220. package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js.map +1 -1
  221. package/dist/stories/shared-utils/decorators/WithTimeRange.js.map +1 -1
  222. package/dist/stories/shared-utils/decorators/index.d.ts +1 -0
  223. package/dist/stories/shared-utils/decorators/index.d.ts.map +1 -1
  224. package/dist/stories/shared-utils/decorators/index.js +1 -0
  225. package/dist/stories/shared-utils/decorators/index.js.map +1 -1
  226. package/dist/stories/shared-utils/index.js.map +1 -1
  227. package/dist/test/index.d.ts +1 -0
  228. package/dist/test/index.d.ts.map +1 -1
  229. package/dist/test/index.js +1 -0
  230. package/dist/test/index.js.map +1 -1
  231. package/dist/test/mock-data.d.ts +3 -0
  232. package/dist/test/mock-data.d.ts.map +1 -0
  233. package/dist/test/mock-data.js +49 -0
  234. package/dist/test/mock-data.js.map +1 -0
  235. package/dist/test/render.js +2 -2
  236. package/dist/test/render.js.map +1 -1
  237. package/dist/test/setup-tests.js.map +1 -1
  238. package/dist/test/test-plugins/bert/index.js.map +1 -1
  239. package/dist/test/test-plugins/ernie/index.js.map +1 -1
  240. package/dist/test/test-plugins/index.js.map +1 -1
  241. package/dist/test-utils/index.js.map +1 -1
  242. package/dist/test-utils/mock-plugin-registry.js +2 -2
  243. package/dist/test-utils/mock-plugin-registry.js.map +1 -1
  244. package/dist/utils/action.d.ts +4 -0
  245. package/dist/utils/action.d.ts.map +1 -0
  246. package/dist/utils/action.js +27 -0
  247. package/dist/utils/action.js.map +1 -0
  248. package/dist/utils/index.d.ts +1 -0
  249. package/dist/utils/index.d.ts.map +1 -1
  250. package/dist/utils/index.js +1 -0
  251. package/dist/utils/index.js.map +1 -1
  252. package/dist/utils/variables.d.ts.map +1 -1
  253. package/dist/utils/variables.js +17 -5
  254. package/dist/utils/variables.js.map +1 -1
  255. package/dist/validation/datasource.d.ts +19 -0
  256. package/dist/validation/datasource.d.ts.map +1 -0
  257. package/dist/validation/datasource.js +22 -0
  258. package/dist/validation/datasource.js.map +1 -0
  259. package/dist/validation/index.d.ts +4 -0
  260. package/dist/validation/index.d.ts.map +1 -0
  261. package/dist/validation/index.js +17 -0
  262. package/dist/validation/index.js.map +1 -0
  263. package/dist/validation/resource.d.ts +3 -0
  264. package/dist/validation/resource.d.ts.map +1 -0
  265. package/dist/validation/resource.js +16 -0
  266. package/dist/validation/resource.js.map +1 -0
  267. package/dist/validation/variable.d.ts +19 -0
  268. package/dist/validation/variable.d.ts.map +1 -0
  269. package/dist/validation/variable.js +21 -0
  270. package/dist/validation/variable.js.map +1 -0
  271. package/package.json +8 -6
  272. package/dist/components/OptionsEditorTabs/TabPanel.d.ts +0 -9
  273. package/dist/components/OptionsEditorTabs/TabPanel.d.ts.map +0 -1
  274. package/dist/components/OptionsEditorTabs/TabPanel.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/stories/shared-utils/decorators/WithDataQueries.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 { Definition, UnknownSpec } from '@perses-dev/core';\nimport { DataQueriesProvider, DataQueriesProviderProps } from '@perses-dev/plugin-system';\nimport { StoryFn, StoryContext } from '@storybook/react';\n\ndeclare module '@storybook/react' {\n interface Parameters {\n withDataQueries?: WithDataQueriesProvideParameter;\n }\n}\n\nexport type WithDataQueriesProvideParameter = {\n props: DataQueriesProviderProps;\n};\n\n// Type guard because storybook types parameters as `any`\nfunction isWithDataQueriesParameter(\n parameter: unknown | WithDataQueriesProvideParameter\n): parameter is WithDataQueriesProvideParameter {\n return !!parameter && typeof parameter === 'object' && 'props' in parameter;\n}\n\nexport const WithDataQueries = (Story: StoryFn, context: StoryContext<unknown>) => {\n const initParameter = context.parameters.withDataQueries;\n const parameter = isWithDataQueriesParameter(initParameter)\n ? initParameter\n : { props: { definitions: [] as Array<Definition<UnknownSpec>> } };\n const props = parameter?.props;\n\n return (\n <DataQueriesProvider {...props}>\n <Story />\n </DataQueriesProvider>\n );\n};\n"],"names":["DataQueriesProvider","isWithDataQueriesParameter","parameter","WithDataQueries","Story","context","initParameter","parameters","withDataQueries","props","definitions"],"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;AACA,SAASA,mBAAmB,QAAkC,2BAA2B,CAAC;AAa1F,yDAAyD;AACzD,SAASC,0BAA0B,CACjCC,SAAoD,EACN;IAC9C,OAAO,CAAC,CAACA,SAAS,IAAI,OAAOA,SAAS,KAAK,QAAQ,IAAI,OAAO,IAAIA,SAAS,CAAC;AAC9E,CAAC;AAED,OAAO,MAAMC,eAAe,GAAG,CAACC,KAAc,EAAEC,OAA8B,GAAK;IACjF,MAAMC,aAAa,GAAGD,OAAO,CAACE,UAAU,CAACC,eAAe,AAAC;IACzD,MAAMN,SAAS,GAAGD,0BAA0B,CAACK,aAAa,CAAC,GACvDA,aAAa,GACb;QAAEG,KAAK,EAAE;YAAEC,WAAW,EAAE,EAAE;SAAoC;KAAE,AAAC;IACrE,MAAMD,KAAK,GAAGP,SAAS,aAATA,SAAS,WAAO,GAAhBA,KAAAA,CAAgB,GAAhBA,SAAS,CAAEO,KAAK,AAAC;IAE/B,qBACE,KAACT,mBAAmB;QAAE,GAAGS,KAAK;kBAC5B,cAAA,KAACL,KAAK,KAAG;MACW,CACtB;AACJ,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../../../src/stories/shared-utils/decorators/WithDataQueries.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 { Definition, UnknownSpec } from '@perses-dev/core';\nimport { DataQueriesProvider, DataQueriesProviderProps } from '@perses-dev/plugin-system';\nimport { StoryFn, StoryContext } from '@storybook/react';\n\ndeclare module '@storybook/react' {\n interface Parameters {\n withDataQueries?: WithDataQueriesProvideParameter;\n }\n}\n\nexport type WithDataQueriesProvideParameter = {\n props: DataQueriesProviderProps;\n};\n\n// Type guard because storybook types parameters as `any`\nfunction isWithDataQueriesParameter(\n parameter: unknown | WithDataQueriesProvideParameter\n): parameter is WithDataQueriesProvideParameter {\n return !!parameter && typeof parameter === 'object' && 'props' in parameter;\n}\n\nexport const WithDataQueries = (Story: StoryFn, context: StoryContext<unknown>) => {\n const initParameter = context.parameters.withDataQueries;\n const parameter = isWithDataQueriesParameter(initParameter)\n ? initParameter\n : { props: { definitions: [] as Array<Definition<UnknownSpec>> } };\n const props = parameter?.props;\n\n return (\n <DataQueriesProvider {...props}>\n <Story />\n </DataQueriesProvider>\n );\n};\n"],"names":["DataQueriesProvider","isWithDataQueriesParameter","parameter","WithDataQueries","Story","context","initParameter","parameters","withDataQueries","props","definitions"],"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;;AAGjC,SAASA,mBAAmB,QAAkC,4BAA4B;AAa1F,yDAAyD;AACzD,SAASC,2BACPC,SAAoD;IAEpD,OAAO,CAAC,CAACA,aAAa,OAAOA,cAAc,YAAY,WAAWA;AACpE;AAEA,OAAO,MAAMC,kBAAkB,CAACC,OAAgBC;IAC9C,MAAMC,gBAAgBD,QAAQE,WAAWC;IACzC,MAAMN,YAAYD,2BAA2BK,iBACzCA,gBACA;QAAEG,OAAO;YAAEC,aAAa,EAAE;QAAmC;IAAE;IACnE,MAAMD,QAAQP,sBAAAA,uBAAAA,KAAAA,IAAAA,UAAWO;IAEzB,qBACE,KAACT;QAAqB,GAAGS,KAAK;kBAC5B,cAAA,KAACL;;AAGP,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/stories/shared-utils/decorators/WithPluginRegistry.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 { StoryFn } from '@storybook/react';\nimport {\n PluginRegistry,\n PluginLoader,\n PluginModuleResource,\n dynamicImportPluginLoader,\n} from '@perses-dev/plugin-system';\n\nimport prometheusResource from '@perses-dev/prometheus-plugin/plugin.json';\nimport panelsResource from '@perses-dev/panels-plugin/plugin.json';\n\nconst bundledPluginLoader: PluginLoader = dynamicImportPluginLoader([\n {\n resource: prometheusResource as PluginModuleResource,\n // This throws an error in CI (but not locally for some reason), likely because\n // this package isn't a dependency for dashboards. We probably do not want to\n // make it one solely for type-checking in storybook.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n importPlugin: () => import('@perses-dev/prometheus-plugin'),\n },\n {\n resource: panelsResource as PluginModuleResource,\n // Same comment as above.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n importPlugin: () => import('@perses-dev/panels-plugin'),\n },\n]);\n\nexport const WithPluginRegistry = (Story: StoryFn) => {\n return (\n <PluginRegistry\n pluginLoader={bundledPluginLoader}\n defaultPluginKinds={{ TimeSeriesQuery: 'PrometheusTimeSeriesQuery' }}\n >\n <Story />\n </PluginRegistry>\n );\n};\n"],"names":["PluginRegistry","dynamicImportPluginLoader","prometheusResource","panelsResource","bundledPluginLoader","resource","importPlugin","WithPluginRegistry","Story","pluginLoader","defaultPluginKinds","TimeSeriesQuery"],"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;AACA,SACEA,cAAc,EAGdC,yBAAyB,QACpB,2BAA2B,CAAC;AAEnC,OAAOC,kBAAkB,MAAM,2CAA2C,CAAC;AAC3E,OAAOC,cAAc,MAAM,uCAAuC,CAAC;AAEnE,MAAMC,mBAAmB,GAAiBH,yBAAyB,CAAC;IAClE;QACEI,QAAQ,EAAEH,kBAAkB;QAC5B,+EAA+E;QAC/E,6EAA6E;QAC7E,qDAAqD;QACrD,6DAA6D;QAC7D,aAAa;QACbI,YAAY,EAAE,IAAM,MAAM,CAAC,+BAA+B,CAAC;KAC5D;IACD;QACED,QAAQ,EAAEF,cAAc;QACxB,yBAAyB;QACzB,6DAA6D;QAC7D,aAAa;QACbG,YAAY,EAAE,IAAM,MAAM,CAAC,2BAA2B,CAAC;KACxD;CACF,CAAC,AAAC;AAEH,OAAO,MAAMC,kBAAkB,GAAG,CAACC,KAAc,GAAK;IACpD,qBACE,KAACR,cAAc;QACbS,YAAY,EAAEL,mBAAmB;QACjCM,kBAAkB,EAAE;YAAEC,eAAe,EAAE,2BAA2B;SAAE;kBAEpE,cAAA,KAACH,KAAK,KAAG;MACM,CACjB;AACJ,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../../../src/stories/shared-utils/decorators/WithPluginRegistry.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 { StoryFn } from '@storybook/react';\nimport {\n PluginRegistry,\n PluginLoader,\n PluginModuleResource,\n dynamicImportPluginLoader,\n} from '@perses-dev/plugin-system';\n\nimport prometheusResource from '@perses-dev/prometheus-plugin/plugin.json';\nimport panelsResource from '@perses-dev/panels-plugin/plugin.json';\n\nconst bundledPluginLoader: PluginLoader = dynamicImportPluginLoader([\n {\n resource: prometheusResource as PluginModuleResource,\n // This throws an error in CI (but not locally for some reason), likely because\n // this package isn't a dependency for dashboards. We probably do not want to\n // make it one solely for type-checking in storybook.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n importPlugin: () => import('@perses-dev/prometheus-plugin'),\n },\n {\n resource: panelsResource as PluginModuleResource,\n // Same comment as above.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n importPlugin: () => import('@perses-dev/panels-plugin'),\n },\n]);\n\nexport const WithPluginRegistry = (Story: StoryFn) => {\n return (\n <PluginRegistry\n pluginLoader={bundledPluginLoader}\n defaultPluginKinds={{ TimeSeriesQuery: 'PrometheusTimeSeriesQuery' }}\n >\n <Story />\n </PluginRegistry>\n );\n};\n"],"names":["PluginRegistry","dynamicImportPluginLoader","prometheusResource","panelsResource","bundledPluginLoader","resource","importPlugin","WithPluginRegistry","Story","pluginLoader","defaultPluginKinds","TimeSeriesQuery"],"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;;AAGjC,SACEA,cAAc,EAGdC,yBAAyB,QACpB,4BAA4B;AAEnC,OAAOC,wBAAwB,4CAA4C;AAC3E,OAAOC,oBAAoB,wCAAwC;AAEnE,MAAMC,sBAAoCH,0BAA0B;IAClE;QACEI,UAAUH;QACV,+EAA+E;QAC/E,6EAA6E;QAC7E,qDAAqD;QACrD,6DAA6D;QAC7D,aAAa;QACbI,cAAc,IAAM,MAAM,CAAC;IAC7B;IACA;QACED,UAAUF;QACV,yBAAyB;QACzB,6DAA6D;QAC7D,aAAa;QACbG,cAAc,IAAM,MAAM,CAAC;IAC7B;CACD;AAED,OAAO,MAAMC,qBAAqB,CAACC;IACjC,qBACE,KAACR;QACCS,cAAcL;QACdM,oBAAoB;YAAEC,iBAAiB;QAA4B;kBAEnE,cAAA,KAACH;;AAGP,EAAE"}
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ import { StoryFn, StoryContext } from '@storybook/react';
3
+ import { BuiltinVariableSrv } from '../../../runtime';
4
+ declare module '@storybook/react' {
5
+ interface Parameters {
6
+ withPluginSystemBuiltinVariables?: WithPluginSystemBuiltinVariableParameter;
7
+ }
8
+ }
9
+ export declare type WithPluginSystemBuiltinVariableParameter = {
10
+ props: BuiltinVariableSrv;
11
+ };
12
+ export declare const WithPluginSystemBuiltinVariables: (Story: StoryFn, context: StoryContext<unknown>) => JSX.Element;
13
+ //# sourceMappingURL=WithPluginSystemBuiltinVariables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WithPluginSystemBuiltinVariables.d.ts","sourceRoot":"","sources":["../../../../src/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAA0B,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE9E,OAAO,QAAQ,kBAAkB,CAAC;IAChC,UAAU,UAAU;QAClB,gCAAgC,CAAC,EAAE,wCAAwC,CAAC;KAC7E;CACF;AAED,oBAAY,wCAAwC,GAAG;IACrD,KAAK,EAAE,kBAAkB,CAAC;CAC3B,CAAC;AAcF,eAAO,MAAM,gCAAgC,UAAW,OAAO,WAAW,aAAa,OAAO,CAAC,gBAc9F,CAAC"}
@@ -0,0 +1,39 @@
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
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { BuiltinVariableContext } from '../../../runtime';
15
+ // Type guard because storybook types parameters as `any`
16
+ function isWithBuiltinVariableParameter(parameter) {
17
+ return !!parameter && Array.isArray(parameter);
18
+ }
19
+ // This decorator is used for non-dashboards package Builtin variable needs.
20
+ // Use the more specific decorator in the dashboards package when working with
21
+ // dashboards.
22
+ // This decorator includes "PluginSystem" in the name to differentiate it from
23
+ // the datasource store decorator in the `dashboards` package.
24
+ export const WithPluginSystemBuiltinVariables = (Story, context)=>{
25
+ const initParameter = context.parameters.withPluginSystemBuiltinVariables;
26
+ const defaultValue = {
27
+ variables: []
28
+ };
29
+ const parameter = isWithBuiltinVariableParameter(initParameter) ? initParameter : {
30
+ props: defaultValue
31
+ };
32
+ const props = parameter === null || parameter === void 0 ? void 0 : parameter.props;
33
+ return /*#__PURE__*/ _jsx(BuiltinVariableContext.Provider, {
34
+ value: props,
35
+ children: /*#__PURE__*/ _jsx(Story, {})
36
+ });
37
+ };
38
+
39
+ //# sourceMappingURL=WithPluginSystemBuiltinVariables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.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 { StoryFn, StoryContext } from '@storybook/react';\nimport { BuiltinVariableContext, BuiltinVariableSrv } from '../../../runtime';\n\ndeclare module '@storybook/react' {\n interface Parameters {\n withPluginSystemBuiltinVariables?: WithPluginSystemBuiltinVariableParameter;\n }\n}\n\nexport type WithPluginSystemBuiltinVariableParameter = {\n props: BuiltinVariableSrv;\n};\n\n// Type guard because storybook types parameters as `any`\nfunction isWithBuiltinVariableParameter(\n parameter: unknown | WithPluginSystemBuiltinVariableParameter\n): parameter is WithPluginSystemBuiltinVariableParameter {\n return !!parameter && Array.isArray(parameter);\n}\n\n// This decorator is used for non-dashboards package Builtin variable needs.\n// Use the more specific decorator in the dashboards package when working with\n// dashboards.\n// This decorator includes \"PluginSystem\" in the name to differentiate it from\n// the datasource store decorator in the `dashboards` package.\nexport const WithPluginSystemBuiltinVariables = (Story: StoryFn, context: StoryContext<unknown>) => {\n const initParameter = context.parameters.withPluginSystemBuiltinVariables;\n const defaultValue: BuiltinVariableSrv = {\n variables: [],\n };\n const parameter = isWithBuiltinVariableParameter(initParameter) ? initParameter : { props: defaultValue };\n\n const props = parameter?.props;\n\n return (\n <BuiltinVariableContext.Provider value={props}>\n <Story />\n </BuiltinVariableContext.Provider>\n );\n};\n"],"names":["BuiltinVariableContext","isWithBuiltinVariableParameter","parameter","Array","isArray","WithPluginSystemBuiltinVariables","Story","context","initParameter","parameters","withPluginSystemBuiltinVariables","defaultValue","variables","props","Provider","value"],"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;;AAGjC,SAASA,sBAAsB,QAA4B,mBAAmB;AAY9E,yDAAyD;AACzD,SAASC,+BACPC,SAA6D;IAE7D,OAAO,CAAC,CAACA,aAAaC,MAAMC,QAAQF;AACtC;AAEA,4EAA4E;AAC5E,8EAA8E;AAC9E,cAAc;AACd,8EAA8E;AAC9E,8DAA8D;AAC9D,OAAO,MAAMG,mCAAmC,CAACC,OAAgBC;IAC/D,MAAMC,gBAAgBD,QAAQE,WAAWC;IACzC,MAAMC,eAAmC;QACvCC,WAAW,EAAE;IACf;IACA,MAAMV,YAAYD,+BAA+BO,iBAAiBA,gBAAgB;QAAEK,OAAOF;IAAa;IAExG,MAAME,QAAQX,sBAAAA,uBAAAA,KAAAA,IAAAA,UAAWW;IAEzB,qBACE,KAACb,uBAAuBc;QAASC,OAAOF;kBACtC,cAAA,KAACP;;AAGP,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"WithPluginSystemDatasourceStore.d.ts","sourceRoot":"","sources":["../../../../src/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.tsx"],"names":[],"mappings":";AAcA,OAAO,EAA0B,eAAe,EAAqB,MAAM,2BAA2B,CAAC;AACvG,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,QAAQ,kBAAkB,CAAC;IAChC,UAAU,UAAU;QAClB,+BAA+B,CAAC,EAAE,wCAAwC,CAAC;KAC5E;CACF;AAED,oBAAY,wCAAwC,GAAG;IACrD,KAAK,EAAE,eAAe,CAAC;CACxB,CAAC;AAaF,eAAO,MAAM,+BAA+B,UAAW,OAAO,WAAW,aAAa,OAAO,CAAC,gBAuD7F,CAAC"}
1
+ {"version":3,"file":"WithPluginSystemDatasourceStore.d.ts","sourceRoot":"","sources":["../../../../src/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.tsx"],"names":[],"mappings":";AAcA,OAAO,EAEL,eAAe,EAGhB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,QAAQ,kBAAkB,CAAC;IAChC,UAAU,UAAU;QAClB,+BAA+B,CAAC,EAAE,wCAAwC,CAAC;KAC5E;CACF;AAED,oBAAY,wCAAwC,GAAG;IACrD,KAAK,EAAE,eAAe,CAAC;CACxB,CAAC;AAaF,eAAO,MAAM,+BAA+B,UAAW,OAAO,WAAW,aAAa,OAAO,CAAC,gBAwD7F,CAAC"}
@@ -26,7 +26,7 @@ export const WithPluginSystemDatasourceStore = (Story, context)=>{
26
26
  // basic stories. It likely will need expanding in the future.
27
27
  // In general, `plugin-system` would probably benefit from a provider wrapper
28
28
  // for `DatasourceStoreContext` that is more generic than the one available
29
- // in in the `dashboard` package for non-dashboard use cases.
29
+ // in the `dashboard` package for non-dashboard use cases.
30
30
  const defaultValue = {
31
31
  getDatasource: (selector)=>{
32
32
  if (selector.kind === 'PrometheusDatasource') {
@@ -44,7 +44,7 @@ export const WithPluginSystemDatasourceStore = (Story, context)=>{
44
44
  if (selector.kind === 'PrometheusDatasource') {
45
45
  const plugin = await getPlugin('Datasource', 'PrometheusDatasource');
46
46
  const client = plugin.createClient({
47
- direct_url: prometheusDemoUrl
47
+ directUrl: prometheusDemoUrl
48
48
  }, {
49
49
  proxyUrl: prometheusDemoUrl
50
50
  });
@@ -52,14 +52,18 @@ export const WithPluginSystemDatasourceStore = (Story, context)=>{
52
52
  }
53
53
  throw new Error(`WithDatasourceStore is not configured to support kind: ${selector.kind}`);
54
54
  },
55
- listDatasourceMetadata: async (datasourcePluginKind)=>{
55
+ listDatasourceSelectItems: async (datasourcePluginKind)=>{
56
56
  if (datasourcePluginKind === 'PrometheusDatasource') {
57
57
  return Promise.resolve([
58
58
  {
59
- name: 'PrometheusDatasource',
60
- selector: {
61
- kind: 'PrometheusDatasource'
62
- }
59
+ items: [
60
+ {
61
+ name: 'PrometheusDatasource',
62
+ selector: {
63
+ kind: 'PrometheusDatasource'
64
+ }
65
+ }
66
+ ]
63
67
  }
64
68
  ]);
65
69
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.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 { DatasourceSelector } from '@perses-dev/core';\nimport { DatasourceStoreContext, DatasourceStore, usePluginRegistry } from '@perses-dev/plugin-system';\nimport { StoryFn, StoryContext } from '@storybook/react';\n\ndeclare module '@storybook/react' {\n interface Parameters {\n withPluginSystemDatasourceStore?: WithPluginSystemDatasourceStoreParameter;\n }\n}\n\nexport type WithPluginSystemDatasourceStoreParameter = {\n props: DatasourceStore;\n};\n\nconst prometheusDemoUrl = 'https://prometheus.demo.do.prometheus.io';\n\n// Type guard because storybook types parameters as `any`\nfunction isWithDatastoreStoreParameter(\n parameter: unknown | WithPluginSystemDatasourceStoreParameter\n): parameter is WithPluginSystemDatasourceStoreParameter {\n return !!parameter && typeof parameter === 'object' && 'props' in parameter;\n}\n\n// This decorator includes \"PluginSystem\" in the name to differentiate it from\n// the datasource store decorator in the `dashboards` package.\nexport const WithPluginSystemDatasourceStore = (Story: StoryFn, context: StoryContext<unknown>) => {\n const { getPlugin } = usePluginRegistry();\n\n const initParameter = context.parameters.withPluginSystemDatasourceStore;\n\n // This currently provides a very simplified default to enable use in some\n // basic stories. It likely will need expanding in the future.\n // In general, `plugin-system` would probably benefit from a provider wrapper\n // for `DatasourceStoreContext` that is more generic than the one available\n // in in the `dashboard` package for non-dashboard use cases.\n const defaultValue: DatasourceStore = {\n getDatasource: (selector) => {\n if (selector.kind === 'PrometheusDatasource') {\n return Promise.resolve({\n default: true,\n plugin: {\n kind: 'PrometheusDatasource',\n spec: {},\n },\n });\n }\n throw new Error(`WithDatasourceStore is not configured to support kind: ${selector.kind}`);\n },\n getDatasourceClient: async <Client,>(selector: DatasourceSelector) => {\n if (selector.kind === 'PrometheusDatasource') {\n const plugin = await getPlugin('Datasource', 'PrometheusDatasource');\n const client = plugin.createClient(\n { direct_url: prometheusDemoUrl },\n { proxyUrl: prometheusDemoUrl }\n ) as Client;\n return client;\n }\n throw new Error(`WithDatasourceStore is not configured to support kind: ${selector.kind}`);\n },\n listDatasourceMetadata: async (datasourcePluginKind) => {\n if (datasourcePluginKind === 'PrometheusDatasource') {\n return Promise.resolve([\n {\n name: 'PrometheusDatasource',\n selector: { kind: 'PrometheusDatasource' },\n },\n ]);\n }\n throw new Error(`WithDatasourceStore is not configured to support kind: ${datasourcePluginKind}`);\n },\n };\n\n const parameter = isWithDatastoreStoreParameter(initParameter) ? initParameter : { props: defaultValue };\n const props = parameter?.props;\n\n return (\n <DatasourceStoreContext.Provider value={props}>\n <Story />\n </DatasourceStoreContext.Provider>\n );\n};\n"],"names":["DatasourceStoreContext","usePluginRegistry","prometheusDemoUrl","isWithDatastoreStoreParameter","parameter","WithPluginSystemDatasourceStore","Story","context","getPlugin","initParameter","parameters","withPluginSystemDatasourceStore","defaultValue","getDatasource","selector","kind","Promise","resolve","default","plugin","spec","Error","getDatasourceClient","client","createClient","direct_url","proxyUrl","listDatasourceMetadata","datasourcePluginKind","name","props","Provider","value"],"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;AACA,SAASA,sBAAsB,EAAmBC,iBAAiB,QAAQ,2BAA2B,CAAC;AAavG,MAAMC,iBAAiB,GAAG,0CAA0C,AAAC;AAErE,yDAAyD;AACzD,SAASC,6BAA6B,CACpCC,SAA6D,EACN;IACvD,OAAO,CAAC,CAACA,SAAS,IAAI,OAAOA,SAAS,KAAK,QAAQ,IAAI,OAAO,IAAIA,SAAS,CAAC;AAC9E,CAAC;AAED,8EAA8E;AAC9E,8DAA8D;AAC9D,OAAO,MAAMC,+BAA+B,GAAG,CAACC,KAAc,EAAEC,OAA8B,GAAK;IACjG,MAAM,EAAEC,SAAS,CAAA,EAAE,GAAGP,iBAAiB,EAAE,AAAC;IAE1C,MAAMQ,aAAa,GAAGF,OAAO,CAACG,UAAU,CAACC,+BAA+B,AAAC;IAEzE,0EAA0E;IAC1E,8DAA8D;IAC9D,6EAA6E;IAC7E,2EAA2E;IAC3E,6DAA6D;IAC7D,MAAMC,YAAY,GAAoB;QACpCC,aAAa,EAAE,CAACC,QAAQ,GAAK;YAC3B,IAAIA,QAAQ,CAACC,IAAI,KAAK,sBAAsB,EAAE;gBAC5C,OAAOC,OAAO,CAACC,OAAO,CAAC;oBACrBC,OAAO,EAAE,IAAI;oBACbC,MAAM,EAAE;wBACNJ,IAAI,EAAE,sBAAsB;wBAC5BK,IAAI,EAAE,EAAE;qBACT;iBACF,CAAC,CAAC;YACL,CAAC;YACD,MAAM,IAAIC,KAAK,CAAC,CAAC,uDAAuD,EAAEP,QAAQ,CAACC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC7F,CAAC;QACDO,mBAAmB,EAAE,OAAgBR,QAA4B,GAAK;YACpE,IAAIA,QAAQ,CAACC,IAAI,KAAK,sBAAsB,EAAE;gBAC5C,MAAMI,MAAM,GAAG,MAAMX,SAAS,CAAC,YAAY,EAAE,sBAAsB,CAAC,AAAC;gBACrE,MAAMe,MAAM,GAAGJ,MAAM,CAACK,YAAY,CAChC;oBAAEC,UAAU,EAAEvB,iBAAiB;iBAAE,EACjC;oBAAEwB,QAAQ,EAAExB,iBAAiB;iBAAE,CAChC,AAAU,AAAC;gBACZ,OAAOqB,MAAM,CAAC;YAChB,CAAC;YACD,MAAM,IAAIF,KAAK,CAAC,CAAC,uDAAuD,EAAEP,QAAQ,CAACC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC7F,CAAC;QACDY,sBAAsB,EAAE,OAAOC,oBAAoB,GAAK;YACtD,IAAIA,oBAAoB,KAAK,sBAAsB,EAAE;gBACnD,OAAOZ,OAAO,CAACC,OAAO,CAAC;oBACrB;wBACEY,IAAI,EAAE,sBAAsB;wBAC5Bf,QAAQ,EAAE;4BAAEC,IAAI,EAAE,sBAAsB;yBAAE;qBAC3C;iBACF,CAAC,CAAC;YACL,CAAC;YACD,MAAM,IAAIM,KAAK,CAAC,CAAC,uDAAuD,EAAEO,oBAAoB,CAAC,CAAC,CAAC,CAAC;QACpG,CAAC;KACF,AAAC;IAEF,MAAMxB,SAAS,GAAGD,6BAA6B,CAACM,aAAa,CAAC,GAAGA,aAAa,GAAG;QAAEqB,KAAK,EAAElB,YAAY;KAAE,AAAC;IACzG,MAAMkB,KAAK,GAAG1B,SAAS,aAATA,SAAS,WAAO,GAAhBA,KAAAA,CAAgB,GAAhBA,SAAS,CAAE0B,KAAK,AAAC;IAE/B,qBACE,KAAC9B,sBAAsB,CAAC+B,QAAQ;QAACC,KAAK,EAAEF,KAAK;kBAC3C,cAAA,KAACxB,KAAK,KAAG;MACuB,CAClC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../../../src/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.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 { DatasourceSelector } from '@perses-dev/core';\nimport {\n DatasourceStoreContext,\n DatasourceStore,\n usePluginRegistry,\n DatasourceSelectItemGroup,\n} from '@perses-dev/plugin-system';\nimport { StoryFn, StoryContext } from '@storybook/react';\n\ndeclare module '@storybook/react' {\n interface Parameters {\n withPluginSystemDatasourceStore?: WithPluginSystemDatasourceStoreParameter;\n }\n}\n\nexport type WithPluginSystemDatasourceStoreParameter = {\n props: DatasourceStore;\n};\n\nconst prometheusDemoUrl = 'https://prometheus.demo.do.prometheus.io';\n\n// Type guard because storybook types parameters as `any`\nfunction isWithDatastoreStoreParameter(\n parameter: unknown | WithPluginSystemDatasourceStoreParameter\n): parameter is WithPluginSystemDatasourceStoreParameter {\n return !!parameter && typeof parameter === 'object' && 'props' in parameter;\n}\n\n// This decorator includes \"PluginSystem\" in the name to differentiate it from\n// the datasource store decorator in the `dashboards` package.\nexport const WithPluginSystemDatasourceStore = (Story: StoryFn, context: StoryContext<unknown>) => {\n const { getPlugin } = usePluginRegistry();\n\n const initParameter = context.parameters.withPluginSystemDatasourceStore;\n\n // This currently provides a very simplified default to enable use in some\n // basic stories. It likely will need expanding in the future.\n // In general, `plugin-system` would probably benefit from a provider wrapper\n // for `DatasourceStoreContext` that is more generic than the one available\n // in the `dashboard` package for non-dashboard use cases.\n const defaultValue: DatasourceStore = {\n getDatasource: (selector) => {\n if (selector.kind === 'PrometheusDatasource') {\n return Promise.resolve({\n default: true,\n plugin: {\n kind: 'PrometheusDatasource',\n spec: {},\n },\n });\n }\n throw new Error(`WithDatasourceStore is not configured to support kind: ${selector.kind}`);\n },\n getDatasourceClient: async <Client,>(selector: DatasourceSelector) => {\n if (selector.kind === 'PrometheusDatasource') {\n const plugin = await getPlugin('Datasource', 'PrometheusDatasource');\n const client = plugin.createClient({ directUrl: prometheusDemoUrl }, { proxyUrl: prometheusDemoUrl }) as Client;\n return client;\n }\n throw new Error(`WithDatasourceStore is not configured to support kind: ${selector.kind}`);\n },\n listDatasourceSelectItems: async (datasourcePluginKind): Promise<DatasourceSelectItemGroup[]> => {\n if (datasourcePluginKind === 'PrometheusDatasource') {\n return Promise.resolve([\n {\n items: [\n {\n name: 'PrometheusDatasource',\n selector: { kind: 'PrometheusDatasource' },\n },\n ],\n },\n ]);\n }\n throw new Error(`WithDatasourceStore is not configured to support kind: ${datasourcePluginKind}`);\n },\n };\n\n const parameter = isWithDatastoreStoreParameter(initParameter) ? initParameter : { props: defaultValue };\n const props = parameter?.props;\n\n return (\n <DatasourceStoreContext.Provider value={props}>\n <Story />\n </DatasourceStoreContext.Provider>\n );\n};\n"],"names":["DatasourceStoreContext","usePluginRegistry","prometheusDemoUrl","isWithDatastoreStoreParameter","parameter","WithPluginSystemDatasourceStore","Story","context","getPlugin","initParameter","parameters","withPluginSystemDatasourceStore","defaultValue","getDatasource","selector","kind","Promise","resolve","default","plugin","spec","Error","getDatasourceClient","client","createClient","directUrl","proxyUrl","listDatasourceSelectItems","datasourcePluginKind","items","name","props","Provider","value"],"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;;AAGjC,SACEA,sBAAsB,EAEtBC,iBAAiB,QAEZ,4BAA4B;AAanC,MAAMC,oBAAoB;AAE1B,yDAAyD;AACzD,SAASC,8BACPC,SAA6D;IAE7D,OAAO,CAAC,CAACA,aAAa,OAAOA,cAAc,YAAY,WAAWA;AACpE;AAEA,8EAA8E;AAC9E,8DAA8D;AAC9D,OAAO,MAAMC,kCAAkC,CAACC,OAAgBC;IAC9D,MAAM,EAAEC,UAAS,EAAE,GAAGP;IAEtB,MAAMQ,gBAAgBF,QAAQG,WAAWC;IAEzC,0EAA0E;IAC1E,8DAA8D;IAC9D,6EAA6E;IAC7E,2EAA2E;IAC3E,0DAA0D;IAC1D,MAAMC,eAAgC;QACpCC,eAAe,CAACC;YACd,IAAIA,SAASC,SAAS,wBAAwB;gBAC5C,OAAOC,QAAQC,QAAQ;oBACrBC,SAAS;oBACTC,QAAQ;wBACNJ,MAAM;wBACNK,MAAM,CAAC;oBACT;gBACF;YACF;YACA,MAAM,IAAIC,MAAM,CAAC,uDAAuD,EAAEP,SAASC,KAAK,CAAC;QAC3F;QACAO,qBAAqB,OAAgBR;YACnC,IAAIA,SAASC,SAAS,wBAAwB;gBAC5C,MAAMI,SAAS,MAAMX,UAAU,cAAc;gBAC7C,MAAMe,SAASJ,OAAOK,aAAa;oBAAEC,WAAWvB;gBAAkB,GAAG;oBAAEwB,UAAUxB;gBAAkB;gBACnG,OAAOqB;YACT;YACA,MAAM,IAAIF,MAAM,CAAC,uDAAuD,EAAEP,SAASC,KAAK,CAAC;QAC3F;QACAY,2BAA2B,OAAOC;YAChC,IAAIA,yBAAyB,wBAAwB;gBACnD,OAAOZ,QAAQC,QAAQ;oBACrB;wBACEY,OAAO;4BACL;gCACEC,MAAM;gCACNhB,UAAU;oCAAEC,MAAM;gCAAuB;4BAC3C;yBACD;oBACH;iBACD;YACH;YACA,MAAM,IAAIM,MAAM,CAAC,uDAAuD,EAAEO,qBAAqB,CAAC;QAClG;IACF;IAEA,MAAMxB,YAAYD,8BAA8BM,iBAAiBA,gBAAgB;QAAEsB,OAAOnB;IAAa;IACvG,MAAMmB,QAAQ3B,sBAAAA,uBAAAA,KAAAA,IAAAA,UAAW2B;IAEzB,qBACE,KAAC/B,uBAAuBgC;QAASC,OAAOF;kBACtC,cAAA,KAACzB;;AAGP,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.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 { StoryFn, StoryContext } from '@storybook/react';\nimport { TemplateVariableContext, TemplateVariableSrv } from '../../../runtime';\n\ndeclare module '@storybook/react' {\n interface Parameters {\n withPluginSystemTemplateVariables?: WithPluginSystemTemplateVariableParameter;\n }\n}\n\nexport type WithPluginSystemTemplateVariableParameter = {\n props: TemplateVariableSrv;\n};\n\n// Type guard because storybook types parameters as `any`\nfunction isWithTemplateVariableParameter(\n parameter: unknown | WithPluginSystemTemplateVariableParameter\n): parameter is WithPluginSystemTemplateVariableParameter {\n return !!parameter && typeof parameter === 'object' && 'props' in parameter;\n}\n\n// This decorator is used for non-dashboards package template variable needs.\n// Use the more specific decorator in the dashboards package when working with\n// dashboards.\n// This decorator includes \"PluginSystem\" in the name to differentiate it from\n// the datasource store decorator in the `dashboards` package.\nexport const WithPluginSystemTemplateVariables = (Story: StoryFn, context: StoryContext<unknown>) => {\n const initParameter = context.parameters.withPluginSystemTemplateVariables;\n const defaultValue: TemplateVariableSrv = {\n state: {},\n };\n const parameter = isWithTemplateVariableParameter(initParameter) ? initParameter : { props: defaultValue };\n\n const props = parameter?.props;\n\n return (\n <TemplateVariableContext.Provider value={props}>\n <Story />\n </TemplateVariableContext.Provider>\n );\n};\n"],"names":["TemplateVariableContext","isWithTemplateVariableParameter","parameter","WithPluginSystemTemplateVariables","Story","context","initParameter","parameters","withPluginSystemTemplateVariables","defaultValue","state","props","Provider","value"],"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;AACA,SAASA,uBAAuB,QAA6B,kBAAkB,CAAC;AAYhF,yDAAyD;AACzD,SAASC,+BAA+B,CACtCC,SAA8D,EACN;IACxD,OAAO,CAAC,CAACA,SAAS,IAAI,OAAOA,SAAS,KAAK,QAAQ,IAAI,OAAO,IAAIA,SAAS,CAAC;AAC9E,CAAC;AAED,6EAA6E;AAC7E,8EAA8E;AAC9E,cAAc;AACd,8EAA8E;AAC9E,8DAA8D;AAC9D,OAAO,MAAMC,iCAAiC,GAAG,CAACC,KAAc,EAAEC,OAA8B,GAAK;IACnG,MAAMC,aAAa,GAAGD,OAAO,CAACE,UAAU,CAACC,iCAAiC,AAAC;IAC3E,MAAMC,YAAY,GAAwB;QACxCC,KAAK,EAAE,EAAE;KACV,AAAC;IACF,MAAMR,SAAS,GAAGD,+BAA+B,CAACK,aAAa,CAAC,GAAGA,aAAa,GAAG;QAAEK,KAAK,EAAEF,YAAY;KAAE,AAAC;IAE3G,MAAME,KAAK,GAAGT,SAAS,aAATA,SAAS,WAAO,GAAhBA,KAAAA,CAAgB,GAAhBA,SAAS,CAAES,KAAK,AAAC;IAE/B,qBACE,KAACX,uBAAuB,CAACY,QAAQ;QAACC,KAAK,EAAEF,KAAK;kBAC5C,cAAA,KAACP,KAAK,KAAG;MACwB,CACnC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../../../src/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.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 { StoryFn, StoryContext } from '@storybook/react';\nimport { TemplateVariableContext, TemplateVariableSrv } from '../../../runtime';\n\ndeclare module '@storybook/react' {\n interface Parameters {\n withPluginSystemTemplateVariables?: WithPluginSystemTemplateVariableParameter;\n }\n}\n\nexport type WithPluginSystemTemplateVariableParameter = {\n props: TemplateVariableSrv;\n};\n\n// Type guard because storybook types parameters as `any`\nfunction isWithTemplateVariableParameter(\n parameter: unknown | WithPluginSystemTemplateVariableParameter\n): parameter is WithPluginSystemTemplateVariableParameter {\n return !!parameter && typeof parameter === 'object' && 'props' in parameter;\n}\n\n// This decorator is used for non-dashboards package template variable needs.\n// Use the more specific decorator in the dashboards package when working with\n// dashboards.\n// This decorator includes \"PluginSystem\" in the name to differentiate it from\n// the datasource store decorator in the `dashboards` package.\nexport const WithPluginSystemTemplateVariables = (Story: StoryFn, context: StoryContext<unknown>) => {\n const initParameter = context.parameters.withPluginSystemTemplateVariables;\n const defaultValue: TemplateVariableSrv = {\n state: {},\n };\n const parameter = isWithTemplateVariableParameter(initParameter) ? initParameter : { props: defaultValue };\n\n const props = parameter?.props;\n\n return (\n <TemplateVariableContext.Provider value={props}>\n <Story />\n </TemplateVariableContext.Provider>\n );\n};\n"],"names":["TemplateVariableContext","isWithTemplateVariableParameter","parameter","WithPluginSystemTemplateVariables","Story","context","initParameter","parameters","withPluginSystemTemplateVariables","defaultValue","state","props","Provider","value"],"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;;AAGjC,SAASA,uBAAuB,QAA6B,mBAAmB;AAYhF,yDAAyD;AACzD,SAASC,gCACPC,SAA8D;IAE9D,OAAO,CAAC,CAACA,aAAa,OAAOA,cAAc,YAAY,WAAWA;AACpE;AAEA,6EAA6E;AAC7E,8EAA8E;AAC9E,cAAc;AACd,8EAA8E;AAC9E,8DAA8D;AAC9D,OAAO,MAAMC,oCAAoC,CAACC,OAAgBC;IAChE,MAAMC,gBAAgBD,QAAQE,WAAWC;IACzC,MAAMC,eAAoC;QACxCC,OAAO,CAAC;IACV;IACA,MAAMR,YAAYD,gCAAgCK,iBAAiBA,gBAAgB;QAAEK,OAAOF;IAAa;IAEzG,MAAME,QAAQT,sBAAAA,uBAAAA,KAAAA,IAAAA,UAAWS;IAEzB,qBACE,KAACX,wBAAwBY;QAASC,OAAOF;kBACvC,cAAA,KAACP;;AAGP,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/stories/shared-utils/decorators/WithTimeRange.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 { StoryFn, StoryContext } from '@storybook/react';\nimport { TimeRangeProvider, TimeRangeProviderProps } from '@perses-dev/plugin-system';\n\ndeclare module '@storybook/react' {\n interface Parameters {\n withTimeRange?: WithTimeRangeParameter;\n }\n}\n\nexport type WithTimeRangeParameter = {\n props: Partial<TimeRangeProviderProps>;\n};\n\n// Type guard because storybook types parameters as `any`\nfunction isWithTimeRangeParameter(parameter: unknown | WithTimeRangeParameter): parameter is WithTimeRangeParameter {\n return !!parameter && typeof parameter === 'object' && 'props' in parameter;\n}\n\nexport const WithTimeRange = (Story: StoryFn, context: StoryContext<unknown>) => {\n const initParameter = context.parameters.withTimeRange;\n const parameter = isWithTimeRangeParameter(initParameter) ? initParameter : undefined;\n const props = parameter?.props;\n\n return (\n <TimeRangeProvider initialRefreshInterval=\"0s\" initialTimeRange={{ pastDuration: '1h' }} {...props}>\n <Story />\n </TimeRangeProvider>\n );\n};\n"],"names":["TimeRangeProvider","isWithTimeRangeParameter","parameter","WithTimeRange","Story","context","initParameter","parameters","withTimeRange","undefined","props","initialRefreshInterval","initialTimeRange","pastDuration"],"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;AACA,SAASA,iBAAiB,QAAgC,2BAA2B,CAAC;AAYtF,yDAAyD;AACzD,SAASC,wBAAwB,CAACC,SAA2C,EAAuC;IAClH,OAAO,CAAC,CAACA,SAAS,IAAI,OAAOA,SAAS,KAAK,QAAQ,IAAI,OAAO,IAAIA,SAAS,CAAC;AAC9E,CAAC;AAED,OAAO,MAAMC,aAAa,GAAG,CAACC,KAAc,EAAEC,OAA8B,GAAK;IAC/E,MAAMC,aAAa,GAAGD,OAAO,CAACE,UAAU,CAACC,aAAa,AAAC;IACvD,MAAMN,SAAS,GAAGD,wBAAwB,CAACK,aAAa,CAAC,GAAGA,aAAa,GAAGG,SAAS,AAAC;IACtF,MAAMC,KAAK,GAAGR,SAAS,aAATA,SAAS,WAAO,GAAhBA,KAAAA,CAAgB,GAAhBA,SAAS,CAAEQ,KAAK,AAAC;IAE/B,qBACE,KAACV,iBAAiB;QAACW,sBAAsB,EAAC,IAAI;QAACC,gBAAgB,EAAE;YAAEC,YAAY,EAAE,IAAI;SAAE;QAAG,GAAGH,KAAK;kBAChG,cAAA,KAACN,KAAK,KAAG;MACS,CACpB;AACJ,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../../../src/stories/shared-utils/decorators/WithTimeRange.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 { StoryFn, StoryContext } from '@storybook/react';\nimport { TimeRangeProvider, TimeRangeProviderProps } from '@perses-dev/plugin-system';\n\ndeclare module '@storybook/react' {\n interface Parameters {\n withTimeRange?: WithTimeRangeParameter;\n }\n}\n\nexport type WithTimeRangeParameter = {\n props: Partial<TimeRangeProviderProps>;\n};\n\n// Type guard because storybook types parameters as `any`\nfunction isWithTimeRangeParameter(parameter: unknown | WithTimeRangeParameter): parameter is WithTimeRangeParameter {\n return !!parameter && typeof parameter === 'object' && 'props' in parameter;\n}\n\nexport const WithTimeRange = (Story: StoryFn, context: StoryContext<unknown>) => {\n const initParameter = context.parameters.withTimeRange;\n const parameter = isWithTimeRangeParameter(initParameter) ? initParameter : undefined;\n const props = parameter?.props;\n\n return (\n <TimeRangeProvider initialRefreshInterval=\"0s\" initialTimeRange={{ pastDuration: '1h' }} {...props}>\n <Story />\n </TimeRangeProvider>\n );\n};\n"],"names":["TimeRangeProvider","isWithTimeRangeParameter","parameter","WithTimeRange","Story","context","initParameter","parameters","withTimeRange","undefined","props","initialRefreshInterval","initialTimeRange","pastDuration"],"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;;AAGjC,SAASA,iBAAiB,QAAgC,4BAA4B;AAYtF,yDAAyD;AACzD,SAASC,yBAAyBC,SAA2C;IAC3E,OAAO,CAAC,CAACA,aAAa,OAAOA,cAAc,YAAY,WAAWA;AACpE;AAEA,OAAO,MAAMC,gBAAgB,CAACC,OAAgBC;IAC5C,MAAMC,gBAAgBD,QAAQE,WAAWC;IACzC,MAAMN,YAAYD,yBAAyBK,iBAAiBA,gBAAgBG;IAC5E,MAAMC,QAAQR,sBAAAA,uBAAAA,KAAAA,IAAAA,UAAWQ;IAEzB,qBACE,KAACV;QAAkBW,wBAAuB;QAAKC,kBAAkB;YAAEC,cAAc;QAAK;QAAI,GAAGH,KAAK;kBAChG,cAAA,KAACN;;AAGP,EAAE"}
@@ -1,5 +1,6 @@
1
1
  export * from './WithDataQueries';
2
2
  export * from './WithPluginRegistry';
3
+ export * from './WithPluginSystemBuiltinVariables';
3
4
  export * from './WithPluginSystemDatasourceStore';
4
5
  export * from './WithPluginSystemTemplateVariables';
5
6
  export * from './WithTimeRange';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/stories/shared-utils/decorators/index.ts"],"names":[],"mappings":"AAaA,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/stories/shared-utils/decorators/index.ts"],"names":[],"mappings":"AAaA,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iBAAiB,CAAC"}
@@ -12,6 +12,7 @@
12
12
  // limitations under the License.
13
13
  export * from './WithDataQueries';
14
14
  export * from './WithPluginRegistry';
15
+ export * from './WithPluginSystemBuiltinVariables';
15
16
  export * from './WithPluginSystemDatasourceStore';
16
17
  export * from './WithPluginSystemTemplateVariables';
17
18
  export * from './WithTimeRange';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/stories/shared-utils/decorators/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 './WithDataQueries';\nexport * from './WithPluginRegistry';\nexport * from './WithPluginSystemDatasourceStore';\nexport * from './WithPluginSystemTemplateVariables';\nexport * from './WithTimeRange';\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,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"sources":["../../../../src/stories/shared-utils/decorators/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 './WithDataQueries';\nexport * from './WithPluginRegistry';\nexport * from './WithPluginSystemBuiltinVariables';\nexport * from './WithPluginSystemDatasourceStore';\nexport * from './WithPluginSystemTemplateVariables';\nexport * from './WithTimeRange';\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,oBAAoB;AAClC,cAAc,uBAAuB;AACrC,cAAc,qCAAqC;AACnD,cAAc,oCAAoC;AAClD,cAAc,sCAAsC;AACpD,cAAc,kBAAkB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/stories/shared-utils/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 './decorators';\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,cAAc,CAAC"}
1
+ {"version":3,"sources":["../../../src/stories/shared-utils/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 './decorators';\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,eAAe"}
@@ -1,2 +1,3 @@
1
1
  export * from './render';
2
+ export * from './mock-data';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAaA,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAaA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
@@ -11,5 +11,6 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  export * from './render';
14
+ export * from './mock-data';
14
15
 
15
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test/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 './render';\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,UAAU,CAAC"}
1
+ {"version":3,"sources":["../../src/test/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 './render';\nexport * from './mock-data';\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,WAAW;AACzB,cAAc,cAAc"}
@@ -0,0 +1,3 @@
1
+ import { TimeSeriesData } from '@perses-dev/core';
2
+ export declare const MOCK_TIME_SERIES_DATA: TimeSeriesData;
3
+ //# sourceMappingURL=mock-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock-data.d.ts","sourceRoot":"","sources":["../../src/test/mock-data.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,eAAO,MAAM,qBAAqB,EAAE,cAsBnC,CAAC"}
@@ -0,0 +1,49 @@
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
+ export const MOCK_TIME_SERIES_DATA = {
14
+ timeRange: {
15
+ start: new Date(1666625490000),
16
+ end: new Date(1666625535000)
17
+ },
18
+ stepMs: 24379,
19
+ series: [
20
+ {
21
+ name: 'device="/dev/vda1", env="demo", fstype="ext4", instance="demo.do.prometheus.io:9100", job="node", mountpoint="/"',
22
+ values: [
23
+ [
24
+ 1666479357903,
25
+ 0.27700745551584494
26
+ ],
27
+ [
28
+ 1666479382282,
29
+ 0.27701284657366565
30
+ ]
31
+ ]
32
+ },
33
+ {
34
+ name: 'device="/dev/vda15", env="demo", fstype="vfat", instance="demo.do.prometheus.io:9100", job="node", mountpoint="/boot/efi"',
35
+ values: [
36
+ [
37
+ 1666479357903,
38
+ 0.08486496097624885
39
+ ],
40
+ [
41
+ 1666479382282,
42
+ 0.08486496097624885
43
+ ]
44
+ ]
45
+ }
46
+ ]
47
+ };
48
+
49
+ //# sourceMappingURL=mock-data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/test/mock-data.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\nimport { TimeSeriesData } from '@perses-dev/core';\n\nexport const MOCK_TIME_SERIES_DATA: TimeSeriesData = {\n timeRange: {\n start: new Date(1666625490000),\n end: new Date(1666625535000),\n },\n stepMs: 24379,\n series: [\n {\n name: 'device=\"/dev/vda1\", env=\"demo\", fstype=\"ext4\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/\"',\n values: [\n [1666479357903, 0.27700745551584494],\n [1666479382282, 0.27701284657366565],\n ],\n },\n {\n name: 'device=\"/dev/vda15\", env=\"demo\", fstype=\"vfat\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/boot/efi\"',\n values: [\n [1666479357903, 0.08486496097624885],\n [1666479382282, 0.08486496097624885],\n ],\n },\n ],\n};\n"],"names":["MOCK_TIME_SERIES_DATA","timeRange","start","Date","end","stepMs","series","name","values"],"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;AAIjC,OAAO,MAAMA,wBAAwC;IACnDC,WAAW;QACTC,OAAO,IAAIC,KAAK;QAChBC,KAAK,IAAID,KAAK;IAChB;IACAE,QAAQ;IACRC,QAAQ;QACN;YACEC,MAAM;YACNC,QAAQ;gBACN;oBAAC;oBAAe;iBAAoB;gBACpC;oBAAC;oBAAe;iBAAoB;aACrC;QACH;QACA;YACED,MAAM;YACNC,QAAQ;gBACN;oBAAC;oBAAe;iBAAoB;gBACpC;oBAAC;oBAAe;iBAAoB;aACrC;QACH;KACD;AACH,EAAE"}
@@ -36,12 +36,12 @@ const testLogger = {
36
36
  },
37
37
  logger: testLogger
38
38
  });
39
- var ref;
39
+ var _contextOptions_defaultPluginKinds;
40
40
  return render(/*#__PURE__*/ _jsx(QueryClientProvider, {
41
41
  client: queryClient,
42
42
  children: /*#__PURE__*/ _jsx(PluginRegistry, {
43
43
  pluginLoader: testPluginLoader,
44
- defaultPluginKinds: (ref = contextOptions === null || contextOptions === void 0 ? void 0 : contextOptions.defaultPluginKinds) !== null && ref !== void 0 ? ref : {
44
+ defaultPluginKinds: (_contextOptions_defaultPluginKinds = contextOptions === null || contextOptions === void 0 ? void 0 : contextOptions.defaultPluginKinds) !== null && _contextOptions_defaultPluginKinds !== void 0 ? _contextOptions_defaultPluginKinds : {
45
45
  TimeSeriesQuery: 'PrometheusTimeSeriesQuery'
46
46
  },
47
47
  children: ui
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test/render.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 { render, RenderOptions } from '@testing-library/react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { PluginRegistry } from '../components/PluginRegistry';\nimport { DefaultPluginKinds } from '../model';\nimport { testPluginLoader } from './test-plugins';\n\nconst testLogger = {\n log: console.log,\n warn: console.warn,\n error: () => {\n // Don't log network errors in tests to the console\n },\n};\n\ntype ContextOptions = {\n defaultPluginKinds?: DefaultPluginKinds;\n};\n\n/**\n * Test helper to render a React component with some common app-level providers, as well as the PluginRegistry\n * wrapped around it.\n */\nexport function renderWithContext(\n ui: React.ReactNode,\n renderOptions?: Omit<RenderOptions, 'queries'>,\n contextOptions?: ContextOptions\n) {\n // Create a new QueryClient for each test to avoid caching issues\n const queryClient = new QueryClient({\n defaultOptions: { queries: { refetchOnWindowFocus: false, retry: false } },\n logger: testLogger,\n });\n return render(\n <QueryClientProvider client={queryClient}>\n <PluginRegistry\n pluginLoader={testPluginLoader}\n defaultPluginKinds={\n contextOptions?.defaultPluginKinds ?? {\n TimeSeriesQuery: 'PrometheusTimeSeriesQuery',\n }\n }\n >\n {ui}\n </PluginRegistry>\n </QueryClientProvider>,\n renderOptions\n );\n}\n"],"names":["render","QueryClient","QueryClientProvider","PluginRegistry","testPluginLoader","testLogger","log","console","warn","error","renderWithContext","ui","renderOptions","contextOptions","queryClient","defaultOptions","queries","refetchOnWindowFocus","retry","logger","client","pluginLoader","defaultPluginKinds","TimeSeriesQuery"],"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,MAAM,QAAuB,wBAAwB,CAAC;AAC/D,SAASC,WAAW,EAAEC,mBAAmB,QAAQ,uBAAuB,CAAC;AACzE,SAASC,cAAc,QAAQ,8BAA8B,CAAC;AAE9D,SAASC,gBAAgB,QAAQ,gBAAgB,CAAC;AAElD,MAAMC,UAAU,GAAG;IACjBC,GAAG,EAAEC,OAAO,CAACD,GAAG;IAChBE,IAAI,EAAED,OAAO,CAACC,IAAI;IAClBC,KAAK,EAAE,IAAM;IACX,mDAAmD;IACrD,CAAC;CACF,AAAC;AAMF;;;CAGC,GACD,OAAO,SAASC,iBAAiB,CAC/BC,EAAmB,EACnBC,aAA8C,EAC9CC,cAA+B,EAC/B;IACA,iEAAiE;IACjE,MAAMC,WAAW,GAAG,IAAIb,WAAW,CAAC;QAClCc,cAAc,EAAE;YAAEC,OAAO,EAAE;gBAAEC,oBAAoB,EAAE,KAAK;gBAAEC,KAAK,EAAE,KAAK;aAAE;SAAE;QAC1EC,MAAM,EAAEd,UAAU;KACnB,CAAC,AAAC;QAMKQ,GAAkC;IAL1C,OAAOb,MAAM,eACX,KAACE,mBAAmB;QAACkB,MAAM,EAAEN,WAAW;kBACtC,cAAA,KAACX,cAAc;YACbkB,YAAY,EAAEjB,gBAAgB;YAC9BkB,kBAAkB,EAChBT,CAAAA,GAAkC,GAAlCA,cAAc,aAAdA,cAAc,WAAoB,GAAlCA,KAAAA,CAAkC,GAAlCA,cAAc,CAAES,kBAAkB,cAAlCT,GAAkC,cAAlCA,GAAkC,GAAI;gBACpCU,eAAe,EAAE,2BAA2B;aAC7C;sBAGFZ,EAAE;UACY;MACG,EACtBC,aAAa,CACd,CAAC;AACJ,CAAC"}
1
+ {"version":3,"sources":["../../src/test/render.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 { render, RenderOptions } from '@testing-library/react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { PluginRegistry } from '../components/PluginRegistry';\nimport { DefaultPluginKinds } from '../model';\nimport { testPluginLoader } from './test-plugins';\n\nconst testLogger = {\n log: console.log,\n warn: console.warn,\n error: () => {\n // Don't log network errors in tests to the console\n },\n};\n\ntype ContextOptions = {\n defaultPluginKinds?: DefaultPluginKinds;\n};\n\n/**\n * Test helper to render a React component with some common app-level providers, as well as the PluginRegistry\n * wrapped around it.\n */\nexport function renderWithContext(\n ui: React.ReactNode,\n renderOptions?: Omit<RenderOptions, 'queries'>,\n contextOptions?: ContextOptions\n) {\n // Create a new QueryClient for each test to avoid caching issues\n const queryClient = new QueryClient({\n defaultOptions: { queries: { refetchOnWindowFocus: false, retry: false } },\n logger: testLogger,\n });\n return render(\n <QueryClientProvider client={queryClient}>\n <PluginRegistry\n pluginLoader={testPluginLoader}\n defaultPluginKinds={\n contextOptions?.defaultPluginKinds ?? {\n TimeSeriesQuery: 'PrometheusTimeSeriesQuery',\n }\n }\n >\n {ui}\n </PluginRegistry>\n </QueryClientProvider>,\n renderOptions\n );\n}\n"],"names":["render","QueryClient","QueryClientProvider","PluginRegistry","testPluginLoader","testLogger","log","console","warn","error","renderWithContext","ui","renderOptions","contextOptions","queryClient","defaultOptions","queries","refetchOnWindowFocus","retry","logger","client","pluginLoader","defaultPluginKinds","TimeSeriesQuery"],"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,MAAM,QAAuB,yBAAyB;AAC/D,SAASC,WAAW,EAAEC,mBAAmB,QAAQ,wBAAwB;AACzE,SAASC,cAAc,QAAQ,+BAA+B;AAE9D,SAASC,gBAAgB,QAAQ,iBAAiB;AAElD,MAAMC,aAAa;IACjBC,KAAKC,QAAQD;IACbE,MAAMD,QAAQC;IACdC,OAAO;IACL,mDAAmD;IACrD;AACF;AAMA;;;CAGC,GACD,OAAO,SAASC,kBACdC,EAAmB,EACnBC,aAA8C,EAC9CC,cAA+B;IAE/B,iEAAiE;IACjE,MAAMC,cAAc,IAAIb,YAAY;QAClCc,gBAAgB;YAAEC,SAAS;gBAAEC,sBAAsB;gBAAOC,OAAO;YAAM;QAAE;QACzEC,QAAQd;IACV;QAMQQ;IALR,OAAOb,qBACL,KAACE;QAAoBkB,QAAQN;kBAC3B,cAAA,KAACX;YACCkB,cAAcjB;YACdkB,oBACET,CAAAA,qCAAAA,2BAAAA,4BAAAA,KAAAA,IAAAA,eAAgBS,gCAAhBT,gDAAAA,qCAAsC;gBACpCU,iBAAiB;YACnB;sBAGDZ;;QAGLC;AAEJ"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test/setup-tests.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\n// Add testing library assertions\nimport '@testing-library/jest-dom/extend-expect';\n\n// Always mock e-charts during tests since we don't have a proper canvas in jsdom\njest.mock('echarts/core');\n"],"names":["jest","mock"],"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,iCAAiC;AACjC,OAAO,yCAAyC,CAAC;AAEjD,iFAAiF;AACjFA,IAAI,CAACC,IAAI,CAAC,cAAc,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../src/test/setup-tests.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\n// Add testing library assertions\nimport '@testing-library/jest-dom/extend-expect';\n\n// Always mock e-charts during tests since we don't have a proper canvas in jsdom\njest.mock('echarts/core');\n"],"names":["jest","mock"],"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,iCAAiC;AACjC,OAAO,0CAA0C;AAEjD,iFAAiF;AACjFA,KAAKC,KAAK"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/test/test-plugins/bert/index.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 { OptionsEditorProps, PanelPlugin } from '../../../model';\n\nfunction BertPanel1Editor({ value, onChange }: OptionsEditorProps<{ option1: string }>) {\n return (\n <div>\n <label htmlFor=\"editor-input\">BertPanel1 editor</label>\n <input\n type=\"text\"\n id=\"editor-input\"\n value={value.option1}\n onChange={(e) => onChange({ ...value, option1: e.target.value })}\n />\n </div>\n );\n}\n\n// Dummy plugins to test loading\nexport const BertPanel1: PanelPlugin<{ option1: string }> = {\n PanelComponent: () => null,\n panelOptionsEditorComponents: [\n {\n label: 'Editor',\n content: BertPanel1Editor,\n },\n ],\n createInitialOptions: () => ({ option1: '' }),\n};\n\nexport const BertPanel2: PanelPlugin<{ option2: string }> = {\n PanelComponent: () => null,\n panelOptionsEditorComponents: [\n {\n label: 'Settings',\n content: function BertPanel2Editor({ value, onChange }) {\n return (\n <div>\n <label htmlFor=\"editor-input\">BertPanel2 editor</label>\n <input\n type=\"text\"\n id=\"editor-input\"\n value={value.option2}\n onChange={(e) => onChange({ ...value, option2: e.target.value })}\n />\n </div>\n );\n },\n },\n {\n label: 'Custom Tab',\n content: function Editor() {\n return <div>custom content</div>;\n },\n },\n ],\n createInitialOptions: () => ({ option2: '' }),\n hideQueryEditor: true,\n};\n"],"names":["BertPanel1Editor","value","onChange","div","label","htmlFor","input","type","id","option1","e","target","BertPanel1","PanelComponent","panelOptionsEditorComponents","content","createInitialOptions","BertPanel2","BertPanel2Editor","option2","Editor","hideQueryEditor"],"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;AAEA,SAASA,gBAAgB,CAAC,EAAEC,KAAK,CAAA,EAAEC,QAAQ,CAAA,EAA2C,EAAE;IACtF,qBACE,MAACC,KAAG;;0BACF,KAACC,OAAK;gBAACC,OAAO,EAAC,cAAc;0BAAC,mBAAiB;cAAQ;0BACvD,KAACC,OAAK;gBACJC,IAAI,EAAC,MAAM;gBACXC,EAAE,EAAC,cAAc;gBACjBP,KAAK,EAAEA,KAAK,CAACQ,OAAO;gBACpBP,QAAQ,EAAE,CAACQ,CAAC,GAAKR,QAAQ,CAAC;wBAAE,GAAGD,KAAK;wBAAEQ,OAAO,EAAEC,CAAC,CAACC,MAAM,CAACV,KAAK;qBAAE,CAAC;cAChE;;MACE,CACN;AACJ,CAAC;AAED,gCAAgC;AAChC,OAAO,MAAMW,UAAU,GAAqC;IAC1DC,cAAc,EAAE,IAAM,IAAI;IAC1BC,4BAA4B,EAAE;QAC5B;YACEV,KAAK,EAAE,QAAQ;YACfW,OAAO,EAAEf,gBAAgB;SAC1B;KACF;IACDgB,oBAAoB,EAAE,IAAO,CAAA;YAAEP,OAAO,EAAE,EAAE;SAAE,CAAA,AAAC;CAC9C,CAAC;AAEF,OAAO,MAAMQ,UAAU,GAAqC;IAC1DJ,cAAc,EAAE,IAAM,IAAI;IAC1BC,4BAA4B,EAAE;QAC5B;YACEV,KAAK,EAAE,UAAU;YACjBW,OAAO,EAAE,SAASG,gBAAgB,CAAC,EAAEjB,KAAK,CAAA,EAAEC,QAAQ,CAAA,EAAE,EAAE;gBACtD,qBACE,MAACC,KAAG;;sCACF,KAACC,OAAK;4BAACC,OAAO,EAAC,cAAc;sCAAC,mBAAiB;0BAAQ;sCACvD,KAACC,OAAK;4BACJC,IAAI,EAAC,MAAM;4BACXC,EAAE,EAAC,cAAc;4BACjBP,KAAK,EAAEA,KAAK,CAACkB,OAAO;4BACpBjB,QAAQ,EAAE,CAACQ,CAAC,GAAKR,QAAQ,CAAC;oCAAE,GAAGD,KAAK;oCAAEkB,OAAO,EAAET,CAAC,CAACC,MAAM,CAACV,KAAK;iCAAE,CAAC;0BAChE;;kBACE,CACN;YACJ,CAAC;SACF;QACD;YACEG,KAAK,EAAE,YAAY;YACnBW,OAAO,EAAE,SAASK,MAAM,GAAG;gBACzB,qBAAO,KAACjB,KAAG;8BAAC,gBAAc;kBAAM,CAAC;YACnC,CAAC;SACF;KACF;IACDa,oBAAoB,EAAE,IAAO,CAAA;YAAEG,OAAO,EAAE,EAAE;SAAE,CAAA,AAAC;IAC7CE,eAAe,EAAE,IAAI;CACtB,CAAC"}
1
+ {"version":3,"sources":["../../../../src/test/test-plugins/bert/index.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 { OptionsEditorProps, PanelPlugin } from '../../../model';\n\nfunction BertPanel1Editor({ value, onChange }: OptionsEditorProps<{ option1: string }>) {\n return (\n <div>\n <label htmlFor=\"editor-input\">BertPanel1 editor</label>\n <input\n type=\"text\"\n id=\"editor-input\"\n value={value.option1}\n onChange={(e) => onChange({ ...value, option1: e.target.value })}\n />\n </div>\n );\n}\n\n// Dummy plugins to test loading\nexport const BertPanel1: PanelPlugin<{ option1: string }> = {\n PanelComponent: () => null,\n panelOptionsEditorComponents: [\n {\n label: 'Editor',\n content: BertPanel1Editor,\n },\n ],\n createInitialOptions: () => ({ option1: '' }),\n};\n\nexport const BertPanel2: PanelPlugin<{ option2: string }> = {\n PanelComponent: () => null,\n panelOptionsEditorComponents: [\n {\n label: 'Settings',\n content: function BertPanel2Editor({ value, onChange }) {\n return (\n <div>\n <label htmlFor=\"editor-input\">BertPanel2 editor</label>\n <input\n type=\"text\"\n id=\"editor-input\"\n value={value.option2}\n onChange={(e) => onChange({ ...value, option2: e.target.value })}\n />\n </div>\n );\n },\n },\n {\n label: 'Custom Tab',\n content: function Editor() {\n return <div>custom content</div>;\n },\n },\n ],\n createInitialOptions: () => ({ option2: '' }),\n hideQueryEditor: true,\n};\n"],"names":["BertPanel1Editor","value","onChange","div","label","htmlFor","input","type","id","option1","e","target","BertPanel1","PanelComponent","panelOptionsEditorComponents","content","createInitialOptions","BertPanel2","BertPanel2Editor","option2","Editor","hideQueryEditor"],"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;;AAIjC,SAASA,iBAAiB,EAAEC,MAAK,EAAEC,SAAQ,EAA2C;IACpF,qBACE,MAACC;;0BACC,KAACC;gBAAMC,SAAQ;0BAAe;;0BAC9B,KAACC;gBACCC,MAAK;gBACLC,IAAG;gBACHP,OAAOA,MAAMQ;gBACbP,UAAU,CAACQ,IAAMR,SAAS;wBAAE,GAAGD,KAAK;wBAAEQ,SAASC,EAAEC,OAAOV;oBAAM;;;;AAItE;AAEA,gCAAgC;AAChC,OAAO,MAAMW,aAA+C;IAC1DC,gBAAgB,IAAM;IACtBC,8BAA8B;QAC5B;YACEV,OAAO;YACPW,SAASf;QACX;KACD;IACDgB,sBAAsB,IAAO,CAAA;YAAEP,SAAS;QAAG,CAAA;AAC7C,EAAE;AAEF,OAAO,MAAMQ,aAA+C;IAC1DJ,gBAAgB,IAAM;IACtBC,8BAA8B;QAC5B;YACEV,OAAO;YACPW,SAAS,SAASG,iBAAiB,EAAEjB,MAAK,EAAEC,SAAQ,EAAE;gBACpD,qBACE,MAACC;;sCACC,KAACC;4BAAMC,SAAQ;sCAAe;;sCAC9B,KAACC;4BACCC,MAAK;4BACLC,IAAG;4BACHP,OAAOA,MAAMkB;4BACbjB,UAAU,CAACQ,IAAMR,SAAS;oCAAE,GAAGD,KAAK;oCAAEkB,SAAST,EAAEC,OAAOV;gCAAM;;;;YAItE;QACF;QACA;YACEG,OAAO;YACPW,SAAS,SAASK;gBAChB,qBAAO,KAACjB;8BAAI;;YACd;QACF;KACD;IACDa,sBAAsB,IAAO,CAAA;YAAEG,SAAS;QAAG,CAAA;IAC3CE,iBAAiB;AACnB,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/test/test-plugins/ernie/index.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 { VariablePlugin, VariableOption } from '../../../model';\n\nconst data: VariableOption[] = [\n { label: 'Grover', value: 'Grover' },\n { label: 'Snuffleupagus', value: 'Snuffleupagus' },\n];\n\n// Dummy plugin to test loading\nexport const ErnieVariable1: VariablePlugin<{ variableOption: string }> = {\n getVariableOptions: async () => ({ data }),\n OptionsEditorComponent: function ErnieVariableEditor({ value, onChange }) {\n return (\n <div>\n <label htmlFor=\"editor-input\">ErnieVariable editor</label>\n <input\n type=\"text\"\n id=\"editor-input\"\n value={value.variableOption}\n onChange={(e) => onChange({ ...value, variableOption: e.target.value })}\n />\n </div>\n );\n },\n createInitialOptions: () => ({ variableOption: '' }),\n};\n\nexport const ErnieVariable2: VariablePlugin<{ variableOption2: string }> = {\n getVariableOptions: async () => ({ data }),\n OptionsEditorComponent: function ErnieVariableEditor({ value, onChange }) {\n return (\n <div>\n <label htmlFor=\"editor-input\">ErnieVariable2 editor</label>\n <input\n type=\"text\"\n id=\"editor-input\"\n value={value.variableOption2}\n onChange={(e) => onChange({ ...value, variableOption2: e.target.value })}\n />\n </div>\n );\n },\n createInitialOptions: () => ({ variableOption2: '' }),\n};\n"],"names":["data","label","value","ErnieVariable1","getVariableOptions","OptionsEditorComponent","ErnieVariableEditor","onChange","div","htmlFor","input","type","id","variableOption","e","target","createInitialOptions","ErnieVariable2","variableOption2"],"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;AAEA,MAAMA,IAAI,GAAqB;IAC7B;QAAEC,KAAK,EAAE,QAAQ;QAAEC,KAAK,EAAE,QAAQ;KAAE;IACpC;QAAED,KAAK,EAAE,eAAe;QAAEC,KAAK,EAAE,eAAe;KAAE;CACnD,AAAC;AAEF,+BAA+B;AAC/B,OAAO,MAAMC,cAAc,GAA+C;IACxEC,kBAAkB,EAAE,UAAa,CAAA;YAAEJ,IAAI;SAAE,CAAA,AAAC;IAC1CK,sBAAsB,EAAE,SAASC,mBAAmB,CAAC,EAAEJ,KAAK,CAAA,EAAEK,QAAQ,CAAA,EAAE,EAAE;QACxE,qBACE,MAACC,KAAG;;8BACF,KAACP,OAAK;oBAACQ,OAAO,EAAC,cAAc;8BAAC,sBAAoB;kBAAQ;8BAC1D,KAACC,OAAK;oBACJC,IAAI,EAAC,MAAM;oBACXC,EAAE,EAAC,cAAc;oBACjBV,KAAK,EAAEA,KAAK,CAACW,cAAc;oBAC3BN,QAAQ,EAAE,CAACO,CAAC,GAAKP,QAAQ,CAAC;4BAAE,GAAGL,KAAK;4BAAEW,cAAc,EAAEC,CAAC,CAACC,MAAM,CAACb,KAAK;yBAAE,CAAC;kBACvE;;UACE,CACN;IACJ,CAAC;IACDc,oBAAoB,EAAE,IAAO,CAAA;YAAEH,cAAc,EAAE,EAAE;SAAE,CAAA,AAAC;CACrD,CAAC;AAEF,OAAO,MAAMI,cAAc,GAAgD;IACzEb,kBAAkB,EAAE,UAAa,CAAA;YAAEJ,IAAI;SAAE,CAAA,AAAC;IAC1CK,sBAAsB,EAAE,SAASC,mBAAmB,CAAC,EAAEJ,KAAK,CAAA,EAAEK,QAAQ,CAAA,EAAE,EAAE;QACxE,qBACE,MAACC,KAAG;;8BACF,KAACP,OAAK;oBAACQ,OAAO,EAAC,cAAc;8BAAC,uBAAqB;kBAAQ;8BAC3D,KAACC,OAAK;oBACJC,IAAI,EAAC,MAAM;oBACXC,EAAE,EAAC,cAAc;oBACjBV,KAAK,EAAEA,KAAK,CAACgB,eAAe;oBAC5BX,QAAQ,EAAE,CAACO,CAAC,GAAKP,QAAQ,CAAC;4BAAE,GAAGL,KAAK;4BAAEgB,eAAe,EAAEJ,CAAC,CAACC,MAAM,CAACb,KAAK;yBAAE,CAAC;kBACxE;;UACE,CACN;IACJ,CAAC;IACDc,oBAAoB,EAAE,IAAO,CAAA;YAAEE,eAAe,EAAE,EAAE;SAAE,CAAA,AAAC;CACtD,CAAC"}
1
+ {"version":3,"sources":["../../../../src/test/test-plugins/ernie/index.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 { VariablePlugin, VariableOption } from '../../../model';\n\nconst data: VariableOption[] = [\n { label: 'Grover', value: 'Grover' },\n { label: 'Snuffleupagus', value: 'Snuffleupagus' },\n];\n\n// Dummy plugin to test loading\nexport const ErnieVariable1: VariablePlugin<{ variableOption: string }> = {\n getVariableOptions: async () => ({ data }),\n OptionsEditorComponent: function ErnieVariableEditor({ value, onChange }) {\n return (\n <div>\n <label htmlFor=\"editor-input\">ErnieVariable editor</label>\n <input\n type=\"text\"\n id=\"editor-input\"\n value={value.variableOption}\n onChange={(e) => onChange({ ...value, variableOption: e.target.value })}\n />\n </div>\n );\n },\n createInitialOptions: () => ({ variableOption: '' }),\n};\n\nexport const ErnieVariable2: VariablePlugin<{ variableOption2: string }> = {\n getVariableOptions: async () => ({ data }),\n OptionsEditorComponent: function ErnieVariableEditor({ value, onChange }) {\n return (\n <div>\n <label htmlFor=\"editor-input\">ErnieVariable2 editor</label>\n <input\n type=\"text\"\n id=\"editor-input\"\n value={value.variableOption2}\n onChange={(e) => onChange({ ...value, variableOption2: e.target.value })}\n />\n </div>\n );\n },\n createInitialOptions: () => ({ variableOption2: '' }),\n};\n"],"names":["data","label","value","ErnieVariable1","getVariableOptions","OptionsEditorComponent","ErnieVariableEditor","onChange","div","htmlFor","input","type","id","variableOption","e","target","createInitialOptions","ErnieVariable2","variableOption2"],"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;;AAIjC,MAAMA,OAAyB;IAC7B;QAAEC,OAAO;QAAUC,OAAO;IAAS;IACnC;QAAED,OAAO;QAAiBC,OAAO;IAAgB;CAClD;AAED,+BAA+B;AAC/B,OAAO,MAAMC,iBAA6D;IACxEC,oBAAoB,UAAa,CAAA;YAAEJ;QAAK,CAAA;IACxCK,wBAAwB,SAASC,oBAAoB,EAAEJ,MAAK,EAAEK,SAAQ,EAAE;QACtE,qBACE,MAACC;;8BACC,KAACP;oBAAMQ,SAAQ;8BAAe;;8BAC9B,KAACC;oBACCC,MAAK;oBACLC,IAAG;oBACHV,OAAOA,MAAMW;oBACbN,UAAU,CAACO,IAAMP,SAAS;4BAAE,GAAGL,KAAK;4BAAEW,gBAAgBC,EAAEC,OAAOb;wBAAM;;;;IAI7E;IACAc,sBAAsB,IAAO,CAAA;YAAEH,gBAAgB;QAAG,CAAA;AACpD,EAAE;AAEF,OAAO,MAAMI,iBAA8D;IACzEb,oBAAoB,UAAa,CAAA;YAAEJ;QAAK,CAAA;IACxCK,wBAAwB,SAASC,oBAAoB,EAAEJ,MAAK,EAAEK,SAAQ,EAAE;QACtE,qBACE,MAACC;;8BACC,KAACP;oBAAMQ,SAAQ;8BAAe;;8BAC9B,KAACC;oBACCC,MAAK;oBACLC,IAAG;oBACHV,OAAOA,MAAMgB;oBACbX,UAAU,CAACO,IAAMP,SAAS;4BAAE,GAAGL,KAAK;4BAAEgB,iBAAiBJ,EAAEC,OAAOb;wBAAM;;;;IAI9E;IACAc,sBAAsB,IAAO,CAAA;YAAEE,iBAAiB;QAAG,CAAA;AACrD,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/test/test-plugins/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\nimport { dynamicImportPluginLoader, PluginLoader, PluginModuleResource } from '../../model';\nimport bertResource from './bert/plugin.json';\nimport ernieResource from './ernie/plugin.json';\n\n/**\n * A PluginLoader for tests that will dynamically load the plugins in this folder.\n */\nexport const testPluginLoader: PluginLoader = dynamicImportPluginLoader([\n { resource: bertResource as PluginModuleResource, importPlugin: () => import('./bert') },\n { resource: ernieResource as PluginModuleResource, importPlugin: () => import('./ernie') },\n]);\n"],"names":["dynamicImportPluginLoader","bertResource","ernieResource","testPluginLoader","resource","importPlugin"],"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,yBAAyB,QAA4C,aAAa,CAAC;AAC5F,OAAOC,YAAY,MAAM,oBAAoB,CAAC;AAC9C,OAAOC,aAAa,MAAM,qBAAqB,CAAC;AAEhD;;CAEC,GACD,OAAO,MAAMC,gBAAgB,GAAiBH,yBAAyB,CAAC;IACtE;QAAEI,QAAQ,EAAEH,YAAY;QAA0BI,YAAY,EAAE,IAAM,MAAM,CAAC,QAAQ,CAAC;KAAE;IACxF;QAAED,QAAQ,EAAEF,aAAa;QAA0BG,YAAY,EAAE,IAAM,MAAM,CAAC,SAAS,CAAC;KAAE;CAC3F,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../../src/test/test-plugins/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\nimport { dynamicImportPluginLoader, PluginLoader, PluginModuleResource } from '../../model';\nimport bertResource from './bert/plugin.json';\nimport ernieResource from './ernie/plugin.json';\n\n/**\n * A PluginLoader for tests that will dynamically load the plugins in this folder.\n */\nexport const testPluginLoader: PluginLoader = dynamicImportPluginLoader([\n { resource: bertResource as PluginModuleResource, importPlugin: () => import('./bert') },\n { resource: ernieResource as PluginModuleResource, importPlugin: () => import('./ernie') },\n]);\n"],"names":["dynamicImportPluginLoader","bertResource","ernieResource","testPluginLoader","resource","importPlugin"],"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,yBAAyB,QAA4C,cAAc;AAC5F,OAAOC,kBAAkB,qBAAqB;AAC9C,OAAOC,mBAAmB,sBAAsB;AAEhD;;CAEC,GACD,OAAO,MAAMC,mBAAiCH,0BAA0B;IACtE;QAAEI,UAAUH;QAAsCI,cAAc,IAAM,MAAM,CAAC;IAAU;IACvF;QAAED,UAAUF;QAAuCG,cAAc,IAAM,MAAM,CAAC;IAAW;CAC1F,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test-utils/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 './mock-plugin-registry';\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,CAAC"}
1
+ {"version":3,"sources":["../../src/test-utils/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 './mock-plugin-registry';\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,yBAAyB"}
@@ -18,8 +18,8 @@
18
18
  kind: 'PluginModule',
19
19
  metadata: {
20
20
  name: 'Fake Plugin Module for Tests',
21
- created_at: '',
22
- updated_at: '',
21
+ createdAt: '',
22
+ updatedAt: '',
23
23
  version: 0
24
24
  },
25
25
  spec: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test-utils/mock-plugin-registry.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 { UnknownSpec } from '@perses-dev/core';\nimport { PluginRegistryProps } from '../components';\nimport { PluginModuleResource, Plugin, PluginLoader, PluginImplementation, PluginType } from '../model';\n\nexport type MockPlugin = {\n [T in PluginType]: {\n pluginType: T;\n kind: string;\n plugin: PluginImplementation<T>;\n };\n}[PluginType];\n\n/**\n * Helper for mocking `PluginRegistry` data during tests. Returns props that can be spread on the `PluginRegistry`\n * component so that it will load the mock plugins you provide.\n */\nexport function mockPluginRegistry(...mockPlugins: MockPlugin[]): Omit<PluginRegistryProps, 'children'> {\n const mockPluginResource: PluginModuleResource = {\n kind: 'PluginModule',\n metadata: {\n name: 'Fake Plugin Module for Tests',\n created_at: '',\n updated_at: '',\n version: 0,\n },\n spec: {\n // Add metadata for all mock plugins\n plugins: mockPlugins.map(({ pluginType, kind }) => ({\n pluginType,\n kind,\n display: {\n name: getMockPluginName(pluginType, kind),\n },\n })),\n },\n };\n\n const mockPluginModule: Record<string, Plugin<UnknownSpec>> = {};\n for (const mockPlugin of mockPlugins) {\n // \"Export\" on the module under the same name as the kind the plugin handles\n mockPluginModule[mockPlugin.kind] = mockPlugin.plugin;\n }\n\n const pluginLoader: PluginLoader = {\n getInstalledPlugins() {\n return Promise.resolve([mockPluginResource]);\n },\n importPluginModule(/* resource */) {\n return Promise.resolve(mockPluginModule);\n },\n };\n\n return {\n pluginLoader,\n defaultPluginKinds: {\n TimeSeriesQuery: 'PrometheusTimeSeriesQuery',\n },\n };\n}\n\n/**\n * The function that's used to generate the display name of mocked plugins in mockPluginRegistry. Can be useful if you\n * need to interact with some UI component that's displaying it.\n */\nexport function getMockPluginName(pluginType: PluginType, kind: string) {\n return `${pluginType} Plugin for ${kind}`;\n}\n"],"names":["mockPluginRegistry","mockPlugins","mockPluginResource","kind","metadata","name","created_at","updated_at","version","spec","plugins","map","pluginType","display","getMockPluginName","mockPluginModule","mockPlugin","plugin","pluginLoader","getInstalledPlugins","Promise","resolve","importPluginModule","defaultPluginKinds","TimeSeriesQuery"],"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;AAcjC;;;CAGC,GACD,OAAO,SAASA,kBAAkB,CAAC,GAAGC,WAAW,AAAc,EAAyC;IACtG,MAAMC,kBAAkB,GAAyB;QAC/CC,IAAI,EAAE,cAAc;QACpBC,QAAQ,EAAE;YACRC,IAAI,EAAE,8BAA8B;YACpCC,UAAU,EAAE,EAAE;YACdC,UAAU,EAAE,EAAE;YACdC,OAAO,EAAE,CAAC;SACX;QACDC,IAAI,EAAE;YACJ,oCAAoC;YACpCC,OAAO,EAAET,WAAW,CAACU,GAAG,CAAC,CAAC,EAAEC,UAAU,CAAA,EAAET,IAAI,CAAA,EAAE,GAAM,CAAA;oBAClDS,UAAU;oBACVT,IAAI;oBACJU,OAAO,EAAE;wBACPR,IAAI,EAAES,iBAAiB,CAACF,UAAU,EAAET,IAAI,CAAC;qBAC1C;iBACF,CAAA,AAAC,CAAC;SACJ;KACF,AAAC;IAEF,MAAMY,gBAAgB,GAAwC,EAAE,AAAC;IACjE,KAAK,MAAMC,UAAU,IAAIf,WAAW,CAAE;QACpC,4EAA4E;QAC5Ec,gBAAgB,CAACC,UAAU,CAACb,IAAI,CAAC,GAAGa,UAAU,CAACC,MAAM,CAAC;IACxD,CAAC;IAED,MAAMC,YAAY,GAAiB;QACjCC,mBAAmB,IAAG;YACpB,OAAOC,OAAO,CAACC,OAAO,CAAC;gBAACnB,kBAAkB;aAAC,CAAC,CAAC;QAC/C,CAAC;QACDoB,kBAAkB,IAAiB;YACjC,OAAOF,OAAO,CAACC,OAAO,CAACN,gBAAgB,CAAC,CAAC;QAC3C,CAAC;KACF,AAAC;IAEF,OAAO;QACLG,YAAY;QACZK,kBAAkB,EAAE;YAClBC,eAAe,EAAE,2BAA2B;SAC7C;KACF,CAAC;AACJ,CAAC;AAED;;;CAGC,GACD,OAAO,SAASV,iBAAiB,CAACF,UAAsB,EAAET,IAAY,EAAE;IACtE,OAAO,CAAC,EAAES,UAAU,CAAC,YAAY,EAAET,IAAI,CAAC,CAAC,CAAC;AAC5C,CAAC"}
1
+ {"version":3,"sources":["../../src/test-utils/mock-plugin-registry.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 { UnknownSpec } from '@perses-dev/core';\nimport { PluginRegistryProps } from '../components';\nimport { PluginModuleResource, Plugin, PluginLoader, PluginImplementation, PluginType } from '../model';\n\nexport type MockPlugin = {\n [T in PluginType]: {\n pluginType: T;\n kind: string;\n plugin: PluginImplementation<T>;\n };\n}[PluginType];\n\n/**\n * Helper for mocking `PluginRegistry` data during tests. Returns props that can be spread on the `PluginRegistry`\n * component so that it will load the mock plugins you provide.\n */\nexport function mockPluginRegistry(...mockPlugins: MockPlugin[]): Omit<PluginRegistryProps, 'children'> {\n const mockPluginResource: PluginModuleResource = {\n kind: 'PluginModule',\n metadata: {\n name: 'Fake Plugin Module for Tests',\n createdAt: '',\n updatedAt: '',\n version: 0,\n },\n spec: {\n // Add metadata for all mock plugins\n plugins: mockPlugins.map(({ pluginType, kind }) => ({\n pluginType,\n kind,\n display: {\n name: getMockPluginName(pluginType, kind),\n },\n })),\n },\n };\n\n const mockPluginModule: Record<string, Plugin<UnknownSpec>> = {};\n for (const mockPlugin of mockPlugins) {\n // \"Export\" on the module under the same name as the kind the plugin handles\n mockPluginModule[mockPlugin.kind] = mockPlugin.plugin;\n }\n\n const pluginLoader: PluginLoader = {\n getInstalledPlugins() {\n return Promise.resolve([mockPluginResource]);\n },\n importPluginModule(/* resource */) {\n return Promise.resolve(mockPluginModule);\n },\n };\n\n return {\n pluginLoader,\n defaultPluginKinds: {\n TimeSeriesQuery: 'PrometheusTimeSeriesQuery',\n },\n };\n}\n\n/**\n * The function that's used to generate the display name of mocked plugins in mockPluginRegistry. Can be useful if you\n * need to interact with some UI component that's displaying it.\n */\nexport function getMockPluginName(pluginType: PluginType, kind: string) {\n return `${pluginType} Plugin for ${kind}`;\n}\n"],"names":["mockPluginRegistry","mockPlugins","mockPluginResource","kind","metadata","name","createdAt","updatedAt","version","spec","plugins","map","pluginType","display","getMockPluginName","mockPluginModule","mockPlugin","plugin","pluginLoader","getInstalledPlugins","Promise","resolve","importPluginModule","defaultPluginKinds","TimeSeriesQuery"],"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;AAcjC;;;CAGC,GACD,OAAO,SAASA,mBAAmB,GAAGC,WAAyB;IAC7D,MAAMC,qBAA2C;QAC/CC,MAAM;QACNC,UAAU;YACRC,MAAM;YACNC,WAAW;YACXC,WAAW;YACXC,SAAS;QACX;QACAC,MAAM;YACJ,oCAAoC;YACpCC,SAAST,YAAYU,IAAI,CAAC,EAAEC,WAAU,EAAET,KAAI,EAAE,GAAM,CAAA;oBAClDS;oBACAT;oBACAU,SAAS;wBACPR,MAAMS,kBAAkBF,YAAYT;oBACtC;gBACF,CAAA;QACF;IACF;IAEA,MAAMY,mBAAwD,CAAC;IAC/D,KAAK,MAAMC,cAAcf,YAAa;QACpC,4EAA4E;QAC5Ec,gBAAgB,CAACC,WAAWb,KAAK,GAAGa,WAAWC;IACjD;IAEA,MAAMC,eAA6B;QACjCC;YACE,OAAOC,QAAQC,QAAQ;gBAACnB;aAAmB;QAC7C;QACAoB;YACE,OAAOF,QAAQC,QAAQN;QACzB;IACF;IAEA,OAAO;QACLG;QACAK,oBAAoB;YAClBC,iBAAiB;QACnB;IACF;AACF;AAEA;;;CAGC,GACD,OAAO,SAASV,kBAAkBF,UAAsB,EAAET,IAAY;IACpE,OAAO,CAAC,EAAES,WAAW,YAAY,EAAET,KAAK,CAAC;AAC3C"}
@@ -0,0 +1,4 @@
1
+ export declare type Action = 'create' | 'read' | 'update';
2
+ export declare function getTitleAction(action: Action, isDraft: boolean): string;
3
+ export declare function getSubmitText(action: Action, isDraft: boolean): string;
4
+ //# sourceMappingURL=action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/utils/action.ts"],"names":[],"mappings":"AAaA,oBAAY,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;AAElD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAMvE;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAKtE"}