@perses-dev/gauge-chart-plugin 0.6.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 (118) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +41 -0
  3. package/__mf/css/async/263.683bd428.css +1 -0
  4. package/__mf/css/async/341.683bd428.css +1 -0
  5. package/__mf/css/async/759.683bd428.css +1 -0
  6. package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
  7. package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
  8. package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
  9. package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
  10. package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
  11. package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
  12. package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
  13. package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
  14. package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
  15. package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
  16. package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
  17. package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
  18. package/__mf/js/481.157b10da.js +5 -0
  19. package/__mf/js/GaugeChart.ab54e56d.js +5 -0
  20. package/__mf/js/async/162.e82ae267.js +73 -0
  21. package/__mf/js/async/162.e82ae267.js.LICENSE.txt +19 -0
  22. package/__mf/js/async/173.5bfb1682.js +2 -0
  23. package/__mf/js/async/173.5bfb1682.js.LICENSE.txt +19 -0
  24. package/__mf/js/async/214.6d1beb4f.js +1 -0
  25. package/__mf/js/async/224.dd9ee618.js +1 -0
  26. package/__mf/js/async/238.3b90e0d1.js +1 -0
  27. package/__mf/js/async/292.d6d07d9c.js +1 -0
  28. package/__mf/js/async/296.6e15d7c1.js +1 -0
  29. package/__mf/js/async/301.2cb371d7.js +1 -0
  30. package/__mf/js/async/488.6e73b2c9.js +1 -0
  31. package/__mf/js/async/553.db3ebdeb.js +1 -0
  32. package/__mf/js/async/610.ba53bb1f.js +1 -0
  33. package/__mf/js/async/620.eb985bf1.js +2 -0
  34. package/__mf/js/async/620.eb985bf1.js.LICENSE.txt +9 -0
  35. package/__mf/js/async/623.afdd0af8.js +1 -0
  36. package/__mf/js/async/656.75485b0e.js +1 -0
  37. package/__mf/js/async/694.8b956cd7.js +1 -0
  38. package/__mf/js/async/738.e2de8ee4.js +1 -0
  39. package/__mf/js/async/740.a7a03e99.js +1 -0
  40. package/__mf/js/async/75.4ebd94ad.js +1 -0
  41. package/__mf/js/async/770.1ddcdb57.js +1 -0
  42. package/__mf/js/async/774.db64c396.js +1 -0
  43. package/__mf/js/async/790.4aa856ac.js +1 -0
  44. package/__mf/js/async/808.4e339e11.js +37 -0
  45. package/__mf/js/async/870.e225b77a.js +29 -0
  46. package/__mf/js/async/870.e225b77a.js.LICENSE.txt +59 -0
  47. package/__mf/js/async/885.6fe431cc.js +102 -0
  48. package/__mf/js/async/929.fde3d617.js +10 -0
  49. package/__mf/js/async/929.fde3d617.js.LICENSE.txt +27 -0
  50. package/__mf/js/async/930.dbd05e3e.js +1 -0
  51. package/__mf/js/async/960.fb84169e.js +2 -0
  52. package/__mf/js/async/960.fb84169e.js.LICENSE.txt +8 -0
  53. package/__mf/js/async/964.80d5e8c0.js +2 -0
  54. package/__mf/js/async/964.80d5e8c0.js.LICENSE.txt +9 -0
  55. package/__mf/js/async/981.6ecc2fa1.js +2 -0
  56. package/__mf/js/async/981.6ecc2fa1.js.LICENSE.txt +8 -0
  57. package/__mf/js/async/996.ec5992e5.js +2 -0
  58. package/__mf/js/async/996.ec5992e5.js.LICENSE.txt +24 -0
  59. package/__mf/js/async/__federation_expose_GaugeChart.8d994ab0.js +1 -0
  60. package/__mf/js/async/lib-router.c799dfc6.js +2 -0
  61. package/__mf/js/async/lib-router.c799dfc6.js.LICENSE.txt +32 -0
  62. package/__mf/js/main.7be7ddac.js +1 -0
  63. package/lib/GaugeChart.d.ts +8 -0
  64. package/lib/GaugeChart.d.ts.map +1 -0
  65. package/lib/GaugeChart.js +33 -0
  66. package/lib/GaugeChart.js.map +1 -0
  67. package/lib/GaugeChartOptionsEditorSettings.d.ts +4 -0
  68. package/lib/GaugeChartOptionsEditorSettings.d.ts.map +1 -0
  69. package/lib/GaugeChartOptionsEditorSettings.js +88 -0
  70. package/lib/GaugeChartOptionsEditorSettings.js.map +1 -0
  71. package/lib/GaugeChartPanel.d.ts +8 -0
  72. package/lib/GaugeChartPanel.d.ts.map +1 -0
  73. package/lib/GaugeChartPanel.js +126 -0
  74. package/lib/GaugeChartPanel.js.map +1 -0
  75. package/lib/bootstrap.d.ts +2 -0
  76. package/lib/bootstrap.d.ts.map +1 -0
  77. package/lib/bootstrap.js +19 -0
  78. package/lib/bootstrap.js.map +1 -0
  79. package/lib/cjs/GaugeChart.js +39 -0
  80. package/lib/cjs/GaugeChartOptionsEditorSettings.js +101 -0
  81. package/lib/cjs/GaugeChartPanel.js +147 -0
  82. package/lib/cjs/bootstrap.js +26 -0
  83. package/lib/cjs/env.d.js +14 -0
  84. package/lib/cjs/gauge-chart-model.js +57 -0
  85. package/lib/cjs/getPluginModule.js +27 -0
  86. package/lib/cjs/index-federation.js +55 -0
  87. package/lib/cjs/index.js +29 -0
  88. package/lib/cjs/setup-tests.js +19 -0
  89. package/lib/cjs/thresholds.js +77 -0
  90. package/lib/env.d.js +15 -0
  91. package/lib/env.d.js.map +1 -0
  92. package/lib/gauge-chart-model.d.ts +26 -0
  93. package/lib/gauge-chart-model.d.ts.map +1 -0
  94. package/lib/gauge-chart-model.js +37 -0
  95. package/lib/gauge-chart-model.js.map +1 -0
  96. package/lib/getPluginModule.d.ts +6 -0
  97. package/lib/getPluginModule.d.ts.map +1 -0
  98. package/lib/getPluginModule.js +16 -0
  99. package/lib/getPluginModule.js.map +1 -0
  100. package/lib/index-federation.d.ts +1 -0
  101. package/lib/index-federation.d.ts.map +1 -0
  102. package/lib/index-federation.js +15 -0
  103. package/lib/index-federation.js.map +1 -0
  104. package/lib/index.d.ts +7 -0
  105. package/lib/index.d.ts.map +1 -0
  106. package/lib/index.js +8 -0
  107. package/lib/index.js.map +1 -0
  108. package/lib/setup-tests.d.ts +2 -0
  109. package/lib/setup-tests.d.ts.map +1 -0
  110. package/lib/setup-tests.js +17 -0
  111. package/lib/setup-tests.js.map +1 -0
  112. package/lib/thresholds.d.ts +6 -0
  113. package/lib/thresholds.d.ts.map +1 -0
  114. package/lib/thresholds.js +56 -0
  115. package/lib/thresholds.js.map +1 -0
  116. package/mf-manifest.json +396 -0
  117. package/mf-stats.json +453 -0
  118. package/package.json +50 -0
