@perses-dev/dashboards 0.8.0 → 0.9.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 (196) hide show
  1. package/dist/cjs/components/Dashboard.js +29 -14
  2. package/dist/cjs/components/DashboardToolbar.js +148 -20
  3. package/dist/cjs/components/GridLayout/GridItemContent.js +24 -18
  4. package/dist/cjs/components/GridLayout/GridLayout.js +88 -26
  5. package/dist/cjs/components/GridLayout/GridTitle.js +69 -31
  6. package/dist/cjs/components/GridLayout/index.js +18 -19
  7. package/dist/cjs/components/Panel/Panel.js +145 -55
  8. package/dist/cjs/components/Panel/Panel.test.js +50 -41
  9. package/dist/cjs/components/Panel/PanelContent.js +40 -12
  10. package/dist/cjs/components/Panel/index.js +16 -17
  11. package/dist/cjs/components/PanelDrawer/PanelDrawer.js +82 -107
  12. package/dist/cjs/components/PanelDrawer/PanelDrawer.test.js +91 -92
  13. package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +152 -0
  14. package/dist/cjs/components/PanelDrawer/PanelSpecEditor.js +40 -0
  15. package/dist/cjs/components/PanelDrawer/PanelTypeSelect.js +38 -0
  16. package/dist/cjs/components/PanelDrawer/index.js +28 -0
  17. package/dist/cjs/components/PanelDrawer/panel-editor-model.js +140 -0
  18. package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +120 -31
  19. package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.test.js +90 -83
  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 +186 -35
  24. package/dist/cjs/components/Variables/VariableList.js +100 -13
  25. package/dist/cjs/components/Variables/index.js +17 -18
  26. package/dist/cjs/components/index.js +21 -21
  27. package/dist/cjs/context/DashboardAppSlice.js +43 -31
  28. package/dist/cjs/context/DashboardProvider.js +88 -58
  29. package/dist/cjs/context/DatasourceStoreProvider.js +68 -0
  30. package/dist/cjs/context/LayoutsSlice.js +40 -27
  31. package/dist/cjs/context/QueryStringProvider.js +69 -15
  32. package/dist/cjs/context/TemplateVariableProvider.js +128 -136
  33. package/dist/cjs/context/TimeRangeProvider.js +79 -30
  34. package/dist/cjs/context/index.js +22 -22
  35. package/dist/cjs/css/styles.js +43 -39
  36. package/dist/cjs/index.js +19 -20
  37. package/dist/cjs/test/dashboard-provider.js +51 -0
  38. package/dist/cjs/test/index.js +18 -18
  39. package/dist/cjs/test/plugin-registry.js +52 -25
  40. package/dist/cjs/test/render.js +25 -22
  41. package/dist/cjs/test/setup-tests.js +4 -2
  42. package/dist/cjs/test/testDashboard.js +193 -109
  43. package/dist/cjs/utils/functions.js +9 -5
  44. package/dist/cjs/views/ViewDashboard/DashboardApp.js +67 -0
  45. package/dist/cjs/views/ViewDashboard/ViewDashboard.js +83 -0
  46. package/dist/cjs/views/ViewDashboard/index.js +28 -0
  47. package/dist/cjs/views/index.js +16 -17
  48. package/dist/components/Dashboard.js +38 -1
  49. package/dist/components/Dashboard.js.map +1 -0
  50. package/dist/components/DashboardToolbar.d.ts.map +1 -1
  51. package/dist/components/DashboardToolbar.js +154 -1
  52. package/dist/components/DashboardToolbar.js.map +1 -0
  53. package/dist/components/GridLayout/GridItemContent.js +35 -1
  54. package/dist/components/GridLayout/GridItemContent.js.map +1 -0
  55. package/dist/components/GridLayout/GridLayout.js +99 -1
  56. package/dist/components/GridLayout/GridLayout.js.map +1 -0
  57. package/dist/components/GridLayout/GridTitle.js +77 -1
  58. package/dist/components/GridLayout/GridTitle.js.map +1 -0
  59. package/dist/components/GridLayout/index.js +16 -1
  60. package/dist/components/GridLayout/index.js.map +1 -0
  61. package/dist/components/Panel/Panel.d.ts.map +1 -1
  62. package/dist/components/Panel/Panel.js +170 -1
  63. package/dist/components/Panel/Panel.js.map +1 -0
  64. package/dist/components/Panel/Panel.test.js +71 -1
  65. package/dist/components/Panel/Panel.test.js.map +1 -0
  66. package/dist/components/Panel/PanelContent.d.ts +2 -4
  67. package/dist/components/Panel/PanelContent.d.ts.map +1 -1
  68. package/dist/components/Panel/PanelContent.js +40 -1
  69. package/dist/components/Panel/PanelContent.js.map +1 -0
  70. package/dist/components/Panel/index.js +15 -1
  71. package/dist/components/Panel/index.js.map +1 -0
  72. package/dist/components/PanelDrawer/PanelDrawer.d.ts +4 -2
  73. package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
  74. package/dist/components/PanelDrawer/PanelDrawer.js +95 -1
  75. package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -0
  76. package/dist/components/PanelDrawer/PanelDrawer.test.js +103 -1
  77. package/dist/components/PanelDrawer/PanelDrawer.test.js.map +1 -0
  78. package/dist/components/PanelDrawer/PanelEditorForm.d.ts +12 -0
  79. package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -0
  80. package/dist/components/PanelDrawer/PanelEditorForm.js +142 -0
  81. package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -0
  82. package/dist/components/PanelDrawer/PanelSpecEditor.d.ts +7 -0
  83. package/dist/components/PanelDrawer/PanelSpecEditor.d.ts.map +1 -0
  84. package/dist/components/PanelDrawer/PanelSpecEditor.js +34 -0
  85. package/dist/components/PanelDrawer/PanelSpecEditor.js.map +1 -0
  86. package/dist/components/PanelDrawer/PanelTypeSelect.d.ts +8 -0
  87. package/dist/components/PanelDrawer/PanelTypeSelect.d.ts.map +1 -0
  88. package/dist/components/PanelDrawer/PanelTypeSelect.js +34 -0
  89. package/dist/components/PanelDrawer/PanelTypeSelect.js.map +1 -0
  90. package/dist/components/PanelDrawer/index.d.ts +2 -0
  91. package/dist/components/PanelDrawer/index.d.ts.map +1 -0
  92. package/dist/components/PanelDrawer/index.js +15 -0
  93. package/dist/components/PanelDrawer/index.js.map +1 -0
  94. package/dist/components/PanelDrawer/panel-editor-model.d.ts +27 -0
  95. package/dist/components/PanelDrawer/panel-editor-model.d.ts.map +1 -0
  96. package/dist/components/PanelDrawer/panel-editor-model.js +133 -0
  97. package/dist/components/PanelDrawer/panel-editor-model.js.map +1 -0
  98. package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
  99. package/dist/components/PanelGroupDialog/PanelGroupDialog.js +138 -1
  100. package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -0
  101. package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js +95 -1
  102. package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js.map +1 -0
  103. package/dist/components/TimeRangeControls/TimeRangeControls.js +137 -1
  104. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -0
  105. package/dist/components/TimeRangeControls/TimeRangeControls.test.js +59 -1
  106. package/dist/components/TimeRangeControls/TimeRangeControls.test.js.map +1 -0
  107. package/dist/components/TimeRangeControls/index.js +15 -1
  108. package/dist/components/TimeRangeControls/index.js.map +1 -0
  109. package/dist/components/Variables/Variable.d.ts.map +1 -1
  110. package/dist/components/Variables/Variable.js +202 -1
  111. package/dist/components/Variables/Variable.js.map +1 -0
  112. package/dist/components/Variables/VariableList.js +108 -1
  113. package/dist/components/Variables/VariableList.js.map +1 -0
  114. package/dist/components/Variables/index.js +16 -1
  115. package/dist/components/Variables/index.js.map +1 -0
  116. package/dist/components/index.d.ts +1 -0
  117. package/dist/components/index.d.ts.map +1 -1
  118. package/dist/components/index.js +20 -1
  119. package/dist/components/index.js.map +1 -0
  120. package/dist/context/DashboardAppSlice.js +45 -1
  121. package/dist/context/DashboardAppSlice.js.map +1 -0
  122. package/dist/context/DashboardProvider.d.ts +4 -2
  123. package/dist/context/DashboardProvider.d.ts.map +1 -1
  124. package/dist/context/DashboardProvider.js +107 -1
  125. package/dist/context/DashboardProvider.js.map +1 -0
  126. package/dist/context/DatasourceStoreProvider.d.ts +16 -0
  127. package/dist/context/DatasourceStoreProvider.d.ts.map +1 -0
  128. package/dist/context/DatasourceStoreProvider.js +64 -0
  129. package/dist/context/DatasourceStoreProvider.js.map +1 -0
  130. package/dist/context/LayoutsSlice.js +43 -1
  131. package/dist/context/LayoutsSlice.js.map +1 -0
  132. package/dist/context/QueryStringProvider.js +40 -1
  133. package/dist/context/QueryStringProvider.js.map +1 -0
  134. package/dist/context/TemplateVariableProvider.d.ts +6 -3
  135. package/dist/context/TemplateVariableProvider.d.ts.map +1 -1
  136. package/dist/context/TemplateVariableProvider.js +192 -1
  137. package/dist/context/TemplateVariableProvider.js.map +1 -0
  138. package/dist/context/TimeRangeProvider.js +72 -1
  139. package/dist/context/TimeRangeProvider.js.map +1 -0
  140. package/dist/context/index.d.ts +3 -2
  141. package/dist/context/index.d.ts.map +1 -1
  142. package/dist/context/index.js +21 -1
  143. package/dist/context/index.js.map +1 -0
  144. package/dist/css/styles.js +186 -1
  145. package/dist/css/styles.js.map +1 -0
  146. package/dist/index.js +17 -1
  147. package/dist/index.js.map +1 -0
  148. package/dist/test/dashboard-provider.d.ts +19 -0
  149. package/dist/test/dashboard-provider.d.ts.map +1 -0
  150. package/dist/test/dashboard-provider.js +40 -0
  151. package/dist/test/dashboard-provider.js.map +1 -0
  152. package/dist/test/index.d.ts +1 -0
  153. package/dist/test/index.d.ts.map +1 -1
  154. package/dist/test/index.js +17 -1
  155. package/dist/test/index.js.map +1 -0
  156. package/dist/test/plugin-registry.d.ts +2 -3
  157. package/dist/test/plugin-registry.d.ts.map +1 -1
  158. package/dist/test/plugin-registry.js +74 -1
  159. package/dist/test/plugin-registry.js.map +1 -0
  160. package/dist/test/render.d.ts +1 -2
  161. package/dist/test/render.d.ts.map +1 -1
  162. package/dist/test/render.js +34 -1
  163. package/dist/test/render.js.map +1 -0
  164. package/dist/test/setup-tests.js +18 -1
  165. package/dist/test/setup-tests.js.map +1 -0
  166. package/dist/test/testDashboard.d.ts.map +1 -1
  167. package/dist/test/testDashboard.js +274 -1
  168. package/dist/test/testDashboard.js.map +1 -0
  169. package/dist/utils/functions.js +17 -1
  170. package/dist/utils/functions.js.map +1 -0
  171. package/dist/views/ViewDashboard/DashboardApp.d.ts +7 -0
  172. package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -0
  173. package/dist/views/ViewDashboard/DashboardApp.js +56 -0
  174. package/dist/views/ViewDashboard/DashboardApp.js.map +1 -0
  175. package/dist/views/{ViewDashboard.d.ts → ViewDashboard/ViewDashboard.d.ts} +3 -1
  176. package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -0
  177. package/dist/views/ViewDashboard/ViewDashboard.js +79 -0
  178. package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -0
  179. package/dist/views/ViewDashboard/index.d.ts +2 -0
  180. package/dist/views/ViewDashboard/index.d.ts.map +1 -0
  181. package/dist/views/ViewDashboard/index.js +15 -0
  182. package/dist/views/ViewDashboard/index.js.map +1 -0
  183. package/dist/views/index.js +15 -1
  184. package/dist/views/index.js.map +1 -0
  185. package/package.json +13 -7
  186. package/dist/cjs/components/PanelDrawer/PanelOptionsEditor.js +0 -19
  187. package/dist/cjs/views/DashboardApp.js +0 -46
  188. package/dist/cjs/views/ViewDashboard.js +0 -43
  189. package/dist/components/PanelDrawer/PanelOptionsEditor.d.ts +0 -9
  190. package/dist/components/PanelDrawer/PanelOptionsEditor.d.ts.map +0 -1
  191. package/dist/components/PanelDrawer/PanelOptionsEditor.js +0 -1
  192. package/dist/views/DashboardApp.d.ts +0 -4
  193. package/dist/views/DashboardApp.d.ts.map +0 -1
  194. package/dist/views/DashboardApp.js +0 -1
  195. package/dist/views/ViewDashboard.d.ts.map +0 -1
  196. package/dist/views/ViewDashboard.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
