@perses-dev/timeseries-table-plugin 0.12.0 → 0.13.0-beta.2

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 (146) hide show
  1. package/__mf/js/{TimeSeriesTable.a46d4c0c.js → TimeSeriesTable.306f8f49.js} +3 -3
  2. package/__mf/js/async/1522.c207deed.js +22 -0
  3. package/__mf/js/async/1616.2eecb24c.js +1 -0
  4. package/__mf/js/async/1915.483e1629.js +37 -0
  5. package/__mf/js/async/2043.3868224e.js +2 -0
  6. package/__mf/js/async/2266.219b7a42.js +1 -0
  7. package/__mf/js/async/2901.7299202e.js +1 -0
  8. package/__mf/js/async/392.e5afbc9f.js +2 -0
  9. package/__mf/js/async/3923.2e6628ef.js +1 -0
  10. package/__mf/js/async/4077.59d693f0.js +1 -0
  11. package/__mf/js/async/4121.91bf4bcc.js +2 -0
  12. package/__mf/js/async/4496.b6247974.js +1 -0
  13. package/__mf/js/async/4647.d4f0a558.js +1 -0
  14. package/__mf/js/async/5002.3e47ae67.js +1 -0
  15. package/__mf/js/async/5071.be72dc35.js +1 -0
  16. package/__mf/js/async/5587.b0e5e14b.js +1 -0
  17. package/__mf/js/async/6157.ae204aed.js +3 -0
  18. package/__mf/js/async/6274.4748d1fc.js +2 -0
  19. package/__mf/js/async/6458.8911babf.js +1 -0
  20. package/__mf/js/async/6465.e08a3883.js +1 -0
  21. package/__mf/js/async/672.13c099dd.js +7 -0
  22. package/__mf/js/async/{589.f808cb6d.js.LICENSE.txt → 672.13c099dd.js.LICENSE.txt} +41 -1
  23. package/__mf/js/async/7028.2a8af948.js +1 -0
  24. package/__mf/js/async/7192.a782922d.js +1 -0
  25. package/__mf/js/async/7633.531c287c.js +2 -0
  26. package/__mf/js/async/7968.1c541836.js +1 -0
  27. package/__mf/js/async/7978.a6164548.js +1 -0
  28. package/__mf/js/async/8356.903dfdcc.js +1 -0
  29. package/__mf/js/async/8470.8828be23.js +2 -0
  30. package/__mf/js/async/873.146dbd48.js +1 -0
  31. package/__mf/js/async/9148.14b32a38.js +1 -0
  32. package/__mf/js/async/9235.87877125.js +1 -0
  33. package/__mf/js/async/941.1550fb5d.js +2 -0
  34. package/__mf/js/async/9588.85235ea3.js +1 -0
  35. package/__mf/js/async/{357.8ed888fe.js → 9736.9653b5a5.js} +7 -6
  36. package/__mf/js/async/__federation_expose_TimeSeriesTable.e4525ca7.js +1 -0
  37. package/__mf/js/async/lib-router.d1eec799.js +2 -0
  38. package/__mf/js/{main.aa88f2d9.js → main.d7039fe9.js} +2 -2
  39. package/lib/TimeSeriesTable.d.ts +3 -3
  40. package/lib/TimeSeriesTable.d.ts.map +1 -1
  41. package/lib/TimeSeriesTable.js +2 -2
  42. package/lib/TimeSeriesTable.js.map +1 -1
  43. package/lib/TimeSeriesTablePanel.d.ts +4 -4
  44. package/lib/TimeSeriesTablePanel.d.ts.map +1 -1
  45. package/lib/TimeSeriesTablePanel.js +3 -3
  46. package/lib/TimeSeriesTablePanel.js.map +1 -1
  47. package/lib/bootstrap.js +2 -2
  48. package/lib/components/DataTable.d.ts +4 -4
  49. package/lib/components/DataTable.d.ts.map +1 -1
  50. package/lib/components/DataTable.js +7 -7
  51. package/lib/components/DataTable.js.map +1 -1
  52. package/lib/components/EmbeddedPanel.d.ts +3 -3
  53. package/lib/components/EmbeddedPanel.d.ts.map +1 -1
  54. package/lib/components/EmbeddedPanel.js +4 -4
  55. package/lib/components/EmbeddedPanel.js.map +1 -1
  56. package/lib/components/SeriesName.d.ts +2 -2
  57. package/lib/components/SeriesName.d.ts.map +1 -1
  58. package/lib/components/SeriesName.js +3 -3
  59. package/lib/components/SeriesName.js.map +1 -1
  60. package/lib/components/TimeSeriesTableItemSelectionActionsEditor.d.ts +2 -2
  61. package/lib/components/TimeSeriesTableItemSelectionActionsEditor.d.ts.map +1 -1
  62. package/lib/components/TimeSeriesTableItemSelectionActionsEditor.js +2 -2
  63. package/lib/components/TimeSeriesTableItemSelectionActionsEditor.js.map +1 -1
  64. package/lib/components/index.js +3 -3
  65. package/lib/components/index.js.map +1 -1
  66. package/lib/getPluginModule.d.ts +1 -1
  67. package/lib/getPluginModule.d.ts.map +1 -1
  68. package/lib/getPluginModule.js +3 -1
  69. package/lib/getPluginModule.js.map +1 -1
  70. package/lib/index-federation.js +1 -1
  71. package/lib/index.js +6 -6
  72. package/lib/index.js.map +1 -1
  73. package/lib/model.d.ts +1 -1
  74. package/lib/model.d.ts.map +1 -1
  75. package/lib/model.js.map +1 -1
  76. package/lib/setup-tests.d.ts +1 -1
  77. package/lib/setup-tests.d.ts.map +1 -1
  78. package/lib/setup-tests.js +2 -2
  79. package/lib/setup-tests.js.map +1 -1
  80. package/lib/test/mock-query-results.d.ts +1 -1
  81. package/lib/test/mock-query-results.d.ts.map +1 -1
  82. package/lib/test/mock-query-results.js.map +1 -1
  83. package/mf-manifest.json +45 -46
  84. package/mf-stats.json +45 -46
  85. package/package.json +11 -11
  86. package/__mf/js/async/121.592e3064.js +0 -2
  87. package/__mf/js/async/177.c119132c.js +0 -1
  88. package/__mf/js/async/187.e7610888.js +0 -7
  89. package/__mf/js/async/187.e7610888.js.LICENSE.txt +0 -39
  90. package/__mf/js/async/192.50958a78.js +0 -1
  91. package/__mf/js/async/2.56628a75.js +0 -1
  92. package/__mf/js/async/235.24837781.js +0 -1
  93. package/__mf/js/async/240.67c2c89e.js +0 -1
  94. package/__mf/js/async/274.65444167.js +0 -2
  95. package/__mf/js/async/356.3bfad7d9.js +0 -1
  96. package/__mf/js/async/392.1ef58718.js +0 -2
  97. package/__mf/js/async/413.06624aa3.js +0 -1
  98. package/__mf/js/async/43.9749b9fd.js +0 -2
  99. package/__mf/js/async/458.621e2d5a.js +0 -1
  100. package/__mf/js/async/470.e310152e.js +0 -2
  101. package/__mf/js/async/546.453f730a.js +0 -3
  102. package/__mf/js/async/558.3509fb4b.js +0 -1
  103. package/__mf/js/async/587.3ce8a0bb.js +0 -1
  104. package/__mf/js/async/588.001b4256.js +0 -1
  105. package/__mf/js/async/589.f808cb6d.js +0 -2
  106. package/__mf/js/async/599.ca81e868.js +0 -2
  107. package/__mf/js/async/603.0e24b840.js +0 -2
  108. package/__mf/js/async/616.0bbea9bc.js +0 -1
  109. package/__mf/js/async/71.70c374bd.js +0 -1
  110. package/__mf/js/async/77.179f6b48.js +0 -1
  111. package/__mf/js/async/842.bc227066.js +0 -1
  112. package/__mf/js/async/873.58804e15.js +0 -1
  113. package/__mf/js/async/939.70679ab8.js +0 -1
  114. package/__mf/js/async/941.4bc4bec7.js +0 -2
  115. package/__mf/js/async/968.96a94ca9.js +0 -1
  116. package/__mf/js/async/978.0065bf35.js +0 -1
  117. package/__mf/js/async/984.894a30f6.js +0 -22
  118. package/__mf/js/async/994.d6948621.js +0 -37
  119. package/__mf/js/async/__federation_expose_TimeSeriesTable.00ffd570.js +0 -1
  120. package/__mf/js/async/lib-router.03790637.js +0 -2
  121. package/lib/cjs/TimeSeriesTable.js +0 -42
  122. package/lib/cjs/TimeSeriesTablePanel.js +0 -44
  123. package/lib/cjs/bootstrap.js +0 -26
  124. package/lib/cjs/components/DataTable.js +0 -333
  125. package/lib/cjs/components/EmbeddedPanel.js +0 -52
  126. package/lib/cjs/components/SeriesName.js +0 -100
  127. package/lib/cjs/components/TimeSeriesTableItemSelectionActionsEditor.js +0 -44
  128. package/lib/cjs/components/index.js +0 -32
  129. package/lib/cjs/env.d.js +0 -14
  130. package/lib/cjs/getPluginModule.js +0 -39
  131. package/lib/cjs/index-federation.js +0 -55
  132. package/lib/cjs/index.js +0 -41
  133. package/lib/cjs/model.js +0 -16
  134. package/lib/cjs/setup-tests.js +0 -19
  135. package/lib/cjs/test/mock-query-results.js +0 -417
  136. /package/__mf/css/async/{187.85c2cbf6.css → 672.85c2cbf6.css} +0 -0
  137. /package/__mf/js/async/{984.894a30f6.js.LICENSE.txt → 1522.c207deed.js.LICENSE.txt} +0 -0
  138. /package/__mf/js/async/{43.9749b9fd.js.LICENSE.txt → 2043.3868224e.js.LICENSE.txt} +0 -0
  139. /package/__mf/js/async/{392.1ef58718.js.LICENSE.txt → 392.e5afbc9f.js.LICENSE.txt} +0 -0
  140. /package/__mf/js/async/{121.592e3064.js.LICENSE.txt → 4121.91bf4bcc.js.LICENSE.txt} +0 -0
  141. /package/__mf/js/async/{274.65444167.js.LICENSE.txt → 6274.4748d1fc.js.LICENSE.txt} +0 -0
  142. /package/__mf/js/async/{603.0e24b840.js.LICENSE.txt → 7633.531c287c.js.LICENSE.txt} +0 -0
  143. /package/__mf/js/async/{470.e310152e.js.LICENSE.txt → 8470.8828be23.js.LICENSE.txt} +0 -0
  144. /package/__mf/js/async/{941.4bc4bec7.js.LICENSE.txt → 941.1550fb5d.js.LICENSE.txt} +0 -0
  145. /package/__mf/js/async/{357.8ed888fe.js.LICENSE.txt → 9736.9653b5a5.js.LICENSE.txt} +0 -0
  146. /package/__mf/js/async/{lib-router.03790637.js.LICENSE.txt → lib-router.d1eec799.js.LICENSE.txt} +0 -0
