@perses-dev/dashboards 0.8.1 → 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.
Files changed (258) hide show
  1. package/dist/cjs/components/Dashboard.js +25 -14
  2. package/dist/cjs/components/DashboardToolbar.js +148 -20
  3. package/dist/cjs/components/GridLayout/GridItemContent.js +25 -19
  4. package/dist/cjs/components/GridLayout/GridLayout.js +92 -27
  5. package/dist/cjs/components/GridLayout/GridTitle.js +91 -31
  6. package/dist/cjs/components/GridLayout/index.js +18 -19
  7. package/dist/cjs/components/Panel/DeletePanelDialog.js +91 -0
  8. package/dist/cjs/components/Panel/Panel.js +156 -55
  9. package/dist/cjs/components/Panel/Panel.test.js +58 -41
  10. package/dist/cjs/components/Panel/PanelContent.js +41 -12
  11. package/dist/cjs/components/Panel/index.js +16 -17
  12. package/dist/cjs/components/PanelDrawer/PanelDrawer.js +84 -108
  13. package/dist/cjs/components/PanelDrawer/PanelDrawer.test.js +87 -92
  14. package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +194 -0
  15. package/dist/cjs/components/PanelDrawer/PanelPreview.js +48 -0
  16. package/dist/cjs/components/PanelDrawer/index.js +28 -0
  17. package/dist/cjs/components/PanelGroupDialog/DeletePanelGroupDialog.js +86 -0
  18. package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +121 -39
  19. package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.test.js +74 -88
  20. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +120 -38
  21. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.test.js +42 -27
  22. package/dist/cjs/components/TimeRangeControls/index.js +16 -17
  23. package/dist/cjs/components/Variables/Variable.js +195 -36
  24. package/dist/cjs/components/Variables/VariableEditor.js +207 -0
  25. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +236 -0
  26. package/dist/cjs/components/Variables/VariableEditorForm/index.js +28 -0
  27. package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +88 -0
  28. package/dist/cjs/components/Variables/VariableList.js +81 -13
  29. package/dist/cjs/components/Variables/index.js +18 -18
  30. package/dist/cjs/components/index.js +21 -21
  31. package/dist/cjs/context/DashboardProvider/DashboardProvider.js +70 -0
  32. package/dist/cjs/context/DashboardProvider/common.js +18 -0
  33. package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +71 -0
  34. package/dist/cjs/context/DashboardProvider/index.js +29 -0
  35. package/dist/cjs/context/DashboardProvider/layout-slice.js +200 -0
  36. package/dist/cjs/context/DashboardProvider/panel-editing-slice.js +156 -0
  37. package/dist/cjs/context/DashboardProvider/panel-group-slice.js +38 -0
  38. package/dist/cjs/context/DatasourceStoreProvider.js +170 -0
  39. package/dist/cjs/context/QueryStringProvider.js +69 -15
  40. package/dist/cjs/context/TemplateVariableProvider.js +135 -136
  41. package/dist/cjs/context/TimeRangeProvider.js +79 -30
  42. package/dist/cjs/context/index.js +20 -22
  43. package/dist/cjs/css/styles.js +43 -39
  44. package/dist/cjs/index.js +19 -20
  45. package/dist/cjs/test/dashboard-provider.js +51 -0
  46. package/dist/cjs/test/index.js +18 -18
  47. package/dist/cjs/test/plugin-registry.js +52 -25
  48. package/dist/cjs/test/render.js +25 -22
  49. package/dist/cjs/test/setup-tests.js +4 -2
  50. package/dist/cjs/test/testDashboard.js +203 -107
  51. package/dist/cjs/utils/functions.js +9 -5
  52. package/dist/cjs/views/ViewDashboard/DashboardApp.js +49 -23
  53. package/dist/cjs/views/ViewDashboard/ViewDashboard.js +62 -31
  54. package/dist/cjs/views/ViewDashboard/index.js +16 -17
  55. package/dist/cjs/views/ViewDashboard/tests/panelGroups.test.js +165 -0
  56. package/dist/cjs/views/index.js +16 -17
  57. package/dist/components/Dashboard.d.ts +1 -4
  58. package/dist/components/Dashboard.d.ts.map +1 -1
  59. package/dist/components/Dashboard.js +34 -1
  60. package/dist/components/Dashboard.js.map +1 -0
  61. package/dist/components/DashboardToolbar.d.ts.map +1 -1
  62. package/dist/components/DashboardToolbar.js +154 -1
  63. package/dist/components/DashboardToolbar.js.map +1 -0
  64. package/dist/components/GridLayout/GridItemContent.d.ts +3 -3
  65. package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
  66. package/dist/components/GridLayout/GridItemContent.js +35 -1
  67. package/dist/components/GridLayout/GridItemContent.js.map +1 -0
  68. package/dist/components/GridLayout/GridLayout.d.ts +2 -3
  69. package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
  70. package/dist/components/GridLayout/GridLayout.js +102 -1
  71. package/dist/components/GridLayout/GridLayout.js.map +1 -0
  72. package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
  73. package/dist/components/GridLayout/GridTitle.js +99 -1
  74. package/dist/components/GridLayout/GridTitle.js.map +1 -0
  75. package/dist/components/GridLayout/index.js +16 -1
  76. package/dist/components/GridLayout/index.js.map +1 -0
  77. package/dist/components/Panel/DeletePanelDialog.d.ts +5 -0
  78. package/dist/components/Panel/DeletePanelDialog.d.ts.map +1 -0
  79. package/dist/components/Panel/DeletePanelDialog.js +80 -0
  80. package/dist/components/Panel/DeletePanelDialog.js.map +1 -0
  81. package/dist/components/Panel/Panel.d.ts +1 -1
  82. package/dist/components/Panel/Panel.d.ts.map +1 -1
  83. package/dist/components/Panel/Panel.js +181 -1
  84. package/dist/components/Panel/Panel.js.map +1 -0
  85. package/dist/components/Panel/Panel.test.js +74 -1
  86. package/dist/components/Panel/Panel.test.js.map +1 -0
  87. package/dist/components/Panel/PanelContent.d.ts +5 -4
  88. package/dist/components/Panel/PanelContent.d.ts.map +1 -1
  89. package/dist/components/Panel/PanelContent.js +41 -1
  90. package/dist/components/Panel/PanelContent.js.map +1 -0
  91. package/dist/components/Panel/index.js +15 -1
  92. package/dist/components/Panel/index.js.map +1 -0
  93. package/dist/components/PanelDrawer/PanelDrawer.d.ts +4 -2
  94. package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
  95. package/dist/components/PanelDrawer/PanelDrawer.js +96 -1
  96. package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -0
  97. package/dist/components/PanelDrawer/PanelDrawer.test.js +99 -1
  98. package/dist/components/PanelDrawer/PanelDrawer.test.js.map +1 -0
  99. package/dist/components/PanelDrawer/PanelEditorForm.d.ts +12 -0
  100. package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -0
  101. package/dist/components/PanelDrawer/PanelEditorForm.js +184 -0
  102. package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -0
  103. package/dist/components/PanelDrawer/PanelPreview.d.ts +4 -0
  104. package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -0
  105. package/dist/components/PanelDrawer/PanelPreview.js +42 -0
  106. package/dist/components/PanelDrawer/PanelPreview.js.map +1 -0
  107. package/dist/components/PanelDrawer/index.d.ts +2 -0
  108. package/dist/components/PanelDrawer/index.d.ts.map +1 -0
  109. package/dist/components/PanelDrawer/index.js +15 -0
  110. package/dist/components/PanelDrawer/index.js.map +1 -0
  111. package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.d.ts +4 -0
  112. package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -0
  113. package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.js +75 -0
  114. package/dist/components/PanelGroupDialog/DeletePanelGroupDialog.js.map +1 -0
  115. package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
  116. package/dist/components/PanelGroupDialog/PanelGroupDialog.js +131 -1
  117. package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -0
  118. package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js +74 -1
  119. package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js.map +1 -0
  120. package/dist/components/TimeRangeControls/TimeRangeControls.js +137 -1
  121. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -0
  122. package/dist/components/TimeRangeControls/TimeRangeControls.test.js +59 -1
  123. package/dist/components/TimeRangeControls/TimeRangeControls.test.js.map +1 -0
  124. package/dist/components/TimeRangeControls/index.js +15 -1
  125. package/dist/components/TimeRangeControls/index.js.map +1 -0
  126. package/dist/components/Variables/Variable.d.ts.map +1 -1
  127. package/dist/components/Variables/Variable.js +210 -1
  128. package/dist/components/Variables/Variable.js.map +1 -0
  129. package/dist/components/Variables/VariableEditor.d.ts +8 -0
  130. package/dist/components/Variables/VariableEditor.d.ts.map +1 -0
  131. package/dist/components/Variables/VariableEditor.js +196 -0
  132. package/dist/components/Variables/VariableEditor.js.map +1 -0
  133. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +8 -0
  134. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -0
  135. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +225 -0
  136. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -0
  137. package/dist/components/Variables/VariableEditorForm/index.d.ts +2 -0
  138. package/dist/components/Variables/VariableEditorForm/index.d.ts.map +1 -0
  139. package/dist/components/Variables/VariableEditorForm/index.js +15 -0
  140. package/dist/components/Variables/VariableEditorForm/index.js.map +1 -0
  141. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +21 -0
  142. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -0
  143. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +76 -0
  144. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -0
  145. package/dist/components/Variables/VariableList.d.ts.map +1 -1
  146. package/dist/components/Variables/VariableList.js +84 -1
  147. package/dist/components/Variables/VariableList.js.map +1 -0
  148. package/dist/components/Variables/index.d.ts +1 -0
  149. package/dist/components/Variables/index.d.ts.map +1 -1
  150. package/dist/components/Variables/index.js +17 -1
  151. package/dist/components/Variables/index.js.map +1 -0
  152. package/dist/components/index.d.ts +1 -0
  153. package/dist/components/index.d.ts.map +1 -1
  154. package/dist/components/index.js +20 -1
  155. package/dist/components/index.js.map +1 -0
  156. package/dist/context/DashboardProvider/DashboardProvider.d.ts +23 -0
  157. package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -0
  158. package/dist/context/DashboardProvider/DashboardProvider.js +52 -0
  159. package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -0
  160. package/dist/context/DashboardProvider/common.d.ts +5 -0
  161. package/dist/context/DashboardProvider/common.d.ts.map +1 -0
  162. package/dist/context/DashboardProvider/common.js +17 -0
  163. package/dist/context/DashboardProvider/common.js.map +1 -0
  164. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +32 -0
  165. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -0
  166. package/dist/context/DashboardProvider/dashboard-provider-api.js +56 -0
  167. package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -0
  168. package/dist/context/DashboardProvider/index.d.ts +3 -0
  169. package/dist/context/DashboardProvider/index.d.ts.map +1 -0
  170. package/dist/context/DashboardProvider/index.js +16 -0
  171. package/dist/context/DashboardProvider/index.js.map +1 -0
  172. package/dist/context/DashboardProvider/layout-slice.d.ts +57 -0
  173. package/dist/context/DashboardProvider/layout-slice.d.ts.map +1 -0
  174. package/dist/context/DashboardProvider/layout-slice.js +196 -0
  175. package/dist/context/DashboardProvider/layout-slice.js.map +1 -0
  176. package/dist/context/DashboardProvider/panel-editing-slice.d.ts +70 -0
  177. package/dist/context/DashboardProvider/panel-editing-slice.d.ts.map +1 -0
  178. package/dist/context/DashboardProvider/panel-editing-slice.js +152 -0
  179. package/dist/context/DashboardProvider/panel-editing-slice.js.map +1 -0
  180. package/dist/context/DashboardProvider/panel-group-slice.d.ts +15 -0
  181. package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -0
  182. package/dist/context/DashboardProvider/panel-group-slice.js +32 -0
  183. package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -0
  184. package/dist/context/DatasourceStoreProvider.d.ts +24 -0
  185. package/dist/context/DatasourceStoreProvider.d.ts.map +1 -0
  186. package/dist/context/DatasourceStoreProvider.js +166 -0
  187. package/dist/context/DatasourceStoreProvider.js.map +1 -0
  188. package/dist/context/QueryStringProvider.js +40 -1
  189. package/dist/context/QueryStringProvider.js.map +1 -0
  190. package/dist/context/TemplateVariableProvider.d.ts +8 -3
  191. package/dist/context/TemplateVariableProvider.d.ts.map +1 -1
  192. package/dist/context/TemplateVariableProvider.js +199 -1
  193. package/dist/context/TemplateVariableProvider.js.map +1 -0
  194. package/dist/context/TimeRangeProvider.js +72 -1
  195. package/dist/context/TimeRangeProvider.js.map +1 -0
  196. package/dist/context/index.d.ts +3 -4
  197. package/dist/context/index.d.ts.map +1 -1
  198. package/dist/context/index.js +19 -1
  199. package/dist/context/index.js.map +1 -0
  200. package/dist/css/styles.js +186 -1
  201. package/dist/css/styles.js.map +1 -0
  202. package/dist/index.js +17 -1
  203. package/dist/index.js.map +1 -0
  204. package/dist/test/dashboard-provider.d.ts +19 -0
  205. package/dist/test/dashboard-provider.d.ts.map +1 -0
  206. package/dist/test/dashboard-provider.js +40 -0
  207. package/dist/test/dashboard-provider.js.map +1 -0
  208. package/dist/test/index.d.ts +1 -0
  209. package/dist/test/index.d.ts.map +1 -1
  210. package/dist/test/index.js +17 -1
  211. package/dist/test/index.js.map +1 -0
  212. package/dist/test/plugin-registry.d.ts +3 -4
  213. package/dist/test/plugin-registry.d.ts.map +1 -1
  214. package/dist/test/plugin-registry.js +74 -1
  215. package/dist/test/plugin-registry.js.map +1 -0
  216. package/dist/test/render.d.ts +1 -2
  217. package/dist/test/render.d.ts.map +1 -1
  218. package/dist/test/render.js +34 -1
  219. package/dist/test/render.js.map +1 -0
  220. package/dist/test/setup-tests.js +18 -1
  221. package/dist/test/setup-tests.js.map +1 -0
  222. package/dist/test/testDashboard.d.ts.map +1 -1
  223. package/dist/test/testDashboard.js +286 -1
  224. package/dist/test/testDashboard.js.map +1 -0
  225. package/dist/utils/functions.js +17 -1
  226. package/dist/utils/functions.js.map +1 -0
  227. package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
  228. package/dist/views/ViewDashboard/DashboardApp.js +55 -1
  229. package/dist/views/ViewDashboard/DashboardApp.js.map +1 -0
  230. package/dist/views/ViewDashboard/ViewDashboard.d.ts +2 -0
  231. package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
  232. package/dist/views/ViewDashboard/ViewDashboard.js +79 -1
  233. package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -0
  234. package/dist/views/ViewDashboard/index.js +15 -1
  235. package/dist/views/ViewDashboard/index.js.map +1 -0
  236. package/dist/views/ViewDashboard/tests/panelGroups.test.d.ts +2 -0
  237. package/dist/views/ViewDashboard/tests/panelGroups.test.d.ts.map +1 -0
  238. package/dist/views/ViewDashboard/tests/panelGroups.test.js +158 -0
  239. package/dist/views/ViewDashboard/tests/panelGroups.test.js.map +1 -0
  240. package/dist/views/index.js +15 -1
  241. package/dist/views/index.js.map +1 -0
  242. package/package.json +13 -7
  243. package/dist/cjs/components/PanelDrawer/PanelOptionsEditor.js +0 -19
  244. package/dist/cjs/context/DashboardAppSlice.js +0 -45
  245. package/dist/cjs/context/DashboardProvider.js +0 -98
  246. package/dist/cjs/context/LayoutsSlice.js +0 -42
  247. package/dist/components/PanelDrawer/PanelOptionsEditor.d.ts +0 -9
  248. package/dist/components/PanelDrawer/PanelOptionsEditor.d.ts.map +0 -1
  249. package/dist/components/PanelDrawer/PanelOptionsEditor.js +0 -1
  250. package/dist/context/DashboardAppSlice.d.ts +0 -26
  251. package/dist/context/DashboardAppSlice.d.ts.map +0 -1
  252. package/dist/context/DashboardAppSlice.js +0 -1
  253. package/dist/context/DashboardProvider.d.ts +0 -34
  254. package/dist/context/DashboardProvider.d.ts.map +0 -1
  255. package/dist/context/DashboardProvider.js +0 -1
  256. package/dist/context/LayoutsSlice.d.ts +0 -12
  257. package/dist/context/LayoutsSlice.d.ts.map +0 -1
  258. package/dist/context/LayoutsSlice.js +0 -1