@@ -133,7 +209,7 @@ const testDashboard = {
133
209
  kind: 'Grid',
134
210
  spec: {
135
211
  display: {
136
- title: 'CPU Stats',
212
+ title: 'CPU Stats'
137
213
  },
138
214
  items: [
139
215
  // First Row
@@ -142,10 +218,12 @@ const testDashboard = {
142
218
  y: 0,
143
219
  width: 12,
144
220
  height: 4,
145
- content: { $ref: '#/spec/panels/cpu' },
146
- },
147
- ],
148
- },
221
+ content: {
222
+ $ref: '#/spec/panels/cpu'
223
+ }
224
+ }
225
+ ]
226
+ }
149
227
  },
150
228
  // No title,
151
229
  {
@@ -157,10 +235,12 @@ const testDashboard = {
157
235
  y: 0,
158
236
  width: 8,
159
237
  height: 3,
160
- content: { $ref: '#/spec/panels/memory' },
161
- },
162
- ],
163
- },
238
+ content: {
239
+ $ref: '#/spec/panels/memory'
240
+ }
241
+ }
242
+ ]
243
+ }
164
244
  },
165
245
  // Collapsed
166
246
  {
@@ -169,8 +249,8 @@ const testDashboard = {
169
249
  display: {
170
250
  title: 'Disk Stats',
171
251
  collapse: {
172
- open: false,
173
- },
252
+ open: false
253
+ }
174
254
  },
175
255
  items: [
176
256
  {
@@ -178,19 +258,23 @@ const testDashboard = {
178
258
  y: 0,
179
259
  width: 6,
180
260
  height: 2,
181
- content: { $ref: '#/spec/panels/diskIO' },
261
+ content: {
262
+ $ref: '#/spec/panels/diskIO'
263
+ }
182
264
  },
183
265
  {
184
266
  x: 18,
185
267
  y: 0,
186
268
  width: 6,
187
269
  height: 2,
188
- content: { $ref: '#/spec/panels/filesystemFullness' },
189
- },
190
- ],
191
- },
192
- },
193
- ],
194
- },
270
+ content: {
271
+ $ref: '#/spec/panels/filesystemFullness'
272
+ }
273
+ }
274
+ ]
275
+ }
276
+ }
277
+ ]
278
+ }
195
279
  };
