@perses-dev/dashboards 0.9.0 → 0.11.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.
- package/dist/cjs/components/Dashboard.js +6 -11
- package/dist/cjs/components/DashboardToolbar.js +12 -6
- package/dist/cjs/components/GridLayout/GridItemContent.js +7 -15
- package/dist/cjs/components/GridLayout/GridLayout.js +27 -22
- package/dist/cjs/components/GridLayout/GridTitle.js +27 -7
- package/dist/cjs/components/Panel/DeletePanelDialog.js +95 -0
- package/dist/cjs/components/Panel/Panel.js +12 -10
- package/dist/cjs/components/Panel/Panel.test.js +15 -6
- package/dist/cjs/components/Panel/PanelContent.js +3 -2
- package/dist/cjs/components/PanelDrawer/PanelDrawer.js +13 -12
- package/dist/cjs/components/PanelDrawer/PanelDrawer.test.js +9 -13
- package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +87 -39
- package/dist/cjs/components/PanelDrawer/PanelPreview.js +54 -0
- package/dist/cjs/components/PanelGroupDialog/DeletePanelGroupDialog.js +88 -0
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +70 -118
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.test.js +21 -36
- package/dist/cjs/components/PanelGroupDialog/PanelGroupEditorForm.js +92 -0
- package/dist/cjs/components/PanelGroupDialog/index.js +29 -0
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +8 -11
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.test.js +20 -13
- package/dist/cjs/components/Variables/Variable.js +20 -11
- package/dist/cjs/components/Variables/VariableEditor.js +240 -0
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +236 -0
- package/dist/cjs/components/Variables/VariableEditorForm/index.js +28 -0
- package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +88 -0
- package/dist/cjs/components/Variables/VariableList.js +49 -69
- package/dist/cjs/components/Variables/index.js +1 -0
- package/dist/cjs/components/index.js +1 -0
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +82 -0
- package/dist/cjs/context/DashboardProvider/common.js +18 -0
- package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +164 -0
- package/dist/cjs/context/DashboardProvider/index.js +29 -0
- package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +175 -0
- package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +102 -0
- package/dist/cjs/context/DashboardProvider/panel-group-slice.js +208 -0
- package/dist/cjs/context/DatasourceStoreProvider.js +109 -7
- package/dist/cjs/context/TemplateVariableProvider.js +8 -1
- package/dist/cjs/context/TimeRangeProvider.js +20 -44
- package/dist/cjs/context/index.js +1 -3
- package/dist/cjs/context/useDashboardSpec.js +61 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/test/render.js +25 -5
- package/dist/cjs/test/setup-tests.js +4 -1
- package/dist/cjs/test/testDashboard.js +24 -11
- package/dist/cjs/utils/index.js +28 -0
- package/dist/cjs/utils/time-range-params.js +145 -0
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +5 -8
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +5 -22
- package/dist/cjs/views/ViewDashboard/tests/panelGroups.test.js +114 -0
- package/dist/components/Dashboard.d.ts +1 -4
- package/dist/components/Dashboard.d.ts.map +1 -1
- package/dist/components/Dashboard.js +7 -12
- package/dist/components/Dashboard.js.map +1 -1
- package/dist/components/DashboardToolbar.d.ts.map +1 -1
- package/dist/components/DashboardToolbar.js +14 -8
- package/dist/components/DashboardToolbar.js.map +1 -1
- package/dist/components/GridLayout/GridItemContent.d.ts +2 -4
- package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
- package/dist/components/GridLayout/GridItemContent.js +7 -15
- package/dist/components/GridLayout/GridItemContent.js.map +1 -1
- package/dist/components/GridLayout/GridLayout.d.ts +2 -4
- package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
- package/dist/components/GridLayout/GridLayout.js +28 -23
- package/dist/components/GridLayout/GridLayout.js.map +1 -1
- package/dist/components/GridLayout/GridTitle.d.ts +2 -1
- package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
- package/dist/components/GridLayout/GridTitle.js +28 -8
- package/dist/components/GridLayout/GridTitle.js.map +1 -1
- package/dist/components/Panel/DeletePanelDialog.d.ts +5 -0
- package/dist/components/Panel/DeletePanelDialog.d.ts.map +1 -0
- package/dist/components/Panel/DeletePanelDialog.js +84 -0
- package/dist/components/Panel/DeletePanelDialog.js.map +1 -0
- package/dist/components/Panel/Panel.d.ts +2 -2
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/Panel.js +13 -11
- package/dist/components/Panel/Panel.js.map +1 -1
- package/dist/components/Panel/Panel.test.d.ts +1 -1
- package/dist/components/Panel/Panel.test.d.ts.map +1 -1
- package/dist/components/Panel/Panel.test.js +10 -6
- package/dist/components/Panel/Panel.test.js.map +1 -1
- package/dist/components/Panel/PanelContent.d.ts +4 -1
- package/dist/components/Panel/PanelContent.d.ts.map +1 -1
- package/dist/components/Panel/PanelContent.js +3 -2
- package/dist/components/Panel/PanelContent.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.js +14 -13
- package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.test.js +9 -13
- package/dist/components/PanelDrawer/PanelDrawer.test.js.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts +3 -3
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js +89 -41
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.d.ts +4 -0
- package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -0
- package/dist/components/PanelDrawer/PanelPreview.js +48 -0
- package/dist/components/PanelDrawer/PanelPreview.js.map +1 -0
- package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.d.ts +3 -0
- package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -0
- package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.js +77 -0
- package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.js.map +1 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts +4 -2
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js +73 -119
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js +20 -35
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts +12 -0
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts.map +1 -0
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js +82 -0
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -0
- package/dist/components/PanelGroupDialog/index.d.ts +3 -0
- package/dist/components/PanelGroupDialog/index.d.ts.map +1 -0
- package/dist/components/PanelGroupDialog/index.js +16 -0
- package/dist/components/PanelGroupDialog/index.js.map +1 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js +11 -14
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.test.js +21 -14
- package/dist/components/TimeRangeControls/TimeRangeControls.test.js.map +1 -1
- package/dist/components/Variables/Variable.js +22 -13
- package/dist/components/Variables/Variable.js.map +1 -1
- package/dist/components/Variables/VariableEditor.d.ts +8 -0
- package/dist/components/Variables/VariableEditor.d.ts.map +1 -0
- package/dist/components/Variables/VariableEditor.js +229 -0
- package/dist/components/Variables/VariableEditor.js.map +1 -0
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +8 -0
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -0
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +225 -0
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -0
- package/dist/components/Variables/VariableEditorForm/index.d.ts +2 -0
- package/dist/components/Variables/VariableEditorForm/index.d.ts.map +1 -0
- package/dist/components/Variables/VariableEditorForm/index.js +15 -0
- package/dist/components/Variables/VariableEditorForm/index.js.map +1 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +21 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +76 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -0
- package/dist/components/Variables/VariableList.d.ts.map +1 -1
- package/dist/components/Variables/VariableList.js +47 -72
- package/dist/components/Variables/VariableList.js.map +1 -1
- package/dist/components/Variables/index.d.ts +1 -0
- package/dist/components/Variables/index.d.ts.map +1 -1
- package/dist/components/Variables/index.js +1 -0
- package/dist/components/Variables/index.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 +25 -0
- package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -0
- package/dist/context/DashboardProvider/DashboardProvider.js +64 -0
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -0
- package/dist/context/DashboardProvider/common.d.ts +5 -0
- package/dist/context/DashboardProvider/common.d.ts.map +1 -0
- package/dist/context/DashboardProvider/common.js +17 -0
- package/dist/context/DashboardProvider/common.js.map +1 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +74 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.js +163 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -0
- package/dist/context/DashboardProvider/index.d.ts +5 -0
- package/dist/context/DashboardProvider/index.d.ts.map +1 -0
- package/dist/context/DashboardProvider/index.js +16 -0
- package/dist/context/DashboardProvider/index.js.map +1 -0
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts +85 -0
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/panel-editor-slice.js +171 -0
- package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -0
- package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts +40 -0
- package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/panel-group-editor-slice.js +96 -0
- package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -0
- package/dist/context/DashboardProvider/panel-group-slice.d.ts +80 -0
- package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/panel-group-slice.js +204 -0
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -0
- package/dist/context/DatasourceStoreProvider.d.ts +10 -2
- package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
- package/dist/context/DatasourceStoreProvider.js +111 -9
- package/dist/context/DatasourceStoreProvider.js.map +1 -1
- package/dist/context/TemplateVariableProvider.d.ts +2 -0
- package/dist/context/TemplateVariableProvider.d.ts.map +1 -1
- package/dist/context/TemplateVariableProvider.js +8 -1
- package/dist/context/TemplateVariableProvider.js.map +1 -1
- package/dist/context/TimeRangeProvider.d.ts +9 -2
- package/dist/context/TimeRangeProvider.d.ts.map +1 -1
- package/dist/context/TimeRangeProvider.js +15 -43
- package/dist/context/TimeRangeProvider.js.map +1 -1
- package/dist/context/index.d.ts +1 -3
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +1 -3
- package/dist/context/index.js.map +1 -1
- package/dist/context/useDashboardSpec.d.ts +3 -0
- package/dist/context/useDashboardSpec.d.ts.map +1 -0
- package/dist/context/useDashboardSpec.js +55 -0
- package/dist/context/useDashboardSpec.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/test/plugin-registry.d.ts +2 -2
- package/dist/test/plugin-registry.d.ts.map +1 -1
- package/dist/test/plugin-registry.js.map +1 -1
- package/dist/test/render.d.ts +2 -1
- package/dist/test/render.d.ts.map +1 -1
- package/dist/test/render.js +25 -5
- package/dist/test/render.js.map +1 -1
- package/dist/test/setup-tests.d.ts.map +1 -1
- package/dist/test/setup-tests.js +4 -0
- package/dist/test/setup-tests.js.map +1 -1
- package/dist/test/testDashboard.d.ts.map +1 -1
- package/dist/test/testDashboard.js +24 -11
- package/dist/test/testDashboard.js.map +1 -1
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +15 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/time-range-params.d.ts +25 -0
- package/dist/utils/time-range-params.d.ts.map +1 -0
- package/dist/utils/time-range-params.js +137 -0
- package/dist/utils/time-range-params.js.map +1 -0
- package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.js +6 -9
- 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 +5 -22
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
- package/dist/views/ViewDashboard/tests/panelGroups.test.d.ts +2 -0
- package/dist/views/ViewDashboard/tests/panelGroups.test.d.ts.map +1 -0
- package/dist/views/ViewDashboard/tests/panelGroups.test.js +107 -0
- package/dist/views/ViewDashboard/tests/panelGroups.test.js.map +1 -0
- package/package.json +5 -4
- package/dist/cjs/components/PanelDrawer/PanelSpecEditor.js +0 -40
- package/dist/cjs/components/PanelDrawer/PanelTypeSelect.js +0 -38
- package/dist/cjs/components/PanelDrawer/panel-editor-model.js +0 -140
- package/dist/cjs/context/DashboardAppSlice.js +0 -57
- package/dist/cjs/context/DashboardProvider.js +0 -128
- package/dist/cjs/context/LayoutsSlice.js +0 -55
- package/dist/cjs/context/QueryStringProvider.js +0 -89
- package/dist/components/PanelDrawer/PanelSpecEditor.d.ts +0 -7
- package/dist/components/PanelDrawer/PanelSpecEditor.d.ts.map +0 -1
- package/dist/components/PanelDrawer/PanelSpecEditor.js +0 -34
- package/dist/components/PanelDrawer/PanelSpecEditor.js.map +0 -1
- package/dist/components/PanelDrawer/PanelTypeSelect.d.ts +0 -8
- package/dist/components/PanelDrawer/PanelTypeSelect.d.ts.map +0 -1
- package/dist/components/PanelDrawer/PanelTypeSelect.js +0 -34
- package/dist/components/PanelDrawer/PanelTypeSelect.js.map +0 -1
- package/dist/components/PanelDrawer/panel-editor-model.d.ts +0 -27
- package/dist/components/PanelDrawer/panel-editor-model.d.ts.map +0 -1
- package/dist/components/PanelDrawer/panel-editor-model.js +0 -133
- package/dist/components/PanelDrawer/panel-editor-model.js.map +0 -1
- package/dist/context/DashboardAppSlice.d.ts +0 -26
- package/dist/context/DashboardAppSlice.d.ts.map +0 -1
- package/dist/context/DashboardAppSlice.js +0 -45
- package/dist/context/DashboardAppSlice.js.map +0 -1
- package/dist/context/DashboardProvider.d.ts +0 -36
- package/dist/context/DashboardProvider.d.ts.map +0 -1
- package/dist/context/DashboardProvider.js +0 -107
- package/dist/context/DashboardProvider.js.map +0 -1
- package/dist/context/LayoutsSlice.d.ts +0 -12
- package/dist/context/LayoutsSlice.d.ts.map +0 -1
- package/dist/context/LayoutsSlice.js +0 -43
- package/dist/context/LayoutsSlice.js.map +0 -1
- package/dist/context/QueryStringProvider.d.ts +0 -13
- package/dist/context/QueryStringProvider.d.ts.map +0 -1
- package/dist/context/QueryStringProvider.js +0 -40
- package/dist/context/QueryStringProvider.js.map +0 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// Copyright 2022 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: all[name]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
PanelGroupEditorForm: ()=>PanelGroupEditorForm,
|
|
25
|
+
panelGroupEditorFormId: ()=>panelGroupEditorFormId
|
|
26
|
+
});
|
|
27
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
28
|
+
const _react = require("react");
|
|
29
|
+
const _material = require("@mui/material");
|
|
30
|
+
function PanelGroupEditorForm(props) {
|
|
31
|
+
const { initialValues , onSubmit } = props;
|
|
32
|
+
const [title, setTitle] = (0, _react.useState)(initialValues.title);
|
|
33
|
+
const [isCollapsed, setIsCollapsed] = (0, _react.useState)(initialValues.isCollapsed);
|
|
34
|
+
const handleCollapsedChange = (e)=>{
|
|
35
|
+
const next = e.target.value;
|
|
36
|
+
setIsCollapsed(next === 'Closed');
|
|
37
|
+
};
|
|
38
|
+
const handleSubmit = (e)=>{
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
onSubmit({
|
|
41
|
+
title,
|
|
42
|
+
isCollapsed
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)("form", {
|
|
46
|
+
id: panelGroupEditorFormId,
|
|
47
|
+
onSubmit: handleSubmit,
|
|
48
|
+
children: [
|
|
49
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.FormControl, {
|
|
50
|
+
fullWidth: true,
|
|
51
|
+
margin: "normal",
|
|
52
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
|
|
53
|
+
required: true,
|
|
54
|
+
label: "Name",
|
|
55
|
+
variant: "outlined",
|
|
56
|
+
value: title,
|
|
57
|
+
onChange: (e)=>setTitle(e.target.value)
|
|
58
|
+
})
|
|
59
|
+
}),
|
|
60
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.FormControl, {
|
|
61
|
+
fullWidth: true,
|
|
62
|
+
margin: "normal",
|
|
63
|
+
children: [
|
|
64
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.InputLabel, {
|
|
65
|
+
id: "select-collapse-state",
|
|
66
|
+
children: "Collapse State"
|
|
67
|
+
}),
|
|
68
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Select, {
|
|
69
|
+
required: true,
|
|
70
|
+
displayEmpty: true,
|
|
71
|
+
labelId: "select-collapse-state",
|
|
72
|
+
label: "Collapse State",
|
|
73
|
+
size: "small",
|
|
74
|
+
value: isCollapsed ? 'Closed' : 'Open',
|
|
75
|
+
onChange: handleCollapsedChange,
|
|
76
|
+
children: [
|
|
77
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.MenuItem, {
|
|
78
|
+
value: "Open",
|
|
79
|
+
children: "Open"
|
|
80
|
+
}),
|
|
81
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.MenuItem, {
|
|
82
|
+
value: "Closed",
|
|
83
|
+
children: "Closed"
|
|
84
|
+
})
|
|
85
|
+
]
|
|
86
|
+
})
|
|
87
|
+
]
|
|
88
|
+
})
|
|
89
|
+
]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
const panelGroupEditorFormId = 'panel-group-editor-form';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright 2022 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
_exportStar(require("./PanelGroupDialog"), exports);
|
|
18
|
+
_exportStar(require("./DeletePanelGroupDialog"), exports);
|
|
19
|
+
function _exportStar(from, to) {
|
|
20
|
+
Object.keys(from).forEach(function(k) {
|
|
21
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function() {
|
|
24
|
+
return from[k];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
return from;
|
|
29
|
+
}
|
|
@@ -29,7 +29,6 @@ const _react = require("react");
|
|
|
29
29
|
const _material = require("@mui/material");
|
|
30
30
|
const _components = require("@perses-dev/components");
|
|
31
31
|
const _core = require("@perses-dev/core");
|
|
32
|
-
const _pluginSystem = require("@perses-dev/plugin-system");
|
|
33
32
|
const _context = require("../../context");
|
|
34
33
|
const TIME_OPTIONS = [
|
|
35
34
|
{
|
|
@@ -88,14 +87,14 @@ const TIME_OPTIONS = [
|
|
|
88
87
|
}
|
|
89
88
|
];
|
|
90
89
|
function TimeRangeControls() {
|
|
91
|
-
const { timeRange , setTimeRange } = (0,
|
|
92
|
-
const { dashboard } = (0, _context.useDashboard)();
|
|
93
|
-
const { queryString } = (0, _pluginSystem.useQueryString)();
|
|
94
|
-
const defaultTimeRange = (0, _core.getDefaultTimeRange)(dashboard.duration, queryString);
|
|
95
|
-
// selected form value can be relative or absolute, timeRange from plugin-system is only absolute
|
|
96
|
-
const [selectedTimeRange, setSelectedTimeRange] = (0, _react.useState)(defaultTimeRange);
|
|
90
|
+
const { timeRange , setTimeRange } = (0, _context.useDashboardTimeRange)();
|
|
97
91
|
const [showCustomDateSelector, setShowCustomDateSelector] = (0, _react.useState)(false);
|
|
98
92
|
const anchorEl = (0, _react.useRef)();
|
|
93
|
+
const convertedTimeRange = (0, _react.useMemo)(()=>{
|
|
94
|
+
return (0, _core.isRelativeTimeRange)(timeRange) ? (0, _core.toAbsoluteTimeRange)(timeRange) : timeRange;
|
|
95
|
+
}, [
|
|
96
|
+
timeRange
|
|
97
|
+
]);
|
|
99
98
|
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
100
99
|
direction: "row",
|
|
101
100
|
spacing: 1,
|
|
@@ -112,10 +111,9 @@ function TimeRangeControls() {
|
|
|
112
111
|
padding: theme.spacing(2)
|
|
113
112
|
}),
|
|
114
113
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.AbsoluteTimePicker, {
|
|
115
|
-
initialTimeRange:
|
|
114
|
+
initialTimeRange: convertedTimeRange,
|
|
116
115
|
onChange: (timeRange)=>{
|
|
117
116
|
setTimeRange(timeRange);
|
|
118
|
-
setSelectedTimeRange(timeRange);
|
|
119
117
|
setShowCustomDateSelector(false);
|
|
120
118
|
}
|
|
121
119
|
})
|
|
@@ -126,7 +124,7 @@ function TimeRangeControls() {
|
|
|
126
124
|
ref: anchorEl,
|
|
127
125
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.TimeRangeSelector, {
|
|
128
126
|
timeOptions: TIME_OPTIONS,
|
|
129
|
-
value:
|
|
127
|
+
value: timeRange,
|
|
130
128
|
onSelectChange: (event)=>{
|
|
131
129
|
const duration = event.target.value;
|
|
132
130
|
const relativeTimeInput = {
|
|
@@ -134,7 +132,6 @@ function TimeRangeControls() {
|
|
|
134
132
|
end: new Date()
|
|
135
133
|
};
|
|
136
134
|
setTimeRange(relativeTimeInput);
|
|
137
|
-
setSelectedTimeRange(relativeTimeInput);
|
|
138
135
|
setShowCustomDateSelector(false);
|
|
139
136
|
},
|
|
140
137
|
onCustomClick: ()=>{
|
|
@@ -15,8 +15,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
17
|
const _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
+
const _reactRouter = require("react-router");
|
|
19
|
+
const _history = require("history");
|
|
18
20
|
const _userEvent = /*#__PURE__*/ _interopRequireDefault(require("@testing-library/user-event"));
|
|
19
|
-
const _core = require("@perses-dev/core");
|
|
20
21
|
const _react = require("@testing-library/react");
|
|
21
22
|
const _test = require("../../test");
|
|
22
23
|
const _testDashboard = /*#__PURE__*/ _interopRequireDefault(require("../../test/testDashboard"));
|
|
@@ -27,31 +28,37 @@ function _interopRequireDefault(obj) {
|
|
|
27
28
|
default: obj
|
|
28
29
|
};
|
|
29
30
|
}
|
|
31
|
+
const history = (0, _history.createMemoryHistory)({
|
|
32
|
+
initialEntries: [
|
|
33
|
+
(0, _reactRouter.generatePath)('/dashboards/:id', {
|
|
34
|
+
id: 'test'
|
|
35
|
+
})
|
|
36
|
+
]
|
|
37
|
+
});
|
|
30
38
|
describe('TimeRangeControls', ()=>{
|
|
31
39
|
let initialState;
|
|
40
|
+
const testDefaultTimeRange = {
|
|
41
|
+
pastDuration: _testDashboard.default.spec.duration
|
|
42
|
+
};
|
|
32
43
|
beforeEach(()=>{
|
|
33
44
|
initialState = {
|
|
34
45
|
dashboardSpec: _testDashboard.default.spec
|
|
35
46
|
};
|
|
36
47
|
});
|
|
37
48
|
const renderTimeRangeControls = ()=>{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
initialState: initialState,
|
|
44
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_context.TimeRangeProvider, {
|
|
45
|
-
initialTimeRange: defaultTimeRange,
|
|
46
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_timeRangeControls.TimeRangeControls, {})
|
|
47
|
-
})
|
|
49
|
+
(0, _test.renderWithContext)(/*#__PURE__*/ (0, _jsxRuntime.jsx)(_context.DashboardProvider, {
|
|
50
|
+
initialState: initialState,
|
|
51
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_context.TimeRangeProvider, {
|
|
52
|
+
timeRange: testDefaultTimeRange,
|
|
53
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_timeRangeControls.TimeRangeControls, {})
|
|
48
54
|
})
|
|
49
|
-
}));
|
|
55
|
+
}), undefined, history);
|
|
50
56
|
};
|
|
51
57
|
it('should render correct initial relative time shortcut', async ()=>{
|
|
52
58
|
renderTimeRangeControls();
|
|
53
|
-
expect(_react.screen.getByText('Last
|
|
59
|
+
expect(_react.screen.getByText('Last 5 minutes')).toBeInTheDocument();
|
|
54
60
|
});
|
|
61
|
+
// TODO: fix setTimeRange no-op, test query params
|
|
55
62
|
it('should be able to select the first option', ()=>{
|
|
56
63
|
renderTimeRangeControls();
|
|
57
64
|
const dateButton = _react.screen.getByRole('button');
|
|
@@ -51,7 +51,7 @@ function TemplateVariable({ name }) {
|
|
|
51
51
|
return Object.values(v).map((v)=>JSON.stringify(v.value)).join(',');
|
|
52
52
|
}
|
|
53
53
|
function ListVariable({ name }) {
|
|
54
|
-
var ref, ref1, ref2;
|
|
54
|
+
var ref, ref1, ref2, ref3;
|
|
55
55
|
const ctx = (0, _context.useTemplateVariable)(name);
|
|
56
56
|
const definition = ctx.definition;
|
|
57
57
|
const { data: variablePlugin } = (0, _pluginSystem.usePlugin)('Variable', definition.spec.plugin.kind);
|
|
@@ -65,6 +65,8 @@ function ListVariable({ name }) {
|
|
|
65
65
|
const variables = (0, _pluginSystem.useTemplateVariableValues)(dependsOnVariables);
|
|
66
66
|
const allowMultiple = (definition === null || definition === void 0 ? void 0 : definition.spec.allow_multiple) === true;
|
|
67
67
|
const allowAllValue = (definition === null || definition === void 0 ? void 0 : definition.spec.allow_all_value) === true;
|
|
68
|
+
var ref4;
|
|
69
|
+
const label = (ref4 = (ref = definition === null || definition === void 0 ? void 0 : definition.spec.display) === null || ref === void 0 ? void 0 : ref.label) !== null && ref4 !== void 0 ? ref4 : name;
|
|
68
70
|
let waitToLoad = false;
|
|
69
71
|
if (dependsOnVariables) {
|
|
70
72
|
waitToLoad = dependsOnVariables.some((v)=>{
|
|
@@ -98,9 +100,9 @@ function ListVariable({ name }) {
|
|
|
98
100
|
setVariableLoading,
|
|
99
101
|
setVariableOptions
|
|
100
102
|
]);
|
|
101
|
-
let value = (
|
|
102
|
-
const options = (
|
|
103
|
-
const loading = (
|
|
103
|
+
let value = (ref1 = ctx.state) === null || ref1 === void 0 ? void 0 : ref1.value;
|
|
104
|
+
const options = (ref2 = ctx.state) === null || ref2 === void 0 ? void 0 : ref2.options;
|
|
105
|
+
const loading = (ref3 = ctx.state) === null || ref3 === void 0 ? void 0 : ref3.loading;
|
|
104
106
|
// Make sure value is an array if allowMultiple is true
|
|
105
107
|
if (allowMultiple && !Array.isArray(value)) {
|
|
106
108
|
value = typeof value === 'string' ? [
|
|
@@ -152,10 +154,11 @@ function ListVariable({ name }) {
|
|
|
152
154
|
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
|
|
153
155
|
display: 'flex',
|
|
154
156
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.FormControl, {
|
|
157
|
+
fullWidth: true,
|
|
155
158
|
children: [
|
|
156
159
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.InputLabel, {
|
|
157
160
|
id: name,
|
|
158
|
-
children:
|
|
161
|
+
children: label
|
|
159
162
|
}),
|
|
160
163
|
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Select, {
|
|
161
164
|
sx: {
|
|
@@ -195,13 +198,19 @@ function ListVariable({ name }) {
|
|
|
195
198
|
}
|
|
196
199
|
function TextVariable({ name }) {
|
|
197
200
|
const { state } = (0, _context.useTemplateVariable)(name);
|
|
198
|
-
|
|
199
|
-
const
|
|
200
|
-
const
|
|
201
|
+
var ref;
|
|
202
|
+
const [tempValue, setTempValue] = (0, _react.useState)((ref = state === null || state === void 0 ? void 0 : state.value) !== null && ref !== void 0 ? ref : '');
|
|
203
|
+
const { setVariableValue } = (0, _context.useTemplateVariableActions)();
|
|
204
|
+
(0, _react.useEffect)(()=>{
|
|
205
|
+
var ref;
|
|
206
|
+
setTempValue((ref = state === null || state === void 0 ? void 0 : state.value) !== null && ref !== void 0 ? ref : '');
|
|
207
|
+
}, [
|
|
208
|
+
state === null || state === void 0 ? void 0 : state.value
|
|
209
|
+
]);
|
|
201
210
|
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
onBlur: (
|
|
211
|
+
value: tempValue,
|
|
212
|
+
onChange: (e)=>setTempValue(e.target.value),
|
|
213
|
+
onBlur: ()=>setVariableValue(name, tempValue),
|
|
205
214
|
placeholder: name,
|
|
206
215
|
label: name
|
|
207
216
|
});
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
// Copyright 2022 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "VariableEditor", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>VariableEditor
|
|
20
|
+
});
|
|
21
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
+
const _react = require("react");
|
|
23
|
+
const _material = require("@mui/material");
|
|
24
|
+
const _useImmer = require("use-immer");
|
|
25
|
+
const _pencil = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/Pencil"));
|
|
26
|
+
const _trashCan = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/TrashCan"));
|
|
27
|
+
const _arrowUp = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/ArrowUp"));
|
|
28
|
+
const _arrowDown = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/ArrowDown"));
|
|
29
|
+
const _variableEditorForm = require("./VariableEditorForm");
|
|
30
|
+
function _interopRequireDefault(obj) {
|
|
31
|
+
return obj && obj.__esModule ? obj : {
|
|
32
|
+
default: obj
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function VariableEditor(props) {
|
|
36
|
+
const [variableDefinitions, setVariableDefinitions] = (0, _useImmer.useImmer)(props.variableDefinitions);
|
|
37
|
+
const [variableEditIdx, setVariableEditIdx] = (0, _react.useState)(null);
|
|
38
|
+
const currentEditingVariableDefinition = typeof variableEditIdx === 'number' && variableDefinitions[variableEditIdx];
|
|
39
|
+
const removeVariable = (index)=>{
|
|
40
|
+
setVariableDefinitions((draft)=>{
|
|
41
|
+
draft.splice(index, 1);
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
const addVariable = ()=>{
|
|
45
|
+
setVariableDefinitions((draft)=>{
|
|
46
|
+
draft.push({
|
|
47
|
+
kind: 'TextVariable',
|
|
48
|
+
spec: {
|
|
49
|
+
name: 'NewVariable',
|
|
50
|
+
value: ''
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
const toggleVariableVisibility = (index, visible)=>{
|
|
56
|
+
setVariableDefinitions((draft)=>{
|
|
57
|
+
const v = draft[index];
|
|
58
|
+
if (!v) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (!v.spec.display) {
|
|
62
|
+
v.spec.display = {
|
|
63
|
+
hidden: false
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
v.spec.display.hidden = visible === false;
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
const changeVariableOrder = (index, direction)=>{
|
|
70
|
+
setVariableDefinitions((draft)=>{
|
|
71
|
+
if (direction === 'up') {
|
|
72
|
+
const prevElement = draft[index - 1];
|
|
73
|
+
const currentElement = draft[index];
|
|
74
|
+
if (index === 0 || !prevElement || !currentElement) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
draft[index - 1] = currentElement;
|
|
78
|
+
draft[index] = prevElement;
|
|
79
|
+
} else {
|
|
80
|
+
const nextElement = draft[index + 1];
|
|
81
|
+
const currentElement1 = draft[index];
|
|
82
|
+
if (index === draft.length - 1 || !nextElement || !currentElement1) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
draft[index + 1] = currentElement1;
|
|
86
|
+
draft[index] = nextElement;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Box, {
|
|
91
|
+
p: 4,
|
|
92
|
+
children: [
|
|
93
|
+
currentEditingVariableDefinition && /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
94
|
+
children: [
|
|
95
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
|
|
96
|
+
variant: "h3",
|
|
97
|
+
mb: 2,
|
|
98
|
+
children: "Edit Variable"
|
|
99
|
+
}),
|
|
100
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_variableEditorForm.VariableEditForm, {
|
|
101
|
+
initialVariableDefinition: currentEditingVariableDefinition,
|
|
102
|
+
onChange: (definition)=>{
|
|
103
|
+
setVariableDefinitions((draft)=>{
|
|
104
|
+
draft[variableEditIdx] = definition;
|
|
105
|
+
setVariableEditIdx(null);
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
onCancel: ()=>setVariableEditIdx(null)
|
|
109
|
+
})
|
|
110
|
+
]
|
|
111
|
+
}),
|
|
112
|
+
!currentEditingVariableDefinition && /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
113
|
+
children: [
|
|
114
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
115
|
+
direction: "row",
|
|
116
|
+
spacing: 1,
|
|
117
|
+
justifyContent: "end",
|
|
118
|
+
children: [
|
|
119
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
|
|
120
|
+
onClick: ()=>{
|
|
121
|
+
props.onCancel();
|
|
122
|
+
},
|
|
123
|
+
children: "Cancel"
|
|
124
|
+
}),
|
|
125
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
|
|
126
|
+
disabled: props.variableDefinitions === variableDefinitions,
|
|
127
|
+
variant: "contained",
|
|
128
|
+
onClick: ()=>{
|
|
129
|
+
props.onChange(variableDefinitions);
|
|
130
|
+
},
|
|
131
|
+
children: "Apply Changes"
|
|
132
|
+
})
|
|
133
|
+
]
|
|
134
|
+
}),
|
|
135
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
|
|
136
|
+
variant: "h3",
|
|
137
|
+
mb: 2,
|
|
138
|
+
children: "Variable List"
|
|
139
|
+
}),
|
|
140
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
141
|
+
spacing: 2,
|
|
142
|
+
children: [
|
|
143
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TableContainer, {
|
|
144
|
+
component: _material.Paper,
|
|
145
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Table, {
|
|
146
|
+
sx: {
|
|
147
|
+
minWidth: 650
|
|
148
|
+
},
|
|
149
|
+
"aria-label": "simple table",
|
|
150
|
+
children: [
|
|
151
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TableHead, {
|
|
152
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.TableRow, {
|
|
153
|
+
children: [
|
|
154
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TableCell, {
|
|
155
|
+
children: "Visibility"
|
|
156
|
+
}),
|
|
157
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TableCell, {
|
|
158
|
+
children: "Variable Name"
|
|
159
|
+
}),
|
|
160
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TableCell, {
|
|
161
|
+
children: "Variable Type"
|
|
162
|
+
}),
|
|
163
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TableCell, {
|
|
164
|
+
align: "right",
|
|
165
|
+
children: "Action"
|
|
166
|
+
})
|
|
167
|
+
]
|
|
168
|
+
})
|
|
169
|
+
}),
|
|
170
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TableBody, {
|
|
171
|
+
children: variableDefinitions.map((v, idx)=>{
|
|
172
|
+
var ref;
|
|
173
|
+
/*#__PURE__*/ return (0, _jsxRuntime.jsxs)(_material.TableRow, {
|
|
174
|
+
children: [
|
|
175
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TableCell, {
|
|
176
|
+
component: "th",
|
|
177
|
+
scope: "row",
|
|
178
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Switch, {
|
|
179
|
+
checked: ((ref = v.spec.display) === null || ref === void 0 ? void 0 : ref.hidden) !== true,
|
|
180
|
+
onChange: (e)=>{
|
|
181
|
+
toggleVariableVisibility(idx, e.target.checked);
|
|
182
|
+
}
|
|
183
|
+
})
|
|
184
|
+
}),
|
|
185
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TableCell, {
|
|
186
|
+
component: "th",
|
|
187
|
+
scope: "row",
|
|
188
|
+
sx: {
|
|
189
|
+
fontWeight: 'bold'
|
|
190
|
+
},
|
|
191
|
+
children: v.spec.name
|
|
192
|
+
}),
|
|
193
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TableCell, {
|
|
194
|
+
children: v.kind
|
|
195
|
+
}),
|
|
196
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.TableCell, {
|
|
197
|
+
align: "right",
|
|
198
|
+
children: [
|
|
199
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
200
|
+
onClick: ()=>changeVariableOrder(idx, 'up'),
|
|
201
|
+
disabled: idx === 0,
|
|
202
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_arrowUp.default, {})
|
|
203
|
+
}),
|
|
204
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
205
|
+
onClick: ()=>changeVariableOrder(idx, 'down'),
|
|
206
|
+
disabled: idx === variableDefinitions.length - 1,
|
|
207
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_arrowDown.default, {})
|
|
208
|
+
}),
|
|
209
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
210
|
+
onClick: ()=>setVariableEditIdx(idx),
|
|
211
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pencil.default, {})
|
|
212
|
+
}),
|
|
213
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
214
|
+
onClick: ()=>removeVariable(idx),
|
|
215
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_trashCan.default, {})
|
|
216
|
+
})
|
|
217
|
+
]
|
|
218
|
+
})
|
|
219
|
+
]
|
|
220
|
+
}, v.spec.name);
|
|
221
|
+
})
|
|
222
|
+
})
|
|
223
|
+
]
|
|
224
|
+
})
|
|
225
|
+
}),
|
|
226
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
|
|
227
|
+
display: "flex",
|
|
228
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
|
|
229
|
+
onClick: addVariable,
|
|
230
|
+
variant: "contained",
|
|
231
|
+
children: "Add New Variable"
|
|
232
|
+
})
|
|
233
|
+
})
|
|
234
|
+
]
|
|
235
|
+
})
|
|
236
|
+
]
|
|
237
|
+
})
|
|
238
|
+
]
|
|
239
|
+
});
|
|
240
|
+
}
|