@perses-dev/dashboards 0.8.1 → 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 (186) 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 +50 -23
  45. package/dist/cjs/views/ViewDashboard/ViewDashboard.js +62 -31
  46. package/dist/cjs/views/ViewDashboard/index.js +16 -17
  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.map +1 -1
  172. package/dist/views/ViewDashboard/DashboardApp.js +56 -1
  173. package/dist/views/ViewDashboard/DashboardApp.js.map +1 -0
  174. package/dist/views/ViewDashboard/ViewDashboard.d.ts +2 -0
  175. package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
  176. package/dist/views/ViewDashboard/ViewDashboard.js +79 -1
  177. package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -0
  178. package/dist/views/ViewDashboard/index.js +15 -1
  179. package/dist/views/ViewDashboard/index.js.map +1 -0
  180. package/dist/views/index.js +15 -1
  181. package/dist/views/index.js.map +1 -0
  182. package/package.json +13 -7
  183. package/dist/cjs/components/PanelDrawer/PanelOptionsEditor.js +0 -19
  184. package/dist/components/PanelDrawer/PanelOptionsEditor.d.ts +0 -9
  185. package/dist/components/PanelDrawer/PanelOptionsEditor.d.ts.map +0 -1
  186. package/dist/components/PanelDrawer/PanelOptionsEditor.js +0 -1