@@ -1,5 +1,4 @@
1
- "use strict";
2
- // Copyright 2021 The Perses Authors
1
+ // Copyright 2022 The Perses Authors
3
2
  // Licensed under the Apache License, Version 2.0 (the "License");
4
3
  // you may not use this file except in compliance with the License.
5
4
  // You may obtain a copy of the License at
@@ -11,7 +10,14 @@
11
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
11
  // See the License for the specific language governing permissions and
13
12
  // limitations under the License.
14
- Object.defineProperty(exports, "__esModule", { value: true });
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "default", {
18
+ enumerable: true,
19
+ get: ()=>_default
20
+ });
15
21
  const testDashboard = {
16
22
  kind: 'Dashboard',
17
23
  metadata: {
@@ -19,113 +25,183 @@ const testDashboard = {
19
25
  project: 'perses',
20
26
  created_at: '2021-11-09',
21
27
  updated_at: '2021-11-09',
22
- version: 0,
28
+ version: 0
23
29
  },
24
30
  spec: {
25
- datasource: { kind: 'Prometheus', global: true, name: 'Public Prometheus Demo Server' },
26
31
  duration: '24h',
27
32
  variables: [
28
33
  {
29
- name: 'job',
30
34
  kind: 'TextVariable',
31
- options: {
32
- value: 'node',
33
- },
35
+ spec: {
36
+ name: 'job',
37
+ value: 'node'
38
+ }
34
39
  },
35
40
  {
36
- name: 'instance',
37
41
  kind: 'TextVariable',
38
- options: {
39
- value: 'demo.do.prometheus.io:9100',
40
- },
42
+ spec: {
43
+ name: 'instance',
44
+ value: 'demo.do.prometheus.io:9100'
45
+ }
41
46
  },
42
47
  {
43
- name: 'interval',
44
48
  kind: 'TextVariable',
45
- options: {
46
- value: '1m',
47
- },
48
- },
49
+ spec: {
50
+ name: 'interval',
51
+ value: '1m'
52
+ }
53
+ }
49
54
  ],
50
55
  panels: {
51
56
  cpu: {
52
- kind: 'LineChart',
53
- display: { name: 'CPU' },
54
- options: {
55
- queries: [
56
- {
57
- kind: 'PrometheusGraphQuery',
58
- options: {
59
- query: 'avg without (cpu)(rate(node_cpu_seconds_total{job="node",instance="$instance",mode!="idle"}[$interval]))',
60
- },
61
- },
62
- ],
63
- unit: { kind: '%' },
64
- },
57
+ kind: 'Panel',
58
+ spec: {
59
+ display: {
60
+ name: 'CPU'
61
+ },
62
+ plugin: {
63
+ kind: 'TimeSeriesChart',
64
+ spec: {
65
+ queries: [
66
+ {
67
+ kind: 'TimeSeriesQuery',
68
+ spec: {
69
+ plugin: {
70
+ kind: 'PrometheusTimeSeriesQuery',
71
+ spec: {
72
+ query: 'avg without (cpu)(rate(node_cpu_seconds_total{job="node",instance="$instance",mode!="idle"}[$interval]))'
73
+ }
74
+ }
75
+ }
76
+ }
77
+ ],
78
+ unit: {
79
+ kind: '%'
80
+ }
81
+ }
82
+ }
83
+ }
65
84
  },
66
85
  memory: {
67
- kind: 'LineChart',
68
- display: { name: 'Memory' },
69
- options: {
70
- queries: [
71
- {
72
- kind: 'PrometheusGraphQuery',
73
- options: {
74
- 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"}',
75
- },
76
- },
77
- {
78
- kind: 'PrometheusGraphQuery',
79
- options: {
80
- query: 'node_memory_Buffers_bytes{job="node",instance="$instance"}',
81
- },
82
- },
83
- {
84
- kind: 'PrometheusGraphQuery',
85
- options: {
86
- query: 'node_memory_Cached_bytes{job="node",instance="$instance"}',
87
- },
88
- },
89
- {
90
- kind: 'PrometheusGraphQuery',
91
- options: {
92
- query: 'node_memory_MemFree_bytes{job="node",instance="$instance"}',
93
- },
94
- },
95
- ],
96
- unit: { kind: 'Bytes' },
97
- },
86
+ kind: 'Panel',
87
+ spec: {
88
+ display: {
89
+ name: 'Memory'
90
+ },
91
+ plugin: {
92
+ kind: 'TimeSeriesChart',
93
+ spec: {
94
+ queries: [
95
+ {
96
+ kind: 'TimeSeriesQuery',
97
+ spec: {
98
+ plugin: {
99
+ kind: 'PrometheusTimeSeriesQuery',
100
+ spec: {
101
+ 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"}'
102
+ }
103
+ }
104
+ }
105
+ },
106
+ {
107
+ kind: 'TimeSeriesQuery',
108
+ spec: {
109
+ plugin: {
110
+ kind: 'PrometheusTimeSeriesQuery',
111
+ spec: {
112
+ query: 'node_memory_Buffers_bytes{job="node",instance="$instance"}'
113
+ }
114
+ }
115
+ }
116
+ },
117
+ {
118
+ kind: 'TimeSeriesQuery',
119
+ spec: {
120
+ plugin: {
121
+ kind: 'PrometheusTimeSeriesQuery',
122
+ spec: {
123
+ query: 'node_memory_Cached_bytes{job="node",instance="$instance"}'
124
+ }
125
+ }
126
+ }
127
+ },
128
+ {
129
+ kind: 'TimeSeriesQuery',
130
+ spec: {
131
+ plugin: {
132
+ kind: 'PrometheusTimeSeriesQuery',
133
+ spec: {
134
+ query: 'node_memory_MemFree_bytes{job="node",instance="$instance"}'
135
+ }
136
+ }
137
+ }
138
+ }
139
+ ],
140
+ unit: {
141
+ kind: 'Bytes'
142
+ }
143
+ }
144
+ }
145
+ }
98
146
  },
99
147
  diskIO: {
100
- kind: 'LineChart',
101
- display: { name: 'Disk I/O Utilization' },
102
- options: {
103
- queries: [
104
- {
105
- kind: 'PrometheusGraphQuery',
106
- options: {
107
- query: 'rate(node_disk_io_time_seconds_total{job="node",instance="$instance",device!~"^(md\\\\d+$|dm-)"}[$interval])',
108
- },
109
- },
110
- ],
111
- unit: { kind: 'Percent' },
112
- },
148
+ kind: 'Panel',
149
+ spec: {
150
+ display: {
151
+ name: 'Disk I/O Utilization'
152
+ },
153
+ plugin: {
154
+ kind: 'TimeSeriesChart',
155
+ spec: {
156
+ queries: [
157
+ {
158
+ kind: 'TimeSeriesQuery',
159
+ spec: {
160
+ plugin: {
161
+ kind: 'PrometheusTimeSeriesQuery',
162
+ spec: {
163
+ query: 'rate(node_disk_io_time_seconds_total{job="node",instance="$instance",device!~"^(md\\\\d+$|dm-)"}[$interval])'
164
+ }
165
+ }
166
+ }
167
+ }
168
+ ],
169
+ unit: {
170
+ kind: 'Percent'
171
+ }
172
+ }
173
+ }
174
+ }
113
175
  },
114
176
  filesystemFullness: {
115
- kind: 'LineChart',
116
- display: { name: 'Filesystem Fullness' },
117
- options: {
118
- queries: [
119
- {
120
- kind: 'PrometheusGraphQuery',
121
- options: {
122
- query: '1 - node_filesystem_free_bytes{job="node",instance="$instance",fstype!="rootfs",mountpoint!~"/(run|var).*",mountpoint!=""} / node_filesystem_size_bytes{job="node",instance="$instance"}',
123
- },
124
- },
125
- ],
126
- unit: { kind: 'Percent' },
127
- },
128
- },
177
+ kind: 'Panel',
178
+ spec: {
179
+ display: {
180
+ name: 'Filesystem Fullness'
181
+ },
182
+ plugin: {
183
+ kind: 'TimeSeriesChart',
184
+ spec: {
185
+ queries: [
186
+ {
187
+ kind: 'TimeSeriesQuery',
188
+ spec: {
189
+ plugin: {
190
+ kind: 'PrometheusTimeSeriesQuery',
191
+ spec: {
192
+ query: '1 - node_filesystem_free_bytes{job="node",instance="$instance",fstype!="rootfs",mountpoint!~"/(run|var).*",mountpoint!=""} / node_filesystem_size_bytes{job="node",instance="$instance"}'
193
+ }
194
+ }
195
+ }
196
+ }
197
+ ],
198
+ unit: {
199
+ kind: 'Percent'
200
+ }
201
+ }
202
+ }
203
+ }
204
+ }
129
205
  },
130
206
  layouts: [
131
207
  // Regular Title, no collapse enabled
@@ -134,6 +210,9 @@ const testDashboard = {
134
210
  spec: {
135
211
  display: {
136
212
  title: 'CPU Stats',
213
+ collapse: {
214
+ open: true
215
+ }
137
216
  },
138
217
  items: [
139
218
  // First Row
@@ -142,10 +221,21 @@ const testDashboard = {
142
221
  y: 0,
143
222
  width: 12,
144
223
  height: 4,
145
- content: { $ref: '#/spec/panels/cpu' },
224
+ content: {
225
+ $ref: '#/spec/panels/cpu'
226
+ }
146
227
  },
147
- ],
148
- },
228
+ {
229
+ x: 0,
230
+ y: 5,
231
+ width: 6,
232
+ height: 2,
233
+ content: {
234
+ $ref: '#/spec/panels/diskIO'
235
+ }
236
+ }
237
+ ]
238
+ }
149
239
  },