196
- exports.default = testDashboard;
280
+ 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;
@@ -0,0 +1,67 @@
1
+ // Copyright 2022 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "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 _context = require("../../context");
28
+ function _interopRequireDefault(obj) {
29
+ return obj && obj.__esModule ? obj : {
30
+ default: obj
31
+ };
32
+ }
33
+ const DashboardApp = (props)=>{
34
+ const { dashboardResource } = props;
35
+ const { dashboard } = (0, _context.useDashboard)();
36
+ const { panelGroupDialog } = (0, _context.useDashboardApp)();
37
+ return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Box, {
38
+ sx: {
39
+ padding: (theme)=>theme.spacing(1, 0),
40
+ flexGrow: 1,
41
+ overflowX: 'hidden',
42
+ overflowY: 'auto',
43
+ display: 'flex',
44
+ flexDirection: 'column'
45
+ },
46
+ children: [
47
+ /*#__PURE__*/ (0, _jsxRuntime.jsx)(_dashboardToolbar.DashboardToolbar, {
48
+ dashboardName: dashboardResource.metadata.name
49
+ }),
50
+ /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Box, {
51
+ sx: {
52
+ padding: (theme)=>theme.spacing(2)
53
+ },
54
+ children: [
55
+ /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.ErrorBoundary, {
56
+ FallbackComponent: _components.ErrorAlert,
57
+ children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components1.Dashboard, {
58
+ spec: dashboard
59
+ })
60
+ }),
61
+ /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components1.PanelDrawer, {}),
62
+ panelGroupDialog && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_panelGroupDialog.default, {})
63
+ ]
64
+ })
65
+ ]
66
+ });
67
+ };
@@ -0,0 +1,83 @@
1
+ // Copyright 2022 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "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");
29
+ function ViewDashboard(props) {
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);
36
+ // TODO: add reusable sync query string or no-op util
37
+ (0, _react.useEffect)(()=>{
38
+ const currentParams = Object.fromEntries([
39
+ ...queryString
40
+ ]);
41
+ // if app does not provide query string implementation, setTimeRange is used instead
42
+ if (!currentParams.start && setQueryString) {
43
+ // default to duration in dashboard definition if start param is not already set
44
+ queryString.set('start', dashboardDuration);
45
+ setQueryString(queryString);
46
+ }
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
+ });
83
+ }
@@ -0,0 +1,28 @@
1
+ // Copyright 2022 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ _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
+ }
@@ -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
+ }