@@ -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,36 +10,42 @@
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.styles = void 0;
16
- const styles = (theme) => {
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "styles", {
18
+ enumerable: true,
19
+ get: ()=>styles
20
+ });
21
+ const styles = (theme)=>{
17
22
  return {
18
23
  '&.react-grid-layout': {
19
24
  position: 'relative',
20
- transition: 'height 200ms ease',
25
+ transition: 'height 200ms ease'
21
26
  },
22
27
  '&.react-grid-item': {
23
28
  transition: 'all 200ms ease',
24
- transitionProperty: 'left, top',
29
+ transitionProperty: 'left, top'
25
30
  },
26
31
  '&.react-grid-item img': {
27
32
  pointerEvents: 'none',
28
- userSelect: 'none',
33
+ userSelect: 'none'
29
34
  },
30
35
  '&.react-grid-item.cssTransforms': {
31
- transitionProperty: 'transform',
36
+ transitionProperty: 'transform'
32
37
  },
33
38
  '&.react-grid-item.resizing': {
34
39
  zIndex: 1,
35
- willChange: 'width, height',
40
+ willChange: 'width, height'
36
41
  },
37
42
  '&.react-grid-item.react-draggable-dragging': {
38
43
  transition: 'none',
39
44
  zIndex: 3,
40
- willChange: 'transform',
45
+ willChange: 'transform'
41
46
  },
42
47
  '&.react-grid-item.dropping': {
43
- visibility: 'hidden',
48
+ visibility: 'hidden'
44
49
  },
45
50
  '&.react-grid-item.react-grid-placeholder': {
46
51
  background: theme.palette.primary.main,
@@ -51,12 +56,12 @@ const styles = (theme) => {
51
56
  WebkitUserSelect: 'none',
52
57
  MozUserSelect: 'none',
53
58
  msUserSelect: 'none',
54
- OUserSelect: 'none',
59
+ OUserSelect: 'none'
55
60
  },
56
61
  '&.react-grid-item > .react-resizable-handle': {
57
62
  position: 'absolute',
58
63
  width: '20px',
59
- height: '20px',
64
+ height: '20px'
60
65
  },
61
66
  '&.react-grid-item > .react-resizable-handle::after': {
62
67
  content: '""',
@@ -66,62 +71,62 @@ const styles = (theme) => {
66
71
  width: '5px',
67
72
  height: '5px',
68
73
  borderRight: '2px solid rgba(0, 0, 0, 0.4)',
69
- borderBottom: '2px solid rgba(0, 0, 0, 0.4)',
74
+ borderBottom: '2px solid rgba(0, 0, 0, 0.4)'
70
75
  },
71
76
  '&.react-resizable-hide > .react-resizable-handle': {
72
- display: 'none',
77
+ display: 'none'
73
78
  },
74
79
  '&.react-grid-item > .react-resizable-handle.react-resizable-handle-sw': {
75
80
  bottom: '0',
76
81
  left: '0',
77
82
  cursor: 'sw-resize',
78
- transform: 'rotate(90deg)',
83
+ transform: 'rotate(90deg)'
79
84
  },
80
85
  '&.react-grid-item > .react-resizable-handle.react-resizable-handle-se': {
81
86
  bottom: '0',
82
87
  right: '0',
83
- cursor: 'se-resize',
88
+ cursor: 'se-resize'
84
89
  },
85
90
  '&.react-grid-item > .react-resizable-handle.react-resizable-handle-nw': {
86
91
  top: '0',
87
92
  left: '0',
88
93
  cursor: 'nw-resize',
89
- transform: 'rotate(180deg)',
94
+ transform: 'rotate(180deg)'
90
95
  },
91
96
  '&.react-grid-item > .react-resizable-handle.react-resizable-handle-ne': {
92
97
  top: '0',
93
98
  right: '0',
94
99
  cursor: 'ne-resize',
95
- transform: 'rotate(270deg)',
100
+ transform: 'rotate(270deg)'
96
101
  },
97
102
  '&.react-grid-item > .react-resizable-handle.react-resizable-handle-w, &.react-grid-item > .react-resizable-handle.react-resizable-handle-e': {
98
103
  top: '50%',
99
104
  marginTop: '-10px',
100
- cursor: 'ew-resize',
105
+ cursor: 'ew-resize'
101
106
  },
102
107
  '&.react-grid-item > .react-resizable-handle.react-resizable-handle-w': {
103
108
  left: '0',
104
- transform: 'rotate(135deg)',
109
+ transform: 'rotate(135deg)'
105
110
  },
106
111
  '&.react-grid-item > .react-resizable-handle.react-resizable-handle-e': {
107
112
  right: '0',
108
- transform: 'rotate(315deg)',
113
+ transform: 'rotate(315deg)'
109
114
  },
110
115
  '&.react-grid-item > .react-resizable-handle.react-resizable-handle-n, &.react-grid-item > .react-resizable-handle.react-resizable-handle-s': {
111
116
  left: '50%',
112
117
  marginLeft: '-10px',
113
- cursor: 'ns-resize',
118
+ cursor: 'ns-resize'
114
119
  },
115
120
  '&.react-grid-item > .react-resizable-handle.react-resizable-handle-n': {
116
121
  top: '0',
117
- transform: 'rotate(225deg)',
122
+ transform: 'rotate(225deg)'
118
123
  },
119
124
  '&.react-grid-item > .react-resizable-handle.react-resizable-handle-s': {
120
125
  bottom: '0',
121
- transform: 'rotate(45deg)',
126
+ transform: 'rotate(45deg)'
122
127
  },
123
128
  '&.react-resizable': {
124
- position: 'relative',
129
+ position: 'relative'
125
130
  },
126
131
  '&.react-resizable-handle': {
127
132
  position: 'absolute',
@@ -132,57 +137,56 @@ const styles = (theme) => {
132
137
  boxSizing: 'border-box',
133
138
  backgroundImage: `url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2IDYiIHN0eWxlPSJiYWNrZ3JvdW5kLWNvbG9yOiNmZmZmZmYwMCIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI2cHgiIGhlaWdodD0iNnB4Ij48ZyBvcGFjaXR5PSIwLjMwMiI+PHBhdGggZD0iTSA2IDYgTCAwIDYgTCAwIDQuMiBMIDQgNC4yIEwgNC4yIDQuMiBMIDQuMiAwIEwgNiAwIEwgNiA2IEwgNiA2IFoiIGZpbGw9IiMwMDAwMDAiLz48L2c+PC9zdmc+')`,
134
139
  backgroundPosition: 'bottom right',
135
- padding: '0 3px 3px 0',
140
+ padding: '0 3px 3px 0'
136
141
  },
137
142
  '&.react-resizable-handle-sw': {
138
143
  bottom: '0',
139
144
  left: '0',
140
145
  cursor: 'sw-resize',
141
- transform: 'rotate(90deg)',
146
+ transform: 'rotate(90deg)'
142
147
  },
143
148
  '&.react-resizable-handle-se': {
144
149
  bottom: '0',
145
150
  right: '0',
146
- cursor: 'se-resize',
151
+ cursor: 'se-resize'
147
152
  },
148
153
  '&.react-resizable-handle-nw': {
149
154
  top: '0',
150
155
  left: '0',
151
156
  cursor: 'nw-resize',
152
- transform: 'rotate(180deg)',
157
+ transform: 'rotate(180deg)'
153
158
  },
154
159
  '&.react-resizable-handle-ne': {
155
160
  top: '0',
156
161
  right: '0',
157
162
  cursor: 'ne-resize',
158
- transform: 'rotate(270deg)',
163
+ transform: 'rotate(270deg)'
159
164
  },
160
165
  '&.react-resizable-handle-w, .react-resizable-handle-e': {
161
166
  top: '50%',
162
167
  marginTop: '-10px',
163
- cursor: 'ew-resize',
168
+ cursor: 'ew-resize'
164
169
  },
165
170
  '&.react-resizable-handle-w': {
166
171
  left: '0',
167
- transform: 'rotate(135deg)',
172
+ transform: 'rotate(135deg)'
168
173
  },
169
174
  '&.react-resizable-handle-e': {
170
175
  right: '0',
171
- transform: 'rotate(315deg)',
176
+ transform: 'rotate(315deg)'
172
177
  },
173
178
  '&.react-resizable-handle-n, .react-resizable-handle-s': {
174
179
  left: '50%',
175
180
  marginLeft: '-10px',
176
- cursor: 'ns-resize',
181
+ cursor: 'ns-resize'
177
182
  },
178
183
  '&.react-resizable-handle-n': {
179
184
  top: '0',
180
- transform: 'rotate(225deg)',
185
+ transform: 'rotate(225deg)'
181
186
  },
182
187
  '&.react-resizable-handle-s': {
183
188
  bottom: '0',
184
- transform: 'rotate(45deg)',
185
- },
189
+ transform: 'rotate(45deg)'
190
+ }
186
191
  };
187
192
  };
188
- exports.styles = styles;
package/dist/cjs/index.js CHANGED
@@ -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,21 +10,21 @@
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("./components"), exports);
30
- __exportStar(require("./context"), exports);
31
- __exportStar(require("./views"), exports);
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ _exportStar(require("./components"), exports);
18
+ _exportStar(require("./context"), exports);
19
+ _exportStar(require("./views"), exports);
20
+ function _exportStar(from, to) {
21
+ Object.keys(from).forEach(function(k) {
22
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
23
+ enumerable: true,
24
+ get: function() {
25
+ return from[k];
26
+ }
27
+ });
28
+ });
29
+ return from;
30
+ }
@@ -0,0 +1,51 @@
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
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ getTestDashboard: ()=>getTestDashboard,
25
+ createDashboardProviderSpy: ()=>createDashboardProviderSpy
26
+ });
27
+ const _react = require("react");
28
+ const _context = require("../context");
29
+ const _testDashboard = /*#__PURE__*/ _interopRequireDefault(require("./testDashboard"));
30
+ function _interopRequireDefault(obj) {
31
+ return obj && obj.__esModule ? obj : {
32
+ default: obj
33
+ };
34
+ }
35
+ function getTestDashboard() {
36
+ // TODO: Should we be cloning this to create a new object each time?
37
+ return _testDashboard.default;
38
+ }
39
+ function createDashboardProviderSpy() {
40
+ const store = {};
41
+ // Spy component just captures the store value so it can be inspected in tests
42
+ function DashboardProviderSpy() {
43
+ const ctx = (0, _react.useContext)(_context.DashboardContext);
44
+ store.value = ctx;
45
+ return null;
46
+ }
47
+ return {
48
+ DashboardProviderSpy,
49
+ store
50
+ };
51
+ }
@@ -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,20 +10,21 @@
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("./plugin-registry"), exports);
30
- __exportStar(require("./render"), exports);
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ _exportStar(require("./dashboard-provider"), exports);
18
+ _exportStar(require("./plugin-registry"), exports);
19
+ _exportStar(require("./render"), exports);
20
+ function _exportStar(from, to) {
21
+ Object.keys(from).forEach(function(k) {
22
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
23
+ enumerable: true,
24
+ get: function() {
25
+ return from[k];
26
+ }
27
+ });
28
+ });
29
+ return from;
30
+ }
@@ -1,55 +1,82 @@
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.
1
13
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FAKE_PANEL_PLUGIN = exports.mockPluginRegistryProps = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- /**
6
- * Helper for mocking `PluginRegistry` data during tests. Returns props that can be spread on the `PluginRegistry`
7
- * component so that it will load the mock plugins you setup. You can use the `addMockPlugin` function that's returned
8
- * to add mock plugins before rendering components that use them.
9
- */
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ mockPluginRegistryProps: ()=>mockPluginRegistryProps,
25
+ FAKE_PANEL_PLUGIN: ()=>FAKE_PANEL_PLUGIN
26
+ });
27
+ const _jsxRuntime = require("react/jsx-runtime");
10
28
  function mockPluginRegistryProps() {
11
29
  const mockPluginResource = {
12
30
  kind: 'PluginModule',
13
31
  metadata: {
14
32
  name: 'Fake Plugin Module for Tests',
33
+ created_at: '',
34
+ updated_at: '',
35
+ version: 0
15
36
  },
16
37
  spec: {
17
- plugins: [],
18
- },
38
+ plugins: []
39
+ }
19
40
  };
