@perses-dev/dashboards 0.27.0 → 0.29.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 (82) hide show
  1. package/dist/cjs/components/GridLayout/GridItemContent.js +22 -4
  2. package/dist/cjs/components/GridLayout/GridLayout.js +31 -2
  3. package/dist/cjs/components/Panel/Panel.js +2 -2
  4. package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +41 -34
  5. package/dist/cjs/components/PanelDrawer/PanelPreview.js +32 -18
  6. package/dist/cjs/components/PanelDrawer/usePanelEditor.js +87 -0
  7. package/dist/cjs/context/DashboardProvider/DashboardProvider.js +4 -4
  8. package/dist/cjs/context/DashboardProvider/common.js +26 -6
  9. package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +8 -32
  10. package/dist/cjs/stories/decorators/WithDataQueriesProvider.js +39 -0
  11. package/dist/cjs/stories/decorators/WithDatasourceStore.js +2 -47
  12. package/dist/cjs/stories/decorators/WithPluginRegistry.js +3 -0
  13. package/dist/cjs/stories/decorators/index.js +1 -0
  14. package/dist/cjs/test/datasource-provider.js +70 -0
  15. package/dist/cjs/test/index.js +1 -0
  16. package/dist/cjs/test/plugin-registry.js +11 -5
  17. package/dist/cjs/test/testDashboard.js +79 -79
  18. package/dist/cjs/utils/index.js +1 -0
  19. package/dist/cjs/utils/time.js +27 -0
  20. package/dist/components/GridLayout/GridItemContent.d.ts +1 -0
  21. package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
  22. package/dist/components/GridLayout/GridItemContent.js +22 -4
  23. package/dist/components/GridLayout/GridItemContent.js.map +1 -1
  24. package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
  25. package/dist/components/GridLayout/GridLayout.js +31 -2
  26. package/dist/components/GridLayout/GridLayout.js.map +1 -1
  27. package/dist/components/Panel/Panel.d.ts +1 -1
  28. package/dist/components/Panel/Panel.d.ts.map +1 -1
  29. package/dist/components/Panel/Panel.js +3 -3
  30. package/dist/components/Panel/Panel.js.map +1 -1
  31. package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
  32. package/dist/components/PanelDrawer/PanelEditorForm.js +42 -35
  33. package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
  34. package/dist/components/PanelDrawer/PanelPreview.d.ts +1 -1
  35. package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -1
  36. package/dist/components/PanelDrawer/PanelPreview.js +32 -18
  37. package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
  38. package/dist/components/PanelDrawer/usePanelEditor.d.ts +15 -0
  39. package/dist/components/PanelDrawer/usePanelEditor.d.ts.map +1 -0
  40. package/dist/components/PanelDrawer/usePanelEditor.js +84 -0
  41. package/dist/components/PanelDrawer/usePanelEditor.js.map +1 -0
  42. package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
  43. package/dist/context/DashboardProvider/DashboardProvider.js +4 -4
  44. package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
  45. package/dist/context/DashboardProvider/common.d.ts +2 -0
  46. package/dist/context/DashboardProvider/common.d.ts.map +1 -1
  47. package/dist/context/DashboardProvider/common.js +17 -2
  48. package/dist/context/DashboardProvider/common.js.map +1 -1
  49. package/dist/context/DashboardProvider/panel-editor-slice.d.ts +3 -6
  50. package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -1
  51. package/dist/context/DashboardProvider/panel-editor-slice.js +9 -33
  52. package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
  53. package/dist/stories/decorators/WithDataQueriesProvider.js +33 -0
  54. package/dist/stories/decorators/WithDataQueriesProvider.js.map +1 -0
  55. package/dist/stories/decorators/WithDatasourceStore.js +1 -46
  56. package/dist/stories/decorators/WithDatasourceStore.js.map +1 -1
  57. package/dist/stories/decorators/WithPluginRegistry.js +3 -0
  58. package/dist/stories/decorators/WithPluginRegistry.js.map +1 -1
  59. package/dist/stories/decorators/index.js +1 -0
  60. package/dist/stories/decorators/index.js.map +1 -1
  61. package/dist/test/datasource-provider.d.ts +6 -0
  62. package/dist/test/datasource-provider.d.ts.map +1 -0
  63. package/dist/test/datasource-provider.js +60 -0
  64. package/dist/test/datasource-provider.js.map +1 -0
  65. package/dist/test/index.d.ts +1 -0
  66. package/dist/test/index.d.ts.map +1 -1
  67. package/dist/test/index.js +1 -0
  68. package/dist/test/index.js.map +1 -1
  69. package/dist/test/plugin-registry.d.ts.map +1 -1
  70. package/dist/test/plugin-registry.js +11 -5
  71. package/dist/test/plugin-registry.js.map +1 -1
  72. package/dist/test/testDashboard.js +79 -79
  73. package/dist/test/testDashboard.js.map +1 -1
  74. package/dist/utils/index.d.ts +1 -0
  75. package/dist/utils/index.d.ts.map +1 -1
  76. package/dist/utils/index.js +1 -0
  77. package/dist/utils/index.js.map +1 -1
  78. package/dist/utils/time.d.ts +5 -0
  79. package/dist/utils/time.d.ts.map +1 -0
  80. package/dist/utils/time.js +23 -0
  81. package/dist/utils/time.js.map +1 -0
  82. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test/index.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\nexport * from './dashboard-provider';\nexport * from './plugin-registry';\nexport * from './render';\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,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC"}
