@perses-dev/dashboards 0.54.0-beta.0 → 0.54.0-beta.2
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/GridItemContent.js +2 -2
- package/dist/cjs/components/Panel/Panel.js +4 -1
- package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +2 -2
- package/dist/cjs/components/Variables/VariableEditor.js +51 -17
- package/dist/cjs/constants/defaults.js +32 -0
- package/dist/cjs/constants/index.js +1 -0
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +3 -3
- package/dist/cjs/context/DatasourceStoreProvider.js +4 -1
- package/dist/cjs/context/VariableProvider/VariableProvider.js +10 -6
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/keyboard-shortcuts/index.js +3 -0
- package/dist/cjs/keyboard-shortcuts/utils.js +11 -0
- package/dist/cjs/model/PanelGroupDefinition.js +25 -0
- package/dist/cjs/model/VariableDefinition.js +16 -0
- package/dist/cjs/model/index.js +1 -0
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +3 -3
- package/dist/components/AddGroupButton/AddGroupButton.js +1 -1
- package/dist/components/AddGroupButton/AddGroupButton.js.map +1 -1
- package/dist/components/AddPanelButton/AddPanelButton.js +1 -1
- package/dist/components/AddPanelButton/AddPanelButton.js.map +1 -1
- package/dist/components/Dashboard/Dashboard.js +1 -1
- package/dist/components/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/DashboardLinks/DashboardLinksEditor.js +1 -1
- package/dist/components/DashboardLinks/DashboardLinksEditor.js.map +1 -1
- package/dist/components/DashboardLinks/EditDashboardLinksButton.js +1 -1
- package/dist/components/DashboardLinks/EditDashboardLinksButton.js.map +1 -1
- package/dist/components/DashboardShortcuts/useDashboardShortcuts.js.map +1 -1
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js +1 -1
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.js +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
- package/dist/components/Datasources/DatasourceEditor.d.ts.map +1 -1
- package/dist/components/Datasources/DatasourceEditor.js +1 -1
- package/dist/components/Datasources/DatasourceEditor.js.map +1 -1
- package/dist/components/Datasources/EditDatasourcesButton.js +1 -1
- package/dist/components/Datasources/EditDatasourcesButton.js.map +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.js +1 -1
- package/dist/components/DownloadButton/DownloadButton.js.map +1 -1
- package/dist/components/EditButton/EditButton.js +1 -1
- package/dist/components/EditButton/EditButton.js.map +1 -1
- package/dist/components/EditJsonButton/EditJsonButton.js +1 -1
- package/dist/components/EditJsonButton/EditJsonButton.js.map +1 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.js +1 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.js.map +1 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.js +1 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.js.map +1 -1
- package/dist/components/GridLayout/GridContainer.js +1 -1
- package/dist/components/GridLayout/GridContainer.js.map +1 -1
- package/dist/components/GridLayout/GridItemContent.d.ts +1 -1
- package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
- package/dist/components/GridLayout/GridItemContent.js +2 -2
- package/dist/components/GridLayout/GridItemContent.js.map +1 -1
- package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
- package/dist/components/GridLayout/GridLayout.js +1 -1
- package/dist/components/GridLayout/GridLayout.js.map +1 -1
- package/dist/components/GridLayout/GridTitle.js +1 -1
- package/dist/components/GridLayout/GridTitle.js.map +1 -1
- package/dist/components/GridLayout/Row.d.ts +1 -1
- package/dist/components/GridLayout/Row.d.ts.map +1 -1
- package/dist/components/GridLayout/Row.js +1 -1
- package/dist/components/GridLayout/Row.js.map +1 -1
- package/dist/components/LeaveDialog/LeaveDialog.js +1 -1
- package/dist/components/LeaveDialog/LeaveDialog.js.map +1 -1
- package/dist/components/LinksDisplay/LinksDisplay.js +1 -1
- package/dist/components/LinksDisplay/LinksDisplay.js.map +1 -1
- package/dist/components/Panel/Panel.d.ts +1 -1
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/Panel.js +5 -2
- package/dist/components/Panel/Panel.js.map +1 -1
- package/dist/components/Panel/PanelActions.js +1 -1
- package/dist/components/Panel/PanelActions.js.map +1 -1
- package/dist/components/Panel/PanelContent.js +1 -1
- package/dist/components/Panel/PanelContent.js.map +1 -1
- package/dist/components/Panel/PanelHeader.js +1 -1
- package/dist/components/Panel/PanelHeader.js.map +1 -1
- package/dist/components/Panel/PanelPluginLoader.js +1 -1
- package/dist/components/Panel/PanelPluginLoader.js.map +1 -1
- package/dist/components/Panel/useSelectionItemActions.js +1 -1
- package/dist/components/Panel/useSelectionItemActions.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.js +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js +3 -3
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.js +1 -1
- package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
- package/dist/components/PanelDrawer/PanelQueriesSharedControls.js +1 -1
- package/dist/components/PanelDrawer/PanelQueriesSharedControls.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -1
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js +1 -1
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -1
- package/dist/components/QueryViewerDialog/QueryViewerDialog.js +1 -1
- package/dist/components/QueryViewerDialog/QueryViewerDialog.js.map +1 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +1 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
- package/dist/components/Variables/EditVariablesButton.js +1 -1
- package/dist/components/Variables/EditVariablesButton.js.map +1 -1
- package/dist/components/Variables/ListVariableListBox.js +1 -1
- package/dist/components/Variables/ListVariableListBox.js.map +1 -1
- package/dist/components/Variables/Variable.js +2 -2
- package/dist/components/Variables/Variable.js.map +1 -1
- package/dist/components/Variables/VariableEditor.d.ts +1 -1
- package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditor.js +56 -22
- package/dist/components/Variables/VariableEditor.js.map +1 -1
- package/dist/components/Variables/VariableList.d.ts.map +1 -1
- package/dist/components/Variables/VariableList.js +1 -1
- package/dist/components/Variables/VariableList.js.map +1 -1
- package/dist/constants/defaults.d.ts +4 -0
- package/dist/constants/defaults.d.ts.map +1 -0
- package/dist/constants/defaults.js +16 -0
- package/dist/constants/defaults.js.map +1 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/index.js +1 -0
- package/dist/constants/index.js.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.js +2 -2
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +1 -2
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-slice.d.ts +1 -1
- package/dist/context/DashboardProvider/delete-panel-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -1
- package/dist/context/DashboardProvider/duplicate-panel-slice.d.ts +1 -1
- package/dist/context/DashboardProvider/duplicate-panel-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/duplicate-panel-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts +2 -1
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.d.ts +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/view-panel-slice.d.ts +1 -1
- package/dist/context/DashboardProvider/view-panel-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/view-panel-slice.js.map +1 -1
- package/dist/context/DatasourceStoreProvider.d.ts +1 -1
- package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
- package/dist/context/DatasourceStoreProvider.js +5 -2
- package/dist/context/DatasourceStoreProvider.js.map +1 -1
- package/dist/context/PanelEditorProvider/PanelEditorProvider.js +1 -1
- package/dist/context/PanelEditorProvider/PanelEditorProvider.js.map +1 -1
- package/dist/context/VariableProvider/VariableProvider.d.ts +3 -2
- package/dist/context/VariableProvider/VariableProvider.d.ts.map +1 -1
- package/dist/context/VariableProvider/VariableProvider.js +12 -8
- package/dist/context/VariableProvider/VariableProvider.js.map +1 -1
- package/dist/context/VariableProvider/hydrationUtils.d.ts +1 -1
- package/dist/context/VariableProvider/hydrationUtils.d.ts.map +1 -1
- package/dist/context/VariableProvider/hydrationUtils.js.map +1 -1
- package/dist/context/VariableProvider/utils.d.ts +1 -1
- package/dist/context/VariableProvider/utils.d.ts.map +1 -1
- package/dist/context/VariableProvider/utils.js.map +1 -1
- package/dist/context/useDashboard.d.ts +1 -2
- package/dist/context/useDashboard.d.ts.map +1 -1
- package/dist/context/useDashboard.js.map +1 -1
- 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/keyboard-shortcuts/PanelFocusProvider.js +1 -1
- package/dist/keyboard-shortcuts/PanelFocusProvider.js.map +1 -1
- package/dist/keyboard-shortcuts/index.d.ts +1 -1
- package/dist/keyboard-shortcuts/index.d.ts.map +1 -1
- package/dist/keyboard-shortcuts/index.js +1 -1
- package/dist/keyboard-shortcuts/index.js.map +1 -1
- package/dist/keyboard-shortcuts/utils.d.ts +8 -0
- package/dist/keyboard-shortcuts/utils.d.ts.map +1 -1
- package/dist/keyboard-shortcuts/utils.js +13 -0
- package/dist/keyboard-shortcuts/utils.js.map +1 -1
- package/dist/model/PanelGroupDefinition.d.ts +59 -0
- package/dist/model/PanelGroupDefinition.d.ts.map +1 -0
- package/dist/model/PanelGroupDefinition.js +19 -0
- package/dist/model/PanelGroupDefinition.js.map +1 -0
- package/dist/model/VariableDefinition.d.ts +50 -0
- package/dist/model/VariableDefinition.d.ts.map +1 -0
- package/dist/model/VariableDefinition.js +20 -0
- package/dist/model/VariableDefinition.js.map +1 -0
- package/dist/model/index.d.ts +1 -0
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +1 -0
- package/dist/model/index.js.map +1 -1
- package/dist/test/datasource-provider.d.ts +1 -1
- package/dist/test/datasource-provider.d.ts.map +1 -1
- package/dist/test/datasource-provider.js.map +1 -1
- package/dist/test/render.js +1 -1
- package/dist/test/render.js.map +1 -1
- package/dist/utils/panelUtils.d.ts +1 -1
- package/dist/utils/panelUtils.d.ts.map +1 -1
- package/dist/utils/panelUtils.js.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.js +1 -1
- 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 +2 -2
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
- package/package.json +6 -9
|
@@ -25,7 +25,7 @@ const _material = require("@mui/material");
|
|
|
25
25
|
const _reactintersectionobserver = require("react-intersection-observer");
|
|
26
26
|
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
27
27
|
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
28
|
-
const
|
|
28
|
+
const _model = require("../../model");
|
|
29
29
|
const _context = require("../../context");
|
|
30
30
|
const _keyboardshortcuts = require("../../keyboard-shortcuts");
|
|
31
31
|
const _Panel = require("../Panel");
|
|
@@ -103,7 +103,7 @@ function GridItemContent(props) {
|
|
|
103
103
|
queries
|
|
104
104
|
]);
|
|
105
105
|
const readHandlers = {
|
|
106
|
-
isPanelViewed: (0,
|
|
106
|
+
isPanelViewed: (0, _model.isPanelGroupItemIdEqual)(viewPanelGroupItemId, panelGroupItemId),
|
|
107
107
|
onViewPanelClick: function() {
|
|
108
108
|
if (viewPanelGroupItemId === undefined) {
|
|
109
109
|
viewPanel(panelGroupItemId);
|
|
@@ -79,7 +79,10 @@ const Panel = /*#__PURE__*/ (0, _react.memo)(function Panel(props) {
|
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
81
|
try {
|
|
82
|
-
const plugin = await getPlugin(
|
|
82
|
+
const plugin = await getPlugin({
|
|
83
|
+
kind: 'Panel',
|
|
84
|
+
name: panelPluginKind
|
|
85
|
+
});
|
|
83
86
|
// More defensive checking for plugin and actions
|
|
84
87
|
if (!plugin || typeof plugin !== 'object' || !plugin.actions || !Array.isArray(plugin.actions) || plugin.actions.length === 0) {
|
|
85
88
|
setPluginActions([]);
|
|
@@ -77,8 +77,8 @@ function PanelEditorForm(props) {
|
|
|
77
77
|
setQueries(undefined, isHidden);
|
|
78
78
|
}
|
|
79
79
|
});
|
|
80
|
-
const titleAction = (0,
|
|
81
|
-
const submitText = (0,
|
|
80
|
+
const titleAction = (0, _components.getTitleAction)(initialAction, true);
|
|
81
|
+
const submitText = (0, _components.getSubmitText)(initialAction, true);
|
|
82
82
|
const links = (0, _reacthookform.useWatch)({
|
|
83
83
|
control: form.control,
|
|
84
84
|
name: 'panelDefinition.spec.links'
|
|
@@ -166,25 +166,25 @@ function VariableEditor(props) {
|
|
|
166
166
|
};
|
|
167
167
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
168
168
|
children: [
|
|
169
|
-
currentEditingVariableDefinition && /*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
});
|
|
180
|
-
},
|
|
181
|
-
onClose: ()=>{
|
|
182
|
-
if (variableFormAction === 'create') {
|
|
183
|
-
removeVariable(variableEditIdx);
|
|
184
|
-
}
|
|
169
|
+
currentEditingVariableDefinition && /*#__PURE__*/ (0, _jsxruntime.jsx)(VariableEditorFormWithContext, {
|
|
170
|
+
variableDefinitions: variableDefinitions,
|
|
171
|
+
externalVariableDefinitions: externalVariableDefinitions,
|
|
172
|
+
builtinVariableDefinitions: builtinVariableDefinitions,
|
|
173
|
+
currentEditingVariableDefinition: currentEditingVariableDefinition,
|
|
174
|
+
variableFormAction: variableFormAction,
|
|
175
|
+
onActionChange: setVariableFormAction,
|
|
176
|
+
onSave: (definition)=>{
|
|
177
|
+
setVariableDefinitions((draft)=>{
|
|
178
|
+
draft[variableEditIdx] = definition;
|
|
185
179
|
setVariableEditIdx(null);
|
|
180
|
+
});
|
|
181
|
+
},
|
|
182
|
+
onClose: ()=>{
|
|
183
|
+
if (variableFormAction === 'create') {
|
|
184
|
+
removeVariable(variableEditIdx);
|
|
186
185
|
}
|
|
187
|
-
|
|
186
|
+
setVariableEditIdx(null);
|
|
187
|
+
}
|
|
188
188
|
}),
|
|
189
189
|
!currentEditingVariableDefinition && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
190
190
|
children: [
|
|
@@ -535,6 +535,40 @@ function VariableEditor(props) {
|
|
|
535
535
|
const TableCell = (0, _material.styled)(_material.TableCell)(({ theme })=>({
|
|
536
536
|
borderBottom: `solid 1px ${theme.palette.divider}`
|
|
537
537
|
}));
|
|
538
|
+
function VariableEditorFormWithContext({ variableDefinitions, externalVariableDefinitions, builtinVariableDefinitions, currentEditingVariableDefinition, variableFormAction, onActionChange, onSave, onClose }) {
|
|
539
|
+
const { initialVariableValues, isLoading } = (0, _pluginsystem.useResolveListVariableValues)(variableDefinitions);
|
|
540
|
+
if (isLoading) {
|
|
541
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
|
|
542
|
+
sx: {
|
|
543
|
+
display: 'flex',
|
|
544
|
+
alignItems: 'center',
|
|
545
|
+
justifyContent: 'center',
|
|
546
|
+
height: '100%',
|
|
547
|
+
width: '100%',
|
|
548
|
+
overflow: 'hidden'
|
|
549
|
+
},
|
|
550
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.CircularProgress, {
|
|
551
|
+
"aria-label": "loading"
|
|
552
|
+
})
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_context.VariableProvider, {
|
|
556
|
+
initialVariableDefinitions: variableDefinitions,
|
|
557
|
+
externalVariableDefinitions: externalVariableDefinitions,
|
|
558
|
+
builtinVariableDefinitions: builtinVariableDefinitions,
|
|
559
|
+
initialVariableValues: initialVariableValues,
|
|
560
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.ValidationProvider, {
|
|
561
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.VariableEditorForm, {
|
|
562
|
+
initialVariableDefinition: currentEditingVariableDefinition,
|
|
563
|
+
action: variableFormAction,
|
|
564
|
+
isDraft: true,
|
|
565
|
+
onActionChange: onActionChange,
|
|
566
|
+
onSave: onSave,
|
|
567
|
+
onClose: onClose
|
|
568
|
+
})
|
|
569
|
+
})
|
|
570
|
+
});
|
|
571
|
+
}
|
|
538
572
|
function VariableName(props) {
|
|
539
573
|
const { name, state } = props;
|
|
540
574
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright 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: Object.getOwnPropertyDescriptor(all, name).get
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
get DEFAULT_DASHBOARD_DURATION () {
|
|
25
|
+
return DEFAULT_DASHBOARD_DURATION;
|
|
26
|
+
},
|
|
27
|
+
get DEFAULT_REFRESH_INTERVAL () {
|
|
28
|
+
return DEFAULT_REFRESH_INTERVAL;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const DEFAULT_DASHBOARD_DURATION = '1h';
|
|
32
|
+
const DEFAULT_REFRESH_INTERVAL = '0s';
|
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
17
17
|
_export_star(require("./grid-layout-config"), exports);
|
|
18
18
|
_export_star(require("./styles"), exports);
|
|
19
19
|
_export_star(require("./user-interface-text"), exports);
|
|
20
|
+
_export_star(require("./defaults"), exports);
|
|
20
21
|
function _export_star(from, to) {
|
|
21
22
|
Object.keys(from).forEach(function(k) {
|
|
22
23
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
@@ -38,8 +38,8 @@ const _middleware = require("zustand/middleware");
|
|
|
38
38
|
const _immer = require("zustand/middleware/immer");
|
|
39
39
|
const _shallow = require("zustand/shallow");
|
|
40
40
|
const _react = require("react");
|
|
41
|
-
const _core = require("@perses-dev/core");
|
|
42
41
|
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
42
|
+
const _constants = require("../../constants");
|
|
43
43
|
const _panelgroupeditorslice = require("./panel-group-editor-slice");
|
|
44
44
|
const _panelgroupslice = require("./panel-group-slice");
|
|
45
45
|
const _paneleditorslice = require("./panel-editor-slice");
|
|
@@ -92,7 +92,7 @@ function DashboardProvider(props) {
|
|
|
92
92
|
}
|
|
93
93
|
function initStore(props) {
|
|
94
94
|
const { initialState: { dashboardResource, isEditMode, viewPanelRef, setViewPanelRef } } = props;
|
|
95
|
-
const { kind, metadata, spec: { display, duration, refreshInterval =
|
|
95
|
+
const { kind, metadata, spec: { display, duration, refreshInterval = _constants.DEFAULT_REFRESH_INTERVAL, datasources, layouts = [], panels = {} } } = dashboardResource;
|
|
96
96
|
const links = dashboardResource.spec.links ?? [];
|
|
97
97
|
const ttl = 'ttl' in dashboardResource.spec ? dashboardResource.spec.ttl : undefined;
|
|
98
98
|
const store = (0, _zustand.createStore)()((0, _immer.immer)((0, _middleware.devtools)((...args)=>{
|
|
@@ -133,7 +133,7 @@ function initStore(props) {
|
|
|
133
133
|
state.panelGroups = panelGroups;
|
|
134
134
|
state.panelGroupOrder = panelGroupOrder;
|
|
135
135
|
state.duration = duration;
|
|
136
|
-
state.refreshInterval = refreshInterval ??
|
|
136
|
+
state.refreshInterval = refreshInterval ?? _constants.DEFAULT_REFRESH_INTERVAL;
|
|
137
137
|
state.datasources = datasources;
|
|
138
138
|
state.links = links;
|
|
139
139
|
// TODO: add ttl here to e.g allow edition from JSON view, but probably requires quite some refactoring
|
|
@@ -82,7 +82,10 @@ function DatasourceStoreProvider(props) {
|
|
|
82
82
|
const { kind } = selector;
|
|
83
83
|
const [{ spec, proxyUrl }, plugin] = await Promise.all([
|
|
84
84
|
findDatasource(selector),
|
|
85
|
-
getPlugin(
|
|
85
|
+
getPlugin({
|
|
86
|
+
kind: 'Datasource',
|
|
87
|
+
name: kind
|
|
88
|
+
})
|
|
86
89
|
]);
|
|
87
90
|
// allows extending client
|
|
88
91
|
const client = plugin.createClient(spec.plugin.spec, {
|
|
@@ -55,7 +55,6 @@ const _middleware = require("zustand/middleware");
|
|
|
55
55
|
const _shallow = require("zustand/shallow");
|
|
56
56
|
const _immer1 = require("immer");
|
|
57
57
|
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
58
|
-
const _core = require("@perses-dev/core");
|
|
59
58
|
const _spec = require("@perses-dev/spec");
|
|
60
59
|
const _utils = require("./utils");
|
|
61
60
|
const _hydrationUtils = require("./hydrationUtils");
|
|
@@ -204,7 +203,7 @@ function PluginProvider({ children, builtinVariables }) {
|
|
|
204
203
|
kind: 'BuiltinVariable',
|
|
205
204
|
spec: {
|
|
206
205
|
name: '__range',
|
|
207
|
-
value: ()=>(0, _spec.formatDuration)((0,
|
|
206
|
+
value: ()=>(0, _spec.formatDuration)((0, _spec.intervalToDuration)(absoluteTimeRange)),
|
|
208
207
|
source: 'Dashboard',
|
|
209
208
|
display: {
|
|
210
209
|
name: '__range',
|
|
@@ -258,8 +257,12 @@ function PluginProvider({ children, builtinVariables }) {
|
|
|
258
257
|
})
|
|
259
258
|
});
|
|
260
259
|
}
|
|
261
|
-
function createVariableDefinitionStore({ initialVariableDefinitions = [], externalVariableDefinitions = [], queryParams }) {
|
|
262
|
-
const
|
|
260
|
+
function createVariableDefinitionStore({ initialVariableDefinitions = [], externalVariableDefinitions = [], queryParams, initialVariableValues }) {
|
|
261
|
+
const queryParamValues = (0, _queryparams.getInitalValuesFromQueryParameters)(queryParams ? queryParams[0] : {});
|
|
262
|
+
const initialParams = {
|
|
263
|
+
...queryParamValues,
|
|
264
|
+
...initialVariableValues
|
|
265
|
+
};
|
|
263
266
|
const store = (0, _zustand.createStore)()((0, _middleware.devtools)((0, _immer.immer)((set, get)=>({
|
|
264
267
|
variableState: (0, _hydrationUtils.hydrateVariableDefinitionStates)(initialVariableDefinitions, initialParams, externalVariableDefinitions),
|
|
265
268
|
variableDefinitions: initialVariableDefinitions,
|
|
@@ -365,10 +368,11 @@ function createVariableDefinitionStore({ initialVariableDefinitions = [], extern
|
|
|
365
368
|
}))));
|
|
366
369
|
return store;
|
|
367
370
|
}
|
|
368
|
-
function VariableProvider({ children, initialVariableDefinitions = [], externalVariableDefinitions = [], builtinVariableDefinitions = [] }) {
|
|
371
|
+
function VariableProvider({ children, initialVariableDefinitions = [], externalVariableDefinitions = [], builtinVariableDefinitions = [], initialVariableValues }) {
|
|
369
372
|
const [store] = (0, _react.useState)(()=>createVariableDefinitionStore({
|
|
370
373
|
initialVariableDefinitions,
|
|
371
|
-
externalVariableDefinitions
|
|
374
|
+
externalVariableDefinitions,
|
|
375
|
+
initialVariableValues
|
|
372
376
|
}));
|
|
373
377
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(VariableDefinitionStoreContext.Provider, {
|
|
374
378
|
value: store,
|
package/dist/cjs/index.js
CHANGED
|
@@ -19,6 +19,7 @@ _export_star(require("./context"), exports);
|
|
|
19
19
|
_export_star(require("./keyboard-shortcuts"), exports);
|
|
20
20
|
_export_star(require("./views"), exports);
|
|
21
21
|
_export_star(require("./model"), exports);
|
|
22
|
+
_export_star(require("./constants"), exports);
|
|
22
23
|
function _export_star(from, to) {
|
|
23
24
|
Object.keys(from).forEach(function(k) {
|
|
24
25
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
@@ -24,6 +24,9 @@ _export(exports, {
|
|
|
24
24
|
get buildShortcutOptions () {
|
|
25
25
|
return buildShortcutOptions;
|
|
26
26
|
},
|
|
27
|
+
get createModEnterHandler () {
|
|
28
|
+
return createModEnterHandler;
|
|
29
|
+
},
|
|
27
30
|
get dispatchShortcutEvent () {
|
|
28
31
|
return dispatchShortcutEvent;
|
|
29
32
|
},
|
|
@@ -74,3 +77,11 @@ function requireShortcutEvent(def) {
|
|
|
74
77
|
function dispatchShortcutEvent(eventName) {
|
|
75
78
|
window.dispatchEvent(new CustomEvent(eventName));
|
|
76
79
|
}
|
|
80
|
+
function createModEnterHandler(execute) {
|
|
81
|
+
return (event)=>{
|
|
82
|
+
if (event.key === 'Enter' && (event.ctrlKey || event.metaKey) && !event.shiftKey && !event.altKey) {
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
execute();
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Copyright 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, "isPanelGroupItemIdEqual", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return isPanelGroupItemIdEqual;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
function isPanelGroupItemIdEqual(a, b) {
|
|
24
|
+
return a?.panelGroupId === b?.panelGroupId && a?.panelGroupItemLayoutId === b?.panelGroupItemLayoutId;
|
|
25
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright 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
|
+
});
|
package/dist/cjs/model/index.js
CHANGED
|
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
17
|
_export_star(require("./DashboardResource"), exports);
|
|
18
|
+
_export_star(require("./PanelGroupDefinition"), exports);
|
|
18
19
|
function _export_star(from, to) {
|
|
19
20
|
Object.keys(from).forEach(function(k) {
|
|
20
21
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
@@ -22,18 +22,18 @@ Object.defineProperty(exports, "ViewDashboard", {
|
|
|
22
22
|
});
|
|
23
23
|
const _jsxruntime = require("react/jsx-runtime");
|
|
24
24
|
const _material = require("@mui/material");
|
|
25
|
-
const _core = require("@perses-dev/core");
|
|
26
25
|
const _components = require("@perses-dev/components");
|
|
27
26
|
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
28
27
|
const _react = require("react");
|
|
28
|
+
const _constants = require("../../constants");
|
|
29
29
|
const _context = require("../../context");
|
|
30
30
|
const _DashboardProviderWithQueryParams = require("../../context/DashboardProvider/DashboardProviderWithQueryParams");
|
|
31
31
|
const _DashboardApp = require("./DashboardApp");
|
|
32
32
|
function ViewDashboard(props) {
|
|
33
33
|
const { dashboardResource, datasourceApi, externalVariableDefinitions, emptyDashboardProps, isReadonly, isVariableEnabled, isDatasourceEnabled, disableShortcuts, isEditing, isCreating, isInitialVariableSticky, isLeavingConfirmDialogEnabled, dashboardTitleComponent, onSave, onDiscard, sx, ...others } = props;
|
|
34
34
|
const { spec } = dashboardResource;
|
|
35
|
-
const dashboardDuration = spec.duration ??
|
|
36
|
-
const dashboardRefreshInterval = spec.refreshInterval ??
|
|
35
|
+
const dashboardDuration = spec.duration ?? _constants.DEFAULT_DASHBOARD_DURATION;
|
|
36
|
+
const dashboardRefreshInterval = spec.refreshInterval ?? _constants.DEFAULT_REFRESH_INTERVAL;
|
|
37
37
|
const initialTimeRange = (0, _pluginsystem.useInitialTimeRange)(dashboardDuration);
|
|
38
38
|
const initialRefreshInterval = (0, _pluginsystem.useInitialRefreshInterval)(dashboardRefreshInterval);
|
|
39
39
|
const { data } = (0, _pluginsystem.usePluginBuiltinVariableDefinitions)();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
// Copyright The Perses Authors
|
|
2
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -10,7 +11,6 @@
|
|
|
10
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
12
|
// See the License for the specific language governing permissions and
|
|
12
13
|
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import { Button } from '@mui/material';
|
|
15
15
|
import AddGroupIcon from 'mdi-material-ui/PlusBoxOutline';
|
|
16
16
|
import { InfoTooltip } from '@perses-dev/components';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/AddGroupButton/AddGroupButton.tsx"],"sourcesContent":["// Copyright 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 { Button } from '@mui/material';\nimport AddGroupIcon from 'mdi-material-ui/PlusBoxOutline';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { ReactElement } from 'react';\nimport { TOOLTIP_TEXT, editButtonStyle } from '../../constants';\nimport { useDashboardActions } from '../../context';\n\nexport const AddGroupButton = (): ReactElement => {\n const { openAddPanelGroup } = useDashboardActions();\n\n return (\n <InfoTooltip description={TOOLTIP_TEXT.addGroup}>\n <Button\n startIcon={<AddGroupIcon />}\n onClick={openAddPanelGroup}\n aria-label={TOOLTIP_TEXT.addGroup}\n sx={editButtonStyle}\n >\n Panel Group\n </Button>\n </InfoTooltip>\n );\n};\n"],"names":["Button","AddGroupIcon","InfoTooltip","TOOLTIP_TEXT","editButtonStyle","useDashboardActions","AddGroupButton","openAddPanelGroup","description","addGroup","startIcon","onClick","aria-label","sx"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC
|
|
1
|
+
{"version":3,"sources":["../../../src/components/AddGroupButton/AddGroupButton.tsx"],"sourcesContent":["// Copyright 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 { Button } from '@mui/material';\nimport AddGroupIcon from 'mdi-material-ui/PlusBoxOutline';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { ReactElement } from 'react';\nimport { TOOLTIP_TEXT, editButtonStyle } from '../../constants';\nimport { useDashboardActions } from '../../context';\n\nexport const AddGroupButton = (): ReactElement => {\n const { openAddPanelGroup } = useDashboardActions();\n\n return (\n <InfoTooltip description={TOOLTIP_TEXT.addGroup}>\n <Button\n startIcon={<AddGroupIcon />}\n onClick={openAddPanelGroup}\n aria-label={TOOLTIP_TEXT.addGroup}\n sx={editButtonStyle}\n >\n Panel Group\n </Button>\n </InfoTooltip>\n );\n};\n"],"names":["Button","AddGroupIcon","InfoTooltip","TOOLTIP_TEXT","editButtonStyle","useDashboardActions","AddGroupButton","openAddPanelGroup","description","addGroup","startIcon","onClick","aria-label","sx"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,MAAM,QAAQ,gBAAgB;AACvC,OAAOC,kBAAkB,iCAAiC;AAC1D,SAASC,WAAW,QAAQ,yBAAyB;AAErD,SAASC,YAAY,EAAEC,eAAe,QAAQ,kBAAkB;AAChE,SAASC,mBAAmB,QAAQ,gBAAgB;AAEpD,OAAO,MAAMC,iBAAiB;IAC5B,MAAM,EAAEC,iBAAiB,EAAE,GAAGF;IAE9B,qBACE,KAACH;QAAYM,aAAaL,aAAaM,QAAQ;kBAC7C,cAAA,KAACT;YACCU,yBAAW,KAACT;YACZU,SAASJ;YACTK,cAAYT,aAAaM,QAAQ;YACjCI,IAAIT;sBACL;;;AAKP,EAAE"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
// Copyright The Perses Authors
|
|
2
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -10,7 +11,6 @@
|
|
|
10
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
12
|
// See the License for the specific language governing permissions and
|
|
12
13
|
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import { Button } from '@mui/material';
|
|
15
15
|
import AddPanelIcon from 'mdi-material-ui/ChartBoxPlusOutline';
|
|
16
16
|
import { InfoTooltip } from '@perses-dev/components';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/AddPanelButton/AddPanelButton.tsx"],"sourcesContent":["// Copyright 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 { Button, ButtonProps } from '@mui/material';\nimport AddPanelIcon from 'mdi-material-ui/ChartBoxPlusOutline';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { ReactElement } from 'react';\nimport { TOOLTIP_TEXT, editButtonStyle } from '../../constants';\nimport { useDashboardActions } from '../../context';\n\nexport interface AddPanelButtonProps extends Pick<ButtonProps, 'fullWidth'> {\n /**\n * The variant to use to display the button.\n */\n variant?: 'text' | 'outlined';\n\n /**\n * The color to use to display the button.\n */\n color?: 'primary' | 'secondary';\n\n /**\n * The label used inside the button.\n */\n label?: string;\n}\n\nexport const AddPanelButton = ({\n variant = 'text',\n color = 'primary',\n label = 'Panel',\n fullWidth,\n}: AddPanelButtonProps): ReactElement => {\n const { openAddPanel } = useDashboardActions();\n\n return (\n <InfoTooltip description={TOOLTIP_TEXT.addPanel}>\n <Button\n startIcon={<AddPanelIcon />}\n onClick={openAddPanel}\n aria-label={TOOLTIP_TEXT.addPanel}\n variant={variant}\n color={color}\n fullWidth={fullWidth}\n sx={editButtonStyle}\n >\n {label}\n </Button>\n </InfoTooltip>\n );\n};\n"],"names":["Button","AddPanelIcon","InfoTooltip","TOOLTIP_TEXT","editButtonStyle","useDashboardActions","AddPanelButton","variant","color","label","fullWidth","openAddPanel","description","addPanel","startIcon","onClick","aria-label","sx"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC
|
|
1
|
+
{"version":3,"sources":["../../../src/components/AddPanelButton/AddPanelButton.tsx"],"sourcesContent":["// Copyright 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 { Button, ButtonProps } from '@mui/material';\nimport AddPanelIcon from 'mdi-material-ui/ChartBoxPlusOutline';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { ReactElement } from 'react';\nimport { TOOLTIP_TEXT, editButtonStyle } from '../../constants';\nimport { useDashboardActions } from '../../context';\n\nexport interface AddPanelButtonProps extends Pick<ButtonProps, 'fullWidth'> {\n /**\n * The variant to use to display the button.\n */\n variant?: 'text' | 'outlined';\n\n /**\n * The color to use to display the button.\n */\n color?: 'primary' | 'secondary';\n\n /**\n * The label used inside the button.\n */\n label?: string;\n}\n\nexport const AddPanelButton = ({\n variant = 'text',\n color = 'primary',\n label = 'Panel',\n fullWidth,\n}: AddPanelButtonProps): ReactElement => {\n const { openAddPanel } = useDashboardActions();\n\n return (\n <InfoTooltip description={TOOLTIP_TEXT.addPanel}>\n <Button\n startIcon={<AddPanelIcon />}\n onClick={openAddPanel}\n aria-label={TOOLTIP_TEXT.addPanel}\n variant={variant}\n color={color}\n fullWidth={fullWidth}\n sx={editButtonStyle}\n >\n {label}\n </Button>\n </InfoTooltip>\n );\n};\n"],"names":["Button","AddPanelIcon","InfoTooltip","TOOLTIP_TEXT","editButtonStyle","useDashboardActions","AddPanelButton","variant","color","label","fullWidth","openAddPanel","description","addPanel","startIcon","onClick","aria-label","sx"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,MAAM,QAAqB,gBAAgB;AACpD,OAAOC,kBAAkB,sCAAsC;AAC/D,SAASC,WAAW,QAAQ,yBAAyB;AAErD,SAASC,YAAY,EAAEC,eAAe,QAAQ,kBAAkB;AAChE,SAASC,mBAAmB,QAAQ,gBAAgB;AAmBpD,OAAO,MAAMC,iBAAiB,CAAC,EAC7BC,UAAU,MAAM,EAChBC,QAAQ,SAAS,EACjBC,QAAQ,OAAO,EACfC,SAAS,EACW;IACpB,MAAM,EAAEC,YAAY,EAAE,GAAGN;IAEzB,qBACE,KAACH;QAAYU,aAAaT,aAAaU,QAAQ;kBAC7C,cAAA,KAACb;YACCc,yBAAW,KAACb;YACZc,SAASJ;YACTK,cAAYb,aAAaU,QAAQ;YACjCN,SAASA;YACTC,OAAOA;YACPE,WAAWA;YACXO,IAAIb;sBAEHK;;;AAIT,EAAE"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
// Copyright The Perses Authors
|
|
2
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -10,7 +11,6 @@
|
|
|
10
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
12
|
// See the License for the specific language governing permissions and
|
|
12
13
|
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
14
|
import { Box } from '@mui/material';
|
|
15
15
|
import { ErrorBoundary, ErrorAlert } from '@perses-dev/components';
|
|
16
16
|
import { useRef } from 'react';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Dashboard/Dashboard.tsx"],"sourcesContent":["// Copyright 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 { Box, BoxProps } from '@mui/material';\nimport { ErrorBoundary, ErrorAlert } from '@perses-dev/components';\nimport { ReactElement, useRef } from 'react';\nimport { usePanelGroupIds } from '../../context';\nimport { GridLayout } from '../GridLayout';\nimport { EmptyDashboard, EmptyDashboardProps } from '../EmptyDashboard';\nimport { PanelOptions } from '../Panel';\n\nexport type DashboardProps = BoxProps & {\n /**\n * Props for `EmptyDashboard` component that will be rendered when the dashboard\n * is empty (i.e. has no panel groups). If not specified, the defaults will\n * be used.\n */\n emptyDashboardProps?: EmptyDashboardProps;\n panelOptions?: PanelOptions;\n};\nconst HEADER_HEIGHT = 165; // Approximate height of the header in dashboard view (including the navbar and variables toolbar)\n\n/**\n * Renders a Dashboard for the provided Dashboard spec.\n */\nexport function Dashboard({ emptyDashboardProps, panelOptions, ...boxProps }: DashboardProps): ReactElement {\n const panelGroupIds = usePanelGroupIds();\n const boxRef = useRef<HTMLDivElement>(null);\n const isEmpty = !panelGroupIds.length;\n const dashboardTopPosition = boxRef.current?.getBoundingClientRect().top ?? HEADER_HEIGHT;\n const panelFullHeight = window.innerHeight - dashboardTopPosition - window.scrollY;\n\n return (\n <Box {...boxProps} sx={{ height: '100%' }} ref={boxRef}>\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n {isEmpty && (\n <Box sx={{ height: '100%', display: 'flex', alignItems: 'center' }}>\n <EmptyDashboard {...emptyDashboardProps} />\n </Box>\n )}\n {!isEmpty &&\n panelGroupIds.map((panelGroupId) => (\n <GridLayout\n key={panelGroupId}\n panelGroupId={panelGroupId}\n panelOptions={panelOptions}\n panelFullHeight={panelFullHeight}\n />\n ))}\n </ErrorBoundary>\n </Box>\n );\n}\n"],"names":["Box","ErrorBoundary","ErrorAlert","useRef","usePanelGroupIds","GridLayout","EmptyDashboard","HEADER_HEIGHT","Dashboard","emptyDashboardProps","panelOptions","boxProps","panelGroupIds","boxRef","isEmpty","length","dashboardTopPosition","current","getBoundingClientRect","top","panelFullHeight","window","innerHeight","scrollY","sx","height","ref","FallbackComponent","display","alignItems","map","panelGroupId"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Dashboard/Dashboard.tsx"],"sourcesContent":["// Copyright 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 { Box, BoxProps } from '@mui/material';\nimport { ErrorBoundary, ErrorAlert } from '@perses-dev/components';\nimport { ReactElement, useRef } from 'react';\nimport { usePanelGroupIds } from '../../context';\nimport { GridLayout } from '../GridLayout';\nimport { EmptyDashboard, EmptyDashboardProps } from '../EmptyDashboard';\nimport { PanelOptions } from '../Panel';\n\nexport type DashboardProps = BoxProps & {\n /**\n * Props for `EmptyDashboard` component that will be rendered when the dashboard\n * is empty (i.e. has no panel groups). If not specified, the defaults will\n * be used.\n */\n emptyDashboardProps?: EmptyDashboardProps;\n panelOptions?: PanelOptions;\n};\nconst HEADER_HEIGHT = 165; // Approximate height of the header in dashboard view (including the navbar and variables toolbar)\n\n/**\n * Renders a Dashboard for the provided Dashboard spec.\n */\nexport function Dashboard({ emptyDashboardProps, panelOptions, ...boxProps }: DashboardProps): ReactElement {\n const panelGroupIds = usePanelGroupIds();\n const boxRef = useRef<HTMLDivElement>(null);\n const isEmpty = !panelGroupIds.length;\n const dashboardTopPosition = boxRef.current?.getBoundingClientRect().top ?? HEADER_HEIGHT;\n const panelFullHeight = window.innerHeight - dashboardTopPosition - window.scrollY;\n\n return (\n <Box {...boxProps} sx={{ height: '100%' }} ref={boxRef}>\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n {isEmpty && (\n <Box sx={{ height: '100%', display: 'flex', alignItems: 'center' }}>\n <EmptyDashboard {...emptyDashboardProps} />\n </Box>\n )}\n {!isEmpty &&\n panelGroupIds.map((panelGroupId) => (\n <GridLayout\n key={panelGroupId}\n panelGroupId={panelGroupId}\n panelOptions={panelOptions}\n panelFullHeight={panelFullHeight}\n />\n ))}\n </ErrorBoundary>\n </Box>\n );\n}\n"],"names":["Box","ErrorBoundary","ErrorAlert","useRef","usePanelGroupIds","GridLayout","EmptyDashboard","HEADER_HEIGHT","Dashboard","emptyDashboardProps","panelOptions","boxProps","panelGroupIds","boxRef","isEmpty","length","dashboardTopPosition","current","getBoundingClientRect","top","panelFullHeight","window","innerHeight","scrollY","sx","height","ref","FallbackComponent","display","alignItems","map","panelGroupId"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,GAAG,QAAkB,gBAAgB;AAC9C,SAASC,aAAa,EAAEC,UAAU,QAAQ,yBAAyB;AACnE,SAAuBC,MAAM,QAAQ,QAAQ;AAC7C,SAASC,gBAAgB,QAAQ,gBAAgB;AACjD,SAASC,UAAU,QAAQ,gBAAgB;AAC3C,SAASC,cAAc,QAA6B,oBAAoB;AAYxE,MAAMC,gBAAgB,KAAK,kGAAkG;AAE7H;;CAEC,GACD,OAAO,SAASC,UAAU,EAAEC,mBAAmB,EAAEC,YAAY,EAAE,GAAGC,UAA0B;IAC1F,MAAMC,gBAAgBR;IACtB,MAAMS,SAASV,OAAuB;IACtC,MAAMW,UAAU,CAACF,cAAcG,MAAM;IACrC,MAAMC,uBAAuBH,OAAOI,OAAO,EAAEC,wBAAwBC,OAAOZ;IAC5E,MAAMa,kBAAkBC,OAAOC,WAAW,GAAGN,uBAAuBK,OAAOE,OAAO;IAElF,qBACE,KAACvB;QAAK,GAAGW,QAAQ;QAAEa,IAAI;YAAEC,QAAQ;QAAO;QAAGC,KAAKb;kBAC9C,cAAA,MAACZ;YAAc0B,mBAAmBzB;;gBAC/BY,yBACC,KAACd;oBAAIwB,IAAI;wBAAEC,QAAQ;wBAAQG,SAAS;wBAAQC,YAAY;oBAAS;8BAC/D,cAAA,KAACvB;wBAAgB,GAAGG,mBAAmB;;;gBAG1C,CAACK,WACAF,cAAckB,GAAG,CAAC,CAACC,6BACjB,KAAC1B;wBAEC0B,cAAcA;wBACdrB,cAAcA;wBACdU,iBAAiBA;uBAHZW;;;;AASnB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
1
2
|
// Copyright The Perses Authors
|
|
2
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -10,7 +11,6 @@
|
|
|
10
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
12
|
// See the License for the specific language governing permissions and
|
|
12
13
|
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
14
|
import { useState } from 'react';
|
|
15
15
|
import { Button, Stack, Box, Typography, IconButton, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Collapse } from '@mui/material';
|
|
16
16
|
import AddIcon from 'mdi-material-ui/Plus';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/DashboardLinks/DashboardLinksEditor.tsx"],"sourcesContent":["// Copyright 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 { useState, ReactElement } from 'react';\nimport {\n Button,\n Stack,\n Box,\n Typography,\n IconButton,\n Table,\n TableBody,\n TableCell,\n TableContainer,\n TableHead,\n TableRow,\n Collapse,\n} from '@mui/material';\nimport AddIcon from 'mdi-material-ui/Plus';\nimport TrashIcon from 'mdi-material-ui/TrashCan';\nimport ArrowUp from 'mdi-material-ui/ArrowUp';\nimport ArrowDown from 'mdi-material-ui/ArrowDown';\nimport PencilIcon from 'mdi-material-ui/Pencil';\nimport ChevronUp from 'mdi-material-ui/ChevronUp';\nimport { Link } from '@perses-dev/spec';\nimport { useImmer } from 'use-immer';\nimport { InfoTooltip, LinkEditorForm } from '@perses-dev/components';\nimport { useDiscardChangesConfirmationDialog } from '../../context';\n\nexport interface DashboardLinksEditorProps {\n links: Link[];\n onChange: (links: Link[]) => void;\n onCancel: () => void;\n}\n\nconst DEFAULT_LINK: Link = {\n url: '',\n name: '',\n tooltip: '',\n renderVariables: true,\n targetBlank: true,\n};\n\nexport function DashboardLinksEditor({\n links: initialLinks,\n onChange,\n onCancel,\n}: DashboardLinksEditorProps): ReactElement {\n const [links, setLinks] = useImmer(initialLinks);\n const [expandedIndex, setExpandedIndex] = useState<number | null>(null);\n\n const { openDiscardChangesConfirmationDialog, closeDiscardChangesConfirmationDialog } =\n useDiscardChangesConfirmationDialog();\n\n const handleCancel = (): void => {\n if (JSON.stringify(initialLinks) !== JSON.stringify(links)) {\n openDiscardChangesConfirmationDialog({\n onDiscardChanges: () => {\n closeDiscardChangesConfirmationDialog();\n onCancel();\n },\n onCancel: closeDiscardChangesConfirmationDialog,\n });\n } else {\n onCancel();\n }\n };\n\n const handleAdd = (): void => {\n setLinks((draft) => {\n draft.push({ ...DEFAULT_LINK });\n });\n setExpandedIndex(links.length);\n };\n\n const handleRemove = (index: number): void => {\n setLinks((draft) => {\n draft.splice(index, 1);\n });\n if (expandedIndex === index) {\n setExpandedIndex(null);\n } else if (expandedIndex !== null && expandedIndex > index) {\n setExpandedIndex(expandedIndex - 1);\n }\n };\n\n const handleMoveUp = (index: number): void => {\n if (index === 0) return;\n setLinks((draft) => {\n const temp = draft[index - 1];\n if (temp && draft[index]) {\n draft[index - 1] = draft[index]!;\n draft[index] = temp;\n }\n });\n if (expandedIndex === index) {\n setExpandedIndex(index - 1);\n } else if (expandedIndex === index - 1) {\n setExpandedIndex(index);\n }\n };\n\n const handleMoveDown = (index: number): void => {\n if (index >= links.length - 1) return;\n setLinks((draft) => {\n const temp = draft[index + 1];\n if (temp && draft[index]) {\n draft[index + 1] = draft[index]!;\n draft[index] = temp;\n }\n });\n if (expandedIndex === index) {\n setExpandedIndex(index + 1);\n } else if (expandedIndex === index + 1) {\n setExpandedIndex(index);\n }\n };\n\n const handleUpdateLink = (index: number, link: Link): void => {\n setLinks((draft) => {\n draft[index] = link;\n });\n };\n\n const isValid = links.every((link) => link.url.trim().length > 0);\n\n return (\n <>\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n padding: (theme) => theme.spacing(1, 2),\n borderBottom: (theme) => `1px solid ${theme.palette.divider}`,\n }}\n >\n <Typography variant=\"h2\">Edit Dashboard Links</Typography>\n <Stack direction=\"row\" spacing={1} marginLeft=\"auto\">\n <Button disabled={!isValid} variant=\"contained\" onClick={() => onChange(links)}>\n Apply\n </Button>\n <Button color=\"secondary\" variant=\"outlined\" onClick={handleCancel}>\n Cancel\n </Button>\n </Stack>\n </Box>\n <Box padding={2} sx={{ overflowY: 'scroll' }}>\n <Stack spacing={2}>\n <TableContainer>\n <Table size=\"small\" sx={{ tableLayout: 'fixed', width: '100%' }} aria-label=\"table of dashboard links\">\n <TableHead>\n <TableRow>\n <TableCell>Name</TableCell>\n <TableCell>URL</TableCell>\n <TableCell width={80}>New Tab</TableCell>\n <TableCell align=\"right\" width={180}>\n Actions\n </TableCell>\n </TableRow>\n </TableHead>\n <TableBody>\n {links.map((link, index) => (\n <LinkTableRow\n key={index}\n link={link}\n index={index}\n isFirst={index === 0}\n isLast={index === links.length - 1}\n isExpanded={expandedIndex === index}\n onToggleExpand={() => setExpandedIndex(expandedIndex === index ? null : index)}\n onUpdate={(updatedLink) => handleUpdateLink(index, updatedLink)}\n onRemove={() => handleRemove(index)}\n onMoveUp={() => handleMoveUp(index)}\n onMoveDown={() => handleMoveDown(index)}\n />\n ))}\n </TableBody>\n </Table>\n </TableContainer>\n {links.length === 0 && (\n <Typography variant=\"body1\" color=\"text.secondary\" fontStyle=\"italic\" textAlign=\"center\" py={4}>\n No links defined. Click 'Add Link' to create one.\n </Typography>\n )}\n <Button variant=\"contained\" startIcon={<AddIcon />} onClick={handleAdd} sx={{ alignSelf: 'flex-start' }}>\n Add Link\n </Button>\n </Stack>\n </Box>\n </>\n );\n}\n\ninterface LinkTableRowProps {\n link: Link;\n index: number;\n isFirst: boolean;\n isLast: boolean;\n isExpanded: boolean;\n onToggleExpand: () => void;\n onUpdate: (link: Link) => void;\n onRemove: () => void;\n onMoveUp: () => void;\n onMoveDown: () => void;\n}\n\nfunction LinkTableRow({\n link,\n index,\n isFirst,\n isLast,\n isExpanded,\n onToggleExpand,\n onUpdate,\n onRemove,\n onMoveUp,\n onMoveDown,\n}: LinkTableRowProps): ReactElement {\n const displayName = link.name?.trim() || `Link ${index + 1}`;\n const hasError = link.url.trim().length === 0;\n\n return (\n <>\n <TableRow>\n <TableCell component=\"th\" scope=\"row\" sx={{ fontWeight: 'bold', overflow: 'hidden', textOverflow: 'ellipsis' }}>\n {displayName}\n </TableCell>\n <TableCell\n sx={{\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n color: hasError ? 'error.main' : undefined,\n }}\n >\n <InfoTooltip description={link.url} enterDelay={100}>\n {link.url || '(no URL)'}\n </InfoTooltip>\n </TableCell>\n <TableCell>{link.targetBlank ? 'Yes' : 'No'}</TableCell>\n <TableCell align=\"right\" sx={{ whiteSpace: 'nowrap' }}>\n <IconButton onClick={onMoveUp} disabled={isFirst} aria-label=\"Move link up\">\n <ArrowUp />\n </IconButton>\n <IconButton onClick={onMoveDown} disabled={isLast} aria-label=\"Move link down\">\n <ArrowDown />\n </IconButton>\n <IconButton onClick={onToggleExpand} aria-label={isExpanded ? 'Collapse link editor' : 'Edit link'}>\n {isExpanded ? <ChevronUp /> : <PencilIcon />}\n </IconButton>\n <IconButton onClick={onRemove} aria-label=\"Remove link\">\n <TrashIcon />\n </IconButton>\n </TableCell>\n </TableRow>\n <TableRow>\n <TableCell colSpan={4} sx={{ paddingBottom: 0, paddingTop: 0, border: isExpanded ? undefined : 'none' }}>\n <Collapse in={isExpanded} timeout=\"auto\" unmountOnExit>\n <Box sx={{ margin: 2 }}>\n <LinkEditorForm\n mode=\"modalEmbedded\"\n url={{\n value: link.url,\n label: 'URL',\n error: { hasError: hasError, helperText: hasError ? 'URL is required' : undefined },\n placeholder: 'https://example.com/dashboard?var=$variable',\n onChange: (url) => onUpdate({ ...link, url }),\n }}\n name={{\n value: link.name ?? '',\n label: 'Display Name',\n onChange: (name) => onUpdate({ ...link, name }),\n }}\n tooltip={{\n value: link.tooltip ?? '',\n label: 'Tooltip',\n onChange: (tooltip) => onUpdate({ ...link, tooltip }),\n }}\n renderVariables={{\n value: link.renderVariables ?? true,\n label: 'Replace variables in URL',\n onChange: (renderVariables) => onUpdate({ ...link, renderVariables }),\n }}\n newTabOpen={{\n value: link.targetBlank ?? true,\n label: 'Open in new tab',\n onChange: (targetBlank) => onUpdate({ ...link, targetBlank }),\n }}\n />\n </Box>\n </Collapse>\n </TableCell>\n </TableRow>\n </>\n );\n}\n"],"names":["useState","Button","Stack","Box","Typography","IconButton","Table","TableBody","TableCell","TableContainer","TableHead","TableRow","Collapse","AddIcon","TrashIcon","ArrowUp","ArrowDown","PencilIcon","ChevronUp","useImmer","InfoTooltip","LinkEditorForm","useDiscardChangesConfirmationDialog","DEFAULT_LINK","url","name","tooltip","renderVariables","targetBlank","DashboardLinksEditor","links","initialLinks","onChange","onCancel","setLinks","expandedIndex","setExpandedIndex","openDiscardChangesConfirmationDialog","closeDiscardChangesConfirmationDialog","handleCancel","JSON","stringify","onDiscardChanges","handleAdd","draft","push","length","handleRemove","index","splice","handleMoveUp","temp","handleMoveDown","handleUpdateLink","link","isValid","every","trim","sx","display","alignItems","padding","theme","spacing","borderBottom","palette","divider","variant","direction","marginLeft","disabled","onClick","color","overflowY","size","tableLayout","width","aria-label","align","map","LinkTableRow","isFirst","isLast","isExpanded","onToggleExpand","onUpdate","updatedLink","onRemove","onMoveUp","onMoveDown","fontStyle","textAlign","py","startIcon","alignSelf","displayName","hasError","component","scope","fontWeight","overflow","textOverflow","whiteSpace","undefined","description","enterDelay","colSpan","paddingBottom","paddingTop","border","in","timeout","unmountOnExit","margin","mode","value","label","error","helperText","placeholder","newTabOpen"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,QAAQ,QAAsB,QAAQ;AAC/C,SACEC,MAAM,EACNC,KAAK,EACLC,GAAG,EACHC,UAAU,EACVC,UAAU,EACVC,KAAK,EACLC,SAAS,EACTC,SAAS,EACTC,cAAc,EACdC,SAAS,EACTC,QAAQ,EACRC,QAAQ,QACH,gBAAgB;AACvB,OAAOC,aAAa,uBAAuB;AAC3C,OAAOC,eAAe,2BAA2B;AACjD,OAAOC,aAAa,0BAA0B;AAC9C,OAAOC,eAAe,4BAA4B;AAClD,OAAOC,gBAAgB,yBAAyB;AAChD,OAAOC,eAAe,4BAA4B;AAElD,SAASC,QAAQ,QAAQ,YAAY;AACrC,SAASC,WAAW,EAAEC,cAAc,QAAQ,yBAAyB;AACrE,SAASC,mCAAmC,QAAQ,gBAAgB;AAQpE,MAAMC,eAAqB;IACzBC,KAAK;IACLC,MAAM;IACNC,SAAS;IACTC,iBAAiB;IACjBC,aAAa;AACf;AAEA,OAAO,SAASC,qBAAqB,EACnCC,OAAOC,YAAY,EACnBC,QAAQ,EACRC,QAAQ,EACkB;IAC1B,MAAM,CAACH,OAAOI,SAAS,GAAGf,SAASY;IACnC,MAAM,CAACI,eAAeC,iBAAiB,GAAGpC,SAAwB;IAElE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AAE,GAAG/B,IAAI;4CAAE7B;wCAAK;gCAC/C;gCACAC,SAAS;oCACPyF,OAAO7D,KAAK5B,OAAO,IAAI;oCACvB0F,OAAO;oCACPpF,UAAU,CAACN,UAAY2D,SAAS;4CAAE,GAAG/B,IAAI;4CAAE5B;wCAAQ;gCACrD;gCACAC,iBAAiB;oCACfwF,OAAO7D,KAAK3B,eAAe,IAAI;oCAC/ByF,OAAO;oCACPpF,UAAU,CAACL,kBAAoB0D,SAAS;4CAAE,GAAG/B,IAAI;4CAAE3B;wCAAgB;gCACrE;gCACA6F,YAAY;oCACVL,OAAO7D,KAAK1B,WAAW,IAAI;oCAC3BwF,OAAO;oCACPpF,UAAU,CAACJ,cAAgByD,SAAS;4CAAE,GAAG/B,IAAI;4CAAE1B;wCAAY;gCAC7D;;;;;;;;AAQhB"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/DashboardLinks/DashboardLinksEditor.tsx"],"sourcesContent":["// Copyright 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 { useState, ReactElement } from 'react';\nimport {\n Button,\n Stack,\n Box,\n Typography,\n IconButton,\n Table,\n TableBody,\n TableCell,\n TableContainer,\n TableHead,\n TableRow,\n Collapse,\n} from '@mui/material';\nimport AddIcon from 'mdi-material-ui/Plus';\nimport TrashIcon from 'mdi-material-ui/TrashCan';\nimport ArrowUp from 'mdi-material-ui/ArrowUp';\nimport ArrowDown from 'mdi-material-ui/ArrowDown';\nimport PencilIcon from 'mdi-material-ui/Pencil';\nimport ChevronUp from 'mdi-material-ui/ChevronUp';\nimport { Link } from '@perses-dev/spec';\nimport { useImmer } from 'use-immer';\nimport { InfoTooltip, LinkEditorForm } from '@perses-dev/components';\nimport { useDiscardChangesConfirmationDialog } from '../../context';\n\nexport interface DashboardLinksEditorProps {\n links: Link[];\n onChange: (links: Link[]) => void;\n onCancel: () => void;\n}\n\nconst DEFAULT_LINK: Link = {\n url: '',\n name: '',\n tooltip: '',\n renderVariables: true,\n targetBlank: true,\n};\n\nexport function DashboardLinksEditor({\n links: initialLinks,\n onChange,\n onCancel,\n}: DashboardLinksEditorProps): ReactElement {\n const [links, setLinks] = useImmer(initialLinks);\n const [expandedIndex, setExpandedIndex] = useState<number | null>(null);\n\n const { openDiscardChangesConfirmationDialog, closeDiscardChangesConfirmationDialog } =\n useDiscardChangesConfirmationDialog();\n\n const handleCancel = (): void => {\n if (JSON.stringify(initialLinks) !== JSON.stringify(links)) {\n openDiscardChangesConfirmationDialog({\n onDiscardChanges: () => {\n closeDiscardChangesConfirmationDialog();\n onCancel();\n },\n onCancel: closeDiscardChangesConfirmationDialog,\n });\n } else {\n onCancel();\n }\n };\n\n const handleAdd = (): void => {\n setLinks((draft) => {\n draft.push({ ...DEFAULT_LINK });\n });\n setExpandedIndex(links.length);\n };\n\n const handleRemove = (index: number): void => {\n setLinks((draft) => {\n draft.splice(index, 1);\n });\n if (expandedIndex === index) {\n setExpandedIndex(null);\n } else if (expandedIndex !== null && expandedIndex > index) {\n setExpandedIndex(expandedIndex - 1);\n }\n };\n\n const handleMoveUp = (index: number): void => {\n if (index === 0) return;\n setLinks((draft) => {\n const temp = draft[index - 1];\n if (temp && draft[index]) {\n draft[index - 1] = draft[index]!;\n draft[index] = temp;\n }\n });\n if (expandedIndex === index) {\n setExpandedIndex(index - 1);\n } else if (expandedIndex === index - 1) {\n setExpandedIndex(index);\n }\n };\n\n const handleMoveDown = (index: number): void => {\n if (index >= links.length - 1) return;\n setLinks((draft) => {\n const temp = draft[index + 1];\n if (temp && draft[index]) {\n draft[index + 1] = draft[index]!;\n draft[index] = temp;\n }\n });\n if (expandedIndex === index) {\n setExpandedIndex(index + 1);\n } else if (expandedIndex === index + 1) {\n setExpandedIndex(index);\n }\n };\n\n const handleUpdateLink = (index: number, link: Link): void => {\n setLinks((draft) => {\n draft[index] = link;\n });\n };\n\n const isValid = links.every((link) => link.url.trim().length > 0);\n\n return (\n <>\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n padding: (theme) => theme.spacing(1, 2),\n borderBottom: (theme) => `1px solid ${theme.palette.divider}`,\n }}\n >\n <Typography variant=\"h2\">Edit Dashboard Links</Typography>\n <Stack direction=\"row\" spacing={1} marginLeft=\"auto\">\n <Button disabled={!isValid} variant=\"contained\" onClick={() => onChange(links)}>\n Apply\n </Button>\n <Button color=\"secondary\" variant=\"outlined\" onClick={handleCancel}>\n Cancel\n </Button>\n </Stack>\n </Box>\n <Box padding={2} sx={{ overflowY: 'scroll' }}>\n <Stack spacing={2}>\n <TableContainer>\n <Table size=\"small\" sx={{ tableLayout: 'fixed', width: '100%' }} aria-label=\"table of dashboard links\">\n <TableHead>\n <TableRow>\n <TableCell>Name</TableCell>\n <TableCell>URL</TableCell>\n <TableCell width={80}>New Tab</TableCell>\n <TableCell align=\"right\" width={180}>\n Actions\n </TableCell>\n </TableRow>\n </TableHead>\n <TableBody>\n {links.map((link, index) => (\n <LinkTableRow\n key={index}\n link={link}\n index={index}\n isFirst={index === 0}\n isLast={index === links.length - 1}\n isExpanded={expandedIndex === index}\n onToggleExpand={() => setExpandedIndex(expandedIndex === index ? null : index)}\n onUpdate={(updatedLink) => handleUpdateLink(index, updatedLink)}\n onRemove={() => handleRemove(index)}\n onMoveUp={() => handleMoveUp(index)}\n onMoveDown={() => handleMoveDown(index)}\n />\n ))}\n </TableBody>\n </Table>\n </TableContainer>\n {links.length === 0 && (\n <Typography variant=\"body1\" color=\"text.secondary\" fontStyle=\"italic\" textAlign=\"center\" py={4}>\n No links defined. Click 'Add Link' to create one.\n </Typography>\n )}\n <Button variant=\"contained\" startIcon={<AddIcon />} onClick={handleAdd} sx={{ alignSelf: 'flex-start' }}>\n Add Link\n </Button>\n </Stack>\n </Box>\n </>\n );\n}\n\ninterface LinkTableRowProps {\n link: Link;\n index: number;\n isFirst: boolean;\n isLast: boolean;\n isExpanded: boolean;\n onToggleExpand: () => void;\n onUpdate: (link: Link) => void;\n onRemove: () => void;\n onMoveUp: () => void;\n onMoveDown: () => void;\n}\n\nfunction LinkTableRow({\n link,\n index,\n isFirst,\n isLast,\n isExpanded,\n onToggleExpand,\n onUpdate,\n onRemove,\n onMoveUp,\n onMoveDown,\n}: LinkTableRowProps): ReactElement {\n const displayName = link.name?.trim() || `Link ${index + 1}`;\n const hasError = link.url.trim().length === 0;\n\n return (\n <>\n <TableRow>\n <TableCell component=\"th\" scope=\"row\" sx={{ fontWeight: 'bold', overflow: 'hidden', textOverflow: 'ellipsis' }}>\n {displayName}\n </TableCell>\n <TableCell\n sx={{\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n color: hasError ? 'error.main' : undefined,\n }}\n >\n <InfoTooltip description={link.url} enterDelay={100}>\n {link.url || '(no URL)'}\n </InfoTooltip>\n </TableCell>\n <TableCell>{link.targetBlank ? 'Yes' : 'No'}</TableCell>\n <TableCell align=\"right\" sx={{ whiteSpace: 'nowrap' }}>\n <IconButton onClick={onMoveUp} disabled={isFirst} aria-label=\"Move link up\">\n <ArrowUp />\n </IconButton>\n <IconButton onClick={onMoveDown} disabled={isLast} aria-label=\"Move link down\">\n <ArrowDown />\n </IconButton>\n <IconButton onClick={onToggleExpand} aria-label={isExpanded ? 'Collapse link editor' : 'Edit link'}>\n {isExpanded ? <ChevronUp /> : <PencilIcon />}\n </IconButton>\n <IconButton onClick={onRemove} aria-label=\"Remove link\">\n <TrashIcon />\n </IconButton>\n </TableCell>\n </TableRow>\n <TableRow>\n <TableCell colSpan={4} sx={{ paddingBottom: 0, paddingTop: 0, border: isExpanded ? undefined : 'none' }}>\n <Collapse in={isExpanded} timeout=\"auto\" unmountOnExit>\n <Box sx={{ margin: 2 }}>\n <LinkEditorForm\n mode=\"modalEmbedded\"\n url={{\n value: link.url,\n label: 'URL',\n error: { hasError: hasError, helperText: hasError ? 'URL is required' : undefined },\n placeholder: 'https://example.com/dashboard?var=$variable',\n onChange: (url) => onUpdate({ ...link, url }),\n }}\n name={{\n value: link.name ?? '',\n label: 'Display Name',\n onChange: (name) => onUpdate({ ...link, name }),\n }}\n tooltip={{\n value: link.tooltip ?? '',\n label: 'Tooltip',\n onChange: (tooltip) => onUpdate({ ...link, tooltip }),\n }}\n renderVariables={{\n value: link.renderVariables ?? true,\n label: 'Replace variables in URL',\n onChange: (renderVariables) => onUpdate({ ...link, renderVariables }),\n }}\n newTabOpen={{\n value: link.targetBlank ?? true,\n label: 'Open in new tab',\n onChange: (targetBlank) => onUpdate({ ...link, targetBlank }),\n }}\n />\n </Box>\n </Collapse>\n </TableCell>\n </TableRow>\n </>\n );\n}\n"],"names":["useState","Button","Stack","Box","Typography","IconButton","Table","TableBody","TableCell","TableContainer","TableHead","TableRow","Collapse","AddIcon","TrashIcon","ArrowUp","ArrowDown","PencilIcon","ChevronUp","useImmer","InfoTooltip","LinkEditorForm","useDiscardChangesConfirmationDialog","DEFAULT_LINK","url","name","tooltip","renderVariables","targetBlank","DashboardLinksEditor","links","initialLinks","onChange","onCancel","setLinks","expandedIndex","setExpandedIndex","openDiscardChangesConfirmationDialog","closeDiscardChangesConfirmationDialog","handleCancel","JSON","stringify","onDiscardChanges","handleAdd","draft","push","length","handleRemove","index","splice","handleMoveUp","temp","handleMoveDown","handleUpdateLink","link","isValid","every","trim","sx","display","alignItems","padding","theme","spacing","borderBottom","palette","divider","variant","direction","marginLeft","disabled","onClick","color","overflowY","size","tableLayout","width","aria-label","align","map","LinkTableRow","isFirst","isLast","isExpanded","onToggleExpand","onUpdate","updatedLink","onRemove","onMoveUp","onMoveDown","fontStyle","textAlign","py","startIcon","alignSelf","displayName","hasError","component","scope","fontWeight","overflow","textOverflow","whiteSpace","undefined","description","enterDelay","colSpan","paddingBottom","paddingTop","border","in","timeout","unmountOnExit","margin","mode","value","label","error","helperText","placeholder","newTabOpen"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,QAAQ,QAAsB,QAAQ;AAC/C,SACEC,MAAM,EACNC,KAAK,EACLC,GAAG,EACHC,UAAU,EACVC,UAAU,EACVC,KAAK,EACLC,SAAS,EACTC,SAAS,EACTC,cAAc,EACdC,SAAS,EACTC,QAAQ,EACRC,QAAQ,QACH,gBAAgB;AACvB,OAAOC,aAAa,uBAAuB;AAC3C,OAAOC,eAAe,2BAA2B;AACjD,OAAOC,aAAa,0BAA0B;AAC9C,OAAOC,eAAe,4BAA4B;AAClD,OAAOC,gBAAgB,yBAAyB;AAChD,OAAOC,eAAe,4BAA4B;AAElD,SAASC,QAAQ,QAAQ,YAAY;AACrC,SAASC,WAAW,EAAEC,cAAc,QAAQ,yBAAyB;AACrE,SAASC,mCAAmC,QAAQ,gBAAgB;AAQpE,MAAMC,eAAqB;IACzBC,KAAK;IACLC,MAAM;IACNC,SAAS;IACTC,iBAAiB;IACjBC,aAAa;AACf;AAEA,OAAO,SAASC,qBAAqB,EACnCC,OAAOC,YAAY,EACnBC,QAAQ,EACRC,QAAQ,EACkB;IAC1B,MAAM,CAACH,OAAOI,SAAS,GAAGf,SAASY;IACnC,MAAM,CAACI,eAAeC,iBAAiB,GAAGpC,SAAwB;IAElE,MAAM,EAAEqC,oCAAoC,EAAEC,qCAAqC,EAAE,GACnFhB;IAEF,MAAMiB,eAAe;QACnB,IAAIC,KAAKC,SAAS,CAACV,kBAAkBS,KAAKC,SAAS,CAACX,QAAQ;YAC1DO,qCAAqC;gBACnCK,kBAAkB;oBAChBJ;oBACAL;gBACF;gBACAA,UAAUK;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F,OAAO7D,KAAK3B,eAAe,IAAI;oCAC/ByF,OAAO;oCACPpF,UAAU,CAACL,kBAAoB0D,SAAS;4CAAE,GAAG/B,IAAI;4CAAE3B;wCAAgB;gCACrE;gCACA6F,YAAY;oCACVL,OAAO7D,KAAK1B,WAAW,IAAI;oCAC3BwF,OAAO;oCACPpF,UAAU,CAACJ,cAAgByD,SAAS;4CAAE,GAAG/B,IAAI;4CAAE1B;wCAAY;gCAC7D;;;;;;;;AAQhB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
1
2
|
// Copyright The Perses Authors
|
|
2
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -10,7 +11,6 @@
|
|
|
10
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
12
|
// See the License for the specific language governing permissions and
|
|
12
13
|
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
14
|
import { useState } from 'react';
|
|
15
15
|
import { Button } from '@mui/material';
|
|
16
16
|
import PencilIcon from 'mdi-material-ui/PencilOutline';
|