@perses-dev/timeseries-table-plugin 0.11.0-beta.0 → 0.11.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 (92) hide show
  1. package/__mf/js/{TimeSeriesTable.5ba10319.js → TimeSeriesTable.cdbd463d.js} +3 -3
  2. package/__mf/js/async/1117.dd32fc22.js +2 -0
  3. package/__mf/js/async/1939.2bf7b68b.js +1 -0
  4. package/__mf/js/async/2240.d6885088.js +1 -0
  5. package/__mf/js/async/392.0af27180.js +2 -0
  6. package/__mf/js/async/4407.fcda154b.js +1 -0
  7. package/__mf/js/async/5357.b184bde0.js +110 -0
  8. package/__mf/js/async/54.3e02cca4.js +22 -0
  9. package/__mf/js/async/5955.d8a0d358.js +7 -0
  10. package/__mf/js/async/648.0698f9e5.js +1 -0
  11. package/__mf/js/async/6599.ae361779.js +2 -0
  12. package/__mf/js/async/8994.783cc861.js +37 -0
  13. package/__mf/js/async/__federation_expose_TimeSeriesTable.2d999a4c.js +1 -0
  14. package/__mf/js/async/lib-router.1f77f0cd.js +2 -0
  15. package/__mf/js/async/{lib-router.4afa3869.js.LICENSE.txt → lib-router.1f77f0cd.js.LICENSE.txt} +3 -3
  16. package/__mf/js/{main.5494308c.js → main.6ab5cdb3.js} +3 -3
  17. package/lib/TimeSeriesTable.d.ts.map +1 -1
  18. package/lib/TimeSeriesTable.js +8 -1
  19. package/lib/TimeSeriesTable.js.map +1 -1
  20. package/lib/TimeSeriesTablePanel.js +4 -3
  21. package/lib/TimeSeriesTablePanel.js.map +1 -1
  22. package/lib/bootstrap.js +1 -1
  23. package/lib/bootstrap.js.map +1 -1
  24. package/lib/cjs/TimeSeriesTable.js +8 -1
  25. package/lib/cjs/TimeSeriesTablePanel.js +4 -3
  26. package/lib/cjs/bootstrap.js +1 -1
  27. package/lib/cjs/components/DataTable.js +218 -101
  28. package/lib/cjs/components/EmbeddedPanel.js +1 -1
  29. package/lib/cjs/components/SeriesName.js +1 -1
  30. package/lib/cjs/components/TimeSeriesTableItemSelectionActionsEditor.js +44 -0
  31. package/lib/cjs/components/index.js +13 -0
  32. package/lib/cjs/env.d.js +1 -1
  33. package/lib/cjs/getPluginModule.js +12 -0
  34. package/lib/cjs/index-federation.js +1 -1
  35. package/lib/cjs/index.js +12 -0
  36. package/lib/cjs/model.js +12 -1
  37. package/lib/cjs/setup-tests.js +1 -1
  38. package/lib/cjs/test/mock-query-results.js +1 -1
  39. package/lib/components/DataTable.d.ts +5 -3
  40. package/lib/components/DataTable.d.ts.map +1 -1
  41. package/lib/components/DataTable.js +219 -102
  42. package/lib/components/DataTable.js.map +1 -1
  43. package/lib/components/EmbeddedPanel.js +1 -1
  44. package/lib/components/EmbeddedPanel.js.map +1 -1
  45. package/lib/components/SeriesName.js +1 -1
  46. package/lib/components/SeriesName.js.map +1 -1
  47. package/lib/components/TimeSeriesTableItemSelectionActionsEditor.d.ts +4 -0
  48. package/lib/components/TimeSeriesTableItemSelectionActionsEditor.d.ts.map +1 -0
  49. package/lib/components/TimeSeriesTableItemSelectionActionsEditor.js +36 -0
  50. package/lib/components/TimeSeriesTableItemSelectionActionsEditor.js.map +1 -0
  51. package/lib/components/index.d.ts +1 -0
  52. package/lib/components/index.d.ts.map +1 -1
  53. package/lib/components/index.js +13 -0
  54. package/lib/components/index.js.map +1 -1
  55. package/lib/env.d.js +1 -1
  56. package/lib/env.d.js.map +1 -1
  57. package/lib/getPluginModule.d.ts.map +1 -1
  58. package/lib/getPluginModule.js +12 -0
  59. package/lib/getPluginModule.js.map +1 -1
  60. package/lib/index-federation.js +1 -1
  61. package/lib/index-federation.js.map +1 -1
  62. package/lib/index.d.ts.map +1 -1
  63. package/lib/index.js +12 -0
  64. package/lib/index.js.map +1 -1
  65. package/lib/model.d.ts +10 -0
  66. package/lib/model.d.ts.map +1 -1
  67. package/lib/model.js +12 -1
  68. package/lib/model.js.map +1 -1
  69. package/lib/setup-tests.js +1 -1
  70. package/lib/setup-tests.js.map +1 -1
  71. package/lib/test/mock-query-results.js +1 -1
  72. package/lib/test/mock-query-results.js.map +1 -1
  73. package/mf-manifest.json +26 -25
  74. package/mf-stats.json +31 -27
  75. package/package.json +5 -5
  76. package/__mf/js/async/1117.8c12a843.js +0 -2
  77. package/__mf/js/async/1490.1b37e9b3.js +0 -22
  78. package/__mf/js/async/2555.3e9e6122.js +0 -7
  79. package/__mf/js/async/2710.135d1c9a.js +0 -37
  80. package/__mf/js/async/2757.0345b149.js +0 -1
  81. package/__mf/js/async/383.737ba616.js +0 -110
  82. package/__mf/js/async/392.cf8653c1.js +0 -2
  83. package/__mf/js/async/6517.c68cf337.js +0 -2
  84. package/__mf/js/async/7417.abe3c9e4.js +0 -1
  85. package/__mf/js/async/8252.16ced360.js +0 -1
  86. package/__mf/js/async/__federation_expose_TimeSeriesTable.cfbb153a.js +0 -1
  87. package/__mf/js/async/lib-router.4afa3869.js +0 -2
  88. /package/__mf/js/async/{1117.8c12a843.js.LICENSE.txt → 1117.dd32fc22.js.LICENSE.txt} +0 -0
  89. /package/__mf/js/async/{392.cf8653c1.js.LICENSE.txt → 392.0af27180.js.LICENSE.txt} +0 -0
  90. /package/__mf/js/async/{383.737ba616.js.LICENSE.txt → 5357.b184bde0.js.LICENSE.txt} +0 -0
  91. /package/__mf/js/async/{1490.1b37e9b3.js.LICENSE.txt → 54.3e02cca4.js.LICENSE.txt} +0 -0
  92. /package/__mf/js/async/{2555.3e9e6122.js.LICENSE.txt → 5955.d8a0d358.js.LICENSE.txt} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- // Copyright 2024 The Perses Authors
2
+ // Copyright 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
@@ -11,11 +11,25 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
11
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
- import { useMemo } from 'react';
15
- import { Alert, Box, Stack, Table, TableBody, TableCell, TableHead, TableRow, Typography } from '@mui/material';
16
- import { SeriesName } from './SeriesName';
14
+ import { Alert, Box, Checkbox, Stack, Table, TableBody, TableCell, TableHead, TableRow, Typography } from '@mui/material';
15
+ import { useSelection } from '@perses-dev/components';
16
+ import { useSelectionItemActions } from '@perses-dev/dashboards';
17
+ import { useAllVariableValues } from '@perses-dev/plugin-system';
18
+ import { useCallback, useMemo } from 'react';
17
19
  import { EmbeddedPanel } from './EmbeddedPanel';
20
+ import { SeriesName } from './SeriesName';
18
21
  const MAX_FORMATTABLE_SERIES = 1000;
