@perses-dev/dashboards 0.7.1 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/Dashboard.js +1 -1
- package/dist/cjs/components/DashboardToolbar.js +3 -18
- package/dist/cjs/components/GridLayout/GridItemContent.js +3 -3
- package/dist/cjs/components/GridLayout/GridLayout.js +4 -7
- package/dist/cjs/components/GridLayout/GridTitle.js +15 -9
- package/dist/cjs/components/Panel/Panel.js +11 -6
- package/dist/cjs/components/Panel/Panel.test.js +17 -13
- package/dist/cjs/components/Panel/PanelContent.js +15 -0
- package/dist/cjs/components/Panel/index.js +29 -0
- package/dist/cjs/components/PanelDrawer/PanelDrawer.js +124 -0
- package/dist/cjs/components/PanelDrawer/PanelDrawer.test.js +111 -0
- package/dist/cjs/components/PanelDrawer/PanelOptionsEditor.js +19 -0
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +60 -0
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.test.js +95 -0
- package/dist/cjs/components/{TimeRangeControls.js → TimeRangeControls/TimeRangeControls.js} +20 -31
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.test.js +51 -0
- package/dist/cjs/components/TimeRangeControls/index.js +29 -0
- package/dist/cjs/components/Variables/Variable.js +57 -0
- package/dist/cjs/components/Variables/VariableList.js +27 -0
- package/dist/cjs/components/{VariableList → Variables}/index.js +1 -0
- package/dist/cjs/components/index.js +2 -3
- package/dist/cjs/context/DashboardAppSlice.js +45 -0
- package/dist/cjs/context/DashboardProvider.js +54 -36
- package/dist/cjs/context/LayoutsSlice.js +42 -0
- package/dist/cjs/context/QueryStringProvider.js +35 -0
- package/dist/cjs/context/TemplateVariableProvider.js +216 -0
- package/dist/cjs/context/TimeRangeProvider.js +66 -0
- package/dist/cjs/context/index.js +6 -3
- package/dist/cjs/css/styles.js +173 -169
- package/dist/cjs/test/plugin-registry.js +24 -17
- package/dist/cjs/test/render.js +11 -2
- package/dist/cjs/test/testDashboard.js +14 -37
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +40 -0
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +52 -0
- package/dist/cjs/views/ViewDashboard/index.js +29 -0
- package/dist/cjs/views/index.js +1 -1
- package/dist/components/Dashboard.d.ts.map +1 -1
- package/dist/components/Dashboard.js +1 -1
- package/dist/components/DashboardToolbar.d.ts +0 -1
- package/dist/components/DashboardToolbar.d.ts.map +1 -1
- package/dist/components/DashboardToolbar.js +1 -1
- package/dist/components/GridLayout/GridItemContent.d.ts +1 -0
- package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
- package/dist/components/GridLayout/GridItemContent.js +1 -1
- package/dist/components/GridLayout/GridLayout.d.ts +2 -1
- package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
- package/dist/components/GridLayout/GridLayout.js +1 -1
- package/dist/components/GridLayout/GridTitle.d.ts +1 -0
- package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
- package/dist/components/GridLayout/GridTitle.js +1 -1
- package/dist/components/Panel/Panel.d.ts +2 -0
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/Panel.js +1 -1
- package/dist/components/Panel/Panel.test.d.ts.map +1 -1
- package/dist/components/Panel/Panel.test.js +1 -1
- package/dist/components/Panel/PanelContent.d.ts +11 -0
- package/dist/components/Panel/PanelContent.d.ts.map +1 -0
- package/dist/components/Panel/PanelContent.js +1 -0
- package/dist/components/Panel/index.d.ts +2 -0
- package/dist/components/Panel/index.d.ts.map +1 -0
- package/dist/components/Panel/index.js +1 -0
- package/dist/components/PanelDrawer/PanelDrawer.d.ts +4 -0
- package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -0
- package/dist/components/PanelDrawer/PanelDrawer.js +1 -0
- package/dist/components/PanelDrawer/PanelDrawer.test.d.ts +2 -0
- package/dist/components/PanelDrawer/PanelDrawer.test.d.ts.map +1 -0
- package/dist/components/PanelDrawer/PanelDrawer.test.js +1 -0
- package/dist/components/PanelDrawer/PanelOptionsEditor.d.ts +9 -0
- package/dist/components/PanelDrawer/PanelOptionsEditor.d.ts.map +1 -0
- package/dist/components/PanelDrawer/PanelOptionsEditor.js +1 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts +4 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js +1 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.d.ts +2 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.d.ts.map +1 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js +1 -0
- package/dist/components/{TimeRangeControls.d.ts → TimeRangeControls/TimeRangeControls.d.ts} +0 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.js +1 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.test.d.ts +2 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.test.d.ts.map +1 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.test.js +1 -0
- package/dist/components/TimeRangeControls/index.d.ts +2 -0
- package/dist/components/TimeRangeControls/index.d.ts.map +1 -0
- package/dist/components/TimeRangeControls/index.js +1 -0
- package/dist/components/Variables/Variable.d.ts +8 -0
- package/dist/components/Variables/Variable.d.ts.map +1 -0
- package/dist/components/Variables/Variable.js +1 -0
- package/dist/components/Variables/VariableList.d.ts +3 -0
- package/dist/components/Variables/VariableList.d.ts.map +1 -0
- package/dist/components/Variables/VariableList.js +1 -0
- package/dist/components/Variables/index.d.ts +3 -0
- package/dist/components/Variables/index.d.ts.map +1 -0
- package/dist/components/Variables/index.js +1 -0
- package/dist/components/index.d.ts +2 -3
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/context/DashboardAppSlice.d.ts +26 -0
- package/dist/context/DashboardAppSlice.d.ts.map +1 -0
- package/dist/context/DashboardAppSlice.js +1 -0
- package/dist/context/DashboardProvider.d.ts +8 -19
- package/dist/context/DashboardProvider.d.ts.map +1 -1
- package/dist/context/DashboardProvider.js +1 -1
- package/dist/context/LayoutsSlice.d.ts +12 -0
- package/dist/context/LayoutsSlice.d.ts.map +1 -0
- package/dist/context/LayoutsSlice.js +1 -0
- package/dist/context/QueryStringProvider.d.ts +13 -0
- package/dist/context/QueryStringProvider.d.ts.map +1 -0
- package/dist/context/QueryStringProvider.js +1 -0
- package/dist/context/TemplateVariableProvider.d.ts +25 -0
- package/dist/context/TemplateVariableProvider.d.ts.map +1 -0
- package/dist/context/TemplateVariableProvider.js +1 -0
- package/dist/context/TimeRangeProvider.d.ts +12 -0
- package/dist/context/TimeRangeProvider.d.ts.map +1 -0
- package/dist/context/TimeRangeProvider.js +1 -0
- package/dist/context/index.d.ts +5 -2
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +1 -1
- package/dist/css/styles.d.ts +7 -7
- package/dist/css/styles.d.ts.map +1 -1
- package/dist/css/styles.js +1 -1
- package/dist/test/plugin-registry.d.ts +4 -2
- package/dist/test/plugin-registry.d.ts.map +1 -1
- package/dist/test/plugin-registry.js +1 -1
- package/dist/test/render.d.ts +2 -1
- package/dist/test/render.d.ts.map +1 -1
- package/dist/test/render.js +1 -1
- package/dist/test/testDashboard.d.ts.map +1 -1
- package/dist/test/testDashboard.js +1 -1
- package/dist/views/ViewDashboard/DashboardApp.d.ts +7 -0
- package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -0
- package/dist/views/ViewDashboard/DashboardApp.js +1 -0
- package/dist/views/{ViewDashboard.d.ts → ViewDashboard/ViewDashboard.d.ts} +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -0
- package/dist/views/ViewDashboard/ViewDashboard.js +1 -0
- package/dist/views/ViewDashboard/index.d.ts +2 -0
- package/dist/views/ViewDashboard/index.d.ts.map +1 -0
- package/dist/views/ViewDashboard/index.js +1 -0
- package/package.json +9 -11
- package/dist/cjs/components/AddPanel/AddPanel.js +0 -75
- package/dist/cjs/components/VariableAutocomplete.js +0 -63
- package/dist/cjs/components/VariableList/VariableList.js +0 -42
- package/dist/cjs/components/VariableList/VariableList.test.js +0 -86
- package/dist/cjs/context/TemplateVariablesProvider.js +0 -142
- package/dist/cjs/context/TimeRangeStateProvider.js +0 -49
- package/dist/cjs/views/DashboardApp.js +0 -46
- package/dist/cjs/views/ViewDashboard.js +0 -15
- package/dist/components/AddPanel/AddPanel.d.ts +0 -8
- package/dist/components/AddPanel/AddPanel.d.ts.map +0 -1
- package/dist/components/AddPanel/AddPanel.js +0 -1
- package/dist/components/TimeRangeControls.d.ts.map +0 -1
- package/dist/components/TimeRangeControls.js +0 -1
- package/dist/components/VariableAutocomplete.d.ts +0 -21
- package/dist/components/VariableAutocomplete.d.ts.map +0 -1
- package/dist/components/VariableAutocomplete.js +0 -1
- package/dist/components/VariableList/VariableList.d.ts +0 -11
- package/dist/components/VariableList/VariableList.d.ts.map +0 -1
- package/dist/components/VariableList/VariableList.js +0 -1
- package/dist/components/VariableList/VariableList.test.d.ts +0 -2
- package/dist/components/VariableList/VariableList.test.d.ts.map +0 -1
- package/dist/components/VariableList/VariableList.test.js +0 -1
- package/dist/components/VariableList/index.d.ts +0 -2
- package/dist/components/VariableList/index.d.ts.map +0 -1
- package/dist/components/VariableList/index.js +0 -1
- package/dist/context/TemplateVariablesProvider.d.ts +0 -23
- package/dist/context/TemplateVariablesProvider.d.ts.map +0 -1
- package/dist/context/TemplateVariablesProvider.js +0 -1
- package/dist/context/TimeRangeStateProvider.d.ts +0 -22
- package/dist/context/TimeRangeStateProvider.d.ts.map +0 -1
- package/dist/context/TimeRangeStateProvider.js +0 -1
- package/dist/views/DashboardApp.d.ts +0 -4
- package/dist/views/DashboardApp.d.ts.map +0 -1
- package/dist/views/DashboardApp.js +0 -1
- package/dist/views/ViewDashboard.d.ts.map +0 -1
- package/dist/views/ViewDashboard.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import userEvent from"@testing-library/user-event";import{getDefaultTimeRange}from"@perses-dev/core";import{screen}from"@testing-library/react";import{renderWithContext}from"../../test";import testDashboard from"../../test/testDashboard";import{DashboardProvider,TimeRangeProvider,QueryStringProvider}from"../../context";import{TimeRangeControls}from"./TimeRangeControls";describe("TimeRangeControls",(()=>{let e;beforeEach((()=>{e={dashboardSpec:testDashboard.spec}}));const t=()=>{const t=new URLSearchParams,r=getDefaultTimeRange(e.dashboardSpec.duration,t);renderWithContext(_jsx(QueryStringProvider,{queryString:t,children:_jsx(DashboardProvider,{initialState:e,children:_jsx(TimeRangeProvider,{initialTimeRange:r,children:_jsx(TimeRangeControls,{})})})}))};it("should render correct initial relative time shortcut",(async()=>{t(),expect(screen.getByText("Last 1 day")).toBeInTheDocument()})),it("should be able to select the first option",(()=>{t();const e=screen.getByRole("button");userEvent.click(e);const r=screen.getByRole("option",{name:"Last 5 minutes"});userEvent.click(r),expect(e).toHaveTextContent(/5 minutes/i)}))}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/TimeRangeControls/index.ts"],"names":[],"mappings":"AAaA,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./TimeRangeControls";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { VariableName } from '@perses-dev/core';
|
|
3
|
+
declare type TemplateVariableProps = {
|
|
4
|
+
name: VariableName;
|
|
5
|
+
};
|
|
6
|
+
export declare function TemplateVariable({ name }: TemplateVariableProps): JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=Variable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Variable.d.ts","sourceRoot":"","sources":["../../../src/components/Variables/Variable.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAE,YAAY,EAA0B,MAAM,kBAAkB,CAAC;AAGxE,aAAK,qBAAqB,GAAG;IAC3B,IAAI,EAAE,YAAY,CAAC;CACpB,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,EAAE,IAAI,EAAE,EAAE,qBAAqB,eAW/D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useEffect,useRef}from"react";import{Select,FormControl,InputLabel,MenuItem,Box,LinearProgress,IconButton,TextField}from"@mui/material";import{Reload}from"mdi-material-ui";import{useTemplateVariable,useTemplateVariableActions,useTemplateVariableStore}from"../../context";export function TemplateVariable({name:e}){var a;const l=null===(a=useTemplateVariable(e).definition)||void 0===a?void 0:a.kind;switch(l){case"TextVariable":return _jsx(TextVariable,{name:e});case"ListVariable":return _jsx(ListVariable,{name:e})}return _jsxs("div",{children:["Unsupported Variable Kind: $",l]})}function ListVariable({name:e}){var a,l,t,i;const r=useTemplateVariable(e),n=r.definition,{setVariableValue:o,loadTemplateVariable:s}=useTemplateVariableActions(),u=!0===(null==n?void 0:n.options.allowMultiple);useEffect((()=>{s(e)}),[e,s]);let d=null===(a=r.state)||void 0===a?void 0:a.value;return u&&!Array.isArray(d)&&(d=[]),_jsxs(Box,{display:"flex",children:[_jsxs(FormControl,{children:[_jsx(InputLabel,{id:e,children:e}),_jsx(Select,{id:e,label:e,value:d,onChange:a=>{o(e,a.target.value)},multiple:u,children:null===(t=null===(l=r.state)||void 0===l?void 0:l.options)||void 0===t?void 0:t.map((e=>_jsx(MenuItem,{value:e.value,children:e.label},e.value)))}),(null===(i=r.state)||void 0===i?void 0:i.loading)&&_jsx(LinearProgress,{})]}),_jsx(IconButton,{onClick:()=>s(e),children:_jsx(Reload,{})})]})}function TextVariable({name:e}){const{state:a}=useTemplateVariable(e),l=useTemplateVariableStore().setVariableValue,t=useRef(null);return _jsx(TextField,{ref:t,defaultValue:null==a?void 0:a.value,onBlur:a=>l(e,a.target.value),placeholder:e,label:e})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VariableList.d.ts","sourceRoot":"","sources":["../../../src/components/Variables/VariableList.tsx"],"names":[],"mappings":";AA8BA,wBAAgB,oBAAoB,gBA2CnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useState}from"react";import{Button,Stack,Box,Drawer,TableContainer,TableBody,TableRow,TableCell,Table,Paper,TableHead}from"@mui/material";import{useTemplateVariableDefinitions,useEditMode}from"../../context";import{TemplateVariable}from"./Variable";export function TemplateVariableList(){const[e,a]=useState(!1),l=useTemplateVariableDefinitions(),{isEditMode:i}=useEditMode();return _jsxs(Box,{m:2,children:[_jsx(Drawer,{anchor:"right",open:e,onClose:()=>a(!1),children:_jsxs(Box,{width:900,p:4,children:[_jsx(TableContainer,{component:Paper,children:_jsxs(Table,{sx:{minWidth:650},"aria-label":"simple table",children:[_jsx(TableHead,{children:_jsxs(TableRow,{children:[_jsx(TableCell,{children:"Variable Name"}),_jsx(TableCell,{align:"right",children:"Type"})]})}),_jsx(TableBody,{children:l.map((e=>_jsxs(TableRow,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[_jsx(TableCell,{component:"th",scope:"row",sx:{fontWeight:"bold"},children:e.name}),_jsx(TableCell,{align:"right",children:e.kind})]},e.name)))})]})}),_jsx("pre",{children:JSON.stringify(l,null,2)})]})}),_jsx(Box,{display:"flex",justifyContent:"space-between",children:_jsxs(Stack,{direction:"row",spacing:2,children:[l.map((e=>_jsx(Box,{children:_jsx(TemplateVariable,{name:e.name},e.name)},e.name))),i&&_jsx(Button,{onClick:()=>a(!0),children:"Modify Variables"})]})})]})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Variables/index.tsx"],"names":[],"mappings":"AAaA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./Variable";export*from"./VariableList";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * from './Dashboard';
|
|
2
2
|
export * from './GridLayout';
|
|
3
|
-
export * from './Panel
|
|
3
|
+
export * from './Panel';
|
|
4
4
|
export * from './TimeRangeControls';
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './VariableList';
|
|
5
|
+
export * from './Variables';
|
|
7
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./Dashboard";export*from"./GridLayout";export*from"./Panel
|
|
1
|
+
export*from"./Dashboard";export*from"./GridLayout";export*from"./Panel";export*from"./TimeRangeControls";export*from"./Variables";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
interface PanelDrawer {
|
|
2
|
+
groupIndex?: number;
|
|
3
|
+
panelKey?: string;
|
|
4
|
+
}
|
|
5
|
+
interface PanelGroupDialog {
|
|
6
|
+
groupIndex?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface DashboardAppSlice {
|
|
9
|
+
panelDrawer?: PanelDrawer;
|
|
10
|
+
openPanelDrawer: (panelDrawer: PanelDrawer) => void;
|
|
11
|
+
closePanelDrawer: () => void;
|
|
12
|
+
panelGroupDialog?: PanelGroupDialog;
|
|
13
|
+
openPanelGroupDialog: (groupIndex?: number) => void;
|
|
14
|
+
closePanelGroupDialog: () => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const createDashboardAppSlice: import("zustand").StateCreator<DashboardAppSlice, [], [["zustand/immer", never]], DashboardAppSlice>;
|
|
17
|
+
export declare function useDashboardApp(): {
|
|
18
|
+
panelDrawer: PanelDrawer | undefined;
|
|
19
|
+
openPanelDrawer: (panelDrawer: PanelDrawer) => void;
|
|
20
|
+
closePanelDrawer: () => void;
|
|
21
|
+
panelGroupDialog: PanelGroupDialog | undefined;
|
|
22
|
+
openPanelGroupDialog: (groupIndex?: number | undefined) => void;
|
|
23
|
+
closePanelGroupDialog: () => void;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=DashboardAppSlice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardAppSlice.d.ts","sourceRoot":"","sources":["../../src/context/DashboardAppSlice.tsx"],"names":[],"mappings":"AAgBA,UAAU,WAAW;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AACD,UAAU,gBAAgB;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,eAAe,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,IAAI,CAAC;IACpD,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,oBAAoB,EAAE,CAAC,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACpD,qBAAqB,EAAE,MAAM,IAAI,CAAC;CACnC;AAED,eAAO,MAAM,uBAAuB,sGAoBjC,CAAC;AAEJ,wBAAgB,eAAe;;;;;;;EAkB9B"}
|
|
@@ -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,
|
|
3
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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":";
|
|
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
|
|
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})}
|
package/dist/context/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
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,
|
|
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"}
|
package/dist/context/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./
|
|
1
|
+
export*from"./DashboardAppSlice";export*from"./LayoutsSlice";export*from"./TemplateVariableProvider";export*from"./DashboardProvider";export*from"./TimeRangeProvider";export*from"./QueryStringProvider";
|
package/dist/css/styles.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
|
+
export declare const styles: (theme: Theme) => {
|
|
2
3
|
readonly '&.react-grid-layout': {
|
|
3
4
|
readonly position: "relative";
|
|
4
5
|
readonly transition: "height 200ms ease";
|
|
@@ -27,15 +28,15 @@ declare const _default: {
|
|
|
27
28
|
readonly visibility: "hidden";
|
|
28
29
|
};
|
|
29
30
|
readonly '&.react-grid-item.react-grid-placeholder': {
|
|
30
|
-
readonly background:
|
|
31
|
+
readonly background: string;
|
|
31
32
|
readonly opacity: 0.2;
|
|
32
33
|
readonly transitionDuration: "100ms";
|
|
33
34
|
readonly zIndex: 2;
|
|
34
35
|
readonly userSelect: "none";
|
|
35
|
-
readonly
|
|
36
|
-
readonly
|
|
37
|
-
readonly
|
|
38
|
-
readonly
|
|
36
|
+
readonly WebkitUserSelect: "none";
|
|
37
|
+
readonly MozUserSelect: "none";
|
|
38
|
+
readonly msUserSelect: "none";
|
|
39
|
+
readonly OUserSelect: "none";
|
|
39
40
|
};
|
|
40
41
|
readonly '&.react-grid-item > .react-resizable-handle': {
|
|
41
42
|
readonly position: "absolute";
|
|
@@ -168,5 +169,4 @@ declare const _default: {
|
|
|
168
169
|
readonly transform: "rotate(45deg)";
|
|
169
170
|
};
|
|
170
171
|
};
|
|
171
|
-
export default _default;
|
|
172
172
|
//# sourceMappingURL=styles.d.ts.map
|
package/dist/css/styles.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/css/styles.tsx"],"names":[],"mappings":"
|
|
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"}
|
package/dist/css/styles.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
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 {
|
|
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:
|
|
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.
|
|
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:"
|
|
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:()=>({})};
|
package/dist/test/render.d.ts
CHANGED
|
@@ -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;
|
|
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"}
|
package/dist/test/render.js
CHANGED
|
@@ -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,
|
|
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,
|
|
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:{
|
|
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;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DashboardResource } from '@perses-dev/core';
|
|
3
|
+
export interface DashboardAppProps {
|
|
4
|
+
dashboardResource: DashboardResource;
|
|
5
|
+
}
|
|
6
|
+
export declare const DashboardApp: (props: DashboardAppProps) => JSX.Element;
|
|
7
|
+
//# sourceMappingURL=DashboardApp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardApp.d.ts","sourceRoot":"","sources":["../../../src/views/ViewDashboard/DashboardApp.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAOrD,MAAM,WAAW,iBAAiB;IAChC,iBAAiB,EAAE,iBAAiB,CAAC;CACtC;AAED,eAAO,MAAM,YAAY,UAAW,iBAAiB,gBA0BpD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{Box}from"@mui/material";import{ErrorAlert,ErrorBoundary}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=r=>{const{dashboardResource:o}=r,{dashboard:a}=useDashboard(),{panelGroupDialog:e}=useDashboardApp();return _jsxs(Box,{sx:{padding:r=>r.spacing(1,2),flexGrow:1,overflowX:"hidden",overflowY:"auto",display:"flex",flexDirection:"column"},children:[_jsx(DashboardToolbar,{dashboardName:o.metadata.name}),_jsx(ErrorBoundary,{FallbackComponent:ErrorAlert,children:_jsx(TemplateVariableList,{})}),_jsx(ErrorBoundary,{FallbackComponent:ErrorAlert,children:_jsx(Dashboard,{spec:a})}),_jsx(PanelDrawer,{}),e&&_jsx(PanelGroupDialog,{})]})};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BoxProps } from '@mui/material';
|
|
3
3
|
import { DashboardResource } from '@perses-dev/core';
|
|
4
|
-
export interface ViewDashboardProps extends BoxProps {
|
|
4
|
+
export interface ViewDashboardProps extends Omit<BoxProps, 'children'> {
|
|
5
5
|
dashboardResource: DashboardResource;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ViewDashboard.d.ts","sourceRoot":"","sources":["../../../src/views/ViewDashboard/ViewDashboard.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAO,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAuB,MAAM,kBAAkB,CAAC;AAM1E,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC;IACpE,iBAAiB,EAAE,iBAAiB,CAAC;CACtC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,eA4CtD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useEffect}from"react";import{Box}from"@mui/material";import{getDefaultTimeRange}from"@perses-dev/core";import{useQueryString}from"@perses-dev/plugin-system";import{ErrorBoundary,ErrorAlert,combineSx}from"@perses-dev/components";import{TimeRangeProvider,TemplateVariableProvider,DashboardProvider}from"../../context";import{DashboardApp}from"./DashboardApp";export function ViewDashboard(r){var e;const{dashboardResource:i,sx:o,...a}=r,{spec:t}=i,{queryString:s,setQueryString:n}=useQueryString(),d=null!==(e=t.duration)&&void 0!==e?e:"1h",m=getDefaultTimeRange(d,s);return useEffect((()=>{!Object.fromEntries([...s]).start&&n&&(s.set("start",d),n(s))}),[d,s,n]),_jsx(DashboardProvider,{initialState:{dashboardSpec:t},children:_jsx(TimeRangeProvider,{initialTimeRange:m,children:_jsx(TemplateVariableProvider,{initialVariableDefinitions:t.variables,children:_jsx(Box,{sx:combineSx({display:"flex",width:"100%",height:"100%",position:"relative",overflow:"hidden"},o),...a,children:_jsx(ErrorBoundary,{FallbackComponent:ErrorAlert,children:_jsx(DashboardApp,{dashboardResource:i})})})})})})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/ViewDashboard/index.ts"],"names":[],"mappings":"AAaA,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./ViewDashboard";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perses-dev/dashboards",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
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.
|
|
28
|
-
"@perses-dev/core": "^0.
|
|
29
|
-
"@perses-dev/plugin-system": "^0.
|
|
27
|
+
"@perses-dev/components": "^0.8.1",
|
|
28
|
+
"@perses-dev/core": "^0.8.1",
|
|
29
|
+
"@perses-dev/plugin-system": "^0.8.1",
|
|
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": "^
|
|
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.
|
|
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"
|