20
41
  const mockPluginModule = {};
21
42
  // Allow adding mock plugins in tests
22
- const addMockPlugin = (pluginType, kind, plugin) => {
43
+ const addMockPlugin = (pluginType, kind, plugin)=>{
23
44
  mockPluginResource.spec.plugins.push({
24
45
  pluginType,
25
46
  kind,
26
47
  display: {
27
- name: `Fake ${pluginType} Plugin for ${kind}`,
28
- },
48
+ name: `Fake ${pluginType} Plugin for ${kind}`
49
+ }
29
50
  });
30
51
  // "Export" on the module under the same name as the kind the plugin handles
31
52
  mockPluginModule[kind] = plugin;
32
53
  };
33
54
  const pluginRegistryProps = {
34
- getInstalledPlugins() {
35
- return Promise.resolve([mockPluginResource]);
55
+ getInstalledPlugins () {
56
+ return Promise.resolve([
57
+ mockPluginResource
58
+ ]);
36
59
  },
37
- importPluginModule( /* resource */) {
60
+ importPluginModule () {
38
61
  return Promise.resolve(mockPluginModule);
39
- },
62
+ }
40
63
  };
41
64
  return {
42
65
  pluginRegistryProps,
43
- addMockPlugin,
66
+ addMockPlugin
44
67
  };
45
68
  }
