@perses-dev/dashboards 0.23.1 → 0.24.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.
Files changed (46) hide show
  1. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +7 -3
  2. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +2 -1
  3. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
  4. package/dist/components/TimeRangeControls/TimeRangeControls.js +8 -4
  5. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
  6. package/package.json +6 -5
  7. package/dist/cjs/components/Panel/Panel.test.js +0 -137
  8. package/dist/cjs/components/PanelDrawer/PanelDrawer.test.js +0 -131
  9. package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.test.js +0 -87
  10. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.test.js +0 -95
  11. package/dist/cjs/components/Variables/variable-model.test.js +0 -106
  12. package/dist/cjs/context/TemplateVariableProvider/query-params.test.js +0 -82
  13. package/dist/cjs/utils/panelUtils.test.js +0 -195
  14. package/dist/cjs/views/ViewDashboard/tests/panelGroups.test.js +0 -110
  15. package/dist/components/Panel/Panel.test.d.ts +0 -2
  16. package/dist/components/Panel/Panel.test.d.ts.map +0 -1
  17. package/dist/components/Panel/Panel.test.js +0 -130
  18. package/dist/components/Panel/Panel.test.js.map +0 -1
  19. package/dist/components/PanelDrawer/PanelDrawer.test.d.ts +0 -2
  20. package/dist/components/PanelDrawer/PanelDrawer.test.d.ts.map +0 -1
  21. package/dist/components/PanelDrawer/PanelDrawer.test.js +0 -124
  22. package/dist/components/PanelDrawer/PanelDrawer.test.js.map +0 -1
  23. package/dist/components/PanelGroupDialog/PanelGroupDialog.test.d.ts +0 -2
  24. package/dist/components/PanelGroupDialog/PanelGroupDialog.test.d.ts.map +0 -1
  25. package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js +0 -80
  26. package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js.map +0 -1
  27. package/dist/components/TimeRangeControls/TimeRangeControls.test.d.ts +0 -2
  28. package/dist/components/TimeRangeControls/TimeRangeControls.test.d.ts.map +0 -1
  29. package/dist/components/TimeRangeControls/TimeRangeControls.test.js +0 -88
  30. package/dist/components/TimeRangeControls/TimeRangeControls.test.js.map +0 -1
  31. package/dist/components/Variables/variable-model.test.d.ts +0 -2
  32. package/dist/components/Variables/variable-model.test.d.ts.map +0 -1
  33. package/dist/components/Variables/variable-model.test.js +0 -104
  34. package/dist/components/Variables/variable-model.test.js.map +0 -1
  35. package/dist/context/TemplateVariableProvider/query-params.test.d.ts +0 -2
  36. package/dist/context/TemplateVariableProvider/query-params.test.d.ts.map +0 -1
  37. package/dist/context/TemplateVariableProvider/query-params.test.js +0 -80
  38. package/dist/context/TemplateVariableProvider/query-params.test.js.map +0 -1
  39. package/dist/utils/panelUtils.test.d.ts +0 -2
  40. package/dist/utils/panelUtils.test.d.ts.map +0 -1
  41. package/dist/utils/panelUtils.test.js +0 -193
  42. package/dist/utils/panelUtils.test.js.map +0 -1
  43. package/dist/views/ViewDashboard/tests/panelGroups.test.d.ts +0 -2
  44. package/dist/views/ViewDashboard/tests/panelGroups.test.d.ts.map +0 -1
  45. package/dist/views/ViewDashboard/tests/panelGroups.test.js +0 -103
  46. package/dist/views/ViewDashboard/tests/panelGroups.test.js.map +0 -1