22
+ /**
23
+ * Build row data object from a TimeSeries, including all labels and value
24
+ */ function buildRowData(ts) {
25
+ return {
26
+ ...ts.labels,
27
+ name: ts.name,
28
+ formattedName: ts.formattedName,
29
+ value: ts.values?.[0]?.[1],
30
+ timestamp: ts.values?.[0]?.[0]
31
+ };
32
+ }
19
33
  /**
20
34
  * Designed to display timeseries data in a prometheus like table format.
21
35
  * The first column will contain the metric name and label combination, and the second column will contain the values.
@@ -23,15 +37,73 @@ const MAX_FORMATTABLE_SERIES = 1000;
23
37
  * https://github.com/prometheus/prometheus/blob/2524a915915d7eb1b1207152d2e0ce5771193404/web/ui/react-app/src/pages/graph/DataTable.tsx
24
38
  * @param result timeseries query result
25
39
  * @constructor
26
- */ export const DataTable = ({ queryResults })=>{
40
+ */ export const DataTable = ({ queryResults, spec })=>{
41
+ const allVariables = useAllVariableValues();
27
42
  const series = useMemo(()=>queryResults.flatMap((d)=>d.data).flatMap((d)=>d?.series || []), [
28
43
  queryResults
29
44
  ]);
30
- const rows = useMemo(()=>buildRows(series, queryResults), [
45
+ const selectionEnabled = spec.selection?.enabled ?? false;
46
+ const { selectionMap, setSelection, clearSelection, toggleSelection } = useSelection();
47
+ const itemActionsConfig = spec.actions ? spec.actions : undefined;
48
+ const itemActionsListConfig = useMemo(()=>itemActionsConfig?.enabled && itemActionsConfig.displayWithItem ? itemActionsConfig.actionsList : [], [
49
+ itemActionsConfig?.enabled,
50
+ itemActionsConfig?.displayWithItem,
51
+ itemActionsConfig?.actionsList
52
+ ]);
53
+ const { getItemActionButtons, confirmDialog, actionButtons } = useSelectionItemActions({
54
+ actions: itemActionsListConfig,
55
+ variableState: allVariables
56
+ });
57
+ const hasItemActions = actionButtons && actionButtons.length > 0;
58
+ const allSelected = useMemo(()=>{
59
+ if (series.length === 0) return false;
60
+ return series.every((_, idx)=>selectionMap.has(idx.toString()));
61
+ }, [
62
+ series,
63
+ selectionMap
64
+ ]);
65
+ // Check if some (but not all) series are selected
66
+ const someSelected = useMemo(()=>{
67
+ if (series.length === 0) return false;
68
+ const selectedCount = series.filter((_, idx)=>selectionMap.has(idx.toString())).length;
69
+ return selectedCount > 0 && selectedCount < series.length;
70
+ }, [
31
71
  series,
32
- queryResults
72
+ selectionMap
73
+ ]);
74
+ const handleSelectAll = useCallback(()=>{
75
+ if (allSelected) {
76
+ clearSelection();
77
+ } else {
78
+ const allItems = series.map((ts, idx)=>({
79
+ id: idx.toString(),
80
+ item: buildRowData(ts)
81
+ }));
82
+ setSelection(allItems);
83
+ }
84
+ }, [
85
+ allSelected,
86
+ series,
87
+ setSelection,
88
+ clearSelection
33
89
  ]);
34
- if (!queryResults || !rows?.length) {
90
+ const handleRowSelectionToggle = useCallback((ts, seriesIdx)=>{
91
+ const rowData = buildRowData(ts);
92
+ toggleSelection(rowData, seriesIdx.toString());
93
+ }, [
94
+ toggleSelection
95
+ ]);
96
+ // Memoize row data for stable references
97
+ const rowsData = useMemo(()=>{
98
+ return series.map((ts, idx)=>({
99
+ ts,
100
+ idx,
101
+ rowData: buildRowData(ts)
102
+ }));
103
+ }, [
104
+ series
105
+ ]);
106
+ if (!queryResults || !series?.length) {
35
107
  return /*#__PURE__*/ _jsx(Box, {
36
108
  sx: {
37
109
  display: 'flex',
@@ -46,6 +118,7 @@ const MAX_FORMATTABLE_SERIES = 1000;
46
118
  }
47
119
  return /*#__PURE__*/ _jsxs(_Fragment, {
48
120
  children: [
121
+ confirmDialog,
49
122
  series.length >= MAX_FORMATTABLE_SERIES && /*#__PURE__*/ _jsxs(Alert, {
50
123
  severity: "warning",
51
124
  children: [
@@ -54,108 +127,152 @@ const MAX_FORMATTABLE_SERIES = 1000;
54
127
  " series, turning off label formatting for performance reasons."
55
128
  ]
56
129
  }),
57
- /*#__PURE__*/ _jsx(Table, {
130
+ /*#__PURE__*/ _jsxs(Table, {
58
131
  className: "data-table",
59
- children: /*#__PURE__*/ _jsx(TableBody, {
60
- children: rows
61
- })
62
- })
63
- ]
64
- });
65
- };
66
- function buildRows(series, queryResults) {
67
- const isFormatted = series.length < MAX_FORMATTABLE_SERIES; // only format series names if we have less than 1000 series for performance reasons
68
- return series.map((s, seriesIdx)=>{
69
- const displayTimeStamps = (s.values?.length ?? 0) > 1;
70
- const valuesAndTimes = s.values ? s.values.map((v, valIdx)=>{
71
- return /*#__PURE__*/ _jsxs(Typography, {
72
132
  children: [
73
- v[1],
74
- " ",
75
- displayTimeStamps && /*#__PURE__*/ _jsxs("span", {
76
- children: [
77
- "@",
78
- v[0]
79
- ]
80
- })
81
- ]
82
- }, valIdx);
83
- }) : [];
84
- let histogramsAndTimes = null;
85
- if (s.histograms && s.histograms.length > 0) {
86
- // Query results contains multiple series, create a new query result with only the current series
87
- const seriesQueryResult = {
88
- ...queryResults[0],
89
- data: {
90
- ...queryResults[0].data,
91
- series: [
92
- queryResults[0].data.series[seriesIdx]
93
- ]
94
- }
95
- };
96
- histogramsAndTimes = s.histograms.map((h, hisIdx)=>{
97
- return /*#__PURE__*/ _jsxs(Stack, {
98
- alignItems: "center",
99
- children: [
100
- /*#__PURE__*/ _jsx(Box, {
101
- width: 400,
102
- height: 200,
103
- children: /*#__PURE__*/ _jsx(EmbeddedPanel, {
104
- kind: "HistogramChart",
105
- spec: {
106
- unit: 'decimal',
107
- width: 400,
108
- height: 200
109
- },
110
- queryResults: [
111
- seriesQueryResult
112
- ]
113
- })
114
- }),
115
- /*#__PURE__*/ _jsxs(Stack, {
116
- flexDirection: "row",
117
- justifyContent: "space-between",
118
- width: "100%",
133
+ selectionEnabled && series.length > 0 && /*#__PURE__*/ _jsx(TableHead, {
134
+ children: /*#__PURE__*/ _jsxs(TableRow, {
119
135
  children: [
120
- /*#__PURE__*/ _jsxs(Typography, {
121
- children: [
122
- "Total count: ",
123
- h[1].count
124
- ]
136
+ /*#__PURE__*/ _jsx(TableCell, {
137
+ padding: "checkbox",
138
+ children: /*#__PURE__*/ _jsx(Checkbox, {
139
+ indeterminate: someSelected,
140
+ checked: allSelected,
141
+ onChange: handleSelectAll,
142
+ inputProps: {
143
+ 'aria-label': 'select all series'
144
+ }
145
+ })
125
146
  }),
126
- /*#__PURE__*/ _jsxs(Typography, {
127
- children: [
128
- "Sum: ",
129
- h[1].sum
130
- ]
147
+ /*#__PURE__*/ _jsx(TableCell, {
148
+ children: "Series"
149
+ }),
150
+ /*#__PURE__*/ _jsx(TableCell, {
151
+ children: "Value"
152
+ }),
153
+ hasItemActions && /*#__PURE__*/ _jsx(TableCell, {
154
+ children: "Actions"
131
155
  })
132
156
  ]
133
- }),
134
- histogramTable(h[1])
135
- ]
136
- }, -hisIdx);
137
- });
138
- }
139
- return /*#__PURE__*/ _jsxs(TableRow, {
140
- style: {
141
- whiteSpace: 'pre'
142
- },
143
- children: [
144
- /*#__PURE__*/ _jsx(TableCell, {
145
- children: /*#__PURE__*/ _jsx(SeriesName, {
146
- name: s.name,
147
- formattedName: s.formattedName,
148
- labels: s.labels,
149
- isFormatted: isFormatted
157
+ })
158
+ }),
159
+ /*#__PURE__*/ _jsx(TableBody, {
160
+ children: rowsData.map(({ ts, idx, rowData })=>{
161
+ const displayTimeStamps = (ts.values?.length ?? 0) > 1;
162
+ const valuesAndTimes = ts.values ? ts.values.map((v, valIdx)=>/*#__PURE__*/ _jsxs(Typography, {
163
+ children: [
164
+ v[1],
165
+ " ",
166
+ displayTimeStamps && /*#__PURE__*/ _jsxs("span", {
167
+ children: [
168
+ "@",
169
+ v[0]
170
+ ]
171
+ })
172
+ ]
173
+ }, valIdx)) : [];
174
+ let histogramsAndTimes = null;
175
+ if (ts.histograms && ts.histograms.length > 0) {
176
+ const seriesQueryResult = {
177
+ ...queryResults[0],
178
+ data: {
179
+ ...queryResults[0].data,
180
+ series: [
181
+ queryResults[0].data.series[idx]
182
+ ]
183
+ }
184
+ };
185
+ histogramsAndTimes = ts.histograms.map((h, hisIdx)=>/*#__PURE__*/ _jsxs(Stack, {
186
+ alignItems: "center",
187
+ children: [
188
+ /*#__PURE__*/ _jsx(Box, {
189
+ width: 400,
190
+ height: 200,
191
+ children: /*#__PURE__*/ _jsx(EmbeddedPanel, {
192
+ kind: "HistogramChart",
193
+ spec: {
194
+ unit: 'decimal',
195
+ width: 400,
196
+ height: 200
197
+ },
198
+ queryResults: [
199
+ seriesQueryResult
200
+ ]
201
+ })
202
+ }),
203
+ /*#__PURE__*/ _jsxs(Stack, {
204
+ flexDirection: "row",
205
+ justifyContent: "space-between",
206
+ width: "100%",
207
+ children: [
208
+ /*#__PURE__*/ _jsxs(Typography, {
209
+ children: [
210
+ "Total count: ",
211
+ h[1].count
212
+ ]
213
+ }),
214
+ /*#__PURE__*/ _jsxs(Typography, {
215
+ children: [
216
+ "Sum: ",
217
+ h[1].sum
218
+ ]
219
+ })
220
+ ]
221
+ }),
222
+ histogramTable(h[1])
223
+ ]
224
+ }, -hisIdx));
225
+ }
226
+ const rowId = idx.toString();
227
+ const isSelected = selectionMap.has(rowId);
228
+ const isFormatted = series.length < MAX_FORMATTABLE_SERIES;
229
+ return /*#__PURE__*/ _jsxs(TableRow, {
230
+ style: {
231
+ whiteSpace: 'pre'
232
+ },
233
+ children: [
234
+ selectionEnabled && /*#__PURE__*/ _jsx(TableCell, {
235
+ padding: "checkbox",
236
+ children: /*#__PURE__*/ _jsx(Checkbox, {
237
+ checked: isSelected,
238
+ onChange: ()=>handleRowSelectionToggle(ts, idx),
239
+ inputProps: {
240
+ 'aria-label': `select series ${idx}`
241
+ }
242
+ })
243
+ }),
244
+ /*#__PURE__*/ _jsx(TableCell, {
245
+ children: /*#__PURE__*/ _jsx(SeriesName, {
246
+ name: ts.name,
247
+ formattedName: ts.formattedName,
248
+ labels: ts.labels,
249
+ isFormatted: isFormatted
250
+ })
251
+ }),
252
+ /*#__PURE__*/ _jsx(TableCell, {
253
+ children: ts.histograms ? histogramsAndTimes : valuesAndTimes
254
+ }),
255
+ hasItemActions && /*#__PURE__*/ _jsx(TableCell, {
256
+ children: /*#__PURE__*/ _jsx(Box, {
257
+ sx: {
258
+ display: 'flex',
259
+ gap: 1
260
+ },
261
+ children: getItemActionButtons({
262
+ id: rowId,
263
+ data: rowData
264
+ })
265
+ })
266
+ })
267
+ ]
268
+ }, idx);
269
+ })
150
270
  })
151
- }),
152
- /*#__PURE__*/ _jsx(TableCell, {
153
- children: s.histograms ? histogramsAndTimes : valuesAndTimes
154
- })
155
- ]
156
- }, seriesIdx);
271
+ ]
272
+ })
273
+ ]
157
274
  });
158
- }
275
+ };
159
276
  const leftDelim = (br)=>br === 3 || br === 1 ? '[' : '(';
160
277
  const rightDelim = (br)=>br === 3 || br === 0 ? ']' : ')';
161
278
  export const bucketRangeString = ([boundaryRule, leftBoundary, rightBoundary])=>{
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/DataTable.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, ReactNode, useMemo } from 'react';\nimport { Alert, Box, Stack, Table, TableBody, TableCell, TableHead, TableRow, Typography } from '@mui/material';\nimport { TimeSeries, TimeSeriesData, BucketTuple, TimeSeriesHistogramTuple, HistogramValue } from '@perses-dev/core';\nimport { PanelData } from '@perses-dev/plugin-system';\nimport { SeriesName } from './SeriesName';\nimport { EmbeddedPanel } from './EmbeddedPanel';\n\nconst MAX_FORMATTABLE_SERIES = 1000;\n\nexport interface DataTableProps {\n queryResults: Array<PanelData<TimeSeriesData>>;\n}\n\n/**\n * Designed to display timeseries data in a prometheus like table format.\n * The first column will contain the metric name and label combination, and the second column will contain the values.\n * This is inspired by prometheus DataTable.\n * https://github.com/prometheus/prometheus/blob/2524a915915d7eb1b1207152d2e0ce5771193404/web/ui/react-app/src/pages/graph/DataTable.tsx\n * @param result timeseries query result\n * @constructor\n */\nexport const DataTable = ({ queryResults }: DataTableProps): ReactElement | null => {\n const series = useMemo(() => queryResults.flatMap((d) => d.data).flatMap((d) => d?.series || []), [queryResults]);\n const rows = useMemo(() => buildRows(series, queryResults), [series, queryResults]);\n\n if (!queryResults || !rows?.length) {\n return (\n <Box\n sx={{\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n height: '100%',\n }}\n >\n <Typography>No data</Typography>\n </Box>\n );\n }\n\n return (\n <>\n {series.length >= MAX_FORMATTABLE_SERIES && (\n <Alert severity=\"warning\">\n Showing more than {MAX_FORMATTABLE_SERIES} series, turning off label formatting for performance reasons.\n </Alert>\n )}\n <Table className=\"data-table\">\n <TableBody>{rows}</TableBody>\n </Table>\n </>\n );\n};\n\nfunction buildRows(series: TimeSeries[], queryResults: Array<PanelData<TimeSeriesData>>): ReactNode[] {\n const isFormatted = series.length < MAX_FORMATTABLE_SERIES; // only format series names if we have less than 1000 series for performance reasons\n return series.map((s, seriesIdx) => {\n const displayTimeStamps = (s.values?.length ?? 0) > 1;\n const valuesAndTimes = s.values\n ? s.values.map((v, valIdx) => {\n return (\n <Typography key={valIdx}>\n {v[1]} {displayTimeStamps && <span>@{v[0]}</span>}\n </Typography>\n );\n })\n : [];\n\n let histogramsAndTimes = null;\n if (s.histograms && s.histograms.length > 0) {\n // Query results contains multiple series, create a new query result with only the current series\n const seriesQueryResult: PanelData<TimeSeriesData> = {\n ...queryResults[0]!,\n data: {\n ...queryResults[0]!.data,\n series: [queryResults[0]!.data.series[seriesIdx]!],\n },\n };\n\n histogramsAndTimes = s.histograms.map((h: TimeSeriesHistogramTuple, hisIdx: number) => {\n return (\n <Stack alignItems=\"center\" key={-hisIdx}>\n <Box width={400} height={200}>\n <EmbeddedPanel\n kind=\"HistogramChart\"\n spec={{ unit: 'decimal', width: 400, height: 200 }}\n queryResults={[seriesQueryResult]}\n />\n </Box>\n <Stack flexDirection=\"row\" justifyContent=\"space-between\" width=\"100%\">\n <Typography>Total count: {h[1].count}</Typography>\n <Typography>Sum: {h[1].sum}</Typography>\n </Stack>\n {histogramTable(h[1])}\n </Stack>\n );\n });\n }\n return (\n <TableRow style={{ whiteSpace: 'pre' }} key={seriesIdx}>\n <TableCell>\n <SeriesName name={s.name} formattedName={s.formattedName} labels={s.labels} isFormatted={isFormatted} />\n </TableCell>\n <TableCell>{s.histograms ? histogramsAndTimes : valuesAndTimes}</TableCell>\n </TableRow>\n );\n });\n}\n\nconst leftDelim = (br: number): string => (br === 3 || br === 1 ? '[' : '(');\nconst rightDelim = (br: number): string => (br === 3 || br === 0 ? ']' : ')');\n\nexport const bucketRangeString = ([boundaryRule, leftBoundary, rightBoundary]: [\n number,\n string,\n string,\n string,\n]): string => {\n return `${leftDelim(boundaryRule)}${leftBoundary} -> ${rightBoundary}${rightDelim(boundaryRule)}`;\n};\n\nexport const histogramTable = (h: HistogramValue): ReactNode => (\n <Table>\n <TableHead>\n <TableRow>\n <TableCell style={{ textAlign: 'center' }} colSpan={2}>\n Histogram Sample\n </TableCell>\n </TableRow>\n </TableHead>\n <TableBody>\n <TableRow>\n <TableCell>Range</TableCell>\n <TableCell>Count</TableCell>\n </TableRow>\n {h.buckets?.map((b: BucketTuple, i: number) => (\n <TableRow key={i}>\n <TableCell>{bucketRangeString(b)}</TableCell>\n <TableCell>{b[3]}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n);\n"],"names":["useMemo","Alert","Box","Stack","Table","TableBody","TableCell","TableHead","TableRow","Typography","SeriesName","EmbeddedPanel","MAX_FORMATTABLE_SERIES","DataTable","queryResults","series","flatMap","d","data","rows","buildRows","length","sx","display","justifyContent","alignItems","height","severity","className","isFormatted","map","s","seriesIdx","displayTimeStamps","values","valuesAndTimes","v","valIdx","span","histogramsAndTimes","histograms","seriesQueryResult","h","hisIdx","width","kind","spec","unit","flexDirection","count","sum","histogramTable","style","whiteSpace","name","formattedName","labels","leftDelim","br","rightDelim","bucketRangeString","boundaryRule","leftBoundary","rightBoundary","textAlign","colSpan","buckets","b","i"],"mappings":";AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAAkCA,OAAO,QAAQ,QAAQ;AACzD,SAASC,KAAK,EAAEC,GAAG,EAAEC,KAAK,EAAEC,KAAK,EAAEC,SAAS,EAAEC,SAAS,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,gBAAgB;AAGhH,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,aAAa,QAAQ,kBAAkB;AAEhD,MAAMC,yBAAyB;AAM/B;;;;;;;CAOC,GACD,OAAO,MAAMC,YAAY,CAAC,EAAEC,YAAY,EAAkB;IACxD,MAAMC,SAASf,QAAQ,IAAMc,aAAaE,OAAO,CAAC,CAACC,IAAMA,EAAEC,IAAI,EAAEF,OAAO,CAAC,CAACC,IAAMA,GAAGF,UAAU,EAAE,GAAG;QAACD;KAAa;IAChH,MAAMK,OAAOnB,QA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MAACG;;0CACC,KAACF;0CAAU;;0CACX,KAACA;0CAAU;;;;oBAEZoC,EAAEwB,OAAO,EAAEpC,IAAI,CAACqC,GAAgBC,kBAC/B,MAAC5D;;8CACC,KAACF;8CAAWsD,kBAAkBO;;8CAC9B,KAAC7D;8CAAW6D,CAAC,CAAC,EAAE;;;2BAFHC;;;;OAOrB"}
1
+ {"version":3,"sources":["../../../src/components/DataTable.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n Alert,\n Box,\n Checkbox,\n Stack,\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableRow,\n Typography,\n} from '@mui/material';\nimport { useSelection } from '@perses-dev/components';\nimport { BucketTuple, HistogramValue, TimeSeries, TimeSeriesData, TimeSeriesHistogramTuple } from '@perses-dev/core';\nimport { useSelectionItemActions } from '@perses-dev/dashboards';\nimport { ActionOptions, PanelData, useAllVariableValues } from '@perses-dev/plugin-system';\nimport { ReactElement, ReactNode, useCallback, useMemo } from 'react';\nimport { TimeSeriesTableOptions } from '../model';\nimport { EmbeddedPanel } from './EmbeddedPanel';\nimport { SeriesName } from './SeriesName';\n\nconst MAX_FORMATTABLE_SERIES = 1000;\n\nexport interface DataTableProps {\n queryResults: Array<PanelData<TimeSeriesData>>;\n spec: TimeSeriesTableOptions;\n}\n\n/**\n * Build row data object from a TimeSeries, including all labels and value\n */\nfunction buildRowData(ts: TimeSeries): Record<string, unknown> {\n return {\n ...ts.labels,\n name: ts.name,\n formattedName: ts.formattedName,\n value: ts.values?.[0]?.[1],\n timestamp: ts.values?.[0]?.[0],\n };\n}\n\n/**\n * Designed to display timeseries data in a prometheus like table format.\n * The first column will contain the metric name and label combination, and the second column will contain the values.\n * This is inspired by prometheus DataTable.\n * https://github.com/prometheus/prometheus/blob/2524a915915d7eb1b1207152d2e0ce5771193404/web/ui/react-app/src/pages/graph/DataTable.tsx\n * @param result timeseries query result\n * @constructor\n */\nexport const DataTable = ({ queryResults, spec }: DataTableProps): ReactElement | null => {\n const allVariables = useAllVariableValues();\n const series = useMemo(() => queryResults.flatMap((d) => d.data).flatMap((d) => d?.series || []), [queryResults]);\n\n const selectionEnabled = spec.selection?.enabled ?? false;\n const { selectionMap, setSelection, clearSelection, toggleSelection } = useSelection<\n Record<string, unknown>,\n string\n >();\n\n const itemActionsConfig = spec.actions ? (spec.actions as ActionOptions) : undefined;\n const itemActionsListConfig = useMemo(\n () => (itemActionsConfig?.enabled && itemActionsConfig.displayWithItem ? itemActionsConfig.actionsList : []),\n [itemActionsConfig?.enabled, itemActionsConfig?.displayWithItem, itemActionsConfig?.actionsList]\n );\n\n const { getItemActionButtons, confirmDialog, actionButtons } = useSelectionItemActions({\n actions: itemActionsListConfig,\n variableState: allVariables,\n });\n\n const hasItemActions = actionButtons && actionButtons.length > 0;\n\n const allSelected = useMemo(() => {\n if (series.length === 0) return false;\n return series.every((_, idx) => selectionMap.has(idx.toString()));\n }, [series, selectionMap]);\n\n // Check if some (but not all) series are selected\n const someSelected = useMemo(() => {\n if (series.length === 0) return false;\n const selectedCount = series.filter((_, idx) => selectionMap.has(idx.toString())).length;\n return selectedCount > 0 && selectedCount < series.length;\n }, [series, selectionMap]);\n\n const handleSelectAll = useCallback(() => {\n if (allSelected) {\n clearSelection();\n } else {\n const allItems = series.map((ts, idx) => ({\n id: idx.toString(),\n item: buildRowData(ts),\n }));\n setSelection(allItems);\n }\n }, [allSelected, series, setSelection, clearSelection]);\n\n const handleRowSelectionToggle = useCallback(\n (ts: TimeSeries, seriesIdx: number) => {\n const rowData = buildRowData(ts);\n toggleSelection(rowData, seriesIdx.toString());\n },\n [toggleSelection]\n );\n\n // Memoize row data for stable references\n const rowsData = useMemo(() => {\n return series.map((ts, idx) => ({\n ts,\n idx,\n rowData: buildRowData(ts),\n }));\n }, [series]);\n\n if (!queryResults || !series?.length) {\n return (\n <Box\n sx={{\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n height: '100%',\n }}\n >\n <Typography>No data</Typography>\n </Box>\n );\n }\n\n return (\n <>\n {confirmDialog}\n {series.length >= MAX_FORMATTABLE_SERIES && (\n <Alert severity=\"warning\">\n Showing more than {MAX_FORMATTABLE_SERIES} series, turning off label formatting for performance reasons.\n </Alert>\n )}\n <Table className=\"data-table\">\n {selectionEnabled && series.length > 0 && (\n <TableHead>\n <TableRow>\n <TableCell padding=\"checkbox\">\n <Checkbox\n indeterminate={someSelected}\n checked={allSelected}\n onChange={handleSelectAll}\n inputProps={{ 'aria-label': 'select all series' }}\n />\n </TableCell>\n <TableCell>Series</TableCell>\n <TableCell>Value</TableCell>\n {hasItemActions && <TableCell>Actions</TableCell>}\n </TableRow>\n </TableHead>\n )}\n <TableBody>\n {rowsData.map(({ ts, idx, rowData }) => {\n const displayTimeStamps = (ts.values?.length ?? 0) > 1;\n const valuesAndTimes = ts.values\n ? ts.values.map((v, valIdx) => (\n <Typography key={valIdx}>\n {v[1]} {displayTimeStamps && <span>@{v[0]}</span>}\n </Typography>\n ))\n : [];\n\n let histogramsAndTimes = null;\n if (ts.histograms && ts.histograms.length > 0) {\n const seriesQueryResult: PanelData<TimeSeriesData> = {\n ...queryResults[0]!,\n data: {\n ...queryResults[0]!.data,\n series: [queryResults[0]!.data.series[idx]!],\n },\n };\n\n histogramsAndTimes = ts.histograms.map((h: TimeSeriesHistogramTuple, hisIdx: number) => (\n <Stack alignItems=\"center\" key={-hisIdx}>\n <Box width={400} height={200}>\n <EmbeddedPanel\n kind=\"HistogramChart\"\n spec={{ unit: 'decimal', width: 400, height: 200 }}\n queryResults={[seriesQueryResult]}\n />\n </Box>\n <Stack flexDirection=\"row\" justifyContent=\"space-between\" width=\"100%\">\n <Typography>Total count: {h[1].count}</Typography>\n <Typography>Sum: {h[1].sum}</Typography>\n </Stack>\n {histogramTable(h[1])}\n </Stack>\n ));\n }\n\n const rowId = idx.toString();\n const isSelected = selectionMap.has(rowId);\n const isFormatted = series.length < MAX_FORMATTABLE_SERIES;\n\n return (\n <TableRow style={{ whiteSpace: 'pre' }} key={idx}>\n {selectionEnabled && (\n <TableCell padding=\"checkbox\">\n <Checkbox\n checked={isSelected}\n onChange={() => handleRowSelectionToggle(ts, idx)}\n inputProps={{ 'aria-label': `select series ${idx}` }}\n />\n </TableCell>\n )}\n <TableCell>\n <SeriesName\n name={ts.name}\n formattedName={ts.formattedName}\n labels={ts.labels}\n isFormatted={isFormatted}\n />\n </TableCell>\n <TableCell>{ts.histograms ? histogramsAndTimes : valuesAndTimes}</TableCell>\n {hasItemActions && (\n <TableCell>\n <Box sx={{ display: 'flex', gap: 1 }}>{getItemActionButtons({ id: rowId, data: rowData })}</Box>\n </TableCell>\n )}\n </TableRow>\n );\n })}\n </TableBody>\n </Table>\n </>\n );\n};\n\nconst leftDelim = (br: number): string => (br === 3 || br === 1 ? '[' : '(');\nconst rightDelim = (br: number): string => (br === 3 || br === 0 ? ']' : ')');\n\nexport const bucketRangeString = ([boundaryRule, leftBoundary, rightBoundary]: [\n number,\n string,\n string,\n string,\n]): string => {\n return `${leftDelim(boundaryRule)}${leftBoundary} -> ${rightBoundary}${rightDelim(boundaryRule)}`;\n};\n\nexport const histogramTable = (h: HistogramValue): ReactNode => (\n <Table>\n <TableHead>\n <TableRow>\n <TableCell style={{ textAlign: 'center' }} colSpan={2}>\n Histogram Sample\n </TableCell>\n </TableRow>\n </TableHead>\n <TableBody>\n <TableRow>\n <TableCell>Range</TableCell>\n <TableCell>Count</TableCell>\n </TableRow>\n {h.buckets?.map((b: BucketTuple, i: number) => (\n <TableRow key={i}>\n <TableCell>{bucketRangeString(b)}</TableCell>\n <TableCell>{b[3]}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n);\n"],"names":["Alert","Box","Checkbox","Stack","Table","TableBody","TableCell","TableHead","TableRow","Typography","useSelection","useSelectionItemActions","useAllVariableValues","useCallback","useMemo","EmbeddedPanel","SeriesName","MAX_FORMATTABLE_SERIES","buildRowData","ts","labels","name","formattedName","value","values","timestamp","DataTable","queryResults","spec","allVariables","series","flatMap","d","data","selectionEnabled","selection","enabled","selectionMap","setSelection","clearSelection","toggleSelection","itemActionsConfig","actions","undefined","itemActionsListConfig","displayWithItem","actionsList","getItemActionButtons","confirmDialog","actionButtons","variableState","hasItemActions","length","allSelected","every","_","idx","has","toString","someSelected","selectedCount","filter","handleSelectAll","allItems","map","id","item","handleRowSelectionToggle","seriesIdx","rowData","rowsData","sx","display","justifyContent","alignItems","height","severity","className","padding","indeterminate","checked","onChange","inputProps","displayTimeStamps","valuesAndTimes","v","valIdx","span","histogramsAndTimes","histograms","seriesQueryResult","h","hisIdx","width","kind","unit","flexDirection","count","sum","histogramTable","rowId","isSelected","isFormatted","style","whiteSpace","gap","leftDelim","br","rightDelim","bucketRangeString","boundaryRule","leftBoundary","rightBoundary","textAlign","colSpan","buckets","b","i"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SACEA,KAAK,EACLC,GAAG,EACHC,QAAQ,EACRC,KAAK,EACLC,KAAK,EACLC,SAAS,EACTC,SAAS,EACTC,SAAS,EACTC,QAAQ,EACRC,UAAU,QACL,gBAAgB;AACvB,SAASC,YAAY,QAAQ,yBAAyB;AAEtD,SAASC,uBAAuB,QAAQ,yBAAyB;AACjE,SAAmCC,oBAAoB,QAAQ,4BAA4B;AAC3F,SAAkCC,WAAW,EAAEC,OAAO,QAAQ,QAAQ;AAEtE,SAASC,aAAa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,KAAKA,OAAO,IAAI,MAAM;AACxE,MAAMC,aAAa,CAACD,KAAwBA,OAAO,KAAKA,OAAO,IAAI,MAAM;AAEzE,OAAO,MAAME,oBAAoB,CAAC,CAACC,cAAcC,cAAcC,cAK9D;IACC,OAAO,GAAGN,UAAUI,gBAAgBC,aAAa,IAAI,EAAEC,gBAAgBJ,WAAWE,eAAe;AACnG,EAAE;AAEF,OAAO,MAAMX,iBAAiB,CAACR,kBAC7B,MAACvF;;0BACC,KAACG;0BACC,cAAA,KAACC;8BACC,cAAA,KAACF;wBAAUiG,OAAO;4BAAEU,WAAW;wBAAS;wBAAGC,SAAS;kCAAG;;;;0BAK3D,MAAC7G;;kCACC,MAACG;;0CACC,KAACF;0CAAU;;0CACX,KAACA;0CAAU;;;;oBAEZqF,EAAEwB,OAAO,EAAEnD,IAAI,CAACoD,GAAgBC,kBAC/B,MAAC7G;;8CACC,KAACF;8CAAWuG,kBAAkBO;;8CAC9B,KAAC9G;8CAAW8G,CAAC,CAAC,EAAE;;;2BAFHC;;;;OAOrB"}
@@ -1,4 +1,4 @@
1
- // Copyright 2025 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/EmbeddedPanel.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PanelData } from '@perses-dev/plugin-system';\nimport { QueryDataType, UnknownSpec } from '@perses-dev/core';\nimport { PanelPluginLoader } from '@perses-dev/dashboards';\nimport useResizeObserver from 'use-resize-observer';\nimport { ErrorAlert, ErrorBoundary } from '@perses-dev/components';\n\ninterface EmbeddedPanelProps {\n kind: string;\n spec: UnknownSpec;\n queryResults: Array<PanelData<QueryDataType>>;\n}\n\nexport function EmbeddedPanel({ kind, spec, queryResults }: EmbeddedPanelProps) {\n const { ref, width = 1, height = 1 } = useResizeObserver<HTMLDivElement>();\n return (\n <div ref={ref} style={{ height: '100%' }}>\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <PanelPluginLoader kind={kind} contentDimensions={{ width, height }} spec={spec} queryResults={queryResults} />\n </ErrorBoundary>\n </div>\n );\n}\n"],"names":["PanelPluginLoader","useResizeObserver","ErrorAlert","ErrorBoundary","EmbeddedPanel","kind","spec","queryResults","ref","width","height","div","style","FallbackComponent","contentDimensions"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAIjC,SAASA,iBAAiB,QAAQ,yBAAyB;AAC3D,OAAOC,uBAAuB,sBAAsB;AACpD,SAASC,UAAU,EAAEC,aAAa,QAAQ,yBAAyB;AAQnE,OAAO,SAASC,cAAc,EAAEC,IAAI,EAAEC,IAAI,EAAEC,YAAY,EAAsB;IAC5E,MAAM,EAAEC,GAAG,EAAEC,QAAQ,CAAC,EAAEC,SAAS,CAAC,EAAE,GAAGT;IACvC,qBACE,KAACU;QAAIH,KAAKA;QAAKI,OAAO;YAAEF,QAAQ;QAAO;kBACrC,cAAA,KAACP;YAAcU,mBAAmBX;sBAChC,cAAA,KAACF;gBAAkBK,MAAMA;gBAAMS,mBAAmB;oBAAEL;oBAAOC;gBAAO;gBAAGJ,MAAMA;gBAAMC,cAAcA;;;;AAIvG"}
1
+ {"version":3,"sources":["../../../src/components/EmbeddedPanel.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PanelData } from '@perses-dev/plugin-system';\nimport { QueryDataType, UnknownSpec } from '@perses-dev/core';\nimport { PanelPluginLoader } from '@perses-dev/dashboards';\nimport useResizeObserver from 'use-resize-observer';\nimport { ErrorAlert, ErrorBoundary } from '@perses-dev/components';\n\ninterface EmbeddedPanelProps {\n kind: string;\n spec: UnknownSpec;\n queryResults: Array<PanelData<QueryDataType>>;\n}\n\nexport function EmbeddedPanel({ kind, spec, queryResults }: EmbeddedPanelProps) {\n const { ref, width = 1, height = 1 } = useResizeObserver<HTMLDivElement>();\n return (\n <div ref={ref} style={{ height: '100%' }}>\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <PanelPluginLoader kind={kind} contentDimensions={{ width, height }} spec={spec} queryResults={queryResults} />\n </ErrorBoundary>\n </div>\n );\n}\n"],"names":["PanelPluginLoader","useResizeObserver","ErrorAlert","ErrorBoundary","EmbeddedPanel","kind","spec","queryResults","ref","width","height","div","style","FallbackComponent","contentDimensions"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAIjC,SAASA,iBAAiB,QAAQ,yBAAyB;AAC3D,OAAOC,uBAAuB,sBAAsB;AACpD,SAASC,UAAU,EAAEC,aAAa,QAAQ,yBAAyB;AAQnE,OAAO,SAASC,cAAc,EAAEC,IAAI,EAAEC,IAAI,EAAEC,YAAY,EAAsB;IAC5E,MAAM,EAAEC,GAAG,EAAEC,QAAQ,CAAC,EAAEC,SAAS,CAAC,EAAE,GAAGT;IACvC,qBACE,KAACU;QAAIH,KAAKA;QAAKI,OAAO;YAAEF,QAAQ;QAAO;kBACrC,cAAA,KAACP;YAAcU,mBAAmBX;sBAChC,cAAA,KAACF;gBAAkBK,MAAMA;gBAAMS,mBAAmB;oBAAEL;oBAAOC;gBAAO;gBAAGJ,MAAMA;gBAAMC,cAAcA;;;;AAIvG"}
@@ -1,4 +1,4 @@
1
- // Copyright 2024 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/SeriesName.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Labels } from '@perses-dev/core';\nimport { ReactElement, MouseEvent } from 'react';\nimport { useSnackbar } from '@perses-dev/components';\nimport { Typography } from '@mui/material';\n\ninterface SeriesNameProps {\n name: string;\n labels?: Labels;\n formattedName?: string;\n isFormatted?: boolean;\n}\n\n/*\n * Display a series with labels in bold and with a copy to clipboard feature if isFormatted is enabled\n * Else it will only display the series in plain text (mostly use for performance reasons)\n */\nexport function SeriesName({ name, labels, formattedName, isFormatted }: SeriesNameProps): ReactElement {\n if (isFormatted && labels && Object.keys(labels).length > 0) {\n return <FormatedSeriesName labels={labels} />;\n }\n return <Typography sx={{ textWrap: 'auto' }}>{formattedName ?? name}</Typography>;\n}\n\nfunction FormatedSeriesName({ labels }: { labels: Labels }): ReactElement {\n const { infoSnackbar } = useSnackbar();\n\n const labelNodes: ReactElement[] = [];\n let first = true;\n\n function copyToClipboard(e: MouseEvent<HTMLSpanElement>): void {\n const copyText = e.currentTarget.innerText || '';\n navigator.clipboard\n .writeText(copyText.trim())\n .then(() => {\n infoSnackbar(`Copied label matcher: ${copyText}`);\n })\n .catch((reason) => {\n console.error(`unable to copy text: ${reason}`);\n });\n }\n\n for (const label in labels) {\n if (label === '__name__') {\n continue;\n }\n\n labelNodes.push(\n <span key={label}>\n {!first && ', '}\n <Typography\n display=\"inline\"\n component=\"span\"\n sx={{\n '&:hover': {\n cursor: 'pointer',\n textDecoration: 'underline',\n },\n }}\n onClick={copyToClipboard}\n title=\"Click to copy label matcher\"\n >\n <strong>{label}</strong>=<span>&quot;{labels[label]}&quot;</span>\n </Typography>\n </span>\n );\n\n if (first) {\n first = false;\n }\n }\n\n return (\n <Typography sx={{ textWrap: 'auto' }}>\n {labels ? labels.__name__ : ''}\n {'{'}\n {labelNodes}\n {'}'}\n </Typography>\n );\n}\n"],"names":["useSnackbar","Typography","SeriesName","name","labels","formattedName","isFormatted","Object","keys","length","FormatedSeriesName","sx","textWrap","infoSnackbar","labelNodes","first","copyToClipboard","e","copyText","currentTarget","innerText","navigator","clipboard","writeText","trim","then","catch","reason","console","error","label","push","span","display","component","cursor","textDecoration","onClick","title","strong","__name__"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAIjC,SAASA,WAAW,QAAQ,yBAAyB;AACrD,SAASC,UAAU,QAAQ,gBAAgB;AAS3C;;;CAGC,GACD,OAAO,SAASC,WAAW,EAAEC,IAAI,EAAEC,MAAM,EAAEC,aAAa,EAAEC,WAAW,EAAmB;IACtF,IAAIA,eAAeF,UAAUG,OAAOC,IAAI,CAACJ,QAAQK,MAAM,GAAG,GAAG;QAC3D,qBAAO,KAACC;YAAmBN,QAAQA;;IACrC;IACA,qBAAO,KAACH;QAAWU,IAAI;YAAEC,UAAU;QAAO;kBAAIP,iBAAiBF;;AACjE;AAEA,SAASO,mBAAmB,EAAEN,MAAM,EAAsB;IACxD,MAAM,EAAES,YAAY,EAAE,GAAGb;IAEzB,MAAMc,aAA6B,EAAE;IACrC,IAAIC,QAAQ;IAEZ,SAASC,gBAAgBC,CAA8B;QACrD,MAAMC,WAAWD,EAAEE,aAAa,CAACC,SAAS,IAAI;QAC9CC,UAAUC,SAAS,CAChBC,SAAS,CAACL,SAASM,IAAI,IACvBC,IAAI,CAAC;YACJZ,aAAa,CAAC,sBAAsB,EAAEK,UAAU;QAClD,GACCQ,KAAK,CAAC,CAACC;YACNC,QAAQC,KAAK,CAAC,CAAC,qBAAqB,EAAEF,QAAQ;QAChD;IACJ;IAEA,IAAK,MAAMG,SAAS1B,OAAQ;QAC1B,IAAI0B,UAAU,YAAY;YACxB;QACF;QAEAhB,WAAWiB,IAAI,eACb,MAACC;;gBACE,CAACjB,SAAS;8BACX,MAACd;oBACCgC,SAAQ;oBACRC,WAAU;oBACVvB,IAAI;wBACF,WAAW;4BACTwB,QAAQ;4BACRC,gBAAgB;wBAClB;oBACF;oBACAC,SAASrB;oBACTsB,OAAM;;sCAEN,KAACC;sCAAQT;;wBAAe;sCAAC,MAACE;;gCAAK;gCAAO5B,MAAM,CAAC0B,MAAM;gCAAC;;;;;;WAd7CA;QAmBb,IAAIf,OAAO;YACTA,QAAQ;QACV;IACF;IAEA,qBACE,MAACd;QAAWU,IAAI;YAAEC,UAAU;QAAO;;YAChCR,SAASA,OAAOoC,QAAQ,GAAG;YAC3B;YACA1B;YACA;;;AAGP"}
1
+ {"version":3,"sources":["../../../src/components/SeriesName.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Labels } from '@perses-dev/core';\nimport { ReactElement, MouseEvent } from 'react';\nimport { useSnackbar } from '@perses-dev/components';\nimport { Typography } from '@mui/material';\n\ninterface SeriesNameProps {\n name: string;\n labels?: Labels;\n formattedName?: string;\n isFormatted?: boolean;\n}\n\n/*\n * Display a series with labels in bold and with a copy to clipboard feature if isFormatted is enabled\n * Else it will only display the series in plain text (mostly use for performance reasons)\n */\nexport function SeriesName({ name, labels, formattedName, isFormatted }: SeriesNameProps): ReactElement {\n if (isFormatted && labels && Object.keys(labels).length > 0) {\n return <FormatedSeriesName labels={labels} />;\n }\n return <Typography sx={{ textWrap: 'auto' }}>{formattedName ?? name}</Typography>;\n}\n\nfunction FormatedSeriesName({ labels }: { labels: Labels }): ReactElement {\n const { infoSnackbar } = useSnackbar();\n\n const labelNodes: ReactElement[] = [];\n let first = true;\n\n function copyToClipboard(e: MouseEvent<HTMLSpanElement>): void {\n const copyText = e.currentTarget.innerText || '';\n navigator.clipboard\n .writeText(copyText.trim())\n .then(() => {\n infoSnackbar(`Copied label matcher: ${copyText}`);\n })\n .catch((reason) => {\n console.error(`unable to copy text: ${reason}`);\n });\n }\n\n for (const label in labels) {\n if (label === '__name__') {\n continue;\n }\n\n labelNodes.push(\n <span key={label}>\n {!first && ', '}\n <Typography\n display=\"inline\"\n component=\"span\"\n sx={{\n '&:hover': {\n cursor: 'pointer',\n textDecoration: 'underline',\n },\n }}\n onClick={copyToClipboard}\n title=\"Click to copy label matcher\"\n >\n <strong>{label}</strong>=<span>&quot;{labels[label]}&quot;</span>\n </Typography>\n </span>\n );\n\n if (first) {\n first = false;\n }\n }\n\n return (\n <Typography sx={{ textWrap: 'auto' }}>\n {labels ? labels.__name__ : ''}\n {'{'}\n {labelNodes}\n {'}'}\n </Typography>\n );\n}\n"],"names":["useSnackbar","Typography","SeriesName","name","labels","formattedName","isFormatted","Object","keys","length","FormatedSeriesName","sx","textWrap","infoSnackbar","labelNodes","first","copyToClipboard","e","copyText","currentTarget","innerText","navigator","clipboard","writeText","trim","then","catch","reason","console","error","label","push","span","display","component","cursor","textDecoration","onClick","title","strong","__name__"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAIjC,SAASA,WAAW,QAAQ,yBAAyB;AACrD,SAASC,UAAU,QAAQ,gBAAgB;AAS3C;;;CAGC,GACD,OAAO,SAASC,WAAW,EAAEC,IAAI,EAAEC,MAAM,EAAEC,aAAa,EAAEC,WAAW,EAAmB;IACtF,IAAIA,eAAeF,UAAUG,OAAOC,IAAI,CAACJ,QAAQK,MAAM,GAAG,GAAG;QAC3D,qBAAO,KAACC;YAAmBN,QAAQA;;IACrC;IACA,qBAAO,KAACH;QAAWU,IAAI;YAAEC,UAAU;QAAO;kBAAIP,iBAAiBF;;AACjE;AAEA,SAASO,mBAAmB,EAAEN,MAAM,EAAsB;IACxD,MAAM,EAAES,YAAY,EAAE,GAAGb;IAEzB,MAAMc,aAA6B,EAAE;IACrC,IAAIC,QAAQ;IAEZ,SAASC,gBAAgBC,CAA8B;QACrD,MAAMC,WAAWD,EAAEE,aAAa,CAACC,SAAS,IAAI;QAC9CC,UAAUC,SAAS,CAChBC,SAAS,CAACL,SAASM,IAAI,IACvBC,IAAI,CAAC;YACJZ,aAAa,CAAC,sBAAsB,EAAEK,UAAU;QAClD,GACCQ,KAAK,CAAC,CAACC;YACNC,QAAQC,KAAK,CAAC,CAAC,qBAAqB,EAAEF,QAAQ;QAChD;IACJ;IAEA,IAAK,MAAMG,SAAS1B,OAAQ;QAC1B,IAAI0B,UAAU,YAAY;YACxB;QACF;QAEAhB,WAAWiB,IAAI,eACb,MAACC;;gBACE,CAACjB,SAAS;8BACX,MAACd;oBACCgC,SAAQ;oBACRC,WAAU;oBACVvB,IAAI;wBACF,WAAW;4BACTwB,QAAQ;4BACRC,gBAAgB;wBAClB;oBACF;oBACAC,SAASrB;oBACTsB,OAAM;;sCAEN,KAACC;sCAAQT;;wBAAe;sCAAC,MAACE;;gCAAK;gCAAO5B,MAAM,CAAC0B,MAAM;gCAAC;;;;;;WAd7CA;QAmBb,IAAIf,OAAO;YACTA,QAAQ;QACV;IACF;IAEA,qBACE,MAACd;QAAWU,IAAI;YAAEC,UAAU;QAAO;;YAChCR,SAASA,OAAOoC,QAAQ,GAAG;YAC3B;YACA1B;YACA;;;AAGP"}
@@ -0,0 +1,4 @@
1
+ import { ReactElement } from 'react';
2
+ import { TimeSeriesTableSettingsEditorProps } from '../model';
3
+ export declare function TimeSeriesTableItemSelectionActionsEditor({ value, onChange, }: TimeSeriesTableSettingsEditorProps): ReactElement;
4
+ //# sourceMappingURL=TimeSeriesTableItemSelectionActionsEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimeSeriesTableItemSelectionActionsEditor.d.ts","sourceRoot":"","sources":["../../../src/components/TimeSeriesTableItemSelectionActionsEditor.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,kCAAkC,EAAE,MAAM,UAAU,CAAC;AAE9D,wBAAgB,yCAAyC,CAAC,EACxD,KAAK,EACL,QAAQ,GACT,EAAE,kCAAkC,GAAG,YAAY,CAiBnD"}
@@ -0,0 +1,36 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // Copyright The Perses Authors
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ import { ItemSelectionActionsEditor } from '@perses-dev/plugin-system';
15
+ export function TimeSeriesTableItemSelectionActionsEditor({ value, onChange }) {
16
+ function handleActionsChange(actions) {
17
+ onChange({
18
+ ...value,
19
+ actions: actions
20
+ });
21
+ }
22
+ function handleSelectionChange(selection) {
23
+ onChange({
24
+ ...value,
25
+ selection: selection
26
+ });
27
+ }
28
+ return /*#__PURE__*/ _jsx(ItemSelectionActionsEditor, {
29
+ actionOptions: value.actions,
30
+ onChangeActions: handleActionsChange,
31
+ selectionOptions: value.selection,
32
+ onChangeSelection: handleSelectionChange
33
+ });
34
+ }
35
+
36
+ //# sourceMappingURL=TimeSeriesTableItemSelectionActionsEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/TimeSeriesTableItemSelectionActionsEditor.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ActionOptions, ItemSelectionActionsEditor, SelectionOptions } from '@perses-dev/plugin-system';\nimport { ReactElement } from 'react';\nimport { TimeSeriesTableSettingsEditorProps } from '../model';\n\nexport function TimeSeriesTableItemSelectionActionsEditor({\n value,\n onChange,\n}: TimeSeriesTableSettingsEditorProps): ReactElement {\n function handleActionsChange(actions: ActionOptions | undefined): void {\n onChange({ ...value, actions: actions });\n }\n\n function handleSelectionChange(selection: SelectionOptions | undefined): void {\n onChange({ ...value, selection: selection });\n }\n\n return (\n <ItemSelectionActionsEditor\n actionOptions={value.actions}\n onChangeActions={handleActionsChange}\n selectionOptions={value.selection}\n onChangeSelection={handleSelectionChange}\n />\n );\n}\n"],"names":["ItemSelectionActionsEditor","TimeSeriesTableItemSelectionActionsEditor","value","onChange","handleActionsChange","actions","handleSelectionChange","selection","actionOptions","onChangeActions","selectionOptions","onChangeSelection"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAAwBA,0BAA0B,QAA0B,4BAA4B;AAIxG,OAAO,SAASC,0CAA0C,EACxDC,KAAK,EACLC,QAAQ,EAC2B;IACnC,SAASC,oBAAoBC,OAAkC;QAC7DF,SAAS;YAAE,GAAGD,KAAK;YAAEG,SAASA;QAAQ;IACxC;IAEA,SAASC,sBAAsBC,SAAuC;QACpEJ,SAAS;YAAE,GAAGD,KAAK;YAAEK,WAAWA;QAAU;IAC5C;IAEA,qBACE,KAACP;QACCQ,eAAeN,MAAMG,OAAO;QAC5BI,iBAAiBL;QACjBM,kBAAkBR,MAAMK,SAAS;QACjCI,mBAAmBL;;AAGzB"}
@@ -1,3 +1,4 @@
1
1
  export * from './DataTable';
2
2
  export * from './SeriesName';
3
+ export * from './TimeSeriesTableItemSelectionActionsEditor';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,6CAA6C,CAAC"}
@@ -1,4 +1,17 @@
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.
1
13
  export * from './DataTable';
2
14
  export * from './SeriesName';
15
+ export * from './TimeSeriesTableItemSelectionActionsEditor';
3
16
 
4
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["export * from './DataTable';\nexport * from './SeriesName';\n"],"names":[],"mappings":"AAAA,cAAc,cAAc;AAC5B,cAAc,eAAe"}
1
+ {"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './DataTable';\nexport * from './SeriesName';\nexport * from './TimeSeriesTableItemSelectionActionsEditor';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,cAAc;AAC5B,cAAc,eAAe;AAC7B,cAAc,8CAA8C"}
package/lib/env.d.js CHANGED
@@ -1,4 +1,4 @@
1
- // Copyright 2024 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
package/lib/env.d.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/env.d.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/// <reference types=\"@rsbuild/core/types\" />\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,6CAA6C"}
1
+ {"version":3,"sources":["../../src/env.d.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/// <reference types=\"@rsbuild/core/types\" />\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,6CAA6C"}
@@ -1 +1 @@
1
- {"version":3,"file":"getPluginModule.d.ts","sourceRoot":"","sources":["../../src/getPluginModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAoB,MAAM,2BAA2B,CAAC;AAGnF;;GAEG;AACH,wBAAgB,eAAe,IAAI,oBAAoB,CAUtD"}
1
+ {"version":3,"file":"getPluginModule.d.ts","sourceRoot":"","sources":["../../src/getPluginModule.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,oBAAoB,EAAoB,MAAM,2BAA2B,CAAC;AAGnF;;GAEG;AACH,wBAAgB,eAAe,IAAI,oBAAoB,CAUtD"}
@@ -1,3 +1,15 @@
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.
1
13
  import packageJson from '../package.json';
2
14
  /**
3
15
  * Returns the plugin module information from package.json