@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
|
@@ -21,13 +21,17 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
getTestDashboard: ()
|
|
25
|
-
|
|
24
|
+
getTestDashboard: function() {
|
|
25
|
+
return getTestDashboard;
|
|
26
|
+
},
|
|
27
|
+
createDashboardProviderSpy: function() {
|
|
28
|
+
return createDashboardProviderSpy;
|
|
29
|
+
}
|
|
26
30
|
});
|
|
27
31
|
const _react = require("react");
|
|
28
32
|
const _context = require("../context");
|
|
29
|
-
const _testDashboard = /*#__PURE__*/
|
|
30
|
-
function
|
|
33
|
+
const _testDashboard = /*#__PURE__*/ _interop_require_default(require("./testDashboard"));
|
|
34
|
+
function _interop_require_default(obj) {
|
|
31
35
|
return obj && obj.__esModule ? obj : {
|
|
32
36
|
default: obj
|
|
33
37
|
};
|
|
@@ -21,18 +21,24 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
prometheusDemoUrl: ()
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
prometheusDemoUrl: function() {
|
|
25
|
+
return prometheusDemoUrl;
|
|
26
|
+
},
|
|
27
|
+
prometheusDemo: function() {
|
|
28
|
+
return prometheusDemo;
|
|
29
|
+
},
|
|
30
|
+
defaultDatasourceProps: function() {
|
|
31
|
+
return defaultDatasourceProps;
|
|
32
|
+
}
|
|
27
33
|
});
|
|
28
|
-
const
|
|
34
|
+
const _dashboardprovider = require("./dashboard-provider");
|
|
29
35
|
const prometheusDemoUrl = 'https://prometheus.demo.do.prometheus.io';
|
|
30
36
|
const prometheusDemo = {
|
|
31
37
|
kind: 'GlobalDatasource',
|
|
32
38
|
metadata: {
|
|
33
39
|
name: 'PrometheusDemo',
|
|
34
|
-
|
|
35
|
-
|
|
40
|
+
createdAt: '0001-01-01T00:00:00Z',
|
|
41
|
+
updatedAt: '0001-01-01T00:00:00Z',
|
|
36
42
|
version: 0
|
|
37
43
|
},
|
|
38
44
|
spec: {
|
|
@@ -40,23 +46,21 @@ const prometheusDemo = {
|
|
|
40
46
|
plugin: {
|
|
41
47
|
kind: 'PrometheusDatasource',
|
|
42
48
|
spec: {
|
|
43
|
-
|
|
49
|
+
directUrl: prometheusDemoUrl
|
|
44
50
|
}
|
|
45
51
|
}
|
|
46
52
|
}
|
|
47
53
|
};
|
|
48
54
|
const defaultDatasourceProps = {
|
|
49
|
-
dashboardResource: (0,
|
|
55
|
+
dashboardResource: (0, _dashboardprovider.getTestDashboard)(),
|
|
50
56
|
datasourceApi: {
|
|
57
|
+
buildProxyUrl: ()=>'',
|
|
51
58
|
getDatasource: ()=>{
|
|
52
59
|
return Promise.resolve(undefined);
|
|
53
60
|
},
|
|
54
61
|
getGlobalDatasource: (selector)=>{
|
|
55
62
|
if (selector.kind === 'PrometheusDatasource') {
|
|
56
|
-
return Promise.resolve(
|
|
57
|
-
resource: prometheusDemo,
|
|
58
|
-
proxyUrl: prometheusDemoUrl
|
|
59
|
-
});
|
|
63
|
+
return Promise.resolve(prometheusDemo);
|
|
60
64
|
}
|
|
61
65
|
return Promise.resolve(undefined);
|
|
62
66
|
},
|
package/dist/cjs/test/index.js
CHANGED
|
@@ -14,18 +14,20 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
function
|
|
17
|
+
_export_star(require("./dashboard-provider"), exports);
|
|
18
|
+
_export_star(require("./datasource-provider"), exports);
|
|
19
|
+
_export_star(require("./plugin-registry"), exports);
|
|
20
|
+
_export_star(require("./render"), exports);
|
|
21
|
+
function _export_star(from, to) {
|
|
22
22
|
Object.keys(from).forEach(function(k) {
|
|
23
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k))
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
24
|
+
Object.defineProperty(to, k, {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function() {
|
|
27
|
+
return from[k];
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
29
31
|
});
|
|
30
32
|
return from;
|
|
31
33
|
}
|
|
@@ -16,17 +16,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "MOCK_PLUGINS", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return MOCK_PLUGINS;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const FakeTimeSeriesChartOptionEditor = ()=>{
|
|
23
|
-
return /*#__PURE__*/ (0,
|
|
25
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
24
26
|
children: "TimeSeriesChart options"
|
|
25
27
|
});
|
|
26
28
|
};
|
|
27
29
|
const FakeTimeSeriesPlugin = {
|
|
28
30
|
PanelComponent: ()=>{
|
|
29
|
-
return /*#__PURE__*/ (0,
|
|
31
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
30
32
|
children: "TimeSeriesChart panel"
|
|
31
33
|
});
|
|
32
34
|
},
|
package/dist/cjs/test/render.js
CHANGED
|
@@ -16,19 +16,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "renderWithContext", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return renderWithContext;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _react = require("react");
|
|
23
25
|
const _react1 = require("@testing-library/react");
|
|
24
|
-
const
|
|
26
|
+
const _reactrouterdom = require("react-router-dom");
|
|
25
27
|
const _history = require("history");
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
28
|
+
const _usequeryparams = require("use-query-params");
|
|
29
|
+
const _reactrouter6 = require("use-query-params/adapters/react-router-6");
|
|
30
|
+
const _reactquery = require("@tanstack/react-query");
|
|
29
31
|
const _components = require("@perses-dev/components");
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
+
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
33
|
+
const _context = require("../context");
|
|
34
|
+
const _test = require("../test");
|
|
35
|
+
const _pluginregistry = require("./plugin-registry");
|
|
32
36
|
/*
|
|
33
37
|
* Workaround for React router upgrade type errors.
|
|
34
38
|
* More details: https://stackoverflow.com/a/69948457/17575201
|
|
@@ -40,7 +44,7 @@ const _pluginRegistry = require("./plugin-registry");
|
|
|
40
44
|
(0, _react.useLayoutEffect)(()=>history.listen(setState), [
|
|
41
45
|
history
|
|
42
46
|
]);
|
|
43
|
-
return /*#__PURE__*/ (0,
|
|
47
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactrouterdom.Router, {
|
|
44
48
|
location: state.location,
|
|
45
49
|
navigationType: state.action,
|
|
46
50
|
navigator: history,
|
|
@@ -49,7 +53,7 @@ const _pluginRegistry = require("./plugin-registry");
|
|
|
49
53
|
};
|
|
50
54
|
function renderWithContext(ui, options, history) {
|
|
51
55
|
// Create a new QueryClient for each test to avoid caching issues
|
|
52
|
-
const queryClient = new
|
|
56
|
+
const queryClient = new _reactquery.QueryClient({
|
|
53
57
|
defaultOptions: {
|
|
54
58
|
queries: {
|
|
55
59
|
refetchOnWindowFocus: false,
|
|
@@ -58,27 +62,30 @@ function renderWithContext(ui, options, history) {
|
|
|
58
62
|
}
|
|
59
63
|
});
|
|
60
64
|
const customHistory = history !== null && history !== void 0 ? history : (0, _history.createMemoryHistory)();
|
|
61
|
-
const BaseRender = ()=>/*#__PURE__*/ (0,
|
|
65
|
+
const BaseRender = ()=>/*#__PURE__*/ (0, _jsxruntime.jsx)(CustomRouter, {
|
|
62
66
|
history: customHistory,
|
|
63
|
-
children: /*#__PURE__*/ (0,
|
|
67
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactquery.QueryClientProvider, {
|
|
64
68
|
client: queryClient,
|
|
65
|
-
children: /*#__PURE__*/ (0,
|
|
66
|
-
adapter:
|
|
67
|
-
children: /*#__PURE__*/ (0,
|
|
69
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_usequeryparams.QueryParamProvider, {
|
|
70
|
+
adapter: _reactrouter6.ReactRouter6Adapter,
|
|
71
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.SnackbarProvider, {
|
|
68
72
|
anchorOrigin: {
|
|
69
73
|
vertical: 'bottom',
|
|
70
74
|
horizontal: 'right'
|
|
71
75
|
},
|
|
72
|
-
children: /*#__PURE__*/ (0,
|
|
76
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ChartsProvider, {
|
|
73
77
|
chartsTheme: _components.testChartsTheme,
|
|
74
|
-
children: /*#__PURE__*/ (0,
|
|
75
|
-
...(0,
|
|
76
|
-
children:
|
|
78
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.PluginRegistry, {
|
|
79
|
+
...(0, _pluginsystem.mockPluginRegistry)(..._pluginregistry.MOCK_PLUGINS),
|
|
80
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_context.DatasourceStoreProvider, {
|
|
81
|
+
..._test.defaultDatasourceProps,
|
|
82
|
+
children: ui
|
|
83
|
+
})
|
|
77
84
|
})
|
|
78
85
|
})
|
|
79
86
|
})
|
|
80
87
|
})
|
|
81
88
|
})
|
|
82
89
|
});
|
|
83
|
-
return (0, _react1.render)(/*#__PURE__*/ (0,
|
|
90
|
+
return (0, _react1.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(BaseRender, {}), options);
|
|
84
91
|
}
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
const
|
|
17
|
+
const _reactintersectionobserver = require("react-intersection-observer");
|
|
18
18
|
require("@testing-library/jest-dom/extend-expect");
|
|
19
19
|
// Always mock e-charts during tests since we don't have a proper canvas in jsdom
|
|
20
20
|
jest.mock('echarts/core');
|
|
21
21
|
// Tell react-intersection-observer that everything should be considered in-view for tests (see package documentation
|
|
22
22
|
// for other options)
|
|
23
|
-
(0,
|
|
23
|
+
(0, _reactintersectionobserver.defaultFallbackInView)(true);
|
|
@@ -16,15 +16,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "default", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return _default;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
23
|
const testDashboard = {
|
|
22
24
|
kind: 'Dashboard',
|
|
23
25
|
metadata: {
|
|
24
26
|
name: 'Node Stats',
|
|
25
27
|
project: 'perses',
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
createdAt: '2021-11-09',
|
|
29
|
+
updatedAt: '2021-11-09',
|
|
28
30
|
version: 0
|
|
29
31
|
},
|
|
30
32
|
spec: {
|
|
@@ -63,8 +65,8 @@ const testDashboard = {
|
|
|
63
65
|
plugin: {
|
|
64
66
|
kind: 'TimeSeriesChart',
|
|
65
67
|
spec: {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
+
format: {
|
|
69
|
+
unit: '%'
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
},
|
|
@@ -92,8 +94,8 @@ const testDashboard = {
|
|
|
92
94
|
plugin: {
|
|
93
95
|
kind: 'TimeSeriesChart',
|
|
94
96
|
spec: {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
+
format: {
|
|
98
|
+
unit: 'bytes'
|
|
97
99
|
}
|
|
98
100
|
}
|
|
99
101
|
},
|
|
@@ -155,8 +157,8 @@ const testDashboard = {
|
|
|
155
157
|
plugin: {
|
|
156
158
|
kind: 'TimeSeriesChart',
|
|
157
159
|
spec: {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
+
format: {
|
|
161
|
+
unit: 'percent'
|
|
160
162
|
}
|
|
161
163
|
}
|
|
162
164
|
},
|
|
@@ -184,8 +186,8 @@ const testDashboard = {
|
|
|
184
186
|
plugin: {
|
|
185
187
|
kind: 'TimeSeriesChart',
|
|
186
188
|
spec: {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
+
format: {
|
|
190
|
+
unit: 'percent'
|
|
189
191
|
}
|
|
190
192
|
}
|
|
191
193
|
},
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -14,16 +14,18 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
function
|
|
17
|
+
_export_star(require("./panelUtils"), exports);
|
|
18
|
+
_export_star(require("./time"), exports);
|
|
19
|
+
function _export_star(from, to) {
|
|
20
20
|
Object.keys(from).forEach(function(k) {
|
|
21
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k))
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
22
|
+
Object.defineProperty(to, k, {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function() {
|
|
25
|
+
return from[k];
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
27
29
|
});
|
|
28
30
|
return from;
|
|
29
31
|
}
|
|
@@ -21,9 +21,15 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
getYForNewRow: ()
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
getYForNewRow: function() {
|
|
25
|
+
return getYForNewRow;
|
|
26
|
+
},
|
|
27
|
+
insertPanelInLayout: function() {
|
|
28
|
+
return insertPanelInLayout;
|
|
29
|
+
},
|
|
30
|
+
getValidPanelKey: function() {
|
|
31
|
+
return getValidPanelKey;
|
|
32
|
+
}
|
|
27
33
|
});
|
|
28
34
|
const _constants = require("../constants");
|
|
29
35
|
function getYForNewRow(group) {
|
package/dist/cjs/utils/time.js
CHANGED
|
@@ -16,12 +16,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "useSuggestedStepMs", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return useSuggestedStepMs;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
23
|
const _core = require("@perses-dev/core");
|
|
22
|
-
const
|
|
24
|
+
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
23
25
|
function useSuggestedStepMs(width) {
|
|
24
|
-
const { absoluteTimeRange } = (0,
|
|
26
|
+
const { absoluteTimeRange } = (0, _pluginsystem.useTimeRange)();
|
|
25
27
|
if (width === undefined) return 0;
|
|
26
28
|
return (0, _core.getSuggestedStepMs)(absoluteTimeRange, width);
|
|
27
29
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
_export_star(require("./panel"), exports);
|
|
18
|
+
function _export_star(from, to) {
|
|
19
|
+
Object.keys(from).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
21
|
+
Object.defineProperty(to, k, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function() {
|
|
24
|
+
return from[k];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return from;
|
|
30
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "panelEditorValidationSchema", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return panelEditorValidationSchema;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _zod = require("zod");
|
|
24
|
+
const panelEditorValidationSchema = _zod.z.object({
|
|
25
|
+
name: _zod.z.string().nonempty('Required'),
|
|
26
|
+
groupId: _zod.z.number(),
|
|
27
|
+
description: _zod.z.string().optional(),
|
|
28
|
+
type: _zod.z.string().nonempty('Required')
|
|
29
|
+
});
|
|
@@ -16,16 +16,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "DashboardApp", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return DashboardApp;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _react = require("react");
|
|
23
25
|
const _material = require("@mui/material");
|
|
24
26
|
const _components = require("@perses-dev/components");
|
|
25
27
|
const _components1 = require("../../components");
|
|
26
28
|
const _context = require("../../context");
|
|
27
29
|
const DashboardApp = (props)=>{
|
|
28
|
-
const { dashboardResource , dashboardTitleComponent , emptyDashboardProps , onSave , onDiscard , initialVariableIsSticky , isReadonly , } = props;
|
|
30
|
+
const { dashboardResource , dashboardTitleComponent , emptyDashboardProps , onSave , onDiscard , initialVariableIsSticky , isReadonly , isCreating } = props;
|
|
29
31
|
const chartsTheme = (0, _components.useChartsTheme)();
|
|
30
32
|
const { setEditMode } = (0, _context.useEditMode)();
|
|
31
33
|
const { dashboard , setDashboard } = (0, _context.useDashboard)();
|
|
@@ -61,7 +63,7 @@ const DashboardApp = (props)=>{
|
|
|
61
63
|
});
|
|
62
64
|
}
|
|
63
65
|
};
|
|
64
|
-
return /*#__PURE__*/ (0,
|
|
66
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
65
67
|
sx: {
|
|
66
68
|
flexGrow: 1,
|
|
67
69
|
overflowX: 'hidden',
|
|
@@ -70,7 +72,7 @@ const DashboardApp = (props)=>{
|
|
|
70
72
|
flexDirection: 'column'
|
|
71
73
|
},
|
|
72
74
|
children: [
|
|
73
|
-
/*#__PURE__*/ (0,
|
|
75
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components1.DashboardToolbar, {
|
|
74
76
|
dashboardName: dashboardResource.metadata.name,
|
|
75
77
|
dashboardTitleComponent: dashboardTitleComponent,
|
|
76
78
|
initialVariableIsSticky: initialVariableIsSticky,
|
|
@@ -79,32 +81,34 @@ const DashboardApp = (props)=>{
|
|
|
79
81
|
onEditButtonClick: onEditButtonClick,
|
|
80
82
|
onCancelButtonClick: onCancelButtonClick
|
|
81
83
|
}),
|
|
82
|
-
/*#__PURE__*/ (0,
|
|
84
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
83
85
|
sx: {
|
|
84
86
|
padding: (theme)=>theme.spacing(2),
|
|
85
87
|
height: '100%'
|
|
86
88
|
},
|
|
87
89
|
children: [
|
|
88
|
-
/*#__PURE__*/ (0,
|
|
90
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorBoundary, {
|
|
89
91
|
FallbackComponent: _components.ErrorAlert,
|
|
90
|
-
children: /*#__PURE__*/ (0,
|
|
92
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components1.Dashboard, {
|
|
91
93
|
emptyDashboardProps: {
|
|
92
94
|
onEditButtonClick,
|
|
93
95
|
...emptyDashboardProps
|
|
94
96
|
}
|
|
95
97
|
})
|
|
96
98
|
}),
|
|
97
|
-
/*#__PURE__*/ (0,
|
|
99
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ChartsProvider, {
|
|
98
100
|
chartsTheme: chartsTheme,
|
|
99
101
|
enablePinning: false,
|
|
100
|
-
children: /*#__PURE__*/ (0,
|
|
102
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components1.PanelDrawer, {})
|
|
101
103
|
}),
|
|
102
|
-
/*#__PURE__*/ (0,
|
|
103
|
-
/*#__PURE__*/ (0,
|
|
104
|
-
/*#__PURE__*/ (0,
|
|
105
|
-
/*#__PURE__*/ (0,
|
|
106
|
-
/*#__PURE__*/ (0,
|
|
107
|
-
|
|
104
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components1.PanelGroupDialog, {}),
|
|
105
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components1.DeletePanelGroupDialog, {}),
|
|
106
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components1.DeletePanelDialog, {}),
|
|
107
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components1.DashboardDiscardChangesConfirmationDialog, {}),
|
|
108
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components1.EditJsonDialog, {
|
|
109
|
+
disableMetadataEdition: !isCreating
|
|
110
|
+
}),
|
|
111
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components1.SaveChangesConfirmationDialog, {})
|
|
108
112
|
]
|
|
109
113
|
})
|
|
110
114
|
]
|
|
@@ -16,40 +16,83 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "ViewDashboard", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return ViewDashboard;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _material = require("@mui/material");
|
|
23
25
|
const _core = require("@perses-dev/core");
|
|
24
26
|
const _components = require("@perses-dev/components");
|
|
25
|
-
const
|
|
27
|
+
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
28
|
+
const _react = require("react");
|
|
26
29
|
const _context = require("../../context");
|
|
27
|
-
const
|
|
30
|
+
const _DashboardApp = require("./DashboardApp");
|
|
28
31
|
function ViewDashboard(props) {
|
|
29
|
-
const { dashboardResource , datasourceApi , externalVariableDefinitions , dashboardTitleComponent , emptyDashboardProps , onSave , onDiscard , initialVariableIsSticky , isReadonly , isEditing , sx , ...others } = props;
|
|
32
|
+
const { dashboardResource , datasourceApi , externalVariableDefinitions , dashboardTitleComponent , emptyDashboardProps , onSave , onDiscard , initialVariableIsSticky , isReadonly , isEditing , isCreating , sx , ...others } = props;
|
|
30
33
|
const { spec } = dashboardResource;
|
|
31
|
-
var
|
|
32
|
-
const dashboardDuration = (
|
|
33
|
-
var
|
|
34
|
-
const dashboardRefreshInterval = (
|
|
35
|
-
const initialTimeRange = (0,
|
|
36
|
-
const initialRefreshInterval = (0,
|
|
37
|
-
|
|
34
|
+
var _spec_duration;
|
|
35
|
+
const dashboardDuration = (_spec_duration = spec.duration) !== null && _spec_duration !== void 0 ? _spec_duration : _core.DEFAULT_DASHBOARD_DURATION;
|
|
36
|
+
var _spec_refreshInterval;
|
|
37
|
+
const dashboardRefreshInterval = (_spec_refreshInterval = spec.refreshInterval) !== null && _spec_refreshInterval !== void 0 ? _spec_refreshInterval : _core.DEFAULT_REFRESH_INTERVAL;
|
|
38
|
+
const initialTimeRange = (0, _pluginsystem.useInitialTimeRange)(dashboardDuration);
|
|
39
|
+
const initialRefreshInterval = (0, _pluginsystem.useInitialRefreshInterval)(dashboardRefreshInterval);
|
|
40
|
+
const { data } = (0, _pluginsystem.usePluginBuiltinVariableDefinitions)();
|
|
41
|
+
const builtinVariables = (0, _react.useMemo)(()=>{
|
|
42
|
+
const result = [
|
|
43
|
+
{
|
|
44
|
+
kind: 'BuiltinVariable',
|
|
45
|
+
spec: {
|
|
46
|
+
name: '__dashboard',
|
|
47
|
+
value: ()=>dashboardResource.metadata.name,
|
|
48
|
+
source: 'Dashboard',
|
|
49
|
+
display: {
|
|
50
|
+
name: '__dashboard',
|
|
51
|
+
description: 'The name of the current dashboard',
|
|
52
|
+
hidden: true
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
kind: 'BuiltinVariable',
|
|
58
|
+
spec: {
|
|
59
|
+
name: '__project',
|
|
60
|
+
value: ()=>dashboardResource.metadata.project,
|
|
61
|
+
source: 'Dashboard',
|
|
62
|
+
display: {
|
|
63
|
+
name: '__project',
|
|
64
|
+
description: 'The name of the current dashboard project',
|
|
65
|
+
hidden: true
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
];
|
|
70
|
+
if (data) {
|
|
71
|
+
data.forEach((def)=>result.push(def));
|
|
72
|
+
}
|
|
73
|
+
return result;
|
|
74
|
+
}, [
|
|
75
|
+
dashboardResource.metadata.name,
|
|
76
|
+
dashboardResource.metadata.project,
|
|
77
|
+
data
|
|
78
|
+
]);
|
|
79
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_context.DatasourceStoreProvider, {
|
|
38
80
|
dashboardResource: dashboardResource,
|
|
39
81
|
datasourceApi: datasourceApi,
|
|
40
|
-
children: /*#__PURE__*/ (0,
|
|
82
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_context.DashboardProvider, {
|
|
41
83
|
initialState: {
|
|
42
84
|
dashboardResource,
|
|
43
85
|
isEditMode: !!isEditing
|
|
44
86
|
},
|
|
45
|
-
children: /*#__PURE__*/ (0,
|
|
87
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.TimeRangeProvider, {
|
|
46
88
|
initialTimeRange: initialTimeRange,
|
|
47
89
|
initialRefreshInterval: initialRefreshInterval,
|
|
48
90
|
enabledURLParams: true,
|
|
49
|
-
children: /*#__PURE__*/ (0,
|
|
91
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_context.TemplateVariableProvider, {
|
|
50
92
|
initialVariableDefinitions: spec.variables,
|
|
51
93
|
externalVariableDefinitions: externalVariableDefinitions,
|
|
52
|
-
|
|
94
|
+
builtinVariables: builtinVariables,
|
|
95
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
53
96
|
sx: (0, _components.combineSx)({
|
|
54
97
|
display: 'flex',
|
|
55
98
|
width: '100%',
|
|
@@ -58,16 +101,17 @@ function ViewDashboard(props) {
|
|
|
58
101
|
overflow: 'hidden'
|
|
59
102
|
}, sx),
|
|
60
103
|
...others,
|
|
61
|
-
children: /*#__PURE__*/ (0,
|
|
104
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorBoundary, {
|
|
62
105
|
FallbackComponent: _components.ErrorAlert,
|
|
63
|
-
children: /*#__PURE__*/ (0,
|
|
106
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_DashboardApp.DashboardApp, {
|
|
64
107
|
dashboardResource: dashboardResource,
|
|
65
108
|
dashboardTitleComponent: dashboardTitleComponent,
|
|
66
109
|
emptyDashboardProps: emptyDashboardProps,
|
|
67
110
|
onSave: onSave,
|
|
68
111
|
onDiscard: onDiscard,
|
|
69
112
|
initialVariableIsSticky: initialVariableIsSticky,
|
|
70
|
-
isReadonly: isReadonly
|
|
113
|
+
isReadonly: isReadonly,
|
|
114
|
+
isCreating: isCreating
|
|
71
115
|
})
|
|
72
116
|
})
|
|
73
117
|
})
|