@perses-dev/dashboards 0.24.0 → 0.25.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/AddPanelButton/AddPanelButton.js +9 -2
- package/dist/cjs/components/Dashboard/Dashboard.js +23 -6
- package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +8 -17
- package/dist/cjs/components/EditButton/EditButton.js +41 -0
- package/dist/cjs/components/EditButton/index.js +28 -0
- package/dist/cjs/components/EditJsonButton/EditJsonButton.js +42 -0
- package/dist/cjs/components/EditJsonButton/index.js +28 -0
- package/dist/cjs/components/EditJsonDialog/EditJsonDialog.js +86 -0
- package/dist/cjs/components/EditJsonDialog/index.js +28 -0
- package/dist/cjs/components/EmptyDashboard/EmptyDashboard.js +127 -0
- package/dist/cjs/components/EmptyDashboard/index.js +28 -0
- package/dist/cjs/components/QuerySummaryTable/QuerySummaryTable.js +185 -0
- package/dist/cjs/components/QuerySummaryTable/index.js +28 -0
- package/dist/cjs/components/ToolbarIconButton/ToolbarIconButton.js +6 -3
- package/dist/cjs/components/Variables/EditVariablesButton.js +9 -2
- package/dist/cjs/components/index.js +4 -0
- package/dist/cjs/constants/user-interface-text.js +1 -0
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +12 -6
- package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +10 -1
- package/dist/cjs/context/DashboardProvider/edit-json-dialog-slice.js +36 -0
- package/dist/cjs/context/DatasourceStoreProvider.js +9 -3
- package/dist/cjs/stories/decorators/WithDashboard.js +60 -0
- package/dist/cjs/stories/decorators/WithPluginRegistry.js +91 -0
- package/dist/cjs/stories/decorators/WithQueryClient.js +29 -0
- package/dist/cjs/stories/decorators/WithQueryParams.js +29 -0
- package/dist/cjs/stories/decorators/WithTemplateVariables.js +27 -0
- package/dist/cjs/stories/decorators/index.js +32 -0
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +11 -4
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +2 -1
- package/dist/components/AddPanelButton/AddPanelButton.d.ts +16 -1
- package/dist/components/AddPanelButton/AddPanelButton.d.ts.map +1 -1
- package/dist/components/AddPanelButton/AddPanelButton.js +9 -2
- package/dist/components/AddPanelButton/AddPanelButton.js.map +1 -1
- package/dist/components/Dashboard/Dashboard.d.ts +10 -2
- package/dist/components/Dashboard/Dashboard.d.ts.map +1 -1
- package/dist/components/Dashboard/Dashboard.js +24 -7
- package/dist/components/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.js +8 -12
- package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
- package/dist/components/EditButton/EditButton.d.ts +13 -0
- package/dist/components/EditButton/EditButton.d.ts.map +1 -0
- package/dist/components/EditButton/EditButton.js +30 -0
- package/dist/components/EditButton/EditButton.js.map +1 -0
- package/dist/components/EditButton/index.d.ts +2 -0
- package/dist/components/EditButton/index.d.ts.map +1 -0
- package/dist/components/EditButton/index.js +15 -0
- package/dist/components/EditButton/index.js.map +1 -0
- package/dist/components/EditJsonButton/EditJsonButton.d.ts +3 -0
- package/dist/components/EditJsonButton/EditJsonButton.d.ts.map +1 -0
- package/dist/components/EditJsonButton/EditJsonButton.js +31 -0
- package/dist/components/EditJsonButton/EditJsonButton.js.map +1 -0
- package/dist/components/EditJsonButton/index.d.ts +2 -0
- package/dist/components/EditJsonButton/index.d.ts.map +1 -0
- package/dist/components/EditJsonButton/index.js +15 -0
- package/dist/components/EditJsonButton/index.js.map +1 -0
- package/dist/components/EditJsonDialog/EditJsonDialog.d.ts +3 -0
- package/dist/components/EditJsonDialog/EditJsonDialog.d.ts.map +1 -0
- package/dist/components/EditJsonDialog/EditJsonDialog.js +80 -0
- package/dist/components/EditJsonDialog/EditJsonDialog.js.map +1 -0
- package/dist/components/EditJsonDialog/index.d.ts +2 -0
- package/dist/components/EditJsonDialog/index.d.ts.map +1 -0
- package/dist/components/EditJsonDialog/index.js +15 -0
- package/dist/components/EditJsonDialog/index.js.map +1 -0
- package/dist/components/EmptyDashboard/EmptyDashboard.d.ts +33 -0
- package/dist/components/EmptyDashboard/EmptyDashboard.d.ts.map +1 -0
- package/dist/components/EmptyDashboard/EmptyDashboard.js +123 -0
- package/dist/components/EmptyDashboard/EmptyDashboard.js.map +1 -0
- package/dist/components/EmptyDashboard/index.d.ts +2 -0
- package/dist/components/EmptyDashboard/index.d.ts.map +1 -0
- package/dist/components/EmptyDashboard/index.js +15 -0
- package/dist/components/EmptyDashboard/index.js.map +1 -0
- package/dist/components/QuerySummaryTable/QuerySummaryTable.d.ts +11 -0
- package/dist/components/QuerySummaryTable/QuerySummaryTable.d.ts.map +1 -0
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js +179 -0
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -0
- package/dist/components/QuerySummaryTable/index.d.ts +2 -0
- package/dist/components/QuerySummaryTable/index.d.ts.map +1 -0
- package/dist/components/QuerySummaryTable/index.js +15 -0
- package/dist/components/QuerySummaryTable/index.js.map +1 -0
- package/dist/components/ToolbarIconButton/ToolbarIconButton.d.ts +1 -1
- package/dist/components/ToolbarIconButton/ToolbarIconButton.d.ts.map +1 -1
- package/dist/components/ToolbarIconButton/ToolbarIconButton.js +6 -3
- package/dist/components/ToolbarIconButton/ToolbarIconButton.js.map +1 -1
- package/dist/components/Variables/EditVariablesButton.d.ts +16 -1
- package/dist/components/Variables/EditVariablesButton.d.ts.map +1 -1
- package/dist/components/Variables/EditVariablesButton.js +9 -2
- package/dist/components/Variables/EditVariablesButton.js.map +1 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +4 -0
- package/dist/components/index.js.map +1 -1
- package/dist/constants/user-interface-text.d.ts +1 -0
- package/dist/constants/user-interface-text.d.ts.map +1 -1
- package/dist/constants/user-interface-text.js +1 -0
- package/dist/constants/user-interface-text.js.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.d.ts +2 -1
- package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.js +12 -6
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +8 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.js +10 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
- package/dist/context/DashboardProvider/edit-json-dialog-slice.d.ts +12 -0
- package/dist/context/DashboardProvider/edit-json-dialog-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/edit-json-dialog-slice.js +30 -0
- package/dist/context/DashboardProvider/edit-json-dialog-slice.js.map +1 -0
- package/dist/context/DatasourceStoreProvider.d.ts +2 -0
- package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
- package/dist/context/DatasourceStoreProvider.js +9 -3
- package/dist/context/DatasourceStoreProvider.js.map +1 -1
- package/dist/stories/decorators/WithDashboard.js +48 -0
- package/dist/stories/decorators/WithDashboard.js.map +1 -0
- package/dist/stories/decorators/WithPluginRegistry.js +46 -0
- package/dist/stories/decorators/WithPluginRegistry.js.map +1 -0
- package/dist/stories/decorators/WithQueryClient.js +23 -0
- package/dist/stories/decorators/WithQueryClient.js.map +1 -0
- package/dist/stories/decorators/WithQueryParams.js +23 -0
- package/dist/stories/decorators/WithQueryParams.js.map +1 -0
- package/dist/stories/decorators/WithTemplateVariables.js +21 -0
- package/dist/stories/decorators/WithTemplateVariables.js.map +1 -0
- package/dist/stories/decorators/index.js +19 -0
- package/dist/stories/decorators/index.js.map +1 -0
- package/dist/views/ViewDashboard/DashboardApp.d.ts +2 -0
- package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.js +12 -5
- package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.d.ts +2 -8
- package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.js +2 -1
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
- package/package.json +4 -4
|
@@ -29,7 +29,7 @@ function _interopRequireDefault(obj) {
|
|
|
29
29
|
default: obj
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
const AddPanelButton = ()=>{
|
|
32
|
+
const AddPanelButton = ({ variant ='text' , color ='primary' , label ='Panel' , fullWidth })=>{
|
|
33
33
|
const { openAddPanel } = (0, _context.useDashboardActions)();
|
|
34
34
|
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.InfoTooltip, {
|
|
35
35
|
description: _constants.TOOLTIP_TEXT.addPanel,
|
|
@@ -37,7 +37,14 @@ const AddPanelButton = ()=>{
|
|
|
37
37
|
startIcon: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_chartBoxPlusOutline.default, {}),
|
|
38
38
|
onClick: openAddPanel,
|
|
39
39
|
"aria-label": _constants.TOOLTIP_TEXT.addPanel,
|
|
40
|
-
|
|
40
|
+
variant: variant,
|
|
41
|
+
color: color,
|
|
42
|
+
fullWidth: fullWidth,
|
|
43
|
+
sx: {
|
|
44
|
+
whiteSpace: 'nowrap',
|
|
45
|
+
minWidth: 'auto'
|
|
46
|
+
},
|
|
47
|
+
children: label
|
|
41
48
|
})
|
|
42
49
|
});
|
|
43
50
|
};
|
|
@@ -23,15 +23,32 @@ const _material = require("@mui/material");
|
|
|
23
23
|
const _components = require("@perses-dev/components");
|
|
24
24
|
const _context = require("../../context");
|
|
25
25
|
const _gridLayout = require("../GridLayout");
|
|
26
|
-
|
|
26
|
+
const _emptyDashboard = require("../EmptyDashboard");
|
|
27
|
+
function Dashboard({ emptyDashboardProps , ...boxProps }) {
|
|
27
28
|
const panelGroupIds = (0, _context.usePanelGroupIds)();
|
|
29
|
+
const isEmpty = !panelGroupIds.length;
|
|
28
30
|
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
|
|
29
|
-
...
|
|
30
|
-
|
|
31
|
+
...boxProps,
|
|
32
|
+
sx: {
|
|
33
|
+
height: '100%'
|
|
34
|
+
},
|
|
35
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_components.ErrorBoundary, {
|
|
31
36
|
FallbackComponent: _components.ErrorAlert,
|
|
32
|
-
children:
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
children: [
|
|
38
|
+
isEmpty && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
|
|
39
|
+
sx: {
|
|
40
|
+
height: '100%',
|
|
41
|
+
display: 'flex',
|
|
42
|
+
alignItems: 'center'
|
|
43
|
+
},
|
|
44
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_emptyDashboard.EmptyDashboard, {
|
|
45
|
+
...emptyDashboardProps
|
|
46
|
+
})
|
|
47
|
+
}),
|
|
48
|
+
!isEmpty && panelGroupIds.map((panelGroupId)=>/*#__PURE__*/ (0, _jsxRuntime.jsx)(_gridLayout.GridLayout, {
|
|
49
|
+
panelGroupId: panelGroupId
|
|
50
|
+
}, panelGroupId))
|
|
51
|
+
]
|
|
35
52
|
})
|
|
36
53
|
});
|
|
37
54
|
}
|
|
@@ -21,7 +21,6 @@ Object.defineProperty(exports, "DashboardToolbar", {
|
|
|
21
21
|
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
22
|
const _react = require("react");
|
|
23
23
|
const _material = require("@mui/material");
|
|
24
|
-
const _pencilOutline = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/PencilOutline"));
|
|
25
24
|
const _components = require("@perses-dev/components");
|
|
26
25
|
const _context = require("../../context");
|
|
27
26
|
const _addPanelButton = require("../AddPanelButton");
|
|
@@ -29,11 +28,8 @@ const _addGroupButton = require("../AddGroupButton");
|
|
|
29
28
|
const _downloadButton = require("../DownloadButton");
|
|
30
29
|
const _timeRangeControls = require("../TimeRangeControls");
|
|
31
30
|
const _variables = require("../Variables");
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
default: obj
|
|
35
|
-
};
|
|
36
|
-
}
|
|
31
|
+
const _editButton = require("../EditButton");
|
|
32
|
+
const _editJsonButton = require("../EditJsonButton");
|
|
37
33
|
const DashboardToolbar = (props)=>{
|
|
38
34
|
const { dashboardName , dashboardTitleComponent , initialVariableIsSticky , isReadonly , onEditButtonClick , onCancelButtonClick , onSave , } = props;
|
|
39
35
|
const dashboard = (0, _context.useDashboard)();
|
|
@@ -130,7 +126,8 @@ const DashboardToolbar = (props)=>{
|
|
|
130
126
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_addPanelButton.AddPanelButton, {}),
|
|
131
127
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_addGroupButton.AddGroupButton, {}),
|
|
132
128
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_timeRangeControls.TimeRangeControls, {}),
|
|
133
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_downloadButton.DownloadButton, {})
|
|
129
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_downloadButton.DownloadButton, {}),
|
|
130
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_editJsonButton.EditJsonButton, {})
|
|
134
131
|
]
|
|
135
132
|
}) : // On smaller screens, make it two rows
|
|
136
133
|
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
@@ -145,7 +142,8 @@ const DashboardToolbar = (props)=>{
|
|
|
145
142
|
},
|
|
146
143
|
children: [
|
|
147
144
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_timeRangeControls.TimeRangeControls, {}),
|
|
148
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_downloadButton.DownloadButton, {})
|
|
145
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_downloadButton.DownloadButton, {}),
|
|
146
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_editJsonButton.EditJsonButton, {})
|
|
149
147
|
]
|
|
150
148
|
}),
|
|
151
149
|
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
@@ -185,15 +183,8 @@ const DashboardToolbar = (props)=>{
|
|
|
185
183
|
children: [
|
|
186
184
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_timeRangeControls.TimeRangeControls, {}),
|
|
187
185
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_downloadButton.DownloadButton, {}),
|
|
188
|
-
isBiggerThanSm && /*#__PURE__*/ (0, _jsxRuntime.jsx)(
|
|
189
|
-
|
|
190
|
-
color: "secondary",
|
|
191
|
-
startIcon: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pencilOutline.default, {}),
|
|
192
|
-
onClick: onEditButtonClick,
|
|
193
|
-
sx: {
|
|
194
|
-
marginLeft: 'auto'
|
|
195
|
-
},
|
|
196
|
-
children: "Edit"
|
|
186
|
+
isBiggerThanSm && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_editButton.EditButton, {
|
|
187
|
+
onClick: onEditButtonClick
|
|
197
188
|
})
|
|
198
189
|
]
|
|
199
190
|
})
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Copyright 2023 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, "EditButton", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>EditButton
|
|
20
|
+
});
|
|
21
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
+
const _material = require("@mui/material");
|
|
23
|
+
const _pencilOutline = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/PencilOutline"));
|
|
24
|
+
function _interopRequireDefault(obj) {
|
|
25
|
+
return obj && obj.__esModule ? obj : {
|
|
26
|
+
default: obj
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const EditButton = ({ label ='Edit' , onClick })=>{
|
|
30
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
|
|
31
|
+
onClick: onClick,
|
|
32
|
+
startIcon: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pencilOutline.default, {}),
|
|
33
|
+
variant: "outlined",
|
|
34
|
+
color: "secondary",
|
|
35
|
+
sx: {
|
|
36
|
+
whiteSpace: 'nowrap',
|
|
37
|
+
minWidth: 'auto'
|
|
38
|
+
},
|
|
39
|
+
children: label
|
|
40
|
+
});
|
|
41
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright 2023 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("./EditButton"), exports);
|
|
18
|
+
function _exportStar(from, to) {
|
|
19
|
+
Object.keys(from).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function() {
|
|
23
|
+
return from[k];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
return from;
|
|
28
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Copyright 2023 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, "EditJsonButton", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>EditJsonButton
|
|
20
|
+
});
|
|
21
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
+
const _codeBraces = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/CodeBraces"));
|
|
23
|
+
const _components = require("@perses-dev/components");
|
|
24
|
+
const _constants = require("../../constants");
|
|
25
|
+
const _toolbarIconButton = require("../ToolbarIconButton");
|
|
26
|
+
const _context = require("../../context");
|
|
27
|
+
function _interopRequireDefault(obj) {
|
|
28
|
+
return obj && obj.__esModule ? obj : {
|
|
29
|
+
default: obj
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const EditJsonButton = ()=>{
|
|
33
|
+
const { openEditJsonDialog } = (0, _context.useEditJsonDialog)();
|
|
34
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.InfoTooltip, {
|
|
35
|
+
description: _constants.TOOLTIP_TEXT.editJson,
|
|
36
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_toolbarIconButton.ToolbarIconButton, {
|
|
37
|
+
variant: "outlined",
|
|
38
|
+
onClick: ()=>openEditJsonDialog(),
|
|
39
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_codeBraces.default, {})
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright 2023 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("./EditJsonButton"), exports);
|
|
18
|
+
function _exportStar(from, to) {
|
|
19
|
+
Object.keys(from).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function() {
|
|
23
|
+
return from[k];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
return from;
|
|
28
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// Copyright 2023 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, "EditJsonDialog", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>EditJsonDialog
|
|
20
|
+
});
|
|
21
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
+
const _react = require("react");
|
|
23
|
+
const _material = require("@mui/material");
|
|
24
|
+
const _components = require("@perses-dev/components");
|
|
25
|
+
const _dashboardProvider = require("../../context/DashboardProvider");
|
|
26
|
+
const _useDashboard = require("../../context/useDashboard");
|
|
27
|
+
const EditJsonDialog = ()=>{
|
|
28
|
+
const { editJsonDialog , closeEditJsonDialog } = (0, _dashboardProvider.useEditJsonDialog)();
|
|
29
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_components.Dialog, {
|
|
30
|
+
open: !!(editJsonDialog === null || editJsonDialog === void 0 ? void 0 : editJsonDialog.isOpen),
|
|
31
|
+
scroll: "paper",
|
|
32
|
+
fullWidth: true,
|
|
33
|
+
maxWidth: "lg",
|
|
34
|
+
children: [
|
|
35
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.Dialog.Header, {
|
|
36
|
+
onClose: ()=>closeEditJsonDialog(),
|
|
37
|
+
children: "Edit Dashboard"
|
|
38
|
+
}),
|
|
39
|
+
(editJsonDialog === null || editJsonDialog === void 0 ? void 0 : editJsonDialog.isOpen) && /*#__PURE__*/ (0, _jsxRuntime.jsx)(EditJsonDialogForm, {})
|
|
40
|
+
]
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
const EditJsonDialogForm = ()=>{
|
|
44
|
+
const { closeEditJsonDialog } = (0, _dashboardProvider.useEditJsonDialog)();
|
|
45
|
+
const { dashboard , setDashboard } = (0, _useDashboard.useDashboard)();
|
|
46
|
+
const [draftDashboard, setDraftDashboard] = (0, _react.useState)(dashboard);
|
|
47
|
+
const handleApply = (e)=>{
|
|
48
|
+
e.preventDefault();
|
|
49
|
+
setDashboard(draftDashboard);
|
|
50
|
+
closeEditJsonDialog();
|
|
51
|
+
};
|
|
52
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_components.Dialog.Form, {
|
|
53
|
+
onSubmit: handleApply,
|
|
54
|
+
children: [
|
|
55
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_components.Dialog.Content, {
|
|
56
|
+
sx: {
|
|
57
|
+
width: '100%'
|
|
58
|
+
},
|
|
59
|
+
children: [
|
|
60
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Alert, {
|
|
61
|
+
sx: {
|
|
62
|
+
marginBottom: (theme)=>theme.spacing(1)
|
|
63
|
+
},
|
|
64
|
+
severity: "warning",
|
|
65
|
+
children: "Metadata cannot be modified or saved."
|
|
66
|
+
}),
|
|
67
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.FormControl, {
|
|
68
|
+
fullWidth: true,
|
|
69
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.JSONEditor, {
|
|
70
|
+
minHeight: "300px",
|
|
71
|
+
maxHeight: "700px",
|
|
72
|
+
value: draftDashboard,
|
|
73
|
+
onChange: (value)=>setDraftDashboard(value)
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
]
|
|
77
|
+
}),
|
|
78
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.Dialog.Actions, {
|
|
79
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.Dialog.PrimaryButton, {
|
|
80
|
+
onClick: handleApply,
|
|
81
|
+
children: "Apply"
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
]
|
|
85
|
+
});
|
|
86
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright 2023 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("./EditJsonDialog"), exports);
|
|
18
|
+
function _exportStar(from, to) {
|
|
19
|
+
Object.keys(from).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function() {
|
|
23
|
+
return from[k];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
return from;
|
|
28
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// Copyright 2023 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, "EmptyDashboard", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>EmptyDashboard
|
|
20
|
+
});
|
|
21
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
+
const _material = require("@mui/material");
|
|
23
|
+
const _context = require("../../context");
|
|
24
|
+
const _addPanelButton = require("../AddPanelButton");
|
|
25
|
+
const _variables = require("../Variables");
|
|
26
|
+
const _editButton = require("../EditButton");
|
|
27
|
+
const DEFAULT_TITLE = "Let's get started";
|
|
28
|
+
const DEFAULT_DESCRIPTION = {
|
|
29
|
+
edit: 'We currently support time series charts, gauge charts, stat charts and more!',
|
|
30
|
+
view: 'This dashboard is currently empty. Get started by clicking the edit button.'
|
|
31
|
+
};
|
|
32
|
+
// Constants from specifics in designs to make the default messaging look good.
|
|
33
|
+
const CONTAINER_WIDTH = '450px';
|
|
34
|
+
const PRIMARY_CONTENT_WIDTH = '289px';
|
|
35
|
+
const COMMON_BUTTON_PROPS = {
|
|
36
|
+
variant: 'outlined',
|
|
37
|
+
color: 'secondary'
|
|
38
|
+
};
|
|
39
|
+
const EmptyDashboardActions = ({ actions , isEditMode , onEditButtonClick })=>{
|
|
40
|
+
if (actions && typeof actions !== 'boolean') {
|
|
41
|
+
// Custom actions
|
|
42
|
+
return actions;
|
|
43
|
+
}
|
|
44
|
+
if (actions === false) {
|
|
45
|
+
// Disable default actions
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
if (isEditMode) {
|
|
49
|
+
// Default edit mode actions
|
|
50
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
51
|
+
children: [
|
|
52
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_addPanelButton.AddPanelButton, {
|
|
53
|
+
variant: "outlined",
|
|
54
|
+
color: "secondary",
|
|
55
|
+
label: "Add Panel",
|
|
56
|
+
fullWidth: true
|
|
57
|
+
}),
|
|
58
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_variables.EditVariablesButton, {
|
|
59
|
+
variant: "outlined",
|
|
60
|
+
color: "secondary",
|
|
61
|
+
label: "Add Variables",
|
|
62
|
+
fullWidth: true
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
if (onEditButtonClick) {
|
|
68
|
+
// Default view mode actions
|
|
69
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_editButton.EditButton, {
|
|
70
|
+
...COMMON_BUTTON_PROPS,
|
|
71
|
+
label: "Edit Dashboard",
|
|
72
|
+
onClick: onEditButtonClick
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return null;
|
|
76
|
+
};
|
|
77
|
+
const EmptyDashboard = ({ title =DEFAULT_TITLE , description , additionalText , actions , onEditButtonClick })=>{
|
|
78
|
+
const { isEditMode } = (0, _context.useEditMode)();
|
|
79
|
+
const defaultDescription = isEditMode ? DEFAULT_DESCRIPTION.edit : DEFAULT_DESCRIPTION.view;
|
|
80
|
+
const actionsContent = /*#__PURE__*/ (0, _jsxRuntime.jsx)(EmptyDashboardActions, {
|
|
81
|
+
actions: actions,
|
|
82
|
+
onEditButtonClick: onEditButtonClick,
|
|
83
|
+
isEditMode: isEditMode
|
|
84
|
+
});
|
|
85
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Box, {
|
|
86
|
+
sx: {
|
|
87
|
+
width: CONTAINER_WIDTH,
|
|
88
|
+
textAlign: 'center',
|
|
89
|
+
margin: '0 auto'
|
|
90
|
+
},
|
|
91
|
+
children: [
|
|
92
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Box, {
|
|
93
|
+
sx: {
|
|
94
|
+
width: PRIMARY_CONTENT_WIDTH,
|
|
95
|
+
margin: '0 auto'
|
|
96
|
+
},
|
|
97
|
+
children: [
|
|
98
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
|
|
99
|
+
variant: "h2",
|
|
100
|
+
gutterBottom: true,
|
|
101
|
+
children: title
|
|
102
|
+
}),
|
|
103
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
|
|
104
|
+
variant: "body1",
|
|
105
|
+
children: description !== null && description !== void 0 ? description : defaultDescription
|
|
106
|
+
}),
|
|
107
|
+
actionsContent && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
|
|
108
|
+
sx: {
|
|
109
|
+
display: 'flex',
|
|
110
|
+
gap: 2,
|
|
111
|
+
marginTop: 1,
|
|
112
|
+
justifyContent: 'center'
|
|
113
|
+
},
|
|
114
|
+
children: actionsContent
|
|
115
|
+
})
|
|
116
|
+
]
|
|
117
|
+
}),
|
|
118
|
+
additionalText && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
|
|
119
|
+
variant: "subtitle1",
|
|
120
|
+
sx: {
|
|
121
|
+
marginTop: 12
|
|
122
|
+
},
|
|
123
|
+
children: additionalText
|
|
124
|
+
})
|
|
125
|
+
]
|
|
126
|
+
});
|
|
127
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright 2023 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("./EmptyDashboard"), exports);
|
|
18
|
+
function _exportStar(from, to) {
|
|
19
|
+
Object.keys(from).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function() {
|
|
23
|
+
return from[k];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
return from;
|
|
28
|
+
}
|