@@ -1,333 +0,0 @@
1
- // Copyright 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: Object.getOwnPropertyDescriptor(all, name).get
21
- });
22
- }
23
- _export(exports, {
24
- get DataTable () {
25
- return DataTable;
26
- },
27
- get bucketRangeString () {
28
- return bucketRangeString;
29
- },
30
- get histogramTable () {
31
- return histogramTable;
32
- }
33
- });
34
- const _jsxruntime = require("react/jsx-runtime");
35
- const _material = require("@mui/material");
36
- const _components = require("@perses-dev/components");
37
- const _dashboards = require("@perses-dev/dashboards");
38
- const _pluginsystem = require("@perses-dev/plugin-system");
39
- const _react = require("react");
40
- const _EmbeddedPanel = require("./EmbeddedPanel");
41
- const _SeriesName = require("./SeriesName");
42
- const MAX_FORMATTABLE_SERIES = 1000;
43
- /**
44
- * Build row data object from a TimeSeries, including all labels and value
45
- */ function buildRowData(ts) {
46
- return {
47
- ...ts.labels,
48
- name: ts.name,
49
- formattedName: ts.formattedName,
50
- value: ts.values?.[0]?.[1],
51
- timestamp: ts.values?.[0]?.[0]
52
- };
53
- }
54
- const DataTable = ({ queryResults, spec })=>{
55
- const allVariables = (0, _pluginsystem.useAllVariableValues)();
56
- const series = (0, _react.useMemo)(()=>queryResults.flatMap((d)=>d.data).flatMap((d)=>d?.series || []), [
57
- queryResults
58
- ]);
59
- const selectionEnabled = spec.selection?.enabled ?? false;
60
- const { selectionMap, setSelection, clearSelection, toggleSelection } = (0, _components.useSelection)();
61
- const itemActionsConfig = spec.actions ? spec.actions : undefined;
62
- const itemActionsListConfig = (0, _react.useMemo)(()=>itemActionsConfig?.enabled && itemActionsConfig.displayWithItem ? itemActionsConfig.actionsList : [], [
63
- itemActionsConfig?.enabled,
64
- itemActionsConfig?.displayWithItem,
65
- itemActionsConfig?.actionsList
66
- ]);
67
- const { getItemActionButtons, confirmDialog, actionButtons } = (0, _dashboards.useSelectionItemActions)({
68
- actions: itemActionsListConfig,
69
- variableState: allVariables
70
- });
71
- const hasItemActions = actionButtons && actionButtons.length > 0;
72
- const allSelected = (0, _react.useMemo)(()=>{
73
- if (series.length === 0) return false;
74
- return series.every((_, idx)=>selectionMap.has(idx.toString()));
75
- }, [
76
- series,
77
- selectionMap
78
- ]);
79
- // Check if some (but not all) series are selected
80
- const someSelected = (0, _react.useMemo)(()=>{
81
- if (series.length === 0) return false;
82
- const selectedCount = series.filter((_, idx)=>selectionMap.has(idx.toString())).length;
83
- return selectedCount > 0 && selectedCount < series.length;
84
- }, [
85
- series,
86
- selectionMap
87
- ]);
88
- const handleSelectAll = (0, _react.useCallback)(()=>{
89
- if (allSelected) {
90
- clearSelection();
91
- } else {
92
- const allItems = series.map((ts, idx)=>({
93
- id: idx.toString(),
94
- item: buildRowData(ts)
95
- }));
96
- setSelection(allItems);
97
- }
98
- }, [
99
- allSelected,
100
- series,
101
- setSelection,
102
- clearSelection
103
- ]);
104
- const handleRowSelectionToggle = (0, _react.useCallback)((ts, seriesIdx)=>{
105
- const rowData = buildRowData(ts);
106
- toggleSelection(rowData, seriesIdx.toString());
107
- }, [
108
- toggleSelection
109
- ]);
110
- // Memoize row data for stable references
111
- const rowsData = (0, _react.useMemo)(()=>{
112
- return series.map((ts, idx)=>({
113
- ts,
114
- idx,
115
- rowData: buildRowData(ts)
116
- }));
117
- }, [
118
- series
119
- ]);
120
- if (!queryResults || !series?.length) {
121
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
122
- sx: {
123
- display: 'flex',
124
- justifyContent: 'center',
125
- alignItems: 'center',
126
- height: '100%'
127
- },
128
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
129
- children: "No data"
130
- })
131
- });
132
- }
133
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
134
- children: [
135
- confirmDialog,
136
- series.length >= MAX_FORMATTABLE_SERIES && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Alert, {
137
- severity: "warning",
138
- children: [
139
- "Showing more than ",
140
- MAX_FORMATTABLE_SERIES,
141
- " series, turning off label formatting for performance reasons."
142
- ]
143
- }),
144
- /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Table, {
145
- className: "data-table",
146
- children: [
147
- selectionEnabled && series.length > 0 && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableHead, {
148
- children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.TableRow, {
149
- children: [
150
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableCell, {
151
- padding: "checkbox",
152
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Checkbox, {
153
- indeterminate: someSelected,
154
- checked: allSelected,
155
- onChange: handleSelectAll,
156
- inputProps: {
157
- 'aria-label': 'select all series'
158
- }
159
- })
160
- }),
161
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableCell, {
162
- children: "Series"
163
- }),
164
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableCell, {
165
- children: "Value"
166
- }),
167
- hasItemActions && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableCell, {
168
- children: "Actions"
169
- })
170
- ]
171
- })
172
- }),
173
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableBody, {
174
- children: rowsData.map(({ ts, idx, rowData })=>{
175
- const displayTimeStamps = (ts.values?.length ?? 0) > 1;
176
- const valuesAndTimes = ts.values ? ts.values.map((v, valIdx)=>/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Typography, {
177
- children: [
178
- v[1],
179
- " ",
180
- displayTimeStamps && /*#__PURE__*/ (0, _jsxruntime.jsxs)("span", {
181
- children: [
182
- "@",
183
- v[0]
184
- ]
185
- })
186
- ]
187
- }, valIdx)) : [];
188
- let histogramsAndTimes = null;
189
- if (ts.histograms && ts.histograms.length > 0) {
190
- const seriesQueryResult = {
191
- ...queryResults[0],
192
- data: {
193
- ...queryResults[0].data,
194
- series: [
195
- queryResults[0].data.series[idx]
196
- ]
197
- }
198
- };
199
- histogramsAndTimes = ts.histograms.map((h, hisIdx)=>/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
200
- alignItems: "center",
201
- children: [
202
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
203
- width: 400,
204
- height: 200,
205
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_EmbeddedPanel.EmbeddedPanel, {
206
- kind: "HistogramChart",
207
- spec: {
208
- unit: 'decimal',
209
- width: 400,
210
- height: 200
211
- },
212
- queryResults: [
213
- seriesQueryResult
214
- ]
215
- })
216
- }),
217
- /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
218
- flexDirection: "row",
219
- justifyContent: "space-between",
220
- width: "100%",
221
- children: [
222
- /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Typography, {
223
- children: [
224
- "Total count: ",
225
- h[1].count
226
- ]
227
- }),
228
- /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Typography, {
229
- children: [
230
- "Sum: ",
231
- h[1].sum
232
- ]
233
- })
234
- ]
235
- }),
236
- histogramTable(h[1])
237
- ]
238
- }, -hisIdx));
239
- }
240
- const rowId = idx.toString();
241
- const isSelected = selectionMap.has(rowId);
242
- const isFormatted = series.length < MAX_FORMATTABLE_SERIES;
243
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.TableRow, {
244
- style: {
245
- whiteSpace: 'pre'
246
- },
247
- children: [
248
- selectionEnabled && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableCell, {
249
- padding: "checkbox",
250
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Checkbox, {
251
- checked: isSelected,
252
- onChange: ()=>handleRowSelectionToggle(ts, idx),
253
- inputProps: {
254
- 'aria-label': `select series ${idx}`
255
- }
256
- })
257
- }),
258
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableCell, {
259
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_SeriesName.SeriesName, {
260
- name: ts.name,
261
- formattedName: ts.formattedName,
262
- labels: ts.labels,
263
- isFormatted: isFormatted
264
- })
265
- }),
266
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableCell, {
267
- children: ts.histograms ? histogramsAndTimes : valuesAndTimes
268
- }),
269
- hasItemActions && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableCell, {
270
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
271
- sx: {
272
- display: 'flex',
273
- gap: 1
274
- },
275
- children: getItemActionButtons({
276
- id: rowId,
277
- data: rowData
278
- })
279
- })
280
- })
281
- ]
282
- }, idx);
283
- })
284
- })
285
- ]
286
- })
287
- ]
288
- });
289
- };
290
- const leftDelim = (br)=>br === 3 || br === 1 ? '[' : '(';
291
- const rightDelim = (br)=>br === 3 || br === 0 ? ']' : ')';
292
- const bucketRangeString = ([boundaryRule, leftBoundary, rightBoundary])=>{
293
- return `${leftDelim(boundaryRule)}${leftBoundary} -> ${rightBoundary}${rightDelim(boundaryRule)}`;
294
- };
295
- const histogramTable = (h)=>/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Table, {
296
- children: [
297
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableHead, {
298
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableRow, {
299
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableCell, {
300
- style: {
301
- textAlign: 'center'
302
- },
303
- colSpan: 2,
304
- children: "Histogram Sample"
305
- })
306
- })
307
- }),
308
- /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.TableBody, {
309
- children: [
310
- /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.TableRow, {
311
- children: [
312
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableCell, {
313
- children: "Range"
314
- }),
315
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableCell, {
316
- children: "Count"
317
- })
318
- ]
319
- }),
320
- h.buckets?.map((b, i)=>/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.TableRow, {
321
- children: [
322
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableCell, {
323
- children: bucketRangeString(b)
324
- }),
325
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableCell, {
326
- children: b[3]
327
- })
328
- ]
329
- }, i))
330
- ]
331
- })
332
- ]
333
- });
@@ -1,52 +0,0 @@
1
- // Copyright 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, "EmbeddedPanel", {
18
- enumerable: true,
19
- get: function() {
20
- return EmbeddedPanel;
21
- }
22
- });
23
- const _jsxruntime = require("react/jsx-runtime");
24
- const _dashboards = require("@perses-dev/dashboards");
25
- const _useresizeobserver = /*#__PURE__*/ _interop_require_default(require("use-resize-observer"));
26
- const _components = require("@perses-dev/components");
27
- function _interop_require_default(obj) {
28
- return obj && obj.__esModule ? obj : {
29
- default: obj
30
- };
31
- }
32
- function EmbeddedPanel({ kind, spec, queryResults }) {
33
- const { ref, width = 1, height = 1 } = (0, _useresizeobserver.default)();
34
- return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
35
- ref: ref,
36
- style: {
37
- height: '100%'
38
- },
39
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorBoundary, {
40
- FallbackComponent: _components.ErrorAlert,
41
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_dashboards.PanelPluginLoader, {
42
- kind: kind,
43
- contentDimensions: {
44
- width,
45
- height
46
- },
47
- spec: spec,
48
- queryResults: queryResults
49
- })
50
- })
51
- });
52
- }
@@ -1,100 +0,0 @@
1
- // Copyright 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, "SeriesName", {
18
- enumerable: true,
19
- get: function() {
20
- return SeriesName;
21
- }
22
- });
23
- const _jsxruntime = require("react/jsx-runtime");
24
- const _components = require("@perses-dev/components");
25
- const _material = require("@mui/material");
26
- function SeriesName({ name, labels, formattedName, isFormatted }) {
27
- if (isFormatted && labels && Object.keys(labels).length > 0) {
28
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(FormatedSeriesName, {
29
- labels: labels
30
- });
31
- }
32
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
33
- sx: {
34
- textWrap: 'auto'
35
- },
36
- children: formattedName ?? name
37
- });
38
- }
39
- function FormatedSeriesName({ labels }) {
40
- const { infoSnackbar } = (0, _components.useSnackbar)();
41
- const labelNodes = [];
42
- let first = true;
43
- function copyToClipboard(e) {
44
- const copyText = e.currentTarget.innerText || '';
45
- navigator.clipboard.writeText(copyText.trim()).then(()=>{
46
- infoSnackbar(`Copied label matcher: ${copyText}`);
47
- }).catch((reason)=>{
48
- console.error(`unable to copy text: ${reason}`);
49
- });
50
- }
51
- for(const label in labels){
52
- if (label === '__name__') {
53
- continue;
54
- }
55
- labelNodes.push(/*#__PURE__*/ (0, _jsxruntime.jsxs)("span", {
56
- children: [
57
- !first && ', ',
58
- /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Typography, {
59
- display: "inline",
60
- component: "span",
61
- sx: {
62
- '&:hover': {
63
- cursor: 'pointer',
64
- textDecoration: 'underline'
65
- }
66
- },
67
- onClick: copyToClipboard,
68
- title: "Click to copy label matcher",
69
- children: [
70
- /*#__PURE__*/ (0, _jsxruntime.jsx)("strong", {
71
- children: label
72
- }),
73
- "=",
74
- /*#__PURE__*/ (0, _jsxruntime.jsxs)("span", {
75
- children: [
76
- '"',
77
- labels[label],
78
- '"'
79
- ]
80
- })
81
- ]
82
- })
83
- ]
84
- }, label));
85
- if (first) {
86
- first = false;
87
- }
88
- }
89
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Typography, {
90
- sx: {
91
- textWrap: 'auto'
92
- },
93
- children: [
94
- labels ? labels.__name__ : '',
95
- '{',
96
- labelNodes,
97
- '}'
98
- ]
99
- });
100
- }
@@ -1,44 +0,0 @@
1
- // Copyright 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, "TimeSeriesTableItemSelectionActionsEditor", {
18
- enumerable: true,
19
- get: function() {
20
- return TimeSeriesTableItemSelectionActionsEditor;
21
- }
22
- });
23
- const _jsxruntime = require("react/jsx-runtime");
24
- const _pluginsystem = require("@perses-dev/plugin-system");
25
- function TimeSeriesTableItemSelectionActionsEditor({ value, onChange }) {
26
- function handleActionsChange(actions) {
27
- onChange({
28
- ...value,
29
- actions: actions
30
- });
31
- }
32
- function handleSelectionChange(selection) {
33
- onChange({
34
- ...value,
35
- selection: selection
36
- });
37
- }
38
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.ItemSelectionActionsEditor, {
39
- actionOptions: value.actions,
40
- onChangeActions: handleActionsChange,
41
- selectionOptions: value.selection,
42
- onChangeSelection: handleSelectionChange
43
- });
44
- }
@@ -1,32 +0,0 @@
1
- // Copyright 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
- _export_star(require("./DataTable"), exports);
18
- _export_star(require("./SeriesName"), exports);
19
- _export_star(require("./TimeSeriesTableItemSelectionActionsEditor"), exports);
20
- function _export_star(from, to) {
21
- Object.keys(from).forEach(function(k) {
22
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
23
- Object.defineProperty(to, k, {
24
- enumerable: true,
25
- get: function() {
26
- return from[k];
27
- }
28
- });
29
- }
30
- });
31
- return from;
32
- }
package/lib/cjs/env.d.js DELETED
@@ -1,14 +0,0 @@
1
- // Copyright 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
- /// <reference types="@rsbuild/core/types" />
14
- "use strict";
@@ -1,39 +0,0 @@
1
- // Copyright 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, "getPluginModule", {
18
- enumerable: true,
19
- get: function() {
20
- return getPluginModule;
21
- }
22
- });
23
- const _packagejson = /*#__PURE__*/ _interop_require_default(require("../package.json"));
24
- function _interop_require_default(obj) {
25
- return obj && obj.__esModule ? obj : {
26
- default: obj
27
- };
28
- }
29
- function getPluginModule() {
30
- const { name, version, perses } = _packagejson.default;
31
- return {
32
- kind: 'PluginModule',
33
- metadata: {
34
- name,
35
- version
36
- },
37
- spec: perses
38
- };
39
- }
@@ -1,55 +0,0 @@
1
- "use strict";
2
- function _getRequireWildcardCache(nodeInterop) {
3
- if (typeof WeakMap !== "function") return null;
4
- var cacheBabelInterop = new WeakMap();
5
- var cacheNodeInterop = new WeakMap();
6
- return (_getRequireWildcardCache = function(nodeInterop) {
7
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
8
- })(nodeInterop);
9
- }
10
- function _interop_require_wildcard(obj, nodeInterop) {
11
- if (!nodeInterop && obj && obj.__esModule) {
12
- return obj;
13
- }
14
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
15
- return {
16
- default: obj
17
- };
18
- }
19
- var cache = _getRequireWildcardCache(nodeInterop);
20
- if (cache && cache.has(obj)) {
21
- return cache.get(obj);
22
- }
23
- var newObj = {
24
- __proto__: null
25
- };
26
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
27
- for(var key in obj){
28
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
29
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
30
- if (desc && (desc.get || desc.set)) {
31
- Object.defineProperty(newObj, key, desc);
32
- } else {
33
- newObj[key] = obj[key];
34
- }
35
- }
36
- }
37
- newObj.default = obj;
38
- if (cache) {
39
- cache.set(obj, newObj);
40
- }
41
- return newObj;
42
- }
43
- // Copyright The Perses Authors
44
- // Licensed under the Apache License, Version 2.0 (the "License");
45
- // you may not use this file except in compliance with the License.
46
- // You may obtain a copy of the License at
47
- //
48
- // http://www.apache.org/licenses/LICENSE-2.0
49
- //
50
- // Unless required by applicable law or agreed to in writing, software
51
- // distributed under the License is distributed on an "AS IS" BASIS,
52
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
53
- // See the License for the specific language governing permissions and
54
- // limitations under the License.
55
- Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("./bootstrap")));