@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
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { DashboardSpec } from '@perses-dev/core';
|
|
3
|
-
export interface TemplateVariablesProviderProps {
|
|
4
|
-
children?: React.ReactNode;
|
|
5
|
-
variableDefinitions: DashboardSpec['variables'];
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Provider implementation that supplies the TemplateVariables at runtime.
|
|
9
|
-
*/
|
|
10
|
-
export declare function TemplateVariablesProvider(props: TemplateVariablesProviderProps): JSX.Element;
|
|
11
|
-
/**
|
|
12
|
-
* Setters for manipulating Template Variable state.
|
|
13
|
-
*/
|
|
14
|
-
export interface TemplateVariablesSetters {
|
|
15
|
-
setValue: (name: string, value: string | string[]) => void;
|
|
16
|
-
setOptions: (name: string, options: string[]) => void;
|
|
17
|
-
}
|
|
18
|
-
export declare const TemplateVariablesSettersContext: import("react").Context<TemplateVariablesSetters | undefined>;
|
|
19
|
-
/**
|
|
20
|
-
* Gets the setters for Template Variables provided by the TemplateVariablesProvider at runtime.
|
|
21
|
-
*/
|
|
22
|
-
export declare function useTemplateVariablesSetters(): TemplateVariablesSetters;
|
|
23
|
-
//# sourceMappingURL=TemplateVariablesProvider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateVariablesProvider.d.ts","sourceRoot":"","sources":["../../src/context/TemplateVariablesProvider.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,mBAAmB,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;CACjD;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,8BAA8B,eAiI9E;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;IAC3D,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CACvD;AAED,eAAO,MAAM,+BAA+B,+DAAiE,CAAC;AAE9G;;GAEG;AACH,wBAAgB,2BAA2B,6BAM1C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useMemo,useCallback,createContext,useContext}from"react";import{useImmer}from"use-immer";import{TemplateVariablesContext}from"@perses-dev/plugin-system";export function TemplateVariablesProvider(e){const{children:t,variableDefinitions:o}=e,[r,n]=useImmer((()=>{const e={};return Object.entries(o).forEach((([t,o])=>{e[t]={value:o.selection.default_value,options:void 0}})),e})),i=useCallback(((e,t)=>{const r=o[e];if(void 0===r)throw new Error(`Unknown variable '${e}'`);const i=r.selection.default_value,s="all_value"in r.selection?r.selection.all_value:void 0;if("object"==typeof i){if("object"!=typeof t)throw new Error(`Invalid value '${t}' for multi-select`);0===t.length&&(t=i)}else if("string"!=typeof t)throw new Error(`Invalid value '${t}' for single-select`);n((o=>{const r=o[e];if(void 0===r)throw new Error(`Unknown variable '${e}'`);if(void 0!==s&&"object"==typeof t&&t.length>1&&t.includes(s)){const e=r.value;if("object"==typeof e){const o=e.includes(s);t=o?t.filter((e=>e!==s)):[s]}}r.value=t}))}),[n,o]),s=useCallback(((e,t)=>{const r=o[e];if(void 0===r)throw new Error(`Unknown variable '${e}'`);let i;if(void 0!==r.capturing_regexp){let e=r.capturing_regexp,t="";if(e.startsWith("/")){const o=e.lastIndexOf("/");o>0&&(t=e.substring(o+1),e=e.substring(1,o))}i=new RegExp(e,t)}const s=new Set;t.forEach((e=>{if(void 0!==i){const t=i.exec(e);null!==t&&void 0!==t[0]&&(e=t[0])}s.add(e)})),n((t=>{const o=t[e];if(void 0===o)throw new Error(`Unknown variable '${e}'`);o.options=Array.from(s)}))}),[n,o]),a=useMemo((()=>({variables:r})),[r]),l=useMemo((()=>({setValue:i,setOptions:s})),[i,s]);return _jsx(TemplateVariablesSettersContext.Provider,{value:l,children:_jsx(TemplateVariablesContext.Provider,{value:a,children:t})})}export const TemplateVariablesSettersContext=createContext(void 0);export function useTemplateVariablesSetters(){const e=useContext(TemplateVariablesSettersContext);if(void 0===e)throw new Error("No TemplateVariablesSettersContext found. Did you forget a Provider?");return e}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { TimeRangeValue, RelativeTimeRange } from '@perses-dev/core';
|
|
3
|
-
export interface TimeRangeProviderProps {
|
|
4
|
-
initialValue: RelativeTimeRange;
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Provider implementation that supplies the TimeRangeState at runtime.
|
|
9
|
-
*/
|
|
10
|
-
export declare function TimeRangeStateProvider(props: TimeRangeProviderProps): JSX.Element;
|
|
11
|
-
/**
|
|
12
|
-
* Setters for manipulating time range state.
|
|
13
|
-
*/
|
|
14
|
-
export interface TimeRangeSetter {
|
|
15
|
-
setTimeRange: (value: TimeRangeValue) => void;
|
|
16
|
-
}
|
|
17
|
-
export declare const TimeRangeSetterContext: import("react").Context<TimeRangeSetter | undefined>;
|
|
18
|
-
/**
|
|
19
|
-
* Gets the setters for time range selection provided by the TimeRangeStateProvider at runtime.
|
|
20
|
-
*/
|
|
21
|
-
export declare function useTimeRangeSetter(): TimeRangeSetter;
|
|
22
|
-
//# sourceMappingURL=TimeRangeStateProvider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TimeRangeStateProvider.d.ts","sourceRoot":"","sources":["../../src/context/TimeRangeStateProvider.tsx"],"names":[],"mappings":";AAcA,OAAO,EACL,cAAc,EAEd,iBAAiB,EAGlB,MAAM,kBAAkB,CAAC;AAG1B,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,iBAAiB,CAAC;IAChC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,sBAAsB,eAqBnE;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;CAC/C;AAED,eAAO,MAAM,sBAAsB,sDAAwD,CAAC;AAE5F;;GAEG;AACH,wBAAgB,kBAAkB,oBAMjC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useState,useMemo,createContext,useContext,useCallback}from"react";import{toAbsoluteTimeRange,isRelativeValue}from"@perses-dev/core";import{TimeRangeContext}from"@perses-dev/plugin-system";export function TimeRangeStateProvider(e){const{initialValue:t,children:o}=e,r=toAbsoluteTimeRange(t),[n,i]=useState(r),a=useCallback((e=>{isRelativeValue(e)||i(e)}),[]),s=useMemo((()=>({timeRange:n,defaultDuration:t.pastDuration})),[n,t]),u=useMemo((()=>({setTimeRange:a})),[a]);return _jsx(TimeRangeSetterContext.Provider,{value:u,children:_jsx(TimeRangeContext.Provider,{value:s,children:o})})}export const TimeRangeSetterContext=createContext(void 0);export function useTimeRangeSetter(){const e=useContext(TimeRangeSetterContext);if(void 0===e)throw new Error("No TimeRangeSetterContext found. Did you forget a Provider?");return e}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardApp.d.ts","sourceRoot":"","sources":["../../src/views/DashboardApp.tsx"],"names":[],"mappings":";AAoBA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,eAAO,MAAM,YAAY,UAAW,kBAAkB,gBAqCrD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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})})})})}
|