@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.
- package/__mf/js/{TimeSeriesTable.5ba10319.js → TimeSeriesTable.cdbd463d.js} +3 -3
- package/__mf/js/async/1117.dd32fc22.js +2 -0
- package/__mf/js/async/1939.2bf7b68b.js +1 -0
- package/__mf/js/async/2240.d6885088.js +1 -0
- package/__mf/js/async/392.0af27180.js +2 -0
- package/__mf/js/async/4407.fcda154b.js +1 -0
- package/__mf/js/async/5357.b184bde0.js +110 -0
- package/__mf/js/async/54.3e02cca4.js +22 -0
- package/__mf/js/async/5955.d8a0d358.js +7 -0
- package/__mf/js/async/648.0698f9e5.js +1 -0
- package/__mf/js/async/6599.ae361779.js +2 -0
- package/__mf/js/async/8994.783cc861.js +37 -0
- package/__mf/js/async/__federation_expose_TimeSeriesTable.2d999a4c.js +1 -0
- package/__mf/js/async/lib-router.1f77f0cd.js +2 -0
- package/__mf/js/async/{lib-router.4afa3869.js.LICENSE.txt → lib-router.1f77f0cd.js.LICENSE.txt} +3 -3
- package/__mf/js/{main.5494308c.js → main.6ab5cdb3.js} +3 -3
- package/lib/TimeSeriesTable.d.ts.map +1 -1
- package/lib/TimeSeriesTable.js +8 -1
- package/lib/TimeSeriesTable.js.map +1 -1
- package/lib/TimeSeriesTablePanel.js +4 -3
- package/lib/TimeSeriesTablePanel.js.map +1 -1
- package/lib/bootstrap.js +1 -1
- package/lib/bootstrap.js.map +1 -1
- package/lib/cjs/TimeSeriesTable.js +8 -1
- package/lib/cjs/TimeSeriesTablePanel.js +4 -3
- package/lib/cjs/bootstrap.js +1 -1
- package/lib/cjs/components/DataTable.js +218 -101
- package/lib/cjs/components/EmbeddedPanel.js +1 -1
- package/lib/cjs/components/SeriesName.js +1 -1
- package/lib/cjs/components/TimeSeriesTableItemSelectionActionsEditor.js +44 -0
- package/lib/cjs/components/index.js +13 -0
- package/lib/cjs/env.d.js +1 -1
- package/lib/cjs/getPluginModule.js +12 -0
- package/lib/cjs/index-federation.js +1 -1
- package/lib/cjs/index.js +12 -0
- package/lib/cjs/model.js +12 -1
- package/lib/cjs/setup-tests.js +1 -1
- package/lib/cjs/test/mock-query-results.js +1 -1
- package/lib/components/DataTable.d.ts +5 -3
- package/lib/components/DataTable.d.ts.map +1 -1
- package/lib/components/DataTable.js +219 -102
- package/lib/components/DataTable.js.map +1 -1
- package/lib/components/EmbeddedPanel.js +1 -1
- package/lib/components/EmbeddedPanel.js.map +1 -1
- package/lib/components/SeriesName.js +1 -1
- package/lib/components/SeriesName.js.map +1 -1
- package/lib/components/TimeSeriesTableItemSelectionActionsEditor.d.ts +4 -0
- package/lib/components/TimeSeriesTableItemSelectionActionsEditor.d.ts.map +1 -0
- package/lib/components/TimeSeriesTableItemSelectionActionsEditor.js +36 -0
- package/lib/components/TimeSeriesTableItemSelectionActionsEditor.js.map +1 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +13 -0
- package/lib/components/index.js.map +1 -1
- package/lib/env.d.js +1 -1
- package/lib/env.d.js.map +1 -1
- package/lib/getPluginModule.d.ts.map +1 -1
- package/lib/getPluginModule.js +12 -0
- package/lib/getPluginModule.js.map +1 -1
- package/lib/index-federation.js +1 -1
- package/lib/index-federation.js.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +12 -0
- package/lib/index.js.map +1 -1
- package/lib/model.d.ts +10 -0
- package/lib/model.d.ts.map +1 -1
- package/lib/model.js +12 -1
- package/lib/model.js.map +1 -1
- package/lib/setup-tests.js +1 -1
- package/lib/setup-tests.js.map +1 -1
- package/lib/test/mock-query-results.js +1 -1
- package/lib/test/mock-query-results.js.map +1 -1
- package/mf-manifest.json +26 -25
- package/mf-stats.json +31 -27
- package/package.json +5 -5
- package/__mf/js/async/1117.8c12a843.js +0 -2
- package/__mf/js/async/1490.1b37e9b3.js +0 -22
- package/__mf/js/async/2555.3e9e6122.js +0 -7
- package/__mf/js/async/2710.135d1c9a.js +0 -37
- package/__mf/js/async/2757.0345b149.js +0 -1
- package/__mf/js/async/383.737ba616.js +0 -110
- package/__mf/js/async/392.cf8653c1.js +0 -2
- package/__mf/js/async/6517.c68cf337.js +0 -2
- package/__mf/js/async/7417.abe3c9e4.js +0 -1
- package/__mf/js/async/8252.16ced360.js +0 -1
- package/__mf/js/async/__federation_expose_TimeSeriesTable.cfbb153a.js +0 -1
- package/__mf/js/async/lib-router.4afa3869.js +0 -2
- /package/__mf/js/async/{1117.8c12a843.js.LICENSE.txt → 1117.dd32fc22.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{392.cf8653c1.js.LICENSE.txt → 392.0af27180.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{383.737ba616.js.LICENSE.txt → 5357.b184bde0.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{1490.1b37e9b3.js.LICENSE.txt → 54.3e02cca4.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{2555.3e9e6122.js.LICENSE.txt → 5955.d8a0d358.js.LICENSE.txt} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
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
|
|
@@ -25,7 +25,7 @@ const _material = require("@mui/material");
|
|
|
25
25
|
const _components = require("@perses-dev/components");
|
|
26
26
|
const _components1 = require("./components");
|
|
27
27
|
function TimeSeriesTablePanel(props) {
|
|
28
|
-
const { contentDimensions, queryResults } = props;
|
|
28
|
+
const { contentDimensions, queryResults, spec } = props;
|
|
29
29
|
const chartsTheme = (0, _components.useChartsTheme)();
|
|
30
30
|
const contentPadding = chartsTheme.container.padding.default;
|
|
31
31
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
@@ -37,7 +37,8 @@ function TimeSeriesTablePanel(props) {
|
|
|
37
37
|
overflowY: 'scroll'
|
|
38
38
|
},
|
|
39
39
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components1.DataTable, {
|
|
40
|
-
queryResults: queryResults
|
|
40
|
+
queryResults: queryResults,
|
|
41
|
+
spec: spec
|
|
41
42
|
})
|
|
42
43
|
});
|
|
43
44
|
}
|
package/lib/cjs/bootstrap.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
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
|
|
@@ -32,20 +32,92 @@ _export(exports, {
|
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
const _jsxruntime = require("react/jsx-runtime");
|
|
35
|
-
const _react = require("react");
|
|
36
35
|
const _material = require("@mui/material");
|
|
37
|
-
const
|
|
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");
|
|
38
40
|
const _EmbeddedPanel = require("./EmbeddedPanel");
|
|
41
|
+
const _SeriesName = require("./SeriesName");
|
|
39
42
|
const MAX_FORMATTABLE_SERIES = 1000;
|
|
40
|
-
|
|
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)();
|
|
41
56
|
const series = (0, _react.useMemo)(()=>queryResults.flatMap((d)=>d.data).flatMap((d)=>d?.series || []), [
|
|
42
57
|
queryResults
|
|
43
58
|
]);
|
|
44
|
-
const
|
|
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
|
+
}, [
|
|
45
76
|
series,
|
|
46
|
-
|
|
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
|
|
47
103
|
]);
|
|
48
|
-
|
|
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) {
|
|
49
121
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
50
122
|
sx: {
|
|
51
123
|
display: 'flex',
|
|
@@ -60,6 +132,7 @@ const DataTable = ({ queryResults })=>{
|
|
|
60
132
|
}
|
|
61
133
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
62
134
|
children: [
|
|
135
|
+
confirmDialog,
|
|
63
136
|
series.length >= MAX_FORMATTABLE_SERIES && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Alert, {
|
|
64
137
|
severity: "warning",
|
|
65
138
|
children: [
|
|
@@ -68,108 +141,152 @@ const DataTable = ({ queryResults })=>{
|
|
|
68
141
|
" series, turning off label formatting for performance reasons."
|
|
69
142
|
]
|
|
70
143
|
}),
|
|
71
|
-
/*#__PURE__*/ (0, _jsxruntime.
|
|
144
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Table, {
|
|
72
145
|
className: "data-table",
|
|
73
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableBody, {
|
|
74
|
-
children: rows
|
|
75
|
-
})
|
|
76
|
-
})
|
|
77
|
-
]
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
function buildRows(series, queryResults) {
|
|
81
|
-
const isFormatted = series.length < MAX_FORMATTABLE_SERIES; // only format series names if we have less than 1000 series for performance reasons
|
|
82
|
-
return series.map((s, seriesIdx)=>{
|
|
83
|
-
const displayTimeStamps = (s.values?.length ?? 0) > 1;
|
|
84
|
-
const valuesAndTimes = s.values ? s.values.map((v, valIdx)=>{
|
|
85
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Typography, {
|
|
86
146
|
children: [
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
displayTimeStamps && /*#__PURE__*/ (0, _jsxruntime.jsxs)("span", {
|
|
90
|
-
children: [
|
|
91
|
-
"@",
|
|
92
|
-
v[0]
|
|
93
|
-
]
|
|
94
|
-
})
|
|
95
|
-
]
|
|
96
|
-
}, valIdx);
|
|
97
|
-
}) : [];
|
|
98
|
-
let histogramsAndTimes = null;
|
|
99
|
-
if (s.histograms && s.histograms.length > 0) {
|
|
100
|
-
// Query results contains multiple series, create a new query result with only the current series
|
|
101
|
-
const seriesQueryResult = {
|
|
102
|
-
...queryResults[0],
|
|
103
|
-
data: {
|
|
104
|
-
...queryResults[0].data,
|
|
105
|
-
series: [
|
|
106
|
-
queryResults[0].data.series[seriesIdx]
|
|
107
|
-
]
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
histogramsAndTimes = s.histograms.map((h, hisIdx)=>{
|
|
111
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
112
|
-
alignItems: "center",
|
|
113
|
-
children: [
|
|
114
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
115
|
-
width: 400,
|
|
116
|
-
height: 200,
|
|
117
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_EmbeddedPanel.EmbeddedPanel, {
|
|
118
|
-
kind: "HistogramChart",
|
|
119
|
-
spec: {
|
|
120
|
-
unit: 'decimal',
|
|
121
|
-
width: 400,
|
|
122
|
-
height: 200
|
|
123
|
-
},
|
|
124
|
-
queryResults: [
|
|
125
|
-
seriesQueryResult
|
|
126
|
-
]
|
|
127
|
-
})
|
|
128
|
-
}),
|
|
129
|
-
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
130
|
-
flexDirection: "row",
|
|
131
|
-
justifyContent: "space-between",
|
|
132
|
-
width: "100%",
|
|
147
|
+
selectionEnabled && series.length > 0 && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableHead, {
|
|
148
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.TableRow, {
|
|
133
149
|
children: [
|
|
134
|
-
/*#__PURE__*/ (0, _jsxruntime.
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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
|
+
})
|
|
139
160
|
}),
|
|
140
|
-
/*#__PURE__*/ (0, _jsxruntime.
|
|
141
|
-
children:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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"
|
|
145
169
|
})
|
|
146
170
|
]
|
|
147
|
-
})
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
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
|
+
})
|
|
164
284
|
})
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
})
|
|
169
|
-
]
|
|
170
|
-
}, seriesIdx);
|
|
285
|
+
]
|
|
286
|
+
})
|
|
287
|
+
]
|
|
171
288
|
});
|
|
172
|
-
}
|
|
289
|
+
};
|
|
173
290
|
const leftDelim = (br)=>br === 3 || br === 1 ? '[' : '(';
|
|
174
291
|
const rightDelim = (br)=>br === 3 || br === 0 ? ']' : ')';
|
|
175
292
|
const bucketRangeString = ([boundaryRule, leftBoundary, rightBoundary])=>{
|
|
@@ -0,0 +1,44 @@
|
|
|
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,9 +1,22 @@
|
|
|
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
|
"use strict";
|
|
2
14
|
Object.defineProperty(exports, "__esModule", {
|
|
3
15
|
value: true
|
|
4
16
|
});
|
|
5
17
|
_export_star(require("./DataTable"), exports);
|
|
6
18
|
_export_star(require("./SeriesName"), exports);
|
|
19
|
+
_export_star(require("./TimeSeriesTableItemSelectionActionsEditor"), exports);
|
|
7
20
|
function _export_star(from, to) {
|
|
8
21
|
Object.keys(from).forEach(function(k) {
|
|
9
22
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
package/lib/cjs/env.d.js
CHANGED
|
@@ -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
|
"use strict";
|
|
2
14
|
Object.defineProperty(exports, "__esModule", {
|
|
3
15
|
value: true
|
|
@@ -40,7 +40,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
40
40
|
}
|
|
41
41
|
return newObj;
|
|
42
42
|
}
|
|
43
|
-
// Copyright
|
|
43
|
+
// Copyright The Perses Authors
|
|
44
44
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
45
45
|
// you may not use this file except in compliance with the License.
|
|
46
46
|
// You may obtain a copy of the License at
|
package/lib/cjs/index.js
CHANGED
|
@@ -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
|
"use strict";
|
|
2
14
|
Object.defineProperty(exports, "__esModule", {
|
|
3
15
|
value: true
|
package/lib/cjs/model.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
//
|
|
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.
|
|
2
13
|
"use strict";
|
|
3
14
|
Object.defineProperty(exports, "__esModule", {
|
|
4
15
|
value: true
|
package/lib/cjs/setup-tests.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TimeSeriesData, HistogramValue } from '@perses-dev/core';
|
|
1
|
+
import { HistogramValue, TimeSeriesData } from '@perses-dev/core';
|
|
3
2
|
import { PanelData } from '@perses-dev/plugin-system';
|
|
3
|
+
import { ReactElement, ReactNode } from 'react';
|
|
4
|
+
import { TimeSeriesTableOptions } from '../model';
|
|
4
5
|
export interface DataTableProps {
|
|
5
6
|
queryResults: Array<PanelData<TimeSeriesData>>;
|
|
7
|
+
spec: TimeSeriesTableOptions;
|
|
6
8
|
}
|
|
7
9
|
/**
|
|
8
10
|
* Designed to display timeseries data in a prometheus like table format.
|
|
@@ -12,7 +14,7 @@ export interface DataTableProps {
|
|
|
12
14
|
* @param result timeseries query result
|
|
13
15
|
* @constructor
|
|
14
16
|
*/
|
|
15
|
-
export declare const DataTable: ({ queryResults }: DataTableProps) => ReactElement | null;
|
|
17
|
+
export declare const DataTable: ({ queryResults, spec }: DataTableProps) => ReactElement | null;
|
|
16
18
|
export declare const bucketRangeString: ([boundaryRule, leftBoundary, rightBoundary]: [number, string, string, string]) => string;
|
|
17
19
|
export declare const histogramTable: (h: HistogramValue) => ReactNode;
|
|
18
20
|
//# sourceMappingURL=DataTable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable.tsx"],"names":[],"mappings":"AA0BA,OAAO,EAAe,cAAc,EAAc,cAAc,EAA4B,MAAM,kBAAkB,CAAC;AAErH,OAAO,EAAiB,SAAS,EAAwB,MAAM,2BAA2B,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,SAAS,EAAwB,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAMlD,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC;IAC/C,IAAI,EAAE,sBAAsB,CAAC;CAC9B;AAeD;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,GAAI,wBAAwB,cAAc,KAAG,YAAY,GAAG,IAoLjF,CAAC;AAKF,eAAO,MAAM,iBAAiB,GAAI,6CAA6C,CAC7E,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,CACP,KAAG,MAEH,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,GAAG,cAAc,KAAG,SAsBlD,CAAC"}
|