@@ -1,193 +0,0 @@
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
- import { getValidPanelKey, insertPanelInLayout } from './panelUtils';
14
- describe('insertPanelInLayout', ()=>{
15
- describe('inserts the panel to the right when space is available', ()=>{
16
- test('with a single panel in that row', ()=>{
17
- const newLayout = {
18
- i: 'abc',
19
- w: 10,
20
- h: 8
21
- };
22
- const referenceLayout = {
23
- i: 'one',
24
- x: 0,
25
- y: 0,
26
- w: 6,
27
- h: 6
28
- };
29
- const layouts = [
30
- referenceLayout
31
- ];
32
- expect(insertPanelInLayout(newLayout, referenceLayout, layouts)).toEqual([
33
- referenceLayout,
34
- {
35
- x: 6,
36
- y: 0,
37
- ...newLayout
38
- }
39
- ]);
40
- });
41
- test('with multiple panels in that row with space between them', ()=>{
42
- const newLayout = {
43
- i: 'abc',
44
- w: 10,
45
- h: 8
46
- };
47
- const referenceLayout = {
48
- i: 'one',
49
- x: 0,
50
- y: 0,
51
- w: 3,
52
- h: 4
53
- };
54
- const otherPanelInRow = {
55
- i: 'two',
56
- x: 20,
57
- y: 0,
58
- w: 4,
59
- h: 4
60
- };
61
- const layouts = [
62
- referenceLayout,
63
- otherPanelInRow
64
- ];
65
- expect(insertPanelInLayout(newLayout, referenceLayout, layouts)).toEqual([
66
- referenceLayout,
67
- {
68
- x: 3,
69
- y: 0,
70
- ...newLayout
71
- },
72
- otherPanelInRow
73
- ]);
74
- });
75
- });
76
- describe('inserts the panel below when space is not available to the right', ()=>{
77
- test('with a single panel in the initial layout', ()=>{
78
- const newLayout = {
79
- i: 'abc',
80
- w: 10,
81
- h: 8
82
- };
83
- const referenceLayout = {
84
- i: 'one',
85
- x: 1,
86
- y: 0,
87
- w: 18,
88
- h: 4
89
- };
90
- const layouts = [
91
- referenceLayout
92
- ];
93
- expect(insertPanelInLayout(newLayout, referenceLayout, layouts)).toEqual([
94
- referenceLayout,
95
- {
96
- x: 1,
97
- y: 4,
98
- ...newLayout
99
- }
100
- ]);
101
- });
102
- test('with a single panel in the same row and additional panels below', ()=>{
103
- const newLayout = {
104
- i: 'abc',
105
- w: 10,
106
- h: 8
107
- };
108
- const referenceLayout = {
109
- i: 'one',
110
- x: 0,
111
- y: 0,
112
- w: 18,
113
- h: 4
114
- };
115
- const nextRowItem = {
116
- i: 'two',
117
- x: 0,
118
- y: 4,
119
- w: 6,
120
- h: 6
121
- };
122
- const layouts = [
123
- referenceLayout,
124
- nextRowItem
125
- ];
126
- expect(insertPanelInLayout(newLayout, referenceLayout, layouts)).toEqual([
127
- referenceLayout,
128
- {
129
- x: 0,
130
- y: 4,
131
- ...newLayout
132
- },
133
- {
134
- ...nextRowItem,
135
- y: nextRowItem.y + newLayout.h
136
- }
137
- ]);
138
- });
139
- });
140
- });
141
- describe('getValidPanelKey', ()=>{
142
- test('removes whitespace', ()=>{
143
- expect(getValidPanelKey('my panel name', {})).toBe('mypanelname');
144
- });
145
- test('does not include a counter if the key is not in use', ()=>{
146
- const mockPanelDefs = {
147
- alreadyInUse: {
148
- kind: 'Panel',
149
- spec: {}
150
- }
151
- };
152
- expect(getValidPanelKey('newPanelName', mockPanelDefs)).toBe('newPanelName');
153
- });
154
- test('includes a counter if the key is already in use', ()=>{
155
- const mockPanelDefs = {
156
- alreadyInUse: {
157
- kind: 'Panel',
158
- spec: {}
159
- }
160
- };
161
- expect(getValidPanelKey('alreadyInUse', mockPanelDefs)).toBe('alreadyInUse-1');
162
- });
163
- test('includes an incremented counter if the key is already in use multiple times', ()=>{
164
- const mockPanelDefs = {
165
- popularKey: {
166
- kind: 'Panel',
167
- spec: {}
168
- },
169
- 'popularKey-1': {
170
- kind: 'Panel',
171
- spec: {}
172
- }
173
- };
174
- expect(getValidPanelKey('popularKey', mockPanelDefs)).toBe('popularKey-2');
175
- expect(getValidPanelKey('popularKey-1', mockPanelDefs)).toBe('popularKey-2');
176
- });
177
- test('does not duplicate counters when they are out of order', ()=>{
178
- const mockPanelDefs = {
179
- outoforder: {
180
- kind: 'Panel',
181
- spec: {}
182
- },
183
- 'outoforder-2': {
184
- kind: 'Panel',
185
- spec: {}
186
- }
187
- };
188
- expect(getValidPanelKey('outoforder', mockPanelDefs)).toBe('outoforder-3');
189
- expect(getValidPanelKey('outoforder-2', mockPanelDefs)).toBe('outoforder-3');
190
- });
191
- });
192
-
193
- //# sourceMappingURL=panelUtils.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/panelUtils.test.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PanelDefinition } from '@perses-dev/core';\nimport { PanelGroupItemLayout } from '../context';\nimport { getValidPanelKey, insertPanelInLayout, UnpositionedPanelGroupItemLayout } from './panelUtils';\n\ndescribe('insertPanelInLayout', () => {\n describe('inserts the panel to the right when space is available', () => {\n test('with a single panel in that row', () => {\n const newLayout: UnpositionedPanelGroupItemLayout = { i: 'abc', w: 10, h: 8 };\n const referenceLayout: PanelGroupItemLayout = {\n i: 'one',\n x: 0,\n y: 0,\n w: 6,\n h: 6,\n };\n const layouts: PanelGroupItemLayout[] = [referenceLayout];\n expect(insertPanelInLayout(newLayout, referenceLayout, layouts)).toEqual([\n referenceLayout,\n {\n x: 6,\n y: 0,\n ...newLayout,\n },\n ]);\n });\n\n test('with multiple panels in that row with space between them', () => {\n const newLayout: UnpositionedPanelGroupItemLayout = { i: 'abc', w: 10, h: 8 };\n const referenceLayout: PanelGroupItemLayout = {\n i: 'one',\n x: 0,\n y: 0,\n w: 3,\n h: 4,\n };\n const otherPanelInRow: PanelGroupItemLayout = {\n i: 'two',\n x: 20,\n y: 0,\n w: 4,\n h: 4,\n };\n const layouts: PanelGroupItemLayout[] = [referenceLayout, otherPanelInRow];\n\n expect(insertPanelInLayout(newLayout, referenceLayout, layouts)).toEqual([\n referenceLayout,\n {\n x: 3,\n y: 0,\n ...newLayout,\n },\n otherPanelInRow,\n ]);\n });\n });\n\n describe('inserts the panel below when space is not available to the right', () => {\n test('with a single panel in the initial layout', () => {\n const newLayout: UnpositionedPanelGroupItemLayout = { i: 'abc', w: 10, h: 8 };\n const referenceLayout: PanelGroupItemLayout = {\n i: 'one',\n x: 1,\n y: 0,\n w: 18,\n h: 4,\n };\n const layouts: PanelGroupItemLayout[] = [referenceLayout];\n expect(insertPanelInLayout(newLayout, referenceLayout, layouts)).toEqual([\n referenceLayout,\n {\n x: 1,\n y: 4,\n ...newLayout,\n },\n ]);\n });\n\n test('with a single panel in the same row and additional panels below', () => {\n const newLayout: UnpositionedPanelGroupItemLayout = { i: 'abc', w: 10, h: 8 };\n const referenceLayout: PanelGroupItemLayout = {\n i: 'one',\n x: 0,\n y: 0,\n w: 18,\n h: 4,\n };\n const nextRowItem: PanelGroupItemLayout = {\n i: 'two',\n x: 0,\n y: 4,\n w: 6,\n h: 6,\n };\n const layouts: PanelGroupItemLayout[] = [referenceLayout, nextRowItem];\n\n expect(insertPanelInLayout(newLayout, referenceLayout, layouts)).toEqual([\n referenceLayout,\n {\n x: 0,\n y: 4,\n ...newLayout,\n },\n {\n ...nextRowItem,\n y: nextRowItem.y + newLayout.h,\n },\n ]);\n });\n });\n});\n\ndescribe('getValidPanelKey', () => {\n test('removes whitespace', () => {\n expect(getValidPanelKey('my panel name', {})).toBe('mypanelname');\n });\n\n test('does not include a counter if the key is not in use', () => {\n const mockPanelDefs = {\n alreadyInUse: {\n kind: 'Panel',\n spec: {},\n } as PanelDefinition,\n };\n expect(getValidPanelKey('newPanelName', mockPanelDefs)).toBe('newPanelName');\n });\n\n test('includes a counter if the key is already in use', () => {\n const mockPanelDefs = {\n alreadyInUse: {\n kind: 'Panel',\n spec: {},\n } as PanelDefinition,\n };\n expect(getValidPanelKey('alreadyInUse', mockPanelDefs)).toBe('alreadyInUse-1');\n });\n\n test('includes an incremented counter if the key is already in use multiple times', () => {\n const mockPanelDefs = {\n popularKey: {\n kind: 'Panel',\n spec: {},\n } as PanelDefinition,\n 'popularKey-1': {\n kind: 'Panel',\n spec: {},\n } as PanelDefinition,\n };\n expect(getValidPanelKey('popularKey', mockPanelDefs)).toBe('popularKey-2');\n expect(getValidPanelKey('popularKey-1', mockPanelDefs)).toBe('popularKey-2');\n });\n\n test('does not duplicate counters when they are out of order', () => {\n const mockPanelDefs = {\n outoforder: {\n kind: 'Panel',\n spec: {},\n } as PanelDefinition,\n 'outoforder-2': {\n kind: 'Panel',\n spec: {},\n } as PanelDefinition,\n };\n expect(getValidPanelKey('outoforder', mockPanelDefs)).toBe('outoforder-3');\n expect(getValidPanelKey('outoforder-2', mockPanelDefs)).toBe('outoforder-3');\n });\n});\n"],"names":["getValidPanelKey","insertPanelInLayout","describe","test","newLayout","i","w","h","referenceLayout","x","y","layouts","expect","toEqual","otherPanelInRow","nextRowItem","toBe","mockPanelDefs","alreadyInUse","kind","spec","popularKey","outoforder"],"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,SAASA,gBAAgB,EAAEC,mBAAmB,QAA0C,cAAc,CAAC;AAEvGC,QAAQ,CAAC,qBAAqB,EAAE,IAAM;IACpCA,QAAQ,CAAC,wDAAwD,EAAE,IAAM;QACvEC,IAAI,CAAC,iCAAiC,EAAE,IAAM;YAC5C,MAAMC,SAAS,GAAqC;gBAAEC,CAAC,EAAE,KAAK;gBAAEC,CAAC,EAAE,EAAE;gBAAEC,CAAC,EAAE,CAAC;aAAE,AAAC;YAC9E,MAAMC,eAAe,GAAyB;gBAC5CH,CAAC,EAAE,KAAK;gBACRI,CAAC,EAAE,CAAC;gBACJC,CAAC,EAAE,CAAC;gBACJJ,CAAC,EAAE,CAAC;gBACJC,CAAC,EAAE,CAAC;aAC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AAC;QACFR,MAAM,CAACZ,gBAAgB,CAAC,YAAY,EAAEiB,aAAa,CAAC,CAAC,CAACD,IAAI,CAAC,cAAc,CAAC,CAAC;QAC3EJ,MAAM,CAACZ,gBAAgB,CAAC,cAAc,EAAEiB,aAAa,CAAC,CAAC,CAACD,IAAI,CAAC,cAAc,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;IAEHb,IAAI,CAAC,wDAAwD,EAAE,IAAM;QACnE,MAAMc,aAAa,GAAG;YACpBK,UAAU,EAAE;gBACVH,IAAI,EAAE,OAAO;gBACbC,IAAI,EAAE,EAAE;aACT;YACD,cAAc,EAAE;gBACdD,IAAI,EAAE,OAAO;gBACbC,IAAI,EAAE,EAAE;aACT;SACF,AAAC;QACFR,MAAM,CAACZ,gBAAgB,CAAC,YAAY,EAAEiB,aAAa,CAAC,CAAC,CAACD,IAAI,CAAC,cAAc,CAAC,CAAC;QAC3EJ,MAAM,CAACZ,gBAAgB,CAAC,cAAc,EAAEiB,aAAa,CAAC,CAAC,CAACD,IAAI,CAAC,cAAc,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=panelGroups.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"panelGroups.test.d.ts","sourceRoot":"","sources":["../../../../src/views/ViewDashboard/tests/panelGroups.test.tsx"],"names":[],"mappings":""}
@@ -1,103 +0,0 @@
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
- import { jsx as _jsx } from "react/jsx-runtime";
14
- import { screen } from '@testing-library/react';
15
- import userEvent from '@testing-library/user-event';
16
- import { TimeRangeProvider } from '@perses-dev/plugin-system';
17
- import { DashboardProvider, TemplateVariableProvider } from '../../../context';
18
- import { getTestDashboard, renderWithContext } from '../../../test';
19
- import { DashboardApp } from '../DashboardApp';
20
- describe('Panel Groups', ()=>{
21
- const renderDashboard = ()=>{
22
- renderWithContext(/*#__PURE__*/ _jsx(TimeRangeProvider, {
23
- initialTimeRange: {
24
- pastDuration: '30m'
25
- },
26
- children: /*#__PURE__*/ _jsx(TemplateVariableProvider, {
27
- children: /*#__PURE__*/ _jsx(DashboardProvider, {
28
- initialState: {
29
- dashboardResource: getTestDashboard(),
30
- isEditMode: true
31
- },
32
- children: /*#__PURE__*/ _jsx(DashboardApp, {
33
- dashboardResource: getTestDashboard(),
34
- isReadonly: false
35
- })
36
- })
37
- })
38
- }));
39
- };
40
- it('should delete panel', ()=>{
41
- renderDashboard();
42
- const panelTitle = 'CPU';
43
- const deletePanelButton = screen.getByLabelText(`delete panel ${panelTitle}`);
44
- userEvent.click(deletePanelButton);
45
- screen.getByText('Delete Panel');
46
- const deleteButton = screen.getByText('Delete');
47
- userEvent.click(deleteButton);
48
- // The panel should disappear
49
- const deletedPanel = screen.queryByText(panelTitle);
50
- expect(deletedPanel).not.toBeInTheDocument();
51
- });
52
- it('should only delete panel from panel group if panel is not referenced more than once', ()=>{
53
- renderDashboard();
54
- const panelTitle = 'Disk I/O Utilization';
55
- const panels = screen.getAllByText(panelTitle);
56
- expect(panels).toHaveLength(2);
57
- const deletePanelButton = screen.getAllByLabelText(`delete panel ${panelTitle}`)[0];
58
- if (deletePanelButton === undefined) throw new Error('Missing delete button');
59
- userEvent.click(deletePanelButton);
60
- screen.getByText('Delete Panel');
61
- const deleteButton = screen.getByText('Delete');
62
- userEvent.click(deleteButton);
63
- // The deleted panel should still be on screen in the other group
64
- const deletedPanel = screen.queryByText(panelTitle);
65
- expect(deletedPanel).toBeInTheDocument();
66
- });
67
- it('should swap panels', ()=>{
68
- renderDashboard();
69
- // should move panel down
70
- const groupTitle1 = 'CPU Stats';
71
- const moveGroupDownBtn = screen.getByLabelText(`move group ${groupTitle1} down`);
72
- userEvent.click(moveGroupDownBtn);
73
- // should move panel up
74
- const groupTitle2 = 'Disk Stats';
75
- const moveGroupUpBtn = screen.getByLabelText(`move group ${groupTitle2} up`);
76
- userEvent.click(moveGroupUpBtn);
77
- /* TODO: Figure out how to test this visually without coupling to the store
78
- const layouts = storeApi.getState().layouts;
79
- expect(layouts[0]?.title).toBe(undefined);
80
- expect(layouts[1]?.title).toBe('Disk Stats');
81
- expect(layouts[2]?.title).toBe('CPU Stats');
82
- */ });
83
- it('should delete a panel group', ()=>{
84
- renderDashboard();
85
- const groupTitle = 'CPU Stats';
86
- const deleteGroupIcon = screen.getByLabelText(`delete group ${groupTitle}`);
87
- userEvent.click(deleteGroupIcon);
88
- screen.getByText('Delete Panel Group');
89
- const deleteButton = screen.getByText('Delete');
90
- userEvent.click(deleteButton);
91
- // should remove group
92
- const deletedGroup = screen.queryByText(groupTitle);
93
- expect(deletedGroup).not.toBeInTheDocument();
94
- // CPU panel should be completely gone since it wasn't in any other group
95
- let panel = screen.queryByText('CPU');
96
- expect(panel).not.toBeInTheDocument();
97
- // A DiskIO panel should still be present in the other group that wasn't deleted
98
- panel = screen.queryByText('Disk I/O Utilization');
99
- expect(panel).toBeInTheDocument();
100
- });
101
- });
102
-
103
- //# sourceMappingURL=panelGroups.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/views/ViewDashboard/tests/panelGroups.test.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { screen } from '@testing-library/react';\nimport userEvent from '@testing-library/user-event';\nimport { TimeRangeProvider } from '@perses-dev/plugin-system';\nimport { DashboardProvider, TemplateVariableProvider } from '../../../context';\nimport { getTestDashboard, renderWithContext } from '../../../test';\nimport { DashboardApp } from '../DashboardApp';\n\ndescribe('Panel Groups', () => {\n const renderDashboard = () => {\n renderWithContext(\n <TimeRangeProvider initialTimeRange={{ pastDuration: '30m' }}>\n <TemplateVariableProvider>\n <DashboardProvider initialState={{ dashboardResource: getTestDashboard(), isEditMode: true }}>\n <DashboardApp dashboardResource={getTestDashboard()} isReadonly={false} />\n </DashboardProvider>\n </TemplateVariableProvider>\n </TimeRangeProvider>\n );\n };\n it('should delete panel', () => {\n renderDashboard();\n const panelTitle = 'CPU';\n const deletePanelButton = screen.getByLabelText(`delete panel ${panelTitle}`);\n userEvent.click(deletePanelButton);\n screen.getByText('Delete Panel');\n const deleteButton = screen.getByText('Delete');\n userEvent.click(deleteButton);\n\n // The panel should disappear\n const deletedPanel = screen.queryByText(panelTitle);\n expect(deletedPanel).not.toBeInTheDocument();\n });\n\n it('should only delete panel from panel group if panel is not referenced more than once', () => {\n renderDashboard();\n\n const panelTitle = 'Disk I/O Utilization';\n const panels = screen.getAllByText(panelTitle);\n expect(panels).toHaveLength(2);\n\n const deletePanelButton = screen.getAllByLabelText(`delete panel ${panelTitle}`)[0];\n if (deletePanelButton === undefined) throw new Error('Missing delete button');\n\n userEvent.click(deletePanelButton);\n screen.getByText('Delete Panel');\n const deleteButton = screen.getByText('Delete');\n userEvent.click(deleteButton);\n\n // The deleted panel should still be on screen in the other group\n const deletedPanel = screen.queryByText(panelTitle);\n expect(deletedPanel).toBeInTheDocument();\n });\n\n it('should swap panels', () => {\n renderDashboard();\n\n // should move panel down\n const groupTitle1 = 'CPU Stats';\n const moveGroupDownBtn = screen.getByLabelText(`move group ${groupTitle1} down`);\n userEvent.click(moveGroupDownBtn);\n\n // should move panel up\n const groupTitle2 = 'Disk Stats';\n const moveGroupUpBtn = screen.getByLabelText(`move group ${groupTitle2} up`);\n userEvent.click(moveGroupUpBtn);\n\n /* TODO: Figure out how to test this visually without coupling to the store\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\n it('should delete a panel group', () => {\n renderDashboard();\n const groupTitle = 'CPU Stats';\n const deleteGroupIcon = screen.getByLabelText(`delete group ${groupTitle}`);\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\n const deletedGroup = screen.queryByText(groupTitle);\n expect(deletedGroup).not.toBeInTheDocument();\n\n // CPU panel should be completely gone since it wasn't in any other group\n let panel = screen.queryByText('CPU');\n expect(panel).not.toBeInTheDocument();\n\n // A DiskIO panel should still be present in the other group that wasn't deleted\n panel = screen.queryByText('Disk I/O Utilization');\n expect(panel).toBeInTheDocument();\n });\n});\n"],"names":["screen","userEvent","TimeRangeProvider","DashboardProvider","TemplateVariableProvider","getTestDashboard","renderWithContext","DashboardApp","describe","renderDashboard","initialTimeRange","pastDuration","initialState","dashboardResource","isEditMode","isReadonly","it","panelTitle","deletePanelButton","getByLabelText","click","getByText","deleteButton","deletedPanel","queryByText","expect","not","toBeInTheDocument","panels","getAllByText","toHaveLength","getAllByLabelText","undefined","Error","groupTitle1","moveGroupDownBtn","groupTitle2","moveGroupUpBtn","groupTitle","deleteGroupIcon","deletedGroup","panel"],"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;AAAA,SAASA,MAAM,QAA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