@perses-dev/timeseries-table-plugin 0.6.0 → 0.7.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/6759.53436797.css +1 -0
- package/__mf/css/async/8433.53436797.css +1 -0
- package/__mf/js/2795.da99f4e6.js +5 -0
- package/__mf/js/TimeSeriesTable.4632354a.js +5 -0
- package/__mf/js/async/1341.d49ae1f0.js +1 -0
- package/__mf/js/async/1553.bffe2dc4.js +1 -0
- package/__mf/js/async/1620.087db0c7.js +2 -0
- package/__mf/js/async/1640.0bfd6990.js +1 -0
- package/__mf/js/async/1722.46f056b1.js +1 -0
- package/__mf/js/async/1964.4a4c79de.js +2 -0
- package/__mf/js/async/1996.eb63b85f.js +2 -0
- package/__mf/js/async/{621.966dfe80.js.LICENSE.txt → 1996.eb63b85f.js.LICENSE.txt} +1 -29
- package/__mf/js/async/2358.d5e2a579.js +7 -0
- package/__mf/js/async/2358.d5e2a579.js.LICENSE.txt +21 -0
- package/__mf/js/async/2399.c004c2a0.js +23 -0
- package/__mf/js/async/2641.01bd627c.js +1 -0
- package/__mf/js/async/2651.d5006fab.js +1 -0
- package/__mf/js/async/3001.f5a37a5a.js +1 -0
- package/__mf/js/async/3111.078f056e.js +37 -0
- package/__mf/js/async/3224.63f1a520.js +1 -0
- package/__mf/js/async/3598.da131c3c.js +1 -0
- package/__mf/js/async/3660.8a07b6df.js +23 -0
- package/__mf/js/async/3957.a3f3614e.js +110 -0
- package/__mf/js/async/3957.a3f3614e.js.LICENSE.txt +27 -0
- package/__mf/js/async/3960.0678df22.js +2 -0
- package/__mf/js/async/4062.8fbd023d.js +1 -0
- package/__mf/js/async/4075.22bc0873.js +1 -0
- package/__mf/js/async/4162.aa7fb091.js +2 -0
- package/__mf/js/async/4238.de913fb3.js +1 -0
- package/__mf/js/async/4446.de8c4376.js +1 -0
- package/__mf/js/async/52.66016701.js +2 -0
- package/__mf/js/async/{998.e20cf478.js.LICENSE.txt → 52.66016701.js.LICENSE.txt} +0 -22
- package/__mf/js/async/5214.b931b5ac.js +1 -0
- package/__mf/js/async/5377.b77de32b.js +1 -0
- package/__mf/js/async/5409.6e494cf6.js +1 -0
- package/__mf/js/async/5662.5aa06a68.js +1 -0
- package/__mf/js/async/5767.9f409196.js +1 -0
- package/__mf/js/async/5981.1cd4ab43.js +2 -0
- package/__mf/js/async/5981.1cd4ab43.js.LICENSE.txt +8 -0
- package/__mf/js/async/5998.273ad1d8.js +73 -0
- package/__mf/js/async/5998.273ad1d8.js.LICENSE.txt +19 -0
- package/__mf/js/async/6292.010b6aa2.js +1 -0
- package/__mf/js/async/654.0d83c19c.js +1 -0
- package/__mf/js/async/6770.6eabdbb7.js +1 -0
- package/__mf/js/async/6884.bc471e42.js +1 -0
- package/__mf/js/async/694.cb61dcb6.js +1 -0
- package/__mf/js/async/738.377b283e.js +1 -0
- package/__mf/js/async/7606.1f156522.js +1 -0
- package/__mf/js/async/7623.54552a7d.js +1 -0
- package/__mf/js/async/7740.0c13b10c.js +1 -0
- package/__mf/js/async/8488.0c0f8c8f.js +1 -0
- package/__mf/js/async/894.670bb5d0.js +1 -0
- package/__mf/js/async/9173.1eeac569.js +2 -0
- package/__mf/js/async/9560.b16c7025.js +1 -0
- package/__mf/js/async/9954.d0a3f126.js +1 -0
- package/__mf/js/async/__federation_expose_TimeSeriesTable.1b608971.js +1 -0
- package/__mf/js/async/lib-router.a7c459f9.js +2 -0
- package/__mf/js/async/lib-router.a7c459f9.js.LICENSE.txt +32 -0
- package/__mf/js/main.f66bbd09.js +1 -0
- package/lib/TimeSeriesTablePanel.js +1 -1
- package/lib/TimeSeriesTablePanel.js.map +1 -1
- package/lib/cjs/TimeSeriesTablePanel.js +1 -1
- package/lib/cjs/components/DataTable.js +62 -39
- package/lib/cjs/components/EmbeddedPanel.js +52 -0
- package/lib/cjs/components/index.js +0 -1
- package/lib/components/DataTable.d.ts +2 -2
- package/lib/components/DataTable.d.ts.map +1 -1
- package/lib/components/DataTable.js +64 -41
- package/lib/components/DataTable.js.map +1 -1
- package/lib/components/EmbeddedPanel.d.ts +10 -0
- package/lib/components/EmbeddedPanel.d.ts.map +1 -0
- package/lib/components/EmbeddedPanel.js +39 -0
- package/lib/components/EmbeddedPanel.js.map +1 -0
- package/lib/components/index.d.ts +0 -1
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +0 -1
- package/lib/components/index.js.map +1 -1
- package/mf-manifest.json +285 -35
- package/mf-stats.json +313 -36
- package/package.json +7 -2
- package/__mf/js/795.a00f14d5.js +0 -5
- package/__mf/js/TimeSeriesTable.78b6adc4.js +0 -5
- package/__mf/js/async/156.edaa1366.js +0 -1
- package/__mf/js/async/173.7677c422.js +0 -2
- package/__mf/js/async/570.4e5c2806.js +0 -1
- package/__mf/js/async/620.989f65d2.js +0 -2
- package/__mf/js/async/621.966dfe80.js +0 -111
- package/__mf/js/async/651.f2005980.js +0 -1
- package/__mf/js/async/694.46f61549.js +0 -1
- package/__mf/js/async/740.64988389.js +0 -1
- package/__mf/js/async/75.65fec995.js +0 -1
- package/__mf/js/async/770.46d7d5f9.js +0 -1
- package/__mf/js/async/960.d242a960.js +0 -2
- package/__mf/js/async/964.7386b918.js +0 -2
- package/__mf/js/async/998.e20cf478.js +0 -65
- package/__mf/js/async/__federation_expose_TimeSeriesTable.0774ca0f.js +0 -1
- package/__mf/js/main.857476c9.js +0 -1
- package/lib/cjs/components/HistogramChart.js +0 -121
- package/lib/components/HistogramChart.d.ts +0 -16
- package/lib/components/HistogramChart.d.ts.map +0 -1
- package/lib/components/HistogramChart.js +0 -113
- package/lib/components/HistogramChart.js.map +0 -1
- /package/__mf/css/async/{341.53436797.css → 2341.53436797.css} +0 -0
- /package/__mf/css/async/{759.53436797.css → 5263.53436797.css} +0 -0
- /package/__mf/js/async/{620.989f65d2.js.LICENSE.txt → 1620.087db0c7.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{964.7386b918.js.LICENSE.txt → 1964.4a4c79de.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{960.d242a960.js.LICENSE.txt → 3960.0678df22.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{173.7677c422.js.LICENSE.txt → 9173.1eeac569.js.LICENSE.txt} +0 -0
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
-
import {
|
|
15
|
-
import { Alert, Stack, Table, TableBody, TableCell, TableHead, TableRow, Typography } from '@mui/material';
|
|
14
|
+
import { useMemo } from 'react';
|
|
15
|
+
import { Alert, Box, Stack, Table, TableBody, TableCell, TableHead, TableRow, Typography } from '@mui/material';
|
|
16
16
|
import { SeriesName } from './SeriesName';
|
|
17
|
-
import {
|
|
17
|
+
import { EmbeddedPanel } from './EmbeddedPanel';
|
|
18
18
|
const MAX_FORMATABLE_SERIES = 1000;
|
|
19
19
|
/**
|
|
20
20
|
* Designed to display timeseries data in a prometheus like table format.
|
|
@@ -23,14 +23,15 @@ const MAX_FORMATABLE_SERIES = 1000;
|
|
|
23
23
|
* https://github.com/prometheus/prometheus/blob/2524a915915d7eb1b1207152d2e0ce5771193404/web/ui/react-app/src/pages/graph/DataTable.tsx
|
|
24
24
|
* @param result timeseries query result
|
|
25
25
|
* @constructor
|
|
26
|
-
*/ export const DataTable = ({
|
|
27
|
-
const series = useMemo(()=>
|
|
28
|
-
|
|
26
|
+
*/ export const DataTable = ({ queryResults })=>{
|
|
27
|
+
const series = useMemo(()=>queryResults.flatMap((d)=>d.data).flatMap((d)=>d?.series || []), [
|
|
28
|
+
queryResults
|
|
29
29
|
]);
|
|
30
|
-
const rows = useMemo(()=>buildRows(series), [
|
|
31
|
-
series
|
|
30
|
+
const rows = useMemo(()=>buildRows(series, queryResults), [
|
|
31
|
+
series,
|
|
32
|
+
queryResults
|
|
32
33
|
]);
|
|
33
|
-
if (!
|
|
34
|
+
if (!queryResults) {
|
|
34
35
|
return /*#__PURE__*/ _jsx(Typography, {
|
|
35
36
|
children: "No data"
|
|
36
37
|
});
|
|
@@ -54,7 +55,7 @@ const MAX_FORMATABLE_SERIES = 1000;
|
|
|
54
55
|
]
|
|
55
56
|
});
|
|
56
57
|
};
|
|
57
|
-
function buildRows(series) {
|
|
58
|
+
function buildRows(series, queryResults) {
|
|
58
59
|
const isFormatted = series.length < MAX_FORMATABLE_SERIES; // only format series names if we have less than 1000 series for performance reasons
|
|
59
60
|
return series.map((s, seriesIdx)=>{
|
|
60
61
|
const displayTimeStamps = (s.values?.length ?? 0) > 1;
|
|
@@ -72,39 +73,61 @@ function buildRows(series) {
|
|
|
72
73
|
]
|
|
73
74
|
}, valIdx);
|
|
74
75
|
}) : [];
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
76
|
+
let histogramsAndTimes = null;
|
|
77
|
+
if (s.histograms && s.histograms.length > 0) {
|
|
78
|
+
// Query results contains multiple series, create a new query result with only the current series
|
|
79
|
+
const seriesQueryResult = {
|
|
80
|
+
...queryResults[0],
|
|
81
|
+
data: {
|
|
82
|
+
...queryResults[0].data,
|
|
83
|
+
series: [
|
|
84
|
+
queryResults[0].data.series[seriesIdx]
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
histogramsAndTimes = s.histograms.map((h, hisIdx)=>{
|
|
89
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
90
|
+
alignItems: "center",
|
|
91
|
+
children: [
|
|
92
|
+
/*#__PURE__*/ _jsx(Box, {
|
|
93
|
+
width: 400,
|
|
94
|
+
height: 200,
|
|
95
|
+
children: /*#__PURE__*/ _jsx(EmbeddedPanel, {
|
|
96
|
+
kind: "HistogramChart",
|
|
97
|
+
spec: {
|
|
98
|
+
unit: 'decimal',
|
|
99
|
+
width: 400,
|
|
100
|
+
height: 200
|
|
101
|
+
},
|
|
102
|
+
queryResults: [
|
|
103
|
+
seriesQueryResult
|
|
100
104
|
]
|
|
101
105
|
})
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
}),
|
|
107
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
108
|
+
flexDirection: "row",
|
|
109
|
+
justifyContent: "space-between",
|
|
110
|
+
width: "100%",
|
|
111
|
+
children: [
|
|
112
|
+
/*#__PURE__*/ _jsxs(Typography, {
|
|
113
|
+
children: [
|
|
114
|
+
"Total count: ",
|
|
115
|
+
h[1].count
|
|
116
|
+
]
|
|
117
|
+
}),
|
|
118
|
+
/*#__PURE__*/ _jsxs(Typography, {
|
|
119
|
+
children: [
|
|
120
|
+
"Sum: ",
|
|
121
|
+
h[1].sum
|
|
122
|
+
]
|
|
123
|
+
})
|
|
124
|
+
]
|
|
125
|
+
}),
|
|
126
|
+
histogramTable(h[1])
|
|
127
|
+
]
|
|
128
|
+
}, -hisIdx);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
108
131
|
return /*#__PURE__*/ _jsxs(TableRow, {
|
|
109
132
|
style: {
|
|
110
133
|
whiteSpace: 'pre'
|
|
@@ -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 {
|
|
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_FORMATABLE_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) {\n return <Typography>No data</Typography>;\n }\n\n return (\n <>\n {series.length >= MAX_FORMATABLE_SERIES && (\n <Alert severity=\"warning\">\n Showing more than {MAX_FORMATABLE_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_FORMATABLE_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_FORMATABLE_SERIES","DataTable","queryResults","series","flatMap","d","data","rows","buildRows","length","severity","className","isFormatted","map","s","seriesIdx","displayTimeStamps","values","valuesAndTimes","v","valIdx","span","histogramsAndTimes","histograms","seriesQueryResult","h","hisIdx","alignItems","width","height","kind","spec","unit","flexDirection","justifyContent","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,U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AI,EAAEC,gBAAgBJ,WAAWE,eAAe;AACnG,EAAE;AAEF,OAAO,MAAMV,iBAAiB,CAACZ,kBAC7B,MAACjC;;0BACC,KAACG;0BACC,cAAA,KAACC;8BACC,cAAA,KAACF;wBAAU4C,OAAO;4BAAEY,WAAW;wBAAS;wBAAGC,SAAS;kCAAG;;;;0BAK3D,MAAC1D;;kCACC,MAACG;;0CACC,KAACF;0CAAU;;0CACX,KAACA;0CAAU;;;;oBAEZ+B,EAAE2B,OAAO,EAAEvC,IAAI,CAACwC,GAAgBC,kBAC/B,MAAC1D;;8CACC,KAACF;8CAAWoD,kBAAkBO;;8CAC9B,KAAC3D;8CAAW2D,CAAC,CAAC,EAAE;;;2BAFHC;;;;OAOrB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PanelData } from '@perses-dev/plugin-system';
|
|
2
|
+
import { QueryDataType, UnknownSpec } from '@perses-dev/core';
|
|
3
|
+
interface EmbeddedPanelProps {
|
|
4
|
+
kind: string;
|
|
5
|
+
spec: UnknownSpec;
|
|
6
|
+
queryResults: Array<PanelData<QueryDataType>>;
|
|
7
|
+
}
|
|
8
|
+
export declare function EmbeddedPanel({ kind, spec, queryResults }: EmbeddedPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=EmbeddedPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmbeddedPanel.d.ts","sourceRoot":"","sources":["../../../src/components/EmbeddedPanel.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAK9D,UAAU,kBAAkB;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,CAAC;IAClB,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC;CAC/C;AAED,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,kBAAkB,2CAS7E"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright 2025 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
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { PanelPluginLoader } from '@perses-dev/dashboards';
|
|
15
|
+
import useResizeObserver from 'use-resize-observer';
|
|
16
|
+
import { ErrorAlert, ErrorBoundary } from '@perses-dev/components';
|
|
17
|
+
export function EmbeddedPanel({ kind, spec, queryResults }) {
|
|
18
|
+
const { ref, width = 1, height = 1 } = useResizeObserver();
|
|
19
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
20
|
+
ref: ref,
|
|
21
|
+
style: {
|
|
22
|
+
height: '100%'
|
|
23
|
+
},
|
|
24
|
+
children: /*#__PURE__*/ _jsx(ErrorBoundary, {
|
|
25
|
+
FallbackComponent: ErrorAlert,
|
|
26
|
+
children: /*#__PURE__*/ _jsx(PanelPluginLoader, {
|
|
27
|
+
kind: kind,
|
|
28
|
+
contentDimensions: {
|
|
29
|
+
width,
|
|
30
|
+
height
|
|
31
|
+
},
|
|
32
|
+
spec: spec,
|
|
33
|
+
queryResults: queryResults
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=EmbeddedPanel.js.map
|
|
@@ -0,0 +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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
package/lib/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["export * from './DataTable';\nexport * from './
|
|
1
|
+
{"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["export * from './DataTable';\nexport * from './SeriesName';\n"],"names":[],"mappings":"AAAA,cAAc,cAAc;AAC5B,cAAc,eAAe"}
|