@perses-dev/dashboards 0.0.0-snapshot-ts-panel-actions-76080ec → 0.0.0-snapshot-reverse-proxy-75afbd7
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/DashboardStickyToolbar/DashboardStickyToolbar.js +0 -2
- package/dist/cjs/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +5 -20
- package/dist/cjs/components/GridLayout/GridItemContent.js +79 -17
- package/dist/cjs/components/GridLayout/GridLayout.js +78 -126
- package/dist/cjs/components/GridLayout/Row.js +150 -0
- package/dist/cjs/components/GridLayout/index.js +1 -0
- package/dist/cjs/components/LeaveDialog/LeaveDialog.js +81 -0
- package/dist/cjs/components/LeaveDialog/index.js +30 -0
- package/dist/cjs/components/Panel/Panel.js +7 -2
- package/dist/cjs/components/Panel/PanelActions.js +37 -14
- package/dist/cjs/components/Panel/PanelHeader.js +35 -15
- package/dist/cjs/components/Panel/index.js +1 -0
- package/dist/cjs/components/PanelDrawer/PanelDrawer.js +58 -21
- package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +202 -180
- package/dist/cjs/components/PanelDrawer/PanelPreview.js +3 -0
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +9 -21
- package/dist/cjs/components/PanelGroupDialog/PanelGroupEditorForm.js +35 -15
- package/dist/cjs/components/QueryViewerDialog/QueryViewerDialog.js +121 -0
- package/dist/cjs/components/QueryViewerDialog/index.js +30 -0
- package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +2 -1
- package/dist/cjs/components/Variables/ListVariableListBox.js +201 -0
- package/dist/cjs/components/Variables/Variable.js +130 -72
- package/dist/cjs/components/Variables/VariableEditor.js +22 -15
- package/dist/cjs/components/Variables/index.js +1 -0
- package/dist/cjs/components/index.js +3 -1
- package/dist/cjs/constants/user-interface-text.js +4 -2
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +7 -8
- package/dist/cjs/context/DashboardProvider/DashboardProviderWithQueryParams.js +4 -4
- package/dist/cjs/context/DashboardProvider/duplicate-panel-slice.js +1 -1
- package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +2 -2
- package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +6 -2
- package/dist/cjs/context/DashboardProvider/panel-group-slice.js +1 -0
- package/dist/cjs/context/DashboardProvider/view-panel-slice.js +10 -3
- package/dist/cjs/context/PanelEditorProvider/PanelEditorProvider.js +49 -0
- package/dist/cjs/context/PanelEditorProvider/index.js +23 -0
- package/dist/cjs/context/VariableProvider/VariableProvider.js +1 -1
- package/dist/cjs/context/index.js +1 -0
- package/dist/cjs/context/useDashboard.js +5 -4
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +7 -3
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +9 -8
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts.map +1 -1
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js +0 -2
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts +2 -2
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +5 -15
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
- package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
- package/dist/components/GridLayout/GridItemContent.js +39 -18
- package/dist/components/GridLayout/GridItemContent.js.map +1 -1
- package/dist/components/GridLayout/GridLayout.d.ts +8 -0
- package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
- package/dist/components/GridLayout/GridLayout.js +72 -126
- package/dist/components/GridLayout/GridLayout.js.map +1 -1
- package/dist/components/GridLayout/Row.d.ts +17 -0
- package/dist/components/GridLayout/Row.d.ts.map +1 -0
- package/dist/components/GridLayout/Row.js +142 -0
- package/dist/components/GridLayout/Row.js.map +1 -0
- package/dist/components/GridLayout/index.d.ts +1 -0
- package/dist/components/GridLayout/index.d.ts.map +1 -1
- package/dist/components/GridLayout/index.js +1 -0
- package/dist/components/GridLayout/index.js.map +1 -1
- package/dist/components/LeaveDialog/LeaveDialog.d.ts +13 -0
- package/dist/components/LeaveDialog/LeaveDialog.d.ts.map +1 -0
- package/dist/components/LeaveDialog/LeaveDialog.js +70 -0
- package/dist/components/LeaveDialog/LeaveDialog.js.map +1 -0
- package/dist/components/LeaveDialog/index.d.ts +2 -0
- package/dist/components/LeaveDialog/index.d.ts.map +1 -0
- package/dist/components/LeaveDialog/index.js +15 -0
- package/dist/components/LeaveDialog/index.js.map +1 -0
- package/dist/components/Panel/HeaderIconButton.d.ts +1 -1
- package/dist/components/Panel/Panel.d.ts +6 -0
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/Panel.js +7 -2
- package/dist/components/Panel/Panel.js.map +1 -1
- package/dist/components/Panel/PanelActions.d.ts +5 -0
- package/dist/components/Panel/PanelActions.d.ts.map +1 -1
- package/dist/components/Panel/PanelActions.js +37 -14
- package/dist/components/Panel/PanelActions.js.map +1 -1
- package/dist/components/Panel/PanelHeader.d.ts +7 -1
- package/dist/components/Panel/PanelHeader.d.ts.map +1 -1
- package/dist/components/Panel/PanelHeader.js +36 -16
- package/dist/components/Panel/PanelHeader.js.map +1 -1
- package/dist/components/Panel/index.d.ts +1 -0
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +1 -0
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.js +59 -22
- package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js +205 -183
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.js +4 -1
- package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js +8 -15
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts +1 -0
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js +36 -16
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -1
- package/dist/components/QueryViewerDialog/QueryViewerDialog.d.ts +9 -0
- package/dist/components/QueryViewerDialog/QueryViewerDialog.d.ts.map +1 -0
- package/dist/components/QueryViewerDialog/QueryViewerDialog.js +72 -0
- package/dist/components/QueryViewerDialog/QueryViewerDialog.js.map +1 -0
- package/dist/components/QueryViewerDialog/index.d.ts +2 -0
- package/dist/components/QueryViewerDialog/index.d.ts.map +1 -0
- package/dist/components/QueryViewerDialog/index.js +15 -0
- package/dist/components/QueryViewerDialog/index.js.map +1 -0
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts.map +1 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +2 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
- package/dist/components/Variables/ListVariableListBox.d.ts +16 -0
- package/dist/components/Variables/ListVariableListBox.d.ts.map +1 -0
- package/dist/components/Variables/ListVariableListBox.js +141 -0
- package/dist/components/Variables/ListVariableListBox.js.map +1 -0
- package/dist/components/Variables/Variable.d.ts.map +1 -1
- package/dist/components/Variables/Variable.js +134 -76
- package/dist/components/Variables/Variable.js.map +1 -1
- package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditor.js +24 -17
- package/dist/components/Variables/VariableEditor.js.map +1 -1
- package/dist/components/Variables/index.d.ts +1 -0
- package/dist/components/Variables/index.d.ts.map +1 -1
- package/dist/components/Variables/index.js +1 -0
- package/dist/components/Variables/index.js.map +1 -1
- package/dist/components/index.d.ts +3 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +3 -1
- package/dist/components/index.js.map +1 -1
- package/dist/constants/user-interface-text.d.ts +2 -0
- package/dist/constants/user-interface-text.d.ts.map +1 -1
- package/dist/constants/user-interface-text.js +4 -2
- package/dist/constants/user-interface-text.js.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.d.ts +5 -5
- package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.js +7 -8
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
- package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.d.ts.map +1 -1
- package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js +5 -5
- package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js.map +1 -1
- package/dist/context/DashboardProvider/common.d.ts +1 -1
- package/dist/context/DashboardProvider/common.d.ts.map +1 -1
- package/dist/context/DashboardProvider/common.js.map +1 -1
- package/dist/context/DashboardProvider/duplicate-panel-slice.js +2 -2
- package/dist/context/DashboardProvider/duplicate-panel-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts +1 -0
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.js +3 -3
- package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts +1 -0
- package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.js +6 -2
- package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.d.ts +3 -0
- package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.js +1 -0
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/view-panel-slice.d.ts +6 -2
- package/dist/context/DashboardProvider/view-panel-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/view-panel-slice.js +10 -3
- package/dist/context/DashboardProvider/view-panel-slice.js.map +1 -1
- package/dist/context/PanelEditorProvider/PanelEditorProvider.d.ts +13 -0
- package/dist/context/PanelEditorProvider/PanelEditorProvider.d.ts.map +1 -0
- package/dist/context/PanelEditorProvider/PanelEditorProvider.js +33 -0
- package/dist/context/PanelEditorProvider/PanelEditorProvider.js.map +1 -0
- package/dist/context/PanelEditorProvider/index.d.ts +3 -0
- package/dist/context/PanelEditorProvider/index.d.ts.map +1 -0
- package/dist/context/PanelEditorProvider/index.js +16 -0
- package/dist/context/PanelEditorProvider/index.js.map +1 -0
- package/dist/context/VariableProvider/VariableProvider.js +1 -1
- package/dist/context/VariableProvider/VariableProvider.js.map +1 -1
- package/dist/context/index.d.ts +1 -0
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +1 -0
- package/dist/context/index.js.map +1 -1
- package/dist/context/useDashboard.js +5 -4
- package/dist/context/useDashboard.js.map +1 -1
- package/dist/utils/panelUtils.d.ts +3 -0
- package/dist/utils/panelUtils.d.ts.map +1 -1
- package/dist/utils/panelUtils.js +3 -0
- package/dist/utils/panelUtils.js.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.d.ts +7 -6
- package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.js +8 -4
- package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.js +9 -8
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Copyright 2025 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
|
+
_export_star(require("./LeaveDialog"), exports);
|
|
18
|
+
function _export_star(from, to) {
|
|
19
|
+
Object.keys(from).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
21
|
+
Object.defineProperty(to, k, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function() {
|
|
24
|
+
return from[k];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return from;
|
|
30
|
+
}
|
|
@@ -34,7 +34,7 @@ function _interop_require_default(obj) {
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
const Panel = /*#__PURE__*/ (0, _react.memo)(function Panel(props) {
|
|
37
|
-
const { definition, readHandlers, editHandlers, onMouseEnter, onMouseLeave, sx, panelOptions, panelGroupItemId, ...others } = props;
|
|
37
|
+
const { definition, readHandlers, editHandlers, onMouseEnter, onMouseLeave, sx, panelOptions, panelGroupItemId, viewQueriesHandler, ...others } = props;
|
|
38
38
|
// Make sure we have an ID we can use for aria attributes
|
|
39
39
|
const generatedPanelId = (0, _components.useId)('Panel');
|
|
40
40
|
const headerId = `${generatedPanelId}-header`;
|
|
@@ -142,6 +142,8 @@ const Panel = /*#__PURE__*/ (0, _react.memo)(function Panel(props) {
|
|
|
142
142
|
const handleMouseLeave = (e)=>{
|
|
143
143
|
onMouseLeave?.(e);
|
|
144
144
|
};
|
|
145
|
+
// default value for showIcons: if the dashboard is in editing mode or the panel is in fullscreen mode: 'always', otherwise 'hover'
|
|
146
|
+
const showIcons = panelOptions?.showIcons ?? (editHandlers || readHandlers?.isPanelViewed ? 'always' : 'hover');
|
|
145
147
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Card, {
|
|
146
148
|
component: "section",
|
|
147
149
|
sx: (0, _components.combineSx)({
|
|
@@ -172,11 +174,14 @@ const Panel = /*#__PURE__*/ (0, _react.memo)(function Panel(props) {
|
|
|
172
174
|
queryResults: queryResults,
|
|
173
175
|
readHandlers: readHandlers,
|
|
174
176
|
editHandlers: editHandlers,
|
|
177
|
+
viewQueriesHandler: viewQueriesHandler,
|
|
175
178
|
links: definition.spec.links,
|
|
176
179
|
pluginActions: pluginActions,
|
|
180
|
+
showIcons: showIcons,
|
|
177
181
|
sx: {
|
|
178
182
|
paddingX: `${chartsTheme.container.padding.default}px`
|
|
179
|
-
}
|
|
183
|
+
},
|
|
184
|
+
dimension: contentDimensions
|
|
180
185
|
}),
|
|
181
186
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.CardContent, {
|
|
182
187
|
component: "figure",
|
|
@@ -24,6 +24,7 @@ const _jsxruntime = require("react/jsx-runtime");
|
|
|
24
24
|
const _material = require("@mui/material");
|
|
25
25
|
const _react = require("react");
|
|
26
26
|
const _components = require("@perses-dev/components");
|
|
27
|
+
const _DatabaseSearch = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/DatabaseSearch"));
|
|
27
28
|
const _ArrowCollapse = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/ArrowCollapse"));
|
|
28
29
|
const _ArrowExpand = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/ArrowExpand"));
|
|
29
30
|
const _PencilOutline = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/PencilOutline"));
|
|
@@ -47,7 +48,7 @@ const ConditionalBox = (0, _material.styled)(_material.Box)({
|
|
|
47
48
|
flexGrow: 1,
|
|
48
49
|
justifyContent: 'flex-end'
|
|
49
50
|
});
|
|
50
|
-
const PanelActions = ({ editHandlers, readHandlers, extra, title, description, descriptionTooltipId, links, queryResults, pluginActions = [] })=>{
|
|
51
|
+
const PanelActions = ({ editHandlers, readHandlers, viewQueriesHandler, extra, title, description, descriptionTooltipId, links, queryResults, pluginActions = [], showIcons })=>{
|
|
51
52
|
const descriptionAction = (0, _react.useMemo)(()=>{
|
|
52
53
|
if (description && description.trim().length > 0) {
|
|
53
54
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
|
|
@@ -124,6 +125,23 @@ const PanelActions = ({ editHandlers, readHandlers, extra, title, description, d
|
|
|
124
125
|
readHandlers,
|
|
125
126
|
title
|
|
126
127
|
]);
|
|
128
|
+
const viewQueryAction = (0, _react.useMemo)(()=>{
|
|
129
|
+
if (!viewQueriesHandler?.onClick) return null;
|
|
130
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
|
|
131
|
+
description: _constants.TOOLTIP_TEXT.queryView,
|
|
132
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_HeaderIconButton.HeaderIconButton, {
|
|
133
|
+
"aria-label": _constants.ARIA_LABEL_TEXT.openQueryView(title),
|
|
134
|
+
size: "small",
|
|
135
|
+
onClick: viewQueriesHandler.onClick,
|
|
136
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_DatabaseSearch.default, {
|
|
137
|
+
fontSize: "inherit"
|
|
138
|
+
})
|
|
139
|
+
})
|
|
140
|
+
});
|
|
141
|
+
}, [
|
|
142
|
+
viewQueriesHandler,
|
|
143
|
+
title
|
|
144
|
+
]);
|
|
127
145
|
const editActions = (0, _react.useMemo)(()=>{
|
|
128
146
|
if (editHandlers !== undefined) {
|
|
129
147
|
// If there are edit handlers, always just show the edit buttons
|
|
@@ -203,8 +221,8 @@ const PanelActions = ({ editHandlers, readHandlers, extra, title, description, d
|
|
|
203
221
|
flexGrow: 1
|
|
204
222
|
}
|
|
205
223
|
});
|
|
206
|
-
// if the panel is in non-editing, non-fullscreen mode
|
|
207
|
-
const OnHover = ({ children })=>
|
|
224
|
+
// By default, the panel header shows certain icons only on hover if the panel is in non-editing, non-fullscreen mode
|
|
225
|
+
const OnHover = ({ children })=>showIcons === 'hover' ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
208
226
|
sx: {
|
|
209
227
|
display: 'var(--panel-hover, none)'
|
|
210
228
|
},
|
|
@@ -235,12 +253,13 @@ const PanelActions = ({ editHandlers, readHandlers, extra, title, description, d
|
|
|
235
253
|
" ",
|
|
236
254
|
extraActions,
|
|
237
255
|
" ",
|
|
256
|
+
viewQueryAction,
|
|
238
257
|
readActions,
|
|
239
258
|
" ",
|
|
259
|
+
pluginActions,
|
|
240
260
|
editActions
|
|
241
261
|
]
|
|
242
262
|
}),
|
|
243
|
-
pluginActions,
|
|
244
263
|
moveAction
|
|
245
264
|
]
|
|
246
265
|
})
|
|
@@ -266,13 +285,16 @@ const PanelActions = ({ editHandlers, readHandlers, extra, title, description, d
|
|
|
266
285
|
/*#__PURE__*/ (0, _jsxruntime.jsxs)(OnHover, {
|
|
267
286
|
children: [
|
|
268
287
|
extraActions,
|
|
269
|
-
" ",
|
|
270
288
|
readActions,
|
|
271
|
-
|
|
272
|
-
pluginActions,
|
|
273
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(OverflowMenu, {
|
|
289
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(OverflowMenu, {
|
|
274
290
|
title: title,
|
|
275
|
-
children:
|
|
291
|
+
children: [
|
|
292
|
+
editActions,
|
|
293
|
+
" ",
|
|
294
|
+
viewQueryAction,
|
|
295
|
+
" ",
|
|
296
|
+
pluginActions
|
|
297
|
+
]
|
|
276
298
|
}),
|
|
277
299
|
moveAction
|
|
278
300
|
]
|
|
@@ -301,13 +323,14 @@ const PanelActions = ({ editHandlers, readHandlers, extra, title, description, d
|
|
|
301
323
|
/*#__PURE__*/ (0, _jsxruntime.jsxs)(OnHover, {
|
|
302
324
|
children: [
|
|
303
325
|
extraActions,
|
|
304
|
-
|
|
326
|
+
viewQueryAction,
|
|
305
327
|
readActions,
|
|
306
328
|
" ",
|
|
307
|
-
pluginActions,
|
|
308
|
-
" ",
|
|
309
329
|
editActions,
|
|
310
|
-
|
|
330
|
+
pluginActions.length <= 1 ? pluginActions : /*#__PURE__*/ (0, _jsxruntime.jsx)(OverflowMenu, {
|
|
331
|
+
title: title,
|
|
332
|
+
children: pluginActions
|
|
333
|
+
}),
|
|
311
334
|
moveAction
|
|
312
335
|
]
|
|
313
336
|
})
|
|
@@ -321,7 +344,7 @@ const OverflowMenu = ({ children, title })=>{
|
|
|
321
344
|
// do not show overflow menu if there is no content (for example, edit actions are hidden)
|
|
322
345
|
const hasContent = /*#__PURE__*/ (0, _react.isValidElement)(children) || Array.isArray(children) && children.some(_react.isValidElement);
|
|
323
346
|
if (!hasContent) {
|
|
324
|
-
return
|
|
347
|
+
return null;
|
|
325
348
|
}
|
|
326
349
|
const handleClick = (event)=>{
|
|
327
350
|
setAnchorPosition(event.currentTarget.getBoundingClientRect());
|
|
@@ -24,13 +24,24 @@ const _jsxruntime = require("react/jsx-runtime");
|
|
|
24
24
|
const _material = require("@mui/material");
|
|
25
25
|
const _components = require("@perses-dev/components");
|
|
26
26
|
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
27
|
+
const _react = require("react");
|
|
27
28
|
const _constants = require("../../constants");
|
|
28
29
|
const _PanelActions = require("./PanelActions");
|
|
29
|
-
function PanelHeader({ id, title: rawTitle, description: rawDescription, links, queryResults, readHandlers, editHandlers, sx, extra, pluginActions, ...rest }) {
|
|
30
|
+
function PanelHeader({ id, title: rawTitle, description: rawDescription, links, queryResults, readHandlers, editHandlers, sx, extra, pluginActions, showIcons, viewQueriesHandler, dimension, ...rest }) {
|
|
30
31
|
const titleElementId = `${id}-title`;
|
|
31
32
|
const descriptionTooltipId = `${id}-description`;
|
|
32
33
|
const title = (0, _pluginsystem.useReplaceVariablesInString)(rawTitle);
|
|
33
34
|
const description = (0, _pluginsystem.useReplaceVariablesInString)(rawDescription);
|
|
35
|
+
const textRef = (0, _react.useRef)(null);
|
|
36
|
+
const [isEllipsisActive, setIsEllipsisActive] = (0, _react.useState)(false);
|
|
37
|
+
(0, _react.useEffect)(()=>{
|
|
38
|
+
if (textRef.current && dimension?.width) {
|
|
39
|
+
setIsEllipsisActive(textRef.current.scrollWidth > textRef.current.clientWidth);
|
|
40
|
+
}
|
|
41
|
+
}, [
|
|
42
|
+
title,
|
|
43
|
+
dimension?.width
|
|
44
|
+
]);
|
|
34
45
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.CardHeader, {
|
|
35
46
|
id: id,
|
|
36
47
|
component: "header",
|
|
@@ -39,20 +50,27 @@ function PanelHeader({ id, title: rawTitle, description: rawDescription, links,
|
|
|
39
50
|
disableTypography: true,
|
|
40
51
|
title: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
41
52
|
direction: "row",
|
|
53
|
+
alignItems: "center",
|
|
54
|
+
height: "var(--panel-header-height, 30px)",
|
|
42
55
|
children: [
|
|
43
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Tooltip, {
|
|
57
|
+
title: title,
|
|
58
|
+
disableHoverListener: !isEllipsisActive,
|
|
59
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
60
|
+
id: titleElementId,
|
|
61
|
+
variant: "subtitle1",
|
|
62
|
+
ref: textRef,
|
|
63
|
+
sx: {
|
|
64
|
+
// `minHeight` guarantees that the header has the correct height
|
|
65
|
+
// when there is no title (i.e. in the preview)
|
|
66
|
+
lineHeight: '24px',
|
|
67
|
+
minHeight: '26px',
|
|
68
|
+
whiteSpace: 'nowrap',
|
|
69
|
+
overflow: 'hidden',
|
|
70
|
+
textOverflow: 'ellipsis'
|
|
71
|
+
},
|
|
72
|
+
children: title
|
|
73
|
+
})
|
|
56
74
|
}),
|
|
57
75
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_PanelActions.PanelActions, {
|
|
58
76
|
title: title,
|
|
@@ -61,9 +79,11 @@ function PanelHeader({ id, title: rawTitle, description: rawDescription, links,
|
|
|
61
79
|
links: links,
|
|
62
80
|
readHandlers: readHandlers,
|
|
63
81
|
editHandlers: editHandlers,
|
|
82
|
+
viewQueriesHandler: viewQueriesHandler,
|
|
64
83
|
extra: extra,
|
|
65
84
|
queryResults: queryResults,
|
|
66
|
-
pluginActions: pluginActions
|
|
85
|
+
pluginActions: pluginActions,
|
|
86
|
+
showIcons: showIcons
|
|
67
87
|
})
|
|
68
88
|
]
|
|
69
89
|
}),
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
+
_export_star(require("./HeaderIconButton"), exports);
|
|
17
18
|
_export_star(require("./Panel"), exports);
|
|
18
19
|
_export_star(require("./PanelPluginLoader"), exports);
|
|
19
20
|
function _export_star(from, to) {
|
|
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "PanelDrawer", {
|
|
|
23
23
|
const _jsxruntime = require("react/jsx-runtime");
|
|
24
24
|
const _react = require("react");
|
|
25
25
|
const _components = require("@perses-dev/components");
|
|
26
|
+
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
26
27
|
const _context = require("../../context");
|
|
27
28
|
const _PanelEditorForm = require("./PanelEditorForm");
|
|
28
29
|
const PanelDrawer = ()=>{
|
|
@@ -30,42 +31,78 @@ const PanelDrawer = ()=>{
|
|
|
30
31
|
// When the user clicks close, start closing but don't call the store yet to keep values stable during animtation
|
|
31
32
|
const [isClosing, setIsClosing] = (0, _react.useState)(false);
|
|
32
33
|
// Drawer is open if we have a model and we're not transitioning out
|
|
33
|
-
const isOpen = panelEditor !== undefined && isClosing
|
|
34
|
-
|
|
34
|
+
const isOpen = panelEditor !== undefined && !isClosing;
|
|
35
|
+
const handleSave = (0, _react.useCallback)((values)=>{
|
|
35
36
|
// This shouldn't happen since we don't render the submit button until we have a model, but check to make TS happy
|
|
36
37
|
if (panelEditor === undefined || values === undefined) {
|
|
37
38
|
throw new Error('Cannot apply changes');
|
|
38
39
|
}
|
|
39
40
|
panelEditor.applyChanges(values);
|
|
40
41
|
setIsClosing(true);
|
|
41
|
-
}
|
|
42
|
+
}, [
|
|
43
|
+
panelEditor
|
|
44
|
+
]);
|
|
42
45
|
const handleClose = ()=>{
|
|
43
46
|
setIsClosing(true);
|
|
44
47
|
};
|
|
45
48
|
// Don't call closeDrawer on the store until the Drawer has completely transitioned out and reset close state
|
|
46
|
-
const handleExited = ()=>{
|
|
49
|
+
const handleExited = (0, _react.useCallback)(()=>{
|
|
47
50
|
panelEditor?.close();
|
|
48
51
|
setIsClosing(false);
|
|
49
|
-
}
|
|
52
|
+
}, [
|
|
53
|
+
panelEditor
|
|
54
|
+
]);
|
|
50
55
|
// Disables closing on click out. This is a quick-win solution to avoid losing draft changes.
|
|
51
56
|
// -> TODO find a way to enable closing by clicking-out in edit view, with a discard confirmation modal popping up
|
|
52
57
|
const handleClickOut = ()=>{
|
|
53
58
|
/* do nothing */ };
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
59
|
+
const drawer = (0, _react.useMemo)(()=>{
|
|
60
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.Drawer, {
|
|
61
|
+
isOpen: isOpen,
|
|
62
|
+
onClose: handleClickOut,
|
|
63
|
+
SlideProps: {
|
|
64
|
+
onExited: handleExited
|
|
65
|
+
},
|
|
66
|
+
"data-testid": "panel-editor",
|
|
67
|
+
children: panelEditor && /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorBoundary, {
|
|
68
|
+
FallbackComponent: _components.ErrorAlert,
|
|
69
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_PanelEditorForm.PanelEditorForm, {
|
|
70
|
+
initialAction: panelEditor.mode,
|
|
71
|
+
initialValues: panelEditor.initialValues,
|
|
72
|
+
onSave: handleSave,
|
|
73
|
+
onClose: handleClose
|
|
74
|
+
})
|
|
68
75
|
})
|
|
69
|
-
})
|
|
70
|
-
}
|
|
76
|
+
});
|
|
77
|
+
}, [
|
|
78
|
+
handleExited,
|
|
79
|
+
handleSave,
|
|
80
|
+
isOpen,
|
|
81
|
+
panelEditor
|
|
82
|
+
]);
|
|
83
|
+
// If the panel editor is using a repeat variable, we need to wrap the drawer in a VariableContext.Provider
|
|
84
|
+
if (panelEditor?.panelGroupItemId?.repeatVariable) {
|
|
85
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(RepeatVariableWrapper, {
|
|
86
|
+
repeatVariable: panelEditor.panelGroupItemId.repeatVariable,
|
|
87
|
+
children: drawer
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return drawer;
|
|
71
91
|
};
|
|
92
|
+
// Wraps the drawer in a VariableContext.Provider to provide the repeat variable value
|
|
93
|
+
// This is necessary for previewing panels that use repeat variables and query editor
|
|
94
|
+
function RepeatVariableWrapper({ repeatVariable, children }) {
|
|
95
|
+
const variables = (0, _pluginsystem.useVariableValues)();
|
|
96
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.VariableContext.Provider, {
|
|
97
|
+
value: {
|
|
98
|
+
state: {
|
|
99
|
+
...variables,
|
|
100
|
+
[repeatVariable[0]]: {
|
|
101
|
+
value: repeatVariable[1],
|
|
102
|
+
loading: false
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
children: children
|
|
107
|
+
});
|
|
108
|
+
}
|