150
240
  // No title,
151
241
  {
@@ -157,10 +247,12 @@ const testDashboard = {
157
247
  y: 0,
158
248
  width: 8,
159
249
  height: 3,
160
- content: { $ref: '#/spec/panels/memory' },
161
- },
162
- ],
163
- },
250
+ content: {
251
+ $ref: '#/spec/panels/memory'
252
+ }
253
+ }
254
+ ]
255
+ }
164
256
  },
165
257
  // Collapsed
166
258
  {
@@ -169,8 +261,8 @@ const testDashboard = {
169
261
  display: {
170
262
  title: 'Disk Stats',
171
263
  collapse: {
172
- open: false,
173
- },
264
+ open: false
265
+ }
174
266
  },
175
267
  items: [
176
268
  {
@@ -178,19 +270,23 @@ const testDashboard = {
178
270
  y: 0,
179
271
  width: 6,
180
272
  height: 2,
181
- content: { $ref: '#/spec/panels/diskIO' },
273
+ content: {
274
+ $ref: '#/spec/panels/diskIO'
275
+ }
182
276
  },
183
277
  {
184
278
  x: 18,
185
279
  y: 0,
186
280
  width: 6,
187
281
  height: 2,
188
- content: { $ref: '#/spec/panels/filesystemFullness' },
189
- },
190
- ],
191
- },
192
- },
193
- ],
194
- },
282
+ content: {
283
+ $ref: '#/spec/panels/filesystemFullness'
284
+ }
285
+ }
286
+ ]
287
+ }
288
+ }
289
+ ]
290
+ }
195
291
  };
