@perses-dev/dashboards 0.9.0 → 0.10.0
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/Dashboard.js +7 -11
- package/dist/cjs/components/DashboardToolbar.js +4 -4
- package/dist/cjs/components/GridLayout/GridItemContent.js +13 -13
- package/dist/cjs/components/GridLayout/GridLayout.js +24 -21
- package/dist/cjs/components/GridLayout/GridTitle.js +27 -5
- package/dist/cjs/components/Panel/DeletePanelDialog.js +91 -0
- package/dist/cjs/components/Panel/Panel.js +16 -5
- package/dist/cjs/components/Panel/Panel.test.js +12 -4
- package/dist/cjs/components/Panel/PanelContent.js +3 -2
- package/dist/cjs/components/PanelDrawer/PanelDrawer.js +13 -12
- package/dist/cjs/components/PanelDrawer/PanelDrawer.test.js +8 -12
- package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +77 -35
- package/dist/cjs/components/PanelDrawer/PanelPreview.js +48 -0
- package/dist/cjs/components/PanelGroupDialog/DeletePanelGroupDialog.js +86 -0
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +12 -19
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.test.js +10 -31
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +2 -2
- package/dist/cjs/components/Variables/Variable.js +19 -11
- package/dist/cjs/components/Variables/VariableEditor.js +207 -0
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +236 -0
- package/dist/cjs/components/Variables/VariableEditorForm/index.js +28 -0
- package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +88 -0
- package/dist/cjs/components/Variables/VariableList.js +50 -69
- package/dist/cjs/components/Variables/index.js +1 -0
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +70 -0
- package/dist/cjs/context/DashboardProvider/common.js +18 -0
- package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +71 -0
- package/dist/cjs/context/DashboardProvider/index.js +29 -0
- package/dist/cjs/context/DashboardProvider/layout-slice.js +200 -0
- package/dist/cjs/context/DashboardProvider/panel-editing-slice.js +156 -0
- package/dist/{context/DashboardAppSlice.js → cjs/context/DashboardProvider/panel-group-slice.js} +18 -25
- package/dist/cjs/context/DatasourceStoreProvider.js +109 -7
- package/dist/cjs/context/TemplateVariableProvider.js +8 -1
- package/dist/cjs/context/index.js +0 -2
- package/dist/cjs/test/testDashboard.js +13 -1
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +6 -7
- package/dist/cjs/views/ViewDashboard/tests/panelGroups.test.js +165 -0
- package/dist/components/Dashboard.d.ts +1 -4
- package/dist/components/Dashboard.d.ts.map +1 -1
- package/dist/components/Dashboard.js +8 -12
- package/dist/components/Dashboard.js.map +1 -1
- package/dist/components/DashboardToolbar.d.ts.map +1 -1
- package/dist/components/DashboardToolbar.js +5 -5
- package/dist/components/DashboardToolbar.js.map +1 -1
- package/dist/components/GridLayout/GridItemContent.d.ts +3 -3
- package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
- package/dist/components/GridLayout/GridItemContent.js +14 -14
- package/dist/components/GridLayout/GridItemContent.js.map +1 -1
- package/dist/components/GridLayout/GridLayout.d.ts +2 -3
- package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
- package/dist/components/GridLayout/GridLayout.js +24 -21
- package/dist/components/GridLayout/GridLayout.js.map +1 -1
- package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
- package/dist/components/GridLayout/GridTitle.js +28 -6
- package/dist/components/GridLayout/GridTitle.js.map +1 -1
- package/dist/components/Panel/DeletePanelDialog.d.ts +5 -0
- package/dist/components/Panel/DeletePanelDialog.d.ts.map +1 -0
- package/dist/components/Panel/DeletePanelDialog.js +80 -0
- package/dist/components/Panel/DeletePanelDialog.js.map +1 -0
- package/dist/components/Panel/Panel.d.ts +1 -1
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/Panel.js +17 -6
- package/dist/components/Panel/Panel.js.map +1 -1
- package/dist/components/Panel/Panel.test.js +7 -4
- package/dist/components/Panel/Panel.test.js.map +1 -1
- package/dist/components/Panel/PanelContent.d.ts +4 -1
- package/dist/components/Panel/PanelContent.d.ts.map +1 -1
- package/dist/components/Panel/PanelContent.js +3 -2
- package/dist/components/Panel/PanelContent.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.js +14 -13
- package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.test.js +8 -12
- package/dist/components/PanelDrawer/PanelDrawer.test.js.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts +3 -3
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js +78 -36
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.d.ts +4 -0
- package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -0
- package/dist/components/PanelDrawer/PanelPreview.js +42 -0
- package/dist/components/PanelDrawer/PanelPreview.js.map +1 -0
- package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.d.ts +4 -0
- package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -0
- package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.js +75 -0
- package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.js.map +1 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js +13 -20
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js +10 -31
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js +3 -3
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
- package/dist/components/Variables/Variable.js +21 -13
- package/dist/components/Variables/Variable.js.map +1 -1
- package/dist/components/Variables/VariableEditor.d.ts +8 -0
- package/dist/components/Variables/VariableEditor.d.ts.map +1 -0
- package/dist/components/Variables/VariableEditor.js +196 -0
- package/dist/components/Variables/VariableEditor.js.map +1 -0
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +8 -0
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -0
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +225 -0
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -0
- package/dist/components/Variables/VariableEditorForm/index.d.ts +2 -0
- package/dist/components/Variables/VariableEditorForm/index.d.ts.map +1 -0
- package/dist/components/Variables/VariableEditorForm/index.js +15 -0
- package/dist/components/Variables/VariableEditorForm/index.js.map +1 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +21 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +76 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -0
- package/dist/components/Variables/VariableList.d.ts.map +1 -1
- package/dist/components/Variables/VariableList.js +48 -72
- 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/context/DashboardProvider/DashboardProvider.d.ts +23 -0
- package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -0
- package/dist/context/DashboardProvider/DashboardProvider.js +52 -0
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -0
- package/dist/context/DashboardProvider/common.d.ts +5 -0
- package/dist/context/DashboardProvider/common.d.ts.map +1 -0
- package/dist/context/DashboardProvider/common.js +17 -0
- package/dist/context/DashboardProvider/common.js.map +1 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +32 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.js +56 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -0
- package/dist/context/DashboardProvider/index.d.ts +3 -0
- package/dist/context/DashboardProvider/index.d.ts.map +1 -0
- package/dist/context/DashboardProvider/index.js +16 -0
- package/dist/context/DashboardProvider/index.js.map +1 -0
- package/dist/context/DashboardProvider/layout-slice.d.ts +57 -0
- package/dist/context/DashboardProvider/layout-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/layout-slice.js +196 -0
- package/dist/context/DashboardProvider/layout-slice.js.map +1 -0
- package/dist/context/DashboardProvider/panel-editing-slice.d.ts +70 -0
- package/dist/context/DashboardProvider/panel-editing-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/panel-editing-slice.js +152 -0
- package/dist/context/DashboardProvider/panel-editing-slice.js.map +1 -0
- package/dist/context/DashboardProvider/panel-group-slice.d.ts +15 -0
- package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/panel-group-slice.js +32 -0
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -0
- package/dist/context/DatasourceStoreProvider.d.ts +10 -2
- package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
- package/dist/context/DatasourceStoreProvider.js +111 -9
- package/dist/context/DatasourceStoreProvider.js.map +1 -1
- package/dist/context/TemplateVariableProvider.d.ts +2 -0
- package/dist/context/TemplateVariableProvider.d.ts.map +1 -1
- package/dist/context/TemplateVariableProvider.js +8 -1
- package/dist/context/TemplateVariableProvider.js.map +1 -1
- package/dist/context/index.d.ts +0 -2
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +0 -2
- package/dist/context/index.js.map +1 -1
- package/dist/test/plugin-registry.d.ts +2 -2
- package/dist/test/plugin-registry.d.ts.map +1 -1
- package/dist/test/plugin-registry.js.map +1 -1
- package/dist/test/testDashboard.d.ts.map +1 -1
- package/dist/test/testDashboard.js +13 -1
- package/dist/test/testDashboard.js.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.js +6 -7
- package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
- package/dist/views/ViewDashboard/tests/panelGroups.test.d.ts +2 -0
- package/dist/views/ViewDashboard/tests/panelGroups.test.d.ts.map +1 -0
- package/dist/views/ViewDashboard/tests/panelGroups.test.js +158 -0
- package/dist/views/ViewDashboard/tests/panelGroups.test.js.map +1 -0
- package/package.json +4 -4
- package/dist/cjs/components/PanelDrawer/PanelSpecEditor.js +0 -40
- package/dist/cjs/components/PanelDrawer/PanelTypeSelect.js +0 -38
- package/dist/cjs/components/PanelDrawer/panel-editor-model.js +0 -140
- package/dist/cjs/context/DashboardAppSlice.js +0 -57
- package/dist/cjs/context/DashboardProvider.js +0 -128
- package/dist/cjs/context/LayoutsSlice.js +0 -55
- package/dist/components/PanelDrawer/PanelSpecEditor.d.ts +0 -7
- package/dist/components/PanelDrawer/PanelSpecEditor.d.ts.map +0 -1
- package/dist/components/PanelDrawer/PanelSpecEditor.js +0 -34
- package/dist/components/PanelDrawer/PanelSpecEditor.js.map +0 -1
- package/dist/components/PanelDrawer/PanelTypeSelect.d.ts +0 -8
- package/dist/components/PanelDrawer/PanelTypeSelect.d.ts.map +0 -1
- package/dist/components/PanelDrawer/PanelTypeSelect.js +0 -34
- package/dist/components/PanelDrawer/PanelTypeSelect.js.map +0 -1
- package/dist/components/PanelDrawer/panel-editor-model.d.ts +0 -27
- package/dist/components/PanelDrawer/panel-editor-model.d.ts.map +0 -1
- package/dist/components/PanelDrawer/panel-editor-model.js +0 -133
- package/dist/components/PanelDrawer/panel-editor-model.js.map +0 -1
- package/dist/context/DashboardAppSlice.d.ts +0 -26
- package/dist/context/DashboardAppSlice.d.ts.map +0 -1
- package/dist/context/DashboardAppSlice.js.map +0 -1
- package/dist/context/DashboardProvider.d.ts +0 -36
- package/dist/context/DashboardProvider.d.ts.map +0 -1
- package/dist/context/DashboardProvider.js +0 -107
- package/dist/context/DashboardProvider.js.map +0 -1
- package/dist/context/LayoutsSlice.d.ts +0 -12
- package/dist/context/LayoutsSlice.d.ts.map +0 -1
- package/dist/context/LayoutsSlice.js +0 -43
- package/dist/context/LayoutsSlice.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/context/index.ts"],"sourcesContent":["// Copyright 2022 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\nexport * from './
|
|
1
|
+
{"version":3,"sources":["../../src/context/index.ts"],"sourcesContent":["// Copyright 2022 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\nexport * from './DashboardProvider';\nexport * from './DatasourceStoreProvider';\nexport * from './QueryStringProvider';\nexport * from './TemplateVariableProvider';\nexport * from './TimeRangeProvider';\n"],"names":[],"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,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PluginRegistryProps, PluginImplementation, PanelPlugin } from '@perses-dev/plugin-system';
|
|
1
|
+
import { PluginRegistryProps, PluginImplementation, PluginType, PanelPlugin } from '@perses-dev/plugin-system';
|
|
2
2
|
/**
|
|
3
3
|
* Helper for mocking `PluginRegistry` data during tests. Returns props that can be spread on the `PluginRegistry`
|
|
4
4
|
* component so that it will load the mock plugins you setup. You can use the `addMockPlugin` function that's returned
|
|
@@ -6,7 +6,7 @@ import { PluginRegistryProps, PluginImplementation, PanelPlugin } from '@perses-
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function mockPluginRegistryProps(): {
|
|
8
8
|
pluginRegistryProps: Omit<PluginRegistryProps, "children">;
|
|
9
|
-
addMockPlugin: <T extends
|
|
9
|
+
addMockPlugin: <T extends PluginType>(pluginType: T, kind: string, plugin: PluginImplementation<T>) => void;
|
|
10
10
|
};
|
|
11
11
|
export declare const FAKE_PANEL_PLUGIN: PanelPlugin;
|
|
12
12
|
//# sourceMappingURL=plugin-registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-registry.d.ts","sourceRoot":"","sources":["../../src/test/plugin-registry.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin-registry.d.ts","sourceRoot":"","sources":["../../src/test/plugin-registry.tsx"],"names":[],"mappings":"AAaA,OAAO,EACL,mBAAmB,EAEnB,oBAAoB,EACpB,UAAU,EACV,WAAW,EAEZ,MAAM,2BAA2B,CAAC;AAEnC;;;;GAIG;AACH,wBAAgB,uBAAuB;;+DAiB6B,MAAM;EA0BzE;AAED,eAAO,MAAM,iBAAiB,EAAE,WAQ/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/test/plugin-registry.tsx"],"sourcesContent":["// Copyright 2022 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.\nimport {\n PluginRegistryProps,\n PluginModuleResource,\n PluginImplementation,\n PluginType,\n
|
|
1
|
+
{"version":3,"sources":["../../src/test/plugin-registry.tsx"],"sourcesContent":["// Copyright 2022 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.\nimport { UnknownSpec } from '@perses-dev/core';\nimport {\n PluginRegistryProps,\n PluginModuleResource,\n PluginImplementation,\n PluginType,\n PanelPlugin,\n Plugin,\n} from '@perses-dev/plugin-system';\n\n/**\n * Helper for mocking `PluginRegistry` data during tests. Returns props that can be spread on the `PluginRegistry`\n * component so that it will load the mock plugins you setup. You can use the `addMockPlugin` function that's returned\n * to add mock plugins before rendering components that use them.\n */\nexport function mockPluginRegistryProps() {\n const mockPluginResource: PluginModuleResource = {\n kind: 'PluginModule',\n metadata: {\n name: 'Fake Plugin Module for Tests',\n created_at: '',\n updated_at: '',\n version: 0,\n },\n spec: {\n plugins: [],\n },\n };\n\n const mockPluginModule: Record<string, Plugin<UnknownSpec>> = {};\n\n // Allow adding mock plugins in tests\n const addMockPlugin = <T extends PluginType>(pluginType: T, kind: string, plugin: PluginImplementation<T>) => {\n mockPluginResource.spec.plugins.push({\n pluginType,\n kind,\n display: {\n name: `Fake ${pluginType} Plugin for ${kind}`,\n },\n });\n\n // \"Export\" on the module under the same name as the kind the plugin handles\n mockPluginModule[kind] = plugin;\n };\n\n const pluginRegistryProps: Omit<PluginRegistryProps, 'children'> = {\n getInstalledPlugins() {\n return Promise.resolve([mockPluginResource]);\n },\n importPluginModule(/* resource */) {\n return Promise.resolve(mockPluginModule);\n },\n };\n\n return {\n pluginRegistryProps,\n addMockPlugin,\n };\n}\n\nexport const FAKE_PANEL_PLUGIN: PanelPlugin = {\n PanelComponent: () => {\n return <div role=\"figure\">FakePanel chart</div>;\n },\n OptionsEditorComponent: () => {\n return <div>Edit options here</div>;\n },\n createInitialOptions: () => ({}),\n};\n"],"names":["mockPluginRegistryProps","mockPluginResource","kind","metadata","name","created_at","updated_at","version","spec","plugins","mockPluginModule","addMockPlugin","pluginType","plugin","push","display","pluginRegistryProps","getInstalledPlugins","Promise","resolve","importPluginModule","FAKE_PANEL_PLUGIN","PanelComponent","div","role","OptionsEditorComponent","createInitialOptions"],"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;AACjC;AAUA;;;;CAIC,GACD,OAAO,SAASA,uBAAuB,GAAG;IACxC,MAAMC,kBAAkB,GAAyB;QAC/CC,IAAI,EAAE,cAAc;QACpBC,QAAQ,EAAE;YACRC,IAAI,EAAE,8BAA8B;YACpCC,UAAU,EAAE,EAAE;YACdC,UAAU,EAAE,EAAE;YACdC,OAAO,EAAE,CAAC;SACX;QACDC,IAAI,EAAE;YACJC,OAAO,EAAE,EAAE;SACZ;KACF,AAAC;IAEF,MAAMC,gBAAgB,GAAwC,EAAE,AAAC;IAEjE,qCAAqC;IACrC,MAAMC,aAAa,GAAG,CAAuBC,UAAa,EAAEV,IAAY,EAAEW,MAA+B,GAAK;QAC5GZ,kBAAkB,CAACO,IAAI,CAACC,OAAO,CAACK,IAAI,CAAC;YACnCF,UAAU;YACVV,IAAI;YACJa,OAAO,EAAE;gBACPX,IAAI,EAAE,CAAC,KAAK,EAAEQ,UAAU,CAAC,YAAY,EAAEV,IAAI,CAAC,CAAC;aAC9C;SACF,CAAC,CAAC;QAEH,4EAA4E;QAC5EQ,gBAAgB,CAACR,IAAI,CAAC,GAAGW,MAAM,CAAC;IAClC,CAAC,AAAC;IAEF,MAAMG,mBAAmB,GAA0C;QACjEC,mBAAmB,IAAG;YACpB,OAAOC,OAAO,CAACC,OAAO,CAAC;gBAAClB,kBAAkB;aAAC,CAAC,CAAC;QAC/C,CAAC;QACDmB,kBAAkB,IAAiB;YACjC,OAAOF,OAAO,CAACC,OAAO,CAACT,gBAAgB,CAAC,CAAC;QAC3C,CAAC;KACF,AAAC;IAEF,OAAO;QACLM,mBAAmB;QACnBL,aAAa;KACd,CAAC;AACJ,CAAC;AAED,OAAO,MAAMU,iBAAiB,GAAgB;IAC5CC,cAAc,EAAE,IAAM;QACpB,qBAAO,KAACC,KAAG;YAACC,IAAI,EAAC,QAAQ;sBAAC,iBAAe;UAAM,CAAC;IAClD,CAAC;IACDC,sBAAsB,EAAE,IAAM;QAC5B,qBAAO,KAACF,KAAG;sBAAC,mBAAiB;UAAM,CAAC;IACtC,CAAC;IACDG,oBAAoB,EAAE,IAAO,CAAA,EAAE,CAAA,AAAC;CACjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testDashboard.d.ts","sourceRoot":"","sources":["../../src/test/testDashboard.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,QAAA,MAAM,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"testDashboard.d.ts","sourceRoot":"","sources":["../../src/test/testDashboard.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,QAAA,MAAM,aAAa,EAAE,iBAwPpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -201,7 +201,10 @@ const testDashboard = {
|
|
|
201
201
|
kind: 'Grid',
|
|
202
202
|
spec: {
|
|
203
203
|
display: {
|
|
204
|
-
title: 'CPU Stats'
|
|
204
|
+
title: 'CPU Stats',
|
|
205
|
+
collapse: {
|
|
206
|
+
open: true
|
|
207
|
+
}
|
|
205
208
|
},
|
|
206
209
|
items: [
|
|
207
210
|
// First Row
|
|
@@ -213,6 +216,15 @@ const testDashboard = {
|
|
|
213
216
|
content: {
|
|
214
217
|
$ref: '#/spec/panels/cpu'
|
|
215
218
|
}
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
x: 0,
|
|
222
|
+
y: 5,
|
|
223
|
+
width: 6,
|
|
224
|
+
height: 2,
|
|
225
|
+
content: {
|
|
226
|
+
$ref: '#/spec/panels/diskIO'
|
|
227
|
+
}
|
|
216
228
|
}
|
|
217
229
|
]
|
|
218
230
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/test/testDashboard.ts"],"sourcesContent":["// Copyright 2022 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 { DashboardResource } from '@perses-dev/core';\n\nconst testDashboard: DashboardResource = {\n kind: 'Dashboard',\n metadata: {\n name: 'Node Stats',\n project: 'perses',\n created_at: '2021-11-09',\n updated_at: '2021-11-09',\n version: 0,\n },\n spec: {\n duration: '24h',\n variables: [\n {\n kind: 'TextVariable',\n spec: {\n name: 'job',\n value: 'node',\n },\n },\n {\n kind: 'TextVariable',\n spec: {\n name: 'instance',\n value: 'demo.do.prometheus.io:9100',\n },\n },\n {\n kind: 'TextVariable',\n spec: {\n name: 'interval',\n value: '1m',\n },\n },\n ],\n panels: {\n cpu: {\n kind: 'Panel',\n spec: {\n display: { name: 'CPU' },\n plugin: {\n kind: 'TimeSeriesChart',\n spec: {\n queries: [\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query:\n 'avg without (cpu)(rate(node_cpu_seconds_total{job=\"node\",instance=\"$instance\",mode!=\"idle\"}[$interval]))',\n },\n },\n },\n },\n ],\n unit: { kind: '%' },\n },\n },\n },\n },\n memory: {\n kind: 'Panel',\n spec: {\n display: { name: 'Memory' },\n plugin: {\n kind: 'TimeSeriesChart',\n spec: {\n queries: [\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query:\n 'node_memory_MemTotal_bytes{job=\"node\",instance=\"$instance\"} - node_memory_MemFree_bytes{job=\"node\",instance=\"$instance\"} - node_memory_Buffers_bytes{job=\"node\",instance=\"$instance\"} - node_memory_Cached_bytes{job=\"node\",instance=\"$instance\"}',\n },\n },\n },\n },\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query: 'node_memory_Buffers_bytes{job=\"node\",instance=\"$instance\"}',\n },\n },\n },\n },\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query: 'node_memory_Cached_bytes{job=\"node\",instance=\"$instance\"}',\n },\n },\n },\n },\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query: 'node_memory_MemFree_bytes{job=\"node\",instance=\"$instance\"}',\n },\n },\n },\n },\n ],\n unit: { kind: 'Bytes' },\n },\n },\n },\n },\n diskIO: {\n kind: 'Panel',\n spec: {\n display: { name: 'Disk I/O Utilization' },\n plugin: {\n kind: 'TimeSeriesChart',\n spec: {\n queries: [\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query:\n 'rate(node_disk_io_time_seconds_total{job=\"node\",instance=\"$instance\",device!~\"^(md\\\\\\\\d+$|dm-)\"}[$interval])',\n },\n },\n },\n },\n ],\n unit: { kind: 'Percent' },\n },\n },\n },\n },\n filesystemFullness: {\n kind: 'Panel',\n spec: {\n display: { name: 'Filesystem Fullness' },\n plugin: {\n kind: 'TimeSeriesChart',\n spec: {\n queries: [\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query:\n '1 - node_filesystem_free_bytes{job=\"node\",instance=\"$instance\",fstype!=\"rootfs\",mountpoint!~\"/(run|var).*\",mountpoint!=\"\"} / node_filesystem_size_bytes{job=\"node\",instance=\"$instance\"}',\n },\n },\n },\n },\n ],\n unit: { kind: 'Percent' },\n },\n },\n },\n },\n },\n layouts: [\n // Regular Title, no collapse enabled\n {\n kind: 'Grid',\n spec: {\n display: {\n title: 'CPU Stats',\n },\n items: [\n // First Row\n {\n x: 0,\n y: 0,\n width: 12,\n height: 4,\n content: { $ref: '#/spec/panels/cpu' },\n },\n ],\n },\n },\n // No title,\n {\n kind: 'Grid',\n spec: {\n items: [\n {\n x: 8,\n y: 0,\n width: 8,\n height: 3,\n content: { $ref: '#/spec/panels/memory' },\n },\n ],\n },\n },\n // Collapsed\n {\n kind: 'Grid',\n spec: {\n display: {\n title: 'Disk Stats',\n collapse: {\n open: false,\n },\n },\n items: [\n {\n x: 0,\n y: 0,\n width: 6,\n height: 2,\n content: { $ref: '#/spec/panels/diskIO' },\n },\n {\n x: 18,\n y: 0,\n width: 6,\n height: 2,\n content: { $ref: '#/spec/panels/filesystemFullness' },\n },\n ],\n },\n },\n ],\n },\n};\n\nexport default testDashboard;\n"],"names":["testDashboard","kind","metadata","name","project","created_at","updated_at","version","spec","duration","variables","value","panels","cpu","display","plugin","queries","query","unit","memory","diskIO","filesystemFullness","layouts","title","items","x","y","width","height","content","$ref","collapse","open"],"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;AAIjC,MAAMA,aAAa,GAAsB;IACvCC,IAAI,EAAE,WAAW;IACjBC,QAAQ,EAAE;QACRC,IAAI,EAAE,YAAY;QAClBC,OAAO,EAAE,QAAQ;QACjBC,UAAU,EAAE,YAAY;QACxBC,UAAU,EAAE,YAAY;QACxBC,OAAO,EAAE,CAAC;KACX;IACDC,IAAI,EAAE;QACJC,QAAQ,EAAE,KAAK;QACfC,SAAS,EAAE;YACT;gBACET,IAAI,EAAE,cAAc;gBACpBO,IAAI,EAAE;oBACJL,IAAI,EAAE,KAAK;oBACXQ,KAAK,EAAE,MAAM;iBACd;aACF;YACD;gBACEV,IAAI,EAAE,cAAc;gBACpBO,IAAI,EAAE;oBACJL,IAAI,EAAE,UAAU;oBAChBQ,KAAK,EAAE,4BAA4B;iBACpC;aACF;YACD;gBACEV,IAAI,EAAE,cAAc;gBACpBO,IAAI,EAAE;oBACJL,IAAI,EAAE,UAAU;oBAChBQ,KAAK,EAAE,IAAI;iBACZ;aACF;SACF;QACDC,MAAM,EAAE;YACNC,GAAG,EAAE;gBACHZ,IAAI,EAAE,OAAO;gBACbO,IAAI,EAAE;oBACJM,OAAO,EAAE;wBAAEX,IAAI,EAAE,KAAK;qBAAE;oBACxBY,MAAM,EAAE;wBACNd,IAAI,EAAE,iBAAiB;wBACvBO,IAAI,EAAE;4BACJQ,OAAO,EAAE;gCACP;oCACEf,IAAI,EAAE,iBAAiB;oCACvBO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,EAAE,mBAAmB;6BAAE;yBACvC;qBACF;iBACF;aACF;YACD,YAAY;YACZ;gBACE7B,IAAI,EAAE,MAAM;gBACZO,IAAI,EAAE;oBACJgB,KAAK,EAAE;wBACL;4BACEC,CAAC,EAAE,CAAC;4BACJC,CAAC,EAAE,CAAC;4BACJC,KAAK,EAAE,CAAC;4BACRC,MAAM,EAAE,CAAC;4BACTC,OAAO,EAAE;gCAAEC,IAAI,EAAE,sBAAsB;6BAAE;yBAC1C;qBACF;iBACF;aACF;YACD,YAAY;YACZ;gBACE7B,IAAI,EAAE,MAAM;gBACZO,IAAI,EAAE;oBACJM,OAAO,EAAE;wBACPS,KAAK,EAAE,YAAY;wBACnBQ,QAAQ,EAAE;4BACRC,IAAI,EAAE,KAAK;yBACZ;qBACF;oBACDR,KAAK,EAAE;wBACL;4BACEC,CAAC,EAAE,CAAC;4BACJC,CAAC,EAAE,CAAC;4BACJC,KAAK,EAAE,CAAC;4BACRC,MAAM,EAAE,CAAC;4BACTC,OAAO,EAAE;gCAAEC,IAAI,EAAE,sBAAsB;6BAAE;yBAC1C;wBACD;4BACEL,CAAC,EAAE,EAAE;4BACLC,CAAC,EAAE,CAAC;4BACJC,KAAK,EAAE,CAAC;4BACRC,MAAM,EAAE,CAAC;4BACTC,OAAO,EAAE;gCAAEC,IAAI,EAAE,kCAAkC;6BAAE;yBACtD;qBACF;iBACF;aACF;SACF;KACF;CACF,AAAC;AAEF,eAAe9B,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../src/test/testDashboard.ts"],"sourcesContent":["// Copyright 2022 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 { DashboardResource } from '@perses-dev/core';\n\nconst testDashboard: DashboardResource = {\n kind: 'Dashboard',\n metadata: {\n name: 'Node Stats',\n project: 'perses',\n created_at: '2021-11-09',\n updated_at: '2021-11-09',\n version: 0,\n },\n spec: {\n duration: '24h',\n variables: [\n {\n kind: 'TextVariable',\n spec: {\n name: 'job',\n value: 'node',\n },\n },\n {\n kind: 'TextVariable',\n spec: {\n name: 'instance',\n value: 'demo.do.prometheus.io:9100',\n },\n },\n {\n kind: 'TextVariable',\n spec: {\n name: 'interval',\n value: '1m',\n },\n },\n ],\n panels: {\n cpu: {\n kind: 'Panel',\n spec: {\n display: { name: 'CPU' },\n plugin: {\n kind: 'TimeSeriesChart',\n spec: {\n queries: [\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query:\n 'avg without (cpu)(rate(node_cpu_seconds_total{job=\"node\",instance=\"$instance\",mode!=\"idle\"}[$interval]))',\n },\n },\n },\n },\n ],\n unit: { kind: '%' },\n },\n },\n },\n },\n memory: {\n kind: 'Panel',\n spec: {\n display: { name: 'Memory' },\n plugin: {\n kind: 'TimeSeriesChart',\n spec: {\n queries: [\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query:\n 'node_memory_MemTotal_bytes{job=\"node\",instance=\"$instance\"} - node_memory_MemFree_bytes{job=\"node\",instance=\"$instance\"} - node_memory_Buffers_bytes{job=\"node\",instance=\"$instance\"} - node_memory_Cached_bytes{job=\"node\",instance=\"$instance\"}',\n },\n },\n },\n },\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query: 'node_memory_Buffers_bytes{job=\"node\",instance=\"$instance\"}',\n },\n },\n },\n },\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query: 'node_memory_Cached_bytes{job=\"node\",instance=\"$instance\"}',\n },\n },\n },\n },\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query: 'node_memory_MemFree_bytes{job=\"node\",instance=\"$instance\"}',\n },\n },\n },\n },\n ],\n unit: { kind: 'Bytes' },\n },\n },\n },\n },\n diskIO: {\n kind: 'Panel',\n spec: {\n display: { name: 'Disk I/O Utilization' },\n plugin: {\n kind: 'TimeSeriesChart',\n spec: {\n queries: [\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query:\n 'rate(node_disk_io_time_seconds_total{job=\"node\",instance=\"$instance\",device!~\"^(md\\\\\\\\d+$|dm-)\"}[$interval])',\n },\n },\n },\n },\n ],\n unit: { kind: 'Percent' },\n },\n },\n },\n },\n filesystemFullness: {\n kind: 'Panel',\n spec: {\n display: { name: 'Filesystem Fullness' },\n plugin: {\n kind: 'TimeSeriesChart',\n spec: {\n queries: [\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query:\n '1 - node_filesystem_free_bytes{job=\"node\",instance=\"$instance\",fstype!=\"rootfs\",mountpoint!~\"/(run|var).*\",mountpoint!=\"\"} / node_filesystem_size_bytes{job=\"node\",instance=\"$instance\"}',\n },\n },\n },\n },\n ],\n unit: { kind: 'Percent' },\n },\n },\n },\n },\n },\n layouts: [\n // Regular Title, no collapse enabled\n {\n kind: 'Grid',\n spec: {\n display: {\n title: 'CPU Stats',\n collapse: {\n open: true,\n },\n },\n items: [\n // First Row\n {\n x: 0,\n y: 0,\n width: 12,\n height: 4,\n content: { $ref: '#/spec/panels/cpu' },\n },\n {\n x: 0,\n y: 5,\n width: 6,\n height: 2,\n content: { $ref: '#/spec/panels/diskIO' },\n },\n ],\n },\n },\n // No title,\n {\n kind: 'Grid',\n spec: {\n items: [\n {\n x: 8,\n y: 0,\n width: 8,\n height: 3,\n content: { $ref: '#/spec/panels/memory' },\n },\n ],\n },\n },\n // Collapsed\n {\n kind: 'Grid',\n spec: {\n display: {\n title: 'Disk Stats',\n collapse: {\n open: false,\n },\n },\n items: [\n {\n x: 0,\n y: 0,\n width: 6,\n height: 2,\n content: { $ref: '#/spec/panels/diskIO' },\n },\n {\n x: 18,\n y: 0,\n width: 6,\n height: 2,\n content: { $ref: '#/spec/panels/filesystemFullness' },\n },\n ],\n },\n },\n ],\n },\n};\n\nexport default testDashboard;\n"],"names":["testDashboard","kind","metadata","name","project","created_at","updated_at","version","spec","duration","variables","value","panels","cpu","display","plugin","queries","query","unit","memory","diskIO","filesystemFullness","layouts","title","collapse","open","items","x","y","width","height","content","$ref"],"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;AAIjC,MAAMA,aAAa,GAAsB;IACvCC,IAAI,EAAE,WAAW;IACjBC,QAAQ,EAAE;QACRC,IAAI,EAAE,YAAY;QAClBC,OAAO,EAAE,QAAQ;QACjBC,UAAU,EAAE,YAAY;QACxBC,UAAU,EAAE,YAAY;QACxBC,OAAO,EAAE,CAAC;KACX;IACDC,IAAI,EAAE;QACJC,QAAQ,EAAE,KAAK;QACfC,SAAS,EAAE;YACT;gBACET,IAAI,EAAE,cAAc;gBACpBO,IAAI,EAAE;oBACJL,IAAI,EAAE,KAAK;oBACXQ,KAAK,EAAE,MAAM;iBACd;aACF;YACD;gBACEV,IAAI,EAAE,cAAc;gBACpBO,IAAI,EAAE;oBACJL,IAAI,EAAE,UAAU;oBAChBQ,KAAK,EAAE,4BAA4B;iBACpC;aACF;YACD;gBACEV,IAAI,EAAE,cAAc;gBACpBO,IAAI,EAAE;oBACJL,IAAI,EAAE,UAAU;oBAChBQ,KAAK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AAC,EAAE,CAAC;4BACJC,KAAK,EAAE,CAAC;4BACRC,MAAM,EAAE,CAAC;4BACTC,OAAO,EAAE;gCAAEC,IAAI,EAAE,kCAAkC;6BAAE;yBACtD;qBACF;iBACF;aACF;SACF;KACF;CACF,AAAC;AAEF,eAAehC,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardApp.d.ts","sourceRoot":"","sources":["../../../src/views/ViewDashboard/DashboardApp.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"DashboardApp.d.ts","sourceRoot":"","sources":["../../../src/views/ViewDashboard/DashboardApp.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAOrD,MAAM,WAAW,iBAAiB;IAChC,iBAAiB,EAAE,iBAAiB,CAAC;CACtC;AAED,eAAO,MAAM,YAAY,UAAW,iBAAiB,gBAyBpD,CAAC"}
|
|
@@ -16,11 +16,10 @@ import { ErrorAlert, ErrorBoundary } from '@perses-dev/components';
|
|
|
16
16
|
import { PanelDrawer, Dashboard } from '../../components';
|
|
17
17
|
import PanelGroupDialog from '../../components/PanelGroupDialog/PanelGroupDialog';
|
|
18
18
|
import { DashboardToolbar } from '../../components/DashboardToolbar';
|
|
19
|
-
import
|
|
19
|
+
import DeletePanelGroupDialog from '../../components/PanelGroupDialog/DeletePanelGroupDialog';
|
|
20
|
+
import DeletePanelDialog from '../../components/Panel/DeletePanelDialog';
|
|
20
21
|
export const DashboardApp = (props)=>{
|
|
21
22
|
const { dashboardResource } = props;
|
|
22
|
-
const { dashboard } = useDashboard();
|
|
23
|
-
const { panelGroupDialog } = useDashboardApp();
|
|
24
23
|
return /*#__PURE__*/ _jsxs(Box, {
|
|
25
24
|
sx: {
|
|
26
25
|
padding: (theme)=>theme.spacing(1, 0),
|
|
@@ -41,12 +40,12 @@ export const DashboardApp = (props)=>{
|
|
|
41
40
|
children: [
|
|
42
41
|
/*#__PURE__*/ _jsx(ErrorBoundary, {
|
|
43
42
|
FallbackComponent: ErrorAlert,
|
|
44
|
-
children: /*#__PURE__*/ _jsx(Dashboard, {
|
|
45
|
-
spec: dashboard
|
|
46
|
-
})
|
|
43
|
+
children: /*#__PURE__*/ _jsx(Dashboard, {})
|
|
47
44
|
}),
|
|
48
45
|
/*#__PURE__*/ _jsx(PanelDrawer, {}),
|
|
49
|
-
|
|
46
|
+
/*#__PURE__*/ _jsx(PanelGroupDialog, {}),
|
|
47
|
+
/*#__PURE__*/ _jsx(DeletePanelGroupDialog, {}),
|
|
48
|
+
/*#__PURE__*/ _jsx(DeletePanelDialog, {})
|
|
50
49
|
]
|
|
51
50
|
})
|
|
52
51
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/views/ViewDashboard/DashboardApp.tsx"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box } from '@mui/material';\nimport { ErrorAlert, ErrorBoundary } from '@perses-dev/components';\nimport { DashboardResource } from '@perses-dev/core';\nimport { PanelDrawer, Dashboard } from '../../components';\nimport PanelGroupDialog from '../../components/PanelGroupDialog/PanelGroupDialog';\nimport { DashboardToolbar } from '../../components/DashboardToolbar';\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/views/ViewDashboard/DashboardApp.tsx"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box } from '@mui/material';\nimport { ErrorAlert, ErrorBoundary } from '@perses-dev/components';\nimport { DashboardResource } from '@perses-dev/core';\nimport { PanelDrawer, Dashboard } from '../../components';\nimport PanelGroupDialog from '../../components/PanelGroupDialog/PanelGroupDialog';\nimport { DashboardToolbar } from '../../components/DashboardToolbar';\nimport DeletePanelGroupDialog from '../../components/PanelGroupDialog/DeletePanelGroupDialog';\nimport DeletePanelDialog from '../../components/Panel/DeletePanelDialog';\n\nexport interface DashboardAppProps {\n dashboardResource: DashboardResource;\n}\n\nexport const DashboardApp = (props: DashboardAppProps) => {\n const { dashboardResource } = props;\n return (\n <Box\n sx={{\n padding: (theme) => theme.spacing(1, 0),\n flexGrow: 1,\n overflowX: 'hidden',\n overflowY: 'auto',\n display: 'flex',\n flexDirection: 'column',\n }}\n >\n <DashboardToolbar dashboardName={dashboardResource.metadata.name} />\n <Box sx={{ padding: (theme) => theme.spacing(2) }}>\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <Dashboard />\n </ErrorBoundary>\n <PanelDrawer />\n <PanelGroupDialog />\n <DeletePanelGroupDialog />\n <DeletePanelDialog />\n </Box>\n </Box>\n );\n};\n"],"names":["Box","ErrorAlert","ErrorBoundary","PanelDrawer","Dashboard","PanelGroupDialog","DashboardToolbar","DeletePanelGroupDialog","DeletePanelDialog","DashboardApp","props","dashboardResource","sx","padding","theme","spacing","flexGrow","overflowX","overflowY","display","flexDirection","dashboardName","metadata","name","FallbackComponent"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EA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ts","sourceRoot":"","sources":["../../../../src/views/ViewDashboard/tests/panelGroups.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
// Copyright 2022 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
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { screen } from '@testing-library/react';
|
|
15
|
+
import userEvent from '@testing-library/user-event';
|
|
16
|
+
import { DashboardProvider, QueryStringProvider, TemplateVariableProvider, TimeRangeProvider } from '../../../context';
|
|
17
|
+
import { createDashboardProviderSpy, getTestDashboard, renderWithContext } from '../../../test';
|
|
18
|
+
import testDashboard from '../../../test/testDashboard';
|
|
19
|
+
import { DashboardApp } from '../DashboardApp';
|
|
20
|
+
describe('Panel Groups', ()=>{
|
|
21
|
+
const renderDashboard = ()=>{
|
|
22
|
+
const { store , DashboardProviderSpy } = createDashboardProviderSpy();
|
|
23
|
+
renderWithContext(/*#__PURE__*/ _jsx(QueryStringProvider, {
|
|
24
|
+
queryString: new URLSearchParams('https://localhost:3000/'),
|
|
25
|
+
children: /*#__PURE__*/ _jsx(TimeRangeProvider, {
|
|
26
|
+
initialTimeRange: {
|
|
27
|
+
pastDuration: '30m'
|
|
28
|
+
},
|
|
29
|
+
children: /*#__PURE__*/ _jsx(TemplateVariableProvider, {
|
|
30
|
+
children: /*#__PURE__*/ _jsxs(DashboardProvider, {
|
|
31
|
+
initialState: {
|
|
32
|
+
dashboardSpec: getTestDashboard().spec,
|
|
33
|
+
isEditMode: true
|
|
34
|
+
},
|
|
35
|
+
children: [
|
|
36
|
+
/*#__PURE__*/ _jsx(DashboardProviderSpy, {}),
|
|
37
|
+
/*#__PURE__*/ _jsx(DashboardApp, {
|
|
38
|
+
dashboardResource: getTestDashboard()
|
|
39
|
+
})
|
|
40
|
+
]
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
}));
|
|
45
|
+
const { value: storeApi } = store;
|
|
46
|
+
if (storeApi === undefined) {
|
|
47
|
+
throw new Error('Expected dashboard store to be set after initial render');
|
|
48
|
+
}
|
|
49
|
+
return storeApi;
|
|
50
|
+
};
|
|
51
|
+
beforeEach(()=>{
|
|
52
|
+
const mockIntersectionObserver = jest.fn();
|
|
53
|
+
mockIntersectionObserver.mockReturnValue({
|
|
54
|
+
observe: ()=>null,
|
|
55
|
+
unobserve: ()=>null,
|
|
56
|
+
disconnect: ()=>null
|
|
57
|
+
});
|
|
58
|
+
window.IntersectionObserver = mockIntersectionObserver;
|
|
59
|
+
});
|
|
60
|
+
it('should delete panel', ()=>{
|
|
61
|
+
var ref;
|
|
62
|
+
const storeApi = renderDashboard();
|
|
63
|
+
const panel = screen.getByText('CPU');
|
|
64
|
+
userEvent.hover(panel);
|
|
65
|
+
const deletePanelButton = screen.getByLabelText('delete panel');
|
|
66
|
+
userEvent.click(deletePanelButton);
|
|
67
|
+
screen.getByText('Delete Panel');
|
|
68
|
+
const deleteButton = screen.getByText('Delete');
|
|
69
|
+
userEvent.click(deleteButton);
|
|
70
|
+
const layouts = storeApi.getState().layouts;
|
|
71
|
+
const deletedPanel = testDashboard.spec.panels['cpu'];
|
|
72
|
+
expect((ref = layouts[0]) === null || ref === void 0 ? void 0 : ref.items).toEqual(expect.not.objectContaining(deletedPanel));
|
|
73
|
+
const panels = storeApi.getState().panels;
|
|
74
|
+
// should remove cpu from state.panels since it's not used anymore
|
|
75
|
+
expect(panels).toEqual(expect.not.objectContaining({
|
|
76
|
+
cpu: testDashboard.spec.panels['cpu']
|
|
77
|
+
}));
|
|
78
|
+
});
|
|
79
|
+
it('should only delete panel from panel group if panel is referenced more than once', ()=>{
|
|
80
|
+
var ref;
|
|
81
|
+
const storeApi = renderDashboard();
|
|
82
|
+
const panel = screen.getByText('Disk I/O Utilization');
|
|
83
|
+
userEvent.hover(panel);
|
|
84
|
+
const deletePanelButton = screen.getByLabelText('delete panel');
|
|
85
|
+
userEvent.click(deletePanelButton);
|
|
86
|
+
screen.getByText('Delete Panel');
|
|
87
|
+
const deleteButton = screen.getByText('Delete');
|
|
88
|
+
userEvent.click(deleteButton);
|
|
89
|
+
const layouts = storeApi.getState().layouts;
|
|
90
|
+
const deletedPanel = testDashboard.spec.panels['diskIO'];
|
|
91
|
+
expect((ref = layouts[0]) === null || ref === void 0 ? void 0 : ref.items).toEqual(expect.not.objectContaining(deletedPanel));
|
|
92
|
+
const panels = storeApi.getState().panels;
|
|
93
|
+
// should NOT remove diskIO from state.panels since it's used in another panel group
|
|
94
|
+
expect(panels).toEqual(expect.objectContaining({
|
|
95
|
+
diskIO: testDashboard.spec.panels['diskIO']
|
|
96
|
+
}));
|
|
97
|
+
});
|
|
98
|
+
it('should swap panels', ()=>{
|
|
99
|
+
var ref, ref1, ref2;
|
|
100
|
+
const storeApi = renderDashboard();
|
|
101
|
+
// should move panel down
|
|
102
|
+
const group1 = screen.getByText('CPU Stats');
|
|
103
|
+
userEvent.hover(group1);
|
|
104
|
+
const moveGroupDownBtn = screen.getByLabelText('move group down');
|
|
105
|
+
userEvent.click(moveGroupDownBtn);
|
|
106
|
+
userEvent.unhover(moveGroupDownBtn);
|
|
107
|
+
// should move panel up
|
|
108
|
+
const group2 = screen.getByText('Disk Stats');
|
|
109
|
+
userEvent.hover(group2);
|
|
110
|
+
const moveGroupUpBtn = screen.getByLabelText('move group up');
|
|
111
|
+
userEvent.click(moveGroupUpBtn);
|
|
112
|
+
const layouts = storeApi.getState().layouts;
|
|
113
|
+
expect((ref = layouts[0]) === null || ref === void 0 ? void 0 : ref.title).toBe(undefined);
|
|
114
|
+
expect((ref1 = layouts[1]) === null || ref1 === void 0 ? void 0 : ref1.title).toBe('Disk Stats');
|
|
115
|
+
expect((ref2 = layouts[2]) === null || ref2 === void 0 ? void 0 : ref2.title).toBe('CPU Stats');
|
|
116
|
+
});
|
|
117
|
+
it('should delete a panel group', ()=>{
|
|
118
|
+
const storeApi = renderDashboard();
|
|
119
|
+
const group = screen.getByText('CPU Stats');
|
|
120
|
+
userEvent.hover(group);
|
|
121
|
+
const deleteGroupIcon = screen.getByLabelText('delete group');
|
|
122
|
+
userEvent.click(deleteGroupIcon);
|
|
123
|
+
screen.getByText('Delete Panel Group');
|
|
124
|
+
const deleteButton = screen.getByText('Delete');
|
|
125
|
+
userEvent.click(deleteButton);
|
|
126
|
+
// should remove group from state.layouts
|
|
127
|
+
const layouts = storeApi.getState().layouts;
|
|
128
|
+
expect(layouts).toHaveLength(2);
|
|
129
|
+
const deletedLayout = {
|
|
130
|
+
id: 0,
|
|
131
|
+
title: 'CPU Stats',
|
|
132
|
+
isCollapsed: false,
|
|
133
|
+
items: [
|
|
134
|
+
{
|
|
135
|
+
x: 0,
|
|
136
|
+
y: 0,
|
|
137
|
+
width: 12,
|
|
138
|
+
height: 4,
|
|
139
|
+
content: {
|
|
140
|
+
$ref: '#/spec/panels/cpu'
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
};
|
|
145
|
+
expect(layouts).toEqual(expect.not.objectContaining(deletedLayout));
|
|
146
|
+
const panels = storeApi.getState().panels;
|
|
147
|
+
// should remove cpu from state.panels since it's not used anymore
|
|
148
|
+
expect(panels).toEqual(expect.not.objectContaining({
|
|
149
|
+
cpu: testDashboard.spec.panels['cpu']
|
|
150
|
+
}));
|
|
151
|
+
// should not remove diskIO from state.panels since it's still used in another group
|
|
152
|
+
expect(panels).toEqual(expect.objectContaining({
|
|
153
|
+
diskIO: testDashboard.spec.panels['diskIO']
|
|
154
|
+
}));
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
//# sourceMappingURL=panelGroups.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/views/ViewDashboard/tests/panelGroups.test.tsx"],"sourcesContent":["// Copyright 2022 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 { screen } from '@testing-library/react';\nimport userEvent from '@testing-library/user-event';\nimport { DashboardProvider, QueryStringProvider, TemplateVariableProvider, TimeRangeProvider } from '../../../context';\nimport { PanelGroupDefinition } from '../../../context/DashboardProvider/layout-slice';\nimport { createDashboardProviderSpy, getTestDashboard, renderWithContext } from '../../../test';\nimport testDashboard from '../../../test/testDashboard';\nimport { DashboardApp } from '../DashboardApp';\n\ndescribe('Panel Groups', () => {\n const renderDashboard = () => {\n const { store, DashboardProviderSpy } = createDashboardProviderSpy();\n renderWithContext(\n <QueryStringProvider queryString={new URLSearchParams('https://localhost:3000/')}>\n <TimeRangeProvider initialTimeRange={{ pastDuration: '30m' }}>\n <TemplateVariableProvider>\n <DashboardProvider initialState={{ dashboardSpec: getTestDashboard().spec, isEditMode: true }}>\n <DashboardProviderSpy />\n <DashboardApp dashboardResource={getTestDashboard()} />\n </DashboardProvider>\n </TemplateVariableProvider>\n </TimeRangeProvider>\n </QueryStringProvider>\n );\n\n const { value: storeApi } = store;\n if (storeApi === undefined) {\n throw new Error('Expected dashboard store to be set after initial render');\n }\n\n return storeApi;\n };\n\n beforeEach(() => {\n const mockIntersectionObserver = jest.fn();\n mockIntersectionObserver.mockReturnValue({\n observe: () => null,\n unobserve: () => null,\n disconnect: () => null,\n });\n window.IntersectionObserver = mockIntersectionObserver;\n });\n\n it('should delete panel', () => {\n const storeApi = renderDashboard();\n const panel = screen.getByText('CPU');\n userEvent.hover(panel);\n const deletePanelButton = screen.getByLabelText('delete panel');\n userEvent.click(deletePanelButton);\n screen.getByText('Delete Panel');\n const deleteButton = screen.getByText('Delete');\n userEvent.click(deleteButton);\n\n const layouts = storeApi.getState().layouts;\n const deletedPanel = testDashboard.spec.panels['cpu'];\n expect(layouts[0]?.items).toEqual(expect.not.objectContaining(deletedPanel));\n\n const panels = storeApi.getState().panels;\n // should remove cpu from state.panels since it's not used anymore\n expect(panels).toEqual(expect.not.objectContaining({ cpu: testDashboard.spec.panels['cpu'] }));\n });\n\n it('should only delete panel from panel group if panel is referenced more than once', () => {\n const storeApi = renderDashboard();\n const panel = screen.getByText('Disk I/O Utilization');\n userEvent.hover(panel);\n const deletePanelButton = screen.getByLabelText('delete panel');\n userEvent.click(deletePanelButton);\n screen.getByText('Delete Panel');\n const deleteButton = screen.getByText('Delete');\n userEvent.click(deleteButton);\n const layouts = storeApi.getState().layouts;\n const deletedPanel = testDashboard.spec.panels['diskIO'];\n expect(layouts[0]?.items).toEqual(expect.not.objectContaining(deletedPanel));\n\n const panels = storeApi.getState().panels;\n // should NOT remove diskIO from state.panels since it's used in another panel group\n expect(panels).toEqual(expect.objectContaining({ diskIO: testDashboard.spec.panels['diskIO'] }));\n });\n\n it('should swap panels', () => {\n const storeApi = renderDashboard();\n // should move panel down\n const group1 = screen.getByText('CPU Stats');\n userEvent.hover(group1);\n const moveGroupDownBtn = screen.getByLabelText('move group down');\n userEvent.click(moveGroupDownBtn);\n userEvent.unhover(moveGroupDownBtn);\n // should move panel up\n const group2 = screen.getByText('Disk Stats');\n userEvent.hover(group2);\n const moveGroupUpBtn = screen.getByLabelText('move group up');\n userEvent.click(moveGroupUpBtn);\n\n const layouts = storeApi.getState().layouts;\n expect(layouts[0]?.title).toBe(undefined);\n expect(layouts[1]?.title).toBe('Disk Stats');\n expect(layouts[2]?.title).toBe('CPU Stats');\n });\n\n it('should delete a panel group', () => {\n const storeApi = renderDashboard();\n const group = screen.getByText('CPU Stats');\n userEvent.hover(group);\n const deleteGroupIcon = screen.getByLabelText('delete group');\n userEvent.click(deleteGroupIcon);\n screen.getByText('Delete Panel Group');\n const deleteButton = screen.getByText('Delete');\n userEvent.click(deleteButton);\n\n // should remove group from state.layouts\n const layouts = storeApi.getState().layouts;\n expect(layouts).toHaveLength(2);\n const deletedLayout: PanelGroupDefinition = {\n id: 0,\n title: 'CPU Stats',\n isCollapsed: false,\n items: [\n {\n x: 0,\n y: 0,\n width: 12,\n height: 4,\n content: { $ref: '#/spec/panels/cpu' },\n },\n ],\n };\n expect(layouts).toEqual(expect.not.objectContaining(deletedLayout));\n\n const panels = storeApi.getState().panels;\n // should remove cpu from state.panels since it's not used anymore\n expect(panels).toEqual(expect.not.objectContaining({ cpu: testDashboard.spec.panels['cpu'] }));\n // should not remove diskIO from state.panels since it's still used in another group\n expect(panels).toEqual(expect.objectContaining({ diskIO: testDashboard.spec.panels['diskIO'] }));\n });\n});\n"],"names":["screen","userEvent","DashboardProvider","QueryStringProvider","TemplateVariableProvider","TimeRangeProvider","createDashboardProviderSpy","getTestDashboard","renderWithContext","testDashboard","DashboardApp","describe","renderDashboard","store","DashboardProviderSpy","queryString","URLSearchParams","initialTimeRange","pastDuration","initialState","dashboardSpec","spec","isEditMode","dashboardResource","value","storeApi","undefined","Error","beforeEach","mockIntersectionObserver","jest","fn","mockReturnValue","observe","unobserve","disconnect","window","IntersectionObserver","it","layouts","panel","getByText","hover","deletePanelButton","getByLabelText","click","deleteButton","getState","deletedPanel","panels","expect","items","toEqual","not","objectContaining","cpu","diskIO","group1","moveGroupDownBtn","unhover","group2","moveGroupUpBtn","title","toBe","group","deleteGroupIcon","toHaveLength","deletedLayout","id","isCollapsed","x","y","width","height","content","$ref"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K,EAAE,WAAW;YAClBO,WAAW,EAAE,KAAK;YAClBlB,KAAK,EAAE;gBACL;oBACEmB,CAAC,EAAE,CAAC;oBACJC,CAAC,EAAE,CAAC;oBACJC,KAAK,EAAE,EAAE;oBACTC,MAAM,EAAE,CAAC;oBACTC,OAAO,EAAE;wBAAEC,IAAI,EAAE,mBAAmB;qBAAE;iBACvC;aACF;SACF,AAAC;QACFzB,MAAM,CAACX,OAAO,CAAC,CAACa,OAAO,CAACF,MAAM,CAACG,GAAG,CAACC,gBAAgB,CAACa,aAAa,CAAC,CAAC,CAAC;QAEpE,MAAMlB,MAAM,GAAGxB,QAAQ,CAACsB,QAAQ,EAAE,CAACE,MAAM,AAAC;QAC1C,kEAAkE;QAClEC,MAAM,CAACD,MAAM,CAAC,CAACG,OAAO,CAACF,MAAM,CAACG,GAAG,CAACC,gBAAgB,CAAC;YAAEC,GAAG,EAAE9C,aAAa,CAACY,IAAI,CAAC4B,MAAM,CAAC,KAAK,CAAC;SAAE,CAAC,CAAC,CAAC;QAC/F,oFAAoF;QACpFC,MAAM,CAACD,MAAM,CAAC,CAACG,OAAO,CAACF,MAAM,CAACI,gBAAgB,CAAC;YAAEE,MAAM,EAAE/C,aAAa,CAACY,IAAI,CAAC4B,MAAM,CAAC,QAAQ,CAAC;SAAE,CAAC,CAAC,CAAC;IACnG,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perses-dev/dashboards",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "The dashboards feature in Perses",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/perses/perses/blob/main/README.md",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"lint:fix": "eslint --fix src --ext .ts,.tsx"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@perses-dev/components": "^0.
|
|
31
|
-
"@perses-dev/core": "^0.
|
|
32
|
-
"@perses-dev/plugin-system": "^0.
|
|
30
|
+
"@perses-dev/components": "^0.10.0",
|
|
31
|
+
"@perses-dev/core": "^0.10.0",
|
|
32
|
+
"@perses-dev/plugin-system": "^0.10.0",
|
|
33
33
|
"@types/react-grid-layout": "^1.3.2",
|
|
34
34
|
"date-fns": "^2.28.0",
|
|
35
35
|
"immer": "^9.0.15",
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// Copyright 2022 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, "PanelSpecEditor", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: ()=>PanelSpecEditor
|
|
20
|
-
});
|
|
21
|
-
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
-
const _pluginSystem = require("@perses-dev/plugin-system");
|
|
23
|
-
function PanelSpecEditor(props) {
|
|
24
|
-
const { panelPluginKind , ...others } = props;
|
|
25
|
-
const { data: plugin , isLoading } = (0, _pluginSystem.usePlugin)('Panel', panelPluginKind, {
|
|
26
|
-
useErrorBoundary: true,
|
|
27
|
-
enabled: panelPluginKind !== ''
|
|
28
|
-
});
|
|
29
|
-
// TODO: Proper loading indicator
|
|
30
|
-
if (isLoading) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
if (plugin === undefined) {
|
|
34
|
-
throw new Error(`Missing OptionsEditorComponent for Panel plugin with kind '${panelPluginKind}'`);
|
|
35
|
-
}
|
|
36
|
-
const { OptionsEditorComponent } = plugin;
|
|
37
|
-
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(OptionsEditorComponent, {
|
|
38
|
-
...others
|
|
39
|
-
});
|
|
40
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// Copyright 2022 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, "PanelTypeSelect", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: ()=>PanelTypeSelect
|
|
20
|
-
});
|
|
21
|
-
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
-
const _material = require("@mui/material");
|
|
23
|
-
const _pluginSystem = require("@perses-dev/plugin-system");
|
|
24
|
-
function PanelTypeSelect(props) {
|
|
25
|
-
const { value: propValue , ...others } = props;
|
|
26
|
-
const { data , isLoading } = (0, _pluginSystem.useListPluginMetadata)('Panel');
|
|
27
|
-
// Pass an empty value while options are still loading so MUI doesn't complain about us using an "out of range" value
|
|
28
|
-
const value = propValue !== '' && isLoading ? '' : propValue;
|
|
29
|
-
// TODO: Does this need a loading indicator of some kind?
|
|
30
|
-
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Select, {
|
|
31
|
-
...others,
|
|
32
|
-
value: value,
|
|
33
|
-
children: data === null || data === void 0 ? void 0 : data.map((metadata)=>/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.MenuItem, {
|
|
34
|
-
value: metadata.kind,
|
|
35
|
-
children: metadata.display.name
|
|
36
|
-
}, metadata.kind))
|
|
37
|
-
});
|
|
38
|
-
}
|