46
- exports.mockPluginRegistryProps = mockPluginRegistryProps;
47
- exports.FAKE_PANEL_PLUGIN = {
48
- PanelComponent: () => {
49
- return (0, jsx_runtime_1.jsx)("div", { role: "figure", children: "FakePanel chart" });
69
+ const FAKE_PANEL_PLUGIN = {
70
+ PanelComponent: ()=>{
71
+ return /*#__PURE__*/ (0, _jsxRuntime.jsx)("div", {
72
+ role: "figure",
73
+ children: "FakePanel chart"
74
+ });
50
75
  },
51
- OptionsEditorComponent: () => {
52
- return (0, jsx_runtime_1.jsx)("div", { children: "Edit options here" });
76
+ OptionsEditorComponent: ()=>{
77
+ return /*#__PURE__*/ (0, _jsxRuntime.jsx)("div", {
78
+ children: "Edit options here"
79
+ });
53
80
  },
54
- createInitialOptions: () => ({}),
81
+ createInitialOptions: ()=>({})
55
82
  };
@@ -1,10 +1,3 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.renderWithContext = void 0;
7
- const jsx_runtime_1 = require("react/jsx-runtime");
8
1
  // Copyright 2022 The Perses Authors
9
2
  // Licensed under the Apache License, Version 2.0 (the "License");
10
3
  // you may not use this file except in compliance with the License.
@@ -17,19 +10,29 @@ const jsx_runtime_1 = require("react/jsx-runtime");
17
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
11
  // See the License for the specific language governing permissions and
19
12
  // limitations under the License.
20
- const react_1 = require("@testing-library/react");
21
- const react_query_1 = require("react-query");
22
- const context_1 = require("../context");
23
- const testDashboard_1 = __importDefault(require("./testDashboard"));
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
- };
29
- /**
30
- * Test helper to render a React component with some common app-level providers wrapped around it.
31
- */
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);
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "renderWithContext", {
18
+ enumerable: true,
19
+ get: ()=>renderWithContext
20
+ });
21
+ const _jsxRuntime = require("react/jsx-runtime");
22
+ const _react = require("@testing-library/react");
23
+ const _reactQuery = require("@tanstack/react-query");
24
+ function renderWithContext(ui, options) {
25
+ // Create a new QueryClient for each test to avoid caching issues
26
+ const queryClient = new _reactQuery.QueryClient({
27
+ defaultOptions: {
28
+ queries: {
29
+ refetchOnWindowFocus: false,
30
+ retry: false
31
+ }
32
+ }
33
+ });
34
+ return (0, _react.render)(/*#__PURE__*/ (0, _jsxRuntime.jsx)(_reactQuery.QueryClientProvider, {
35
+ client: queryClient,
36
+ children: ui
37
+ }), options);
34
38
  }
35
- exports.renderWithContext = renderWithContext;
@@ -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,8 +10,11 @@
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
13
  // Add testing library assertions
14
+ "use strict";
15
+ Object.defineProperty(exports, "__esModule", {
16
+ value: true
17
+ });
16
18
  require("@testing-library/jest-dom/extend-expect");
17
19
  // Always mock e-charts during tests since we don't have a proper canvas in jsdom
18
20
  jest.mock('echarts/core');