196
- exports.default = testDashboard;
292
+ const _default = testDashboard;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // Copyright 2022 The Perses Authors
3
2
  // Licensed under the Apache License, Version 2.0 (the "License");
4
3
  // you may not use this file except in compliance with the License.
@@ -11,9 +10,14 @@
11
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
11
  // See the License for the specific language governing permissions and
13
12
  // limitations under the License.
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.removeWhiteSpacesAndSpecialCharacters = void 0;
16
- const removeWhiteSpacesAndSpecialCharacters = (str) => {
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "removeWhiteSpacesAndSpecialCharacters", {
18
+ enumerable: true,
19
+ get: ()=>removeWhiteSpacesAndSpecialCharacters
20
+ });
21
+ const removeWhiteSpacesAndSpecialCharacters = (str)=>{
17
22
  return str.replace(/\s+/g, '');
18
23
  };
19
- exports.removeWhiteSpacesAndSpecialCharacters = removeWhiteSpacesAndSpecialCharacters;
@@ -1,10 +1,3 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.DashboardApp = void 0;
7
- const jsx_runtime_1 = require("react/jsx-runtime");
8
1
  // Copyright 2022 The Perses Authors
9
2
  // Licensed under the Apache License, Version 2.0 (the "License");
10
3
  // you may not use this file except in compliance with the License.