@@ -0,0 +1,126 @@
1
+ // Copyright 2023 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 { Box, Skeleton, Stack } from '@mui/material';
15
+ import { GaugeChart, useChartsTheme } from '@perses-dev/components';
16
+ import { CalculationsMap, DEFAULT_CALCULATION } from '@perses-dev/core';
17
+ import merge from 'lodash/merge';
18
+ import { useMemo } from 'react';
19
+ import { DEFAULT_FORMAT, DEFAULT_MAX_PERCENT, DEFAULT_MAX_PERCENT_DECIMAL } from './gauge-chart-model';
20
+ import { convertThresholds, defaultThresholdInput } from './thresholds';
21
+ const EMPTY_GAUGE_SERIES = {
22
+ label: '',
23
+ value: undefined
24
+ };
25
+ const GAUGE_MIN_WIDTH = 90;
26
+ const PANEL_PADDING_OFFSET = 20;
27
+ export function GaugeChartPanel(props) {
28
+ const { spec: pluginSpec, contentDimensions, queryResults } = props;
29
+ const { calculation, max } = pluginSpec;
30
+ const { thresholds: thresholdsColors } = useChartsTheme();
31
+ // ensures all default format properties set if undef
32
+ const format = merge({}, DEFAULT_FORMAT, pluginSpec.format);
33
+ const thresholds = pluginSpec.thresholds ?? defaultThresholdInput;
34
+ const gaugeData = useMemo(()=>{
35
+ if (queryResults[0]?.data === undefined) {
36
+ return [];
37
+ }
38
+ if (CalculationsMap[calculation] === undefined) {
39
+ console.warn(`Invalid GaugeChart panel calculation ${calculation}, fallback to ${DEFAULT_CALCULATION}`);
40
+ }
41
+ const calculate = CalculationsMap[calculation] ?? CalculationsMap[DEFAULT_CALCULATION];
42
+ const seriesData = [];
43
+ for (const timeSeries of queryResults[0].data.series){
44
+ const series = {
45
+ value: calculate(timeSeries.values),
46
+ label: timeSeries.formattedName ?? ''
47
+ };
48
+ seriesData.push(series);
49
+ }
50
+ return seriesData;
51
+ }, [
52
+ queryResults,
53
+ calculation
54
+ ]);
55
+ if (contentDimensions === undefined) return null;
56
+ // needed for end value of last threshold color segment
57
+ let thresholdMax = max;
58
+ if (thresholdMax === undefined) {
59
+ if (format.unit === 'percent') {
60
+ thresholdMax = DEFAULT_MAX_PERCENT;
61
+ } else {
62
+ thresholdMax = DEFAULT_MAX_PERCENT_DECIMAL;
63
+ }
64
+ }
65
+ const axisLineColors = convertThresholds(thresholds, format, thresholdMax, thresholdsColors);
66
+ const axisLine = {
67
+ show: true,
68
+ lineStyle: {
69
+ width: 5,
70
+ color: axisLineColors
71
+ }
72
+ };
73
+ // no data message handled inside chart component
74
+ if (gaugeData.length === 0) {
75
+ return /*#__PURE__*/ _jsx(GaugeChart, {
76
+ width: contentDimensions.width,
77
+ height: contentDimensions.height,
78
+ data: EMPTY_GAUGE_SERIES,
79
+ format: format,
80
+ axisLine: axisLine,
81
+ max: thresholdMax
82
+ });
83
+ }
84
+ // accounts for showing a separate chart for each time series
85
+ let chartWidth = contentDimensions.width / gaugeData.length - PANEL_PADDING_OFFSET;
86
+ if (chartWidth < GAUGE_MIN_WIDTH && gaugeData.length > 1) {
87
+ // enables horizontal scroll when charts overflow outside of panel
88
+ chartWidth = GAUGE_MIN_WIDTH;
89
+ }
90
+ const hasMultipleCharts = gaugeData.length > 1;
91
+ return /*#__PURE__*/ _jsx(Stack, {
92
+ direction: "row",
93
+ spacing: hasMultipleCharts ? 2 : 0,
94
+ justifyContent: hasMultipleCharts ? 'left' : 'center',
95
+ alignItems: "center",
96
+ sx: {
97
+ // so scrollbar only shows when necessary
98
+ overflowX: gaugeData.length > 1 ? 'scroll' : 'auto'
99
+ },
100
+ children: gaugeData.map((series, seriesIndex)=>{
101
+ return /*#__PURE__*/ _jsx(Box, {
102
+ children: /*#__PURE__*/ _jsx(GaugeChart, {
103
+ width: chartWidth,
104
+ height: contentDimensions.height,
105
+ data: series,
106
+ format: format,
107
+ axisLine: axisLine,
108
+ max: thresholdMax
109
+ })
110
+ }, `gauge-series-${seriesIndex}`);
111
+ })
112
+ });
113
+ }
114
+ export function GaugeChartLoading({ contentDimensions }) {
115
+ if (contentDimensions === undefined) return null;
116
+ return /*#__PURE__*/ _jsx(Skeleton, {
117
+ sx: {
118
+ margin: '0 auto'
119
+ },
120
+ variant: "circular",
121
+ width: contentDimensions.width > contentDimensions.height ? contentDimensions.height : contentDimensions.width,
122
+ height: contentDimensions.height
123
+ });
124
+ }
125
+
126
+ //# sourceMappingURL=GaugeChartPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/GaugeChartPanel.tsx"],"sourcesContent":["// Copyright 2023 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 { Box, Skeleton, Stack } from '@mui/material';\nimport { GaugeChart, GaugeSeries, useChartsTheme } from '@perses-dev/components';\nimport { CalculationsMap, DEFAULT_CALCULATION, TimeSeriesData } from '@perses-dev/core';\nimport { PanelProps } from '@perses-dev/plugin-system';\nimport type { GaugeSeriesOption } from 'echarts';\nimport merge from 'lodash/merge';\nimport { ReactElement, useMemo } from 'react';\nimport {\n DEFAULT_FORMAT,\n DEFAULT_MAX_PERCENT,\n DEFAULT_MAX_PERCENT_DECIMAL,\n GaugeChartOptions,\n} from './gauge-chart-model';\nimport { convertThresholds, defaultThresholdInput } from './thresholds';\n\nconst EMPTY_GAUGE_SERIES: GaugeSeries = { label: '', value: undefined };\nconst GAUGE_MIN_WIDTH = 90;\nconst PANEL_PADDING_OFFSET = 20;\n\nexport type GaugeChartPanelProps = PanelProps<GaugeChartOptions, TimeSeriesData>;\n\nexport function GaugeChartPanel(props: GaugeChartPanelProps): ReactElement | null {\n const { spec: pluginSpec, contentDimensions, queryResults } = props;\n const { calculation, max } = pluginSpec;\n\n const { thresholds: thresholdsColors } = useChartsTheme();\n\n // ensures all default format properties set if undef\n const format = merge({}, DEFAULT_FORMAT, pluginSpec.format);\n\n const thresholds = pluginSpec.thresholds ?? defaultThresholdInput;\n\n const gaugeData: GaugeSeries[] = useMemo(() => {\n if (queryResults[0]?.data === undefined) {\n return [];\n }\n\n if (CalculationsMap[calculation] === undefined) {\n console.warn(`Invalid GaugeChart panel calculation ${calculation}, fallback to ${DEFAULT_CALCULATION}`);\n }\n\n const calculate = CalculationsMap[calculation] ?? CalculationsMap[DEFAULT_CALCULATION];\n\n const seriesData: GaugeSeries[] = [];\n for (const timeSeries of queryResults[0].data.series) {\n const series = {\n value: calculate(timeSeries.values),\n label: timeSeries.formattedName ?? '',\n };\n seriesData.push(series);\n }\n return seriesData;\n }, [queryResults, calculation]);\n\n if (contentDimensions === undefined) return null;\n\n // needed for end value of last threshold color segment\n let thresholdMax = max;\n if (thresholdMax === undefined) {\n if (format.unit === 'percent') {\n thresholdMax = DEFAULT_MAX_PERCENT;\n } else {\n thresholdMax = DEFAULT_MAX_PERCENT_DECIMAL;\n }\n }\n const axisLineColors = convertThresholds(thresholds, format, thresholdMax, thresholdsColors);\n\n const axisLine: GaugeSeriesOption['axisLine'] = {\n show: true,\n lineStyle: {\n width: 5,\n color: axisLineColors,\n },\n };\n\n // no data message handled inside chart component\n if (gaugeData.length === 0) {\n return (\n <GaugeChart\n width={contentDimensions.width}\n height={contentDimensions.height}\n data={EMPTY_GAUGE_SERIES}\n format={format}\n axisLine={axisLine}\n max={thresholdMax}\n />\n );\n }\n\n // accounts for showing a separate chart for each time series\n let chartWidth = contentDimensions.width / gaugeData.length - PANEL_PADDING_OFFSET;\n if (chartWidth < GAUGE_MIN_WIDTH && gaugeData.length > 1) {\n // enables horizontal scroll when charts overflow outside of panel\n chartWidth = GAUGE_MIN_WIDTH;\n }\n\n const hasMultipleCharts = gaugeData.length > 1;\n\n return (\n <Stack\n direction=\"row\"\n spacing={hasMultipleCharts ? 2 : 0}\n justifyContent={hasMultipleCharts ? 'left' : 'center'}\n alignItems=\"center\"\n sx={{\n // so scrollbar only shows when necessary\n overflowX: gaugeData.length > 1 ? 'scroll' : 'auto',\n }}\n >\n {gaugeData.map((series, seriesIndex) => {\n return (\n <Box key={`gauge-series-${seriesIndex}`}>\n <GaugeChart\n width={chartWidth}\n height={contentDimensions.height}\n data={series}\n format={format}\n axisLine={axisLine}\n max={thresholdMax}\n />\n </Box>\n );\n })}\n </Stack>\n );\n}\n\nexport function GaugeChartLoading({ contentDimensions }: GaugeChartPanelProps): React.ReactElement | null {\n if (contentDimensions === undefined) return null;\n return (\n <Skeleton\n sx={{ margin: '0 auto' }}\n variant=\"circular\"\n width={contentDimensions.width > contentDimensions.height ? contentDimensions.height : contentDimensions.width}\n height={contentDimensions.height}\n />\n );\n}\n"],"names":["Box","Skeleton","Stack","GaugeChart","useChartsTheme","CalculationsMap","DEFAULT_CALCULATION","merge","useMemo","DEFAULT_FORMAT","DEFAULT_MAX_PERCENT","DEFAULT_MAX_PERCENT_DECIMAL","convertThresholds","defaultThresholdInput","EMPTY_GAUGE_SERIES","label","value","undefined","GAUGE_MIN_WIDTH","PANEL_PADDING_OFFSET","GaugeChartPanel","props","spec","pluginSpec","contentDimensions","queryResults","calculation","max","thresholds","thresholdsColors","format","gaugeData","data","console","warn","calculate","seriesData","timeSeries","series","values","formattedName","push","thresholdMax","unit","axisLineColors","axisLine","show","lineStyle","width","color","length","height","chartWidth","hasMultipleCharts","direction","spacing","justifyContent","alignItems","sx","overflowX","map","seriesIndex","GaugeChartLoading","margin","variant"],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=bootstrap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/bootstrap.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ // Copyright 2024 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 React from 'react';
15
+ import ReactDOM from 'react-dom/client';
16
+ const root = ReactDOM.createRoot(document.getElementById('root'));
17
+ root.render(/*#__PURE__*/ _jsx(React.StrictMode, {}));
18
+
19
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/bootstrap.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 React from 'react';\nimport ReactDOM from 'react-dom/client';\n\nconst root = ReactDOM.createRoot(document.getElementById('root')!);\nroot.render(<React.StrictMode></React.StrictMode>);\n"],"names":["React","ReactDOM","root","createRoot","document","getElementById","render","StrictMode"],"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,OAAOA,WAAW,QAAQ;AAC1B,OAAOC,cAAc,mBAAmB;AAExC,MAAMC,OAAOD,SAASE,UAAU,CAACC,SAASC,cAAc,CAAC;AACzDH,KAAKI,MAAM,eAAC,KAACN,MAAMO,UAAU"}
@@ -0,0 +1,39 @@
1
+ // Copyright 2023 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, "GaugeChart", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return GaugeChart;
21
+ }
22
+ });
23
+ const _gaugechartmodel = require("./gauge-chart-model");
24
+ const _GaugeChartOptionsEditorSettings = require("./GaugeChartOptionsEditorSettings");
25
+ const _GaugeChartPanel = require("./GaugeChartPanel");
26
+ const GaugeChart = {
27
+ PanelComponent: _GaugeChartPanel.GaugeChartPanel,
28
+ LoadingComponent: _GaugeChartPanel.GaugeChartLoading,
29
+ supportedQueryTypes: [
30
+ 'TimeSeriesQuery'
31
+ ],
32
+ panelOptionsEditorComponents: [
33
+ {
34
+ label: 'Settings',
35
+ content: _GaugeChartOptionsEditorSettings.GaugeChartOptionsEditorSettings
36
+ }
37
+ ],
38
+ createInitialOptions: _gaugechartmodel.createInitialGaugeChartOptions
39
+ };
@@ -0,0 +1,101 @@
1
+ // Copyright 2023 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, "GaugeChartOptionsEditorSettings", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return GaugeChartOptionsEditorSettings;
21
+ }
22
+ });
23
+ const _jsxruntime = require("react/jsx-runtime");
24
+ const _material = require("@mui/material");
25
+ const _components = require("@perses-dev/components");
26
+ const _pluginsystem = require("@perses-dev/plugin-system");
27
+ const _immer = require("immer");
28
+ const _merge = /*#__PURE__*/ _interop_require_default(require("lodash/merge"));
29
+ const _gaugechartmodel = require("./gauge-chart-model");
30
+ function _interop_require_default(obj) {
31
+ return obj && obj.__esModule ? obj : {
32
+ default: obj
33
+ };
34
+ }
35
+ function GaugeChartOptionsEditorSettings(props) {
36
+ const { onChange, value } = props;
37
+ const handleCalculationChange = (newCalculation)=>{
38
+ onChange((0, _immer.produce)(value, (draft)=>{
39
+ draft.calculation = newCalculation;
40
+ }));
41
+ };
42
+ const handleUnitChange = (newFormat)=>{
43
+ onChange((0, _immer.produce)(value, (draft)=>{
44
+ draft.format = newFormat;
45
+ }));
46
+ };
47
+ // ensures decimalPlaces defaults to correct value
48
+ const format = (0, _merge.default)({}, _gaugechartmodel.DEFAULT_FORMAT, value.format);
49
+ // max only needs to be set explicitly for units other than percent and percent-decimal
50
+ let maxPlaceholder = 'Enter value';
51
+ if (format.unit === 'percent') {
52
+ maxPlaceholder = _gaugechartmodel.DEFAULT_MAX_PERCENT.toString();
53
+ } else if (format.unit === 'percent-decimal') {
54
+ maxPlaceholder = _gaugechartmodel.DEFAULT_MAX_PERCENT_DECIMAL.toString();
55
+ }
56
+ const handleThresholdsChange = (thresholds)=>{
57
+ onChange((0, _immer.produce)(value, (draft)=>{
58
+ draft.thresholds = thresholds;
59
+ }));
60
+ };
61
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_components.OptionsEditorGrid, {
62
+ children: [
63
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorColumn, {
64
+ children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_components.OptionsEditorGroup, {
65
+ title: "Misc",
66
+ children: [
67
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.FormatControls, {
68
+ value: format,
69
+ onChange: handleUnitChange
70
+ }),
71
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.CalculationSelector, {
72
+ value: value.calculation,
73
+ onChange: handleCalculationChange
74
+ }),
75
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
76
+ label: "Max",
77
+ control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
78
+ type: "number",
79
+ value: value.max ?? '',
80
+ onChange: (e)=>{
81
+ // ensure empty value resets to undef to allow chart to calculate max
82
+ const newValue = e.target.value ? Number(e.target.value) : undefined;
83
+ onChange((0, _immer.produce)(value, (draft)=>{
84
+ draft.max = newValue;
85
+ }));
86
+ },
87
+ placeholder: maxPlaceholder
88
+ })
89
+ })
90
+ ]
91
+ })
92
+ }),
93
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorColumn, {
94
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ThresholdsEditor, {
95
+ thresholds: value.thresholds,
96
+ onChange: handleThresholdsChange
97
+ })
98
+ })
99
+ ]
100
+ });
101
+ }
@@ -0,0 +1,147 @@
1
+ // Copyright 2023 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: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ GaugeChartLoading: function() {
25
+ return GaugeChartLoading;
26
+ },
27
+ GaugeChartPanel: function() {
28
+ return GaugeChartPanel;
29
+ }
30
+ });
31
+ const _jsxruntime = require("react/jsx-runtime");
32
+ const _material = require("@mui/material");
33
+ const _components = require("@perses-dev/components");
34
+ const _core = require("@perses-dev/core");
35
+ const _merge = /*#__PURE__*/ _interop_require_default(require("lodash/merge"));
36
+ const _react = require("react");
37
+ const _gaugechartmodel = require("./gauge-chart-model");
38
+ const _thresholds = require("./thresholds");
39
+ function _interop_require_default(obj) {
40
+ return obj && obj.__esModule ? obj : {
41
+ default: obj
42
+ };
43
+ }
44
+ const EMPTY_GAUGE_SERIES = {
45
+ label: '',
46
+ value: undefined
47
+ };
48
+ const GAUGE_MIN_WIDTH = 90;
49
+ const PANEL_PADDING_OFFSET = 20;
50
+ function GaugeChartPanel(props) {
51
+ const { spec: pluginSpec, contentDimensions, queryResults } = props;
52
+ const { calculation, max } = pluginSpec;
53
+ const { thresholds: thresholdsColors } = (0, _components.useChartsTheme)();
54
+ // ensures all default format properties set if undef
55
+ const format = (0, _merge.default)({}, _gaugechartmodel.DEFAULT_FORMAT, pluginSpec.format);
56
+ const thresholds = pluginSpec.thresholds ?? _thresholds.defaultThresholdInput;
57
+ const gaugeData = (0, _react.useMemo)(()=>{
58
+ if (queryResults[0]?.data === undefined) {
59
+ return [];
60
+ }
61
+ if (_core.CalculationsMap[calculation] === undefined) {
62
+ console.warn(`Invalid GaugeChart panel calculation ${calculation}, fallback to ${_core.DEFAULT_CALCULATION}`);
63
+ }
64
+ const calculate = _core.CalculationsMap[calculation] ?? _core.CalculationsMap[_core.DEFAULT_CALCULATION];
65
+ const seriesData = [];
66
+ for (const timeSeries of queryResults[0].data.series){
67
+ const series = {
68
+ value: calculate(timeSeries.values),
69
+ label: timeSeries.formattedName ?? ''
70
+ };
71
+ seriesData.push(series);
72
+ }
73
+ return seriesData;
74
+ }, [
75
+ queryResults,
76
+ calculation
77
+ ]);
78
+ if (contentDimensions === undefined) return null;
79
+ // needed for end value of last threshold color segment
80
+ let thresholdMax = max;
81
+ if (thresholdMax === undefined) {
82
+ if (format.unit === 'percent') {
83
+ thresholdMax = _gaugechartmodel.DEFAULT_MAX_PERCENT;
84
+ } else {
85
+ thresholdMax = _gaugechartmodel.DEFAULT_MAX_PERCENT_DECIMAL;
86
+ }
87
+ }
88
+ const axisLineColors = (0, _thresholds.convertThresholds)(thresholds, format, thresholdMax, thresholdsColors);
89
+ const axisLine = {
90
+ show: true,
91
+ lineStyle: {
92
+ width: 5,
93
+ color: axisLineColors
94
+ }
95
+ };
96
+ // no data message handled inside chart component
97
+ if (gaugeData.length === 0) {
98
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.GaugeChart, {
99
+ width: contentDimensions.width,
100
+ height: contentDimensions.height,
101
+ data: EMPTY_GAUGE_SERIES,
102
+ format: format,
103
+ axisLine: axisLine,
104
+ max: thresholdMax
105
+ });
106
+ }
107
+ // accounts for showing a separate chart for each time series
108
+ let chartWidth = contentDimensions.width / gaugeData.length - PANEL_PADDING_OFFSET;
109
+ if (chartWidth < GAUGE_MIN_WIDTH && gaugeData.length > 1) {
110
+ // enables horizontal scroll when charts overflow outside of panel
111
+ chartWidth = GAUGE_MIN_WIDTH;
112
+ }
113
+ const hasMultipleCharts = gaugeData.length > 1;
114
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
115
+ direction: "row",
116
+ spacing: hasMultipleCharts ? 2 : 0,
117
+ justifyContent: hasMultipleCharts ? 'left' : 'center',
118
+ alignItems: "center",
119
+ sx: {
120
+ // so scrollbar only shows when necessary
121
+ overflowX: gaugeData.length > 1 ? 'scroll' : 'auto'
122
+ },
123
+ children: gaugeData.map((series, seriesIndex)=>{
124
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
125
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.GaugeChart, {
126
+ width: chartWidth,
127
+ height: contentDimensions.height,
128
+ data: series,
129
+ format: format,
130
+ axisLine: axisLine,
131
+ max: thresholdMax
132
+ })
133
+ }, `gauge-series-${seriesIndex}`);
134
+ })
135
+ });
136
+ }
137
+ function GaugeChartLoading({ contentDimensions }) {
138
+ if (contentDimensions === undefined) return null;
139
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Skeleton, {
140
+ sx: {
141
+ margin: '0 auto'
142
+ },
143
+ variant: "circular",
144
+ width: contentDimensions.width > contentDimensions.height ? contentDimensions.height : contentDimensions.width,
145
+ height: contentDimensions.height
146
+ });
147
+ }
@@ -0,0 +1,26 @@
1
+ // Copyright 2024 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
+ const _jsxruntime = require("react/jsx-runtime");
18
+ const _react = /*#__PURE__*/ _interop_require_default(require("react"));
19
+ const _client = /*#__PURE__*/ _interop_require_default(require("react-dom/client"));
20
+ function _interop_require_default(obj) {
21
+ return obj && obj.__esModule ? obj : {
22
+ default: obj
23
+ };
24
+ }
25
+ const root = _client.default.createRoot(document.getElementById('root'));
26
+ root.render(/*#__PURE__*/ (0, _jsxruntime.jsx)(_react.default.StrictMode, {}));
@@ -0,0 +1,14 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ /// <reference types="@rsbuild/core/types" />
14
+ "use strict";
@@ -0,0 +1,57 @@
1
+ // Copyright 2023 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: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ DEFAULT_FORMAT: function() {
25
+ return DEFAULT_FORMAT;
26
+ },
27
+ DEFAULT_MAX_PERCENT: function() {
28
+ return DEFAULT_MAX_PERCENT;
29
+ },
30
+ DEFAULT_MAX_PERCENT_DECIMAL: function() {
31
+ return DEFAULT_MAX_PERCENT_DECIMAL;
32
+ },
33
+ createInitialGaugeChartOptions: function() {
34
+ return createInitialGaugeChartOptions;
35
+ }
36
+ });
37
+ const DEFAULT_FORMAT = {
38
+ unit: 'percent-decimal'
39
+ };
40
+ const DEFAULT_MAX_PERCENT = 100;
41
+ const DEFAULT_MAX_PERCENT_DECIMAL = 1;
42
+ function createInitialGaugeChartOptions() {
43
+ return {
44
+ calculation: 'last-number',
45
+ format: DEFAULT_FORMAT,
46
+ thresholds: {
47
+ steps: [
48
+ {
49
+ value: 0.8
50
+ },
51
+ {
52
+ value: 0.9
53
+ }
54
+ ]
55
+ }
56
+ };
57
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "getPluginModule", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return getPluginModule;
9
+ }
10
+ });
11
+ const _packagejson = /*#__PURE__*/ _interop_require_default(require("../package.json"));
12
+ function _interop_require_default(obj) {
13
+ return obj && obj.__esModule ? obj : {
14
+ default: obj
15
+ };
16
+ }
17
+ function getPluginModule() {
18
+ const { name, version, perses } = _packagejson.default;
19
+ return {
20
+ kind: 'PluginModule',
21
+ metadata: {
22
+ name,
23
+ version
24
+ },
25
+ spec: perses
26
+ };
27
+ }
@@ -0,0 +1,55 @@
1
+ // Copyright 2024 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
+ function _getRequireWildcardCache(nodeInterop) {
15
+ if (typeof WeakMap !== "function") return null;
16
+ var cacheBabelInterop = new WeakMap();
17
+ var cacheNodeInterop = new WeakMap();
18
+ return (_getRequireWildcardCache = function(nodeInterop) {
19
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
20
+ })(nodeInterop);
21
+ }
22
+ function _interop_require_wildcard(obj, nodeInterop) {
23
+ if (!nodeInterop && obj && obj.__esModule) {
24
+ return obj;
25
+ }
26
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
27
+ return {
28
+ default: obj
29
+ };
30
+ }
31
+ var cache = _getRequireWildcardCache(nodeInterop);
32
+ if (cache && cache.has(obj)) {
33
+ return cache.get(obj);
34
+ }
35
+ var newObj = {
36
+ __proto__: null
37
+ };
38
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
39
+ for(var key in obj){
40
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
41
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
42
+ if (desc && (desc.get || desc.set)) {
43
+ Object.defineProperty(newObj, key, desc);
44
+ } else {
45
+ newObj[key] = obj[key];
46
+ }
47
+ }
48
+ }
49
+ newObj.default = obj;
50
+ if (cache) {
51
+ cache.set(obj, newObj);
52
+ }
53
+ return newObj;
54
+ }
55
+ Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("./bootstrap")));