@perses-dev/dashboards 0.39.0 → 0.40.1
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 +9 -7
- package/dist/cjs/components/AddGroupButton/index.js +10 -8
- package/dist/cjs/components/AddPanelButton/AddPanelButton.js +9 -7
- package/dist/cjs/components/AddPanelButton/index.js +10 -8
- package/dist/cjs/components/Dashboard/Dashboard.js +11 -9
- package/dist/cjs/components/Dashboard/index.js +10 -8
- package/dist/cjs/components/DashboardStickyToolbar/DashboardStickyToolbar.js +18 -16
- package/dist/cjs/components/DashboardStickyToolbar/index.js +10 -8
- package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +43 -41
- package/dist/cjs/components/DashboardToolbar/index.js +10 -8
- package/dist/cjs/components/DeletePanelDialog/DeletePanelDialog.js +12 -10
- package/dist/cjs/components/DeletePanelDialog/index.js +10 -8
- package/dist/cjs/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +17 -15
- package/dist/cjs/components/DeletePanelGroupDialog/index.js +10 -8
- package/dist/cjs/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +5 -3
- package/dist/cjs/components/DiscardChangesConfirmationDialog/index.js +10 -8
- package/dist/cjs/components/DownloadButton/DownloadButton.js +12 -10
- package/dist/cjs/components/DownloadButton/index.js +10 -8
- package/dist/cjs/components/EditButton/EditButton.js +8 -6
- package/dist/cjs/components/EditButton/index.js +10 -8
- package/dist/cjs/components/EditJsonButton/EditJsonButton.js +10 -8
- package/dist/cjs/components/EditJsonButton/index.js +10 -8
- package/dist/cjs/components/EditJsonDialog/EditJsonDialog.js +29 -23
- package/dist/cjs/components/EditJsonDialog/index.js +10 -8
- package/dist/cjs/components/EmptyDashboard/EmptyDashboard.js +18 -16
- package/dist/cjs/components/EmptyDashboard/index.js +10 -8
- package/dist/cjs/components/GridLayout/GridContainer.js +5 -3
- package/dist/cjs/components/GridLayout/GridItemContent.js +33 -14
- package/dist/cjs/components/GridLayout/GridLayout.js +18 -16
- package/dist/cjs/components/GridLayout/GridTitle.js +35 -33
- package/dist/cjs/components/GridLayout/index.js +13 -11
- package/dist/cjs/components/Panel/Panel.js +17 -22
- package/dist/cjs/components/Panel/PanelContent.js +8 -6
- package/dist/cjs/components/Panel/PanelHeader.js +33 -31
- package/dist/cjs/components/Panel/index.js +10 -8
- package/dist/cjs/components/PanelDrawer/PanelDrawer.js +25 -77
- package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +269 -141
- package/dist/cjs/components/PanelDrawer/PanelPreview.js +11 -9
- package/dist/cjs/components/PanelDrawer/index.js +10 -8
- package/dist/cjs/components/PanelDrawer/usePanelEditor.js +3 -1
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +18 -16
- package/dist/cjs/components/PanelGroupDialog/PanelGroupEditorForm.js +15 -11
- package/dist/cjs/components/PanelGroupDialog/index.js +10 -8
- package/dist/cjs/components/QuerySummaryTable/QuerySummaryTable.js +46 -44
- package/dist/cjs/components/QuerySummaryTable/index.js +10 -8
- package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +23 -21
- package/dist/cjs/components/SaveChangesConfirmationDialog/index.js +10 -8
- package/dist/cjs/components/SaveDashboardButton/SaveDashboardButton.js +8 -8
- package/dist/cjs/components/SaveDashboardButton/index.js +10 -8
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +40 -16
- package/dist/cjs/components/TimeRangeControls/index.js +10 -8
- package/dist/cjs/components/ToolbarIconButton/ToolbarIconButton.js +5 -3
- package/dist/cjs/components/ToolbarIconButton/index.js +10 -8
- package/dist/cjs/components/Variables/BuiltinVariableAccordions.js +140 -0
- package/dist/cjs/components/Variables/EditVariablesButton.js +16 -11
- package/dist/cjs/components/Variables/TemplateVariable.js +116 -69
- package/dist/cjs/components/Variables/VariableEditor.js +280 -204
- package/dist/cjs/components/Variables/VariableList.js +19 -15
- package/dist/cjs/components/Variables/index.js +14 -11
- package/dist/cjs/components/index.js +31 -29
- package/dist/cjs/constants/grid-layout-config.js +6 -2
- package/dist/cjs/constants/index.js +11 -9
- package/dist/cjs/constants/user-interface-text.js +6 -2
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +40 -34
- package/dist/cjs/context/DashboardProvider/common.js +6 -2
- package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +70 -38
- package/dist/cjs/context/DashboardProvider/delete-panel-group-slice.js +3 -1
- package/dist/cjs/context/DashboardProvider/delete-panel-slice.js +5 -3
- package/dist/cjs/context/DashboardProvider/discard-changes-dialog-slice.js +3 -1
- package/dist/cjs/context/DashboardProvider/duplicate-panel-slice.js +3 -1
- package/dist/cjs/context/DashboardProvider/edit-json-dialog-slice.js +3 -1
- package/dist/cjs/context/DashboardProvider/index.js +12 -10
- package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +13 -11
- package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +8 -6
- package/dist/cjs/context/DashboardProvider/panel-group-slice.js +15 -7
- package/dist/cjs/context/DashboardProvider/panel-slice.js +3 -1
- package/dist/cjs/context/DashboardProvider/save-changes-dialog-slice.js +3 -1
- package/dist/cjs/context/DatasourceStoreProvider.js +114 -45
- package/dist/cjs/context/TemplateVariableProvider/TemplateVariableProvider.js +125 -34
- package/dist/cjs/context/TemplateVariableProvider/hydrationUtils.js +12 -10
- package/dist/cjs/context/TemplateVariableProvider/index.js +10 -8
- package/dist/cjs/context/TemplateVariableProvider/query-params.js +17 -7
- package/dist/cjs/context/TemplateVariableProvider/utils.js +15 -7
- package/dist/cjs/context/index.js +13 -11
- package/dist/cjs/context/useDashboard.js +8 -6
- package/dist/cjs/index.js +12 -10
- package/dist/cjs/stories/decorators/WithDashboard.js +6 -4
- package/dist/cjs/stories/decorators/WithDatasourceStore.js +6 -4
- package/dist/cjs/stories/decorators/WithTemplateVariables.js +6 -4
- package/dist/cjs/stories/decorators/constants.js +5 -3
- package/dist/cjs/stories/decorators/index.js +13 -11
- package/dist/cjs/test/dashboard-provider.js +8 -4
- package/dist/cjs/test/datasource-provider.js +16 -12
- package/dist/cjs/test/index.js +13 -11
- package/dist/cjs/test/plugin-registry.js +6 -4
- package/dist/cjs/test/render.js +27 -20
- package/dist/cjs/test/setup-tests.js +2 -2
- package/dist/cjs/test/testDashboard.js +13 -11
- package/dist/cjs/utils/index.js +11 -9
- package/dist/cjs/utils/panelUtils.js +9 -3
- package/dist/cjs/utils/time.js +5 -3
- package/dist/cjs/validation/index.js +30 -0
- package/dist/cjs/validation/panel.js +29 -0
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +20 -16
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +63 -19
- package/dist/cjs/views/ViewDashboard/index.js +10 -8
- package/dist/cjs/views/index.js +10 -8
- package/dist/components/AddGroupButton/AddGroupButton.js.map +1 -1
- package/dist/components/AddGroupButton/index.js.map +1 -1
- package/dist/components/AddPanelButton/AddPanelButton.js.map +1 -1
- package/dist/components/AddPanelButton/index.js.map +1 -1
- package/dist/components/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/Dashboard/index.js.map +1 -1
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +1 -1
- package/dist/components/DashboardStickyToolbar/index.js.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.js +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
- package/dist/components/DashboardToolbar/index.js.map +1 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -1
- package/dist/components/DeletePanelDialog/index.js.map +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +2 -2
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
- package/dist/components/DeletePanelGroupDialog/index.js.map +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/index.js.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.js.map +1 -1
- package/dist/components/DownloadButton/index.js.map +1 -1
- package/dist/components/EditButton/EditButton.js.map +1 -1
- package/dist/components/EditButton/index.js.map +1 -1
- package/dist/components/EditJsonButton/EditJsonButton.js.map +1 -1
- package/dist/components/EditJsonButton/index.js.map +1 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.d.ts +4 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.d.ts.map +1 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.js +12 -8
- package/dist/components/EditJsonDialog/EditJsonDialog.js.map +1 -1
- package/dist/components/EditJsonDialog/index.js.map +1 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.js.map +1 -1
- package/dist/components/EmptyDashboard/index.js.map +1 -1
- package/dist/components/GridLayout/GridContainer.js.map +1 -1
- package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
- package/dist/components/GridLayout/GridItemContent.js +27 -10
- package/dist/components/GridLayout/GridItemContent.js.map +1 -1
- package/dist/components/GridLayout/GridLayout.js +2 -2
- package/dist/components/GridLayout/GridLayout.js.map +1 -1
- package/dist/components/GridLayout/GridTitle.js.map +1 -1
- package/dist/components/GridLayout/index.js.map +1 -1
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/Panel.js +4 -11
- package/dist/components/Panel/Panel.js.map +1 -1
- package/dist/components/Panel/PanelContent.js.map +1 -1
- package/dist/components/Panel/PanelHeader.js.map +1 -1
- 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 +22 -76
- package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts +4 -1
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js +223 -138
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.js +2 -2
- package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
- package/dist/components/PanelDrawer/index.js.map +1 -1
- package/dist/components/PanelDrawer/usePanelEditor.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -1
- package/dist/components/PanelGroupDialog/index.js.map +1 -1
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js +4 -4
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -1
- package/dist/components/QuerySummaryTable/index.js.map +1 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +4 -4
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
- package/dist/components/SaveChangesConfirmationDialog/index.js.map +1 -1
- package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts.map +1 -1
- package/dist/components/SaveDashboardButton/SaveDashboardButton.js +1 -3
- package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -1
- package/dist/components/SaveDashboardButton/index.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js +19 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
- package/dist/components/TimeRangeControls/index.js.map +1 -1
- package/dist/components/ToolbarIconButton/ToolbarIconButton.js.map +1 -1
- package/dist/components/ToolbarIconButton/index.js.map +1 -1
- package/dist/components/Variables/BuiltinVariableAccordions.d.ts +8 -0
- package/dist/components/Variables/BuiltinVariableAccordions.d.ts.map +1 -0
- package/dist/components/Variables/BuiltinVariableAccordions.js +127 -0
- package/dist/components/Variables/BuiltinVariableAccordions.js.map +1 -0
- package/dist/components/Variables/EditVariablesButton.d.ts.map +1 -1
- package/dist/components/Variables/EditVariablesButton.js +3 -0
- package/dist/components/Variables/EditVariablesButton.js.map +1 -1
- package/dist/components/Variables/TemplateVariable.d.ts +10 -1
- package/dist/components/Variables/TemplateVariable.d.ts.map +1 -1
- package/dist/components/Variables/TemplateVariable.js +91 -54
- package/dist/components/Variables/TemplateVariable.js.map +1 -1
- package/dist/components/Variables/VariableEditor.d.ts +2 -1
- package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditor.js +229 -157
- package/dist/components/Variables/VariableEditor.js.map +1 -1
- package/dist/components/Variables/VariableList.js +6 -6
- package/dist/components/Variables/VariableList.js.map +1 -1
- package/dist/components/Variables/index.d.ts +1 -0
- package/dist/components/Variables/index.d.ts.map +1 -1
- package/dist/components/Variables/index.js +1 -0
- package/dist/components/Variables/index.js.map +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/constants/grid-layout-config.js.map +1 -1
- package/dist/constants/index.js.map +1 -1
- package/dist/constants/user-interface-text.js.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.js +5 -5
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
- package/dist/context/DashboardProvider/common.js.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.js +2 -2
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-slice.js +2 -2
- 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.map +1 -1
- package/dist/context/DashboardProvider/edit-json-dialog-slice.js.map +1 -1
- package/dist/context/DashboardProvider/index.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 +7 -7
- package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.js +2 -2
- package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.js +3 -3
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-slice.js.map +1 -1
- package/dist/context/DashboardProvider/save-changes-dialog-slice.js.map +1 -1
- package/dist/context/DatasourceStoreProvider.d.ts +14 -10
- package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
- package/dist/context/DatasourceStoreProvider.js +107 -40
- package/dist/context/DatasourceStoreProvider.js.map +1 -1
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts +10 -4
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts.map +1 -1
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js +93 -18
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js.map +1 -1
- package/dist/context/TemplateVariableProvider/hydrationUtils.js +7 -7
- package/dist/context/TemplateVariableProvider/hydrationUtils.js.map +1 -1
- package/dist/context/TemplateVariableProvider/index.js.map +1 -1
- package/dist/context/TemplateVariableProvider/query-params.js.map +1 -1
- package/dist/context/TemplateVariableProvider/utils.js +3 -3
- package/dist/context/TemplateVariableProvider/utils.js.map +1 -1
- package/dist/context/index.js.map +1 -1
- package/dist/context/useDashboard.js +1 -1
- package/dist/context/useDashboard.js.map +1 -1
- package/dist/index.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/stories/decorators/constants.js +2 -2
- package/dist/stories/decorators/constants.js.map +1 -1
- package/dist/stories/decorators/index.js.map +1 -1
- package/dist/test/dashboard-provider.js.map +1 -1
- package/dist/test/datasource-provider.d.ts.map +1 -1
- package/dist/test/datasource-provider.js +5 -7
- package/dist/test/datasource-provider.js.map +1 -1
- package/dist/test/index.js.map +1 -1
- package/dist/test/plugin-registry.js.map +1 -1
- package/dist/test/render.d.ts.map +1 -1
- package/dist/test/render.js +6 -1
- package/dist/test/render.js.map +1 -1
- package/dist/test/setup-tests.js.map +1 -1
- package/dist/test/testDashboard.js +10 -10
- package/dist/test/testDashboard.js.map +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/panelUtils.js.map +1 -1
- package/dist/utils/time.js.map +1 -1
- package/dist/validation/index.d.ts +2 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +15 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/panel.d.ts +19 -0
- package/dist/validation/panel.d.ts.map +1 -0
- package/dist/validation/panel.js +21 -0
- package/dist/validation/panel.js.map +1 -0
- package/dist/views/ViewDashboard/DashboardApp.d.ts +1 -0
- package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.js +4 -2
- package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.d.ts +1 -0
- package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.js +49 -7
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
- package/dist/views/ViewDashboard/index.js.map +1 -1
- package/dist/views/index.js.map +1 -1
- package/package.json +8 -7
|
@@ -16,7 +16,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "createDuplicatePanelSlice", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return createDuplicatePanelSlice;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
23
|
const _panelUtils = require("../../utils/panelUtils");
|
|
22
24
|
const _common = require("./common");
|
|
@@ -16,7 +16,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "createEditJsonDialogSlice", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return createEditJsonDialogSlice;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
23
|
const createEditJsonDialogSlice = (set)=>({
|
|
22
24
|
openEditJsonDialog () {
|
|
@@ -14,17 +14,19 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
function
|
|
17
|
+
_export_star(require("./common"), exports);
|
|
18
|
+
_export_star(require("./dashboard-provider-api"), exports);
|
|
19
|
+
_export_star(require("./DashboardProvider"), exports);
|
|
20
|
+
function _export_star(from, to) {
|
|
21
21
|
Object.keys(from).forEach(function(k) {
|
|
22
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k))
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
23
|
+
Object.defineProperty(to, k, {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function() {
|
|
26
|
+
return from[k];
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
28
30
|
});
|
|
29
31
|
return from;
|
|
30
32
|
}
|
|
@@ -16,22 +16,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "createPanelEditorSlice", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return createPanelEditorSlice;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
23
|
const _panelUtils = require("../../utils/panelUtils");
|
|
22
24
|
const _common = require("./common");
|
|
23
|
-
const
|
|
25
|
+
const _panelgroupslice = require("./panel-group-slice");
|
|
24
26
|
function createPanelEditorSlice() {
|
|
25
27
|
// Return the state creator function for Zustand that uses the panels provided as intitial state
|
|
26
28
|
return (set, get)=>{
|
|
27
29
|
return {
|
|
28
30
|
panelEditor: undefined,
|
|
29
31
|
openEditPanel (panelGroupItemId) {
|
|
30
|
-
var
|
|
32
|
+
var _panelGroups_panelGroupId;
|
|
31
33
|
const { panels , panelGroups } = get();
|
|
32
34
|
// Figure out the panel key at that location
|
|
33
35
|
const { panelGroupId , panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;
|
|
34
|
-
const panelKey = (
|
|
36
|
+
const panelKey = (_panelGroups_panelGroupId = panelGroups[panelGroupId]) === null || _panelGroups_panelGroupId === void 0 ? void 0 : _panelGroups_panelGroupId.itemPanelKeys[panelGroupLayoutId];
|
|
35
37
|
if (panelKey === undefined) {
|
|
36
38
|
throw new Error(`Could not find Panel Group item ${panelGroupItemId}`);
|
|
37
39
|
}
|
|
@@ -41,7 +43,7 @@ function createPanelEditorSlice() {
|
|
|
41
43
|
throw new Error(`Cannot find Panel with key '${panelKey}'`);
|
|
42
44
|
}
|
|
43
45
|
const editorState = {
|
|
44
|
-
mode: '
|
|
46
|
+
mode: 'update',
|
|
45
47
|
initialValues: {
|
|
46
48
|
groupId: panelGroupItemId.panelGroupId,
|
|
47
49
|
panelDefinition: panelToEdit
|
|
@@ -94,21 +96,21 @@ function createPanelEditorSlice() {
|
|
|
94
96
|
});
|
|
95
97
|
},
|
|
96
98
|
openAddPanel (panelGroupId) {
|
|
97
|
-
var
|
|
99
|
+
var _get_initialValues;
|
|
98
100
|
// If a panel group isn't supplied, add to the first group or create a group if there aren't any
|
|
99
101
|
let newGroup = undefined;
|
|
100
102
|
panelGroupId !== null && panelGroupId !== void 0 ? panelGroupId : panelGroupId = get().panelGroupOrder[0];
|
|
101
103
|
if (panelGroupId === undefined) {
|
|
102
|
-
newGroup = (0,
|
|
104
|
+
newGroup = (0, _panelgroupslice.createEmptyPanelGroup)();
|
|
103
105
|
newGroup.title = 'Panel Group';
|
|
104
106
|
panelGroupId = newGroup.id;
|
|
105
107
|
}
|
|
106
|
-
var
|
|
108
|
+
var _get_initialValues_panelDefinition;
|
|
107
109
|
const editorState = {
|
|
108
|
-
mode: '
|
|
110
|
+
mode: 'create',
|
|
109
111
|
initialValues: {
|
|
110
112
|
groupId: panelGroupId,
|
|
111
|
-
panelDefinition: (
|
|
113
|
+
panelDefinition: (_get_initialValues_panelDefinition = (_get_initialValues = get().initialValues) === null || _get_initialValues === void 0 ? void 0 : _get_initialValues.panelDefinition) !== null && _get_initialValues_panelDefinition !== void 0 ? _get_initialValues_panelDefinition : (0, _common.createPanelDefinition)()
|
|
112
114
|
},
|
|
113
115
|
applyChanges: (next)=>{
|
|
114
116
|
const name = next.panelDefinition.spec.display.name;
|
|
@@ -141,7 +143,7 @@ function createPanelEditorSlice() {
|
|
|
141
143
|
set((state)=>{
|
|
142
144
|
// Add the new panel group if one was created for the panel
|
|
143
145
|
if (newGroup !== undefined) {
|
|
144
|
-
(0,
|
|
146
|
+
(0, _panelgroupslice.addPanelGroup)(state, newGroup);
|
|
145
147
|
}
|
|
146
148
|
// Open the editor with the new state
|
|
147
149
|
state.panelEditor = editorState;
|
|
@@ -16,9 +16,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "createPanelGroupEditorSlice", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return createPanelGroupEditorSlice;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _panelgroupslice = require("./panel-group-slice");
|
|
22
24
|
const createPanelGroupEditorSlice = (set, get)=>({
|
|
23
25
|
panelGroupEditor: undefined,
|
|
24
26
|
openAddPanelGroup: ()=>{
|
|
@@ -30,11 +32,11 @@ const createPanelGroupEditorSlice = (set, get)=>({
|
|
|
30
32
|
isCollapsed: false
|
|
31
33
|
},
|
|
32
34
|
applyChanges (next) {
|
|
33
|
-
const newGroup = (0,
|
|
35
|
+
const newGroup = (0, _panelgroupslice.createEmptyPanelGroup)();
|
|
34
36
|
newGroup.title = next.title;
|
|
35
37
|
newGroup.isCollapsed = next.isCollapsed;
|
|
36
38
|
set((draft)=>{
|
|
37
|
-
(0,
|
|
39
|
+
(0, _panelgroupslice.addPanelGroup)(draft, newGroup);
|
|
38
40
|
});
|
|
39
41
|
},
|
|
40
42
|
close () {
|
|
@@ -53,12 +55,12 @@ const createPanelGroupEditorSlice = (set, get)=>({
|
|
|
53
55
|
if (existingGroup === undefined) {
|
|
54
56
|
throw new Error(`Panel group with Id ${panelGroupId} does not exist`);
|
|
55
57
|
}
|
|
56
|
-
var
|
|
58
|
+
var _existingGroup_title;
|
|
57
59
|
// Create the editor state
|
|
58
60
|
const editor = {
|
|
59
61
|
mode: 'Edit',
|
|
60
62
|
initialValues: {
|
|
61
|
-
title: (
|
|
63
|
+
title: (_existingGroup_title = existingGroup.title) !== null && _existingGroup_title !== void 0 ? _existingGroup_title : '',
|
|
62
64
|
isCollapsed: existingGroup.isCollapsed
|
|
63
65
|
},
|
|
64
66
|
applyChanges (next) {
|
|
@@ -21,10 +21,18 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
createPanelGroupSlice: ()
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
createPanelGroupSlice: function() {
|
|
25
|
+
return createPanelGroupSlice;
|
|
26
|
+
},
|
|
27
|
+
convertLayoutsToPanelGroups: function() {
|
|
28
|
+
return convertLayoutsToPanelGroups;
|
|
29
|
+
},
|
|
30
|
+
createEmptyPanelGroup: function() {
|
|
31
|
+
return createEmptyPanelGroup;
|
|
32
|
+
},
|
|
33
|
+
addPanelGroup: function() {
|
|
34
|
+
return addPanelGroup;
|
|
35
|
+
}
|
|
28
36
|
});
|
|
29
37
|
const _core = require("@perses-dev/core");
|
|
30
38
|
const _common = require("./common");
|
|
@@ -67,7 +75,7 @@ function convertLayoutsToPanelGroups(layouts) {
|
|
|
67
75
|
const panelGroups = {};
|
|
68
76
|
const panelGroupIdOrder = [];
|
|
69
77
|
for (const layout of layouts){
|
|
70
|
-
var
|
|
78
|
+
var _layout_spec_display, _layout_spec_display_collapse, _layout_spec_display1;
|
|
71
79
|
const itemLayouts = [];
|
|
72
80
|
const itemPanelKeys = {};
|
|
73
81
|
// Split layout information from panel keys to make it easier to update just layouts on move/resize of panels
|
|
@@ -86,8 +94,8 @@ function convertLayoutsToPanelGroups(layouts) {
|
|
|
86
94
|
const panelGroupId = (0, _common.generateId)();
|
|
87
95
|
panelGroups[panelGroupId] = {
|
|
88
96
|
id: panelGroupId,
|
|
89
|
-
isCollapsed: ((
|
|
90
|
-
title: (
|
|
97
|
+
isCollapsed: ((_layout_spec_display = layout.spec.display) === null || _layout_spec_display === void 0 ? void 0 : (_layout_spec_display_collapse = _layout_spec_display.collapse) === null || _layout_spec_display_collapse === void 0 ? void 0 : _layout_spec_display_collapse.open) === false,
|
|
98
|
+
title: (_layout_spec_display1 = layout.spec.display) === null || _layout_spec_display1 === void 0 ? void 0 : _layout_spec_display1.title,
|
|
91
99
|
itemLayouts,
|
|
92
100
|
itemPanelKeys
|
|
93
101
|
};
|
|
@@ -16,7 +16,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "createPanelSlice", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return createPanelSlice;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
23
|
function createPanelSlice(panels) {
|
|
22
24
|
return ()=>({
|
|
@@ -16,7 +16,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "createSaveChangesDialogSlice", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return createSaveChangesDialogSlice;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
23
|
const createSaveChangesDialogSlice = (set)=>({
|
|
22
24
|
isOpen: false,
|
|
@@ -16,16 +16,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "DatasourceStoreProvider", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return DatasourceStoreProvider;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _react = require("react");
|
|
23
25
|
const _core = require("@perses-dev/core");
|
|
24
|
-
const
|
|
26
|
+
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
25
27
|
function DatasourceStoreProvider(props) {
|
|
26
28
|
const { dashboardResource , projectName , datasourceApi , onCreate , children } = props;
|
|
27
29
|
const project = projectName !== null && projectName !== void 0 ? projectName : dashboardResource === null || dashboardResource === void 0 ? void 0 : dashboardResource.metadata.project;
|
|
28
|
-
const { getPlugin , listPluginMetadata } = (0,
|
|
30
|
+
const { getPlugin , listPluginMetadata } = (0, _pluginsystem.usePluginRegistry)();
|
|
29
31
|
const findDatasource = (0, _core.useEvent)(async (selector)=>{
|
|
30
32
|
// Try to find it in dashboard spec
|
|
31
33
|
if (dashboardResource) {
|
|
@@ -33,8 +35,12 @@ function DatasourceStoreProvider(props) {
|
|
|
33
35
|
const dashboardDatasource = findDashboardDatasource(datasources, selector);
|
|
34
36
|
if (dashboardDatasource !== undefined) {
|
|
35
37
|
return {
|
|
36
|
-
spec: dashboardDatasource,
|
|
37
|
-
proxyUrl:
|
|
38
|
+
spec: dashboardDatasource.spec,
|
|
39
|
+
proxyUrl: buildDatasourceProxyUrl(datasourceApi, {
|
|
40
|
+
project: dashboardResource.metadata.project,
|
|
41
|
+
dashboard: dashboardResource.metadata.name,
|
|
42
|
+
name: dashboardDatasource.name
|
|
43
|
+
})
|
|
38
44
|
};
|
|
39
45
|
}
|
|
40
46
|
}
|
|
@@ -43,8 +49,11 @@ function DatasourceStoreProvider(props) {
|
|
|
43
49
|
const datasource = await datasourceApi.getDatasource(project, selector);
|
|
44
50
|
if (datasource !== undefined) {
|
|
45
51
|
return {
|
|
46
|
-
spec: datasource.
|
|
47
|
-
proxyUrl:
|
|
52
|
+
spec: datasource.spec,
|
|
53
|
+
proxyUrl: buildDatasourceProxyUrl(datasourceApi, {
|
|
54
|
+
project: datasource.metadata.project,
|
|
55
|
+
name: datasource.metadata.name
|
|
56
|
+
})
|
|
48
57
|
};
|
|
49
58
|
}
|
|
50
59
|
}
|
|
@@ -52,8 +61,10 @@ function DatasourceStoreProvider(props) {
|
|
|
52
61
|
const globalDatasource = await datasourceApi.getGlobalDatasource(selector);
|
|
53
62
|
if (globalDatasource !== undefined) {
|
|
54
63
|
return {
|
|
55
|
-
spec: globalDatasource.
|
|
56
|
-
proxyUrl:
|
|
64
|
+
spec: globalDatasource.spec,
|
|
65
|
+
proxyUrl: buildDatasourceProxyUrl(datasourceApi, {
|
|
66
|
+
name: globalDatasource.metadata.name
|
|
67
|
+
})
|
|
57
68
|
};
|
|
58
69
|
}
|
|
59
70
|
throw new Error(`No datasource found for kind '${selector.kind}' and name '${selector.name}'`);
|
|
@@ -85,53 +96,56 @@ function DatasourceStoreProvider(props) {
|
|
|
85
96
|
getPlugin,
|
|
86
97
|
onCreate
|
|
87
98
|
]);
|
|
88
|
-
const
|
|
99
|
+
const listDatasourceSelectItems = (0, _core.useEvent)(async (datasourcePluginKind)=>{
|
|
89
100
|
const [pluginMetadata, datasources, globalDatasources] = await Promise.all([
|
|
90
101
|
listPluginMetadata('Datasource'),
|
|
91
102
|
project ? datasourceApi.listDatasources(project, datasourcePluginKind) : [],
|
|
92
103
|
datasourceApi.listGlobalDatasources(datasourcePluginKind)
|
|
93
104
|
]);
|
|
94
|
-
// Find the metadata for the plugin type they asked for so we can use it for the name of the default datasource
|
|
105
|
+
// Find the metadata for the plugin type they asked for, so we can use it for the name of the default datasource
|
|
95
106
|
const datasourcePluginMetadata = pluginMetadata.find((metadata)=>metadata.kind === datasourcePluginKind);
|
|
96
107
|
if (datasourcePluginMetadata === undefined) {
|
|
97
108
|
throw new Error(`Could not find a Datasource plugin with kind '${datasourcePluginKind}'`);
|
|
98
109
|
}
|
|
99
|
-
// Get helper for
|
|
100
|
-
const { results ,
|
|
101
|
-
// Start with dashboard datasources
|
|
110
|
+
// Get helper for computing results properly
|
|
111
|
+
const { results , addItem } = buildDatasourceSelectItemGroups(datasourcePluginMetadata.display.name);
|
|
112
|
+
// Start with dashboard datasources with the highest precedence
|
|
102
113
|
if (dashboardResource === null || dashboardResource === void 0 ? void 0 : dashboardResource.spec.datasources) {
|
|
103
114
|
for(const selectorName in dashboardResource.spec.datasources){
|
|
104
115
|
const spec = dashboardResource.spec.datasources[selectorName];
|
|
105
116
|
if (spec === undefined || spec.plugin.kind !== datasourcePluginKind) continue;
|
|
106
|
-
|
|
117
|
+
addItem(spec, selectorName, 'dashboard');
|
|
107
118
|
}
|
|
108
119
|
}
|
|
109
120
|
// Now look at project-level datasources
|
|
110
121
|
for (const datasource of datasources){
|
|
111
|
-
const
|
|
112
|
-
|
|
122
|
+
const selectorName = datasource.metadata.name;
|
|
123
|
+
addItem(datasource.spec, selectorName, 'project', `/projects/${project}/datasources`);
|
|
113
124
|
}
|
|
114
125
|
// And finally global datasources
|
|
115
126
|
for (const globalDatasource of globalDatasources){
|
|
116
|
-
const
|
|
117
|
-
|
|
127
|
+
const selectorName = globalDatasource.metadata.name;
|
|
128
|
+
addItem(globalDatasource.spec, selectorName, 'global', '/admin/datasources');
|
|
118
129
|
}
|
|
119
130
|
return results;
|
|
120
131
|
});
|
|
121
132
|
const ctxValue = (0, _react.useMemo)(()=>({
|
|
122
133
|
getDatasource,
|
|
123
134
|
getDatasourceClient,
|
|
124
|
-
|
|
135
|
+
listDatasourceSelectItems
|
|
125
136
|
}), [
|
|
126
137
|
getDatasource,
|
|
127
138
|
getDatasourceClient,
|
|
128
|
-
|
|
139
|
+
listDatasourceSelectItems
|
|
129
140
|
]);
|
|
130
|
-
return /*#__PURE__*/ (0,
|
|
141
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.DatasourceStoreContext.Provider, {
|
|
131
142
|
value: ctxValue,
|
|
132
143
|
children: children
|
|
133
144
|
});
|
|
134
145
|
}
|
|
146
|
+
function buildDatasourceProxyUrl(api, params) {
|
|
147
|
+
return api.buildProxyUrl ? api.buildProxyUrl(params) : '';
|
|
148
|
+
}
|
|
135
149
|
// Helper to find a datasource in the list embedded in a dashboard spec
|
|
136
150
|
function findDashboardDatasource(dashboardDatasources, selector) {
|
|
137
151
|
if (dashboardDatasources === undefined) return undefined;
|
|
@@ -139,42 +153,97 @@ function findDashboardDatasource(dashboardDatasources, selector) {
|
|
|
139
153
|
if (selector.name !== undefined) {
|
|
140
154
|
const named = dashboardDatasources[selector.name];
|
|
141
155
|
if (named === undefined) return undefined;
|
|
142
|
-
return named.plugin.kind === selector.kind ?
|
|
156
|
+
return named.plugin.kind === selector.kind ? {
|
|
157
|
+
name: selector.name,
|
|
158
|
+
spec: named
|
|
159
|
+
} : undefined;
|
|
143
160
|
}
|
|
144
161
|
// If only using a kind, try to find one with that kind that is the default
|
|
145
|
-
|
|
162
|
+
const result = Object.entries(dashboardDatasources).find((entry)=>entry[1].plugin.kind === selector.kind && entry[1].default);
|
|
163
|
+
if (!result) {
|
|
164
|
+
return undefined;
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
name: result[0],
|
|
168
|
+
spec: result[1]
|
|
169
|
+
};
|
|
146
170
|
}
|
|
147
|
-
|
|
148
|
-
|
|
171
|
+
/**
|
|
172
|
+
* Helper for building a list of DatasourceSelectItemGroup results.
|
|
173
|
+
* @param pluginDisplayName
|
|
174
|
+
*/ function buildDatasourceSelectItemGroups(pluginDisplayName) {
|
|
149
175
|
const results = [];
|
|
150
176
|
const usedNames = new Set();
|
|
151
|
-
let
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
177
|
+
let isFirst = true;
|
|
178
|
+
let explicitDefaultAdded = false;
|
|
179
|
+
const groupIndices = {};
|
|
180
|
+
let currentGroupIndex = 1; // 0 is the default group, always there as it contains at least the first item.
|
|
181
|
+
const addItem = (spec, selectorName, group, editLink)=>{
|
|
182
|
+
var _spec_display;
|
|
183
|
+
group = group !== null && group !== void 0 ? group : '';
|
|
184
|
+
// Ensure the default group is always present as soon as an item is added.
|
|
185
|
+
if (isFirst) {
|
|
186
|
+
results.push({
|
|
187
|
+
group: `Default ${pluginDisplayName}`,
|
|
188
|
+
items: []
|
|
161
189
|
});
|
|
162
|
-
defaultAdded = true;
|
|
163
190
|
}
|
|
164
|
-
|
|
165
|
-
if
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
191
|
+
var _groupIndices_group;
|
|
192
|
+
// Create the group if necessary
|
|
193
|
+
let selectItemGroup = results[(_groupIndices_group = groupIndices[group]) !== null && _groupIndices_group !== void 0 ? _groupIndices_group : -1];
|
|
194
|
+
if (!selectItemGroup) {
|
|
195
|
+
groupIndices[group] = currentGroupIndex;
|
|
196
|
+
selectItemGroup = {
|
|
197
|
+
items: [],
|
|
198
|
+
group,
|
|
199
|
+
editLink
|
|
200
|
+
};
|
|
201
|
+
results[currentGroupIndex] = selectItemGroup;
|
|
202
|
+
currentGroupIndex++;
|
|
203
|
+
}
|
|
204
|
+
// Add item to the group
|
|
205
|
+
const isOverridden = usedNames.has(selectorName);
|
|
206
|
+
var _spec_display_name;
|
|
207
|
+
selectItemGroup.items.push({
|
|
208
|
+
name: (_spec_display_name = (_spec_display = spec.display) === null || _spec_display === void 0 ? void 0 : _spec_display.name) !== null && _spec_display_name !== void 0 ? _spec_display_name : selectorName,
|
|
209
|
+
overridden: isOverridden,
|
|
169
210
|
selector: {
|
|
170
211
|
kind: spec.plugin.kind,
|
|
171
|
-
name: selectorName
|
|
212
|
+
name: selectorName,
|
|
213
|
+
group
|
|
172
214
|
}
|
|
173
215
|
});
|
|
174
216
|
usedNames.add(selectorName);
|
|
217
|
+
const isExplicitDefault = !isOverridden && spec.default && !explicitDefaultAdded;
|
|
218
|
+
if (results[0] && (isFirst || isExplicitDefault)) {
|
|
219
|
+
// If we haven't added a default yet and this is a default, add default option to the beginning of the results
|
|
220
|
+
results[0].items = [
|
|
221
|
+
{
|
|
222
|
+
name: `Default (${selectorName} from ${group})`,
|
|
223
|
+
selector: {
|
|
224
|
+
kind: spec.plugin.kind
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
];
|
|
228
|
+
// We consider that we added the default datasource only if it has been explicitly set as default.
|
|
229
|
+
// If we add this datasource as default just because it's the first, it still needs to be overridable by
|
|
230
|
+
// another datasource explicitly set as default.
|
|
231
|
+
explicitDefaultAdded = isExplicitDefault;
|
|
232
|
+
}
|
|
233
|
+
// At the end, we make sure the overriding item(s) is well flagged so
|
|
234
|
+
if (isOverridden) {
|
|
235
|
+
for(let i = explicitDefaultAdded ? 1 : 0; i < currentGroupIndex; i++){
|
|
236
|
+
var _results_i;
|
|
237
|
+
var _results_i_items;
|
|
238
|
+
((_results_i_items = (_results_i = results[i]) === null || _results_i === void 0 ? void 0 : _results_i.items) !== null && _results_i_items !== void 0 ? _results_i_items : []).filter((item)=>item.selector.name === selectorName).forEach((item)=>{
|
|
239
|
+
item.overriding = true;
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
isFirst = false;
|
|
175
244
|
};
|
|
176
245
|
return {
|
|
177
246
|
results,
|
|
178
|
-
|
|
247
|
+
addItem
|
|
179
248
|
};
|
|
180
249
|
}
|