@perses-dev/dashboards 0.52.0-beta.5 → 0.52.0-rc.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/GridLayout/GridLayout.js +78 -126
- package/dist/cjs/components/GridLayout/Row.js +150 -0
- package/dist/cjs/components/GridLayout/index.js +1 -0
- package/dist/cjs/components/LeaveDialog/LeaveDialog.js +72 -0
- package/dist/cjs/components/LeaveDialog/index.js +30 -0
- package/dist/cjs/components/Panel/Panel.js +5 -1
- package/dist/cjs/components/Panel/PanelActions.js +4 -4
- package/dist/cjs/components/Panel/PanelHeader.js +32 -15
- package/dist/cjs/components/PanelDrawer/PanelDrawer.js +58 -21
- package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +204 -185
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +3 -0
- package/dist/cjs/components/PanelGroupDialog/PanelGroupEditorForm.js +35 -15
- package/dist/cjs/components/Variables/VariableEditor.js +22 -15
- package/dist/cjs/components/index.js +1 -0
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +7 -8
- package/dist/cjs/context/DashboardProvider/DashboardProviderWithQueryParams.js +27 -5
- package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +1 -0
- package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +6 -2
- package/dist/cjs/context/DashboardProvider/panel-group-slice.js +1 -0
- package/dist/cjs/context/DashboardProvider/view-panel-slice.js +10 -3
- package/dist/cjs/context/VariableProvider/VariableProvider.js +1 -1
- package/dist/cjs/context/VariableProvider/query-params.js +12 -14
- package/dist/cjs/context/useDashboard.js +5 -4
- package/dist/cjs/test/render.js +6 -8
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +7 -3
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +9 -8
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts +2 -2
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
- package/dist/components/GridLayout/GridLayout.d.ts +8 -0
- package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
- package/dist/components/GridLayout/GridLayout.js +72 -126
- package/dist/components/GridLayout/GridLayout.js.map +1 -1
- package/dist/components/GridLayout/Row.d.ts +17 -0
- package/dist/components/GridLayout/Row.d.ts.map +1 -0
- package/dist/components/GridLayout/Row.js +142 -0
- package/dist/components/GridLayout/Row.js.map +1 -0
- package/dist/components/GridLayout/index.d.ts +1 -0
- package/dist/components/GridLayout/index.d.ts.map +1 -1
- package/dist/components/GridLayout/index.js +1 -0
- package/dist/components/GridLayout/index.js.map +1 -1
- package/dist/components/LeaveDialog/LeaveDialog.d.ts +12 -0
- package/dist/components/LeaveDialog/LeaveDialog.d.ts.map +1 -0
- package/dist/components/LeaveDialog/LeaveDialog.js +61 -0
- package/dist/components/LeaveDialog/LeaveDialog.js.map +1 -0
- package/dist/components/LeaveDialog/index.d.ts +2 -0
- package/dist/components/LeaveDialog/index.d.ts.map +1 -0
- package/dist/components/LeaveDialog/index.js +15 -0
- package/dist/components/LeaveDialog/index.js.map +1 -0
- package/dist/components/Panel/HeaderIconButton.d.ts +1 -1
- package/dist/components/Panel/Panel.d.ts +5 -0
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/Panel.js +5 -1
- package/dist/components/Panel/Panel.js.map +1 -1
- package/dist/components/Panel/PanelActions.d.ts +2 -0
- package/dist/components/Panel/PanelActions.d.ts.map +1 -1
- package/dist/components/Panel/PanelActions.js +4 -4
- package/dist/components/Panel/PanelActions.js.map +1 -1
- package/dist/components/Panel/PanelHeader.d.ts +6 -1
- package/dist/components/Panel/PanelHeader.d.ts.map +1 -1
- package/dist/components/Panel/PanelHeader.js +33 -16
- package/dist/components/Panel/PanelHeader.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.js +59 -22
- package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js +207 -188
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js +3 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts +1 -0
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js +36 -16
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -1
- package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditor.js +24 -17
- package/dist/components/Variables/VariableEditor.js.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.d.ts +5 -5
- package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.js +7 -8
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
- package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.d.ts.map +1 -1
- package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js +27 -5
- package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js.map +1 -1
- package/dist/context/DashboardProvider/common.d.ts +1 -1
- package/dist/context/DashboardProvider/common.d.ts.map +1 -1
- package/dist/context/DashboardProvider/common.js.map +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts +1 -0
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.js +1 -0
- package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts +1 -0
- package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.js +6 -2
- package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.d.ts +3 -0
- package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.js +1 -0
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/view-panel-slice.d.ts +6 -2
- package/dist/context/DashboardProvider/view-panel-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/view-panel-slice.js +10 -3
- package/dist/context/DashboardProvider/view-panel-slice.js.map +1 -1
- package/dist/context/VariableProvider/VariableProvider.js +1 -1
- package/dist/context/VariableProvider/VariableProvider.js.map +1 -1
- package/dist/context/VariableProvider/query-params.d.ts +4 -3
- package/dist/context/VariableProvider/query-params.d.ts.map +1 -1
- package/dist/context/VariableProvider/query-params.js +9 -14
- package/dist/context/VariableProvider/query-params.js.map +1 -1
- package/dist/context/useDashboard.js +5 -4
- package/dist/context/useDashboard.js.map +1 -1
- package/dist/test/render.d.ts.map +1 -1
- package/dist/test/render.js +6 -8
- package/dist/test/render.js.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.d.ts +7 -6
- package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.js +8 -4
- package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.js +9 -8
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
- package/package.json +6 -6
|
@@ -32,6 +32,7 @@ const _jsxruntime = require("react/jsx-runtime");
|
|
|
32
32
|
const _react = require("react");
|
|
33
33
|
const _material = require("@mui/material");
|
|
34
34
|
const _Plus = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Plus"));
|
|
35
|
+
const _core = require("@perses-dev/core");
|
|
35
36
|
const _useimmer = require("use-immer");
|
|
36
37
|
const _Pencil = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Pencil"));
|
|
37
38
|
const _TrashCan = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/TrashCan"));
|
|
@@ -163,26 +164,32 @@ function VariableEditor(props) {
|
|
|
163
164
|
draft.push(v);
|
|
164
165
|
});
|
|
165
166
|
};
|
|
167
|
+
const { dashboard } = (0, _context.useDashboard)();
|
|
168
|
+
const dashboardDuration = dashboard?.kind === 'Dashboard' ? dashboard.spec.duration : _core.DEFAULT_DASHBOARD_DURATION;
|
|
169
|
+
const initialTimeRange = (0, _pluginsystem.useInitialTimeRange)(dashboardDuration);
|
|
166
170
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
167
171
|
children: [
|
|
168
172
|
currentEditingVariableDefinition && /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.ValidationProvider, {
|
|
169
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
173
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.TimeRangeProvider, {
|
|
174
|
+
timeRange: initialTimeRange,
|
|
175
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.VariableEditorForm, {
|
|
176
|
+
initialVariableDefinition: currentEditingVariableDefinition,
|
|
177
|
+
action: variableFormAction,
|
|
178
|
+
isDraft: true,
|
|
179
|
+
onActionChange: setVariableFormAction,
|
|
180
|
+
onSave: (definition)=>{
|
|
181
|
+
setVariableDefinitions((draft)=>{
|
|
182
|
+
draft[variableEditIdx] = definition;
|
|
183
|
+
setVariableEditIdx(null);
|
|
184
|
+
});
|
|
185
|
+
},
|
|
186
|
+
onClose: ()=>{
|
|
187
|
+
if (variableFormAction === 'create') {
|
|
188
|
+
removeVariable(variableEditIdx);
|
|
189
|
+
}
|
|
177
190
|
setVariableEditIdx(null);
|
|
178
|
-
});
|
|
179
|
-
},
|
|
180
|
-
onClose: ()=>{
|
|
181
|
-
if (variableFormAction === 'create') {
|
|
182
|
-
removeVariable(variableEditIdx);
|
|
183
191
|
}
|
|
184
|
-
|
|
185
|
-
}
|
|
192
|
+
})
|
|
186
193
|
})
|
|
187
194
|
}),
|
|
188
195
|
!currentEditingVariableDefinition && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
@@ -28,6 +28,7 @@ _export_star(require("./EditJsonButton"), exports);
|
|
|
28
28
|
_export_star(require("./EditJsonDialog"), exports);
|
|
29
29
|
_export_star(require("./EmptyDashboard"), exports);
|
|
30
30
|
_export_star(require("./GridLayout"), exports);
|
|
31
|
+
_export_star(require("./LeaveDialog"), exports);
|
|
31
32
|
_export_star(require("./Panel"), exports);
|
|
32
33
|
_export_star(require("./PanelDrawer"), exports);
|
|
33
34
|
_export_star(require("./PanelGroupDialog"), exports);
|
|
@@ -61,14 +61,15 @@ function useDashboardStore(selector) {
|
|
|
61
61
|
return (0, _traditional.useStoreWithEqualityFn)(store, selector, _shallow.shallow);
|
|
62
62
|
}
|
|
63
63
|
function DashboardProvider(props) {
|
|
64
|
+
// Prevent calling createDashboardStore every time it rerenders
|
|
64
65
|
const createDashboardStore = (0, _react.useCallback)(initStore, [
|
|
65
66
|
props
|
|
66
67
|
]);
|
|
68
|
+
const [store] = (0, _react.useState)(createDashboardStore(props));
|
|
67
69
|
// load plugin to retrieve initial spec if default panel kind is defined
|
|
68
70
|
const { defaultPluginKinds } = (0, _pluginsystem.usePluginRegistry)();
|
|
69
71
|
const defaultPanelKind = defaultPluginKinds?.['Panel'] ?? '';
|
|
70
72
|
const { data: plugin } = (0, _pluginsystem.usePlugin)('Panel', defaultPanelKind);
|
|
71
|
-
const [store] = (0, _react.useState)(createDashboardStore(props)); // prevent calling createDashboardStore every time it rerenders
|
|
72
73
|
(0, _react.useEffect)(()=>{
|
|
73
74
|
if (plugin === undefined) return;
|
|
74
75
|
const defaultPanelSpec = plugin.createInitialOptions ? plugin.createInitialOptions() : {};
|
|
@@ -90,12 +91,8 @@ function DashboardProvider(props) {
|
|
|
90
91
|
}
|
|
91
92
|
function initStore(props) {
|
|
92
93
|
const { initialState: { dashboardResource, isEditMode, viewPanelRef, setViewPanelRef } } = props;
|
|
93
|
-
const { kind, metadata, spec: { display, duration, refreshInterval = _core.DEFAULT_REFRESH_INTERVAL, datasources } } = dashboardResource;
|
|
94
|
+
const { kind, metadata, spec: { display, duration, refreshInterval = _core.DEFAULT_REFRESH_INTERVAL, datasources, layouts = [], panels = {} } } = dashboardResource;
|
|
94
95
|
const ttl = 'ttl' in dashboardResource.spec ? dashboardResource.spec.ttl : undefined;
|
|
95
|
-
let { spec: { layouts, panels } } = dashboardResource;
|
|
96
|
-
// Set fallbacks in case the frontend is used with a non-Perses backend
|
|
97
|
-
layouts = layouts ?? [];
|
|
98
|
-
panels = panels ?? {};
|
|
99
96
|
const store = (0, _zustand.createStore)()((0, _immer.immer)((0, _middleware.devtools)((...args)=>{
|
|
100
97
|
const [set] = args;
|
|
101
98
|
return {
|
|
@@ -118,9 +115,11 @@ function initStore(props) {
|
|
|
118
115
|
datasources,
|
|
119
116
|
ttl,
|
|
120
117
|
isEditMode: !!isEditMode,
|
|
121
|
-
setEditMode: (isEditMode)=>
|
|
118
|
+
setEditMode: (isEditMode)=>{
|
|
119
|
+
set({
|
|
122
120
|
isEditMode
|
|
123
|
-
})
|
|
121
|
+
});
|
|
122
|
+
},
|
|
124
123
|
setDashboard: ({ kind, metadata, spec: { display, panels = {}, layouts = [], duration, refreshInterval, datasources = {} } })=>{
|
|
125
124
|
set((state)=>{
|
|
126
125
|
state.kind = kind;
|
|
@@ -21,15 +21,37 @@ Object.defineProperty(exports, "DashboardProviderWithQueryParams", {
|
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
-
const
|
|
24
|
+
const _zod = require("zod");
|
|
25
|
+
const _react = require("react");
|
|
26
|
+
const _nuqs = require("nuqs");
|
|
25
27
|
const _DashboardProvider = require("./DashboardProvider");
|
|
26
28
|
function DashboardProviderWithQueryParams({ children, initialState }) {
|
|
27
|
-
const [viewPanelRef, setViewPanelRef] = (0,
|
|
29
|
+
const [viewPanelRef, setViewPanelRef] = (0, _nuqs.useQueryState)('viewPanelRef', (0, _nuqs.parseAsJson)(_zod.z.object({
|
|
30
|
+
ref: _zod.z.string(),
|
|
31
|
+
repeatVariable: _zod.z.tuple([
|
|
32
|
+
_zod.z.string(),
|
|
33
|
+
_zod.z.string()
|
|
34
|
+
]).optional()
|
|
35
|
+
}).optional()));
|
|
36
|
+
// nuqs returns null when the query param is not present, but our state expects undefined when not present
|
|
37
|
+
const viewPanelRefNotNull = (0, _react.useMemo)(()=>{
|
|
38
|
+
return viewPanelRef ?? undefined;
|
|
39
|
+
}, [
|
|
40
|
+
viewPanelRef
|
|
41
|
+
]);
|
|
42
|
+
const handleSetViewPanelRef = (0, _react.useCallback)((panelRef)=>{
|
|
43
|
+
if (panelRef) {
|
|
44
|
+
return setViewPanelRef(panelRef);
|
|
45
|
+
}
|
|
46
|
+
return setViewPanelRef(null);
|
|
47
|
+
}, [
|
|
48
|
+
setViewPanelRef
|
|
49
|
+
]);
|
|
28
50
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_DashboardProvider.DashboardProvider, {
|
|
29
51
|
initialState: {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
52
|
+
...initialState,
|
|
53
|
+
viewPanelRef: viewPanelRefNotNull,
|
|
54
|
+
setViewPanelRef: handleSetViewPanelRef
|
|
33
55
|
},
|
|
34
56
|
children: children
|
|
35
57
|
});
|
|
@@ -29,12 +29,14 @@ const createPanelGroupEditorSlice = (set, get)=>({
|
|
|
29
29
|
mode: 'Add',
|
|
30
30
|
initialValues: {
|
|
31
31
|
title: '',
|
|
32
|
-
isCollapsed: false
|
|
32
|
+
isCollapsed: false,
|
|
33
|
+
repeatVariable: ''
|
|
33
34
|
},
|
|
34
35
|
applyChanges (next) {
|
|
35
36
|
const newGroup = (0, _panelgroupslice.createEmptyPanelGroup)();
|
|
36
37
|
newGroup.title = next.title;
|
|
37
38
|
newGroup.isCollapsed = next.isCollapsed;
|
|
39
|
+
newGroup.repeatVariable = next.repeatVariable;
|
|
38
40
|
set((draft)=>{
|
|
39
41
|
(0, _panelgroupslice.addPanelGroup)(draft, newGroup);
|
|
40
42
|
});
|
|
@@ -60,7 +62,8 @@ const createPanelGroupEditorSlice = (set, get)=>({
|
|
|
60
62
|
mode: 'Edit',
|
|
61
63
|
initialValues: {
|
|
62
64
|
title: existingGroup.title ?? '',
|
|
63
|
-
isCollapsed: existingGroup.isCollapsed
|
|
65
|
+
isCollapsed: existingGroup.isCollapsed,
|
|
66
|
+
repeatVariable: existingGroup.repeatVariable ?? ''
|
|
64
67
|
},
|
|
65
68
|
applyChanges (next) {
|
|
66
69
|
set((draft)=>{
|
|
@@ -70,6 +73,7 @@ const createPanelGroupEditorSlice = (set, get)=>({
|
|
|
70
73
|
}
|
|
71
74
|
group.title = next.title;
|
|
72
75
|
group.isCollapsed = next.isCollapsed;
|
|
76
|
+
group.repeatVariable = next.repeatVariable;
|
|
73
77
|
});
|
|
74
78
|
},
|
|
75
79
|
close () {
|
|
@@ -100,6 +100,7 @@ function convertLayoutsToPanelGroups(layouts) {
|
|
|
100
100
|
panelGroups[panelGroupId] = {
|
|
101
101
|
id: panelGroupId,
|
|
102
102
|
isCollapsed: layout.spec.display?.collapse?.open === false,
|
|
103
|
+
repeatVariable: layout.spec.repeatVariable,
|
|
103
104
|
title: layout.spec.display?.title,
|
|
104
105
|
itemLayouts,
|
|
105
106
|
itemPanelKeys
|
|
@@ -55,12 +55,13 @@ function getViewPanelGroupId(panelGroups, panelGroupItemId, panelRef) {
|
|
|
55
55
|
// Find the PanelGroupItemId of a Panel from a PanelRef
|
|
56
56
|
function findPanelGroupItemIdOfPanelRef(panelGroups, panelRef) {
|
|
57
57
|
for (const panelGroup of Object.values(panelGroups)){
|
|
58
|
-
const itemPanel = Object.entries(panelGroup.itemPanelKeys ?? []).find(([_, value])=>value === panelRef);
|
|
58
|
+
const itemPanel = Object.entries(panelGroup.itemPanelKeys ?? []).find(([_, value])=>value === panelRef.ref);
|
|
59
59
|
if (itemPanel) {
|
|
60
60
|
const [key] = itemPanel;
|
|
61
61
|
return {
|
|
62
62
|
panelGroupId: panelGroup.id,
|
|
63
|
-
panelGroupItemLayoutId: key
|
|
63
|
+
panelGroupItemLayoutId: key,
|
|
64
|
+
repeatVariable: panelRef.repeatVariable
|
|
64
65
|
};
|
|
65
66
|
}
|
|
66
67
|
}
|
|
@@ -73,7 +74,13 @@ function findPanelRefOfPanelGroupItemId(panelGroups, panelGroupItemId) {
|
|
|
73
74
|
}
|
|
74
75
|
const panelGroup = panelGroups[panelGroupItemId.panelGroupId];
|
|
75
76
|
if (panelGroup) {
|
|
76
|
-
|
|
77
|
+
const panelRef = panelGroup.itemPanelKeys[panelGroupItemId.panelGroupItemLayoutId];
|
|
78
|
+
if (panelRef) {
|
|
79
|
+
return {
|
|
80
|
+
ref: panelRef,
|
|
81
|
+
repeatVariable: panelGroupItemId.repeatVariable
|
|
82
|
+
};
|
|
83
|
+
}
|
|
77
84
|
}
|
|
78
85
|
return undefined;
|
|
79
86
|
}
|
|
@@ -362,7 +362,7 @@ function createVariableDefinitionStore({ initialVariableDefinitions = [], extern
|
|
|
362
362
|
return (0, _utils.checkSavedDefaultVariableStatus)(get().variableDefinitions, get().variableState);
|
|
363
363
|
}
|
|
364
364
|
}))));
|
|
365
|
-
return store;
|
|
365
|
+
return store;
|
|
366
366
|
}
|
|
367
367
|
function VariableProvider({ children, initialVariableDefinitions = [], externalVariableDefinitions = [], builtinVariableDefinitions = [] }) {
|
|
368
368
|
const [store] = (0, _react.useState)(()=>createVariableDefinitionStore({
|
|
@@ -33,11 +33,14 @@ _export(exports, {
|
|
|
33
33
|
getURLQueryParamName: function() {
|
|
34
34
|
return getURLQueryParamName;
|
|
35
35
|
},
|
|
36
|
+
parseAsVariableValue: function() {
|
|
37
|
+
return parseAsVariableValue;
|
|
38
|
+
},
|
|
36
39
|
useVariableQueryParams: function() {
|
|
37
40
|
return useVariableQueryParams;
|
|
38
41
|
}
|
|
39
42
|
});
|
|
40
|
-
const
|
|
43
|
+
const _nuqs = require("nuqs");
|
|
41
44
|
const variableQueryParameterPrefix = 'var-';
|
|
42
45
|
function getURLQueryParamName(name) {
|
|
43
46
|
return `${variableQueryParameterPrefix}${name}`;
|
|
@@ -46,7 +49,7 @@ function encodeVariableValue(value) {
|
|
|
46
49
|
if (Array.isArray(value)) {
|
|
47
50
|
return value.join(',');
|
|
48
51
|
}
|
|
49
|
-
return value;
|
|
52
|
+
return value ?? '';
|
|
50
53
|
}
|
|
51
54
|
function decodeVariableValue(value) {
|
|
52
55
|
if (!value) {
|
|
@@ -58,23 +61,18 @@ function decodeVariableValue(value) {
|
|
|
58
61
|
}
|
|
59
62
|
return values;
|
|
60
63
|
}
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return decodeVariableValue(v);
|
|
66
|
-
}
|
|
67
|
-
return '';
|
|
68
|
-
}
|
|
69
|
-
};
|
|
64
|
+
const parseAsVariableValue = (0, _nuqs.createParser)({
|
|
65
|
+
parse: decodeVariableValue,
|
|
66
|
+
serialize: encodeVariableValue
|
|
67
|
+
});
|
|
70
68
|
function useVariableQueryParams(defs) {
|
|
71
69
|
const config = {};
|
|
72
70
|
defs.forEach((def)=>{
|
|
73
71
|
const name = getURLQueryParamName(def.spec.name);
|
|
74
|
-
config[name] =
|
|
72
|
+
config[name] = parseAsVariableValue;
|
|
75
73
|
});
|
|
76
|
-
return (0,
|
|
77
|
-
|
|
74
|
+
return (0, _nuqs.useQueryStates)(config, {
|
|
75
|
+
history: 'replace'
|
|
78
76
|
});
|
|
79
77
|
}
|
|
80
78
|
function getInitalValuesFromQueryParameters(queryParamValues) {
|
|
@@ -82,11 +82,11 @@ function convertPanelGroupsToLayouts(panelGroups, panelGroupOrder) {
|
|
|
82
82
|
if (group === undefined) {
|
|
83
83
|
throw new Error('panel group not found');
|
|
84
84
|
}
|
|
85
|
-
const { title, isCollapsed, itemLayouts, itemPanelKeys } = group;
|
|
85
|
+
const { title, isCollapsed, repeatVariable, itemLayouts, itemPanelKeys } = group;
|
|
86
86
|
let display = undefined;
|
|
87
|
-
if (title) {
|
|
87
|
+
if (title || isCollapsed !== undefined) {
|
|
88
88
|
display = {
|
|
89
|
-
title,
|
|
89
|
+
title: title ?? '',
|
|
90
90
|
collapse: {
|
|
91
91
|
open: !isCollapsed
|
|
92
92
|
}
|
|
@@ -108,7 +108,8 @@ function convertPanelGroupsToLayouts(panelGroups, panelGroupOrder) {
|
|
|
108
108
|
height: layout.h,
|
|
109
109
|
content: (0, _core.createPanelRef)(panelKey)
|
|
110
110
|
};
|
|
111
|
-
})
|
|
111
|
+
}),
|
|
112
|
+
repeatVariable: repeatVariable
|
|
112
113
|
}
|
|
113
114
|
};
|
|
114
115
|
layouts.push(layout);
|
package/dist/cjs/test/render.js
CHANGED
|
@@ -28,8 +28,7 @@ const _react = require("@testing-library/react");
|
|
|
28
28
|
const _history = require("history");
|
|
29
29
|
const _react1 = require("react");
|
|
30
30
|
const _reactrouterdom = require("react-router-dom");
|
|
31
|
-
const
|
|
32
|
-
const _reactrouter6 = require("use-query-params/adapters/react-router-6");
|
|
31
|
+
const _v6 = require("nuqs/adapters/react-router/v6");
|
|
33
32
|
const _context = require("../context");
|
|
34
33
|
const _test = require("../test");
|
|
35
34
|
const _pluginregistry = require("./plugin-registry");
|
|
@@ -63,12 +62,11 @@ function renderWithContext(ui, options, history) {
|
|
|
63
62
|
});
|
|
64
63
|
const customHistory = history ?? (0, _history.createMemoryHistory)();
|
|
65
64
|
const mockRegistry = (0, _pluginsystem.mockPluginRegistry)(..._pluginregistry.MOCK_PLUGINS);
|
|
66
|
-
const BaseRender = ()=>/*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
adapter: _reactrouter6.ReactRouter6Adapter,
|
|
65
|
+
const BaseRender = ()=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_v6.NuqsAdapter, {
|
|
66
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(CustomRouter, {
|
|
67
|
+
history: customHistory,
|
|
68
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactquery.QueryClientProvider, {
|
|
69
|
+
client: queryClient,
|
|
72
70
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.SnackbarProvider, {
|
|
73
71
|
anchorOrigin: {
|
|
74
72
|
vertical: 'bottom',
|
|
@@ -28,7 +28,7 @@ const _pluginsystem = require("@perses-dev/plugin-system");
|
|
|
28
28
|
const _components1 = require("../../components");
|
|
29
29
|
const _context = require("../../context");
|
|
30
30
|
const DashboardApp = (props)=>{
|
|
31
|
-
const { dashboardResource,
|
|
31
|
+
const { dashboardResource, emptyDashboardProps, isReadonly, isVariableEnabled, isDatasourceEnabled, isCreating, isInitialVariableSticky, isLeavingConfirmDialogEnabled, dashboardTitleComponent, onSave, onDiscard } = props;
|
|
32
32
|
const chartsTheme = (0, _components.useChartsTheme)();
|
|
33
33
|
const { isEditMode, setEditMode } = (0, _context.useEditMode)();
|
|
34
34
|
const { dashboard, setDashboard } = (0, _context.useDashboard)();
|
|
@@ -78,7 +78,7 @@ const DashboardApp = (props)=>{
|
|
|
78
78
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components1.DashboardToolbar, {
|
|
79
79
|
dashboardName: dashboardResource.metadata.name,
|
|
80
80
|
dashboardTitleComponent: dashboardTitleComponent,
|
|
81
|
-
initialVariableIsSticky:
|
|
81
|
+
initialVariableIsSticky: isInitialVariableSticky,
|
|
82
82
|
onSave: onSave,
|
|
83
83
|
isReadonly: isReadonly,
|
|
84
84
|
isVariableEnabled: isVariableEnabled,
|
|
@@ -116,7 +116,11 @@ const DashboardApp = (props)=>{
|
|
|
116
116
|
isReadonly: !isEditMode,
|
|
117
117
|
disableMetadataEdition: !isCreating
|
|
118
118
|
}),
|
|
119
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components1.SaveChangesConfirmationDialog, {})
|
|
119
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components1.SaveChangesConfirmationDialog, {}),
|
|
120
|
+
isLeavingConfirmDialogEnabled && isEditMode && /*#__PURE__*/ (0, _jsxruntime.jsx)(_components1.LeaveDialog, {
|
|
121
|
+
original: originalDashboard,
|
|
122
|
+
current: dashboard
|
|
123
|
+
})
|
|
120
124
|
]
|
|
121
125
|
})
|
|
122
126
|
]
|
|
@@ -30,7 +30,7 @@ const _context = require("../../context");
|
|
|
30
30
|
const _DashboardProviderWithQueryParams = require("../../context/DashboardProvider/DashboardProviderWithQueryParams");
|
|
31
31
|
const _DashboardApp = require("./DashboardApp");
|
|
32
32
|
function ViewDashboard(props) {
|
|
33
|
-
const { dashboardResource, datasourceApi, externalVariableDefinitions,
|
|
33
|
+
const { dashboardResource, datasourceApi, externalVariableDefinitions, emptyDashboardProps, isReadonly, isVariableEnabled, isDatasourceEnabled, isEditing, isCreating, isInitialVariableSticky, isLeavingConfirmDialogEnabled, dashboardTitleComponent, onSave, onDiscard, sx, ...others } = props;
|
|
34
34
|
const { spec } = dashboardResource;
|
|
35
35
|
const dashboardDuration = spec.duration ?? _core.DEFAULT_DASHBOARD_DURATION;
|
|
36
36
|
const dashboardRefreshInterval = spec.refreshInterval ?? _core.DEFAULT_REFRESH_INTERVAL;
|
|
@@ -80,8 +80,8 @@ function ViewDashboard(props) {
|
|
|
80
80
|
datasourceApi: datasourceApi,
|
|
81
81
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_DashboardProviderWithQueryParams.DashboardProviderWithQueryParams, {
|
|
82
82
|
initialState: {
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
isEditMode: !!isEditing,
|
|
84
|
+
dashboardResource
|
|
85
85
|
},
|
|
86
86
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.TimeRangeProviderWithQueryParams, {
|
|
87
87
|
initialTimeRange: initialTimeRange,
|
|
@@ -103,15 +103,16 @@ function ViewDashboard(props) {
|
|
|
103
103
|
FallbackComponent: _components.ErrorAlert,
|
|
104
104
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_DashboardApp.DashboardApp, {
|
|
105
105
|
dashboardResource: dashboardResource,
|
|
106
|
-
dashboardTitleComponent: dashboardTitleComponent,
|
|
107
106
|
emptyDashboardProps: emptyDashboardProps,
|
|
108
|
-
onSave: onSave,
|
|
109
|
-
onDiscard: onDiscard,
|
|
110
|
-
initialVariableIsSticky: initialVariableIsSticky,
|
|
111
107
|
isReadonly: isReadonly,
|
|
112
108
|
isVariableEnabled: isVariableEnabled,
|
|
113
109
|
isDatasourceEnabled: isDatasourceEnabled,
|
|
114
|
-
isCreating: isCreating
|
|
110
|
+
isCreating: isCreating,
|
|
111
|
+
isInitialVariableSticky: isInitialVariableSticky,
|
|
112
|
+
isLeavingConfirmDialogEnabled: isLeavingConfirmDialogEnabled,
|
|
113
|
+
dashboardTitleComponent: dashboardTitleComponent,
|
|
114
|
+
onSave: onSave,
|
|
115
|
+
onDiscard: onDiscard
|
|
115
116
|
})
|
|
116
117
|
})
|
|
117
118
|
})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { OnSaveDashboard } from '../../context';
|
|
3
3
|
export interface DashboardToolbarProps {
|
|
4
4
|
dashboardName: string;
|
|
5
|
-
dashboardTitleComponent?:
|
|
5
|
+
dashboardTitleComponent?: ReactNode;
|
|
6
6
|
initialVariableIsSticky?: boolean;
|
|
7
7
|
isReadonly: boolean;
|
|
8
8
|
isVariableEnabled: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/DashboardToolbar/DashboardToolbar.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DashboardToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/DashboardToolbar/DashboardToolbar.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,eAAe,EAAe,MAAM,eAAe,CAAC;AAW7D,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,uBAAuB,CAAC,EAAE,SAAS,CAAC;IACpC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B;AAED,eAAO,MAAM,gBAAgB,UAAW,qBAAqB,KAAG,YAgG/D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/DashboardToolbar/DashboardToolbar.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Typography, Stack, Button, Box, useTheme, useMediaQuery, Alert } from '@mui/material';\nimport { ErrorBoundary, ErrorAlert } from '@perses-dev/components';\nimport { TimeRangeControls } from '@perses-dev/plugin-system';\nimport { ReactElement } from 'react';\nimport { OnSaveDashboard, useEditMode } from '../../context';\nimport { AddPanelButton } from '../AddPanelButton';\nimport { AddGroupButton } from '../AddGroupButton';\nimport { DownloadButton } from '../DownloadButton';\nimport { EditVariablesButton } from '../Variables';\nimport { EditDatasourcesButton } from '../Datasources';\nimport { EditButton } from '../EditButton';\nimport { EditJsonButton } from '../EditJsonButton';\nimport { SaveDashboardButton } from '../SaveDashboardButton';\nimport { DashboardStickyToolbar } from '../DashboardStickyToolbar';\n\nexport interface DashboardToolbarProps {\n dashboardName: string;\n dashboardTitleComponent?:
|
|
1
|
+
{"version":3,"sources":["../../../src/components/DashboardToolbar/DashboardToolbar.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Typography, Stack, Button, Box, useTheme, useMediaQuery, Alert } from '@mui/material';\nimport { ErrorBoundary, ErrorAlert } from '@perses-dev/components';\nimport { TimeRangeControls } from '@perses-dev/plugin-system';\nimport { ReactElement, ReactNode } from 'react';\nimport { OnSaveDashboard, useEditMode } from '../../context';\nimport { AddPanelButton } from '../AddPanelButton';\nimport { AddGroupButton } from '../AddGroupButton';\nimport { DownloadButton } from '../DownloadButton';\nimport { EditVariablesButton } from '../Variables';\nimport { EditDatasourcesButton } from '../Datasources';\nimport { EditButton } from '../EditButton';\nimport { EditJsonButton } from '../EditJsonButton';\nimport { SaveDashboardButton } from '../SaveDashboardButton';\nimport { DashboardStickyToolbar } from '../DashboardStickyToolbar';\n\nexport interface DashboardToolbarProps {\n dashboardName: string;\n dashboardTitleComponent?: ReactNode;\n initialVariableIsSticky?: boolean;\n isReadonly: boolean;\n isVariableEnabled: boolean;\n isDatasourceEnabled: boolean;\n onEditButtonClick: () => void;\n onCancelButtonClick: () => void;\n onSave?: OnSaveDashboard;\n}\n\nexport const DashboardToolbar = (props: DashboardToolbarProps): ReactElement => {\n const {\n dashboardName,\n dashboardTitleComponent,\n initialVariableIsSticky,\n isReadonly,\n isVariableEnabled,\n isDatasourceEnabled,\n onEditButtonClick,\n onCancelButtonClick,\n onSave,\n } = props;\n\n const { isEditMode } = useEditMode();\n\n const isBiggerThanSm = useMediaQuery(useTheme().breakpoints.up('sm'));\n const isBiggerThanMd = useMediaQuery(useTheme().breakpoints.up('md'));\n\n const dashboardTitle = dashboardTitleComponent ? (\n dashboardTitleComponent\n ) : (\n <Typography variant=\"h2\">{dashboardName}</Typography>\n );\n\n const testId = 'dashboard-toolbar';\n\n return (\n <>\n <Stack data-testid={testId}>\n <Box\n px={2}\n py={1.5}\n display=\"flex\"\n sx={{ backgroundColor: (theme) => theme.palette.primary.main + (isEditMode ? '30' : '0') }}\n >\n {dashboardTitle}\n {isEditMode ? (\n <Stack direction=\"row\" gap={1} ml=\"auto\">\n {isReadonly && (\n <Alert severity=\"warning\" sx={{ backgroundColor: 'transparent', padding: 0 }}>\n Dashboard managed via code only. Download JSON and commit changes to save.\n </Alert>\n )}\n <Stack direction=\"row\" spacing={0.5} ml={1} whiteSpace=\"nowrap\">\n {isVariableEnabled && <EditVariablesButton />}\n {isDatasourceEnabled && <EditDatasourcesButton />}\n <AddPanelButton />\n <AddGroupButton />\n </Stack>\n <SaveDashboardButton onSave={onSave} isDisabled={isReadonly} />\n <Button variant=\"outlined\" onClick={onCancelButtonClick}>\n Cancel\n </Button>\n </Stack>\n ) : (\n <>\n {isBiggerThanSm && (\n <Stack direction=\"row\" gap={1} ml=\"auto\">\n <EditButton onClick={onEditButtonClick} />\n </Stack>\n )}\n </>\n )}\n </Box>\n <Box\n sx={{\n display: 'flex',\n width: '100%',\n alignItems: 'start',\n padding: (theme) => theme.spacing(1, 2, 0, 2),\n flexDirection: isBiggerThanMd ? 'row' : 'column',\n flexWrap: 'nowrap',\n gap: 1,\n }}\n >\n <Box width=\"100%\">\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <DashboardStickyToolbar\n initialVariableIsSticky={initialVariableIsSticky}\n sx={{\n backgroundColor: ({ palette }) => palette.background.default,\n }}\n />\n </ErrorBoundary>\n </Box>\n <Stack direction=\"row\" ml=\"auto\" flexWrap=\"wrap\" justifyContent=\"end\">\n <Stack direction=\"row\" spacing={1} mt={1} ml={1}>\n <TimeRangeControls />\n <DownloadButton />\n <EditJsonButton isReadonly={!isEditMode} />\n </Stack>\n </Stack>\n </Box>\n </Stack>\n </>\n );\n};\n"],"names":["Typography","Stack","Button","Box","useTheme","useMediaQuery","Alert","ErrorBoundary","ErrorAlert","TimeRangeControls","useEditMode","AddPanelButton","AddGroupButton","DownloadButton","EditVariablesButton","EditDatasourcesButton","EditButton","EditJsonButton","SaveDashboardButton","DashboardStickyToolbar","DashboardToolbar","props","dashboardName","dashboardTitleComponent","initialVariableIsSticky","isReadonly","isVariableEnabled","isDatasourceEnabled","onEditButtonClick","onCancelButtonClick","onSave","isEditMode","isBiggerThanSm","breakpoints","up","isBiggerThanMd","dashboardTitle","variant","testId","data-testid","px","py","display","sx","backgroundColor","theme","palette","primary","main","direction","gap","ml","severity","padding","spacing","whiteSpace","isDisabled","onClick","width","alignItems","flexDirection","flexWrap","FallbackComponent","background","default","justifyContent","mt"],"mappings":"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"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { PanelGroupId } from '@perses-dev/core';
|
|
3
3
|
import { PanelOptions } from '../Panel';
|
|
4
|
+
import { RowProps } from './Row';
|
|
4
5
|
export interface GridLayoutProps {
|
|
5
6
|
panelGroupId: PanelGroupId;
|
|
6
7
|
panelOptions?: PanelOptions;
|
|
@@ -10,4 +11,11 @@ export interface GridLayoutProps {
|
|
|
10
11
|
* Layout component that arranges children in a Grid based on the definition.
|
|
11
12
|
*/
|
|
12
13
|
export declare function GridLayout(props: GridLayoutProps): ReactElement;
|
|
14
|
+
export interface RepeatGridLayoutProps extends RowProps {
|
|
15
|
+
repeatVariableName: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Renders a grid layout for a repeated variable, where each value of the variable will create a new row.
|
|
19
|
+
*/
|
|
20
|
+
export declare function RepeatGridLayout({ repeatVariableName, panelGroupId, groupDefinition, gridColWidth, panelFullHeight, panelOptions, isEditMode, onLayoutChange, onWidthChange, }: RepeatGridLayoutProps): ReactElement | null;
|
|
13
21
|
//# sourceMappingURL=GridLayout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridLayout.d.ts","sourceRoot":"","sources":["../../../src/components/GridLayout/GridLayout.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"GridLayout.d.ts","sourceRoot":"","sources":["../../../src/components/GridLayout/GridLayout.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAUhD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAO,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,YAAY,CAmE/D;AAED,MAAM,WAAW,qBAAsB,SAAQ,QAAQ;IACrD,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,UAAkB,EAClB,cAAc,EACd,aAAa,GACd,EAAE,qBAAqB,GAAG,YAAY,GAAG,IAAI,CA0C7C"}
|