@perses-dev/dashboards 0.7.0 → 0.8.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 (161) hide show
  1. package/dist/cjs/components/Dashboard.js +1 -1
  2. package/dist/cjs/components/DashboardToolbar.js +3 -18
  3. package/dist/cjs/components/GridLayout/GridItemContent.js +3 -3
  4. package/dist/cjs/components/GridLayout/GridLayout.js +8 -9
  5. package/dist/cjs/components/GridLayout/GridTitle.js +15 -9
  6. package/dist/cjs/components/Panel/Panel.js +11 -6
  7. package/dist/cjs/components/Panel/Panel.test.js +17 -13
  8. package/dist/cjs/components/Panel/PanelContent.js +15 -0
  9. package/dist/cjs/components/Panel/index.js +29 -0
  10. package/dist/cjs/components/PanelDrawer/PanelDrawer.js +124 -0
  11. package/dist/cjs/components/PanelDrawer/PanelDrawer.test.js +111 -0
  12. package/dist/cjs/components/PanelDrawer/PanelOptionsEditor.js +19 -0
  13. package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +60 -0
  14. package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.test.js +95 -0
  15. package/dist/cjs/components/{TimeRangeControls.js → TimeRangeControls/TimeRangeControls.js} +20 -31
  16. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.test.js +51 -0
  17. package/dist/cjs/components/TimeRangeControls/index.js +29 -0
  18. package/dist/cjs/components/Variables/Variable.js +57 -0
  19. package/dist/cjs/components/Variables/VariableList.js +27 -0
  20. package/dist/cjs/components/{VariableList → Variables}/index.js +1 -0
  21. package/dist/cjs/components/index.js +2 -3
  22. package/dist/cjs/context/DashboardAppSlice.js +45 -0
  23. package/dist/cjs/context/DashboardProvider.js +54 -36
  24. package/dist/cjs/context/LayoutsSlice.js +42 -0
  25. package/dist/cjs/context/QueryStringProvider.js +35 -0
  26. package/dist/cjs/context/TemplateVariableProvider.js +216 -0
  27. package/dist/cjs/context/TimeRangeProvider.js +66 -0
  28. package/dist/cjs/context/index.js +6 -3
  29. package/dist/cjs/css/styles.js +188 -0
  30. package/dist/cjs/test/plugin-registry.js +24 -17
  31. package/dist/cjs/test/render.js +11 -2
  32. package/dist/cjs/test/testDashboard.js +14 -37
  33. package/dist/cjs/views/DashboardApp.js +4 -4
  34. package/dist/cjs/views/ViewDashboard.js +30 -2
  35. package/dist/cjs/views/index.js +1 -1
  36. package/dist/components/Dashboard.d.ts.map +1 -1
  37. package/dist/components/Dashboard.js +1 -1
  38. package/dist/components/DashboardToolbar.d.ts +0 -1
  39. package/dist/components/DashboardToolbar.d.ts.map +1 -1
  40. package/dist/components/DashboardToolbar.js +1 -1
  41. package/dist/components/GridLayout/GridItemContent.d.ts +1 -0
  42. package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
  43. package/dist/components/GridLayout/GridItemContent.js +1 -1
  44. package/dist/components/GridLayout/GridLayout.d.ts +2 -3
  45. package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
  46. package/dist/components/GridLayout/GridLayout.js +1 -1
  47. package/dist/components/GridLayout/GridTitle.d.ts +1 -0
  48. package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
  49. package/dist/components/GridLayout/GridTitle.js +1 -1
  50. package/dist/components/Panel/Panel.d.ts +2 -0
  51. package/dist/components/Panel/Panel.d.ts.map +1 -1
  52. package/dist/components/Panel/Panel.js +1 -1
  53. package/dist/components/Panel/Panel.test.d.ts.map +1 -1
  54. package/dist/components/Panel/Panel.test.js +1 -1
  55. package/dist/components/Panel/PanelContent.d.ts +11 -0
  56. package/dist/components/Panel/PanelContent.d.ts.map +1 -0
  57. package/dist/components/Panel/PanelContent.js +1 -0
  58. package/dist/components/Panel/index.d.ts +2 -0
  59. package/dist/components/Panel/index.d.ts.map +1 -0
  60. package/dist/components/Panel/index.js +1 -0
  61. package/dist/components/PanelDrawer/PanelDrawer.d.ts +4 -0
  62. package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -0
  63. package/dist/components/PanelDrawer/PanelDrawer.js +1 -0
  64. package/dist/components/PanelDrawer/PanelDrawer.test.d.ts +2 -0
  65. package/dist/components/PanelDrawer/PanelDrawer.test.d.ts.map +1 -0
  66. package/dist/components/PanelDrawer/PanelDrawer.test.js +1 -0
  67. package/dist/components/PanelDrawer/PanelOptionsEditor.d.ts +9 -0
  68. package/dist/components/PanelDrawer/PanelOptionsEditor.d.ts.map +1 -0
  69. package/dist/components/PanelDrawer/PanelOptionsEditor.js +1 -0
  70. package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts +4 -0
  71. package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -0
  72. package/dist/components/PanelGroupDialog/PanelGroupDialog.js +1 -0
  73. package/dist/components/PanelGroupDialog/PanelGroupDialog.test.d.ts +2 -0
  74. package/dist/components/PanelGroupDialog/PanelGroupDialog.test.d.ts.map +1 -0
  75. package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js +1 -0
  76. package/dist/components/{TimeRangeControls.d.ts → TimeRangeControls/TimeRangeControls.d.ts} +0 -0
  77. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -0
  78. package/dist/components/TimeRangeControls/TimeRangeControls.js +1 -0
  79. package/dist/components/TimeRangeControls/TimeRangeControls.test.d.ts +2 -0
  80. package/dist/components/TimeRangeControls/TimeRangeControls.test.d.ts.map +1 -0
  81. package/dist/components/TimeRangeControls/TimeRangeControls.test.js +1 -0
  82. package/dist/components/TimeRangeControls/index.d.ts +2 -0
  83. package/dist/components/TimeRangeControls/index.d.ts.map +1 -0
  84. package/dist/components/TimeRangeControls/index.js +1 -0
  85. package/dist/components/Variables/Variable.d.ts +8 -0
  86. package/dist/components/Variables/Variable.d.ts.map +1 -0
  87. package/dist/components/Variables/Variable.js +1 -0
  88. package/dist/components/Variables/VariableList.d.ts +3 -0
  89. package/dist/components/Variables/VariableList.d.ts.map +1 -0
  90. package/dist/components/Variables/VariableList.js +1 -0
  91. package/dist/components/Variables/index.d.ts +3 -0
  92. package/dist/components/Variables/index.d.ts.map +1 -0
  93. package/dist/components/Variables/index.js +1 -0
  94. package/dist/components/index.d.ts +2 -3
  95. package/dist/components/index.d.ts.map +1 -1
  96. package/dist/components/index.js +1 -1
  97. package/dist/context/DashboardAppSlice.d.ts +26 -0
  98. package/dist/context/DashboardAppSlice.d.ts.map +1 -0
  99. package/dist/context/DashboardAppSlice.js +1 -0
  100. package/dist/context/DashboardProvider.d.ts +8 -19
  101. package/dist/context/DashboardProvider.d.ts.map +1 -1
  102. package/dist/context/DashboardProvider.js +1 -1
  103. package/dist/context/LayoutsSlice.d.ts +12 -0
  104. package/dist/context/LayoutsSlice.d.ts.map +1 -0
  105. package/dist/context/LayoutsSlice.js +1 -0
  106. package/dist/context/QueryStringProvider.d.ts +13 -0
  107. package/dist/context/QueryStringProvider.d.ts.map +1 -0
  108. package/dist/context/QueryStringProvider.js +1 -0
  109. package/dist/context/TemplateVariableProvider.d.ts +25 -0
  110. package/dist/context/TemplateVariableProvider.d.ts.map +1 -0
  111. package/dist/context/TemplateVariableProvider.js +1 -0
  112. package/dist/context/TimeRangeProvider.d.ts +12 -0
  113. package/dist/context/TimeRangeProvider.d.ts.map +1 -0
  114. package/dist/context/TimeRangeProvider.js +1 -0
  115. package/dist/context/index.d.ts +5 -2
  116. package/dist/context/index.d.ts.map +1 -1
  117. package/dist/context/index.js +1 -1
  118. package/dist/css/styles.d.ts +172 -0
  119. package/dist/css/styles.d.ts.map +1 -0
  120. package/dist/css/styles.js +1 -0
  121. package/dist/test/plugin-registry.d.ts +4 -2
  122. package/dist/test/plugin-registry.d.ts.map +1 -1
  123. package/dist/test/plugin-registry.js +1 -1
  124. package/dist/test/render.d.ts +2 -1
  125. package/dist/test/render.d.ts.map +1 -1
  126. package/dist/test/render.js +1 -1
  127. package/dist/test/testDashboard.d.ts.map +1 -1
  128. package/dist/test/testDashboard.js +1 -1
  129. package/dist/views/DashboardApp.js +1 -1
  130. package/dist/views/ViewDashboard.d.ts.map +1 -1
  131. package/dist/views/ViewDashboard.js +1 -1
  132. package/package.json +9 -11
  133. package/dist/cjs/components/AddPanel/AddPanel.js +0 -75
  134. package/dist/cjs/components/VariableAutocomplete.js +0 -63
  135. package/dist/cjs/components/VariableList/VariableList.js +0 -42
  136. package/dist/cjs/components/VariableList/VariableList.test.js +0 -86
  137. package/dist/cjs/context/TemplateVariablesProvider.js +0 -142
  138. package/dist/cjs/context/TimeRangeStateProvider.js +0 -49
  139. package/dist/components/AddPanel/AddPanel.d.ts +0 -8
  140. package/dist/components/AddPanel/AddPanel.d.ts.map +0 -1
  141. package/dist/components/AddPanel/AddPanel.js +0 -1
  142. package/dist/components/TimeRangeControls.d.ts.map +0 -1
  143. package/dist/components/TimeRangeControls.js +0 -1
  144. package/dist/components/VariableAutocomplete.d.ts +0 -21
  145. package/dist/components/VariableAutocomplete.d.ts.map +0 -1
  146. package/dist/components/VariableAutocomplete.js +0 -1
  147. package/dist/components/VariableList/VariableList.d.ts +0 -11
  148. package/dist/components/VariableList/VariableList.d.ts.map +0 -1
  149. package/dist/components/VariableList/VariableList.js +0 -1
  150. package/dist/components/VariableList/VariableList.test.d.ts +0 -2
  151. package/dist/components/VariableList/VariableList.test.d.ts.map +0 -1
  152. package/dist/components/VariableList/VariableList.test.js +0 -1
  153. package/dist/components/VariableList/index.d.ts +0 -2
  154. package/dist/components/VariableList/index.d.ts.map +0 -1
  155. package/dist/components/VariableList/index.js +0 -1
  156. package/dist/context/TemplateVariablesProvider.d.ts +0 -23
  157. package/dist/context/TemplateVariablesProvider.d.ts.map +0 -1
  158. package/dist/context/TemplateVariablesProvider.js +0 -1
  159. package/dist/context/TimeRangeStateProvider.d.ts +0 -22
  160. package/dist/context/TimeRangeStateProvider.d.ts.map +0 -1
  161. package/dist/context/TimeRangeStateProvider.js +0 -1
