@perses-dev/table-plugin 0.11.1 → 0.13.0-beta.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/css/async/5286.85c2cbf6.css +1 -0
- package/__mf/font/inter-cyrillic-300-normal.432f2b21.woff +0 -0
- package/__mf/font/inter-cyrillic-300-normal.9da91009.woff2 +0 -0
- package/__mf/font/inter-cyrillic-400-normal.372704ff.woff2 +0 -0
- package/__mf/font/inter-cyrillic-400-normal.a6b6ef6f.woff +0 -0
- package/__mf/font/inter-cyrillic-500-normal.7c15bba8.woff2 +0 -0
- package/__mf/font/inter-cyrillic-500-normal.b9f8c929.woff +0 -0
- package/__mf/font/inter-cyrillic-600-normal.2f42892a.woff2 +0 -0
- package/__mf/font/inter-cyrillic-600-normal.c3987adc.woff +0 -0
- package/__mf/font/inter-cyrillic-700-normal.93eba3c3.woff +0 -0
- package/__mf/font/inter-cyrillic-700-normal.e9e5b2dc.woff2 +0 -0
- package/__mf/font/inter-cyrillic-900-normal.f285bd7a.woff2 +0 -0
- package/__mf/font/inter-cyrillic-900-normal.ffbd8a3a.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-300-normal.95bb9038.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-300-normal.cfc143a9.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-400-normal.2a31c04b.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-400-normal.f572b170.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-500-normal.5a6bb1da.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-500-normal.fe0d9b14.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-600-normal.ecbdecad.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-600-normal.f7b3c15b.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-700-normal.4b4022a6.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-700-normal.74b516d2.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-900-normal.9970ddb5.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-900-normal.a0d59adc.woff2 +0 -0
- package/__mf/font/inter-greek-300-normal.0d7be683.woff2 +0 -0
- package/__mf/font/inter-greek-300-normal.8f0b988e.woff +0 -0
- package/__mf/font/inter-greek-400-normal.cc58c11b.woff +0 -0
- package/__mf/font/inter-greek-400-normal.d7020e3c.woff2 +0 -0
- package/__mf/font/inter-greek-500-normal.d9a33207.woff +0 -0
- package/__mf/font/inter-greek-500-normal.f41f43db.woff2 +0 -0
- package/__mf/font/inter-greek-600-normal.4ec0c1c1.woff +0 -0
- package/__mf/font/inter-greek-600-normal.cc532937.woff2 +0 -0
- package/__mf/font/inter-greek-700-normal.5ec6c758.woff +0 -0
- package/__mf/font/inter-greek-700-normal.97f0eeeb.woff2 +0 -0
- package/__mf/font/inter-greek-900-normal.46b66369.woff2 +0 -0
- package/__mf/font/inter-greek-900-normal.9ae3a3c5.woff +0 -0
- package/__mf/font/inter-greek-ext-300-normal.10247a66.woff2 +0 -0
- package/__mf/font/inter-greek-ext-300-normal.4668e5cb.woff +0 -0
- package/__mf/font/inter-greek-ext-400-normal.4ce1df5d.woff2 +0 -0
- package/__mf/font/inter-greek-ext-400-normal.88ede1ea.woff +0 -0
- package/__mf/font/inter-greek-ext-500-normal.7a4aa726.woff +0 -0
- package/__mf/font/inter-greek-ext-500-normal.cbd51e2d.woff2 +0 -0
- package/__mf/font/inter-greek-ext-600-normal.089a95ee.woff +0 -0
- package/__mf/font/inter-greek-ext-600-normal.1f33d317.woff2 +0 -0
- package/__mf/font/inter-greek-ext-700-normal.31f1075d.woff +0 -0
- package/__mf/font/inter-greek-ext-700-normal.827cd618.woff2 +0 -0
- package/__mf/font/inter-greek-ext-900-normal.531bcee7.woff +0 -0
- package/__mf/font/inter-greek-ext-900-normal.8a9b36b9.woff2 +0 -0
- package/__mf/font/inter-latin-300-normal.15fb600d.woff2 +0 -0
- package/__mf/font/inter-latin-300-normal.6f95f590.woff +0 -0
- package/__mf/font/inter-latin-400-normal.2c7a775c.woff +0 -0
- package/__mf/font/inter-latin-400-normal.ef6d3f52.woff2 +0 -0
- package/__mf/font/inter-latin-500-normal.b7b43ace.woff2 +0 -0
- package/__mf/font/inter-latin-500-normal.cb4c8ceb.woff +0 -0
- package/__mf/font/inter-latin-600-normal.8fb1a964.woff2 +0 -0
- package/__mf/font/inter-latin-600-normal.ce0f5f43.woff +0 -0
- package/__mf/font/inter-latin-700-normal.953b7aa5.woff2 +0 -0
- package/__mf/font/inter-latin-700-normal.9c21d4dc.woff +0 -0
- package/__mf/font/inter-latin-900-normal.2a8028ec.woff2 +0 -0
- package/__mf/font/inter-latin-900-normal.fa252135.woff +0 -0
- package/__mf/font/inter-latin-ext-300-normal.167cc8c9.woff2 +0 -0
- package/__mf/font/inter-latin-ext-300-normal.f695be66.woff +0 -0
- package/__mf/font/inter-latin-ext-400-normal.32a25442.woff2 +0 -0
- package/__mf/font/inter-latin-ext-400-normal.4edcaace.woff +0 -0
- package/__mf/font/inter-latin-ext-500-normal.a19a84a6.woff +0 -0
- package/__mf/font/inter-latin-ext-500-normal.d9b491de.woff2 +0 -0
- package/__mf/font/inter-latin-ext-600-normal.38b075d8.woff2 +0 -0
- package/__mf/font/inter-latin-ext-600-normal.49faa47a.woff +0 -0
- package/__mf/font/inter-latin-ext-700-normal.93534b50.woff +0 -0
- package/__mf/font/inter-latin-ext-700-normal.b63daa1a.woff2 +0 -0
- package/__mf/font/inter-latin-ext-900-normal.0efdb307.woff +0 -0
- package/__mf/font/inter-latin-ext-900-normal.9c0fc2c7.woff2 +0 -0
- package/__mf/font/inter-vietnamese-300-normal.aad496d8.woff +0 -0
- package/__mf/font/inter-vietnamese-300-normal.ad9ef503.woff2 +0 -0
- package/__mf/font/inter-vietnamese-400-normal.a9dd2faf.woff +0 -0
- package/__mf/font/inter-vietnamese-400-normal.de4fc44f.woff2 +0 -0
- package/__mf/font/inter-vietnamese-500-normal.7c0a695f.woff2 +0 -0
- package/__mf/font/inter-vietnamese-500-normal.a3a73b95.woff +0 -0
- package/__mf/font/inter-vietnamese-600-normal.9d518599.woff2 +0 -0
- package/__mf/font/inter-vietnamese-600-normal.c5ce3fcb.woff +0 -0
- package/__mf/font/inter-vietnamese-700-normal.bc68b199.woff +0 -0
- package/__mf/font/inter-vietnamese-700-normal.faf12809.woff2 +0 -0
- package/__mf/font/inter-vietnamese-900-normal.2b782045.woff +0 -0
- package/__mf/font/inter-vietnamese-900-normal.e639b65a.woff2 +0 -0
- package/__mf/js/Table.5ec41996.js +7 -0
- package/__mf/js/async/1432.47ca9bc7.js +1 -0
- package/__mf/js/async/1519.446ee3b5.js +1 -0
- package/__mf/js/async/1616.29b0085e.js +1 -0
- package/__mf/js/async/1805.b4a1e768.js +1 -0
- package/__mf/js/async/2043.0b0ffaef.js +2 -0
- package/__mf/js/async/2082.c0b3db38.js +1 -0
- package/__mf/js/async/256.7929d7f5.js +1 -0
- package/__mf/js/async/2842.cee1ed42.js +1 -0
- package/__mf/js/async/392.eef36bcd.js +2 -0
- package/__mf/js/async/4121.403fdade.js +2 -0
- package/__mf/js/async/4320.5cbfbd1c.js +1 -0
- package/__mf/js/async/5002.fd6ad994.js +1 -0
- package/__mf/js/async/5071.1684b9fd.js +1 -0
- package/__mf/js/async/5183.acc536f9.js +22 -0
- package/__mf/js/async/5286.1b3a5a62.js +7 -0
- package/__mf/js/async/{550.8bab52fc.js.LICENSE.txt → 5286.1b3a5a62.js.LICENSE.txt} +19 -1
- package/__mf/js/async/5587.966d92d2.js +1 -0
- package/__mf/js/async/6274.71776a1d.js +2 -0
- package/__mf/js/async/6753.5632301a.js +1 -0
- package/__mf/js/async/6811.6a011de7.js +38 -0
- package/__mf/js/async/7177.f0c1cf85.js +1 -0
- package/__mf/js/async/7192.f9d57dbb.js +1 -0
- package/__mf/js/async/7413.a78d135c.js +1 -0
- package/__mf/js/async/7862.de8ef786.js +2 -0
- package/__mf/js/async/7968.545aab42.js +1 -0
- package/__mf/js/async/7978.61f7fc2d.js +1 -0
- package/__mf/js/async/8356.7a060c2c.js +1 -0
- package/__mf/js/async/8470.dac32d6a.js +2 -0
- package/__mf/js/async/868.a08b9f5f.js +110 -0
- package/__mf/js/async/{868.9f710584.js.LICENSE.txt → 868.a08b9f5f.js.LICENSE.txt} +1 -1
- package/__mf/js/async/873.bb80627c.js +1 -0
- package/__mf/js/async/8750.8dc0b93d.js +3 -0
- package/__mf/js/async/9051.2db4f8e5.js +1 -0
- package/__mf/js/async/9235.35b8884a.js +1 -0
- package/__mf/js/async/941.97799379.js +2 -0
- package/__mf/js/async/9546.f3c1cf02.js +2 -0
- package/__mf/js/async/{1117.b21b0ae4.js.LICENSE.txt → 9546.f3c1cf02.js.LICENSE.txt} +1 -1
- package/__mf/js/async/9588.178c0b3f.js +1 -0
- package/__mf/js/async/9701.4ae63d2f.js +1 -0
- package/__mf/js/async/__federation_expose_Table.7060f62e.js +1 -0
- package/__mf/js/async/lib-router.96861d20.js +2 -0
- package/__mf/js/main.8677f3d2.js +7 -0
- package/lib/TableExportAction.d.ts +16 -0
- package/lib/TableExportAction.d.ts.map +1 -1
- package/lib/TableExportAction.js +78 -26
- package/lib/TableExportAction.js.map +1 -1
- package/lib/cjs/TableExportAction.js +83 -27
- package/lib/cjs/components/ColumnsEditor/ColumnEditor.js +60 -22
- package/lib/cjs/components/ColumnsEditor/EmbeddedPanelOptionsEditor.js +124 -0
- package/lib/cjs/components/TablePanel.js +206 -56
- package/lib/cjs/models/table-model.js +32 -6
- package/lib/cjs/table-data-utils.js +83 -0
- package/lib/components/ColumnsEditor/ColumnEditor.d.ts.map +1 -1
- package/lib/components/ColumnsEditor/ColumnEditor.js +61 -23
- package/lib/components/ColumnsEditor/ColumnEditor.js.map +1 -1
- package/lib/components/ColumnsEditor/EmbeddedPanelOptionsEditor.d.ts +13 -0
- package/lib/components/ColumnsEditor/EmbeddedPanelOptionsEditor.d.ts.map +1 -0
- package/lib/components/ColumnsEditor/EmbeddedPanelOptionsEditor.js +114 -0
- package/lib/components/ColumnsEditor/EmbeddedPanelOptionsEditor.js.map +1 -0
- package/lib/components/EmbeddedPanel.d.ts +1 -1
- package/lib/components/EmbeddedPanel.d.ts.map +1 -1
- package/lib/components/EmbeddedPanel.js.map +1 -1
- package/lib/components/TablePanel.d.ts +1 -1
- package/lib/components/TablePanel.d.ts.map +1 -1
- package/lib/components/TablePanel.js +206 -56
- package/lib/components/TablePanel.js.map +1 -1
- package/lib/components/TableTransformsEditor.d.ts.map +1 -1
- package/lib/components/TableTransformsEditor.js.map +1 -1
- package/lib/models/table-model.d.ts +2 -2
- package/lib/models/table-model.d.ts.map +1 -1
- package/lib/models/table-model.js +32 -6
- package/lib/models/table-model.js.map +1 -1
- package/lib/table-data-utils.d.ts +32 -0
- package/lib/table-data-utils.d.ts.map +1 -0
- package/lib/table-data-utils.js +81 -0
- package/lib/table-data-utils.js.map +1 -0
- package/lib/test/mock-query-results.d.ts +1 -1
- package/lib/test/mock-query-results.js.map +1 -1
- package/mf-manifest.json +94 -75
- package/mf-stats.json +110 -79
- package/package.json +5 -5
- package/__mf/css/async/3061.d3010b86.css +0 -1
- package/__mf/css/async/5442.d3010b86.css +0 -1
- package/__mf/css/async/7823.d3010b86.css +0 -1
- package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
- package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
- package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
- package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
- package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
- package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
- package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
- package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
- package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
- package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
- package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
- package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
- package/__mf/js/Table.057041ac.js +0 -6
- package/__mf/js/async/1103.ffbc2bec.js +0 -1
- package/__mf/js/async/1117.b21b0ae4.js +0 -2
- package/__mf/js/async/1432.acd0ad59.js +0 -1
- package/__mf/js/async/1616.7a74f4ef.js +0 -1
- package/__mf/js/async/2043.fdebf89c.js +0 -2
- package/__mf/js/async/208.2b17c08c.js +0 -3
- package/__mf/js/async/2082.78532c3c.js +0 -1
- package/__mf/js/async/272.3bc7825c.js +0 -1
- package/__mf/js/async/392.49e51fc5.js +0 -2
- package/__mf/js/async/4121.8e97ef88.js +0 -2
- package/__mf/js/async/5002.3189d214.js +0 -1
- package/__mf/js/async/5019.5318688a.js +0 -1
- package/__mf/js/async/5071.91e1c002.js +0 -1
- package/__mf/js/async/54.8b007a26.js +0 -22
- package/__mf/js/async/550.8bab52fc.js +0 -7
- package/__mf/js/async/5587.f5f2b0cc.js +0 -1
- package/__mf/js/async/6274.14683c28.js +0 -2
- package/__mf/js/async/6283.e044c368.js +0 -2
- package/__mf/js/async/6753.032ce611.js +0 -1
- package/__mf/js/async/6811.4e18bc66.js +0 -38
- package/__mf/js/async/7177.356298ae.js +0 -1
- package/__mf/js/async/7192.66c9e3a5.js +0 -1
- package/__mf/js/async/7968.a66bfadb.js +0 -1
- package/__mf/js/async/7978.a19f5a4f.js +0 -1
- package/__mf/js/async/8356.8ae40b6a.js +0 -1
- package/__mf/js/async/8470.1b8b20ff.js +0 -2
- package/__mf/js/async/868.9f710584.js +0 -110
- package/__mf/js/async/873.a7310675.js +0 -1
- package/__mf/js/async/9051.e3054e02.js +0 -1
- package/__mf/js/async/9235.eee50e10.js +0 -1
- package/__mf/js/async/941.333875f4.js +0 -2
- package/__mf/js/async/9588.7b021071.js +0 -1
- package/__mf/js/async/9701.3b068d23.js +0 -1
- package/__mf/js/async/__federation_expose_Table.5e9f3060.js +0 -1
- package/__mf/js/async/lib-router.2e1dec85.js +0 -2
- package/__mf/js/main.2181a7b4.js +0 -6
- /package/__mf/js/async/{2043.fdebf89c.js.LICENSE.txt → 2043.0b0ffaef.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{392.49e51fc5.js.LICENSE.txt → 392.eef36bcd.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{4121.8e97ef88.js.LICENSE.txt → 4121.403fdade.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{54.8b007a26.js.LICENSE.txt → 5183.acc536f9.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{6274.14683c28.js.LICENSE.txt → 6274.71776a1d.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{6283.e044c368.js.LICENSE.txt → 7862.de8ef786.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{8470.1b8b20ff.js.LICENSE.txt → 8470.dac32d6a.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{941.333875f4.js.LICENSE.txt → 941.97799379.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{lib-router.2e1dec85.js.LICENSE.txt → lib-router.96861d20.js.LICENSE.txt} +0 -0
|
@@ -31,18 +31,163 @@ _export(exports, {
|
|
|
31
31
|
const _jsxruntime = require("react/jsx-runtime");
|
|
32
32
|
const _material = require("@mui/material");
|
|
33
33
|
const _components = require("@perses-dev/components");
|
|
34
|
-
const _core = require("@perses-dev/core");
|
|
35
34
|
const _dashboards = require("@perses-dev/dashboards");
|
|
36
35
|
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
37
36
|
const _react = require("react");
|
|
38
37
|
const _models = require("../models");
|
|
38
|
+
const _tabledatautils = require("../table-data-utils");
|
|
39
39
|
const _EmbeddedPanel = require("./EmbeddedPanel");
|
|
40
|
-
function
|
|
40
|
+
function parseNumericCellValue(value) {
|
|
41
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
if (typeof value === 'string') {
|
|
45
|
+
const parsed = Number(value);
|
|
46
|
+
if (Number.isFinite(parsed)) {
|
|
47
|
+
return parsed;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
function isPanelData(value) {
|
|
53
|
+
if (typeof value !== 'object' || value === null) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
const candidate = value;
|
|
57
|
+
return candidate.definition !== undefined && candidate.data !== undefined;
|
|
58
|
+
}
|
|
59
|
+
function createSyntheticPanelData(value, columnName) {
|
|
60
|
+
const numericValue = parseNumericCellValue(value);
|
|
61
|
+
if (numericValue === undefined) {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
const now = Date.now();
|
|
65
|
+
return {
|
|
66
|
+
definition: {
|
|
67
|
+
kind: 'TimeSeriesQuery',
|
|
68
|
+
spec: {
|
|
69
|
+
plugin: {
|
|
70
|
+
kind: 'PrometheusTimeSeriesQuery',
|
|
71
|
+
spec: {
|
|
72
|
+
query: ''
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
data: {
|
|
78
|
+
timeRange: {
|
|
79
|
+
start: new Date(now),
|
|
80
|
+
end: new Date(now)
|
|
81
|
+
},
|
|
82
|
+
stepMs: 1,
|
|
83
|
+
series: [
|
|
84
|
+
{
|
|
85
|
+
name: columnName,
|
|
86
|
+
values: [
|
|
87
|
+
[
|
|
88
|
+
now,
|
|
89
|
+
numericValue
|
|
90
|
+
]
|
|
91
|
+
],
|
|
92
|
+
labels: {}
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function getGaugeNumericValue(value) {
|
|
99
|
+
if (isPanelData(value)) {
|
|
100
|
+
const series = value.data?.series;
|
|
101
|
+
const firstSeries = series?.[0];
|
|
102
|
+
if (!firstSeries?.values?.length) {
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
const calc = _pluginsystem.CalculationsMap['last-number'];
|
|
106
|
+
if (typeof calc !== 'function') {
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
const calculatedValue = calc(firstSeries.values);
|
|
110
|
+
return typeof calculatedValue === 'number' ? calculatedValue : undefined;
|
|
111
|
+
}
|
|
112
|
+
return parseNumericCellValue(value);
|
|
113
|
+
}
|
|
114
|
+
function InlineGaugeCellWithRange({ value, range, fillColor, format }) {
|
|
115
|
+
if (value === undefined) {
|
|
116
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {});
|
|
117
|
+
}
|
|
118
|
+
let percent = 0;
|
|
119
|
+
if (range !== undefined) {
|
|
120
|
+
if (range.max === range.min) {
|
|
121
|
+
percent = 100;
|
|
122
|
+
} else {
|
|
123
|
+
percent = (value - range.min) / (range.max - range.min) * 100;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
percent = Math.max(0, Math.min(100, percent));
|
|
127
|
+
const trackColor = 'rgba(127,127,127,0.20)';
|
|
128
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
129
|
+
sx: {
|
|
130
|
+
display: 'flex',
|
|
131
|
+
alignItems: 'center',
|
|
132
|
+
width: '100%',
|
|
133
|
+
gap: 1
|
|
134
|
+
},
|
|
135
|
+
children: [
|
|
136
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
137
|
+
sx: {
|
|
138
|
+
flexGrow: 1,
|
|
139
|
+
borderRadius: 1,
|
|
140
|
+
backgroundColor: trackColor,
|
|
141
|
+
height: 24,
|
|
142
|
+
overflow: 'hidden'
|
|
143
|
+
},
|
|
144
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
145
|
+
sx: {
|
|
146
|
+
width: `${percent}%`,
|
|
147
|
+
height: '100%',
|
|
148
|
+
backgroundColor: fillColor ?? 'success.main',
|
|
149
|
+
borderRadius: 1
|
|
150
|
+
}
|
|
151
|
+
})
|
|
152
|
+
}),
|
|
153
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
154
|
+
variant: "body2",
|
|
155
|
+
sx: {
|
|
156
|
+
minWidth: 52,
|
|
157
|
+
textAlign: 'right'
|
|
158
|
+
},
|
|
159
|
+
children: format ? (0, _components.formatValue)(value, format) : value.toFixed(2)
|
|
160
|
+
})
|
|
161
|
+
]
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
function resolveGaugeFillColor(value, globalCellSettings, columnCellSettings) {
|
|
165
|
+
let cellConfig = (0, _models.evaluateConditionalFormatting)(value, globalCellSettings);
|
|
166
|
+
if (columnCellSettings?.length) {
|
|
167
|
+
const columnCellConfig = (0, _models.evaluateConditionalFormatting)(value, columnCellSettings);
|
|
168
|
+
if (columnCellConfig) {
|
|
169
|
+
cellConfig = columnCellConfig;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return cellConfig?.backgroundColor ?? cellConfig?.textColor;
|
|
173
|
+
}
|
|
174
|
+
function generateCellContentConfig(column, gaugeRange, globalCellSettings = []) {
|
|
41
175
|
const plugin = column.plugin;
|
|
42
176
|
if (plugin !== undefined) {
|
|
43
177
|
return {
|
|
44
178
|
cell: (ctx)=>{
|
|
45
|
-
const
|
|
179
|
+
const cellValue = ctx.getValue();
|
|
180
|
+
if (plugin.kind === 'GaugeChart') {
|
|
181
|
+
const gaugeValue = getGaugeNumericValue(cellValue);
|
|
182
|
+
const gaugeFillColor = resolveGaugeFillColor(gaugeValue, globalCellSettings, column.cellSettings);
|
|
183
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(InlineGaugeCellWithRange, {
|
|
184
|
+
value: gaugeValue,
|
|
185
|
+
range: gaugeRange,
|
|
186
|
+
fillColor: gaugeFillColor,
|
|
187
|
+
format: plugin.spec?.format ?? column.format
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
const panelData = isPanelData(cellValue) ? cellValue : createSyntheticPanelData(cellValue, column.name);
|
|
46
191
|
if (!panelData) return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {});
|
|
47
192
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_EmbeddedPanel.EmbeddedPanel, {
|
|
48
193
|
kind: plugin.kind,
|
|
@@ -58,15 +203,17 @@ function generateCellContentConfig(column) {
|
|
|
58
203
|
return {
|
|
59
204
|
cell: (ctx)=>{
|
|
60
205
|
const cellValue = ctx.getValue();
|
|
61
|
-
return typeof cellValue === 'number' && column.format ? (0,
|
|
206
|
+
return typeof cellValue === 'number' && column.format ? (0, _components.formatValue)(cellValue, column.format) : cellValue;
|
|
62
207
|
},
|
|
63
208
|
cellDescription: column.cellDescription ? ()=>`${column.cellDescription}` : undefined
|
|
64
209
|
};
|
|
65
210
|
}
|
|
66
211
|
function ColumnFilterDropdown({ allValues, selectedValues, onFilterChange, theme }) {
|
|
212
|
+
const [searchTerm, setSearchTerm] = (0, _react.useState)('');
|
|
67
213
|
const values = [
|
|
68
214
|
...new Set(allValues)
|
|
69
215
|
].filter((v)=>v !== null).sort();
|
|
216
|
+
const filteredValues = searchTerm ? values.filter((v)=>String(v).toLowerCase().includes(searchTerm.toLowerCase())) : values;
|
|
70
217
|
if (values.length === 0) {
|
|
71
218
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
72
219
|
"data-filter-dropdown": true,
|
|
@@ -100,6 +247,23 @@ function ColumnFilterDropdown({ allValues, selectedValues, onFilterChange, theme
|
|
|
100
247
|
overflowY: 'auto'
|
|
101
248
|
},
|
|
102
249
|
children: [
|
|
250
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)("input", {
|
|
251
|
+
type: "text",
|
|
252
|
+
placeholder: "Search...",
|
|
253
|
+
value: searchTerm,
|
|
254
|
+
onChange: (e)=>setSearchTerm(e.target.value),
|
|
255
|
+
style: {
|
|
256
|
+
width: '100%',
|
|
257
|
+
padding: '6px 8px',
|
|
258
|
+
marginBottom: 8,
|
|
259
|
+
fontSize: 13,
|
|
260
|
+
border: `1px solid ${theme.palette.divider}`,
|
|
261
|
+
borderRadius: 4,
|
|
262
|
+
backgroundColor: theme.palette.background.default,
|
|
263
|
+
color: theme.palette.text.primary,
|
|
264
|
+
boxSizing: 'border-box'
|
|
265
|
+
}
|
|
266
|
+
}),
|
|
103
267
|
/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
104
268
|
style: {
|
|
105
269
|
marginBottom: 8,
|
|
@@ -141,7 +305,7 @@ function ColumnFilterDropdown({ allValues, selectedValues, onFilterChange, theme
|
|
|
141
305
|
borderTop: `1px solid ${theme.palette.divider}`
|
|
142
306
|
}
|
|
143
307
|
}),
|
|
144
|
-
|
|
308
|
+
filteredValues.map((value, index)=>/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
145
309
|
style: {
|
|
146
310
|
marginBottom: 4
|
|
147
311
|
},
|
|
@@ -194,7 +358,7 @@ function ColumnFilterDropdown({ allValues, selectedValues, onFilterChange, theme
|
|
|
194
358
|
* Generate column config from column definitions, if a column has multiple definitions, the first one will be used.
|
|
195
359
|
* If column is hidden, return undefined.
|
|
196
360
|
* If column do not have a definition, return a default column config.
|
|
197
|
-
*/ function generateColumnConfig(name, columnSettings, allVariables) {
|
|
361
|
+
*/ function generateColumnConfig(name, columnSettings, allVariables, gaugeRangeByColumn, globalCellSettings = []) {
|
|
198
362
|
for (const column of columnSettings){
|
|
199
363
|
if (column.name === name) {
|
|
200
364
|
if (column.hide) {
|
|
@@ -213,7 +377,7 @@ function ColumnFilterDropdown({ allValues, selectedValues, onFilterChange, theme
|
|
|
213
377
|
width,
|
|
214
378
|
align,
|
|
215
379
|
dataLink: modifiedDataLink,
|
|
216
|
-
...generateCellContentConfig(column)
|
|
380
|
+
...generateCellContentConfig(column, gaugeRangeByColumn[name], globalCellSettings)
|
|
217
381
|
};
|
|
218
382
|
}
|
|
219
383
|
}
|
|
@@ -225,7 +389,7 @@ function ColumnFilterDropdown({ allValues, selectedValues, onFilterChange, theme
|
|
|
225
389
|
function getTablePanelQueryOptions(spec) {
|
|
226
390
|
// if any cell renders a panel plugin, perform a range query instead of an instant query
|
|
227
391
|
return {
|
|
228
|
-
mode: (
|
|
392
|
+
mode: (0, _tabledatautils.getTablePanelQueryMode)(spec)
|
|
229
393
|
};
|
|
230
394
|
}
|
|
231
395
|
function TablePanel({ contentDimensions, spec, queryResults }) {
|
|
@@ -273,56 +437,15 @@ function TablePanel({ contentDimensions, spec, queryResults }) {
|
|
|
273
437
|
clearSelection
|
|
274
438
|
]);
|
|
275
439
|
// TODO: handle other query types
|
|
276
|
-
const queryMode = getTablePanelQueryOptions(spec).mode;
|
|
277
440
|
const rawData = (0, _react.useMemo)(()=>{
|
|
278
|
-
// Transform query results to a tabular format
|
|
279
|
-
|
|
280
|
-
return queryResults.flatMap((data, queryIndex)=>data.data.series.map((ts)=>({
|
|
281
|
-
data,
|
|
282
|
-
ts,
|
|
283
|
-
queryIndex
|
|
284
|
-
}))).map(({ data, ts, queryIndex })=>{
|
|
285
|
-
if (ts.values[0] === undefined) {
|
|
286
|
-
return {
|
|
287
|
-
...ts.labels
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
// If there are multiple queries, we need to add the query index to the value key and label key to avoid conflicts
|
|
291
|
-
const valueColumnName = queryResults.length === 1 ? 'value' : `value #${queryIndex + 1}`;
|
|
292
|
-
const labels = queryResults.length === 1 ? ts.labels : Object.entries(ts.labels ?? {}).reduce((acc, [key, value])=>{
|
|
293
|
-
if (key) acc[`${key} #${queryIndex + 1}`] = value;
|
|
294
|
-
return acc;
|
|
295
|
-
}, {});
|
|
296
|
-
// If the cell visualization is a panel plugin, filter the data by the current series
|
|
297
|
-
const columnValue = (spec.columnSettings ?? []).find((x)=>x.name === valueColumnName)?.plugin ? {
|
|
298
|
-
...data,
|
|
299
|
-
data: {
|
|
300
|
-
...data.data,
|
|
301
|
-
series: data.data.series.filter((s)=>s === ts)
|
|
302
|
-
}
|
|
303
|
-
} : ts.values[0][1];
|
|
304
|
-
if (queryMode === 'instant') {
|
|
305
|
-
// Timestamp is not indexed as it will be the same for all queries
|
|
306
|
-
return {
|
|
307
|
-
timestamp: ts.values[0][0],
|
|
308
|
-
[valueColumnName]: columnValue,
|
|
309
|
-
...labels
|
|
310
|
-
};
|
|
311
|
-
} else {
|
|
312
|
-
// Don't add a timestamp for range queries
|
|
313
|
-
return {
|
|
314
|
-
[valueColumnName]: columnValue,
|
|
315
|
-
...labels
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
});
|
|
441
|
+
// Transform query results to a tabular format using shared utility
|
|
442
|
+
return (0, _tabledatautils.buildRawTableData)(queryResults, spec);
|
|
319
443
|
}, [
|
|
320
444
|
queryResults,
|
|
321
|
-
|
|
322
|
-
spec.columnSettings
|
|
445
|
+
spec
|
|
323
446
|
]);
|
|
324
447
|
// Transform will be applied by their orders on the original data
|
|
325
|
-
const data = (0, _react.useMemo)(()=>(0,
|
|
448
|
+
const data = (0, _react.useMemo)(()=>(0, _components.transformData)(rawData, spec.transforms ?? []), [
|
|
326
449
|
rawData,
|
|
327
450
|
spec.transforms
|
|
328
451
|
]);
|
|
@@ -351,6 +474,31 @@ function TablePanel({ contentDimensions, spec, queryResults }) {
|
|
|
351
474
|
data,
|
|
352
475
|
keys
|
|
353
476
|
]);
|
|
477
|
+
const gaugeRangeByColumn = (0, _react.useMemo)(()=>{
|
|
478
|
+
const result = {};
|
|
479
|
+
for (const key of keys){
|
|
480
|
+
let min = Number.POSITIVE_INFINITY;
|
|
481
|
+
let max = Number.NEGATIVE_INFINITY;
|
|
482
|
+
for (const row of data){
|
|
483
|
+
const numericValue = getGaugeNumericValue(row[key]);
|
|
484
|
+
if (numericValue === undefined) {
|
|
485
|
+
continue;
|
|
486
|
+
}
|
|
487
|
+
min = Math.min(min, numericValue);
|
|
488
|
+
max = Math.max(max, numericValue);
|
|
489
|
+
}
|
|
490
|
+
if (min !== Number.POSITIVE_INFINITY && max !== Number.NEGATIVE_INFINITY) {
|
|
491
|
+
result[key] = {
|
|
492
|
+
min,
|
|
493
|
+
max
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
return result;
|
|
498
|
+
}, [
|
|
499
|
+
data,
|
|
500
|
+
keys
|
|
501
|
+
]);
|
|
354
502
|
// Generate columns and map each column accessor to its settings index and data key
|
|
355
503
|
const columns = (0, _react.useMemo)(()=>{
|
|
356
504
|
const columns = [];
|
|
@@ -358,7 +506,7 @@ function TablePanel({ contentDimensions, spec, queryResults }) {
|
|
|
358
506
|
// Process columnSettings if they exist
|
|
359
507
|
for (const columnSetting of spec.columnSettings ?? []){
|
|
360
508
|
if (customizedColumns.has(columnSetting.name)) continue; // Skip duplicates
|
|
361
|
-
const columnConfig = generateColumnConfig(columnSetting.name, spec.columnSettings ?? [], allVariables);
|
|
509
|
+
const columnConfig = generateColumnConfig(columnSetting.name, spec.columnSettings ?? [], allVariables, gaugeRangeByColumn, spec.cellSettings ?? []);
|
|
362
510
|
if (columnConfig !== undefined) {
|
|
363
511
|
columns.push(columnConfig);
|
|
364
512
|
customizedColumns.add(columnSetting.name);
|
|
@@ -368,7 +516,7 @@ function TablePanel({ contentDimensions, spec, queryResults }) {
|
|
|
368
516
|
if (!spec.defaultColumnHidden) {
|
|
369
517
|
for (const key of keys){
|
|
370
518
|
if (!customizedColumns.has(key)) {
|
|
371
|
-
const columnConfig = generateColumnConfig(key, spec.columnSettings ?? [], allVariables);
|
|
519
|
+
const columnConfig = generateColumnConfig(key, spec.columnSettings ?? [], allVariables, gaugeRangeByColumn, spec.cellSettings ?? []);
|
|
372
520
|
if (columnConfig !== undefined) {
|
|
373
521
|
columns.push(columnConfig);
|
|
374
522
|
}
|
|
@@ -380,7 +528,9 @@ function TablePanel({ contentDimensions, spec, queryResults }) {
|
|
|
380
528
|
keys,
|
|
381
529
|
spec.columnSettings,
|
|
382
530
|
spec.defaultColumnHidden,
|
|
383
|
-
allVariables
|
|
531
|
+
allVariables,
|
|
532
|
+
gaugeRangeByColumn,
|
|
533
|
+
spec.cellSettings
|
|
384
534
|
]);
|
|
385
535
|
// Generate cell settings that will be used by the table to render cells (text color, background color, ...)
|
|
386
536
|
const cellConfigs = (0, _react.useMemo)(()=>{
|
|
@@ -50,6 +50,14 @@ function createInitialTableOptions() {
|
|
|
50
50
|
enableFiltering: true
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
+
function parseRangeBound(rawValue) {
|
|
54
|
+
const trimmed = rawValue.trim();
|
|
55
|
+
if (trimmed === '') {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
const parsed = Number(trimmed);
|
|
59
|
+
return Number.isNaN(parsed) ? undefined : parsed;
|
|
60
|
+
}
|
|
53
61
|
function formatCellDisplay(value, setting, defaultText) {
|
|
54
62
|
const baseText = setting.text || defaultText || String(value);
|
|
55
63
|
const displayText = `${setting.prefix ?? ''}${baseText}${setting.suffix ?? ''}`;
|
|
@@ -153,13 +161,22 @@ function renderConditionEditor(condition, onChange, size = 'small') {
|
|
|
153
161
|
label: 'From',
|
|
154
162
|
placeholder: 'Start of range',
|
|
155
163
|
value: condition.spec?.min ?? '',
|
|
156
|
-
onChange: (e)=>
|
|
164
|
+
onChange: (e)=>{
|
|
165
|
+
const nextMin = parseRangeBound(e.target.value);
|
|
166
|
+
onChange({
|
|
157
167
|
...condition,
|
|
158
168
|
spec: {
|
|
159
169
|
...condition.spec,
|
|
160
|
-
min:
|
|
170
|
+
min: nextMin
|
|
161
171
|
}
|
|
162
|
-
})
|
|
172
|
+
});
|
|
173
|
+
},
|
|
174
|
+
type: 'number',
|
|
175
|
+
slotProps: {
|
|
176
|
+
htmlInput: {
|
|
177
|
+
step: 'any'
|
|
178
|
+
}
|
|
179
|
+
},
|
|
163
180
|
fullWidth: true,
|
|
164
181
|
size: size
|
|
165
182
|
}),
|
|
@@ -168,13 +185,22 @@ function renderConditionEditor(condition, onChange, size = 'small') {
|
|
|
168
185
|
label: 'To',
|
|
169
186
|
placeholder: 'End of range (inclusive)',
|
|
170
187
|
value: condition.spec?.max ?? '',
|
|
171
|
-
onChange: (e)=>
|
|
188
|
+
onChange: (e)=>{
|
|
189
|
+
const nextMax = parseRangeBound(e.target.value);
|
|
190
|
+
onChange({
|
|
172
191
|
...condition,
|
|
173
192
|
spec: {
|
|
174
193
|
...condition.spec,
|
|
175
|
-
max:
|
|
194
|
+
max: nextMax
|
|
176
195
|
}
|
|
177
|
-
})
|
|
196
|
+
});
|
|
197
|
+
},
|
|
198
|
+
type: 'number',
|
|
199
|
+
slotProps: {
|
|
200
|
+
htmlInput: {
|
|
201
|
+
step: 'any'
|
|
202
|
+
}
|
|
203
|
+
},
|
|
178
204
|
fullWidth: true,
|
|
179
205
|
size: size
|
|
180
206
|
})
|
|
@@ -0,0 +1,83 @@
|
|
|
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 buildRawTableData () {
|
|
25
|
+
return buildRawTableData;
|
|
26
|
+
},
|
|
27
|
+
get getTablePanelQueryMode () {
|
|
28
|
+
return getTablePanelQueryMode;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
function getTablePanelQueryMode(spec) {
|
|
32
|
+
return (spec.columnSettings ?? []).some((c)=>c.plugin) ? 'range' : 'instant';
|
|
33
|
+
}
|
|
34
|
+
function buildRawTableData(queryResults, spec, options = {}) {
|
|
35
|
+
const { forExport = false } = options;
|
|
36
|
+
const queryMode = getTablePanelQueryMode(spec);
|
|
37
|
+
return queryResults.flatMap((data, queryIndex)=>(data.data?.series ?? []).map((ts)=>({
|
|
38
|
+
data,
|
|
39
|
+
ts,
|
|
40
|
+
queryIndex
|
|
41
|
+
}))).map(({ data, ts, queryIndex })=>{
|
|
42
|
+
if (ts.values[0] === undefined) {
|
|
43
|
+
return {
|
|
44
|
+
...ts.labels
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
// If there are multiple queries, add query index to value key and label keys to avoid conflicts
|
|
48
|
+
const valueColumnName = queryResults.length === 1 ? 'value' : `value #${queryIndex + 1}`;
|
|
49
|
+
const labels = queryResults.length === 1 ? ts.labels : Object.entries(ts.labels ?? {}).reduce((acc, [key, value])=>{
|
|
50
|
+
if (key) acc[`${key} #${queryIndex + 1}`] = value;
|
|
51
|
+
return acc;
|
|
52
|
+
}, {});
|
|
53
|
+
// For export: always use raw scalar values
|
|
54
|
+
// For rendering: plugin columns get embedded PanelData objects
|
|
55
|
+
let columnValue;
|
|
56
|
+
if (forExport) {
|
|
57
|
+
columnValue = ts.values[0][1];
|
|
58
|
+
} else {
|
|
59
|
+
const hasPlugin = (spec.columnSettings ?? []).find((x)=>x.name === valueColumnName)?.plugin;
|
|
60
|
+
columnValue = hasPlugin ? {
|
|
61
|
+
...data,
|
|
62
|
+
data: {
|
|
63
|
+
...data.data,
|
|
64
|
+
series: data.data.series.filter((s)=>s === ts)
|
|
65
|
+
}
|
|
66
|
+
} : ts.values[0][1];
|
|
67
|
+
}
|
|
68
|
+
if (queryMode === 'instant') {
|
|
69
|
+
// Timestamp is not indexed as it will be the same for all queries
|
|
70
|
+
return {
|
|
71
|
+
timestamp: ts.values[0][0],
|
|
72
|
+
[valueColumnName]: columnValue,
|
|
73
|
+
...labels
|
|
74
|
+
};
|
|
75
|
+
} else {
|
|
76
|
+
// Don't add a timestamp for range queries
|
|
77
|
+
return {
|
|
78
|
+
[valueColumnName]: columnValue,
|
|
79
|
+
...labels
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColumnEditor.d.ts","sourceRoot":"","sources":["../../../../src/components/ColumnsEditor/ColumnEditor.tsx"],"names":[],"mappings":"AAaA,OAAO,EAA8B,UAAU,
|
|
1
|
+
{"version":3,"file":"ColumnEditor.d.ts","sourceRoot":"","sources":["../../../../src/components/ColumnsEditor/ColumnEditor.tsx"],"names":[],"mappings":"AAaA,OAAO,EAA8B,UAAU,EAAiC,MAAM,eAAe,CAAC;AACtG,OAAO,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAa/C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAU9C,KAAK,eAAe,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,CAAC;AAEzD,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC;IAC1E,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;CAC5C;AAED,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,EAAE,iBAAiB,GAAG,YAAY,CA8M7F"}
|
|
@@ -11,12 +11,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
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 { Button, ButtonGroup, Stack, Switch, TextField } from '@mui/material';
|
|
14
|
+
import { Button, ButtonGroup, Stack, Switch, TextField, Typography } from '@mui/material';
|
|
15
15
|
import { useState } from 'react';
|
|
16
16
|
import { AlignSelector, FormatControls, OptionsEditorColumn, OptionsEditorControl, OptionsEditorGrid, OptionsEditorGroup, SortSelectorButtons } from '@perses-dev/components';
|
|
17
17
|
import { PluginKindSelect } from '@perses-dev/plugin-system';
|
|
18
18
|
import { ConditionalPanel } from '../ConditionalPanel';
|
|
19
19
|
import { DataLinkEditor } from './DataLinkEditorDialog';
|
|
20
|
+
import { EmbeddedPanelOptionsEditor } from './EmbeddedPanelOptionsEditor';
|
|
20
21
|
const DEFAULT_FORMAT = {
|
|
21
22
|
unit: 'decimal',
|
|
22
23
|
shortValues: true
|
|
@@ -115,39 +116,53 @@ export function ColumnEditor({ column, onChange, ...others }) {
|
|
|
115
116
|
})
|
|
116
117
|
}),
|
|
117
118
|
/*#__PURE__*/ _jsx(OptionsEditorControl, {
|
|
118
|
-
label: "
|
|
119
|
-
control: /*#__PURE__*/ _jsxs(
|
|
120
|
-
|
|
121
|
-
size: "small",
|
|
119
|
+
label: "Cell display",
|
|
120
|
+
control: /*#__PURE__*/ _jsxs(Stack, {
|
|
121
|
+
spacing: 1,
|
|
122
122
|
children: [
|
|
123
|
-
/*#__PURE__*/
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
123
|
+
/*#__PURE__*/ _jsxs(ButtonGroup, {
|
|
124
|
+
"aria-label": "Cell display",
|
|
125
|
+
size: "small",
|
|
126
|
+
children: [
|
|
127
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
128
|
+
variant: !column.plugin ? 'contained' : 'outlined',
|
|
129
|
+
onClick: ()=>onChange({
|
|
130
|
+
...column,
|
|
131
|
+
plugin: undefined
|
|
132
|
+
}),
|
|
133
|
+
children: "Text"
|
|
128
134
|
}),
|
|
129
|
-
|
|
135
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
136
|
+
variant: column.plugin ? 'contained' : 'outlined',
|
|
137
|
+
onClick: ()=>onChange({
|
|
138
|
+
...column,
|
|
139
|
+
plugin: {
|
|
140
|
+
kind: 'GaugeChart',
|
|
141
|
+
spec: {}
|
|
142
|
+
}
|
|
143
|
+
}),
|
|
144
|
+
children: "Visualization"
|
|
145
|
+
})
|
|
146
|
+
]
|
|
130
147
|
}),
|
|
131
|
-
/*#__PURE__*/ _jsx(
|
|
132
|
-
variant:
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
}),
|
|
140
|
-
children: "Embedded Panel"
|
|
148
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
149
|
+
variant: "caption",
|
|
150
|
+
color: "text.secondary",
|
|
151
|
+
sx: {
|
|
152
|
+
maxWidth: 360
|
|
153
|
+
},
|
|
154
|
+
children: "Visualizations reuse panel settings (thresholds, units, colors). Text mode uses value formatting below."
|
|
141
155
|
})
|
|
142
156
|
]
|
|
143
157
|
})
|
|
144
158
|
}),
|
|
145
159
|
column.plugin ? /*#__PURE__*/ _jsx(OptionsEditorControl, {
|
|
146
|
-
label: "
|
|
160
|
+
label: "Visualization type",
|
|
147
161
|
control: /*#__PURE__*/ _jsx(PluginKindSelect, {
|
|
148
162
|
pluginTypes: [
|
|
149
163
|
'Panel'
|
|
150
164
|
],
|
|
165
|
+
size: "small",
|
|
151
166
|
value: {
|
|
152
167
|
type: 'Panel',
|
|
153
168
|
kind: column.plugin.kind
|
|
@@ -221,9 +236,32 @@ export function ColumnEditor({ column, onChange, ...others }) {
|
|
|
221
236
|
})
|
|
222
237
|
]
|
|
223
238
|
}),
|
|
239
|
+
column.plugin?.kind === 'GaugeChart' && /*#__PURE__*/ _jsx(Stack, {
|
|
240
|
+
sx: {
|
|
241
|
+
px: 8,
|
|
242
|
+
mt: 4,
|
|
243
|
+
width: '100%'
|
|
244
|
+
},
|
|
245
|
+
spacing: 2,
|
|
246
|
+
children: /*#__PURE__*/ _jsx(OptionsEditorGroup, {
|
|
247
|
+
title: "Visualization settings",
|
|
248
|
+
children: /*#__PURE__*/ _jsx(EmbeddedPanelOptionsEditor, {
|
|
249
|
+
kind: "GaugeChart",
|
|
250
|
+
spec: column.plugin.spec,
|
|
251
|
+
onChange: (nextSpec)=>onChange({
|
|
252
|
+
...column,
|
|
253
|
+
plugin: {
|
|
254
|
+
kind: 'GaugeChart',
|
|
255
|
+
spec: nextSpec
|
|
256
|
+
}
|
|
257
|
+
})
|
|
258
|
+
})
|
|
259
|
+
})
|
|
260
|
+
}),
|
|
224
261
|
/*#__PURE__*/ _jsx(Stack, {
|
|
225
262
|
sx: {
|
|
226
|
-
px: 8
|
|
263
|
+
px: 8,
|
|
264
|
+
mt: column.plugin?.kind === 'GaugeChart' ? 3 : 0
|
|
227
265
|
},
|
|
228
266
|
children: /*#__PURE__*/ _jsx(OptionsEditorGroup, {
|
|
229
267
|
title: "Conditional Cell Format",
|