@perses-dev/dashboards 0.7.1 → 0.8.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 +1 -1
- package/dist/cjs/components/DashboardToolbar.js +3 -18
- package/dist/cjs/components/GridLayout/GridItemContent.js +3 -3
- package/dist/cjs/components/GridLayout/GridLayout.js +6 -9
- package/dist/cjs/components/GridLayout/GridTitle.js +15 -9
- package/dist/cjs/components/Panel/Panel.js +11 -6
- package/dist/cjs/components/Panel/Panel.test.js +17 -13
- package/dist/cjs/components/Panel/PanelContent.js +15 -0
- package/dist/cjs/components/Panel/index.js +29 -0
- package/dist/cjs/components/PanelDrawer/PanelDrawer.js +124 -0
- package/dist/cjs/components/PanelDrawer/PanelDrawer.test.js +111 -0
- package/dist/cjs/components/PanelDrawer/PanelOptionsEditor.js +19 -0
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +60 -0
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.test.js +95 -0
- package/dist/cjs/components/{TimeRangeControls.js → TimeRangeControls/TimeRangeControls.js} +20 -31
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.test.js +51 -0
- package/dist/cjs/components/TimeRangeControls/index.js +29 -0
- package/dist/cjs/components/Variables/Variable.js +57 -0
- package/dist/cjs/components/Variables/VariableList.js +27 -0
- package/dist/cjs/components/{VariableList → Variables}/index.js +1 -0
- package/dist/cjs/components/index.js +2 -3
- package/dist/cjs/context/DashboardAppSlice.js +45 -0
- package/dist/cjs/context/DashboardProvider.js +54 -36
- package/dist/cjs/context/LayoutsSlice.js +42 -0
- package/dist/cjs/context/QueryStringProvider.js +35 -0
- package/dist/cjs/context/TemplateVariableProvider.js +216 -0
- package/dist/cjs/context/TimeRangeProvider.js +66 -0
- package/dist/cjs/context/index.js +6 -3
- package/dist/cjs/css/styles.js +173 -169
- package/dist/cjs/test/plugin-registry.js +24 -17
- package/dist/cjs/test/render.js +11 -2
- package/dist/cjs/test/testDashboard.js +14 -37
- package/dist/cjs/views/DashboardApp.js +4 -4
- package/dist/cjs/views/ViewDashboard.js +30 -2
- package/dist/cjs/views/index.js +1 -1
- package/dist/components/Dashboard.d.ts.map +1 -1
- package/dist/components/Dashboard.js +1 -1
- package/dist/components/DashboardToolbar.d.ts +0 -1
- package/dist/components/DashboardToolbar.d.ts.map +1 -1
- package/dist/components/DashboardToolbar.js +1 -1
- package/dist/components/GridLayout/GridItemContent.d.ts +1 -0
- package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
- package/dist/components/GridLayout/GridItemContent.js +1 -1
- package/dist/components/GridLayout/GridLayout.d.ts +2 -1
- package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
- package/dist/components/GridLayout/GridLayout.js +1 -1
- package/dist/components/GridLayout/GridTitle.d.ts +1 -0
- package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
- package/dist/components/GridLayout/GridTitle.js +1 -1
- package/dist/components/Panel/Panel.d.ts +2 -0
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/Panel.js +1 -1
- package/dist/components/Panel/Panel.test.d.ts.map +1 -1
- package/dist/components/Panel/Panel.test.js +1 -1
- package/dist/components/Panel/PanelContent.d.ts +11 -0
- package/dist/components/Panel/PanelContent.d.ts.map +1 -0
- package/dist/components/Panel/PanelContent.js +1 -0
- package/dist/components/Panel/index.d.ts +2 -0
- package/dist/components/Panel/index.d.ts.map +1 -0
- package/dist/components/Panel/index.js +1 -0
- package/dist/components/PanelDrawer/PanelDrawer.d.ts +4 -0
- package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -0
- package/dist/components/PanelDrawer/PanelDrawer.js +1 -0
- package/dist/components/PanelDrawer/PanelDrawer.test.d.ts +2 -0
- package/dist/components/PanelDrawer/PanelDrawer.test.d.ts.map +1 -0
- package/dist/components/PanelDrawer/PanelDrawer.test.js +1 -0
- package/dist/components/PanelDrawer/PanelOptionsEditor.d.ts +9 -0
- package/dist/components/PanelDrawer/PanelOptionsEditor.d.ts.map +1 -0
- package/dist/components/PanelDrawer/PanelOptionsEditor.js +1 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts +4 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js +1 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.d.ts +2 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.d.ts.map +1 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.test.js +1 -0
- package/dist/components/{TimeRangeControls.d.ts → TimeRangeControls/TimeRangeControls.d.ts} +0 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.js +1 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.test.d.ts +2 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.test.d.ts.map +1 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.test.js +1 -0
- package/dist/components/TimeRangeControls/index.d.ts +2 -0
- package/dist/components/TimeRangeControls/index.d.ts.map +1 -0
- package/dist/components/TimeRangeControls/index.js +1 -0
- package/dist/components/Variables/Variable.d.ts +8 -0
- package/dist/components/Variables/Variable.d.ts.map +1 -0
- package/dist/components/Variables/Variable.js +1 -0
- package/dist/components/Variables/VariableList.d.ts +3 -0
- package/dist/components/Variables/VariableList.d.ts.map +1 -0
- package/dist/components/Variables/VariableList.js +1 -0
- package/dist/components/Variables/index.d.ts +3 -0
- package/dist/components/Variables/index.d.ts.map +1 -0
- package/dist/components/Variables/index.js +1 -0
- package/dist/components/index.d.ts +2 -3
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/context/DashboardAppSlice.d.ts +26 -0
- package/dist/context/DashboardAppSlice.d.ts.map +1 -0
- package/dist/context/DashboardAppSlice.js +1 -0
- package/dist/context/DashboardProvider.d.ts +8 -19
- package/dist/context/DashboardProvider.d.ts.map +1 -1
- package/dist/context/DashboardProvider.js +1 -1
- package/dist/context/LayoutsSlice.d.ts +12 -0
- package/dist/context/LayoutsSlice.d.ts.map +1 -0
- package/dist/context/LayoutsSlice.js +1 -0
- package/dist/context/QueryStringProvider.d.ts +13 -0
- package/dist/context/QueryStringProvider.d.ts.map +1 -0
- package/dist/context/QueryStringProvider.js +1 -0
- package/dist/context/TemplateVariableProvider.d.ts +25 -0
- package/dist/context/TemplateVariableProvider.d.ts.map +1 -0
- package/dist/context/TemplateVariableProvider.js +1 -0
- package/dist/context/TimeRangeProvider.d.ts +12 -0
- package/dist/context/TimeRangeProvider.d.ts.map +1 -0
- package/dist/context/TimeRangeProvider.js +1 -0
- package/dist/context/index.d.ts +5 -2
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +1 -1
- package/dist/css/styles.d.ts +7 -7
- package/dist/css/styles.d.ts.map +1 -1
- package/dist/css/styles.js +1 -1
- package/dist/test/plugin-registry.d.ts +4 -2
- package/dist/test/plugin-registry.d.ts.map +1 -1
- package/dist/test/plugin-registry.js +1 -1
- package/dist/test/render.d.ts +2 -1
- package/dist/test/render.d.ts.map +1 -1
- package/dist/test/render.js +1 -1
- package/dist/test/testDashboard.d.ts.map +1 -1
- package/dist/test/testDashboard.js +1 -1
- package/dist/views/DashboardApp.js +1 -1
- package/dist/views/ViewDashboard.d.ts.map +1 -1
- package/dist/views/ViewDashboard.js +1 -1
- package/package.json +9 -11
- package/dist/cjs/components/AddPanel/AddPanel.js +0 -75
- package/dist/cjs/components/VariableAutocomplete.js +0 -63
- package/dist/cjs/components/VariableList/VariableList.js +0 -42
- package/dist/cjs/components/VariableList/VariableList.test.js +0 -86
- package/dist/cjs/context/TemplateVariablesProvider.js +0 -142
- package/dist/cjs/context/TimeRangeStateProvider.js +0 -49
- package/dist/components/AddPanel/AddPanel.d.ts +0 -8
- package/dist/components/AddPanel/AddPanel.d.ts.map +0 -1
- package/dist/components/AddPanel/AddPanel.js +0 -1
- package/dist/components/TimeRangeControls.d.ts.map +0 -1
- package/dist/components/TimeRangeControls.js +0 -1
- package/dist/components/VariableAutocomplete.d.ts +0 -21
- package/dist/components/VariableAutocomplete.d.ts.map +0 -1
- package/dist/components/VariableAutocomplete.js +0 -1
- package/dist/components/VariableList/VariableList.d.ts +0 -11
- package/dist/components/VariableList/VariableList.d.ts.map +0 -1
- package/dist/components/VariableList/VariableList.js +0 -1
- package/dist/components/VariableList/VariableList.test.d.ts +0 -2
- package/dist/components/VariableList/VariableList.test.d.ts.map +0 -1
- package/dist/components/VariableList/VariableList.test.js +0 -1
- package/dist/components/VariableList/index.d.ts +0 -2
- package/dist/components/VariableList/index.d.ts.map +0 -1
- package/dist/components/VariableList/index.js +0 -1
- package/dist/context/TemplateVariablesProvider.d.ts +0 -23
- package/dist/context/TemplateVariablesProvider.d.ts.map +0 -1
- package/dist/context/TemplateVariablesProvider.js +0 -1
- package/dist/context/TimeRangeStateProvider.d.ts +0 -22
- package/dist/context/TimeRangeStateProvider.d.ts.map +0 -1
- package/dist/context/TimeRangeStateProvider.js +0 -1
package/dist/cjs/css/styles.js
CHANGED
|
@@ -12,173 +12,177 @@
|
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
15
|
+
exports.styles = void 0;
|
|
16
|
+
const styles = (theme) => {
|
|
17
|
+
return {
|
|
18
|
+
'&.react-grid-layout': {
|
|
19
|
+
position: 'relative',
|
|
20
|
+
transition: 'height 200ms ease',
|
|
21
|
+
},
|
|
22
|
+
'&.react-grid-item': {
|
|
23
|
+
transition: 'all 200ms ease',
|
|
24
|
+
transitionProperty: 'left, top',
|
|
25
|
+
},
|
|
26
|
+
'&.react-grid-item img': {
|
|
27
|
+
pointerEvents: 'none',
|
|
28
|
+
userSelect: 'none',
|
|
29
|
+
},
|
|
30
|
+
'&.react-grid-item.cssTransforms': {
|
|
31
|
+
transitionProperty: 'transform',
|
|
32
|
+
},
|
|
33
|
+
'&.react-grid-item.resizing': {
|
|
34
|
+
zIndex: 1,
|
|
35
|
+
willChange: 'width, height',
|
|
36
|
+
},
|
|
37
|
+
'&.react-grid-item.react-draggable-dragging': {
|
|
38
|
+
transition: 'none',
|
|
39
|
+
zIndex: 3,
|
|
40
|
+
willChange: 'transform',
|
|
41
|
+
},
|
|
42
|
+
'&.react-grid-item.dropping': {
|
|
43
|
+
visibility: 'hidden',
|
|
44
|
+
},
|
|
45
|
+
'&.react-grid-item.react-grid-placeholder': {
|
|
46
|
+
background: theme.palette.primary.main,
|
|
47
|
+
opacity: 0.2,
|
|
48
|
+
transitionDuration: '100ms',
|
|
49
|
+
zIndex: 2,
|
|
50
|
+
userSelect: 'none',
|
|
51
|
+
WebkitUserSelect: 'none',
|
|
52
|
+
MozUserSelect: 'none',
|
|
53
|
+
msUserSelect: 'none',
|
|
54
|
+
OUserSelect: 'none',
|
|
55
|
+
},
|
|
56
|
+
'&.react-grid-item > .react-resizable-handle': {
|
|
57
|
+
position: 'absolute',
|
|
58
|
+
width: '20px',
|
|
59
|
+
height: '20px',
|
|
60
|
+
},
|
|
61
|
+
'&.react-grid-item > .react-resizable-handle::after': {
|
|
62
|
+
content: '""',
|
|
63
|
+
position: 'absolute',
|
|
64
|
+
right: '3px',
|
|
65
|
+
bottom: '3px',
|
|
66
|
+
width: '5px',
|
|
67
|
+
height: '5px',
|
|
68
|
+
borderRight: '2px solid rgba(0, 0, 0, 0.4)',
|
|
69
|
+
borderBottom: '2px solid rgba(0, 0, 0, 0.4)',
|
|
70
|
+
},
|
|
71
|
+
'&.react-resizable-hide > .react-resizable-handle': {
|
|
72
|
+
display: 'none',
|
|
73
|
+
},
|
|
74
|
+
'&.react-grid-item > .react-resizable-handle.react-resizable-handle-sw': {
|
|
75
|
+
bottom: '0',
|
|
76
|
+
left: '0',
|
|
77
|
+
cursor: 'sw-resize',
|
|
78
|
+
transform: 'rotate(90deg)',
|
|
79
|
+
},
|
|
80
|
+
'&.react-grid-item > .react-resizable-handle.react-resizable-handle-se': {
|
|
81
|
+
bottom: '0',
|
|
82
|
+
right: '0',
|
|
83
|
+
cursor: 'se-resize',
|
|
84
|
+
},
|
|
85
|
+
'&.react-grid-item > .react-resizable-handle.react-resizable-handle-nw': {
|
|
86
|
+
top: '0',
|
|
87
|
+
left: '0',
|
|
88
|
+
cursor: 'nw-resize',
|
|
89
|
+
transform: 'rotate(180deg)',
|
|
90
|
+
},
|
|
91
|
+
'&.react-grid-item > .react-resizable-handle.react-resizable-handle-ne': {
|
|
92
|
+
top: '0',
|
|
93
|
+
right: '0',
|
|
94
|
+
cursor: 'ne-resize',
|
|
95
|
+
transform: 'rotate(270deg)',
|
|
96
|
+
},
|
|
97
|
+
'&.react-grid-item > .react-resizable-handle.react-resizable-handle-w, &.react-grid-item > .react-resizable-handle.react-resizable-handle-e': {
|
|
98
|
+
top: '50%',
|
|
99
|
+
marginTop: '-10px',
|
|
100
|
+
cursor: 'ew-resize',
|
|
101
|
+
},
|
|
102
|
+
'&.react-grid-item > .react-resizable-handle.react-resizable-handle-w': {
|
|
103
|
+
left: '0',
|
|
104
|
+
transform: 'rotate(135deg)',
|
|
105
|
+
},
|
|
106
|
+
'&.react-grid-item > .react-resizable-handle.react-resizable-handle-e': {
|
|
107
|
+
right: '0',
|
|
108
|
+
transform: 'rotate(315deg)',
|
|
109
|
+
},
|
|
110
|
+
'&.react-grid-item > .react-resizable-handle.react-resizable-handle-n, &.react-grid-item > .react-resizable-handle.react-resizable-handle-s': {
|
|
111
|
+
left: '50%',
|
|
112
|
+
marginLeft: '-10px',
|
|
113
|
+
cursor: 'ns-resize',
|
|
114
|
+
},
|
|
115
|
+
'&.react-grid-item > .react-resizable-handle.react-resizable-handle-n': {
|
|
116
|
+
top: '0',
|
|
117
|
+
transform: 'rotate(225deg)',
|
|
118
|
+
},
|
|
119
|
+
'&.react-grid-item > .react-resizable-handle.react-resizable-handle-s': {
|
|
120
|
+
bottom: '0',
|
|
121
|
+
transform: 'rotate(45deg)',
|
|
122
|
+
},
|
|
123
|
+
'&.react-resizable': {
|
|
124
|
+
position: 'relative',
|
|
125
|
+
},
|
|
126
|
+
'&.react-resizable-handle': {
|
|
127
|
+
position: 'absolute',
|
|
128
|
+
width: '20px',
|
|
129
|
+
height: '20px',
|
|
130
|
+
backgroundRepeat: 'no-repeat',
|
|
131
|
+
backgroundOrigin: 'content-box',
|
|
132
|
+
boxSizing: 'border-box',
|
|
133
|
+
backgroundImage: `url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2IDYiIHN0eWxlPSJiYWNrZ3JvdW5kLWNvbG9yOiNmZmZmZmYwMCIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI2cHgiIGhlaWdodD0iNnB4Ij48ZyBvcGFjaXR5PSIwLjMwMiI+PHBhdGggZD0iTSA2IDYgTCAwIDYgTCAwIDQuMiBMIDQgNC4yIEwgNC4yIDQuMiBMIDQuMiAwIEwgNiAwIEwgNiA2IEwgNiA2IFoiIGZpbGw9IiMwMDAwMDAiLz48L2c+PC9zdmc+')`,
|
|
134
|
+
backgroundPosition: 'bottom right',
|
|
135
|
+
padding: '0 3px 3px 0',
|
|
136
|
+
},
|
|
137
|
+
'&.react-resizable-handle-sw': {
|
|
138
|
+
bottom: '0',
|
|
139
|
+
left: '0',
|
|
140
|
+
cursor: 'sw-resize',
|
|
141
|
+
transform: 'rotate(90deg)',
|
|
142
|
+
},
|
|
143
|
+
'&.react-resizable-handle-se': {
|
|
144
|
+
bottom: '0',
|
|
145
|
+
right: '0',
|
|
146
|
+
cursor: 'se-resize',
|
|
147
|
+
},
|
|
148
|
+
'&.react-resizable-handle-nw': {
|
|
149
|
+
top: '0',
|
|
150
|
+
left: '0',
|
|
151
|
+
cursor: 'nw-resize',
|
|
152
|
+
transform: 'rotate(180deg)',
|
|
153
|
+
},
|
|
154
|
+
'&.react-resizable-handle-ne': {
|
|
155
|
+
top: '0',
|
|
156
|
+
right: '0',
|
|
157
|
+
cursor: 'ne-resize',
|
|
158
|
+
transform: 'rotate(270deg)',
|
|
159
|
+
},
|
|
160
|
+
'&.react-resizable-handle-w, .react-resizable-handle-e': {
|
|
161
|
+
top: '50%',
|
|
162
|
+
marginTop: '-10px',
|
|
163
|
+
cursor: 'ew-resize',
|
|
164
|
+
},
|
|
165
|
+
'&.react-resizable-handle-w': {
|
|
166
|
+
left: '0',
|
|
167
|
+
transform: 'rotate(135deg)',
|
|
168
|
+
},
|
|
169
|
+
'&.react-resizable-handle-e': {
|
|
170
|
+
right: '0',
|
|
171
|
+
transform: 'rotate(315deg)',
|
|
172
|
+
},
|
|
173
|
+
'&.react-resizable-handle-n, .react-resizable-handle-s': {
|
|
174
|
+
left: '50%',
|
|
175
|
+
marginLeft: '-10px',
|
|
176
|
+
cursor: 'ns-resize',
|
|
177
|
+
},
|
|
178
|
+
'&.react-resizable-handle-n': {
|
|
179
|
+
top: '0',
|
|
180
|
+
transform: 'rotate(225deg)',
|
|
181
|
+
},
|
|
182
|
+
'&.react-resizable-handle-s': {
|
|
183
|
+
bottom: '0',
|
|
184
|
+
transform: 'rotate(45deg)',
|
|
185
|
+
},
|
|
186
|
+
};
|
|
184
187
|
};
|
|
188
|
+
exports.styles = styles;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mockPluginRegistryProps = void 0;
|
|
3
|
+
exports.FAKE_PANEL_PLUGIN = exports.mockPluginRegistryProps = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
5
|
/**
|
|
5
6
|
* Helper for mocking `PluginRegistry` data during tests. Returns props that can be spread on the `PluginRegistry`
|
|
6
7
|
* component so that it will load the mock plugins you setup. You can use the `addMockPlugin` function that's returned
|
|
@@ -8,29 +9,26 @@ exports.mockPluginRegistryProps = void 0;
|
|
|
8
9
|
*/
|
|
9
10
|
function mockPluginRegistryProps() {
|
|
10
11
|
const mockPluginResource = {
|
|
11
|
-
kind: '
|
|
12
|
+
kind: 'PluginModule',
|
|
12
13
|
metadata: {
|
|
13
|
-
name: 'Fake Plugin for Tests',
|
|
14
|
+
name: 'Fake Plugin Module for Tests',
|
|
14
15
|
},
|
|
15
16
|
spec: {
|
|
16
|
-
|
|
17
|
+
plugins: [],
|
|
17
18
|
},
|
|
18
19
|
};
|
|
20
|
+
const mockPluginModule = {};
|
|
19
21
|
// Allow adding mock plugins in tests
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const addMockPlugin = (pluginType, kind, plugin) => {
|
|
23
|
+
mockPluginResource.spec.plugins.push({
|
|
24
|
+
pluginType,
|
|
25
|
+
kind,
|
|
26
|
+
display: {
|
|
27
|
+
name: `Fake ${pluginType} Plugin for ${kind}`,
|
|
28
|
+
},
|
|
25
29
|
});
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const mockPluginModule = {
|
|
29
|
-
setup(registerPlugin) {
|
|
30
|
-
for (const setup of mockSetupFunctions) {
|
|
31
|
-
setup(registerPlugin);
|
|
32
|
-
}
|
|
33
|
-
},
|
|
30
|
+
// "Export" on the module under the same name as the kind the plugin handles
|
|
31
|
+
mockPluginModule[kind] = plugin;
|
|
34
32
|
};
|
|
35
33
|
const pluginRegistryProps = {
|
|
36
34
|
getInstalledPlugins() {
|
|
@@ -46,3 +44,12 @@ function mockPluginRegistryProps() {
|
|
|
46
44
|
};
|
|
47
45
|
}
|
|
48
46
|
exports.mockPluginRegistryProps = mockPluginRegistryProps;
|
|
47
|
+
exports.FAKE_PANEL_PLUGIN = {
|
|
48
|
+
PanelComponent: () => {
|
|
49
|
+
return (0, jsx_runtime_1.jsx)("div", { role: "figure", children: "FakePanel chart" });
|
|
50
|
+
},
|
|
51
|
+
OptionsEditorComponent: () => {
|
|
52
|
+
return (0, jsx_runtime_1.jsx)("div", { children: "Edit options here" });
|
|
53
|
+
},
|
|
54
|
+
createInitialOptions: () => ({}),
|
|
55
|
+
};
|
package/dist/cjs/test/render.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.renderWithContext = void 0;
|
|
4
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
@@ -16,11 +19,17 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
16
19
|
// limitations under the License.
|
|
17
20
|
const react_1 = require("@testing-library/react");
|
|
18
21
|
const react_query_1 = require("react-query");
|
|
22
|
+
const context_1 = require("../context");
|
|
23
|
+
const testDashboard_1 = __importDefault(require("./testDashboard"));
|
|
19
24
|
const queryClient = new react_query_1.QueryClient({ defaultOptions: { queries: { refetchOnWindowFocus: false } } });
|
|
25
|
+
const initialStore = {
|
|
26
|
+
isEditMode: true,
|
|
27
|
+
dashboardSpec: testDashboard_1.default.spec,
|
|
28
|
+
};
|
|
20
29
|
/**
|
|
21
30
|
* Test helper to render a React component with some common app-level providers wrapped around it.
|
|
22
31
|
*/
|
|
23
|
-
function renderWithContext(ui, options) {
|
|
24
|
-
return (0, react_1.render)((0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: ui }), options);
|
|
32
|
+
function renderWithContext(ui, initialState = initialStore, options) {
|
|
33
|
+
return (0, react_1.render)((0, jsx_runtime_1.jsx)(context_1.DashboardProvider, { initialState: initialState, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: ui }) }), options);
|
|
25
34
|
}
|
|
26
35
|
exports.renderWithContext = renderWithContext;
|
|
@@ -23,53 +23,30 @@ const testDashboard = {
|
|
|
23
23
|
},
|
|
24
24
|
spec: {
|
|
25
25
|
datasource: { kind: 'Prometheus', global: true, name: 'Public Prometheus Demo Server' },
|
|
26
|
-
// TODO: Should duration actually be a time range?
|
|
27
26
|
duration: '24h',
|
|
28
|
-
variables:
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
variables: [
|
|
28
|
+
{
|
|
29
|
+
name: 'job',
|
|
30
|
+
kind: 'TextVariable',
|
|
31
31
|
options: {
|
|
32
|
-
|
|
33
|
-
match: ['node_uname_info'],
|
|
34
|
-
},
|
|
35
|
-
display: {
|
|
36
|
-
label: 'Job',
|
|
37
|
-
},
|
|
38
|
-
selection: {
|
|
39
|
-
default_value: 'node',
|
|
32
|
+
value: 'node',
|
|
40
33
|
},
|
|
41
34
|
},
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
{
|
|
36
|
+
name: 'instance',
|
|
37
|
+
kind: 'TextVariable',
|
|
44
38
|
options: {
|
|
45
|
-
|
|
46
|
-
match: ['node_uname_info{job="node"}'],
|
|
47
|
-
},
|
|
48
|
-
display: {
|
|
49
|
-
label: 'Node',
|
|
50
|
-
},
|
|
51
|
-
selection: {
|
|
52
|
-
default_value: ['demo.do.prometheus.io:9100'],
|
|
53
|
-
all_value: '$__all',
|
|
39
|
+
value: 'demo.do.prometheus.io:9100',
|
|
54
40
|
},
|
|
55
41
|
},
|
|
56
|
-
|
|
57
|
-
|
|
42
|
+
{
|
|
43
|
+
name: 'interval',
|
|
44
|
+
kind: 'TextVariable',
|
|
58
45
|
options: {
|
|
59
|
-
|
|
60
|
-
auto: {
|
|
61
|
-
step_count: 50,
|
|
62
|
-
min_interval: '1m',
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
display: {
|
|
66
|
-
label: 'Interval',
|
|
67
|
-
},
|
|
68
|
-
selection: {
|
|
69
|
-
default_value: '1m',
|
|
46
|
+
value: '1m',
|
|
70
47
|
},
|
|
71
48
|
},
|
|
72
|
-
|
|
49
|
+
],
|
|
73
50
|
panels: {
|
|
74
51
|
cpu: {
|
|
75
52
|
kind: 'LineChart',
|
|
@@ -19,15 +19,15 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
19
19
|
// limitations under the License.
|
|
20
20
|
const material_1 = require("@mui/material");
|
|
21
21
|
const components_1 = require("@perses-dev/components");
|
|
22
|
-
const react_1 = require("react");
|
|
23
22
|
const components_2 = require("../components");
|
|
24
|
-
const
|
|
23
|
+
const PanelGroupDialog_1 = __importDefault(require("../components/PanelGroupDialog/PanelGroupDialog"));
|
|
24
|
+
const PanelDrawer_1 = __importDefault(require("../components/PanelDrawer/PanelDrawer"));
|
|
25
25
|
const DashboardToolbar_1 = require("../components/DashboardToolbar");
|
|
26
26
|
const context_1 = require("../context");
|
|
27
27
|
const DashboardApp = (props) => {
|
|
28
28
|
const { dashboardResource, sx, children, ...others } = props;
|
|
29
|
-
const [showAddPanel, setShowAddPanel] = (0, react_1.useState)(false);
|
|
30
29
|
const { dashboard } = (0, context_1.useDashboard)();
|
|
30
|
+
const { panelGroupDialog } = (0, context_1.useDashboardApp)();
|
|
31
31
|
return ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: (0, components_1.combineSx)({
|
|
32
32
|
display: 'flex',
|
|
33
33
|
width: '100%',
|
|
@@ -41,6 +41,6 @@ const DashboardApp = (props) => {
|
|
|
41
41
|
overflowY: 'auto',
|
|
42
42
|
display: 'flex',
|
|
43
43
|
flexDirection: 'column',
|
|
44
|
-
}, children: [(0, jsx_runtime_1.jsx)(DashboardToolbar_1.DashboardToolbar, { dashboardName: dashboardResource.metadata.name
|
|
44
|
+
}, children: [(0, jsx_runtime_1.jsx)(DashboardToolbar_1.DashboardToolbar, { dashboardName: dashboardResource.metadata.name }), (0, jsx_runtime_1.jsx)(components_2.TemplateVariableList, {}), (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, {}), children] }) }));
|
|
45
45
|
};
|
|
46
46
|
exports.DashboardApp = DashboardApp;
|
|
@@ -2,14 +2,42 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ViewDashboard = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
// Copyright 2021 The Perses Authors
|
|
6
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
// you may not use this file except in compliance with the License.
|
|
8
|
+
// You may obtain a copy of the License at
|
|
9
|
+
//
|
|
10
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
//
|
|
12
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
// See the License for the specific language governing permissions and
|
|
16
|
+
// limitations under the License.
|
|
17
|
+
const react_1 = require("react");
|
|
18
|
+
const core_1 = require("@perses-dev/core");
|
|
19
|
+
const plugin_system_1 = require("@perses-dev/plugin-system");
|
|
5
20
|
const context_1 = require("../context");
|
|
6
21
|
const DashboardApp_1 = require("./DashboardApp");
|
|
7
22
|
/**
|
|
8
23
|
* The View for displaying a Dashboard, along with the UI for selecting variable values.
|
|
9
24
|
*/
|
|
10
25
|
function ViewDashboard(props) {
|
|
26
|
+
var _a;
|
|
11
27
|
const { dashboardResource: { spec }, children, } = props;
|
|
12
|
-
const
|
|
13
|
-
|
|
28
|
+
const { queryString, setQueryString } = (0, plugin_system_1.useQueryString)();
|
|
29
|
+
const dashboardDuration = (_a = spec.duration) !== null && _a !== void 0 ? _a : '1h';
|
|
30
|
+
const defaultTimeRange = (0, core_1.getDefaultTimeRange)(dashboardDuration, queryString);
|
|
31
|
+
// TODO: add reusable sync query string or no-op util
|
|
32
|
+
(0, react_1.useEffect)(() => {
|
|
33
|
+
const currentParams = Object.fromEntries([...queryString]);
|
|
34
|
+
// if app does not provide query string implementation, setTimeRange is used instead
|
|
35
|
+
if (!currentParams.start && setQueryString) {
|
|
36
|
+
// default to duration in dashboard definition if start param is not already set
|
|
37
|
+
queryString.set('start', dashboardDuration);
|
|
38
|
+
setQueryString(queryString);
|
|
39
|
+
}
|
|
40
|
+
}, [dashboardDuration, queryString, setQueryString]);
|
|
41
|
+
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)(DashboardApp_1.DashboardApp, { ...props, children: children }) }) }) }));
|
|
14
42
|
}
|
|
15
43
|
exports.ViewDashboard = ViewDashboard;
|
package/dist/cjs/views/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright 2022 The Perses Authors
|
|
3
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
// you may not use this file except in compliance with the License.
|
|
5
5
|
// You may obtain a copy of the License at
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dashboard.d.ts","sourceRoot":"","sources":["../../src/components/Dashboard.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAO,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC9C,IAAI,EAAE,aAAa,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"Dashboard.d.ts","sourceRoot":"","sources":["../../src/components/Dashboard.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAO,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC9C,IAAI,EAAE,aAAa,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,eAmB9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{Box}from"@mui/material";import{ErrorBoundary,ErrorAlert}from"@perses-dev/components";import{GridLayout,GridItemContent}from"./GridLayout";export function Dashboard(r){const{spec:o,...t}=r;return _jsx(Box,{...t,children:_jsx(ErrorBoundary,{FallbackComponent:ErrorAlert,children:o.layouts.map(((r,t)=>_jsx(GridLayout,{definition:r,renderGridItemContent:r=>_jsx(GridItemContent,{content:r.content,spec:o})}
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{Box}from"@mui/material";import{ErrorBoundary,ErrorAlert}from"@perses-dev/components";import{GridLayout,GridItemContent}from"./GridLayout";export function Dashboard(r){const{spec:o,...t}=r;return _jsx(Box,{...t,children:_jsx(ErrorBoundary,{FallbackComponent:ErrorAlert,children:o.layouts.map(((r,t)=>_jsx(GridLayout,{groupIndex:t,definition:r,renderGridItemContent:(r,t)=>_jsx(GridItemContent,{content:r.content,spec:o,groupIndex:t})},`${JSON.stringify(o.layouts)} ${t}`)))})})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardToolbar.d.ts","sourceRoot":"","sources":["../../src/components/DashboardToolbar.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"DashboardToolbar.d.ts","sourceRoot":"","sources":["../../src/components/DashboardToolbar.tsx"],"names":[],"mappings":";AAmBA,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,gBAAgB,UAAW,qBAAqB,gBA2D5D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as _jsxs,jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import{Toolbar,Typography,Stack,Button,Box}from"@mui/material";import PencilIcon from"mdi-material-ui/PencilOutline";import AddIcon from"mdi-material-ui/Plus";import{useEditMode
|
|
1
|
+
import{jsxs as _jsxs,jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import{Toolbar,Typography,Stack,Button,Box}from"@mui/material";import PencilIcon from"mdi-material-ui/PencilOutline";import AddIcon from"mdi-material-ui/Plus";import{useDashboardApp,useEditMode}from"../context";import{TimeRangeControls}from"../components";export const DashboardToolbar=n=>{const{dashboardName:o}=n,{isEditMode:i,setEditMode:t}=useEditMode(),{openPanelDrawer:a,openPanelGroupDialog:s}=useDashboardApp();return _jsx(Toolbar,{disableGutters:!0,sx:{display:"block",padding:n=>n.spacing(2,0)},children:i?_jsxs(_Fragment,{children:[_jsxs(Box,{sx:{display:"flex",width:"100%"},children:[_jsxs(Typography,{variant:"h2",children:["Edit ",o]}),_jsxs(Stack,{direction:"row",spacing:1,sx:{marginLeft:"auto"},children:[_jsx(TimeRangeControls,{}),_jsx(Button,{variant:"outlined",onClick:()=>{t(!1)},children:"Cancel"}),_jsx(Button,{variant:"contained",children:"Save"})]})]}),_jsxs(Stack,{direction:"row",spacing:1,sx:{display:"flex",justifyContent:"flex-end",width:"100%",padding:n=>n.spacing(2,0)},children:[_jsx(Button,{startIcon:_jsx(AddIcon,{}),onClick:()=>s(),children:"Add Group"}),_jsx(Button,{startIcon:_jsx(AddIcon,{}),onClick:()=>a({groupIndex:0}),children:"Add Panel"})]})]}):_jsxs(Box,{sx:{display:"flex",width:"100%"},children:[_jsx(Typography,{variant:"h2",children:o}),_jsxs(Stack,{direction:"row",spacing:2,sx:{marginLeft:"auto"},children:[_jsx(TimeRangeControls,{}),_jsx(Button,{variant:"contained",startIcon:_jsx(PencilIcon,{}),onClick:()=>{t(!0)},sx:{marginLeft:"auto"},children:"Edit"})]})]})})};
|