@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.
- package/dist/cjs/components/Dashboard.js +29 -14
- package/dist/cjs/components/DashboardToolbar.js +148 -20
- package/dist/cjs/components/GridLayout/GridItemContent.js +24 -18
- package/dist/cjs/components/GridLayout/GridLayout.js +88 -26
- package/dist/cjs/components/GridLayout/GridTitle.js +69 -31
- package/dist/cjs/components/GridLayout/index.js +18 -19
- package/dist/cjs/components/Panel/Panel.js +145 -55
- package/dist/cjs/components/Panel/Panel.test.js +50 -41
- package/dist/cjs/components/Panel/PanelContent.js +40 -12
- package/dist/cjs/components/Panel/index.js +16 -17
- package/dist/cjs/components/PanelDrawer/PanelDrawer.js +82 -107
- package/dist/cjs/components/PanelDrawer/PanelDrawer.test.js +91 -92
- package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +152 -0
- package/dist/cjs/components/PanelDrawer/PanelSpecEditor.js +40 -0
- package/dist/cjs/components/PanelDrawer/PanelTypeSelect.js +38 -0
- package/dist/cjs/components/PanelDrawer/index.js +28 -0
- package/dist/cjs/components/PanelDrawer/panel-editor-model.js +140 -0
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +120 -31
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.test.js +90 -83
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +120 -38
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.test.js +42 -27
- package/dist/cjs/components/TimeRangeControls/index.js +16 -17
- package/dist/cjs/components/Variables/Variable.js +186 -35
- package/dist/cjs/components/Variables/VariableList.js +100 -13
- package/dist/cjs/components/Variables/index.js +17 -18
- package/dist/cjs/components/index.js +21 -21
- package/dist/cjs/context/DashboardAppSlice.js +43 -31
- package/dist/cjs/context/DashboardProvider.js +88 -58
- package/dist/cjs/context/DatasourceStoreProvider.js +68 -0
- package/dist/cjs/context/LayoutsSlice.js +40 -27
- package/dist/cjs/context/QueryStringProvider.js +69 -15
- package/dist/cjs/context/TemplateVariableProvider.js +128 -136
- package/dist/cjs/context/TimeRangeProvider.js +79 -30
- package/dist/cjs/context/index.js +22 -22
- package/dist/cjs/css/styles.js +43 -39
- package/dist/cjs/index.js +19 -20
- package/dist/cjs/test/dashboard-provider.js +51 -0
- package/dist/cjs/test/index.js +18 -18
- package/dist/cjs/test/plugin-registry.js +52 -25
- package/dist/cjs/test/render.js +25 -22
- package/dist/cjs/test/setup-tests.js +4 -2
- package/dist/cjs/test/testDashboard.js +193 -109
- package/dist/cjs/utils/functions.js +9 -5
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +67 -0
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +83 -0
- package/dist/cjs/views/ViewDashboard/index.js +28 -0
- package/dist/cjs/views/index.js +16 -17
- package/dist/components/Dashboard.js +38 -1
- package/dist/components/Dashboard.js.map +1 -0
- package/dist/components/DashboardToolbar.d.ts.map +1 -1
- package/dist/components/DashboardToolbar.js +154 -1
- package/dist/components/DashboardToolbar.js.map +1 -0
- package/dist/components/GridLayout/GridItemContent.js +35 -1
- package/dist/components/GridLayout/GridItemContent.js.map +1 -0
- package/dist/components/GridLayout/GridLayout.js +99 -1
- package/dist/components/GridLayout/GridLayout.js.map +1 -0
- package/dist/components/GridLayout/GridTitle.js +77 -1
- package/dist/components/GridLayout/GridTitle.js.map +1 -0
- package/dist/components/GridLayout/index.js +16 -1
- package/dist/components/GridLayout/index.js.map +1 -0
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/Panel.js +170 -1
- package/dist/components/Panel/Panel.js.map +1 -0
- package/dist/components/Panel/Panel.test.js +71 -1
- package/dist/components/Panel/Panel.test.js.map +1 -0
- package/dist/components/Panel/PanelContent.d.ts +2 -4
- package/dist/components/Panel/PanelContent.d.ts.map +1 -1
- package/dist/components/Panel/PanelContent.js +40 -1
- package/dist/components/Panel/PanelContent.js.map +1 -0
- package/dist/components/Panel/index.js +15 -1
- package/dist/components/Panel/index.js.map +1 -0
- package/dist/components/PanelDrawer/PanelDrawer.d.ts +4 -2
- package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.js +95 -1
- package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -0
- package/dist/components/PanelDrawer/PanelDrawer.test.js +103 -1
- package/dist/components/PanelDrawer/PanelDrawer.test.js.map +1 -0
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts +12 -0
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -0
- package/dist/components/PanelDrawer/PanelEditorForm.js +142 -0
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -0
- package/dist/components/PanelDrawer/PanelSpecEditor.d.ts +7 -0
- package/dist/components/PanelDrawer/PanelSpecEditor.d.ts.map +1 -0
- package/dist/components/PanelDrawer/PanelSpecEditor.js +34 -0
- package/dist/components/PanelDrawer/PanelSpecEditor.js.map +1 -0
- package/dist/components/PanelDrawer/PanelTypeSelect.d.ts +8 -0
- package/dist/components/PanelDrawer/PanelTypeSelect.d.ts.map +1 -0
- package/dist/components/PanelDrawer/PanelTypeSelect.js +34 -0
- package/dist/components/PanelDrawer/PanelTypeSelect.js.map +1 -0
- package/dist/components/PanelDrawer/index.d.ts +2 -0
- package/dist/components/PanelDrawer/index.d.ts.map +1 -0
- package/dist/components/PanelDrawer/index.js +15 -0
- package/dist/components/PanelDrawer/index.js.map +1 -0
- package/dist/components/PanelDrawer/panel-editor-model.d.ts +27 -0
- package/dist/components/PanelDrawer/panel-editor-model.d.ts.map +1 -0
- package/dist/components/PanelDrawer/panel-editor-model.js +133 -0
- package/dist/components/PanelDrawer/panel-editor-model.js.map +1 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js +138 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js +95 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js.map +1 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.js +137 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.test.js +59 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.test.js.map +1 -0
- package/dist/components/TimeRangeControls/index.js +15 -1
- package/dist/components/TimeRangeControls/index.js.map +1 -0
- package/dist/components/Variables/Variable.d.ts.map +1 -1
- package/dist/components/Variables/Variable.js +202 -1
- package/dist/components/Variables/Variable.js.map +1 -0
- package/dist/components/Variables/VariableList.js +108 -1
- package/dist/components/Variables/VariableList.js.map +1 -0
- package/dist/components/Variables/index.js +16 -1
- package/dist/components/Variables/index.js.map +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +20 -1
- package/dist/components/index.js.map +1 -0
- package/dist/context/DashboardAppSlice.js +45 -1
- package/dist/context/DashboardAppSlice.js.map +1 -0
- package/dist/context/DashboardProvider.d.ts +4 -2
- package/dist/context/DashboardProvider.d.ts.map +1 -1
- package/dist/context/DashboardProvider.js +107 -1
- package/dist/context/DashboardProvider.js.map +1 -0
- package/dist/context/DatasourceStoreProvider.d.ts +16 -0
- package/dist/context/DatasourceStoreProvider.d.ts.map +1 -0
- package/dist/context/DatasourceStoreProvider.js +64 -0
- package/dist/context/DatasourceStoreProvider.js.map +1 -0
- package/dist/context/LayoutsSlice.js +43 -1
- package/dist/context/LayoutsSlice.js.map +1 -0
- package/dist/context/QueryStringProvider.js +40 -1
- package/dist/context/QueryStringProvider.js.map +1 -0
- package/dist/context/TemplateVariableProvider.d.ts +6 -3
- package/dist/context/TemplateVariableProvider.d.ts.map +1 -1
- package/dist/context/TemplateVariableProvider.js +192 -1
- package/dist/context/TemplateVariableProvider.js.map +1 -0
- package/dist/context/TimeRangeProvider.js +72 -1
- package/dist/context/TimeRangeProvider.js.map +1 -0
- package/dist/context/index.d.ts +3 -2
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +21 -1
- package/dist/context/index.js.map +1 -0
- package/dist/css/styles.js +186 -1
- package/dist/css/styles.js.map +1 -0
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -0
- package/dist/test/dashboard-provider.d.ts +19 -0
- package/dist/test/dashboard-provider.d.ts.map +1 -0
- package/dist/test/dashboard-provider.js +40 -0
- package/dist/test/dashboard-provider.js.map +1 -0
- package/dist/test/index.d.ts +1 -0
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +17 -1
- package/dist/test/index.js.map +1 -0
- package/dist/test/plugin-registry.d.ts +2 -3
- package/dist/test/plugin-registry.d.ts.map +1 -1
- package/dist/test/plugin-registry.js +74 -1
- package/dist/test/plugin-registry.js.map +1 -0
- package/dist/test/render.d.ts +1 -2
- package/dist/test/render.d.ts.map +1 -1
- package/dist/test/render.js +34 -1
- package/dist/test/render.js.map +1 -0
- package/dist/test/setup-tests.js +18 -1
- package/dist/test/setup-tests.js.map +1 -0
- package/dist/test/testDashboard.d.ts.map +1 -1
- package/dist/test/testDashboard.js +274 -1
- package/dist/test/testDashboard.js.map +1 -0
- package/dist/utils/functions.js +17 -1
- package/dist/utils/functions.js.map +1 -0
- package/dist/views/ViewDashboard/DashboardApp.d.ts +7 -0
- package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -0
- package/dist/views/ViewDashboard/DashboardApp.js +56 -0
- package/dist/views/ViewDashboard/DashboardApp.js.map +1 -0
- package/dist/views/{ViewDashboard.d.ts → ViewDashboard/ViewDashboard.d.ts} +3 -1
- package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -0
- package/dist/views/ViewDashboard/ViewDashboard.js +79 -0
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -0
- package/dist/views/ViewDashboard/index.d.ts +2 -0
- package/dist/views/ViewDashboard/index.d.ts.map +1 -0
- package/dist/views/ViewDashboard/index.js +15 -0
- package/dist/views/ViewDashboard/index.js.map +1 -0
- package/dist/views/index.js +15 -1
- package/dist/views/index.js.map +1 -0
- package/package.json +13 -7
- package/dist/cjs/components/PanelDrawer/PanelOptionsEditor.js +0 -19
- package/dist/cjs/views/DashboardApp.js +0 -46
- package/dist/cjs/views/ViewDashboard.js +0 -43
- package/dist/components/PanelDrawer/PanelOptionsEditor.d.ts +0 -9
- package/dist/components/PanelDrawer/PanelOptionsEditor.d.ts.map +0 -1
- package/dist/components/PanelDrawer/PanelOptionsEditor.js +0 -1
- package/dist/views/DashboardApp.d.ts +0 -4
- package/dist/views/DashboardApp.d.ts.map +0 -1
- package/dist/views/DashboardApp.js +0 -1
- package/dist/views/ViewDashboard.d.ts.map +0 -1
- package/dist/views/ViewDashboard.js +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
spec: {
|
|
36
|
+
name: 'job',
|
|
37
|
+
value: 'node'
|
|
38
|
+
}
|
|
34
39
|
},
|
|
35
40
|
{
|
|
36
|
-
name: 'instance',
|
|
37
41
|
kind: 'TextVariable',
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
spec: {
|
|
50
|
+
name: 'interval',
|
|
51
|
+
value: '1m'
|
|
52
|
+
}
|
|
53
|
+
}
|
|
49
54
|
],
|
|
50
55
|
panels: {
|
|
51
56
|
cpu: {
|
|
52
|
-
kind: '
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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: '
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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: '
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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: '
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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: {
|
|
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: {
|
|
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: {
|
|
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: {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
270
|
+
content: {
|
|
271
|
+
$ref: '#/spec/panels/filesystemFullness'
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
]
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
]
|
|
278
|
+
}
|
|
195
279
|
};
|
|
196
|
-
|
|
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
|
-
|
|
15
|
-
exports
|
|
16
|
-
|
|
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
|
+
}
|
package/dist/cjs/views/index.js
CHANGED
|
@@ -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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Object.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
|
|
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
|
+
}
|