@perses-dev/dashboards 0.43.0 → 0.44.0-rc0
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/AddGroupButton/AddGroupButton.js +1 -1
- package/dist/cjs/components/AddPanelButton/AddPanelButton.js +2 -2
- package/dist/cjs/components/Dashboard/Dashboard.js +1 -1
- package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +3 -3
- package/dist/cjs/components/Datasources/DatasourceEditor.js +1 -1
- package/dist/cjs/components/Datasources/EditDatasourcesButton.js +3 -3
- package/dist/cjs/components/DeletePanelDialog/DeletePanelDialog.js +4 -4
- package/dist/cjs/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +1 -1
- package/dist/cjs/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +1 -1
- package/dist/cjs/components/DownloadButton/DownloadButton.js +2 -2
- package/dist/cjs/components/EditButton/EditButton.js +1 -1
- package/dist/cjs/components/EditJsonButton/EditJsonButton.js +2 -2
- package/dist/cjs/components/EditJsonDialog/EditJsonDialog.js +7 -7
- package/dist/cjs/components/EmptyDashboard/EmptyDashboard.js +3 -3
- package/dist/cjs/components/GridLayout/GridContainer.js +1 -1
- package/dist/cjs/components/GridLayout/GridItemContent.js +5 -5
- package/dist/cjs/components/GridLayout/GridLayout.js +4 -4
- package/dist/cjs/components/GridLayout/GridTitle.js +5 -5
- package/dist/cjs/components/Panel/Panel.js +3 -2
- package/dist/cjs/components/Panel/PanelContent.js +4 -3
- package/dist/cjs/components/Panel/PanelHeader.js +2 -2
- package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +18 -15
- package/dist/cjs/components/PanelDrawer/PanelPreview.js +1 -1
- package/dist/cjs/components/PanelDrawer/usePanelEditor.js +2 -2
- package/dist/cjs/components/PanelGroupDialog/PanelGroupEditorForm.js +1 -1
- package/dist/cjs/components/QuerySummaryTable/QuerySummaryTable.js +2 -2
- package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +4 -4
- package/dist/cjs/components/SaveDashboardButton/SaveDashboardButton.js +7 -7
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +6 -6
- package/dist/cjs/components/ToolbarIconButton/ToolbarIconButton.js +1 -1
- package/dist/cjs/components/Variables/BuiltinVariableAccordions.js +7 -6
- package/dist/cjs/components/Variables/EditVariablesButton.js +2 -2
- package/dist/cjs/components/Variables/TemplateVariable.js +20 -11
- package/dist/cjs/components/Variables/VariableEditor.js +13 -14
- package/dist/cjs/components/Variables/VariableList.js +1 -1
- package/dist/cjs/constants/styles.js +4 -4
- package/dist/cjs/constants/user-interface-text.js +3 -3
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +10 -10
- package/dist/cjs/context/DashboardProvider/common.js +3 -3
- package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +40 -40
- package/dist/cjs/context/DashboardProvider/delete-panel-group-slice.js +1 -1
- package/dist/cjs/context/DashboardProvider/delete-panel-slice.js +3 -3
- package/dist/cjs/context/DashboardProvider/duplicate-panel-slice.js +1 -1
- package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +4 -6
- package/dist/cjs/context/DashboardProvider/panel-group-slice.js +6 -6
- package/dist/cjs/context/DatasourceStoreProvider.js +8 -8
- package/dist/cjs/context/TemplateVariableProvider/TemplateVariableProvider.js +81 -77
- package/dist/cjs/context/TemplateVariableProvider/query-params.js +7 -7
- package/dist/cjs/context/TemplateVariableProvider/utils.js +3 -3
- package/dist/cjs/context/useDashboard.js +3 -3
- package/dist/cjs/test/dashboard-provider.js +3 -3
- package/dist/cjs/test/datasource-provider.js +4 -4
- package/dist/cjs/test/render.js +1 -1
- package/dist/cjs/utils/panelUtils.js +5 -5
- package/dist/cjs/utils/time.js +1 -1
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +5 -5
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +3 -3
- package/dist/components/AddGroupButton/AddGroupButton.d.ts +1 -2
- package/dist/components/AddGroupButton/AddGroupButton.d.ts.map +1 -1
- package/dist/components/AddGroupButton/AddGroupButton.js +1 -1
- package/dist/components/AddGroupButton/AddGroupButton.js.map +1 -1
- package/dist/components/AddPanelButton/AddPanelButton.d.ts +1 -2
- package/dist/components/AddPanelButton/AddPanelButton.d.ts.map +1 -1
- package/dist/components/AddPanelButton/AddPanelButton.js +2 -2
- package/dist/components/AddPanelButton/AddPanelButton.js.map +1 -1
- package/dist/components/Dashboard/Dashboard.d.ts +2 -3
- package/dist/components/Dashboard/Dashboard.d.ts.map +1 -1
- package/dist/components/Dashboard/Dashboard.js +1 -1
- package/dist/components/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts +1 -2
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts.map +1 -1
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.js +3 -3
- package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
- package/dist/components/Datasources/DatasourceEditor.d.ts +1 -2
- 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.d.ts +1 -2
- package/dist/components/Datasources/EditDatasourcesButton.d.ts.map +1 -1
- package/dist/components/Datasources/EditDatasourcesButton.js +3 -3
- package/dist/components/Datasources/EditDatasourcesButton.js.map +1 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts +1 -2
- package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts.map +1 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.js +4 -4
- package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts +1 -2
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.d.ts +1 -2
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.d.ts.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.d.ts +1 -2
- package/dist/components/DownloadButton/DownloadButton.d.ts.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.js +2 -2
- package/dist/components/DownloadButton/DownloadButton.js.map +1 -1
- package/dist/components/EditButton/EditButton.d.ts +1 -2
- package/dist/components/EditButton/EditButton.d.ts.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.d.ts +1 -2
- package/dist/components/EditJsonButton/EditJsonButton.d.ts.map +1 -1
- package/dist/components/EditJsonButton/EditJsonButton.js +2 -2
- package/dist/components/EditJsonButton/EditJsonButton.js.map +1 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.d.ts +1 -2
- package/dist/components/EditJsonDialog/EditJsonDialog.d.ts.map +1 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.js +7 -7
- package/dist/components/EditJsonDialog/EditJsonDialog.js.map +1 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.d.ts +1 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.d.ts.map +1 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.js +3 -3
- package/dist/components/EmptyDashboard/EmptyDashboard.js.map +1 -1
- package/dist/components/GridLayout/GridContainer.d.ts +1 -1
- package/dist/components/GridLayout/GridContainer.d.ts.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 -2
- package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
- package/dist/components/GridLayout/GridItemContent.js +5 -5
- package/dist/components/GridLayout/GridItemContent.js.map +1 -1
- package/dist/components/GridLayout/GridLayout.d.ts +1 -2
- package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
- package/dist/components/GridLayout/GridLayout.js +4 -4
- package/dist/components/GridLayout/GridLayout.js.map +1 -1
- package/dist/components/GridLayout/GridTitle.d.ts +1 -2
- package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
- package/dist/components/GridLayout/GridTitle.js +5 -5
- package/dist/components/GridLayout/GridTitle.js.map +1 -1
- package/dist/components/Panel/Panel.d.ts +2 -2
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/Panel.js +3 -2
- package/dist/components/Panel/Panel.js.map +1 -1
- package/dist/components/Panel/PanelContent.d.ts +3 -3
- package/dist/components/Panel/PanelContent.d.ts.map +1 -1
- package/dist/components/Panel/PanelContent.js +4 -3
- package/dist/components/Panel/PanelContent.js.map +1 -1
- package/dist/components/Panel/PanelHeader.d.ts +2 -2
- package/dist/components/Panel/PanelHeader.d.ts.map +1 -1
- package/dist/components/Panel/PanelHeader.js +2 -2
- package/dist/components/Panel/PanelHeader.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.d.ts +1 -2
- package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts +1 -2
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js +18 -15
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.d.ts +1 -2
- package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.js +1 -1
- package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
- package/dist/components/PanelDrawer/usePanelEditor.js +2 -2
- package/dist/components/PanelDrawer/usePanelEditor.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts +1 -2
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts +1 -2
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts.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.d.ts +1 -2
- package/dist/components/QuerySummaryTable/QuerySummaryTable.d.ts.map +1 -1
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js +2 -2
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts +1 -2
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts.map +1 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +4 -4
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
- package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts +1 -2
- package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts.map +1 -1
- package/dist/components/SaveDashboardButton/SaveDashboardButton.js +7 -7
- package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +1 -2
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js +3 -3
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
- package/dist/components/ToolbarIconButton/ToolbarIconButton.d.ts +2 -2
- package/dist/components/ToolbarIconButton/ToolbarIconButton.d.ts.map +1 -1
- package/dist/components/ToolbarIconButton/ToolbarIconButton.js +1 -1
- package/dist/components/ToolbarIconButton/ToolbarIconButton.js.map +1 -1
- package/dist/components/Variables/BuiltinVariableAccordions.d.ts +2 -3
- package/dist/components/Variables/BuiltinVariableAccordions.d.ts.map +1 -1
- package/dist/components/Variables/BuiltinVariableAccordions.js +7 -6
- package/dist/components/Variables/BuiltinVariableAccordions.js.map +1 -1
- package/dist/components/Variables/EditVariablesButton.d.ts +1 -2
- package/dist/components/Variables/EditVariablesButton.d.ts.map +1 -1
- package/dist/components/Variables/EditVariablesButton.js +2 -2
- package/dist/components/Variables/EditVariablesButton.js.map +1 -1
- package/dist/components/Variables/TemplateVariable.d.ts +2 -3
- package/dist/components/Variables/TemplateVariable.d.ts.map +1 -1
- package/dist/components/Variables/TemplateVariable.js +20 -11
- package/dist/components/Variables/TemplateVariable.js.map +1 -1
- package/dist/components/Variables/VariableEditor.d.ts +2 -3
- package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditor.js +13 -14
- package/dist/components/Variables/VariableEditor.js.map +1 -1
- package/dist/components/Variables/VariableList.d.ts +2 -3
- 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/context/DashboardProvider/DashboardProvider.d.ts +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.js +7 -7
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
- package/dist/context/DashboardProvider/common.d.ts +2 -2
- package/dist/context/DashboardProvider/common.d.ts.map +1 -1
- package/dist/context/DashboardProvider/common.js.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.js +15 -15
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.js +1 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-slice.js +3 -3
- package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -1
- package/dist/context/DashboardProvider/discard-changes-dialog-slice.js.map +1 -1
- package/dist/context/DashboardProvider/duplicate-panel-slice.js +1 -1
- package/dist/context/DashboardProvider/duplicate-panel-slice.js.map +1 -1
- package/dist/context/DashboardProvider/edit-json-dialog-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.js +4 -6
- package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.d.ts +2 -2
- package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.js +2 -2
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/save-changes-dialog-slice.js.map +1 -1
- package/dist/context/DatasourceStoreProvider.d.ts +3 -3
- package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
- package/dist/context/DatasourceStoreProvider.js +8 -8
- package/dist/context/DatasourceStoreProvider.js.map +1 -1
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts +6 -6
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts.map +1 -1
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js +70 -66
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js.map +1 -1
- package/dist/context/TemplateVariableProvider/hydrationUtils.d.ts.map +1 -1
- package/dist/context/TemplateVariableProvider/hydrationUtils.js.map +1 -1
- package/dist/context/TemplateVariableProvider/query-params.js.map +1 -1
- package/dist/context/TemplateVariableProvider/utils.js.map +1 -1
- package/dist/context/useDashboard.js +3 -3
- package/dist/context/useDashboard.js.map +1 -1
- package/dist/stories/decorators/WithDashboard.js.map +1 -1
- package/dist/stories/decorators/WithDatasourceStore.js.map +1 -1
- package/dist/stories/decorators/WithTemplateVariables.js.map +1 -1
- package/dist/test/dashboard-provider.js.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/test/setup-tests.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 +2 -2
- package/dist/utils/panelUtils.js.map +1 -1
- package/dist/utils/time.js +1 -1
- package/dist/utils/time.js.map +1 -1
- package/dist/validation/panel.d.ts +1 -1
- package/dist/validation/panel.d.ts.map +1 -1
- package/dist/validation/panel.js.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.d.ts +1 -1
- package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.js +5 -5
- package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.d.ts +1 -2
- package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.js +3 -3
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
- package/package.json +6 -6
|
@@ -21,8 +21,8 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
|
|
25
|
-
return
|
|
24
|
+
addPanelGroup: function() {
|
|
25
|
+
return addPanelGroup;
|
|
26
26
|
},
|
|
27
27
|
convertLayoutsToPanelGroups: function() {
|
|
28
28
|
return convertLayoutsToPanelGroups;
|
|
@@ -30,14 +30,14 @@ _export(exports, {
|
|
|
30
30
|
createEmptyPanelGroup: function() {
|
|
31
31
|
return createEmptyPanelGroup;
|
|
32
32
|
},
|
|
33
|
-
|
|
34
|
-
return
|
|
33
|
+
createPanelGroupSlice: function() {
|
|
34
|
+
return createPanelGroupSlice;
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
37
|
const _core = require("@perses-dev/core");
|
|
38
38
|
const _common = require("./common");
|
|
39
39
|
function createPanelGroupSlice(layouts) {
|
|
40
|
-
const { panelGroups
|
|
40
|
+
const { panelGroups, panelGroupOrder } = convertLayoutsToPanelGroups(layouts);
|
|
41
41
|
// Return the state creator function for Zustand
|
|
42
42
|
return (set)=>({
|
|
43
43
|
panelGroups,
|
|
@@ -75,7 +75,7 @@ function convertLayoutsToPanelGroups(layouts) {
|
|
|
75
75
|
const panelGroups = {};
|
|
76
76
|
const panelGroupIdOrder = [];
|
|
77
77
|
for (const layout of layouts){
|
|
78
|
-
var
|
|
78
|
+
var _layout_spec_display_collapse, _layout_spec_display, _layout_spec_display1;
|
|
79
79
|
const itemLayouts = [];
|
|
80
80
|
const itemPanelKeys = {};
|
|
81
81
|
// Split layout information from panel keys to make it easier to update just layouts on move/resize of panels
|
|
@@ -25,16 +25,16 @@ const _react = require("react");
|
|
|
25
25
|
const _core = require("@perses-dev/core");
|
|
26
26
|
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
27
27
|
function DatasourceStoreProvider(props) {
|
|
28
|
-
const { projectName
|
|
28
|
+
const { projectName, datasourceApi, onCreate, children } = props;
|
|
29
29
|
const [dashboardResource, setDashboardResource] = (0, _react.useState)(props.dashboardResource);
|
|
30
30
|
var _props_savedDatasources;
|
|
31
31
|
const [savedDatasources, setSavedDatasources] = (0, _react.useState)((_props_savedDatasources = props.savedDatasources) !== null && _props_savedDatasources !== void 0 ? _props_savedDatasources : {});
|
|
32
32
|
const project = projectName !== null && projectName !== void 0 ? projectName : dashboardResource === null || dashboardResource === void 0 ? void 0 : dashboardResource.metadata.project;
|
|
33
|
-
const { getPlugin
|
|
33
|
+
const { getPlugin, listPluginMetadata } = (0, _pluginsystem.usePluginRegistry)();
|
|
34
34
|
const findDatasource = (0, _core.useEvent)(async (selector)=>{
|
|
35
35
|
// Try to find it in dashboard spec
|
|
36
36
|
if (dashboardResource) {
|
|
37
|
-
const { datasources
|
|
37
|
+
const { datasources } = dashboardResource.spec;
|
|
38
38
|
const dashboardDatasource = findDashboardDatasource(datasources, selector);
|
|
39
39
|
if (dashboardDatasource !== undefined) {
|
|
40
40
|
return {
|
|
@@ -74,15 +74,15 @@ function DatasourceStoreProvider(props) {
|
|
|
74
74
|
});
|
|
75
75
|
// Gets a datasource spec for a given selector
|
|
76
76
|
const getDatasource = (0, _react.useCallback)(async (selector)=>{
|
|
77
|
-
const { spec
|
|
77
|
+
const { spec } = await findDatasource(selector);
|
|
78
78
|
return spec;
|
|
79
79
|
}, [
|
|
80
80
|
findDatasource
|
|
81
81
|
]);
|
|
82
82
|
// Given a Datasource selector, finds the spec for it and then uses its corresponding plugin the create a client
|
|
83
83
|
const getDatasourceClient = (0, _react.useCallback)(async function getClient(selector) {
|
|
84
|
-
const { kind
|
|
85
|
-
const [{ spec
|
|
84
|
+
const { kind } = selector;
|
|
85
|
+
const [{ spec, proxyUrl }, plugin] = await Promise.all([
|
|
86
86
|
findDatasource(selector),
|
|
87
87
|
getPlugin('Datasource', kind)
|
|
88
88
|
]);
|
|
@@ -111,7 +111,7 @@ function DatasourceStoreProvider(props) {
|
|
|
111
111
|
throw new Error(`Could not find a Datasource plugin with kind '${datasourcePluginKind}'`);
|
|
112
112
|
}
|
|
113
113
|
// Get helper for computing results properly
|
|
114
|
-
const { results
|
|
114
|
+
const { results, addItem } = buildDatasourceSelectItemGroups(datasourcePluginMetadata.display.name);
|
|
115
115
|
// Start with dashboard datasources with the highest precedence
|
|
116
116
|
if (dashboardResource === null || dashboardResource === void 0 ? void 0 : dashboardResource.spec.datasources) {
|
|
117
117
|
for(const selectorName in dashboardResource.spec.datasources){
|
|
@@ -229,7 +229,7 @@ function findDashboardDatasource(dashboardDatasources, selector) {
|
|
|
229
229
|
let explicitDefaultAdded = false;
|
|
230
230
|
const groupIndices = {};
|
|
231
231
|
let currentGroupIndex = 1; // 0 is the default group, always there as it contains at least the first item.
|
|
232
|
-
const addItem = ({ spec
|
|
232
|
+
const addItem = ({ spec, selectorName, selectorGroup: group, editLink, saved })=>{
|
|
233
233
|
var _spec_display;
|
|
234
234
|
group = group !== null && group !== void 0 ? group : '';
|
|
235
235
|
// Ensure the default group is always present as soon as an item is added.
|
|
@@ -21,11 +21,14 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
|
|
25
|
-
return
|
|
24
|
+
TemplateVariableProvider: function() {
|
|
25
|
+
return TemplateVariableProvider;
|
|
26
26
|
},
|
|
27
|
-
|
|
28
|
-
return
|
|
27
|
+
TemplateVariableProviderWithQueryParams: function() {
|
|
28
|
+
return TemplateVariableProviderWithQueryParams;
|
|
29
|
+
},
|
|
30
|
+
useTemplateExternalVariableDefinitions: function() {
|
|
31
|
+
return useTemplateExternalVariableDefinitions;
|
|
29
32
|
},
|
|
30
33
|
useTemplateVariable: function() {
|
|
31
34
|
return useTemplateVariable;
|
|
@@ -36,17 +39,14 @@ _export(exports, {
|
|
|
36
39
|
useTemplateVariableDefinitions: function() {
|
|
37
40
|
return useTemplateVariableDefinitions;
|
|
38
41
|
},
|
|
39
|
-
useTemplateExternalVariableDefinitions: function() {
|
|
40
|
-
return useTemplateExternalVariableDefinitions;
|
|
41
|
-
},
|
|
42
42
|
useTemplateVariableStore: function() {
|
|
43
43
|
return useTemplateVariableStore;
|
|
44
44
|
},
|
|
45
|
-
|
|
46
|
-
return
|
|
45
|
+
useTemplateVariableStoreCtx: function() {
|
|
46
|
+
return useTemplateVariableStoreCtx;
|
|
47
47
|
},
|
|
48
|
-
|
|
49
|
-
return
|
|
48
|
+
useTemplateVariableValues: function() {
|
|
49
|
+
return useTemplateVariableValues;
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
const _jsxruntime = require("react/jsx-runtime");
|
|
@@ -149,11 +149,11 @@ function useTemplateVariableStore() {
|
|
|
149
149
|
const store = useTemplateVariableStoreCtx();
|
|
150
150
|
return (0, _zustand.useStore)(store);
|
|
151
151
|
}
|
|
152
|
-
function PluginProvider({ children
|
|
152
|
+
function PluginProvider({ children, builtinVariables }) {
|
|
153
153
|
const originalValues = useTemplateVariableValues();
|
|
154
154
|
const definitions = useTemplateVariableDefinitions();
|
|
155
155
|
const externalDefinitions = useTemplateExternalVariableDefinitions();
|
|
156
|
-
const { absoluteTimeRange
|
|
156
|
+
const { absoluteTimeRange } = (0, _pluginsystem.useTimeRange)();
|
|
157
157
|
const values = (0, _react.useMemo)(()=>{
|
|
158
158
|
const contextValues = {};
|
|
159
159
|
// This will loop through all the current variables values
|
|
@@ -182,74 +182,80 @@ function PluginProvider({ children , builtinVariables }) {
|
|
|
182
182
|
definitions,
|
|
183
183
|
externalDefinitions
|
|
184
184
|
]);
|
|
185
|
-
const allBuiltinVariables =
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
value: ()=>absoluteTimeRange.start.valueOf().toString(),
|
|
191
|
-
source: 'Dashboard',
|
|
192
|
-
display: {
|
|
185
|
+
const allBuiltinVariables = (0, _react.useMemo)(()=>{
|
|
186
|
+
const result = [
|
|
187
|
+
{
|
|
188
|
+
kind: 'BuiltinVariable',
|
|
189
|
+
spec: {
|
|
193
190
|
name: '__from',
|
|
194
|
-
|
|
195
|
-
|
|
191
|
+
value: ()=>absoluteTimeRange.start.valueOf().toString(),
|
|
192
|
+
source: 'Dashboard',
|
|
193
|
+
display: {
|
|
194
|
+
name: '__from',
|
|
195
|
+
description: 'Start time of the current time range in unix millisecond epoch',
|
|
196
|
+
hidden: true
|
|
197
|
+
}
|
|
196
198
|
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
spec: {
|
|
202
|
-
name: '__to',
|
|
203
|
-
value: ()=>absoluteTimeRange.end.valueOf().toString(),
|
|
204
|
-
source: 'Dashboard',
|
|
205
|
-
display: {
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
kind: 'BuiltinVariable',
|
|
202
|
+
spec: {
|
|
206
203
|
name: '__to',
|
|
207
|
-
|
|
208
|
-
|
|
204
|
+
value: ()=>absoluteTimeRange.end.valueOf().toString(),
|
|
205
|
+
source: 'Dashboard',
|
|
206
|
+
display: {
|
|
207
|
+
name: '__to',
|
|
208
|
+
description: 'End time of the current time range in unix millisecond epoch',
|
|
209
|
+
hidden: true
|
|
210
|
+
}
|
|
209
211
|
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
spec: {
|
|
215
|
-
name: '__range',
|
|
216
|
-
value: ()=>(0, _core.formatDuration)((0, _core.intervalToPrometheusDuration)(absoluteTimeRange)),
|
|
217
|
-
source: 'Dashboard',
|
|
218
|
-
display: {
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
kind: 'BuiltinVariable',
|
|
215
|
+
spec: {
|
|
219
216
|
name: '__range',
|
|
220
|
-
|
|
221
|
-
|
|
217
|
+
value: ()=>(0, _core.formatDuration)((0, _core.intervalToPrometheusDuration)(absoluteTimeRange)),
|
|
218
|
+
source: 'Dashboard',
|
|
219
|
+
display: {
|
|
220
|
+
name: '__range',
|
|
221
|
+
description: 'The range for the current dashboard in human readable format',
|
|
222
|
+
hidden: true
|
|
223
|
+
}
|
|
222
224
|
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
spec: {
|
|
228
|
-
name: '__range_s',
|
|
229
|
-
value: ()=>((absoluteTimeRange.end.valueOf() - absoluteTimeRange.start.valueOf()) / 1000).toString(),
|
|
230
|
-
source: 'Dashboard',
|
|
231
|
-
display: {
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
kind: 'BuiltinVariable',
|
|
228
|
+
spec: {
|
|
232
229
|
name: '__range_s',
|
|
233
|
-
|
|
234
|
-
|
|
230
|
+
value: ()=>((absoluteTimeRange.end.valueOf() - absoluteTimeRange.start.valueOf()) / 1000).toString(),
|
|
231
|
+
source: 'Dashboard',
|
|
232
|
+
display: {
|
|
233
|
+
name: '__range_s',
|
|
234
|
+
description: 'The range for the current dashboard in second',
|
|
235
|
+
hidden: true
|
|
236
|
+
}
|
|
235
237
|
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
spec: {
|
|
241
|
-
name: '__range_ms',
|
|
242
|
-
value: ()=>(absoluteTimeRange.end.valueOf() - absoluteTimeRange.start.valueOf()).toString(),
|
|
243
|
-
source: 'Dashboard',
|
|
244
|
-
display: {
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
kind: 'BuiltinVariable',
|
|
241
|
+
spec: {
|
|
245
242
|
name: '__range_ms',
|
|
246
|
-
|
|
247
|
-
|
|
243
|
+
value: ()=>(absoluteTimeRange.end.valueOf() - absoluteTimeRange.start.valueOf()).toString(),
|
|
244
|
+
source: 'Dashboard',
|
|
245
|
+
display: {
|
|
246
|
+
name: '__range_ms',
|
|
247
|
+
description: 'The range for the current dashboard in millisecond',
|
|
248
|
+
hidden: true
|
|
249
|
+
}
|
|
248
250
|
}
|
|
249
251
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
252
|
+
];
|
|
253
|
+
builtinVariables === null || builtinVariables === void 0 ? void 0 : builtinVariables.forEach((def)=>result.push(def));
|
|
254
|
+
return result;
|
|
255
|
+
}, [
|
|
256
|
+
absoluteTimeRange,
|
|
257
|
+
builtinVariables
|
|
258
|
+
]);
|
|
253
259
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.BuiltinVariableContext.Provider, {
|
|
254
260
|
value: {
|
|
255
261
|
variables: allBuiltinVariables
|
|
@@ -262,10 +268,9 @@ function PluginProvider({ children , builtinVariables }) {
|
|
|
262
268
|
})
|
|
263
269
|
});
|
|
264
270
|
}
|
|
265
|
-
function createTemplateVariableSrvStore({ initialVariableDefinitions =[]
|
|
271
|
+
function createTemplateVariableSrvStore({ initialVariableDefinitions = [], externalVariableDefinitions = [], queryParams }) {
|
|
266
272
|
const initialParams = (0, _queryparams.getInitalValuesFromQueryParameters)(queryParams ? queryParams[0] : {});
|
|
267
|
-
const store = (0, _zustand.createStore)()((0, _middleware.devtools)((0, _immer.immer)((set, get)=>{
|
|
268
|
-
return {
|
|
273
|
+
const store = (0, _zustand.createStore)()((0, _middleware.devtools)((0, _immer.immer)((set, get)=>({
|
|
269
274
|
variableState: (0, _hydrationUtils.hydrateTemplateVariableStates)(initialVariableDefinitions, initialParams, externalVariableDefinitions),
|
|
270
275
|
variableDefinitions: initialVariableDefinitions,
|
|
271
276
|
externalVariableDefinitions: externalVariableDefinitions,
|
|
@@ -367,11 +372,10 @@ function createTemplateVariableSrvStore({ initialVariableDefinitions =[] , exter
|
|
|
367
372
|
getSavedVariablesStatus: ()=>{
|
|
368
373
|
return (0, _utils.checkSavedDefaultVariableStatus)(get().variableDefinitions, get().variableState);
|
|
369
374
|
}
|
|
370
|
-
};
|
|
371
|
-
})));
|
|
375
|
+
}))));
|
|
372
376
|
return store;
|
|
373
377
|
}
|
|
374
|
-
function TemplateVariableProvider({ children
|
|
378
|
+
function TemplateVariableProvider({ children, initialVariableDefinitions = [], externalVariableDefinitions = [], builtinVariables = [] }) {
|
|
375
379
|
const [store] = (0, _react.useState)(createTemplateVariableSrvStore({
|
|
376
380
|
initialVariableDefinitions,
|
|
377
381
|
externalVariableDefinitions
|
|
@@ -384,7 +388,7 @@ function TemplateVariableProvider({ children , initialVariableDefinitions =[] ,
|
|
|
384
388
|
})
|
|
385
389
|
});
|
|
386
390
|
}
|
|
387
|
-
function TemplateVariableProviderWithQueryParams({ children
|
|
391
|
+
function TemplateVariableProviderWithQueryParams({ children, initialVariableDefinitions = [], externalVariableDefinitions = [], builtinVariables = [] }) {
|
|
388
392
|
const allVariableDefs = (0, _utils.mergeVariableDefinitions)(initialVariableDefinitions, externalVariableDefinitions);
|
|
389
393
|
const queryParams = (0, _queryparams.useVariableQueryParams)(allVariableDefs);
|
|
390
394
|
const [store] = (0, _react.useState)(createTemplateVariableSrvStore({
|
|
@@ -21,20 +21,20 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
|
|
25
|
-
return
|
|
24
|
+
decodeVariableValue: function() {
|
|
25
|
+
return decodeVariableValue;
|
|
26
26
|
},
|
|
27
27
|
encodeVariableValue: function() {
|
|
28
28
|
return encodeVariableValue;
|
|
29
29
|
},
|
|
30
|
-
|
|
31
|
-
return
|
|
30
|
+
getInitalValuesFromQueryParameters: function() {
|
|
31
|
+
return getInitalValuesFromQueryParameters;
|
|
32
|
+
},
|
|
33
|
+
getURLQueryParamName: function() {
|
|
34
|
+
return getURLQueryParamName;
|
|
32
35
|
},
|
|
33
36
|
useVariableQueryParams: function() {
|
|
34
37
|
return useVariableQueryParams;
|
|
35
|
-
},
|
|
36
|
-
getInitalValuesFromQueryParameters: function() {
|
|
37
|
-
return getInitalValuesFromQueryParameters;
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
const _usequeryparams = require("use-query-params");
|
|
@@ -24,14 +24,14 @@ _export(exports, {
|
|
|
24
24
|
checkSavedDefaultVariableStatus: function() {
|
|
25
25
|
return checkSavedDefaultVariableStatus;
|
|
26
26
|
},
|
|
27
|
-
mergeVariableDefinitions: function() {
|
|
28
|
-
return mergeVariableDefinitions;
|
|
29
|
-
},
|
|
30
27
|
findVariableDefinitionByName: function() {
|
|
31
28
|
return findVariableDefinitionByName;
|
|
32
29
|
},
|
|
33
30
|
forEachVariableDefinition: function() {
|
|
34
31
|
return forEachVariableDefinition;
|
|
32
|
+
},
|
|
33
|
+
mergeVariableDefinitions: function() {
|
|
34
|
+
return mergeVariableDefinitions;
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
37
|
function checkSavedDefaultVariableStatus(definitions, varState) {
|
|
@@ -24,7 +24,7 @@ const _core = require("@perses-dev/core");
|
|
|
24
24
|
const _DashboardProvider = require("./DashboardProvider");
|
|
25
25
|
const _TemplateVariableProvider = require("./TemplateVariableProvider");
|
|
26
26
|
function useDashboard() {
|
|
27
|
-
const { panels
|
|
27
|
+
const { panels, panelGroups, panelGroupOrder, setDashboard: setDashboardResource, metadata, display, duration, refreshInterval, datasources } = (0, _DashboardProvider.useDashboardStore)(({ panels, panelGroups, panelGroupOrder, setDashboard, metadata, display, duration, refreshInterval, datasources })=>({
|
|
28
28
|
panels,
|
|
29
29
|
panelGroups,
|
|
30
30
|
panelGroupOrder,
|
|
@@ -35,7 +35,7 @@ function useDashboard() {
|
|
|
35
35
|
refreshInterval,
|
|
36
36
|
datasources
|
|
37
37
|
}));
|
|
38
|
-
const { setVariableDefinitions
|
|
38
|
+
const { setVariableDefinitions } = (0, _TemplateVariableProvider.useTemplateVariableActions)();
|
|
39
39
|
const variables = (0, _TemplateVariableProvider.useTemplateVariableDefinitions)();
|
|
40
40
|
const layouts = convertPanelGroupsToLayouts(panelGroups, panelGroupOrder);
|
|
41
41
|
const dashboard = {
|
|
@@ -67,7 +67,7 @@ function convertPanelGroupsToLayouts(panelGroups, panelGroupOrder) {
|
|
|
67
67
|
if (group === undefined) {
|
|
68
68
|
throw new Error('panel group not found');
|
|
69
69
|
}
|
|
70
|
-
const { title
|
|
70
|
+
const { title, isCollapsed, itemLayouts, itemPanelKeys } = group;
|
|
71
71
|
let display = undefined;
|
|
72
72
|
if (title) {
|
|
73
73
|
display = {
|
|
@@ -21,11 +21,11 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
getTestDashboard: function() {
|
|
25
|
-
return getTestDashboard;
|
|
26
|
-
},
|
|
27
24
|
createDashboardProviderSpy: function() {
|
|
28
25
|
return createDashboardProviderSpy;
|
|
26
|
+
},
|
|
27
|
+
getTestDashboard: function() {
|
|
28
|
+
return getTestDashboard;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
const _react = require("react");
|
|
@@ -21,14 +21,14 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
|
|
25
|
-
return
|
|
24
|
+
defaultDatasourceProps: function() {
|
|
25
|
+
return defaultDatasourceProps;
|
|
26
26
|
},
|
|
27
27
|
prometheusDemo: function() {
|
|
28
28
|
return prometheusDemo;
|
|
29
29
|
},
|
|
30
|
-
|
|
31
|
-
return
|
|
30
|
+
prometheusDemoUrl: function() {
|
|
31
|
+
return prometheusDemoUrl;
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
const _dashboardprovider = require("./dashboard-provider");
|
package/dist/cjs/test/render.js
CHANGED
|
@@ -36,7 +36,7 @@ const _pluginregistry = require("./plugin-registry");
|
|
|
36
36
|
/*
|
|
37
37
|
* Workaround for React router upgrade type errors.
|
|
38
38
|
* More details: https://stackoverflow.com/a/69948457/17575201
|
|
39
|
-
*/ const CustomRouter = ({ history
|
|
39
|
+
*/ const CustomRouter = ({ history, children })=>{
|
|
40
40
|
const [state, setState] = (0, _react.useState)({
|
|
41
41
|
action: history.action,
|
|
42
42
|
location: history.location
|
|
@@ -21,14 +21,14 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
+
getValidPanelKey: function() {
|
|
25
|
+
return getValidPanelKey;
|
|
26
|
+
},
|
|
24
27
|
getYForNewRow: function() {
|
|
25
28
|
return getYForNewRow;
|
|
26
29
|
},
|
|
27
30
|
insertPanelInLayout: function() {
|
|
28
31
|
return insertPanelInLayout;
|
|
29
|
-
},
|
|
30
|
-
getValidPanelKey: function() {
|
|
31
|
-
return getValidPanelKey;
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
const _constants = require("../constants");
|
|
@@ -42,7 +42,7 @@ function getYForNewRow(group) {
|
|
|
42
42
|
}
|
|
43
43
|
return newRowY;
|
|
44
44
|
}
|
|
45
|
-
function getPanelBounds({ x
|
|
45
|
+
function getPanelBounds({ x, y, w, h }) {
|
|
46
46
|
return {
|
|
47
47
|
x1: x,
|
|
48
48
|
x2: x + w,
|
|
@@ -159,7 +159,7 @@ const removeWhiteSpaces = (str)=>{
|
|
|
159
159
|
function getUniquePanelKeys(panels) {
|
|
160
160
|
const uniquePanelKeys = {};
|
|
161
161
|
Object.keys(panels).forEach((panelKey)=>{
|
|
162
|
-
const { name
|
|
162
|
+
const { name, number } = getPanelKeyParts(panelKey);
|
|
163
163
|
if (uniquePanelKeys[name] === undefined) {
|
|
164
164
|
uniquePanelKeys[name] = 0;
|
|
165
165
|
}
|
package/dist/cjs/utils/time.js
CHANGED
|
@@ -23,7 +23,7 @@ Object.defineProperty(exports, "useSuggestedStepMs", {
|
|
|
23
23
|
const _core = require("@perses-dev/core");
|
|
24
24
|
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
25
25
|
function useSuggestedStepMs(width) {
|
|
26
|
-
const { absoluteTimeRange
|
|
26
|
+
const { absoluteTimeRange } = (0, _pluginsystem.useTimeRange)();
|
|
27
27
|
if (width === undefined) return 0;
|
|
28
28
|
return (0, _core.getSuggestedStepMs)(absoluteTimeRange, width);
|
|
29
29
|
}
|
|
@@ -28,13 +28,13 @@ const _pluginsystem = require("@perses-dev/plugin-system");
|
|
|
28
28
|
const _components1 = require("../../components");
|
|
29
29
|
const _context = require("../../context");
|
|
30
30
|
const DashboardApp = (props)=>{
|
|
31
|
-
const { dashboardResource
|
|
31
|
+
const { dashboardResource, dashboardTitleComponent, emptyDashboardProps, onSave, onDiscard, initialVariableIsSticky, isReadonly, isCreating } = props;
|
|
32
32
|
const chartsTheme = (0, _components.useChartsTheme)();
|
|
33
|
-
const { isEditMode
|
|
34
|
-
const { dashboard
|
|
33
|
+
const { isEditMode, setEditMode } = (0, _context.useEditMode)();
|
|
34
|
+
const { dashboard, setDashboard } = (0, _context.useDashboard)();
|
|
35
35
|
const [originalDashboard, setOriginalDashboard] = (0, _react.useState)(undefined);
|
|
36
|
-
const { setSavedDatasources
|
|
37
|
-
const { openDiscardChangesConfirmationDialog
|
|
36
|
+
const { setSavedDatasources } = (0, _pluginsystem.useDatasourceStore)();
|
|
37
|
+
const { openDiscardChangesConfirmationDialog, closeDiscardChangesConfirmationDialog } = (0, _context.useDiscardChangesConfirmationDialog)();
|
|
38
38
|
const handleDiscardChanges = ()=>{
|
|
39
39
|
// Reset to the original spec and exit edit mode
|
|
40
40
|
if (originalDashboard) {
|
|
@@ -29,15 +29,15 @@ const _react = require("react");
|
|
|
29
29
|
const _context = require("../../context");
|
|
30
30
|
const _DashboardApp = require("./DashboardApp");
|
|
31
31
|
function ViewDashboard(props) {
|
|
32
|
-
const { dashboardResource
|
|
33
|
-
const { spec
|
|
32
|
+
const { dashboardResource, datasourceApi, externalVariableDefinitions, dashboardTitleComponent, emptyDashboardProps, onSave, onDiscard, initialVariableIsSticky, isReadonly, isEditing, isCreating, sx, ...others } = props;
|
|
33
|
+
const { spec } = dashboardResource;
|
|
34
34
|
var _spec_duration;
|
|
35
35
|
const dashboardDuration = (_spec_duration = spec.duration) !== null && _spec_duration !== void 0 ? _spec_duration : _core.DEFAULT_DASHBOARD_DURATION;
|
|
36
36
|
var _spec_refreshInterval;
|
|
37
37
|
const dashboardRefreshInterval = (_spec_refreshInterval = spec.refreshInterval) !== null && _spec_refreshInterval !== void 0 ? _spec_refreshInterval : _core.DEFAULT_REFRESH_INTERVAL;
|
|
38
38
|
const initialTimeRange = (0, _pluginsystem.useInitialTimeRange)(dashboardDuration);
|
|
39
39
|
const initialRefreshInterval = (0, _pluginsystem.useInitialRefreshInterval)(dashboardRefreshInterval);
|
|
40
|
-
const { data
|
|
40
|
+
const { data } = (0, _pluginsystem.usePluginBuiltinVariableDefinitions)();
|
|
41
41
|
const builtinVariables = (0, _react.useMemo)(()=>{
|
|
42
42
|
const result = [
|
|
43
43
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddGroupButton.d.ts","sourceRoot":"","sources":["../../../src/components/AddGroupButton/AddGroupButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AddGroupButton.d.ts","sourceRoot":"","sources":["../../../src/components/AddGroupButton/AddGroupButton.tsx"],"names":[],"mappings":"AAmBA,eAAO,MAAM,cAAc,+CAe1B,CAAC"}
|
|
@@ -17,7 +17,7 @@ import { InfoTooltip } from '@perses-dev/components';
|
|
|
17
17
|
import { TOOLTIP_TEXT, editButtonStyle } from '../../constants';
|
|
18
18
|
import { useDashboardActions } from '../../context';
|
|
19
19
|
export const AddGroupButton = ()=>{
|
|
20
|
-
const { openAddPanelGroup
|
|
20
|
+
const { openAddPanelGroup } = useDashboardActions();
|
|
21
21
|
return /*#__PURE__*/ _jsx(InfoTooltip, {
|
|
22
22
|
description: TOOLTIP_TEXT.addGroup,
|
|
23
23
|
children: /*#__PURE__*/ _jsx(Button, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/AddGroupButton/AddGroupButton.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Button } from '@mui/material';\nimport AddGroupIcon from 'mdi-material-ui/PlusBoxOutline';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { TOOLTIP_TEXT, editButtonStyle } from '../../constants';\nimport { useDashboardActions } from '../../context';\n\nexport const AddGroupButton = () => {\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,oCAAoC;AACpC,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;AACrD,SAASC,YAAY,EAAEC,eAAe,QAAQ,kBAAkB;AAChE,SAASC,mBAAmB,QAAQ,gBAAgB;AAEpD,OAAO,MAAMC,iBAAiB;IAC5B,MAAM,EAAEC,
|
|
1
|
+
{"version":3,"sources":["../../../src/components/AddGroupButton/AddGroupButton.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Button } from '@mui/material';\nimport AddGroupIcon from 'mdi-material-ui/PlusBoxOutline';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { TOOLTIP_TEXT, editButtonStyle } from '../../constants';\nimport { useDashboardActions } from '../../context';\n\nexport const AddGroupButton = () => {\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,oCAAoC;AACpC,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;AACrD,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,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { ButtonProps } from '@mui/material';
|
|
3
2
|
export interface AddPanelButtonProps extends Pick<ButtonProps, 'fullWidth'> {
|
|
4
3
|
/**
|
|
@@ -14,5 +13,5 @@ export interface AddPanelButtonProps extends Pick<ButtonProps, 'fullWidth'> {
|
|
|
14
13
|
*/
|
|
15
14
|
label?: string;
|
|
16
15
|
}
|
|
17
|
-
export declare const AddPanelButton: ({ variant, color, label, fullWidth, }: AddPanelButtonProps) => JSX.Element;
|
|
16
|
+
export declare const AddPanelButton: ({ variant, color, label, fullWidth, }: AddPanelButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
17
|
//# sourceMappingURL=AddPanelButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddPanelButton.d.ts","sourceRoot":"","sources":["../../../src/components/AddPanelButton/AddPanelButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AddPanelButton.d.ts","sourceRoot":"","sources":["../../../src/components/AddPanelButton/AddPanelButton.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAU,WAAW,EAAE,MAAM,eAAe,CAAC;AAMpD,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC;IACzE;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAE9B;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;IAEhC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,cAAc,0CAKxB,mBAAmB,4CAkBrB,CAAC"}
|
|
@@ -16,8 +16,8 @@ import AddPanelIcon from 'mdi-material-ui/ChartBoxPlusOutline';
|
|
|
16
16
|
import { InfoTooltip } from '@perses-dev/components';
|
|
17
17
|
import { TOOLTIP_TEXT, editButtonStyle } from '../../constants';
|
|
18
18
|
import { useDashboardActions } from '../../context';
|
|
19
|
-
export const AddPanelButton = ({ variant ='text'
|
|
20
|
-
const { openAddPanel
|
|
19
|
+
export const AddPanelButton = ({ variant = 'text', color = 'primary', label = 'Panel', fullWidth })=>{
|
|
20
|
+
const { openAddPanel } = useDashboardActions();
|
|
21
21
|
return /*#__PURE__*/ _jsx(InfoTooltip, {
|
|
22
22
|
description: TOOLTIP_TEXT.addPanel,
|
|
23
23
|
children: /*#__PURE__*/ _jsx(Button, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/AddPanelButton/AddPanelButton.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Button, ButtonProps } from '@mui/material';\nimport AddPanelIcon from 'mdi-material-ui/ChartBoxPlusOutline';\nimport { InfoTooltip } from '@perses-dev/components';\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) => {\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,oCAAoC;AACpC,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;AACrD,SAASC,YAAY,EAAEC,eAAe,QAAQ,kBAAkB;AAChE,SAASC,mBAAmB,QAAQ,gBAAgB;AAmBpD,OAAO,MAAMC,iBAAiB,CAAC,EAC7BC,
|
|
1
|
+
{"version":3,"sources":["../../../src/components/AddPanelButton/AddPanelButton.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Button, ButtonProps } from '@mui/material';\nimport AddPanelIcon from 'mdi-material-ui/ChartBoxPlusOutline';\nimport { InfoTooltip } from '@perses-dev/components';\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) => {\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,oCAAoC;AACpC,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;AACrD,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,8 +1,7 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { BoxProps } from '@mui/material';
|
|
3
2
|
import { EmptyDashboardProps } from '../EmptyDashboard';
|
|
4
3
|
import { PanelOptions } from '../Panel';
|
|
5
|
-
export
|
|
4
|
+
export type DashboardProps = BoxProps & {
|
|
6
5
|
/**
|
|
7
6
|
* Props for `EmptyDashboard` component that will be rendered when the dashboard
|
|
8
7
|
* is empty (i.e. has no panel groups). If not specified, the defaults will
|
|
@@ -14,5 +13,5 @@ export declare type DashboardProps = BoxProps & {
|
|
|
14
13
|
/**
|
|
15
14
|
* Renders a Dashboard for the provided Dashboard spec.
|
|
16
15
|
*/
|
|
17
|
-
export declare function Dashboard({ emptyDashboardProps, panelOptions, ...boxProps }: DashboardProps): JSX.Element;
|
|
16
|
+
export declare function Dashboard({ emptyDashboardProps, panelOptions, ...boxProps }: DashboardProps): import("react/jsx-runtime").JSX.Element;
|
|
18
17
|
//# sourceMappingURL=Dashboard.d.ts.map
|