@perses-dev/dashboards 0.8.0 → 0.9.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 (196) hide show
  1. package/dist/cjs/components/Dashboard.js +29 -14
  2. package/dist/cjs/components/DashboardToolbar.js +148 -20
  3. package/dist/cjs/components/GridLayout/GridItemContent.js +24 -18
  4. package/dist/cjs/components/GridLayout/GridLayout.js +88 -26
  5. package/dist/cjs/components/GridLayout/GridTitle.js +69 -31
  6. package/dist/cjs/components/GridLayout/index.js +18 -19
  7. package/dist/cjs/components/Panel/Panel.js +145 -55
  8. package/dist/cjs/components/Panel/Panel.test.js +50 -41
  9. package/dist/cjs/components/Panel/PanelContent.js +40 -12
  10. package/dist/cjs/components/Panel/index.js +16 -17
  11. package/dist/cjs/components/PanelDrawer/PanelDrawer.js +82 -107
  12. package/dist/cjs/components/PanelDrawer/PanelDrawer.test.js +91 -92
  13. package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +152 -0
  14. package/dist/cjs/components/PanelDrawer/PanelSpecEditor.js +40 -0
  15. package/dist/cjs/components/PanelDrawer/PanelTypeSelect.js +38 -0
  16. package/dist/cjs/components/PanelDrawer/index.js +28 -0
  17. package/dist/cjs/components/PanelDrawer/panel-editor-model.js +140 -0
  18. package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +120 -31
  19. package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.test.js +90 -83
  20. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +120 -38
  21. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.test.js +42 -27
  22. package/dist/cjs/components/TimeRangeControls/index.js +16 -17
  23. package/dist/cjs/components/Variables/Variable.js +186 -35
  24. package/dist/cjs/components/Variables/VariableList.js +100 -13
  25. package/dist/cjs/components/Variables/index.js +17 -18
  26. package/dist/cjs/components/index.js +21 -21
  27. package/dist/cjs/context/DashboardAppSlice.js +43 -31
  28. package/dist/cjs/context/DashboardProvider.js +88 -58
  29. package/dist/cjs/context/DatasourceStoreProvider.js +68 -0
  30. package/dist/cjs/context/LayoutsSlice.js +40 -27
  31. package/dist/cjs/context/QueryStringProvider.js +69 -15
  32. package/dist/cjs/context/TemplateVariableProvider.js +128 -136
  33. package/dist/cjs/context/TimeRangeProvider.js +79 -30
  34. package/dist/cjs/context/index.js +22 -22
  35. package/dist/cjs/css/styles.js +43 -39
  36. package/dist/cjs/index.js +19 -20
  37. package/dist/cjs/test/dashboard-provider.js +51 -0
  38. package/dist/cjs/test/index.js +18 -18
  39. package/dist/cjs/test/plugin-registry.js +52 -25
  40. package/dist/cjs/test/render.js +25 -22
  41. package/dist/cjs/test/setup-tests.js +4 -2
  42. package/dist/cjs/test/testDashboard.js +193 -109
  43. package/dist/cjs/utils/functions.js +9 -5
  44. package/dist/cjs/views/ViewDashboard/DashboardApp.js +67 -0
  45. package/dist/cjs/views/ViewDashboard/ViewDashboard.js +83 -0
  46. package/dist/cjs/views/ViewDashboard/index.js +28 -0
  47. package/dist/cjs/views/index.js +16 -17
  48. package/dist/components/Dashboard.js +38 -1
  49. package/dist/components/Dashboard.js.map +1 -0
  50. package/dist/components/DashboardToolbar.d.ts.map +1 -1
  51. package/dist/components/DashboardToolbar.js +154 -1
  52. package/dist/components/DashboardToolbar.js.map +1 -0
  53. package/dist/components/GridLayout/GridItemContent.js +35 -1
  54. package/dist/components/GridLayout/GridItemContent.js.map +1 -0
  55. package/dist/components/GridLayout/GridLayout.js +99 -1
  56. package/dist/components/GridLayout/GridLayout.js.map +1 -0
  57. package/dist/components/GridLayout/GridTitle.js +77 -1
  58. package/dist/components/GridLayout/GridTitle.js.map +1 -0
  59. package/dist/components/GridLayout/index.js +16 -1
  60. package/dist/components/GridLayout/index.js.map +1 -0
  61. package/dist/components/Panel/Panel.d.ts.map +1 -1
  62. package/dist/components/Panel/Panel.js +170 -1
  63. package/dist/components/Panel/Panel.js.map +1 -0
  64. package/dist/components/Panel/Panel.test.js +71 -1
  65. package/dist/components/Panel/Panel.test.js.map +1 -0
  66. package/dist/components/Panel/PanelContent.d.ts +2 -4
  67. package/dist/components/Panel/PanelContent.d.ts.map +1 -1
  68. package/dist/components/Panel/PanelContent.js +40 -1
  69. package/dist/components/Panel/PanelContent.js.map +1 -0
  70. package/dist/components/Panel/index.js +15 -1
  71. package/dist/components/Panel/index.js.map +1 -0
  72. package/dist/components/PanelDrawer/PanelDrawer.d.ts +4 -2
  73. package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
  74. package/dist/components/PanelDrawer/PanelDrawer.js +95 -1
  75. package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -0
  76. package/dist/components/PanelDrawer/PanelDrawer.test.js +103 -1
  77. package/dist/components/PanelDrawer/PanelDrawer.test.js.map +1 -0
  78. package/dist/components/PanelDrawer/PanelEditorForm.d.ts +12 -0
  79. package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -0
  80. package/dist/components/PanelDrawer/PanelEditorForm.js +142 -0
  81. package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -0
  82. package/dist/components/PanelDrawer/PanelSpecEditor.d.ts +7 -0
  83. package/dist/components/PanelDrawer/PanelSpecEditor.d.ts.map +1 -0
  84. package/dist/components/PanelDrawer/PanelSpecEditor.js +34 -0
  85. package/dist/components/PanelDrawer/PanelSpecEditor.js.map +1 -0
  86. package/dist/components/PanelDrawer/PanelTypeSelect.d.ts +8 -0
  87. package/dist/components/PanelDrawer/PanelTypeSelect.d.ts.map +1 -0
  88. package/dist/components/PanelDrawer/PanelTypeSelect.js +34 -0
  89. package/dist/components/PanelDrawer/PanelTypeSelect.js.map +1 -0
  90. package/dist/components/PanelDrawer/index.d.ts +2 -0
  91. package/dist/components/PanelDrawer/index.d.ts.map +1 -0
  92. package/dist/components/PanelDrawer/index.js +15 -0
  93. package/dist/components/PanelDrawer/index.js.map +1 -0
  94. package/dist/components/PanelDrawer/panel-editor-model.d.ts +27 -0
  95. package/dist/components/PanelDrawer/panel-editor-model.d.ts.map +1 -0
  96. package/dist/components/PanelDrawer/panel-editor-model.js +133 -0
  97. package/dist/components/PanelDrawer/panel-editor-model.js.map +1 -0
  98. package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
  99. package/dist/components/PanelGroupDialog/PanelGroupDialog.js +138 -1
  100. package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -0
  101. package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js +95 -1
  102. package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js.map +1 -0
  103. package/dist/components/TimeRangeControls/TimeRangeControls.js +137 -1
  104. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -0
  105. package/dist/components/TimeRangeControls/TimeRangeControls.test.js +59 -1
  106. package/dist/components/TimeRangeControls/TimeRangeControls.test.js.map +1 -0
  107. package/dist/components/TimeRangeControls/index.js +15 -1
  108. package/dist/components/TimeRangeControls/index.js.map +1 -0
  109. package/dist/components/Variables/Variable.d.ts.map +1 -1
  110. package/dist/components/Variables/Variable.js +202 -1
  111. package/dist/components/Variables/Variable.js.map +1 -0
  112. package/dist/components/Variables/VariableList.js +108 -1
  113. package/dist/components/Variables/VariableList.js.map +1 -0
  114. package/dist/components/Variables/index.js +16 -1
  115. package/dist/components/Variables/index.js.map +1 -0
  116. package/dist/components/index.d.ts +1 -0
  117. package/dist/components/index.d.ts.map +1 -1
  118. package/dist/components/index.js +20 -1
  119. package/dist/components/index.js.map +1 -0
  120. package/dist/context/DashboardAppSlice.js +45 -1
  121. package/dist/context/DashboardAppSlice.js.map +1 -0
  122. package/dist/context/DashboardProvider.d.ts +4 -2
  123. package/dist/context/DashboardProvider.d.ts.map +1 -1
  124. package/dist/context/DashboardProvider.js +107 -1
  125. package/dist/context/DashboardProvider.js.map +1 -0
  126. package/dist/context/DatasourceStoreProvider.d.ts +16 -0
  127. package/dist/context/DatasourceStoreProvider.d.ts.map +1 -0
  128. package/dist/context/DatasourceStoreProvider.js +64 -0
  129. package/dist/context/DatasourceStoreProvider.js.map +1 -0
  130. package/dist/context/LayoutsSlice.js +43 -1
  131. package/dist/context/LayoutsSlice.js.map +1 -0
  132. package/dist/context/QueryStringProvider.js +40 -1
  133. package/dist/context/QueryStringProvider.js.map +1 -0
  134. package/dist/context/TemplateVariableProvider.d.ts +6 -3
  135. package/dist/context/TemplateVariableProvider.d.ts.map +1 -1
  136. package/dist/context/TemplateVariableProvider.js +192 -1
  137. package/dist/context/TemplateVariableProvider.js.map +1 -0
  138. package/dist/context/TimeRangeProvider.js +72 -1
  139. package/dist/context/TimeRangeProvider.js.map +1 -0
  140. package/dist/context/index.d.ts +3 -2
  141. package/dist/context/index.d.ts.map +1 -1
  142. package/dist/context/index.js +21 -1
  143. package/dist/context/index.js.map +1 -0
  144. package/dist/css/styles.js +186 -1
  145. package/dist/css/styles.js.map +1 -0
  146. package/dist/index.js +17 -1
  147. package/dist/index.js.map +1 -0
  148. package/dist/test/dashboard-provider.d.ts +19 -0
  149. package/dist/test/dashboard-provider.d.ts.map +1 -0
  150. package/dist/test/dashboard-provider.js +40 -0
  151. package/dist/test/dashboard-provider.js.map +1 -0
  152. package/dist/test/index.d.ts +1 -0
  153. package/dist/test/index.d.ts.map +1 -1
  154. package/dist/test/index.js +17 -1
  155. package/dist/test/index.js.map +1 -0
  156. package/dist/test/plugin-registry.d.ts +2 -3
  157. package/dist/test/plugin-registry.d.ts.map +1 -1
  158. package/dist/test/plugin-registry.js +74 -1
  159. package/dist/test/plugin-registry.js.map +1 -0
  160. package/dist/test/render.d.ts +1 -2
  161. package/dist/test/render.d.ts.map +1 -1
  162. package/dist/test/render.js +34 -1
  163. package/dist/test/render.js.map +1 -0
  164. package/dist/test/setup-tests.js +18 -1
  165. package/dist/test/setup-tests.js.map +1 -0
  166. package/dist/test/testDashboard.d.ts.map +1 -1
  167. package/dist/test/testDashboard.js +274 -1
  168. package/dist/test/testDashboard.js.map +1 -0
  169. package/dist/utils/functions.js +17 -1
  170. package/dist/utils/functions.js.map +1 -0
  171. package/dist/views/ViewDashboard/DashboardApp.d.ts +7 -0
  172. package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -0
  173. package/dist/views/ViewDashboard/DashboardApp.js +56 -0
  174. package/dist/views/ViewDashboard/DashboardApp.js.map +1 -0
  175. package/dist/views/{ViewDashboard.d.ts → ViewDashboard/ViewDashboard.d.ts} +3 -1
  176. package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -0
  177. package/dist/views/ViewDashboard/ViewDashboard.js +79 -0
  178. package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -0
  179. package/dist/views/ViewDashboard/index.d.ts +2 -0
  180. package/dist/views/ViewDashboard/index.d.ts.map +1 -0
  181. package/dist/views/ViewDashboard/index.js +15 -0
  182. package/dist/views/ViewDashboard/index.js.map +1 -0
  183. package/dist/views/index.js +15 -1
  184. package/dist/views/index.js.map +1 -0
  185. package/package.json +13 -7
  186. package/dist/cjs/components/PanelDrawer/PanelOptionsEditor.js +0 -19
  187. package/dist/cjs/views/DashboardApp.js +0 -46
  188. package/dist/cjs/views/ViewDashboard.js +0 -43
  189. package/dist/components/PanelDrawer/PanelOptionsEditor.d.ts +0 -9
  190. package/dist/components/PanelDrawer/PanelOptionsEditor.d.ts.map +0 -1
  191. package/dist/components/PanelDrawer/PanelOptionsEditor.js +0 -1
  192. package/dist/views/DashboardApp.d.ts +0 -4
  193. package/dist/views/DashboardApp.d.ts.map +0 -1
  194. package/dist/views/DashboardApp.js +0 -1
  195. package/dist/views/ViewDashboard.d.ts.map +0 -1
  196. package/dist/views/ViewDashboard.js +0 -1
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PanelOptionsEditor = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const plugin_system_1 = require("@perses-dev/plugin-system");
6
- const react_1 = require("react");
7
- function PanelOptionsEditor(props) {
8
- const { kind, value, onChange } = props;
9
- const { OptionsEditorComponent, createInitialOptions } = (0, plugin_system_1.usePanelPlugin)(kind);
10
- // When the kind changes, re-init options
11
- (0, react_1.useEffect)(() => {
12
- onChange(createInitialOptions());
13
- // TODO: See if we can switch up plugin loading so this happens as part of selecting the plugin kind so we don't
14
- // need this effect at all
15
- // eslint-disable-next-line react-hooks/exhaustive-deps
16
- }, [kind]);
17
- return (0, jsx_runtime_1.jsx)(OptionsEditorComponent, { value: value, onChange: onChange });
18
- }
19
- exports.PanelOptionsEditor = PanelOptionsEditor;
@@ -1,46 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.DashboardApp = void 0;
7
- const jsx_runtime_1 = require("react/jsx-runtime");
8
- // Copyright 2022 The Perses Authors
9
- // Licensed under the Apache License, Version 2.0 (the "License");
10
- // you may not use this file except in compliance with the License.
11
- // You may obtain a copy of the License at
12
- //
13
- // http://www.apache.org/licenses/LICENSE-2.0
14
- //
15
- // Unless required by applicable law or agreed to in writing, software
16
- // distributed under the License is distributed on an "AS IS" BASIS,
17
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
- // See the License for the specific language governing permissions and
19
- // limitations under the License.
20
- const material_1 = require("@mui/material");
21
- const components_1 = require("@perses-dev/components");
22
- const components_2 = require("../components");
23
- const PanelGroupDialog_1 = __importDefault(require("../components/PanelGroupDialog/PanelGroupDialog"));
24
- const PanelDrawer_1 = __importDefault(require("../components/PanelDrawer/PanelDrawer"));
25
- const DashboardToolbar_1 = require("../components/DashboardToolbar");
26
- const context_1 = require("../context");
27
- const DashboardApp = (props) => {
28
- const { dashboardResource, sx, children, ...others } = props;
29
- const { dashboard } = (0, context_1.useDashboard)();
30
- const { panelGroupDialog } = (0, context_1.useDashboardApp)();
31
- return ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: (0, components_1.combineSx)({
32
- display: 'flex',
33
- width: '100%',
34
- height: '100%',
35
- position: 'relative',
36
- overflow: 'hidden',
37
- }, sx), ...others, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
38
- padding: (theme) => theme.spacing(1, 2),
39
- flexGrow: 1,
40
- overflowX: 'hidden',
41
- overflowY: 'auto',
42
- display: 'flex',
43
- flexDirection: 'column',
44
- }, children: [(0, jsx_runtime_1.jsx)(DashboardToolbar_1.DashboardToolbar, { dashboardName: dashboardResource.metadata.name }), (0, jsx_runtime_1.jsx)(components_2.TemplateVariableList, {}), (0, jsx_runtime_1.jsx)(components_2.Dashboard, { spec: dashboard }), (0, jsx_runtime_1.jsx)(PanelDrawer_1.default, {}), panelGroupDialog && (0, jsx_runtime_1.jsx)(PanelGroupDialog_1.default, {}), children] }) }));
45
- };
46
- exports.DashboardApp = DashboardApp;
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ViewDashboard = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- // Copyright 2021 The Perses Authors
6
- // Licensed under the Apache License, Version 2.0 (the "License");
7
- // you may not use this file except in compliance with the License.
8
- // You may obtain a copy of the License at
9
- //
10
- // http://www.apache.org/licenses/LICENSE-2.0
11
- //
12
- // Unless required by applicable law or agreed to in writing, software
13
- // distributed under the License is distributed on an "AS IS" BASIS,
14
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- // See the License for the specific language governing permissions and
16
- // limitations under the License.
17
- const react_1 = require("react");
18
- const core_1 = require("@perses-dev/core");
19
- const plugin_system_1 = require("@perses-dev/plugin-system");
20
- const context_1 = require("../context");
21
- const DashboardApp_1 = require("./DashboardApp");
22
- /**
23
- * The View for displaying a Dashboard, along with the UI for selecting variable values.
24
- */
25
- function ViewDashboard(props) {
26
- var _a;
27
- const { dashboardResource: { spec }, children, } = props;
28
- const { queryString, setQueryString } = (0, plugin_system_1.useQueryString)();
29
- const dashboardDuration = (_a = spec.duration) !== null && _a !== void 0 ? _a : '1h';
30
- const defaultTimeRange = (0, core_1.getDefaultTimeRange)(dashboardDuration, queryString);
31
- // TODO: add reusable sync query string or no-op util
32
- (0, react_1.useEffect)(() => {
33
- const currentParams = Object.fromEntries([...queryString]);
34
- // if app does not provide query string implementation, setTimeRange is used instead
35
- if (!currentParams.start && setQueryString) {
36
- // default to duration in dashboard definition if start param is not already set
37
- queryString.set('start', dashboardDuration);
38
- setQueryString(queryString);
39
- }
40
- }, [dashboardDuration, queryString, setQueryString]);
41
- return ((0, jsx_runtime_1.jsx)(context_1.DashboardProvider, { initialState: { dashboardSpec: spec }, children: (0, jsx_runtime_1.jsx)(context_1.TimeRangeProvider, { initialTimeRange: defaultTimeRange, children: (0, jsx_runtime_1.jsx)(context_1.TemplateVariableProvider, { initialVariableDefinitions: spec.variables, children: (0, jsx_runtime_1.jsx)(DashboardApp_1.DashboardApp, { ...props, children: children }) }) }) }));
42
- }
43
- exports.ViewDashboard = ViewDashboard;
@@ -1,9 +0,0 @@
1
- /// <reference types="react" />
2
- import { JsonObject } from '@perses-dev/core';
3
- export interface PanelOptionsEditorProps {
4
- kind: string;
5
- value: JsonObject;
6
- onChange: (next: JsonObject) => void;
7
- }
8
- export declare function PanelOptionsEditor(props: PanelOptionsEditorProps): JSX.Element;
9
- //# sourceMappingURL=PanelOptionsEditor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PanelOptionsEditor.d.ts","sourceRoot":"","sources":["../../../src/components/PanelDrawer/PanelOptionsEditor.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAI9C,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;CACtC;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,eAchE"}
@@ -1 +0,0 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{usePanelPlugin}from"@perses-dev/plugin-system";import{useEffect}from"react";export function PanelOptionsEditor(e){const{kind:n,value:t,onChange:o}=e,{OptionsEditorComponent:s,createInitialOptions:i}=usePanelPlugin(n);return useEffect((()=>{o(i())}),[n]),_jsx(s,{value:t,onChange:o})}
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- import { ViewDashboardProps } from './ViewDashboard';
3
- export declare const DashboardApp: (props: ViewDashboardProps) => JSX.Element;
4
- //# sourceMappingURL=DashboardApp.d.ts.map
@@ -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{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 +0,0 @@
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 +0,0 @@
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})})})})}