@perses-dev/plugin-system 0.41.1 → 0.42.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 (166) hide show
  1. package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +26 -55
  2. package/dist/cjs/components/DatasourceSelect.js +22 -10
  3. package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +1 -0
  4. package/dist/cjs/components/PluginEditor/PluginEditor.js +2 -1
  5. package/dist/cjs/components/ProjectSelect.js +96 -0
  6. package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +14 -12
  7. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +50 -2
  8. package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +11 -8
  9. package/dist/cjs/components/index.js +1 -0
  10. package/dist/cjs/context/ProjectStoreProvider.js +78 -0
  11. package/dist/cjs/context/index.js +30 -0
  12. package/dist/cjs/context/query-params.js +49 -0
  13. package/dist/cjs/index.js +1 -0
  14. package/dist/cjs/model/index.js +1 -0
  15. package/dist/cjs/model/trace-queries.js +16 -0
  16. package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +17 -5
  17. package/dist/cjs/runtime/DataQueriesProvider/model.js +27 -7
  18. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +27 -18
  19. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js +43 -0
  20. package/dist/cjs/runtime/TimeRangeProvider/index.js +1 -0
  21. package/dist/cjs/runtime/TimeRangeProvider/query-params.js +7 -39
  22. package/dist/cjs/runtime/TimeRangeProvider/refresh-interval.js +30 -0
  23. package/dist/cjs/runtime/datasources.js +3 -2
  24. package/dist/cjs/runtime/index.js +1 -0
  25. package/dist/cjs/runtime/trace-queries.js +59 -0
  26. package/dist/cjs/stories/shared-utils/decorators/WithPluginRegistry.js +2 -1
  27. package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +12 -0
  28. package/dist/cjs/stories/shared-utils/decorators/WithTimeRange.js +2 -2
  29. package/dist/cjs/test/mock-data.js +26 -3
  30. package/dist/cjs/validation/role.js +85 -0
  31. package/dist/cjs/validation/rolebinding.js +55 -0
  32. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts +7 -7
  33. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -1
  34. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +26 -16
  35. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
  36. package/dist/components/DatasourceSelect.d.ts +1 -0
  37. package/dist/components/DatasourceSelect.d.ts.map +1 -1
  38. package/dist/components/DatasourceSelect.js +22 -10
  39. package/dist/components/DatasourceSelect.js.map +1 -1
  40. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts +1 -1
  41. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
  42. package/dist/components/PanelSpecEditor/PanelSpecEditor.js +1 -0
  43. package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
  44. package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -1
  45. package/dist/components/PluginEditor/PluginEditor.js +2 -1
  46. package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
  47. package/dist/components/PluginEditor/plugin-editor-api.d.ts +1 -0
  48. package/dist/components/PluginEditor/plugin-editor-api.d.ts.map +1 -1
  49. package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
  50. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts +1 -0
  51. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts.map +1 -1
  52. package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
  53. package/dist/components/ProjectSelect.d.ts +15 -0
  54. package/dist/components/ProjectSelect.d.ts.map +1 -0
  55. package/dist/components/ProjectSelect.js +91 -0
  56. package/dist/components/ProjectSelect.js.map +1 -0
  57. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts.map +1 -1
  58. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +15 -13
  59. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js.map +1 -1
  60. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +1 -2
  61. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  62. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +50 -2
  63. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  64. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +2 -1
  65. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
  66. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +11 -8
  67. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
  68. package/dist/components/index.d.ts +1 -0
  69. package/dist/components/index.d.ts.map +1 -1
  70. package/dist/components/index.js +1 -0
  71. package/dist/components/index.js.map +1 -1
  72. package/dist/context/ProjectStoreProvider.d.ts +16 -0
  73. package/dist/context/ProjectStoreProvider.d.ts.map +1 -0
  74. package/dist/context/ProjectStoreProvider.js +56 -0
  75. package/dist/context/ProjectStoreProvider.js.map +1 -0
  76. package/dist/context/index.d.ts +2 -0
  77. package/dist/context/index.d.ts.map +1 -0
  78. package/dist/context/index.js +15 -0
  79. package/dist/context/index.js.map +1 -0
  80. package/dist/context/query-params.d.ts +5 -0
  81. package/dist/context/query-params.d.ts.map +1 -0
  82. package/dist/context/query-params.js +41 -0
  83. package/dist/context/query-params.js.map +1 -0
  84. package/dist/index.d.ts +1 -0
  85. package/dist/index.d.ts.map +1 -1
  86. package/dist/index.js +1 -0
  87. package/dist/index.js.map +1 -1
  88. package/dist/model/index.d.ts +1 -0
  89. package/dist/model/index.d.ts.map +1 -1
  90. package/dist/model/index.js +1 -0
  91. package/dist/model/index.js.map +1 -1
  92. package/dist/model/plugin-base.d.ts +1 -0
  93. package/dist/model/plugin-base.d.ts.map +1 -1
  94. package/dist/model/plugin-base.js.map +1 -1
  95. package/dist/model/plugins.d.ts +2 -0
  96. package/dist/model/plugins.d.ts.map +1 -1
  97. package/dist/model/plugins.js.map +1 -1
  98. package/dist/model/trace-queries.d.ts +18 -0
  99. package/dist/model/trace-queries.d.ts.map +1 -0
  100. package/dist/model/trace-queries.js +15 -0
  101. package/dist/model/trace-queries.js.map +1 -0
  102. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
  103. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +17 -5
  104. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
  105. package/dist/runtime/DataQueriesProvider/model.d.ts +1 -1
  106. package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
  107. package/dist/runtime/DataQueriesProvider/model.js +27 -7
  108. package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
  109. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts +4 -3
  110. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -1
  111. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +28 -19
  112. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
  113. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts +9 -0
  114. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts.map +1 -0
  115. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js +30 -0
  116. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js.map +1 -0
  117. package/dist/runtime/TimeRangeProvider/index.d.ts +1 -0
  118. package/dist/runtime/TimeRangeProvider/index.d.ts.map +1 -1
  119. package/dist/runtime/TimeRangeProvider/index.js +1 -0
  120. package/dist/runtime/TimeRangeProvider/index.js.map +1 -1
  121. package/dist/runtime/TimeRangeProvider/query-params.d.ts +4 -4
  122. package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -1
  123. package/dist/runtime/TimeRangeProvider/query-params.js +8 -40
  124. package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
  125. package/dist/runtime/TimeRangeProvider/refresh-interval.d.ts +7 -0
  126. package/dist/runtime/TimeRangeProvider/refresh-interval.d.ts.map +1 -0
  127. package/dist/runtime/TimeRangeProvider/refresh-interval.js +25 -0
  128. package/dist/runtime/TimeRangeProvider/refresh-interval.js.map +1 -0
  129. package/dist/runtime/datasources.d.ts +29 -2
  130. package/dist/runtime/datasources.d.ts.map +1 -1
  131. package/dist/runtime/datasources.js +3 -2
  132. package/dist/runtime/datasources.js.map +1 -1
  133. package/dist/runtime/index.d.ts +1 -0
  134. package/dist/runtime/index.d.ts.map +1 -1
  135. package/dist/runtime/index.js +1 -0
  136. package/dist/runtime/index.js.map +1 -1
  137. package/dist/runtime/trace-queries.d.ts +10 -0
  138. package/dist/runtime/trace-queries.d.ts.map +1 -0
  139. package/dist/runtime/trace-queries.js +47 -0
  140. package/dist/runtime/trace-queries.js.map +1 -0
  141. package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts.map +1 -1
  142. package/dist/stories/shared-utils/decorators/WithPluginRegistry.js +2 -1
  143. package/dist/stories/shared-utils/decorators/WithPluginRegistry.js.map +1 -1
  144. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts.map +1 -1
  145. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +12 -0
  146. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js.map +1 -1
  147. package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts +2 -2
  148. package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts.map +1 -1
  149. package/dist/stories/shared-utils/decorators/WithTimeRange.js +2 -2
  150. package/dist/stories/shared-utils/decorators/WithTimeRange.js.map +1 -1
  151. package/dist/test/mock-data.d.ts +2 -1
  152. package/dist/test/mock-data.d.ts.map +1 -1
  153. package/dist/test/mock-data.js +15 -0
  154. package/dist/test/mock-data.js.map +1 -1
  155. package/dist/utils/action.d.ts +1 -1
  156. package/dist/utils/action.d.ts.map +1 -1
  157. package/dist/utils/action.js.map +1 -1
  158. package/dist/validation/role.d.ts +228 -0
  159. package/dist/validation/role.d.ts.map +1 -0
  160. package/dist/validation/role.js +66 -0
  161. package/dist/validation/role.js.map +1 -0
  162. package/dist/validation/rolebinding.d.ts +137 -0
  163. package/dist/validation/rolebinding.d.ts.map +1 -0
  164. package/dist/validation/rolebinding.js +47 -0
  165. package/dist/validation/rolebinding.js.map +1 -0
  166. package/package.json +5 -4