@@ -0,0 +1 @@
1
+ import{immer}from"zustand/middleware/immer";import{useDashboardStore}from"./DashboardProvider";export const createDashboardAppSlice=immer((e=>({openPanelDrawer:({groupIndex:a,panelKey:r})=>e((e=>{e.panelDrawer={groupIndex:a,panelKey:r}})),closePanelDrawer:()=>e((e=>{e.panelDrawer=void 0})),openPanelGroupDialog:a=>e((e=>{e.panelGroupDialog={groupIndex:a}})),closePanelGroupDialog:()=>e((e=>{e.panelGroupDialog=void 0}))})));export function useDashboardApp(){return useDashboardStore((({panelDrawer:e,openPanelDrawer:a,closePanelDrawer:r,panelGroupDialog:o,openPanelGroupDialog:l,closePanelGroupDialog:p})=>({panelDrawer:e,openPanelDrawer:a,closePanelDrawer:r,panelGroupDialog:o,openPanelGroupDialog:l,closePanelGroupDialog:p})))}
@@ -1,20 +1,15 @@
1
1
  /// <reference types="react" />
2
- import { DashboardSpec, GridItemDefinition, LayoutDefinition, PanelDefinition } from '@perses-dev/core';
3
- interface DashboardState {
2
+ import { DashboardSpec, LayoutDefinition, PanelDefinition } from '@perses-dev/core';
3
+ import { DashboardAppSlice } from './DashboardAppSlice';
4
+ import { LayoutsSlice } from './LayoutsSlice';
5
+ export interface DashboardStoreState extends DashboardAppSlice, LayoutsSlice {
4
6
  dashboard: DashboardSpec;
5
- isEditMode: boolean;
6
7
  layouts: LayoutDefinition[];
7
8
  panels: Record<string, PanelDefinition>;
8
- }
9
- interface DashboardActions {
9
+ updatePanel: (name: string, panel: PanelDefinition, groupIndex?: number) => void;
10
+ isEditMode: boolean;
10
11
  setEditMode: (isEditMode: boolean) => void;
11
- setLayouts: (layouts: LayoutDefinition[]) => void;
12
- addLayout: (layout: LayoutDefinition) => void;
13
- addItemToLayout: (index: number, item: GridItemDefinition) => void;
14
- setPanels: (panels: Record<string, PanelDefinition>) => void;
15
- addPanel: (name: string, panel: PanelDefinition) => void;
16
12
  }
17
- export declare type DashboardStoreState = DashboardState & DashboardActions;
18
13
  export interface DashboardStoreProps {
19
14
  dashboardSpec: DashboardSpec;
20
15
  isEditMode?: boolean;
@@ -25,13 +20,7 @@ export interface DashboardProviderProps {
25
20
  }
26
21
  export declare function usePanels(): {
27
22
  panels: Record<string, PanelDefinition<import("@perses-dev/core").JsonObject>>;
28
- addPanel: (name: string, panel: PanelDefinition<import("@perses-dev/core").JsonObject>) => void;
29
- };
30
- export declare function useLayouts(): {
31
- layouts: import("@perses-dev/core").GridDefinition[];
32
- setLayouts: (layouts: import("@perses-dev/core").GridDefinition[]) => void;
33
- addLayout: (layout: import("@perses-dev/core").GridDefinition) => void;
34
- addItemToLayout: (index: number, item: GridItemDefinition) => void;
23
+ updatePanel: (name: string, panel: PanelDefinition<import("@perses-dev/core").JsonObject>, groupIndex?: number | undefined) => void;
35
24
  };
36
25
  export declare function useEditMode(): {
37
26
  isEditMode: boolean;
@@ -40,6 +29,6 @@ export declare function useEditMode(): {
40
29
  export declare function useDashboard(): {
41
30
  dashboard: DashboardSpec;
42
31
  };
32
+ export declare function useDashboardStore<T>(selector: (state: DashboardStoreState) => T): T;
43
33
  export declare function DashboardProvider(props: DashboardProviderProps): JSX.Element;
44
- export {};
45
34
  //# sourceMappingURL=DashboardProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DashboardProvider.d.ts","sourceRoot":"","sources":["../../src/context/DashboardProvider.tsx"],"names":[],"mappings":";AAiBA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExG,UAAU,cAAc;IACtB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CACzC;AAED,UAAU,gBAAgB;IACxB,WAAW,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,UAAU,EAAE,CAAC,OAAO,EAAE,gBAAgB,EAAE,KAAK,IAAI,CAAC;IAClD,SAAS,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC9C,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACnE,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,KAAK,IAAI,CAAC;IAC7D,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;CAC1D;AAED,oBAAY,mBAAmB,GAAG,cAAc,GAAG,gBAAgB,CAAC;AAEpE,MAAM,WAAW,mBAAmB;IAClC,aAAa,EAAE,aAAa,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AACD,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,mBAAmB,CAAC;IAClC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAID,wBAAgB,SAAS;;;EAGxB;AAED,wBAAgB,UAAU;;;;;EAUzB;AAED,wBAAgB,WAAW;;;EAG1B;AAED,wBAAgB,YAAY;;EAU3B;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,eA4C9D"}
1
+ {"version":3,"file":"DashboardProvider.d.ts","sourceRoot":"","sources":["../../src/context/DashboardProvider.tsx"],"names":[],"mappings":";AAmBA,OAAO,EAAE,aAAa,EAAsB,gBAAgB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxG,OAAO,EAAE,iBAAiB,EAA2B,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,YAAY,EAAsB,MAAM,gBAAgB,CAAC;AAElE,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB,EAAE,YAAY;IAC1E,SAAS,EAAE,aAAa,CAAC;IACzB,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACxC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACjF,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C;AAED,MAAM,WAAW,mBAAmB;IAClC,aAAa,EAAE,aAAa,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AACD,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,mBAAmB,CAAC;IAClC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,wBAAgB,SAAS;;;EAExB;AAED,wBAAgB,WAAW;;;EAE1B;AAED,wBAAgB,YAAY;;EAU3B;AAID,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,CAAC,KAM/E;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,eAqD9D"}
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import create from"zustand";import createZustandContext from"zustand/context";import produce from"immer";const{Provider,useStore}=createZustandContext();export function usePanels(){const{panels:t,addPanel:e}=useStore((({panels:t,addPanel:e})=>({panels:t,addPanel:e})));return{panels:t,addPanel:e}}export function useLayouts(){const{layouts:t,setLayouts:e,addLayout:o,addItemToLayout:a}=useStore((({layouts:t,setLayouts:e,addLayout:o,addItemToLayout:a})=>({layouts:t,setLayouts:e,addLayout:o,addItemToLayout:a})));return{layouts:t,setLayouts:e,addLayout:o,addItemToLayout:a}}export function useEditMode(){const{isEditMode:t,setEditMode:e}=useStore((({isEditMode:t,setEditMode:e})=>({isEditMode:t,setEditMode:e})));return{isEditMode:t,setEditMode:e}}export function useDashboard(){return{dashboard:useStore((t=>produce(t.dashboard,(e=>{e.panels=t.panels,e.layouts=t.layouts}))))}}export function DashboardProvider(t){const{children:e,initialState:{dashboardSpec:o,isEditMode:a}}=t,{layouts:d,panels:s}=o;return _jsx(Provider,{createStore:()=>create((t=>({layouts:d,panels:s,dashboard:o,isEditMode:!!a,setEditMode:e=>t({isEditMode:e}),setLayouts:e=>t({layouts:e}),addLayout:e=>t(produce((t=>{t.layouts.push(e)}))),addItemToLayout:(e,o)=>t(produce((t=>{t.layouts[e].spec.items.push(o)}))),setPanels:e=>t({panels:e}),addPanel:(e,o)=>{t(produce((t=>{t.panels[e]=o}),{}))}}))),children:e})}
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{createStore,useStore}from"zustand";import{immer}from"zustand/middleware/immer";import shallow from"zustand/shallow";import{createContext,useContext}from"react";import produce from"immer";import{createDashboardAppSlice}from"./DashboardAppSlice";import{createLayoutsSlice}from"./LayoutsSlice";export function usePanels(){return useDashboardStore((({panels:e,updatePanel:o})=>({panels:e,updatePanel:o})))}export function useEditMode(){return useDashboardStore((({isEditMode:e,setEditMode:o})=>({isEditMode:e,setEditMode:o})))}export function useDashboard(){return{dashboard:useDashboardStore((e=>produce(e.dashboard,(o=>{o.panels=e.panels,o.layouts=e.layouts}))))}}const DashboardContext=createContext(void 0);export function useDashboardStore(e){const o=useContext(DashboardContext);if(void 0===o)throw new Error("No DashboardContext found. Did you forget a Provider?");return useStore(o,e,shallow)}export function DashboardProvider(e){const{children:o,initialState:{dashboardSpec:t,isEditMode:r}}=e,{layouts:a,panels:s}=t,d=createStore()(immer(((e,o,d)=>({...createDashboardAppSlice(e,o,d,[]),...createLayoutsSlice(e,o,d,[]),layouts:a,panels:s,dashboard:t,updatePanel:(o,t,r=0)=>e((e=>{var a,s;if(void 0===e.panels[o]){let t=0;null===(a=e.layouts[r])||void 0===a||a.spec.items.forEach((e=>{e.y>t&&(t=e.y)}));const d={x:0,y:t+1,width:12,height:6,content:{$ref:`#/spec/panels/${o}`}},i=e.layouts;i&&i[r]&&(null===(s=i[r])||void 0===s||s.spec.items.push(d))}e.panels[o]=t})),isEditMode:!!r,setEditMode:o=>e({isEditMode:o})}))));return _jsx(DashboardContext.Provider,{value:d,children:o})}
@@ -0,0 +1,12 @@
1
+ import { LayoutDefinition, GridItemDefinition } from '@perses-dev/core';
2
+ export interface LayoutsSlice {
3
+ updateLayout: (layout: LayoutDefinition, index?: number) => void;
4
+ addItemToLayout: (index: number, item: GridItemDefinition) => void;
5
+ }
6
+ export declare const createLayoutsSlice: import("zustand").StateCreator<LayoutsSlice, [], [["zustand/immer", never]], LayoutsSlice>;
7
+ export declare function useLayouts(): {
8
+ layouts: import("@perses-dev/core").GridDefinition[];
9
+ updateLayout: (layout: import("@perses-dev/core").GridDefinition, index?: number | undefined) => void;
10
+ addItemToLayout: (index: number, item: GridItemDefinition) => void;
11
+ };
12
+ //# sourceMappingURL=LayoutsSlice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LayoutsSlice.d.ts","sourceRoot":"","sources":["../../src/context/LayoutsSlice.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAIxE,MAAM,WAAW,YAAY;IAC3B,YAAY,EAAE,CAAC,MAAM,EAAE,gBAAgB,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACjE,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,KAAK,IAAI,CAAC;CACpE;AAED,eAAO,MAAM,kBAAkB,4FAgB5B,CAAC;AAEJ,wBAAgB,UAAU;;;;EAMzB"}
@@ -0,0 +1 @@
1
+ import{immer}from"zustand/middleware/immer";import{useDashboardStore}from"./DashboardProvider";export const createLayoutsSlice=immer((o=>({updateLayout:(t,a)=>o((o=>{void 0===a?o.layouts.unshift(t):o.layouts[a]=t})),addItemToLayout:(t,a)=>o((o=>{var e;const u=o.layouts;u&&u[t]&&(null===(e=u[t])||void 0===e||e.spec.items.push(a))}))})));export function useLayouts(){return useDashboardStore((({layouts:o,updateLayout:t,addItemToLayout:a})=>({layouts:o,updateLayout:t,addItemToLayout:a})))}
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { QueryString } from '@perses-dev/plugin-system';
3
+ export interface QueryStringProviderProps {
4
+ queryString: URLSearchParams;
5
+ setQueryString?: (queryString: URLSearchParams) => void;
6
+ children?: React.ReactNode;
7
+ }
8
+ /**
9
+ * Allows apps to provide their own query string implementations
10
+ */
11
+ export declare function QueryStringProvider(props: QueryStringProviderProps): JSX.Element;
12
+ export declare function useQueryString(): QueryString;
13
+ //# sourceMappingURL=QueryStringProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueryStringProvider.d.ts","sourceRoot":"","sources":["../../src/context/QueryStringProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,WAAW,EAAsB,MAAM,2BAA2B,CAAC;AAE5E,MAAM,WAAW,wBAAwB;IACvC,WAAW,EAAE,eAAe,CAAC;IAC7B,cAAc,CAAC,EAAE,CAAC,WAAW,EAAE,eAAe,KAAK,IAAI,CAAC;IACxD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,eAMlE;AAED,wBAAgB,cAAc,IAAI,WAAW,CAM5C"}
@@ -0,0 +1 @@
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useMemo}from"react";import{QueryStringContext}from"@perses-dev/plugin-system";export function QueryStringProvider(r){const{queryString:e,setQueryString:t,children:n}=r,o=useMemo((()=>({queryString:e,setQueryString:t})),[e,t]);return _jsx(QueryStringContext.Provider,{value:o,children:n})}export function useQueryString(){const r=useContext(QueryStringContext);if(void 0===r)throw new Error("No QueryStringContext found. Did you forget a Provider?");return r}
@@ -0,0 +1,25 @@
1
+ /// <reference types="react" />
2
+ import { VariableStateMap, VariableState, VariableName, VariableValue, VariableDefinition } from '@perses-dev/core';
3
+ declare type TemplateVariableStore = {
4
+ variableDefinitions: VariableDefinition[];
5
+ variableState: VariableStateMap;
6
+ setVariableValue: (variableName: VariableName, value: VariableValue) => void;
7
+ loadTemplateVariable: (name: VariableName) => Promise<void>;
8
+ };
9
+ export declare function useTemplateVariableValues(variableNames?: string[]): VariableStateMap;
10
+ export declare function useTemplateVariable(name: string): {
11
+ state: VariableState | undefined;
12
+ definition: VariableDefinition | undefined;
13
+ };
14
+ export declare function useTemplateVariableActions(): {
15
+ setVariableValue: (variableName: string, value: VariableValue) => void;
16
+ loadTemplateVariable: (name: string) => Promise<void>;
17
+ };
18
+ export declare function useTemplateVariableDefinitions(): VariableDefinition[];
19
+ export declare function useTemplateVariableStore(): TemplateVariableStore;
20
+ export declare function TemplateVariableProvider({ children, initialVariableDefinitions, }: {
21
+ children: React.ReactNode;
22
+ initialVariableDefinitions?: VariableDefinition[];
23
+ }): JSX.Element;
24
+ export {};
25
+ //# sourceMappingURL=TemplateVariableProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TemplateVariableProvider.d.ts","sourceRoot":"","sources":["../../src/context/TemplateVariableProvider.tsx"],"names":[],"mappings":";AAkBA,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,aAAa,EAEb,kBAAkB,EAEnB,MAAM,kBAAkB,CAAC;AAE1B,aAAK,qBAAqB,GAAG;IAC3B,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;IAC1C,aAAa,EAAE,gBAAgB,CAAC;IAChC,gBAAgB,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC7E,oBAAoB,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7D,CAAC;AAaF,wBAAgB,yBAAyB,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,oBAqBjE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM;;;EAU/C;AAED,wBAAgB,0BAA0B;;;EAQzC;AAED,wBAAgB,8BAA8B,yBAG7C;AAED,wBAAgB,wBAAwB,0BAGvC;AA0ED,wBAAgB,wBAAwB,CAAC,EACvC,QAAQ,EACR,0BAA+B,GAChC,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,0BAA0B,CAAC,EAAE,kBAAkB,EAAE,CAAC;CACnD,eAQA"}
@@ -0,0 +1 @@
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{createContext,useContext}from"react";import{createStore,useStore}from"zustand";import{immer}from"zustand/middleware/immer";import{devtools}from"zustand/middleware";import{TemplateVariableContext}from"@perses-dev/plugin-system";import{DEFAULT_ALL_VALUE as ALL_VALUE}from"@perses-dev/core";const TemplateVariableStoreContext=createContext(void 0);function useTemplateVariableStoreCtx(){const e=useContext(TemplateVariableStoreContext);if(!e)throw new Error("TemplateVariableStoreContext not initialized");return e}export function useTemplateVariableValues(e){const t=useTemplateVariableStoreCtx();return useStore(t,(t=>{const a=null!=e?e:Object.keys(t.variableState),r={};return a.forEach((e=>{const a=t.variableState[e];a&&(r[e]=a)})),r}),((e,t)=>JSON.stringify(e)===JSON.stringify(t)))}export function useTemplateVariable(e){const t=useTemplateVariableStoreCtx();return useStore(t,(t=>({state:t.variableState[e],definition:t.variableDefinitions.find((t=>t.name===e))})))}export function useTemplateVariableActions(){const e=useTemplateVariableStoreCtx();return useStore(e,(e=>({setVariableValue:e.setVariableValue,loadTemplateVariable:e.loadTemplateVariable})))}export function useTemplateVariableDefinitions(){const e=useTemplateVariableStoreCtx();return useStore(e,(e=>e.variableDefinitions))}export function useTemplateVariableStore(){const e=useTemplateVariableStoreCtx();return useStore(e)}function PluginProvider({children:e}){const t=useTemplateVariableValues();return _jsx(TemplateVariableContext.Provider,{value:{state:t},children:e})}function createTemplateVariableSrvStore({initialVariableDefinitions:e=[]}){return createStore()(devtools(immer(((t,a)=>({variableState:hydrateTemplateVariableStates(e),variableDefinitions:e,loadTemplateVariable:async e=>{const r=a().variableDefinitions.find((t=>t.name===e));if(!r)return;t((t=>{const a=t.variableState[e];a&&(a.loading=!0)}));const{data:i}=await loadTemplateVariables();r.options.allowAllValue&&i.unshift(getAllOption()),t((t=>{const a=t.variableState[e];a&&(a.options=i,a.loading=!1)}))},setVariableValue:(e,a)=>t((t=>{let r=a;const i=t.variableState[e];i&&(Array.isArray(r)&&r.includes(ALL_VALUE)&&(r=r.at(-1)===ALL_VALUE?[ALL_VALUE]:r.filter((e=>e!==ALL_VALUE))),i.value=r)}))})))))}export function TemplateVariableProvider({children:e,initialVariableDefinitions:t=[]}){const a=createTemplateVariableSrvStore({initialVariableDefinitions:t});return _jsx(TemplateVariableStoreContext.Provider,{value:a,children:_jsx(PluginProvider,{children:e})})}async function loadTemplateVariables(){const e=Math.floor(1e4*Math.random())+1e3;return await new Promise((t=>setTimeout(t,e))),{data:["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"].map((e=>({label:e,value:e})))}}function getAllOption(){return{label:"All",value:ALL_VALUE}}function hydrateTemplateVariableState(e){var t,a;const r=e,i={value:null,loading:!1};switch(r.kind){case"TextVariable":i.value=r.options.value;break;case"ListVariable":if(i.options=[],r.options.allowAllValue&&i.options.unshift({label:"All",value:ALL_VALUE}),i.options.length>0&&!i.value){const e=null!==(a=null===(t=i.options[0])||void 0===t?void 0:t.value)&&void 0!==a?a:null;null!==e&&(i.value=r.options.allowMultiple?[e]:e)}}return i}function hydrateTemplateVariableStates(e){const t={};return e.forEach((e=>{t[e.name]=hydrateTemplateVariableState(e)})),t}
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { TimeRangeValue } from '@perses-dev/core';
3
+ export interface TimeRangeProviderProps {
4
+ initialTimeRange: TimeRangeValue;
5
+ children?: React.ReactNode;
6
+ onTimeRangeChange?: (e: TimeRangeValue) => void;
7
+ }
8
+ /**
9
+ * Provider implementation that supplies the time range state at runtime.
10
+ */
11
+ export declare function TimeRangeProvider(props: TimeRangeProviderProps): JSX.Element;
12
+ //# sourceMappingURL=TimeRangeProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimeRangeProvider.d.ts","sourceRoot":"","sources":["../../src/context/TimeRangeProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,cAAc,EAA+D,MAAM,kBAAkB,CAAC;AAG/G,MAAM,WAAW,sBAAsB;IACrC,gBAAgB,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,iBAAiB,CAAC,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;CACjD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,eAkD9D"}
@@ -0,0 +1 @@
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useState,useMemo,useCallback}from"react";import{getUnixTime}from"date-fns";import{toAbsoluteTimeRange,isRelativeTimeRange}from"@perses-dev/core";import{TimeRangeContext,useQueryString}from"@perses-dev/plugin-system";export function TimeRangeProvider(e){const{initialTimeRange:t,children:i,onTimeRangeChange:n}=e,{queryString:s,setQueryString:r}=useQueryString(),a=isRelativeTimeRange(t)?toAbsoluteTimeRange(t):t,[o,m]=useState(a),g=useCallback((e=>{if(void 0===n)if(isRelativeTimeRange(e))r?(s.set("start",e.pastDuration),s.delete("end"),r(s)):m(toAbsoluteTimeRange(e));else if(r){const t=1e3*getUnixTime(e.start),i=1e3*getUnixTime(e.end);s.set("start",t.toString()),s.set("end",i.toString()),r(s)}else m(e);else n(e)}),[s,r,n]),u=useMemo((()=>({timeRange:o,setTimeRange:g})),[o,g]);return _jsx(TimeRangeContext.Provider,{value:u,children:i})}
@@ -1,4 +1,7 @@
1
- export * from './TemplateVariablesProvider';
2
- export * from './TimeRangeStateProvider';
1
+ export * from './DashboardAppSlice';
2
+ export * from './LayoutsSlice';
3
+ export * from './TemplateVariableProvider';
3
4
  export * from './DashboardProvider';
5
+ export * from './TimeRangeProvider';
6
+ export * from './QueryStringProvider';
4
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAaA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAaA,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC"}
@@ -1 +1 @@
1
- export*from"./TemplateVariablesProvider";export*from"./TimeRangeStateProvider";export*from"./DashboardProvider";
1
+ export*from"./DashboardAppSlice";export*from"./LayoutsSlice";export*from"./TemplateVariableProvider";export*from"./DashboardProvider";export*from"./TimeRangeProvider";export*from"./QueryStringProvider";
@@ -0,0 +1,172 @@
1
+ import { Theme } from '@mui/material';
2
+ export declare const styles: (theme: Theme) => {
3
+ readonly '&.react-grid-layout': {
4
+ readonly position: "relative";
5
+ readonly transition: "height 200ms ease";
6
+ };
7
+ readonly '&.react-grid-item': {
8
+ readonly transition: "all 200ms ease";
9
+ readonly transitionProperty: "left, top";
10
+ };
11
+ readonly '&.react-grid-item img': {
12
+ readonly pointerEvents: "none";
13
+ readonly userSelect: "none";
14
+ };
15
+ readonly '&.react-grid-item.cssTransforms': {
16
+ readonly transitionProperty: "transform";
17
+ };
18
+ readonly '&.react-grid-item.resizing': {
19
+ readonly zIndex: 1;
20
+ readonly willChange: "width, height";
21
+ };
22
+ readonly '&.react-grid-item.react-draggable-dragging': {
23
+ readonly transition: "none";
24
+ readonly zIndex: 3;
25
+ readonly willChange: "transform";
26
+ };
27
+ readonly '&.react-grid-item.dropping': {
28
+ readonly visibility: "hidden";
29
+ };
30
+ readonly '&.react-grid-item.react-grid-placeholder': {
31
+ readonly background: string;
32
+ readonly opacity: 0.2;
33
+ readonly transitionDuration: "100ms";
34
+ readonly zIndex: 2;
35
+ readonly userSelect: "none";
36
+ readonly WebkitUserSelect: "none";
37
+ readonly MozUserSelect: "none";
38
+ readonly msUserSelect: "none";
39
+ readonly OUserSelect: "none";
40
+ };
41
+ readonly '&.react-grid-item > .react-resizable-handle': {
42
+ readonly position: "absolute";
43
+ readonly width: "20px";
44
+ readonly height: "20px";
45
+ };
46
+ readonly '&.react-grid-item > .react-resizable-handle::after': {
47
+ readonly content: "\"\"";
48
+ readonly position: "absolute";
49
+ readonly right: "3px";
50
+ readonly bottom: "3px";
51
+ readonly width: "5px";
52
+ readonly height: "5px";
53
+ readonly borderRight: "2px solid rgba(0, 0, 0, 0.4)";
54
+ readonly borderBottom: "2px solid rgba(0, 0, 0, 0.4)";
55
+ };
56
+ readonly '&.react-resizable-hide > .react-resizable-handle': {
57
+ readonly display: "none";
58
+ };
59
+ readonly '&.react-grid-item > .react-resizable-handle.react-resizable-handle-sw': {
60
+ readonly bottom: "0";
61
+ readonly left: "0";
62
+ readonly cursor: "sw-resize";
63
+ readonly transform: "rotate(90deg)";
64
+ };
65
+ readonly '&.react-grid-item > .react-resizable-handle.react-resizable-handle-se': {
66
+ readonly bottom: "0";
67
+ readonly right: "0";
68
+ readonly cursor: "se-resize";
69
+ };
70
+ readonly '&.react-grid-item > .react-resizable-handle.react-resizable-handle-nw': {
71
+ readonly top: "0";
72
+ readonly left: "0";
73
+ readonly cursor: "nw-resize";
74
+ readonly transform: "rotate(180deg)";
75
+ };
76
+ readonly '&.react-grid-item > .react-resizable-handle.react-resizable-handle-ne': {
77
+ readonly top: "0";
78
+ readonly right: "0";
79
+ readonly cursor: "ne-resize";
80
+ readonly transform: "rotate(270deg)";
81
+ };
82
+ readonly '&.react-grid-item > .react-resizable-handle.react-resizable-handle-w, &.react-grid-item > .react-resizable-handle.react-resizable-handle-e': {
83
+ readonly top: "50%";
84
+ readonly marginTop: "-10px";
85
+ readonly cursor: "ew-resize";
86
+ };
87
+ readonly '&.react-grid-item > .react-resizable-handle.react-resizable-handle-w': {
88
+ readonly left: "0";
89
+ readonly transform: "rotate(135deg)";
90
+ };
91
+ readonly '&.react-grid-item > .react-resizable-handle.react-resizable-handle-e': {
92
+ readonly right: "0";
93
+ readonly transform: "rotate(315deg)";
94
+ };
95
+ readonly '&.react-grid-item > .react-resizable-handle.react-resizable-handle-n, &.react-grid-item > .react-resizable-handle.react-resizable-handle-s': {
96
+ readonly left: "50%";
97
+ readonly marginLeft: "-10px";
98
+ readonly cursor: "ns-resize";
99
+ };
100
+ readonly '&.react-grid-item > .react-resizable-handle.react-resizable-handle-n': {
101
+ readonly top: "0";
102
+ readonly transform: "rotate(225deg)";
103
+ };
104
+ readonly '&.react-grid-item > .react-resizable-handle.react-resizable-handle-s': {
105
+ readonly bottom: "0";
106
+ readonly transform: "rotate(45deg)";
107
+ };
108
+ readonly '&.react-resizable': {
109
+ readonly position: "relative";
110
+ };
111
+ readonly '&.react-resizable-handle': {
112
+ readonly position: "absolute";
113
+ readonly width: "20px";
114
+ readonly height: "20px";
115
+ readonly backgroundRepeat: "no-repeat";
116
+ readonly backgroundOrigin: "content-box";
117
+ readonly boxSizing: "border-box";
118
+ readonly backgroundImage: "url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2IDYiIHN0eWxlPSJiYWNrZ3JvdW5kLWNvbG9yOiNmZmZmZmYwMCIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI2cHgiIGhlaWdodD0iNnB4Ij48ZyBvcGFjaXR5PSIwLjMwMiI+PHBhdGggZD0iTSA2IDYgTCAwIDYgTCAwIDQuMiBMIDQgNC4yIEwgNC4yIDQuMiBMIDQuMiAwIEwgNiAwIEwgNiA2IEwgNiA2IFoiIGZpbGw9IiMwMDAwMDAiLz48L2c+PC9zdmc+')";
119
+ readonly backgroundPosition: "bottom right";
120
+ readonly padding: "0 3px 3px 0";
121
+ };
122
+ readonly '&.react-resizable-handle-sw': {
123
+ readonly bottom: "0";
124
+ readonly left: "0";
125
+ readonly cursor: "sw-resize";
126
+ readonly transform: "rotate(90deg)";
127
+ };
128
+ readonly '&.react-resizable-handle-se': {
129
+ readonly bottom: "0";
130
+ readonly right: "0";
131
+ readonly cursor: "se-resize";
132
+ };
133
+ readonly '&.react-resizable-handle-nw': {
134
+ readonly top: "0";
135
+ readonly left: "0";
136
+ readonly cursor: "nw-resize";
137
+ readonly transform: "rotate(180deg)";
138
+ };
139
+ readonly '&.react-resizable-handle-ne': {
140
+ readonly top: "0";
141
+ readonly right: "0";
142
+ readonly cursor: "ne-resize";
143
+ readonly transform: "rotate(270deg)";
144
+ };
145
+ readonly '&.react-resizable-handle-w, .react-resizable-handle-e': {
146
+ readonly top: "50%";
147
+ readonly marginTop: "-10px";
148
+ readonly cursor: "ew-resize";
149
+ };
150
+ readonly '&.react-resizable-handle-w': {
151
+ readonly left: "0";
152
+ readonly transform: "rotate(135deg)";
153
+ };
154
+ readonly '&.react-resizable-handle-e': {
155
+ readonly right: "0";
156
+ readonly transform: "rotate(315deg)";
157
+ };
158
+ readonly '&.react-resizable-handle-n, .react-resizable-handle-s': {
159
+ readonly left: "50%";
160
+ readonly marginLeft: "-10px";
161
+ readonly cursor: "ns-resize";
162
+ };
163
+ readonly '&.react-resizable-handle-n': {
164
+ readonly top: "0";
165
+ readonly transform: "rotate(225deg)";
166
+ };
167
+ readonly '&.react-resizable-handle-s': {
168
+ readonly bottom: "0";
169
+ readonly transform: "rotate(45deg)";
170
+ };
171
+ };
172
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/css/styles.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,eAAO,MAAM,MAAM,UAAW,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgLlC,CAAC"}
@@ -0,0 +1 @@
1
+ export const styles=e=>({"&.react-grid-layout":{position:"relative",transition:"height 200ms ease"},"&.react-grid-item":{transition:"all 200ms ease",transitionProperty:"left, top"},"&.react-grid-item img":{pointerEvents:"none",userSelect:"none"},"&.react-grid-item.cssTransforms":{transitionProperty:"transform"},"&.react-grid-item.resizing":{zIndex:1,willChange:"width, height"},"&.react-grid-item.react-draggable-dragging":{transition:"none",zIndex:3,willChange:"transform"},"&.react-grid-item.dropping":{visibility:"hidden"},"&.react-grid-item.react-grid-placeholder":{background:e.palette.primary.main,opacity:.2,transitionDuration:"100ms",zIndex:2,userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",OUserSelect:"none"},"&.react-grid-item > .react-resizable-handle":{position:"absolute",width:"20px",height:"20px"},"&.react-grid-item > .react-resizable-handle::after":{content:'""',position:"absolute",right:"3px",bottom:"3px",width:"5px",height:"5px",borderRight:"2px solid rgba(0, 0, 0, 0.4)",borderBottom:"2px solid rgba(0, 0, 0, 0.4)"},"&.react-resizable-hide > .react-resizable-handle":{display:"none"},"&.react-grid-item > .react-resizable-handle.react-resizable-handle-sw":{bottom:"0",left:"0",cursor:"sw-resize",transform:"rotate(90deg)"},"&.react-grid-item > .react-resizable-handle.react-resizable-handle-se":{bottom:"0",right:"0",cursor:"se-resize"},"&.react-grid-item > .react-resizable-handle.react-resizable-handle-nw":{top:"0",left:"0",cursor:"nw-resize",transform:"rotate(180deg)"},"&.react-grid-item > .react-resizable-handle.react-resizable-handle-ne":{top:"0",right:"0",cursor:"ne-resize",transform:"rotate(270deg)"},"&.react-grid-item > .react-resizable-handle.react-resizable-handle-w, &.react-grid-item > .react-resizable-handle.react-resizable-handle-e":{top:"50%",marginTop:"-10px",cursor:"ew-resize"},"&.react-grid-item > .react-resizable-handle.react-resizable-handle-w":{left:"0",transform:"rotate(135deg)"},"&.react-grid-item > .react-resizable-handle.react-resizable-handle-e":{right:"0",transform:"rotate(315deg)"},"&.react-grid-item > .react-resizable-handle.react-resizable-handle-n, &.react-grid-item > .react-resizable-handle.react-resizable-handle-s":{left:"50%",marginLeft:"-10px",cursor:"ns-resize"},"&.react-grid-item > .react-resizable-handle.react-resizable-handle-n":{top:"0",transform:"rotate(225deg)"},"&.react-grid-item > .react-resizable-handle.react-resizable-handle-s":{bottom:"0",transform:"rotate(45deg)"},"&.react-resizable":{position:"relative"},"&.react-resizable-handle":{position:"absolute",width:"20px",height:"20px",backgroundRepeat:"no-repeat",backgroundOrigin:"content-box",boxSizing:"border-box",backgroundImage:"url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2IDYiIHN0eWxlPSJiYWNrZ3JvdW5kLWNvbG9yOiNmZmZmZmYwMCIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI2cHgiIGhlaWdodD0iNnB4Ij48ZyBvcGFjaXR5PSIwLjMwMiI+PHBhdGggZD0iTSA2IDYgTCAwIDYgTCAwIDQuMiBMIDQgNC4yIEwgNC4yIDQuMiBMIDQuMiAwIEwgNiAwIEwgNiA2IEwgNiA2IFoiIGZpbGw9IiMwMDAwMDAiLz48L2c+PC9zdmc+')",backgroundPosition:"bottom right",padding:"0 3px 3px 0"},"&.react-resizable-handle-sw":{bottom:"0",left:"0",cursor:"sw-resize",transform:"rotate(90deg)"},"&.react-resizable-handle-se":{bottom:"0",right:"0",cursor:"se-resize"},"&.react-resizable-handle-nw":{top:"0",left:"0",cursor:"nw-resize",transform:"rotate(180deg)"},"&.react-resizable-handle-ne":{top:"0",right:"0",cursor:"ne-resize",transform:"rotate(270deg)"},"&.react-resizable-handle-w, .react-resizable-handle-e":{top:"50%",marginTop:"-10px",cursor:"ew-resize"},"&.react-resizable-handle-w":{left:"0",transform:"rotate(135deg)"},"&.react-resizable-handle-e":{right:"0",transform:"rotate(315deg)"},"&.react-resizable-handle-n, .react-resizable-handle-s":{left:"50%",marginLeft:"-10px",cursor:"ns-resize"},"&.react-resizable-handle-n":{top:"0",transform:"rotate(225deg)"},"&.react-resizable-handle-s":{bottom:"0",transform:"rotate(45deg)"}});
@@ -1,4 +1,5 @@
1
- import { PluginRegistryProps, RegisterPlugin } from '@perses-dev/plugin-system';
1
+ import { JsonObject } from '@perses-dev/core';
2
+ import { PluginRegistryProps, PluginImplementation, PanelPlugin } from '@perses-dev/plugin-system';
2
3
  /**
3
4
  * Helper for mocking `PluginRegistry` data during tests. Returns props that can be spread on the `PluginRegistry`
4
5
  * component so that it will load the mock plugins you setup. You can use the `addMockPlugin` function that's returned
@@ -6,6 +7,7 @@ import { PluginRegistryProps, RegisterPlugin } from '@perses-dev/plugin-system';
6
7
  */
7
8
  export declare function mockPluginRegistryProps(): {
8
9
  pluginRegistryProps: Omit<PluginRegistryProps, "children">;
9
- addMockPlugin: RegisterPlugin;
10
+ addMockPlugin: <T extends "Variable" | "Panel" | "GraphQuery">(pluginType: T, kind: string, plugin: PluginImplementation<T, JsonObject>) => void;
10
11
  };
12
+ export declare const FAKE_PANEL_PLUGIN: PanelPlugin<JsonObject>;
11
13
  //# sourceMappingURL=plugin-registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-registry.d.ts","sourceRoot":"","sources":["../../src/test/plugin-registry.ts"],"names":[],"mappings":"AAYA,OAAO,EAEL,mBAAmB,EAGnB,cAAc,EACf,MAAM,2BAA2B,CAAC;AAEnC;;;;GAIG;AACH,wBAAgB,uBAAuB;;;EA0CtC"}
1
+ {"version":3,"file":"plugin-registry.d.ts","sourceRoot":"","sources":["../../src/test/plugin-registry.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACL,mBAAmB,EAEnB,oBAAoB,EAGpB,WAAW,EACZ,MAAM,2BAA2B,CAAC;AAEnC;;;;GAIG;AACH,wBAAgB,uBAAuB;;wFAgB7B,MAAM;EA4Bf;AAED,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,UAAU,CAQrD,CAAC"}
@@ -1 +1 @@
1
- export function mockPluginRegistryProps(){const e={kind:"Plugin",metadata:{name:"Fake Plugin for Tests"},spec:{supported_kinds:{}}},s=[],n={setup(e){for(const n of s)n(e)}};return{pluginRegistryProps:{getInstalledPlugins:()=>Promise.resolve([e]),importPluginModule:()=>Promise.resolve(n)},addMockPlugin:n=>{e.spec.supported_kinds[n.kind]=n.pluginType,s.push((e=>{e(n)}))}}}
1
+ import{jsx as _jsx}from"react/jsx-runtime";export function mockPluginRegistryProps(){const e={kind:"PluginModule",metadata:{name:"Fake Plugin Module for Tests"},spec:{plugins:[]}},i={};return{pluginRegistryProps:{getInstalledPlugins:()=>Promise.resolve([e]),importPluginModule:()=>Promise.resolve(i)},addMockPlugin:(n,o,s)=>{e.spec.plugins.push({pluginType:n,kind:o,display:{name:`Fake ${n} Plugin for ${o}`}}),i[o]=s}}}export const FAKE_PANEL_PLUGIN={PanelComponent:()=>_jsx("div",{role:"figure",children:"FakePanel chart"}),OptionsEditorComponent:()=>_jsx("div",{children:"Edit options here"}),createInitialOptions:()=>({})};
@@ -1,7 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import { RenderOptions } from '@testing-library/react';
3
+ import { DashboardStoreProps } from '../context';
3
4
  /**
4
5
  * Test helper to render a React component with some common app-level providers wrapped around it.
5
6
  */
6
- export declare function renderWithContext(ui: React.ReactElement, options?: Omit<RenderOptions, 'queries'>): import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
7
+ export declare function renderWithContext(ui: React.ReactElement, initialState?: DashboardStoreProps, options?: Omit<RenderOptions, 'queries'>): import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
7
8
  //# sourceMappingURL=render.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/test/render.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAU,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAK/D;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,KAAK,CAAC,YAAY,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,gIAEjG"}
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/test/render.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAU,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE/D,OAAO,EAAqB,mBAAmB,EAAE,MAAM,YAAY,CAAC;AASpE;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,KAAK,CAAC,YAAY,EACtB,YAAY,GAAE,mBAAkC,EAChD,OAAO,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,gIAQzC"}
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{render}from"@testing-library/react";import{QueryClient,QueryClientProvider}from"react-query";const queryClient=new QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1}}});export function renderWithContext(e,r){return render(_jsx(QueryClientProvider,{client:queryClient,children:e}),r)}
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{render}from"@testing-library/react";import{QueryClient,QueryClientProvider}from"react-query";import{DashboardProvider}from"../context";import testDashboard from"./testDashboard";const queryClient=new QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),initialStore={isEditMode:!0,dashboardSpec:testDashboard.spec};export function renderWithContext(r,e=initialStore,t){return render(_jsx(DashboardProvider,{initialState:e,children:_jsx(QueryClientProvider,{client:queryClient,children:r})}),t)}
@@ -1 +1 @@
1
- {"version":3,"file":"testDashboard.d.ts","sourceRoot":"","sources":["../../src/test/testDashboard.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,QAAA,MAAM,aAAa,EAAE,iBA+MpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"testDashboard.d.ts","sourceRoot":"","sources":["../../src/test/testDashboard.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,QAAA,MAAM,aAAa,EAAE,iBAwLpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1 +1 @@
1
- const testDashboard={kind:"Dashboard",metadata:{name:"Node Stats",project:"perses",created_at:"2021-11-09",updated_at:"2021-11-09",version:0},spec:{datasource:{kind:"Prometheus",global:!0,name:"Public Prometheus Demo Server"},duration:"24h",variables:{job:{kind:"PrometheusLabelValues",options:{label_name:"job",match:["node_uname_info"]},display:{label:"Job"},selection:{default_value:"node"}},instance:{kind:"PrometheusLabelValues",options:{label_name:"instance",match:['node_uname_info{job="node"}']},display:{label:"Node"},selection:{default_value:["demo.do.prometheus.io:9100"],all_value:"$__all"}},interval:{kind:"Interval",options:{values:["1m","5m","10m","1h"],auto:{step_count:50,min_interval:"1m"}},display:{label:"Interval"},selection:{default_value:"1m"}}},panels:{cpu:{kind:"LineChart",display:{name:"CPU"},options:{queries:[{kind:"PrometheusGraphQuery",options:{query:'avg without (cpu)(rate(node_cpu_seconds_total{job="node",instance="$instance",mode!="idle"}[$interval]))'}}],unit:{kind:"%"}}},memory:{kind:"LineChart",display:{name:"Memory"},options:{queries:[{kind:"PrometheusGraphQuery",options:{query:'node_memory_MemTotal_bytes{job="node",instance="$instance"} - node_memory_MemFree_bytes{job="node",instance="$instance"} - node_memory_Buffers_bytes{job="node",instance="$instance"} - node_memory_Cached_bytes{job="node",instance="$instance"}'}},{kind:"PrometheusGraphQuery",options:{query:'node_memory_Buffers_bytes{job="node",instance="$instance"}'}},{kind:"PrometheusGraphQuery",options:{query:'node_memory_Cached_bytes{job="node",instance="$instance"}'}},{kind:"PrometheusGraphQuery",options:{query:'node_memory_MemFree_bytes{job="node",instance="$instance"}'}}],unit:{kind:"Bytes"}}},diskIO:{kind:"LineChart",display:{name:"Disk I/O Utilization"},options:{queries:[{kind:"PrometheusGraphQuery",options:{query:'rate(node_disk_io_time_seconds_total{job="node",instance="$instance",device!~"^(md\\\\d+$|dm-)"}[$interval])'}}],unit:{kind:"Percent"}}},filesystemFullness:{kind:"LineChart",display:{name:"Filesystem Fullness"},options:{queries:[{kind:"PrometheusGraphQuery",options:{query:'1 - node_filesystem_free_bytes{job="node",instance="$instance",fstype!="rootfs",mountpoint!~"/(run|var).*",mountpoint!=""} / node_filesystem_size_bytes{job="node",instance="$instance"}'}}],unit:{kind:"Percent"}}}},layouts:[{kind:"Grid",spec:{display:{title:"CPU Stats"},items:[{x:0,y:0,width:12,height:4,content:{$ref:"#/spec/panels/cpu"}}]}},{kind:"Grid",spec:{items:[{x:8,y:0,width:8,height:3,content:{$ref:"#/spec/panels/memory"}}]}},{kind:"Grid",spec:{display:{title:"Disk Stats",collapse:{open:!1}},items:[{x:0,y:0,width:6,height:2,content:{$ref:"#/spec/panels/diskIO"}},{x:18,y:0,width:6,height:2,content:{$ref:"#/spec/panels/filesystemFullness"}}]}}]}};export default testDashboard;
1
+ const testDashboard={kind:"Dashboard",metadata:{name:"Node Stats",project:"perses",created_at:"2021-11-09",updated_at:"2021-11-09",version:0},spec:{datasource:{kind:"Prometheus",global:!0,name:"Public Prometheus Demo Server"},duration:"24h",variables:[{name:"job",kind:"TextVariable",options:{value:"node"}},{name:"instance",kind:"TextVariable",options:{value:"demo.do.prometheus.io:9100"}},{name:"interval",kind:"TextVariable",options:{value:"1m"}}],panels:{cpu:{kind:"LineChart",display:{name:"CPU"},options:{queries:[{kind:"PrometheusGraphQuery",options:{query:'avg without (cpu)(rate(node_cpu_seconds_total{job="node",instance="$instance",mode!="idle"}[$interval]))'}}],unit:{kind:"%"}}},memory:{kind:"LineChart",display:{name:"Memory"},options:{queries:[{kind:"PrometheusGraphQuery",options:{query:'node_memory_MemTotal_bytes{job="node",instance="$instance"} - node_memory_MemFree_bytes{job="node",instance="$instance"} - node_memory_Buffers_bytes{job="node",instance="$instance"} - node_memory_Cached_bytes{job="node",instance="$instance"}'}},{kind:"PrometheusGraphQuery",options:{query:'node_memory_Buffers_bytes{job="node",instance="$instance"}'}},{kind:"PrometheusGraphQuery",options:{query:'node_memory_Cached_bytes{job="node",instance="$instance"}'}},{kind:"PrometheusGraphQuery",options:{query:'node_memory_MemFree_bytes{job="node",instance="$instance"}'}}],unit:{kind:"Bytes"}}},diskIO:{kind:"LineChart",display:{name:"Disk I/O Utilization"},options:{queries:[{kind:"PrometheusGraphQuery",options:{query:'rate(node_disk_io_time_seconds_total{job="node",instance="$instance",device!~"^(md\\\\d+$|dm-)"}[$interval])'}}],unit:{kind:"Percent"}}},filesystemFullness:{kind:"LineChart",display:{name:"Filesystem Fullness"},options:{queries:[{kind:"PrometheusGraphQuery",options:{query:'1 - node_filesystem_free_bytes{job="node",instance="$instance",fstype!="rootfs",mountpoint!~"/(run|var).*",mountpoint!=""} / node_filesystem_size_bytes{job="node",instance="$instance"}'}}],unit:{kind:"Percent"}}}},layouts:[{kind:"Grid",spec:{display:{title:"CPU Stats"},items:[{x:0,y:0,width:12,height:4,content:{$ref:"#/spec/panels/cpu"}}]}},{kind:"Grid",spec:{items:[{x:8,y:0,width:8,height:3,content:{$ref:"#/spec/panels/memory"}}]}},{kind:"Grid",spec:{display:{title:"Disk Stats",collapse:{open:!1}},items:[{x:0,y:0,width:6,height:2,content:{$ref:"#/spec/panels/diskIO"}},{x:18,y:0,width:6,height:2,content:{$ref:"#/spec/panels/filesystemFullness"}}]}}]}};export default testDashboard;
@@ -1 +1 @@
1
- import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{Box}from"@mui/material";import{combineSx}from"@perses-dev/components";import{useState}from"react";import{VariableList,Dashboard}from"../components";import AddPanel from"../components/AddPanel/AddPanel";import{DashboardToolbar}from"../components/DashboardToolbar";import{useDashboard}from"../context";export const DashboardApp=o=>{const{dashboardResource:a,sx:s,children:e,...r}=o,[d,i]=useState(!1),{dashboard:n}=useDashboard();return _jsx(Box,{sx:combineSx({display:"flex",width:"100%",height:"100%",position:"relative",overflow:"hidden"},s),...r,children:_jsxs(Box,{sx:{padding:o=>o.spacing(1,2),flexGrow:1,overflowX:"hidden",overflowY:"auto",display:"flex",flexDirection:"column"},children:[_jsx(DashboardToolbar,{dashboardName:a.metadata.name,onAddPanel:()=>i(!0)}),_jsx(VariableList,{variables:a.spec.variables,sx:{margin:o=>o.spacing(1,0,2)}}),_jsx(Dashboard,{spec:n}),_jsx(AddPanel,{isOpen:d,onClose:()=>i(!1)}),e]})})};
1
+ import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{Box}from"@mui/material";import{combineSx}from"@perses-dev/components";import{TemplateVariableList,Dashboard}from"../components";import PanelGroupDialog from"../components/PanelGroupDialog/PanelGroupDialog";import PanelDrawer from"../components/PanelDrawer/PanelDrawer";import{DashboardToolbar}from"../components/DashboardToolbar";import{useDashboard,useDashboardApp}from"../context";export const DashboardApp=o=>{const{dashboardResource:a,sx:r,children:e,...s}=o,{dashboard:i}=useDashboard(),{panelGroupDialog:n}=useDashboardApp();return _jsx(Box,{sx:combineSx({display:"flex",width:"100%",height:"100%",position:"relative",overflow:"hidden"},r),...s,children:_jsxs(Box,{sx:{padding:o=>o.spacing(1,2),flexGrow:1,overflowX:"hidden",overflowY:"auto",display:"flex",flexDirection:"column"},children:[_jsx(DashboardToolbar,{dashboardName:a.metadata.name}),_jsx(TemplateVariableList,{}),_jsx(Dashboard,{spec:i}),_jsx(PanelDrawer,{}),n&&_jsx(PanelGroupDialog,{}),e]})})};
@@ -1 +1 @@
1
- {"version":3,"file":"ViewDashboard.d.ts","sourceRoot":"","sources":["../../src/views/ViewDashboard.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAKrD,MAAM,WAAW,kBAAmB,SAAQ,QAAQ;IAClD,iBAAiB,EAAE,iBAAiB,CAAC;CACtC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,eAgBtD"}
1
+ {"version":3,"file":"ViewDashboard.d.ts","sourceRoot":"","sources":["../../src/views/ViewDashboard.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAuB,MAAM,kBAAkB,CAAC;AAK1E,MAAM,WAAW,kBAAmB,SAAQ,QAAQ;IAClD,iBAAiB,EAAE,iBAAiB,CAAC;CACtC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,eA8BtD"}
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{TimeRangeStateProvider,TemplateVariablesProvider,DashboardProvider}from"../context";import{DashboardApp}from"./DashboardApp";export function ViewDashboard(r){const{dashboardResource:{spec:a},children:e}=r,i=a.duration;return _jsx(DashboardProvider,{initialState:{dashboardSpec:a},children:_jsx(TimeRangeStateProvider,{initialValue:{pastDuration:i},children:_jsx(TemplateVariablesProvider,{variableDefinitions:a.variables,children:_jsx(DashboardApp,{...r,children:e})})})})}
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useEffect}from"react";import{getDefaultTimeRange}from"@perses-dev/core";import{useQueryString}from"@perses-dev/plugin-system";import{TimeRangeProvider,TemplateVariableProvider,DashboardProvider}from"../context";import{DashboardApp}from"./DashboardApp";export function ViewDashboard(e){var r;const{dashboardResource:{spec:i},children:a}=e,{queryString:t,setQueryString:o}=useQueryString(),s=null!==(r=i.duration)&&void 0!==r?r:"1h",n=getDefaultTimeRange(s,t);return useEffect((()=>{!Object.fromEntries([...t]).start&&o&&(t.set("start",s),o(t))}),[s,t,o]),_jsx(DashboardProvider,{initialState:{dashboardSpec:i},children:_jsx(TimeRangeProvider,{initialTimeRange:n,children:_jsx(TemplateVariableProvider,{initialVariableDefinitions:i.variables,children:_jsx(DashboardApp,{...e,children:a})})})})}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/dashboards",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "The dashboards feature in Perses",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/perses/perses/blob/main/README.md",
@@ -24,26 +24,24 @@
24
24
  "lint:fix": "eslint --fix src --ext .ts,.tsx"
25
25
  },
26
26
  "dependencies": {
27
- "@perses-dev/components": "^0.7.0",
28
- "@perses-dev/core": "^0.7.0",
29
- "@perses-dev/plugin-system": "^0.7.0",
27
+ "@perses-dev/components": "^0.8.0",
28
+ "@perses-dev/core": "^0.8.0",
29
+ "@perses-dev/plugin-system": "^0.8.0",
30
30
  "@types/react-grid-layout": "^1.3.2",
31
31
  "immer": "^9.0.15",
32
32
  "react-grid-layout": "^1.3.4",
33
33
  "react-intersection-observer": "^9.4.0",
34
34
  "use-immer": "^0.7.0",
35
- "use-resize-observer": "^8.0.0",
35
+ "use-resize-observer": "^9.0.0",
36
36
  "zustand": "^4.1.1"
37
37
  },
38
38
  "devDependencies": {
39
- "intersection-observer": "^0.12.2",
40
- "react": "^17.0.2",
41
- "react-dom": "^17.0.2"
39
+ "intersection-observer": "^0.12.2"
42
40
  },
43
41
  "peerDependencies": {
44
- "@mui/material": "^5.5.1",
45
- "react": "^17.0.2",
46
- "react-dom": "^17.0.2"
42
+ "@mui/material": "^5.6.0",
43
+ "react": "^17.0.2 || ^18.0.0",
44
+ "react-dom": "^17.0.2 || ^18.0.0"
47
45
  },
48
46
  "files": [
49
47
  "dist"