@@ -17,24 +10,57 @@ const jsx_runtime_1 = require("react/jsx-runtime");
17
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
11
  // See the License for the specific language governing permissions and
19
12
  // limitations under the License.
20
- const material_1 = require("@mui/material");
21
- const components_1 = require("@perses-dev/components");
22
- const components_2 = require("../../components");
23
- const PanelGroupDialog_1 = __importDefault(require("../../components/PanelGroupDialog/PanelGroupDialog"));
24
- const PanelDrawer_1 = __importDefault(require("../../components/PanelDrawer/PanelDrawer"));
25
- const DashboardToolbar_1 = require("../../components/DashboardToolbar");
26
- const context_1 = require("../../context");
27
- const DashboardApp = (props) => {
28
- const { dashboardResource } = props;
29
- const { dashboard } = (0, context_1.useDashboard)();
30
- const { panelGroupDialog } = (0, context_1.useDashboardApp)();
31
- return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
32
- padding: (theme) => theme.spacing(1, 2),
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "DashboardApp", {
18
+ enumerable: true,
19
+ get: ()=>DashboardApp
20
+ });
21
+ const _jsxRuntime = require("react/jsx-runtime");
22
+ const _material = require("@mui/material");
23
+ const _components = require("@perses-dev/components");
24
+ const _components1 = require("../../components");
25
+ const _panelGroupDialog = /*#__PURE__*/ _interopRequireDefault(require("../../components/PanelGroupDialog/PanelGroupDialog"));
26
+ const _dashboardToolbar = require("../../components/DashboardToolbar");
27
+ const _deletePanelGroupDialog = /*#__PURE__*/ _interopRequireDefault(require("../../components/PanelGroupDialog/DeletePanelGroupDialog"));
28
+ const _deletePanelDialog = /*#__PURE__*/ _interopRequireDefault(require("../../components/Panel/DeletePanelDialog"));
29
+ function _interopRequireDefault(obj) {
30
+ return obj && obj.__esModule ? obj : {
31
+ default: obj
32
+ };
33
+ }
34
+ const DashboardApp = (props)=>{
35
+ const { dashboardResource } = props;
36
+ return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Box, {
37
+ sx: {
38
+ padding: (theme)=>theme.spacing(1, 0),
33
39
  flexGrow: 1,
34
40
  overflowX: 'hidden',
35
41
  overflowY: 'auto',
36
42
  display: 'flex',
37
- flexDirection: 'column',
38
- }, children: [(0, jsx_runtime_1.jsx)(DashboardToolbar_1.DashboardToolbar, { dashboardName: dashboardResource.metadata.name }), (0, jsx_runtime_1.jsx)(components_1.ErrorBoundary, { FallbackComponent: components_1.ErrorAlert, children: (0, jsx_runtime_1.jsx)(components_2.TemplateVariableList, {}) }), (0, jsx_runtime_1.jsx)(components_1.ErrorBoundary, { FallbackComponent: components_1.ErrorAlert, children: (0, jsx_runtime_1.jsx)(components_2.Dashboard, { spec: dashboard }) }), (0, jsx_runtime_1.jsx)(PanelDrawer_1.default, {}), panelGroupDialog && (0, jsx_runtime_1.jsx)(PanelGroupDialog_1.default, {})] }));
43
+ flexDirection: 'column'
44
+ },
45
+ children: [
46
+ /*#__PURE__*/ (0, _jsxRuntime.jsx)(_dashboardToolbar.DashboardToolbar, {
47
+ dashboardName: dashboardResource.metadata.name
48
+ }),
49
+ /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Box, {
50
+ sx: {
51
+ padding: (theme)=>theme.spacing(2)
52
+ },
53
+ children: [
54
+ /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.ErrorBoundary, {
55
+ FallbackComponent: _components.ErrorAlert,
56
+ children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components1.Dashboard, {})
57
+ }),
58
+ /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components1.PanelDrawer, {}),
59
+ /*#__PURE__*/ (0, _jsxRuntime.jsx)(_panelGroupDialog.default, {}),
60
+ /*#__PURE__*/ (0, _jsxRuntime.jsx)(_deletePanelGroupDialog.default, {}),
61
+ /*#__PURE__*/ (0, _jsxRuntime.jsx)(_deletePanelDialog.default, {})
62
+ ]
63
+ })
64
+ ]
65
+ });
39
66
  };