@@ -10,6 +10,22 @@ export interface DatasourceStore {
10
10
  * Gets a list of datasource selection items for a plugin kind.
11
11
  */
12
12
  listDatasourceSelectItems(datasourcePluginKind: string): Promise<DatasourceSelectItemGroup[]>;
13
+ /**
14
+ * Gets the list of datasources defined in the dashboard
15
+ */
16
+ getLocalDatasources(): Record<string, DatasourceSpec>;
17
+ /**
18
+ * Sets the list of datasources defined in the dashboard
19
+ */
20
+ setLocalDatasources(datasources: Record<string, DatasourceSpec>): void;
21
+ /**
22
+ * Gets the list of datasources that are available in the dashboard (i.e. dashboards that have been created on the server side that we can use).
23
+ */
24
+ getSavedDatasources(): Record<string, DatasourceSpec>;
25
+ /**
26
+ * Sets the list of datasources that are saved in the dashboard
27
+ */
28
+ setSavedDatasources(datasources: Record<string, DatasourceSpec>): void;
13
29
  }
14
30
  export interface DatasourceSelectItemGroup {
15
31
  group?: string;
@@ -20,7 +36,18 @@ export interface DatasourceSelectItem {
20
36
  name: string;
21
37
  overridden?: boolean;
22
38
  overriding?: boolean;
23
- selector: DatasourceSelector;
39
+ saved?: boolean;
40
+ selector: DatasourceSelectItemSelector;
41
+ }
42
+ /**
43
+ * Datasource Selector used by the frontend only to differentiate datasources coming from different group.
44
+ */
45
+ export interface DatasourceSelectItemSelector extends DatasourceSelector {
46
+ /**
47
+ * Group of the datasource.
48
+ * Omit it if you don't store datasource by group.
49
+ */
50
+ group?: string;
24
51
  }
25
52
  export declare const DatasourceStoreContext: import("react").Context<DatasourceStore | undefined>;
26
53
  export declare function useDatasourceStore(): DatasourceStore;
@@ -28,7 +55,7 @@ export declare function useDatasourceStore(): DatasourceStore;
28
55
  * Lists all available Datasource selection items for a given datasource plugin kind.
29
56
  * Returns a list, with all information that can be used in a datasource selection context (group, name, selector, kind, ...)
30
57
  */
31
- export declare function useListDatasourceSelectItems(datasourcePluginKind: string): import("@tanstack/react-query").UseQueryResult<DatasourceSelectItemGroup[], unknown>;
58
+ export declare function useListDatasourceSelectItems(datasourcePluginKind: string, project?: string): import("@tanstack/react-query").UseQueryResult<DatasourceSelectItemGroup[], unknown>;
32
59
  /**
33
60
  * Provides a convenience hook for getting a DatasourceClient for a given DatasourceSelector.
34
61
  */
@@ -1 +1 @@
1
- {"version":3,"file":"datasources.d.ts","sourceRoot":"","sources":["../../src/runtime/datasources.ts"],"names":[],"mappings":";AAaA,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAItE,MAAM,WAAW,eAAe;IAE9B,aAAa,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAErE;;OAEG;IACH,mBAAmB,CAAC,MAAM,EAAE,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE3E;;OAEG;IACH,yBAAyB,CAAC,oBAAoB,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,EAAE,CAAC,CAAC;CAC/F;AAED,MAAM,WAAW,yBAAyB;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,oBAAoB,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,kBAAkB,CAAC;CAC9B;AAED,eAAO,MAAM,sBAAsB,sDAAwD,CAAC;AAE5F,wBAAgB,kBAAkB,oBAMjC;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,oBAAoB,EAAE,MAAM,wFAKxE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,QAAQ,EAAE,kBAAkB,mEAGvE;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,kBAAkB,mHAGzD"}
1
+ {"version":3,"file":"datasources.d.ts","sourceRoot":"","sources":["../../src/runtime/datasources.ts"],"names":[],"mappings":";AAaA,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAItE,MAAM,WAAW,eAAe;IAE9B,aAAa,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAErE;;OAEG;IACH,mBAAmB,CAAC,MAAM,EAAE,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE3E;;OAEG;IACH,yBAAyB,CAAC,oBAAoB,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,EAAE,CAAC,CAAC;IAE9F;;OAEG;IACH,mBAAmB,IAAI,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAEtD;;OAEG;IACH,mBAAmB,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,IAAI,CAAC;IAEvE;;OAEG;IACH,mBAAmB,IAAI,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAEtD;;OAEG;IACH,mBAAmB,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,IAAI,CAAC;CACxE;AAED,MAAM,WAAW,yBAAyB;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,oBAAoB,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,4BAA4B,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,4BAA6B,SAAQ,kBAAkB;IACtE;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,sBAAsB,sDAAwD,CAAC;AAE5F,wBAAgB,kBAAkB,oBAMjC;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,oBAAoB,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,wFAK1F;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,QAAQ,EAAE,kBAAkB,mEAGvE;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,kBAAkB,mHAGzD"}
@@ -23,11 +23,12 @@ export function useDatasourceStore() {
23
23
  /**
24
24
  * Lists all available Datasource selection items for a given datasource plugin kind.
25
25
  * Returns a list, with all information that can be used in a datasource selection context (group, name, selector, kind, ...)
26
- */ export function useListDatasourceSelectItems(datasourcePluginKind) {
26
+ */ export function useListDatasourceSelectItems(datasourcePluginKind, project) {
27
27
  const { listDatasourceSelectItems } = useDatasourceStore();
28
28
  return useQuery([
29
29
  'listDatasourceSelectItems',
30
- datasourcePluginKind
30
+ datasourcePluginKind,
31
+ project
31
32
  ], ()=>listDatasourceSelectItems(datasourcePluginKind));
32
33
  }
33
34
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/runtime/datasources.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 { DatasourceSelector, DatasourceSpec } from '@perses-dev/core';\nimport { useQuery } from '@tanstack/react-query';\nimport { createContext, useContext } from 'react';\n\nexport interface DatasourceStore {\n // TODO: Do we even need this method?\n getDatasource(selector: DatasourceSelector): Promise<DatasourceSpec>;\n\n /**\n * Given a DatasourceSelector, gets a `Client` object from the corresponding Datasource plugin.\n */\n getDatasourceClient<Client>(selector: DatasourceSelector): Promise<Client>;\n\n /**\n * Gets a list of datasource selection items for a plugin kind.\n */\n listDatasourceSelectItems(datasourcePluginKind: string): Promise<DatasourceSelectItemGroup[]>;\n}\n\nexport interface DatasourceSelectItemGroup {\n group?: string;\n editLink?: string;\n items: DatasourceSelectItem[];\n}\n\nexport interface DatasourceSelectItem {\n name: string;\n overridden?: boolean;\n overriding?: boolean;\n selector: DatasourceSelector;\n}\n\nexport const DatasourceStoreContext = createContext<DatasourceStore | undefined>(undefined);\n\nexport function useDatasourceStore() {\n const ctx = useContext(DatasourceStoreContext);\n if (ctx === undefined) {\n throw new Error('No DatasourceStoreContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\n/**\n * Lists all available Datasource selection items for a given datasource plugin kind.\n * Returns a list, with all information that can be used in a datasource selection context (group, name, selector, kind, ...)\n */\nexport function useListDatasourceSelectItems(datasourcePluginKind: string) {\n const { listDatasourceSelectItems } = useDatasourceStore();\n return useQuery(['listDatasourceSelectItems', datasourcePluginKind], () =>\n listDatasourceSelectItems(datasourcePluginKind)\n );\n}\n\n/**\n * Provides a convenience hook for getting a DatasourceClient for a given DatasourceSelector.\n */\nexport function useDatasourceClient<Client>(selector: DatasourceSelector) {\n const store = useDatasourceStore();\n return useQuery<Client>(['getDatasourceClient', selector], () => store.getDatasourceClient<Client>(selector));\n}\n\nexport function useDatasource(selector: DatasourceSelector) {\n const store = useDatasourceStore();\n return useQuery(['getDatasource', selector], () => store.getDatasource(selector));\n}\n"],"names":["useQuery","createContext","useContext","DatasourceStoreContext","undefined","useDatasourceStore","ctx","Error","useListDatasourceSelectItems","datasourcePluginKind","listDatasourceSelectItems","useDatasourceClient","selector","store","getDatasourceClient","useDatasource","getDatasource"],"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,QAAQ,QAAQ,wBAAwB;AACjD,SAASC,aAAa,EAAEC,UAAU,QAAQ,QAAQ;AA8BlD,OAAO,MAAMC,yBAAyBF,cAA2CG,WAAW;AAE5F,OAAO,SAASC;IACd,MAAMC,MAAMJ,WAAWC;IACvB,IAAIG,QAAQF,WAAW;QACrB,MAAM,IAAIG,MAAM;IAClB;IACA,OAAOD;AACT;AAEA;;;CAGC,GACD,OAAO,SAASE,6BAA6BC,oBAA4B;IACvE,MAAM,EAAEC,0BAAyB,EAAE,GAAGL;IACtC,OAAOL,SAAS;QAAC;QAA6BS;KAAqB,EAAE,IACnEC,0BAA0BD;AAE9B;AAEA;;CAEC,GACD,OAAO,SAASE,oBAA4BC,QAA4B;IACtE,MAAMC,QAAQR;IACd,OAAOL,SAAiB;QAAC;QAAuBY;KAAS,EAAE,IAAMC,MAAMC,oBAA4BF;AACrG;AAEA,OAAO,SAASG,cAAcH,QAA4B;IACxD,MAAMC,QAAQR;IACd,OAAOL,SAAS;QAAC;QAAiBY;KAAS,EAAE,IAAMC,MAAMG,cAAcJ;AACzE"}
1
+ {"version":3,"sources":["../../src/runtime/datasources.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 { DatasourceSelector, DatasourceSpec } from '@perses-dev/core';\nimport { useQuery } from '@tanstack/react-query';\nimport { createContext, useContext } from 'react';\n\nexport interface DatasourceStore {\n // TODO: Do we even need this method?\n getDatasource(selector: DatasourceSelector): Promise<DatasourceSpec>;\n\n /**\n * Given a DatasourceSelector, gets a `Client` object from the corresponding Datasource plugin.\n */\n getDatasourceClient<Client>(selector: DatasourceSelector): Promise<Client>;\n\n /**\n * Gets a list of datasource selection items for a plugin kind.\n */\n listDatasourceSelectItems(datasourcePluginKind: string): Promise<DatasourceSelectItemGroup[]>;\n\n /**\n * Gets the list of datasources defined in the dashboard\n */\n getLocalDatasources(): Record<string, DatasourceSpec>;\n\n /**\n * Sets the list of datasources defined in the dashboard\n */\n setLocalDatasources(datasources: Record<string, DatasourceSpec>): void;\n\n /**\n * Gets the list of datasources that are available in the dashboard (i.e. dashboards that have been created on the server side that we can use).\n */\n getSavedDatasources(): Record<string, DatasourceSpec>;\n\n /**\n * Sets the list of datasources that are saved in the dashboard\n */\n setSavedDatasources(datasources: Record<string, DatasourceSpec>): void;\n}\n\nexport interface DatasourceSelectItemGroup {\n group?: string;\n editLink?: string;\n items: DatasourceSelectItem[];\n}\n\nexport interface DatasourceSelectItem {\n name: string;\n overridden?: boolean;\n overriding?: boolean;\n saved?: boolean;\n selector: DatasourceSelectItemSelector;\n}\n\n/**\n * Datasource Selector used by the frontend only to differentiate datasources coming from different group.\n */\nexport interface DatasourceSelectItemSelector extends DatasourceSelector {\n /**\n * Group of the datasource.\n * Omit it if you don't store datasource by group.\n */\n group?: string;\n}\n\nexport const DatasourceStoreContext = createContext<DatasourceStore | undefined>(undefined);\n\nexport function useDatasourceStore() {\n const ctx = useContext(DatasourceStoreContext);\n if (ctx === undefined) {\n throw new Error('No DatasourceStoreContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\n/**\n * Lists all available Datasource selection items for a given datasource plugin kind.\n * Returns a list, with all information that can be used in a datasource selection context (group, name, selector, kind, ...)\n */\nexport function useListDatasourceSelectItems(datasourcePluginKind: string, project?: string) {\n const { listDatasourceSelectItems } = useDatasourceStore();\n return useQuery(['listDatasourceSelectItems', datasourcePluginKind, project], () =>\n listDatasourceSelectItems(datasourcePluginKind)\n );\n}\n\n/**\n * Provides a convenience hook for getting a DatasourceClient for a given DatasourceSelector.\n */\nexport function useDatasourceClient<Client>(selector: DatasourceSelector) {\n const store = useDatasourceStore();\n return useQuery<Client>(['getDatasourceClient', selector], () => store.getDatasourceClient<Client>(selector));\n}\n\nexport function useDatasource(selector: DatasourceSelector) {\n const store = useDatasourceStore();\n return useQuery(['getDatasource', selector], () => store.getDatasource(selector));\n}\n"],"names":["useQuery","createContext","useContext","DatasourceStoreContext","undefined","useDatasourceStore","ctx","Error","useListDatasourceSelectItems","datasourcePluginKind","project","listDatasourceSelectItems","useDatasourceClient","selector","store","getDatasourceClient","useDatasource","getDatasource"],"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,QAAQ,QAAQ,wBAAwB;AACjD,SAASC,aAAa,EAAEC,UAAU,QAAQ,QAAQ;AA8DlD,OAAO,MAAMC,yBAAyBF,cAA2CG,WAAW;AAE5F,OAAO,SAASC;IACd,MAAMC,MAAMJ,WAAWC;IACvB,IAAIG,QAAQF,WAAW;QACrB,MAAM,IAAIG,MAAM;IAClB;IACA,OAAOD;AACT;AAEA;;;CAGC,GACD,OAAO,SAASE,6BAA6BC,oBAA4B,EAAEC,OAAgB;IACzF,MAAM,EAAEC,0BAAyB,EAAE,GAAGN;IACtC,OAAOL,SAAS;QAAC;QAA6BS;QAAsBC;KAAQ,EAAE,IAC5EC,0BAA0BF;AAE9B;AAEA;;CAEC,GACD,OAAO,SAASG,oBAA4BC,QAA4B;IACtE,MAAMC,QAAQT;IACd,OAAOL,SAAiB;QAAC;QAAuBa;KAAS,EAAE,IAAMC,MAAMC,oBAA4BF;AACrG;AAEA,OAAO,SAASG,cAAcH,QAA4B;IACxD,MAAMC,QAAQT;IACd,OAAOL,SAAS;QAAC;QAAiBa;KAAS,EAAE,IAAMC,MAAMG,cAAcJ;AACzE"}
@@ -4,5 +4,6 @@ export * from './plugin-registry';
4
4
  export * from './template-variables';
5
5
  export * from './TimeRangeProvider';
6
6
  export * from './time-series-queries';
7
+ export * from './trace-queries';
7
8
  export * from './DataQueriesProvider';
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAaA,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAaA,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC"}
@@ -16,6 +16,7 @@ export * from './plugin-registry';
16
16
  export * from './template-variables';
17
17
  export * from './TimeRangeProvider';
18
18
  export * from './time-series-queries';
19
+ export * from './trace-queries';
19
20
  export * from './DataQueriesProvider';
20
21
 
21
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/runtime/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 './builtin-variables';\nexport * from './datasources';\nexport * from './plugin-registry';\nexport * from './template-variables';\nexport * from './TimeRangeProvider';\nexport * from './time-series-queries';\nexport * from './DataQueriesProvider';\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,sBAAsB;AACpC,cAAc,gBAAgB;AAC9B,cAAc,oBAAoB;AAClC,cAAc,uBAAuB;AACrC,cAAc,sBAAsB;AACpC,cAAc,wBAAwB;AACtC,cAAc,wBAAwB"}
1
+ {"version":3,"sources":["../../src/runtime/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 './builtin-variables';\nexport * from './datasources';\nexport * from './plugin-registry';\nexport * from './template-variables';\nexport * from './TimeRangeProvider';\nexport * from './time-series-queries';\nexport * from './trace-queries';\nexport * from './DataQueriesProvider';\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,sBAAsB;AACpC,cAAc,gBAAgB;AAC9B,cAAc,oBAAoB;AAClC,cAAc,uBAAuB;AACrC,cAAc,sBAAsB;AACpC,cAAc,wBAAwB;AACtC,cAAc,kBAAkB;AAChC,cAAc,wBAAwB"}
@@ -0,0 +1,10 @@
1
+ import { QueryDefinition, UnknownSpec } from '@perses-dev/core';
2
+ export declare type TraceQueryDefinition<PluginSpec = UnknownSpec> = QueryDefinition<'TraceQuery', PluginSpec>;
3
+ export declare const TRACE_QUERY_KEY = "TraceQuery";
4
+ /**
5
+ * Run a trace query using a TraceQuery plugin and return the results
6
+ * @param definition: dashboard defintion for a trace query, written in Trace Query Language (TraceQL)
7
+ * Documentation for TraceQL: https://grafana.com/docs/tempo/latest/traceql/
8
+ */
9
+ export declare function useTraceQueries(definitions: TraceQueryDefinition[]): import("@tanstack/react-query").UseQueryResult<import("@perses-dev/core").TraceData, unknown>[];
10
+ //# sourceMappingURL=trace-queries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace-queries.d.ts","sourceRoot":"","sources":["../../src/runtime/trace-queries.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAKhE,oBAAY,oBAAoB,CAAC,UAAU,GAAG,WAAW,IAAI,eAAe,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;AACvG,eAAO,MAAM,eAAe,eAAe,CAAC;AAE5C;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,oBAAoB,EAAE,mGAsBlE"}
@@ -0,0 +1,47 @@
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 { useQueries } from '@tanstack/react-query';
14
+ import { useDatasourceStore } from './datasources';
15
+ import { usePluginRegistry } from './plugin-registry';
16
+ export const TRACE_QUERY_KEY = 'TraceQuery';
17
+ /**
18
+ * Run a trace query using a TraceQuery plugin and return the results
19
+ * @param definition: dashboard defintion for a trace query, written in Trace Query Language (TraceQL)
20
+ * Documentation for TraceQL: https://grafana.com/docs/tempo/latest/traceql/
21
+ */ export function useTraceQueries(definitions) {
22
+ const { getPlugin } = usePluginRegistry();
23
+ const datasourceStore = useDatasourceStore();
24
+ const ctx = {
25
+ datasourceStore
26
+ };
27
+ return useQueries({
28
+ queries: definitions.map((definition)=>{
29
+ var _definition_spec, _definition_spec_plugin;
30
+ const queryKey = [
31
+ definition,
32
+ datasourceStore
33
+ ];
34
+ const traceQueryKind = definition === null || definition === void 0 ? void 0 : (_definition_spec = definition.spec) === null || _definition_spec === void 0 ? void 0 : (_definition_spec_plugin = _definition_spec.plugin) === null || _definition_spec_plugin === void 0 ? void 0 : _definition_spec_plugin.kind;
35
+ return {
36
+ queryKey: queryKey,
37
+ queryFn: async ()=>{
38
+ const plugin = await getPlugin(TRACE_QUERY_KEY, traceQueryKind);
39
+ const data = await plugin.getTraceData(definition.spec.plugin.spec, ctx);
40
+ return data;
41
+ }
42
+ };
43
+ })
44
+ });
45
+ }
46
+
47
+ //# sourceMappingURL=trace-queries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/runtime/trace-queries.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 { QueryDefinition, UnknownSpec } from '@perses-dev/core';\nimport { useQueries } from '@tanstack/react-query';\nimport { useDatasourceStore } from './datasources';\nimport { usePluginRegistry } from './plugin-registry';\n\nexport type TraceQueryDefinition<PluginSpec = UnknownSpec> = QueryDefinition<'TraceQuery', PluginSpec>;\nexport const TRACE_QUERY_KEY = 'TraceQuery';\n\n/**\n * Run a trace query using a TraceQuery plugin and return the results\n * @param definition: dashboard defintion for a trace query, written in Trace Query Language (TraceQL)\n * Documentation for TraceQL: https://grafana.com/docs/tempo/latest/traceql/\n */\nexport function useTraceQueries(definitions: TraceQueryDefinition[]) {\n const { getPlugin } = usePluginRegistry();\n\n const datasourceStore = useDatasourceStore();\n const ctx = {\n datasourceStore,\n };\n\n return useQueries({\n queries: definitions.map((definition) => {\n const queryKey = [definition, datasourceStore] as const;\n const traceQueryKind = definition?.spec?.plugin?.kind;\n return {\n queryKey: queryKey,\n queryFn: async () => {\n const plugin = await getPlugin(TRACE_QUERY_KEY, traceQueryKind);\n const data = await plugin.getTraceData(definition.spec.plugin.spec, ctx);\n return data;\n },\n };\n }),\n });\n}\n"],"names":["useQueries","useDatasourceStore","usePluginRegistry","TRACE_QUERY_KEY","useTraceQueries","definitions","getPlugin","datasourceStore","ctx","queries","map","definition","queryKey","traceQueryKind","spec","plugin","kind","queryFn","data","getTraceData"],"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,UAAU,QAAQ,wBAAwB;AACnD,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,SAASC,iBAAiB,QAAQ,oBAAoB;AAGtD,OAAO,MAAMC,kBAAkB,aAAa;AAE5C;;;;CAIC,GACD,OAAO,SAASC,gBAAgBC,WAAmC;IACjE,MAAM,EAAEC,UAAS,EAAE,GAAGJ;IAEtB,MAAMK,kBAAkBN;IACxB,MAAMO,MAAM;QACVD;IACF;IAEA,OAAOP,WAAW;QAChBS,SAASJ,YAAYK,IAAI,CAACC;gBAEDA;YADvB,MAAMC,WAAW;gBAACD;gBAAYJ;aAAgB;YAC9C,MAAMM,iBAAiBF,uBAAAA,wBAAAA,KAAAA,IAAAA,CAAAA,mBAAAA,WAAYG,kBAAZH,8BAAAA,KAAAA,IAAAA,2BAAAA,iBAAkBI,yDAAlBJ,KAAAA,4BAA0BK;YACjD,OAAO;gBACLJ,UAAUA;gBACVK,SAAS;oBACP,MAAMF,SAAS,MAAMT,UAAUH,iBAAiBU;oBAChD,MAAMK,OAAO,MAAMH,OAAOI,aAAaR,WAAWG,KAAKC,OAAOD,MAAMN;oBACpE,OAAOU;gBACT;YACF;QACF;IACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"WithPluginRegistry.d.ts","sourceRoot":"","sources":["../../../../src/stories/shared-utils/decorators/WithPluginRegistry.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AA8B3C,eAAO,MAAM,kBAAkB,UAAW,OAAO,gBAShD,CAAC"}
1
+ {"version":3,"file":"WithPluginRegistry.d.ts","sourceRoot":"","sources":["../../../../src/stories/shared-utils/decorators/WithPluginRegistry.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AA8B3C,eAAO,MAAM,kBAAkB,UAAW,OAAO,gBAYhD,CAAC"}
@@ -36,7 +36,8 @@ export const WithPluginRegistry = (Story)=>{
36
36
  return /*#__PURE__*/ _jsx(PluginRegistry, {
37
37
  pluginLoader: bundledPluginLoader,
38
38
  defaultPluginKinds: {
39
- TimeSeriesQuery: 'PrometheusTimeSeriesQuery'
39
+ TimeSeriesQuery: 'PrometheusTimeSeriesQuery',
40
+ TraceQuery: 'TempoTraceQuery'
40
41
  },
41
42
  children: /*#__PURE__*/ _jsx(Story, {})
42
43
  });
@@ -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;;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"}
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={{\n TimeSeriesQuery: 'PrometheusTimeSeriesQuery',\n TraceQuery: 'TempoTraceQuery',\n }}\n >\n <Story />\n </PluginRegistry>\n );\n};\n"],"names":["PluginRegistry","dynamicImportPluginLoader","prometheusResource","panelsResource","bundledPluginLoader","resource","importPlugin","WithPluginRegistry","Story","pluginLoader","defaultPluginKinds","TimeSeriesQuery","TraceQuery"],"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;YAClBC,iBAAiB;YACjBC,YAAY;QACd;kBAEA,cAAA,KAACJ;;AAGP,EAAE"}
@@ -1 +1 @@
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"}
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,gBAoE7F,CAAC"}
@@ -68,6 +68,18 @@ export const WithPluginSystemDatasourceStore = (Story, context)=>{
68
68
  ]);
69
69
  }
70
70
  throw new Error(`WithDatasourceStore is not configured to support kind: ${datasourcePluginKind}`);
71
+ },
72
+ getSavedDatasources: ()=>{
73
+ return {};
74
+ },
75
+ setSavedDatasources: (datasources)=>{
76
+ return datasources;
77
+ },
78
+ getLocalDatasources: ()=>{
79
+ return {};
80
+ },
81
+ setLocalDatasources: (datasources)=>{
82
+ return datasources;
71
83
  }
72
84
  };
73
85
  const parameter = isWithDatastoreStoreParameter(initParameter) ? initParameter : {
@@ -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 {\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
+ {"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, DatasourceSpec } 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 getSavedDatasources: (): Record<string, DatasourceSpec> => {\n return {};\n },\n setSavedDatasources: (datasources: Record<string, DatasourceSpec>) => {\n return datasources;\n },\n getLocalDatasources: (): Record<string, DatasourceSpec> => {\n return {};\n },\n setLocalDatasources: (datasources: Record<string, DatasourceSpec>) => {\n return datasources;\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","getSavedDatasources","setSavedDatasources","datasources","getLocalDatasources","setLocalDatasources","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;QACAG,qBAAqB;YACnB,OAAO,CAAC;QACV;QACAC,qBAAqB,CAACC;YACpB,OAAOA;QACT;QACAC,qBAAqB;YACnB,OAAO,CAAC;QACV;QACAC,qBAAqB,CAACF;YACpB,OAAOA;QACT;IACF;IAEA,MAAM7B,YAAYD,8BAA8BM,iBAAiBA,gBAAgB;QAAE2B,OAAOxB;IAAa;IACvG,MAAMwB,QAAQhC,sBAAAA,uBAAAA,KAAAA,IAAAA,UAAWgC;IAEzB,qBACE,KAACpC,uBAAuBqC;QAASC,OAAOF;kBACtC,cAAA,KAAC9B;;AAGP,EAAE"}
@@ -1,13 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import { StoryFn, StoryContext } from '@storybook/react';
3
- import { TimeRangeProviderProps } from '@perses-dev/plugin-system';
3
+ import { TimeRangeFromQueryProps } from '@perses-dev/plugin-system';
4
4
  declare module '@storybook/react' {
5
5
  interface Parameters {
6
6
  withTimeRange?: WithTimeRangeParameter;
7
7
  }
8
8
  }
9
9
  export declare type WithTimeRangeParameter = {
10
- props: Partial<TimeRangeProviderProps>;
10
+ props: Partial<TimeRangeFromQueryProps>;
11
11
  };
12
12
  export declare const WithTimeRange: (Story: StoryFn, context: StoryContext<unknown>) => JSX.Element;
13
13
  //# sourceMappingURL=WithTimeRange.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WithTimeRange.d.ts","sourceRoot":"","sources":["../../../../src/stories/shared-utils/decorators/WithTimeRange.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAqB,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAEtF,OAAO,QAAQ,kBAAkB,CAAC;IAChC,UAAU,UAAU;QAClB,aAAa,CAAC,EAAE,sBAAsB,CAAC;KACxC;CACF;AAED,oBAAY,sBAAsB,GAAG;IACnC,KAAK,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACxC,CAAC;AAOF,eAAO,MAAM,aAAa,UAAW,OAAO,WAAW,aAAa,OAAO,CAAC,gBAU3E,CAAC"}
1
+ {"version":3,"file":"WithTimeRange.d.ts","sourceRoot":"","sources":["../../../../src/stories/shared-utils/decorators/WithTimeRange.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAqB,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEvF,OAAO,QAAQ,kBAAkB,CAAC;IAChC,UAAU,UAAU;QAClB,aAAa,CAAC,EAAE,sBAAsB,CAAC;KACxC;CACF;AAED,oBAAY,sBAAsB,GAAG;IACnC,KAAK,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAC;CACzC,CAAC;AAOF,eAAO,MAAM,aAAa,UAAW,OAAO,WAAW,aAAa,OAAO,CAAC,gBAU3E,CAAC"}
@@ -21,8 +21,8 @@ export const WithTimeRange = (Story, context)=>{
21
21
  const parameter = isWithTimeRangeParameter(initParameter) ? initParameter : undefined;
22
22
  const props = parameter === null || parameter === void 0 ? void 0 : parameter.props;
23
23
  return /*#__PURE__*/ _jsx(TimeRangeProvider, {
24
- initialRefreshInterval: "0s",
25
- initialTimeRange: {
24
+ refreshInterval: "0s",
25
+ timeRange: {
26
26
  pastDuration: '1h'
27
27
  },
28
28
  ...props,
@@ -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;;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
+ {"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, TimeRangeFromQueryProps } 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<TimeRangeFromQueryProps>;\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 refreshInterval=\"0s\" timeRange={{ pastDuration: '1h' }} {...props}>\n <Story />\n </TimeRangeProvider>\n );\n};\n"],"names":["TimeRangeProvider","isWithTimeRangeParameter","parameter","WithTimeRange","Story","context","initParameter","parameters","withTimeRange","undefined","props","refreshInterval","timeRange","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,QAAiC,4BAA4B;AAYvF,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,iBAAgB;QAAKC,WAAW;YAAEC,cAAc;QAAK;QAAI,GAAGH,KAAK;kBAClF,cAAA,KAACN;;AAGP,EAAE"}
@@ -1,3 +1,4 @@
1
- import { TimeSeriesData } from '@perses-dev/core';
1
+ import { TimeSeriesData, TraceData } from '@perses-dev/core';
2
2
  export declare const MOCK_TIME_SERIES_DATA: TimeSeriesData;
3
+ export declare const MOCK_TRACE_DATA: TraceData;
3
4
  //# sourceMappingURL=mock-data.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"mock-data.d.ts","sourceRoot":"","sources":["../../src/test/mock-data.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7D,eAAO,MAAM,qBAAqB,EAAE,cAsBnC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAc7B,CAAC"}
@@ -45,5 +45,20 @@ export const MOCK_TIME_SERIES_DATA = {
45
45
  }
46
46
  ]
47
47
  };
48
+ export const MOCK_TRACE_DATA = {
49
+ traces: [
50
+ {
51
+ durationMs: 1120,
52
+ errorCount: 0,
53
+ spanCount: 10,
54
+ startTimeUnixMs: 1699916103945861,
55
+ traceId: '95ba9202315c29c801b5aa41452aa775',
56
+ name: 'rootServiceName="shop-backend", rootTraceName="shop-backend"'
57
+ }
58
+ ],
59
+ metadata: {
60
+ executedQueryString: '{ duration > 1000ms }'
61
+ }
62
+ };
48
63
 
49
64
  //# sourceMappingURL=mock-data.js.map
@@ -1 +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"}
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, TraceData } 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\nexport const MOCK_TRACE_DATA: TraceData = {\n traces: [\n {\n durationMs: 1120,\n errorCount: 0,\n spanCount: 10,\n startTimeUnixMs: 1699916103945861,\n traceId: '95ba9202315c29c801b5aa41452aa775',\n name: 'rootServiceName=\"shop-backend\", rootTraceName=\"shop-backend\"',\n },\n ],\n metadata: {\n executedQueryString: '{ duration > 1000ms }',\n },\n};\n"],"names":["MOCK_TIME_SERIES_DATA","timeRange","start","Date","end","stepMs","series","name","values","MOCK_TRACE_DATA","traces","durationMs","errorCount","spanCount","startTimeUnixMs","traceId","metadata","executedQueryString"],"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;AAEF,OAAO,MAAMC,kBAA6B;IACxCC,QAAQ;QACN;YACEC,YAAY;YACZC,YAAY;YACZC,WAAW;YACXC,iBAAiB;YACjBC,SAAS;YACTR,MAAM;QACR;KACD;IACDS,UAAU;QACRC,qBAAqB;IACvB;AACF,EAAE"}
@@ -1,4 +1,4 @@
1
- export declare type Action = 'create' | 'read' | 'update';
1
+ import { Action } from '@perses-dev/core';
2
2
  export declare function getTitleAction(action: Action, isDraft: boolean): string;
3
3
  export declare function getSubmitText(action: Action, isDraft: boolean): string;
4
4
  //# sourceMappingURL=action.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/utils/action.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,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"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/action.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 type Action = 'create' | 'read' | 'update';\n\nexport function getTitleAction(action: Action, isDraft: boolean): string {\n if (action === 'read') return 'View';\n if (isDraft && action === 'create') return 'Add';\n if (!isDraft && action === 'create') return 'Create';\n if (action === 'update') return 'Edit';\n return '';\n}\n\nexport function getSubmitText(action: Action, isDraft: boolean): string {\n if (isDraft && action === 'create') return 'Add';\n if (isDraft && action === 'update') return 'Apply';\n if (!isDraft) return 'Save';\n return '';\n}\n"],"names":["getTitleAction","action","isDraft","getSubmitText"],"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,SAASA,eAAeC,MAAc,EAAEC,OAAgB;IAC7D,IAAID,WAAW,QAAQ,OAAO;IAC9B,IAAIC,WAAWD,WAAW,UAAU,OAAO;IAC3C,IAAI,CAACC,WAAWD,WAAW,UAAU,OAAO;IAC5C,IAAIA,WAAW,UAAU,OAAO;IAChC,OAAO;AACT;AAEA,OAAO,SAASE,cAAcF,MAAc,EAAEC,OAAgB;IAC5D,IAAIA,WAAWD,WAAW,UAAU,OAAO;IAC3C,IAAIC,WAAWD,WAAW,UAAU,OAAO;IAC3C,IAAI,CAACC,SAAS,OAAO;IACrB,OAAO;AACT"}
1
+ {"version":3,"sources":["../../src/utils/action.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 { Action } from '@perses-dev/core';\n\nexport function getTitleAction(action: Action, isDraft: boolean): string {\n if (action === 'read') return 'View';\n if (isDraft && action === 'create') return 'Add';\n if (!isDraft && action === 'create') return 'Create';\n if (action === 'update') return 'Edit';\n return '';\n}\n\nexport function getSubmitText(action: Action, isDraft: boolean): string {\n if (isDraft && action === 'create') return 'Add';\n if (isDraft && action === 'update') return 'Apply';\n if (!isDraft) return 'Save';\n return '';\n}\n"],"names":["getTitleAction","action","isDraft","getSubmitText"],"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,SAASA,eAAeC,MAAc,EAAEC,OAAgB;IAC7D,IAAID,WAAW,QAAQ,OAAO;IAC9B,IAAIC,WAAWD,WAAW,UAAU,OAAO;IAC3C,IAAI,CAACC,WAAWD,WAAW,UAAU,OAAO;IAC5C,IAAIA,WAAW,UAAU,OAAO;IAChC,OAAO;AACT;AAEA,OAAO,SAASE,cAAcF,MAAc,EAAEC,OAAgB;IAC5D,IAAIA,WAAWD,WAAW,UAAU,OAAO;IAC3C,IAAIC,WAAWD,WAAW,UAAU,OAAO;IAC3C,IAAI,CAACC,SAAS,OAAO;IACrB,OAAO;AACT"}