1
+ {"version":3,"sources":["../../src/test/index.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\nexport * from './dashboard-provider';\nexport * from './datasource-provider';\nexport * from './plugin-registry';\nexport * from './render';\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,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-registry.d.ts","sourceRoot":"","sources":["../../src/test/plugin-registry.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAe,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAmBpE,eAAO,MAAM,YAAY,EAAE,UAAU,EAA6B,CAAC"}
1
+ {"version":3,"file":"plugin-registry.d.ts","sourceRoot":"","sources":["../../src/test/plugin-registry.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAe,UAAU,EAAE,MAAM,2BAA2B,CAAC;AA0BpE,eAAO,MAAM,YAAY,EAAE,UAAU,EAA6B,CAAC"}
@@ -11,17 +11,23 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
+ const FakeTimeSeriesChartOptionEditor = ()=>{
15
+ return /*#__PURE__*/ _jsx("div", {
16
+ children: "TimeSeriesChart options"
17
+ });
18
+ };
14
19
  const FakeTimeSeriesPlugin = {
15
20
  PanelComponent: ()=>{
16
21
  return /*#__PURE__*/ _jsx("div", {
17
22
  children: "TimeSeriesChart panel"
18
23
  });
19
24
  },
20
- OptionsEditorComponent: ()=>{
21
- return /*#__PURE__*/ _jsx("div", {
22
- children: "TimeSeriesChart options"
23
- });
24
- },
25
+ panelOptionsEditorComponents: [
26
+ {
27
+ label: 'Settings',
28
+ content: FakeTimeSeriesChartOptionEditor
29
+ }
30
+ ],
25
31
  createInitialOptions: ()=>({})
26
32
  };
27
33
  const MOCK_TIME_SERIES_PANEL = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test/plugin-registry.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 { UnknownSpec } from '@perses-dev/core';\nimport { PanelPlugin, MockPlugin } from '@perses-dev/plugin-system';\n\nconst FakeTimeSeriesPlugin: PanelPlugin<UnknownSpec> = {\n PanelComponent: () => {\n return <div>TimeSeriesChart panel</div>;\n },\n OptionsEditorComponent: () => {\n return <div>TimeSeriesChart options</div>;\n },\n createInitialOptions: () => ({}),\n};\n\nconst MOCK_TIME_SERIES_PANEL: MockPlugin = {\n pluginType: 'Panel',\n kind: 'TimeSeriesChart',\n plugin: FakeTimeSeriesPlugin,\n};\n\n// Array of default mock plugins added to the PluginRegistry during test renders\nexport const MOCK_PLUGINS: MockPlugin[] = [MOCK_TIME_SERIES_PANEL];\n"],"names":["FakeTimeSeriesPlugin","PanelComponent","div","OptionsEditorComponent","createInitialOptions","MOCK_TIME_SERIES_PANEL","pluginType","kind","plugin","MOCK_PLUGINS"],"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;AAGA,MAAMA,oBAAoB,GAA6B;IACrDC,cAAc,EAAE,IAAM;QACpB,qBAAO,KAACC,KAAG;sBAAC,uBAAqB;UAAM,CAAC;IAC1C,CAAC;IACDC,sBAAsB,EAAE,IAAM;QAC5B,qBAAO,KAACD,KAAG;sBAAC,yBAAuB;UAAM,CAAC;IAC5C,CAAC;IACDE,oBAAoB,EAAE,IAAO,CAAA,EAAE,CAAA,AAAC;CACjC,AAAC;AAEF,MAAMC,sBAAsB,GAAe;IACzCC,UAAU,EAAE,OAAO;IACnBC,IAAI,EAAE,iBAAiB;IACvBC,MAAM,EAAER,oBAAoB;CAC7B,AAAC;AAEF,gFAAgF;AAChF,OAAO,MAAMS,YAAY,GAAiB;IAACJ,sBAAsB;CAAC,CAAC"}
1
+ {"version":3,"sources":["../../src/test/plugin-registry.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 { UnknownSpec } from '@perses-dev/core';\nimport { PanelPlugin, MockPlugin } from '@perses-dev/plugin-system';\n\nconst FakeTimeSeriesChartOptionEditor = () => {\n return <div>TimeSeriesChart options</div>;\n};\n\nconst FakeTimeSeriesPlugin: PanelPlugin<UnknownSpec> = {\n PanelComponent: () => {\n return <div>TimeSeriesChart panel</div>;\n },\n panelOptionsEditorComponents: [\n {\n label: 'Settings',\n content: FakeTimeSeriesChartOptionEditor,\n },\n ],\n createInitialOptions: () => ({}),\n};\n\nconst MOCK_TIME_SERIES_PANEL: MockPlugin = {\n pluginType: 'Panel',\n kind: 'TimeSeriesChart',\n plugin: FakeTimeSeriesPlugin,\n};\n\n// Array of default mock plugins added to the PluginRegistry during test renders\nexport const MOCK_PLUGINS: MockPlugin[] = [MOCK_TIME_SERIES_PANEL];\n"],"names":["FakeTimeSeriesChartOptionEditor","div","FakeTimeSeriesPlugin","PanelComponent","panelOptionsEditorComponents","label","content","createInitialOptions","MOCK_TIME_SERIES_PANEL","pluginType","kind","plugin","MOCK_PLUGINS"],"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;AAGA,MAAMA,+BAA+B,GAAG,IAAM;IAC5C,qBAAO,KAACC,KAAG;kBAAC,yBAAuB;MAAM,CAAC;AAC5C,CAAC,AAAC;AAEF,MAAMC,oBAAoB,GAA6B;IACrDC,cAAc,EAAE,IAAM;QACpB,qBAAO,KAACF,KAAG;sBAAC,uBAAqB;UAAM,CAAC;IAC1C,CAAC;IACDG,4BAA4B,EAAE;QAC5B;YACEC,KAAK,EAAE,UAAU;YACjBC,OAAO,EAAEN,+BAA+B;SACzC;KACF;IACDO,oBAAoB,EAAE,IAAO,CAAA,EAAE,CAAA,AAAC;CACjC,AAAC;AAEF,MAAMC,sBAAsB,GAAe;IACzCC,UAAU,EAAE,OAAO;IACnBC,IAAI,EAAE,iBAAiB;IACvBC,MAAM,EAAET,oBAAoB;CAC7B,AAAC;AAEF,gFAAgF;AAChF,OAAO,MAAMU,YAAY,GAAiB;IAACJ,sBAAsB;CAAC,CAAC"}
@@ -54,24 +54,24 @@ const testDashboard = {
54
54
  plugin: {
55
55
  kind: 'TimeSeriesChart',
56
56
  spec: {
57
- queries: [
58
- {
59
- kind: 'TimeSeriesQuery',
57
+ unit: {
58
+ kind: '%'
59
+ }
60
+ }
61
+ },
62
+ queries: [
63
+ {
64
+ kind: 'TimeSeriesQuery',
65
+ spec: {
66
+ plugin: {
67
+ kind: 'PrometheusTimeSeriesQuery',
60
68
  spec: {
61
- plugin: {
62
- kind: 'PrometheusTimeSeriesQuery',
63
- spec: {
64
- query: 'avg without (cpu)(rate(node_cpu_seconds_total{job="node",instance="$instance",mode!="idle"}[$interval]))'
65
- }
66
- }
69
+ query: 'avg without (cpu)(rate(node_cpu_seconds_total{job="node",instance="$instance",mode!="idle"}[$interval]))'
67
70
  }
68
71
  }
69
- ],
70
- unit: {
71
- kind: '%'
72
72
  }
73
73
  }
74
- }
74
+ ]
75
75
  }
76
76
  },
77
77
  memory: {
@@ -83,57 +83,57 @@ const testDashboard = {
83
83
  plugin: {
84
84
  kind: 'TimeSeriesChart',
85
85
  spec: {
86
- queries: [
87
- {
88
- kind: 'TimeSeriesQuery',
86
+ unit: {
87
+ kind: 'Bytes'
88
+ }
89
+ }
90
+ },
91
+ queries: [
92
+ {
93
+ kind: 'TimeSeriesQuery',
94
+ spec: {
95
+ plugin: {
96
+ kind: 'PrometheusTimeSeriesQuery',
89
97
  spec: {
90
- plugin: {
91
- kind: 'PrometheusTimeSeriesQuery',
92
- spec: {
93
- query: '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"}'
94
- }
95
- }
98
+ query: '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"}'
96
99
  }
97
- },
98
- {
99
- kind: 'TimeSeriesQuery',
100
+ }
101
+ }
102
+ },
103
+ {
104
+ kind: 'TimeSeriesQuery',
105
+ spec: {
106
+ plugin: {
107
+ kind: 'PrometheusTimeSeriesQuery',
100
108
  spec: {
101
- plugin: {
102
- kind: 'PrometheusTimeSeriesQuery',
103
- spec: {
104
- query: 'node_memory_Buffers_bytes{job="node",instance="$instance"}'
105
- }
106
- }
109
+ query: 'node_memory_Buffers_bytes{job="node",instance="$instance"}'
107
110
  }
108
- },
109
- {
110
- kind: 'TimeSeriesQuery',
111
+ }
112
+ }
113
+ },
114
+ {
115
+ kind: 'TimeSeriesQuery',
116
+ spec: {
117
+ plugin: {
118
+ kind: 'PrometheusTimeSeriesQuery',
111
119
  spec: {
112
- plugin: {
113
- kind: 'PrometheusTimeSeriesQuery',
114
- spec: {
115
- query: 'node_memory_Cached_bytes{job="node",instance="$instance"}'
116
- }
117
- }
120
+ query: 'node_memory_Cached_bytes{job="node",instance="$instance"}'
118
121
  }
119
- },
120
- {
121
- kind: 'TimeSeriesQuery',
122
+ }
123
+ }
124
+ },
125
+ {
126
+ kind: 'TimeSeriesQuery',
127
+ spec: {
128
+ plugin: {
129
+ kind: 'PrometheusTimeSeriesQuery',
122
130
  spec: {
123
- plugin: {
124
- kind: 'PrometheusTimeSeriesQuery',
125
- spec: {
126
- query: 'node_memory_MemFree_bytes{job="node",instance="$instance"}'
127
- }
128
- }
131
+ query: 'node_memory_MemFree_bytes{job="node",instance="$instance"}'
129
132
  }
130
133
  }
131
- ],
132
- unit: {
133
- kind: 'Bytes'
134
134
  }
135
135
  }
136
- }
136
+ ]
137
137
  }
138
138
  },
139
139
  // This panel is referenced in more than one layout below
@@ -146,24 +146,24 @@ const testDashboard = {
146
146
  plugin: {
147
147
  kind: 'TimeSeriesChart',
148
148
  spec: {
149
- queries: [
150
- {
151
- kind: 'TimeSeriesQuery',
149
+ unit: {
150
+ kind: 'Percent'
151
+ }
152
+ }
153
+ },
154
+ queries: [
155
+ {
156
+ kind: 'TimeSeriesQuery',
157
+ spec: {
158
+ plugin: {
159
+ kind: 'PrometheusTimeSeriesQuery',
152
160
  spec: {
153
- plugin: {
154
- kind: 'PrometheusTimeSeriesQuery',
155
- spec: {
156
- query: 'rate(node_disk_io_time_seconds_total{job="node",instance="$instance",device!~"^(md\\\\d+$|dm-)"}[$interval])'
157
- }
158
- }
161
+ query: 'rate(node_disk_io_time_seconds_total{job="node",instance="$instance",device!~"^(md\\\\d+$|dm-)"}[$interval])'
159
162
  }
160
163
  }
161
- ],
162
- unit: {
163
- kind: 'Percent'
164
164
  }
165
165
  }
166
- }
166
+ ]
167
167
  }
168
168
  },
169
169
  filesystemFullness: {
@@ -175,24 +175,24 @@ const testDashboard = {
175
175
  plugin: {
176
176
  kind: 'TimeSeriesChart',
177
177
  spec: {
178
- queries: [
179
- {
180
- kind: 'TimeSeriesQuery',
178
+ unit: {
179
+ kind: 'Percent'
180
+ }
181
+ }
182
+ },
183
+ queries: [
184
+ {
185
+ kind: 'TimeSeriesQuery',
186
+ spec: {
187
+ plugin: {
188
+ kind: 'PrometheusTimeSeriesQuery',
181
189
  spec: {
182
- plugin: {
183
- kind: 'PrometheusTimeSeriesQuery',
184
- spec: {
185
- query: '1 - node_filesystem_free_bytes{job="node",instance="$instance",fstype!="rootfs",mountpoint!~"/(run|var).*",mountpoint!=""} / node_filesystem_size_bytes{job="node",instance="$instance"}'
186
- }
187
- }
190
+ query: '1 - node_filesystem_free_bytes{job="node",instance="$instance",fstype!="rootfs",mountpoint!~"/(run|var).*",mountpoint!=""} / node_filesystem_size_bytes{job="node",instance="$instance"}'
188
191
  }
189
192
  }
190
- ],
191
- unit: {
192
- kind: 'Percent'
193
193
  }
194
194
  }
195
- }
195
+ ]
196
196
  }
197
197
  }
198
198
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test/testDashboard.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 { 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: '30m',\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 // This panel is referenced in more than one layout below\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: 0,\n y: 0,\n width: 6,\n height: 2,\n content: { $ref: '#/spec/panels/diskIO' },\n },\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: 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,M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;iBACF;aACF;YACD,YAAY;YACZ;gBACE/B,IAAI,EAAE,MAAM;gBACZO,IAAI,EAAE;oBACJM,OAAO,EAAE;wBACPS,KAAK,EAAE,YAAY;wBACnBC,QAAQ,EAAE;4BACRC,IAAI,EAAE,KAAK;yBACZ;qBACF;oBACDC,KAAK,EAAE;wBACL;4BACEC,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,eAAehC,aAAa,CAAC"}
1
+ {"version":3,"sources":["../../src/test/testDashboard.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 { 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: '30m',\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 unit: { kind: '%' },\n },\n },\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 },\n },\n memory: {\n kind: 'Panel',\n spec: {\n display: { name: 'Memory' },\n plugin: {\n kind: 'TimeSeriesChart',\n spec: {\n unit: { kind: 'Bytes' },\n },\n },\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 },\n },\n // This panel is referenced in more than one layout below\n diskIO: {\n kind: 'Panel',\n spec: {\n display: { name: 'Disk I/O Utilization' },\n plugin: {\n kind: 'TimeSeriesChart',\n spec: {\n unit: { kind: 'Percent' },\n },\n },\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 },\n },\n filesystemFullness: {\n kind: 'Panel',\n spec: {\n display: { name: 'Filesystem Fullness' },\n plugin: {\n kind: 'TimeSeriesChart',\n spec: {\n unit: { kind: 'Percent' },\n },\n },\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 },\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: 0,\n y: 0,\n width: 6,\n height: 2,\n content: { $ref: '#/spec/panels/diskIO' },\n },\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: 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","unit","queries","query","memory","diskIO","filesystemFullness","layouts","title","collapse","open","items","x","y","width","height","content","$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,CAAC;4BACRC,MAAM,EAAE,CAAC;4BACTC,OAAO,EAAE;gCAAEC,IAAI,EAAE,sBAAsB;6BAAE;yBAC1C;qBACF;iBACF;aACF;YACD,YAAY;YACZ;gBACE/B,IAAI,EAAE,MAAM;gBACZO,IAAI,EAAE;oBACJkB,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,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;gBACE/B,IAAI,EAAE,MAAM;gBACZO,IAAI,EAAE;oBACJM,OAAO,EAAE;wBACPS,KAAK,EAAE,YAAY;wBACnBC,QAAQ,EAAE;4BACRC,IAAI,EAAE,KAAK;yBACZ;qBACF;oBACDC,KAAK,EAAE;wBACL;4BACEC,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,eAAehC,aAAa,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export * from './panelUtils';
2
+ export * from './time';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAaA,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAaA,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC"}
@@ -11,5 +11,6 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  export * from './panelUtils';
14
+ export * from './time';
14
15
 
15
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/index.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\nexport * from './panelUtils';\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,cAAc,CAAC"}
1
+ {"version":3,"sources":["../../src/utils/index.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\nexport * from './panelUtils';\nexport * from './time';\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,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Gets the suggested step for a graph query in ms for the currently selected time range.
3
+ */
4
+ export declare function useSuggestedStepMs(width?: number): number;
5
+ //# sourceMappingURL=time.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/utils/time.ts"],"names":[],"mappings":"AAgBA;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,MAAM,UAIhD"}
@@ -0,0 +1,23 @@
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 { getSuggestedStepMs } from '@perses-dev/core';
14
+ import { useTimeRange } from '@perses-dev/plugin-system';
15
+ /**
16
+ * Gets the suggested step for a graph query in ms for the currently selected time range.
17
+ */ export function useSuggestedStepMs(width) {
18
+ const { absoluteTimeRange } = useTimeRange();
19
+ if (width === undefined) return 0;
20
+ return getSuggestedStepMs(absoluteTimeRange, width);
21
+ }
22
+
23
+ //# sourceMappingURL=time.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/time.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 { getSuggestedStepMs } from '@perses-dev/core';\nimport { useTimeRange } from '@perses-dev/plugin-system';\n\n/**\n * Gets the suggested step for a graph query in ms for the currently selected time range.\n */\nexport function useSuggestedStepMs(width?: number) {\n const { absoluteTimeRange } = useTimeRange();\n if (width === undefined) return 0;\n return getSuggestedStepMs(absoluteTimeRange, width);\n}\n"],"names":["getSuggestedStepMs","useTimeRange","useSuggestedStepMs","width","absoluteTimeRange","undefined"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,kBAAkB,QAAQ,kBAAkB,CAAC;AACtD,SAASC,YAAY,QAAQ,2BAA2B,CAAC;AAEzD;;CAEC,GACD,OAAO,SAASC,kBAAkB,CAACC,KAAc,EAAE;IACjD,MAAM,EAAEC,iBAAiB,CAAA,EAAE,GAAGH,YAAY,EAAE,AAAC;IAC7C,IAAIE,KAAK,KAAKE,SAAS,EAAE,OAAO,CAAC,CAAC;IAClC,OAAOL,kBAAkB,CAACI,iBAAiB,EAAED,KAAK,CAAC,CAAC;AACtD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/dashboards",
3
- "version": "0.27.0",
3
+ "version": "0.29.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",
@@ -29,9 +29,9 @@
29
29
  "lint:fix": "eslint --fix src --ext .ts,.tsx"
30
30
  },
31
31
  "dependencies": {
32
- "@perses-dev/components": "0.27.0",
33
- "@perses-dev/core": "0.27.0",
34
- "@perses-dev/plugin-system": "0.27.0",
32
+ "@perses-dev/components": "0.29.0",
33
+ "@perses-dev/core": "0.29.0",
34
+ "@perses-dev/plugin-system": "0.29.0",
35
35
  "@types/react-grid-layout": "^1.3.2",
36
36
  "date-fns": "^2.28.0",
37
37
  "immer": "^9.0.15",
@@ -44,8 +44,8 @@
44
44
  "zustand": "^4.3.3"
45
45
  },
46
46
  "devDependencies": {
47
- "@perses-dev/internal-utils": "0.27.0",
48
- "@perses-dev/storybook": "0.27.0",
47
+ "@perses-dev/internal-utils": "0.29.0",
48
+ "@perses-dev/storybook": "0.29.0",
49
49
  "intersection-observer": "^0.12.2"
50
50
  },
51
51
  "peerDependencies": {