40
- exports.DashboardApp = DashboardApp;
@@ -1,7 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ViewDashboard = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
1
  // Copyright 2022 The Perses Authors
6
2
  // Licensed under the Apache License, Version 2.0 (the "License");
7
3
  // you may not use this file except in compliance with the License.
@@ -14,39 +10,74 @@ const jsx_runtime_1 = require("react/jsx-runtime");
14
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
11
  // See the License for the specific language governing permissions and
16
12
  // limitations under the License.
17
- const react_1 = require("react");
18
- const material_1 = require("@mui/material");
19
- const core_1 = require("@perses-dev/core");
20
- const plugin_system_1 = require("@perses-dev/plugin-system");
21
- const components_1 = require("@perses-dev/components");
22
- const context_1 = require("../../context");
23
- const DashboardApp_1 = require("./DashboardApp");
24
- /**
25
- * The View for displaying a Dashboard, along with the UI for selecting variable values.
26
- */
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "ViewDashboard", {
18
+ enumerable: true,
19
+ get: ()=>ViewDashboard
20
+ });
21
+ const _jsxRuntime = require("react/jsx-runtime");
22
+ const _react = require("react");
23
+ const _material = require("@mui/material");
24
+ const _core = require("@perses-dev/core");
25
+ const _pluginSystem = require("@perses-dev/plugin-system");
26
+ const _components = require("@perses-dev/components");
27
+ const _context = require("../../context");
28
+ const _dashboardApp = require("./DashboardApp");
27
29
  function ViewDashboard(props) {
28
- var _a;
29
- const { dashboardResource, sx, ...others } = props;
30
- const { spec } = dashboardResource;
31
- const { queryString, setQueryString } = (0, plugin_system_1.useQueryString)();
32
- const dashboardDuration = (_a = spec.duration) !== null && _a !== void 0 ? _a : '1h';
33
- const defaultTimeRange = (0, core_1.getDefaultTimeRange)(dashboardDuration, queryString);
30
+ const { dashboardResource , datasourceApi , sx , ...others } = props;
31
+ const { spec } = dashboardResource;
32
+ const { queryString , setQueryString } = (0, _pluginSystem.useQueryString)();
33
+ var _duration;
34
+ const dashboardDuration = (_duration = spec.duration) !== null && _duration !== void 0 ? _duration : '1h';
35
+ const defaultTimeRange = (0, _core.getDefaultTimeRange)(dashboardDuration, queryString);
34
36
  // TODO: add reusable sync query string or no-op util
35
- (0, react_1.useEffect)(() => {
36
- const currentParams = Object.fromEntries([...queryString]);
37
+ (0, _react.useEffect)(()=>{
38
+ const currentParams = Object.fromEntries([
39
+ ...queryString
40
+ ]);
37
41
  // if app does not provide query string implementation, setTimeRange is used instead
38
42
  if (!currentParams.start && setQueryString) {
39
43
  // default to duration in dashboard definition if start param is not already set
40
44
  queryString.set('start', dashboardDuration);
41
45
  setQueryString(queryString);
42
46
  }
43
- }, [dashboardDuration, queryString, setQueryString]);
44
- return ((0, jsx_runtime_1.jsx)(context_1.DashboardProvider, { initialState: { dashboardSpec: spec }, children: (0, jsx_runtime_1.jsx)(context_1.TimeRangeProvider, { initialTimeRange: defaultTimeRange, children: (0, jsx_runtime_1.jsx)(context_1.TemplateVariableProvider, { initialVariableDefinitions: spec.variables, children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: (0, components_1.combineSx)({
45
- display: 'flex',
46
- width: '100%',
47
- height: '100%',
48
- position: 'relative',
49
- overflow: 'hidden',
50
- }, sx), ...others, children: (0, jsx_runtime_1.jsx)(components_1.ErrorBoundary, { FallbackComponent: components_1.ErrorAlert, children: (0, jsx_runtime_1.jsx)(DashboardApp_1.DashboardApp, { dashboardResource: dashboardResource }) }) }) }) }) }));
47
+ }, [
48
+ dashboardDuration,
49
+ queryString,
50
+ setQueryString
51
+ ]);
52
+ return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_context.DatasourceStoreProvider, {
53
+ dashboardResource: dashboardResource,
54
+ datasourceApi: datasourceApi,
55
+ children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_context.DashboardProvider, {
56
+ initialState: {
57
+ dashboardSpec: spec
58
+ },
59
+ children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_context.TimeRangeProvider, {
60
+ initialTimeRange: defaultTimeRange,
61
+ children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_context.TemplateVariableProvider, {
62
+ initialVariableDefinitions: spec.variables,
63
+ children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
64
+ sx: (0, _components.combineSx)({
65
+ display: 'flex',
66
+ width: '100%',
67
+ height: '100%',
68
+ position: 'relative',
69
+ overflow: 'hidden'
70
+ }, sx),
71
+ ...others,
72
+ children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.ErrorBoundary, {
73
+ FallbackComponent: _components.ErrorAlert,
74
+ children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_dashboardApp.DashboardApp, {
75
+ dashboardResource: dashboardResource
76
+ })
77
+ })
78
+ })
79
+ })
80
+ })
81
+ })
82
+ });
51
83
  }
52
- exports.ViewDashboard = ViewDashboard;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // Copyright 2022 The Perses Authors
3
2
  // Licensed under the Apache License, Version 2.0 (the "License");
4
3
  // you may not use this file except in compliance with the License.
@@ -11,19 +10,19 @@
11
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
11
  // See the License for the specific language governing permissions and
13
12
  // limitations under the License.
14
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
- if (k2 === undefined) k2 = k;
16
- var desc = Object.getOwnPropertyDescriptor(m, k);
17
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18
- desc = { enumerable: true, get: function() { return m[k]; } };
19
- }
20
- Object.defineProperty(o, k2, desc);
21
- }) : (function(o, m, k, k2) {
22
- if (k2 === undefined) k2 = k;
23
- o[k2] = m[k];
24
- }));
25
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- __exportStar(require("./ViewDashboard"), exports);
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ _exportStar(require("./ViewDashboard"), exports);
18
+ function _exportStar(from, to) {
19
+ Object.keys(from).forEach(function(k) {
20
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
21
+ enumerable: true,
22
+ get: function() {
23
+ return from[k];
24
+ }
25
+ });
26
+ });
27
+ return from;
28
+ }