@perses-dev/heatmap-chart-plugin 0.4.0-beta.0 → 0.4.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mf/js/{HeatMapChart.0ae7910f.js → HeatMapChart.3d6939cb.js} +3 -3
- package/__mf/js/async/12.6b37fcc7.js +2 -0
- package/__mf/js/async/983.84770ead.js +71 -0
- package/__mf/js/async/{__federation_expose_HeatMapChart.b5bb953a.js → __federation_expose_HeatMapChart.158cef2e.js} +1 -1
- package/__mf/js/{main.f5fc42b4.js → main.b7008596.js} +3 -3
- package/lib/HeatMapChart.js +1 -1
- package/lib/HeatMapChart.js.map +1 -1
- package/lib/bootstrap.js +1 -1
- package/lib/bootstrap.js.map +1 -1
- package/lib/cjs/HeatMapChart.js +1 -1
- package/lib/cjs/bootstrap.js +1 -1
- package/lib/cjs/components/HeatMapChart.js +1 -1
- package/lib/cjs/components/HeatMapChartOptionsEditorSettings.js +1 -1
- package/lib/cjs/components/HeatMapChartPanel.js +1 -1
- package/lib/cjs/components/HeatMapTooltip.js +1 -1
- package/lib/cjs/components/index.js +1 -1
- package/lib/cjs/env.d.js +1 -1
- package/lib/cjs/getPluginModule.js +12 -0
- package/lib/cjs/heat-map-chart-model.js +1 -1
- package/lib/cjs/index-federation.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/setup-tests.js +1 -1
- package/lib/cjs/utils/data-transform.js +12 -0
- package/lib/cjs/utils/get-formatted-axis-label.js +1 -1
- package/lib/cjs/utils/index.js +1 -1
- package/lib/cjs/utils/thresholds.js +12 -0
- package/lib/components/HeatMapChart.js +1 -1
- package/lib/components/HeatMapChart.js.map +1 -1
- package/lib/components/HeatMapChartOptionsEditorSettings.js +1 -1
- package/lib/components/HeatMapChartOptionsEditorSettings.js.map +1 -1
- package/lib/components/HeatMapChartPanel.js +1 -1
- package/lib/components/HeatMapChartPanel.js.map +1 -1
- package/lib/components/HeatMapTooltip.js +1 -1
- package/lib/components/HeatMapTooltip.js.map +1 -1
- package/lib/components/index.js +1 -1
- package/lib/components/index.js.map +1 -1
- package/lib/env.d.js +1 -1
- package/lib/env.d.js.map +1 -1
- package/lib/getPluginModule.d.ts.map +1 -1
- package/lib/getPluginModule.js +12 -0
- package/lib/getPluginModule.js.map +1 -1
- package/lib/heat-map-chart-model.js +1 -1
- package/lib/heat-map-chart-model.js.map +1 -1
- package/lib/index-federation.js +1 -1
- package/lib/index-federation.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/setup-tests.js +1 -1
- package/lib/setup-tests.js.map +1 -1
- package/lib/utils/data-transform.d.ts.map +1 -1
- package/lib/utils/data-transform.js +12 -0
- package/lib/utils/data-transform.js.map +1 -1
- package/lib/utils/get-formatted-axis-label.js +1 -1
- package/lib/utils/get-formatted-axis-label.js.map +1 -1
- package/lib/utils/index.js +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/thresholds.d.ts.map +1 -1
- package/lib/utils/thresholds.js +12 -0
- package/lib/utils/thresholds.js.map +1 -1
- package/mf-manifest.json +9 -9
- package/mf-stats.json +9 -9
- package/package.json +4 -4
- package/__mf/js/async/12.4a0642db.js +0 -2
- package/__mf/js/async/277.278c6205.js +0 -71
- /package/__mf/js/async/{12.4a0642db.js.LICENSE.txt → 12.6b37fcc7.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{277.278c6205.js.LICENSE.txt → 983.84770ead.js.LICENSE.txt} +0 -0
package/lib/cjs/utils/index.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the \"License\");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an \"AS IS\" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
1
13
|
"use strict";
|
|
2
14
|
Object.defineProperty(exports, "__esModule", {
|
|
3
15
|
value: true
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright The Perses Authors
|
|
3
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
// you may not use this file except in compliance with the License.
|
|
5
5
|
// You may obtain a copy of the License at
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/HeatMapChart.tsx"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/HeatMapChart.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, useMemo } from 'react';\nimport { FormatOptions, TimeScale } from '@perses-dev/core';\nimport { EChart, getFormattedAxis, useChartsTheme, useTimeZone } from '@perses-dev/components';\nimport { use, EChartsCoreOption } from 'echarts/core';\nimport { HeatmapChart as EChartsHeatmapChart } from 'echarts/charts';\nimport { useTheme } from '@mui/material';\nimport { getFormattedHeatmapAxisLabel } from '../utils';\nimport { generateTooltipHTML } from './HeatMapTooltip';\n\nuse([EChartsHeatmapChart]);\n\n// The default coloring is a blue->yellow->red gradient\nconst DEFAULT_VISUAL_MAP_COLORS = [\n '#313695',\n '#4575b4',\n '#74add1',\n '#abd9e9',\n '#e0f3f8',\n '#ffffbf',\n '#fee090',\n '#fdae61',\n '#f46d43',\n '#d73027',\n '#a50026',\n];\n\nexport type HeatMapData = [number, number, number | undefined]; // [x, y, value]\n\nexport interface HeatMapDataItem {\n value: HeatMapData;\n label: string;\n itemStyle?: {\n color?: string;\n borderColor?: string;\n borderWidth?: number;\n };\n}\n\nexport interface HeatMapChartProps {\n width: number;\n height: number;\n data: HeatMapDataItem[];\n xAxisCategories: number[];\n yAxisCategories: string[];\n yAxisFormat?: FormatOptions;\n countFormat?: FormatOptions;\n countMin?: number;\n countMax?: number;\n timeScale?: TimeScale;\n showVisualMap?: boolean;\n // TODO: exponential?: boolean;\n}\n\nexport function HeatMapChart({\n width,\n height,\n data,\n xAxisCategories,\n yAxisCategories,\n yAxisFormat,\n countFormat,\n countMin,\n countMax,\n timeScale,\n showVisualMap,\n}: HeatMapChartProps): ReactElement | null {\n const chartsTheme = useChartsTheme();\n const theme = useTheme();\n const { timeZone } = useTimeZone();\n\n const option: EChartsCoreOption = useMemo(() => {\n return {\n tooltip: {\n appendToBody: true,\n formatter: (params: { data: HeatMapDataItem; marker: string }) => {\n return generateTooltipHTML({\n data: params.data.value,\n label: params.data.label,\n marker: params.marker,\n xAxisCategories,\n yAxisCategories,\n theme,\n yAxisFormat: yAxisFormat,\n countFormat: countFormat,\n });\n },\n },\n xAxis: {\n type: 'category',\n data: xAxisCategories,\n axisLabel: {\n hideOverlap: true,\n formatter: getFormattedHeatmapAxisLabel(timeScale?.rangeMs ?? 0, timeZone),\n },\n },\n yAxis: getFormattedAxis(\n {\n type: 'category',\n data: yAxisCategories,\n },\n yAxisFormat\n ),\n visualMap: {\n show: showVisualMap ?? false,\n type: 'continuous',\n min: countMin,\n max: countMax,\n realtime: false,\n itemHeight: height - 30,\n itemWidth: 10,\n orient: 'vertical',\n left: 'right',\n top: 'center',\n inRange: {\n color: DEFAULT_VISUAL_MAP_COLORS,\n },\n textStyle: {\n color: theme.palette.text.primary,\n textBorderColor: theme.palette.background.default,\n textBorderWidth: 5,\n },\n },\n series: [\n {\n name: 'Gaussian',\n type: 'heatmap',\n data: data,\n emphasis: {\n itemStyle: {\n borderColor: '#333',\n borderWidth: 1,\n },\n },\n progressive: 1000,\n animation: false,\n },\n ],\n };\n }, [\n xAxisCategories,\n timeScale?.rangeMs,\n timeZone,\n yAxisCategories,\n yAxisFormat,\n showVisualMap,\n countMin,\n countMax,\n height,\n theme,\n data,\n countFormat,\n ]);\n\n const chart = useMemo(\n () => (\n <EChart\n style={{\n width: width,\n height: height,\n }}\n sx={{\n padding: `${chartsTheme.container.padding.default}px`,\n }}\n option={option}\n theme={chartsTheme.echartsTheme}\n />\n ),\n [chartsTheme.container.padding.default, chartsTheme.echartsTheme, height, option, width]\n );\n\n return <>{chart}</>;\n}\n"],"names":["useMemo","EChart","getFormattedAxis","useChartsTheme","useTimeZone","use","HeatmapChart","EChartsHeatmapChart","useTheme","getFormattedHeatmapAxisLabel","generateTooltipHTML","DEFAULT_VISUAL_MAP_COLORS","HeatMapChart","width","height","data","xAxisCategories","yAxisCategories","yAxisFormat","countFormat","countMin","countMax","timeScale","showVisualMap","chartsTheme","theme","timeZone","option","tooltip","appendToBody","formatter","params","value","label","marker","xAxis","type","axisLabel","hideOverlap","rangeMs","yAxis","visualMap","show","min","max","realtime","itemHeight","itemWidth","orient","left","top","inRange","color","textStyle","palette","text","primary","textBorderColor","background","default","textBorderWidth","series","name","emphasis","itemStyle","borderColor","borderWidth","progressive","animation","chart","style","sx","padding","container","echartsTheme"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAAuBA,OAAO,QAAQ,QAAQ;AAE9C,SAASC,MAAM,EAAEC,gBAAgB,EAAE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AAQ;gBACRC,MAAM;gBACNC,KAAK;gBACLC,SAAS;oBACPC,OAAOzC;gBACT;gBACA0C,WAAW;oBACTD,OAAO3B,MAAM6B,OAAO,CAACC,IAAI,CAACC,OAAO;oBACjCC,iBAAiBhC,MAAM6B,OAAO,CAACI,UAAU,CAACC,OAAO;oBACjDC,iBAAiB;gBACnB;YACF;YACAC,QAAQ;gBACN;oBACEC,MAAM;oBACN1B,MAAM;oBACNrB,MAAMA;oBACNgD,UAAU;wBACRC,WAAW;4BACTC,aAAa;4BACbC,aAAa;wBACf;oBACF;oBACAC,aAAa;oBACbC,WAAW;gBACb;aACD;QACH;IACF,GAAG;QACDpD;QACAM,WAAWiB;QACXb;QACAT;QACAC;QACAK;QACAH;QACAC;QACAP;QACAW;QACAV;QACAI;KACD;IAED,MAAMkD,QAAQrE,QACZ,kBACE,KAACC;YACCqE,OAAO;gBACLzD,OAAOA;gBACPC,QAAQA;YACV;YACAyD,IAAI;gBACFC,SAAS,GAAGhD,YAAYiD,SAAS,CAACD,OAAO,CAACb,OAAO,CAAC,EAAE,CAAC;YACvD;YACAhC,QAAQA;YACRF,OAAOD,YAAYkD,YAAY;YAGnC;QAAClD,YAAYiD,SAAS,CAACD,OAAO,CAACb,OAAO;QAAEnC,YAAYkD,YAAY;QAAE5D;QAAQa;QAAQd;KAAM;IAG1F,qBAAO;kBAAGwD;;AACZ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright The Perses Authors
|
|
3
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
// you may not use this file except in compliance with the License.
|
|
5
5
|
// You may obtain a copy of the License at
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/HeatMapChartOptionsEditorSettings.tsx"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/HeatMapChartOptionsEditorSettings.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Switch, SwitchProps } from '@mui/material';\nimport {\n FormatControls,\n FormatControlsProps,\n OptionsEditorColumn,\n OptionsEditorControl,\n OptionsEditorGrid,\n OptionsEditorGroup,\n} from '@perses-dev/components';\nimport { produce } from 'immer';\nimport merge from 'lodash/merge';\nimport { ReactElement } from 'react';\nimport { DEFAULT_FORMAT, HeatMapChartOptions, HeatMapChartOptionsEditorProps } from '../heat-map-chart-model';\n\nexport function HeatMapChartOptionsEditorSettings(props: HeatMapChartOptionsEditorProps): ReactElement {\n const { onChange, value } = props;\n\n const handleYAxisFormatChange: FormatControlsProps['onChange'] = (newFormat) => {\n onChange(\n produce(value, (draft: HeatMapChartOptions) => {\n draft.yAxisFormat = newFormat;\n })\n );\n };\n\n const handleCountFormatChange: FormatControlsProps['onChange'] = (newFormat) => {\n onChange(\n produce(value, (draft: HeatMapChartOptions) => {\n draft.countFormat = newFormat;\n })\n );\n };\n\n const handleShowVisualMapChange: SwitchProps['onChange'] = (_: unknown, checked: boolean) => {\n onChange(\n produce(value, (draft: HeatMapChartOptions) => {\n draft.showVisualMap = checked;\n })\n );\n };\n\n // ensures decimalPlaces defaults to correct value\n const yAxisFormat = merge({}, DEFAULT_FORMAT, value.yAxisFormat);\n const countFormat = merge({}, DEFAULT_FORMAT, value.countFormat);\n\n return (\n <OptionsEditorGrid>\n <OptionsEditorColumn>\n <OptionsEditorGroup title=\"Bucket Count\">\n <FormatControls value={countFormat} onChange={handleCountFormatChange} />\n <OptionsEditorControl\n label=\"Show Visual Map\"\n control={<Switch checked={!!value.showVisualMap} onChange={handleShowVisualMapChange} />}\n />\n </OptionsEditorGroup>\n </OptionsEditorColumn>\n <OptionsEditorColumn>\n <OptionsEditorGroup title=\"Y Axis\">\n <FormatControls value={yAxisFormat} onChange={handleYAxisFormatChange} />\n </OptionsEditorGroup>\n </OptionsEditorColumn>\n </OptionsEditorGrid>\n );\n}\n"],"names":["Switch","FormatControls","OptionsEditorColumn","OptionsEditorControl","OptionsEditorGrid","OptionsEditorGroup","produce","merge","DEFAULT_FORMAT","HeatMapChartOptionsEditorSettings","props","onChange","value","handleYAxisFormatChange","newFormat","draft","yAxisFormat","handleCountFormatChange","countFormat","handleShowVisualMapChange","_","checked","showVisualMap","title","label","control"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,MAAM,QAAqB,gBAAgB;AACpD,SACEC,cAAc,EAEdC,mBAAmB,EACnBC,oBAAoB,EACpBC,iBAAiB,EACjBC,kBAAkB,QACb,yBAAyB;AAChC,SAASC,OAAO,QAAQ,QAAQ;AAChC,OAAOC,WAAW,eAAe;AAEjC,SAASC,cAAc,QAA6D,0BAA0B;AAE9G,OAAO,SAASC,kCAAkCC,KAAqC;IACrF,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGF;IAE5B,MAAMG,0BAA2D,CAACC;QAChEH,SACEL,QAAQM,OAAO,CAACG;YACdA,MAAMC,WAAW,GAAGF;QACtB;IAEJ;IAEA,MAAMG,0BAA2D,CAACH;QAChEH,SACEL,QAAQM,OAAO,CAACG;YACdA,MAAMG,WAAW,GAAGJ;QACtB;IAEJ;IAEA,MAAMK,4BAAqD,CAACC,GAAYC;QACtEV,SACEL,QAAQM,OAAO,CAACG;YACdA,MAAMO,aAAa,GAAGD;QACxB;IAEJ;IAEA,kDAAkD;IAClD,MAAML,cAAcT,MAAM,CAAC,GAAGC,gBAAgBI,MAAMI,WAAW;IAC/D,MAAME,cAAcX,MAAM,CAAC,GAAGC,gBAAgBI,MAAMM,WAAW;IAE/D,qBACE,MAACd;;0BACC,KAACF;0BACC,cAAA,MAACG;oBAAmBkB,OAAM;;sCACxB,KAACtB;4BAAeW,OAAOM;4BAAaP,UAAUM;;sCAC9C,KAACd;4BACCqB,OAAM;4BACNC,uBAAS,KAACzB;gCAAOqB,SAAS,CAAC,CAACT,MAAMU,aAAa;gCAAEX,UAAUQ;;;;;;0BAIjE,KAACjB;0BACC,cAAA,KAACG;oBAAmBkB,OAAM;8BACxB,cAAA,KAACtB;wBAAeW,OAAOI;wBAAaL,UAAUE;;;;;;AAKxD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright The Perses Authors
|
|
3
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
// you may not use this file except in compliance with the License.
|
|
5
5
|
// You may obtain a copy of the License at
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/HeatMapChartPanel.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 { Stack, Typography } from '@mui/material';\nimport { TimeScale, TimeSeries, TimeSeriesData } from '@perses-dev/core';\nimport { PanelProps } from '@perses-dev/plugin-system';\nimport merge from 'lodash/merge';\nimport { ReactElement, useMemo } from 'react';\nimport { DEFAULT_FORMAT, HeatMapChartOptions } from '../heat-map-chart-model';\nimport { generateCompleteTimestamps, getCommonTimeScaleForQueries } from '../utils';\nimport { HeatMapChart, HeatMapDataItem } from './HeatMapChart';\n\nconst HEATMAP_MIN_HEIGHT = 200;\nconst HEATMAP_ITEM_MIN_HEIGHT = 2;\n\nexport type HeatMapChartPanelProps = PanelProps<HeatMapChartOptions, TimeSeriesData>;\n\nexport function HeatMapChartPanel(props: HeatMapChartPanelProps): ReactElement | null {\n const { spec: pluginSpec, contentDimensions, queryResults } = props;\n\n // ensures all default format properties set if undef\n const yAxisFormat = merge({}, DEFAULT_FORMAT, pluginSpec.yAxisFormat);\n const countFormat = merge({}, DEFAULT_FORMAT, pluginSpec.countFormat);\n\n const {\n data,\n xAxisCategories,\n yAxisCategories,\n countMin,\n countMax,\n timeScale,\n }: {\n data: HeatMapDataItem[];\n xAxisCategories: number[];\n yAxisCategories: string[];\n countMin: number;\n countMax: number;\n timeScale?: TimeScale;\n } = useMemo(() => {\n if (!queryResults || queryResults.length === 0) {\n return {\n data: [],\n xAxisCategories: [],\n yAxisCategories: [],\n countMin: 0,\n countMax: 0,\n timeScale: undefined,\n };\n }\n\n if (\n queryResults.length != 1 ||\n queryResults[0]!.data.series.length != 1 ||\n queryResults[0]!.data.series[0]!.histograms === undefined\n ) {\n return {\n data: [],\n xAxisCategories: [],\n yAxisCategories: [],\n countMin: 0,\n countMax: 0,\n timeScale: undefined,\n };\n }\n\n const series: TimeSeries = queryResults[0]!.data.series[0]!;\n\n const timeScale = getCommonTimeScaleForQueries(queryResults);\n const xAxisCategories: number[] = generateCompleteTimestamps(timeScale);\n\n // Dummy value that will be replaced at the first iteration\n let lowestBound = Infinity;\n let highestBound = -Infinity;\n let countMin = Infinity;\n let countMax = -Infinity;\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n for (const [_, histogram] of series?.histograms ?? []) {\n for (const bucket of histogram?.buckets ?? []) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [_, lowerBound, upperBound, count] = bucket;\n const lowerBoundFloat = parseFloat(lowerBound);\n const upperBoundFloat = parseFloat(upperBound);\n const countFloat = parseFloat(count);\n if (lowerBoundFloat < lowestBound) {\n lowestBound = lowerBoundFloat;\n }\n if (upperBoundFloat > highestBound) {\n highestBound = upperBoundFloat;\n }\n if (countFloat < countMin) {\n countMin = countFloat;\n }\n if (countFloat > countMax) {\n countMax = countFloat;\n }\n }\n }\n\n const height = contentDimensions?.height ?? HEATMAP_MIN_HEIGHT;\n const totalRange = highestBound - lowestBound;\n const rangePerItem = (totalRange * HEATMAP_ITEM_MIN_HEIGHT) / height;\n const totalItems = Math.ceil(height / HEATMAP_ITEM_MIN_HEIGHT);\n\n // Generating value of the Y axis based on the height divided by the size of a cell (item)\n const yAxisCategories: string[] = Array.from({ length: totalItems }, (_, index) =>\n (lowestBound + index * rangePerItem).toFixed(3)\n );\n\n const data: HeatMapDataItem[] = [];\n // Logic for filling all cells where a bucket is present\n for (const [time, histogram] of series?.histograms ?? []) {\n const itemIndexOnXaxis = xAxisCategories.findIndex((v) => v === time * 1000);\n\n for (const bucket of histogram?.buckets ?? []) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [_, lowerBound, upperBound, count] = bucket;\n const yLowerBoundItem = Math.floor((parseFloat(lowerBound) - lowestBound) / rangePerItem);\n const yUpperBoundItem = Math.ceil((parseFloat(upperBound) - lowestBound) / rangePerItem);\n\n for (let i = 0; i < yUpperBoundItem - yLowerBoundItem; i++) {\n // TODO: some bucket may have overlapping cells, we could use avg value. Probably will need to move to a matrix data structure for performance reasons\n data.push({\n value: [itemIndexOnXaxis, yLowerBoundItem + i, parseFloat(count)],\n label: count,\n });\n }\n }\n }\n return {\n data,\n xAxisCategories,\n yAxisCategories,\n countMin,\n countMax,\n timeScale,\n };\n }, [contentDimensions?.height, queryResults]);\n\n // TODO: add support for multiple queries\n if (queryResults.length > 1) {\n return (\n <Stack justifyContent=\"center\" height=\"100%\">\n <Typography variant=\"body2\" textAlign=\"center\">\n Only one query at a time is supported for now\n </Typography>\n </Stack>\n );\n }\n\n // Mo data message handled inside chart component\n if (data.length === 0) {\n return (\n <Stack justifyContent=\"center\" height=\"100%\">\n <Typography variant=\"body2\" textAlign=\"center\">\n No data available (only native histograms are supported for now)\n </Typography>\n </Stack>\n );\n }\n\n if (contentDimensions === undefined) return null;\n\n return (\n <Stack direction=\"row\" justifyContent=\"center\" alignItems=\"center\">\n <HeatMapChart\n width={contentDimensions.width}\n height={contentDimensions.height}\n data={data}\n xAxisCategories={xAxisCategories}\n yAxisCategories={yAxisCategories}\n yAxisFormat={yAxisFormat}\n countFormat={countFormat}\n countMin={countMin}\n countMax={countMax}\n timeScale={timeScale}\n showVisualMap={pluginSpec.showVisualMap}\n />\n </Stack>\n );\n}\n"],"names":["Stack","Typography","merge","useMemo","DEFAULT_FORMAT","generateCompleteTimestamps","getCommonTimeScaleForQueries","HeatMapChart","HEATMAP_MIN_HEIGHT","HEATMAP_ITEM_MIN_HEIGHT","HeatMapChartPanel","props","spec","pluginSpec","contentDimensions","queryResults","yAxisFormat","countFormat","data","xAxisCategories","yAxisCategories","countMin","countMax","timeScale","length","undefined","series","histograms","lowestBound","Infinity","highestBound","_","histogram","bucket","buckets","lowerBound","upperBound","count","lowerBoundFloat","parseFloat","upperBoundFloat","countFloat","height","totalRange","rangePerItem","totalItems","Math","ceil","Array","from","index","toFixed","time","itemIndexOnXaxis","findIndex","v","yLowerBoundItem","floor","yUpperBoundItem","i","push","value","label","justifyContent","variant","textAlign","direction","alignItems","width","showVisualMap"],"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,SAASA,KAAK,EAAEC,UAAU,QAAQ,gBAAgB;AAGlD,OAAOC,WAAW,eAAe;AAC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ChartPanel.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Stack, Typography } from '@mui/material';\nimport { TimeScale, TimeSeries, TimeSeriesData } from '@perses-dev/core';\nimport { PanelProps } from '@perses-dev/plugin-system';\nimport merge from 'lodash/merge';\nimport { ReactElement, useMemo } from 'react';\nimport { DEFAULT_FORMAT, HeatMapChartOptions } from '../heat-map-chart-model';\nimport { generateCompleteTimestamps, getCommonTimeScaleForQueries } from '../utils';\nimport { HeatMapChart, HeatMapDataItem } from './HeatMapChart';\n\nconst HEATMAP_MIN_HEIGHT = 200;\nconst HEATMAP_ITEM_MIN_HEIGHT = 2;\n\nexport type HeatMapChartPanelProps = PanelProps<HeatMapChartOptions, TimeSeriesData>;\n\nexport function HeatMapChartPanel(props: HeatMapChartPanelProps): ReactElement | null {\n const { spec: pluginSpec, contentDimensions, queryResults } = props;\n\n // ensures all default format properties set if undef\n const yAxisFormat = merge({}, DEFAULT_FORMAT, pluginSpec.yAxisFormat);\n const countFormat = merge({}, DEFAULT_FORMAT, pluginSpec.countFormat);\n\n const {\n data,\n xAxisCategories,\n yAxisCategories,\n countMin,\n countMax,\n timeScale,\n }: {\n data: HeatMapDataItem[];\n xAxisCategories: number[];\n yAxisCategories: string[];\n countMin: number;\n countMax: number;\n timeScale?: TimeScale;\n } = useMemo(() => {\n if (!queryResults || queryResults.length === 0) {\n return {\n data: [],\n xAxisCategories: [],\n yAxisCategories: [],\n countMin: 0,\n countMax: 0,\n timeScale: undefined,\n };\n }\n\n if (\n queryResults.length != 1 ||\n queryResults[0]!.data.series.length != 1 ||\n queryResults[0]!.data.series[0]!.histograms === undefined\n ) {\n return {\n data: [],\n xAxisCategories: [],\n yAxisCategories: [],\n countMin: 0,\n countMax: 0,\n timeScale: undefined,\n };\n }\n\n const series: TimeSeries = queryResults[0]!.data.series[0]!;\n\n const timeScale = getCommonTimeScaleForQueries(queryResults);\n const xAxisCategories: number[] = generateCompleteTimestamps(timeScale);\n\n // Dummy value that will be replaced at the first iteration\n let lowestBound = Infinity;\n let highestBound = -Infinity;\n let countMin = Infinity;\n let countMax = -Infinity;\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n for (const [_, histogram] of series?.histograms ?? []) {\n for (const bucket of histogram?.buckets ?? []) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [_, lowerBound, upperBound, count] = bucket;\n const lowerBoundFloat = parseFloat(lowerBound);\n const upperBoundFloat = parseFloat(upperBound);\n const countFloat = parseFloat(count);\n if (lowerBoundFloat < lowestBound) {\n lowestBound = lowerBoundFloat;\n }\n if (upperBoundFloat > highestBound) {\n highestBound = upperBoundFloat;\n }\n if (countFloat < countMin) {\n countMin = countFloat;\n }\n if (countFloat > countMax) {\n countMax = countFloat;\n }\n }\n }\n\n const height = contentDimensions?.height ?? HEATMAP_MIN_HEIGHT;\n const totalRange = highestBound - lowestBound;\n const rangePerItem = (totalRange * HEATMAP_ITEM_MIN_HEIGHT) / height;\n const totalItems = Math.ceil(height / HEATMAP_ITEM_MIN_HEIGHT);\n\n // Generating value of the Y axis based on the height divided by the size of a cell (item)\n const yAxisCategories: string[] = Array.from({ length: totalItems }, (_, index) =>\n (lowestBound + index * rangePerItem).toFixed(3)\n );\n\n const data: HeatMapDataItem[] = [];\n // Logic for filling all cells where a bucket is present\n for (const [time, histogram] of series?.histograms ?? []) {\n const itemIndexOnXaxis = xAxisCategories.findIndex((v) => v === time * 1000);\n\n for (const bucket of histogram?.buckets ?? []) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [_, lowerBound, upperBound, count] = bucket;\n const yLowerBoundItem = Math.floor((parseFloat(lowerBound) - lowestBound) / rangePerItem);\n const yUpperBoundItem = Math.ceil((parseFloat(upperBound) - lowestBound) / rangePerItem);\n\n for (let i = 0; i < yUpperBoundItem - yLowerBoundItem; i++) {\n // TODO: some bucket may have overlapping cells, we could use avg value. Probably will need to move to a matrix data structure for performance reasons\n data.push({\n value: [itemIndexOnXaxis, yLowerBoundItem + i, parseFloat(count)],\n label: count,\n });\n }\n }\n }\n return {\n data,\n xAxisCategories,\n yAxisCategories,\n countMin,\n countMax,\n timeScale,\n };\n }, [contentDimensions?.height, queryResults]);\n\n // TODO: add support for multiple queries\n if (queryResults.length > 1) {\n return (\n <Stack justifyContent=\"center\" height=\"100%\">\n <Typography variant=\"body2\" textAlign=\"center\">\n Only one query at a time is supported for now\n </Typography>\n </Stack>\n );\n }\n\n // Mo data message handled inside chart component\n if (data.length === 0) {\n return (\n <Stack justifyContent=\"center\" height=\"100%\">\n <Typography variant=\"body2\" textAlign=\"center\">\n No data available (only native histograms are supported for now)\n </Typography>\n </Stack>\n );\n }\n\n if (contentDimensions === undefined) return null;\n\n return (\n <Stack direction=\"row\" justifyContent=\"center\" alignItems=\"center\">\n <HeatMapChart\n width={contentDimensions.width}\n height={contentDimensions.height}\n data={data}\n xAxisCategories={xAxisCategories}\n yAxisCategories={yAxisCategories}\n yAxisFormat={yAxisFormat}\n countFormat={countFormat}\n countMin={countMin}\n countMax={countMax}\n timeScale={timeScale}\n showVisualMap={pluginSpec.showVisualMap}\n />\n </Stack>\n );\n}\n"],"names":["Stack","Typography","merge","useMemo","DEFAULT_FORMAT","generateCompleteTimestamps","getCommonTimeScaleForQueries","HeatMapChart","HEATMAP_MIN_HEIGHT","HEATMAP_ITEM_MIN_HEIGHT","HeatMapChartPanel","props","spec","pluginSpec","contentDimensions","queryResults","yAxisFormat","countFormat","data","xAxisCategories","yAxisCategories","countMin","countMax","timeScale","length","undefined","series","histograms","lowestBound","Infinity","highestBound","_","histogram","bucket","buckets","lowerBound","upperBound","count","lowerBoundFloat","parseFloat","upperBoundFloat","countFloat","height","totalRange","rangePerItem","totalItems","Math","ceil","Array","from","index","toFixed","time","itemIndexOnXaxis","findIndex","v","yLowerBoundItem","floor","yUpperBoundItem","i","push","value","label","justifyContent","variant","textAlign","direction","alignItems","width","showVisualMap"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,KAAK,EAAEC,UAAU,QAAQ,gBAAgB;AAGlD,OAAOC,WAAW,eAAe;AACjC,SAAuBC,OAAO,QAAQ,QAAQ;AAC9C,SAASC,cAAc,QAA6B,0BAA0B;AAC9E,SAASC,0BAA0B,EAAEC,4BAA4B,QAAQ,WAAW;AACpF,SAASC,YAAY,QAAyB,iBAAiB;AAE/D,MAAMC,qBAAqB;AAC3B,MAAMC,0BAA0B;AAIhC,OAAO,SAASC,kBAAkBC,KAA6B;IAC7D,MAAM,EAAEC,MAAMC,UAAU,EAAEC,iBAAiB,EAAEC,YAAY,EAAE,GAAGJ;IAE9D,qDAAqD;IACrD,MAAMK,cAAcd,MAAM,CAAC,GAAGE,gBAAgBS,WAAWG,WAAW;IACpE,MAAMC,cAAcf,MAAM,CAAC,GAAGE,gBAAgBS,WAAWI,WAAW;IAEpE,MAAM,EACJC,IAAI,EACJC,eAAe,EACfC,eAAe,EACfC,QAAQ,EACRC,QAAQ,EACRC,SAAS,EACV,GAOGpB,QAAQ;QACV,IAAI,CAACY,gBAAgBA,aAAaS,MAAM,KAAK,GAAG;YAC9C,OAAO;gBACLN,MAAM,EAAE;gBACRC,iBAAiB,EAAE;gBACnBC,iBAAiB,EAAE;gBACnBC,UAAU;gBACVC,UAAU;gBACVC,WAAWE;YACb;QACF;QAEA,IACEV,aAAaS,MAAM,IAAI,KACvBT,YAAY,C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,cAAA,KAACzC;gBAAW+D,SAAQ;gBAAQC,WAAU;0BAAS;;;IAKrD;IAEA,IAAInD,sBAAsBW,WAAW,OAAO;IAE5C,qBACE,KAACzB;QAAMkE,WAAU;QAAMH,gBAAe;QAASI,YAAW;kBACxD,cAAA,KAAC5D;YACC6D,OAAOtD,kBAAkBsD,KAAK;YAC9B1B,QAAQ5B,kBAAkB4B,MAAM;YAChCxB,MAAMA;YACNC,iBAAiBA;YACjBC,iBAAiBA;YACjBJ,aAAaA;YACbC,aAAaA;YACbI,UAAUA;YACVC,UAAUA;YACVC,WAAWA;YACX8C,eAAexD,WAAWwD,aAAa;;;AAI/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/HeatMapTooltip.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/HeatMapTooltip.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { css, Theme } from '@mui/material';\nimport { getDateAndTime } from '@perses-dev/components';\nimport { FormatOptions, formatValue } from '@perses-dev/core';\nimport { HeatMapData } from './HeatMapChart';\n\ninterface CustomTooltipProps {\n data: HeatMapData;\n label: string;\n marker: string;\n xAxisCategories: number[];\n yAxisCategories: string[];\n theme: Theme;\n yAxisFormat?: FormatOptions;\n countFormat?: FormatOptions;\n}\n\nexport function generateTooltipHTML({\n data,\n label,\n marker,\n xAxisCategories,\n yAxisCategories,\n theme,\n yAxisFormat,\n countFormat,\n}: CustomTooltipProps): string {\n const [x, y] = data;\n const xAxisLabel = xAxisCategories[x];\n\n const { formattedDate, formattedTime } = getDateAndTime(xAxisLabel);\n\n const tooltipHeader = css`\n border-bottom: 1px solid ${theme.palette.grey[500]};\n padding-bottom: 8px;\n `;\n\n const tooltipContentStyles = css`\n display: flex;\n justify-content: space-between;\n padding-top: 8px;\n `;\n\n const labelStyles = css`\n margin-right: 16px;\n `;\n\n const lowerBound = parseFloat(yAxisCategories[y]!);\n const upperBound = yAxisCategories[y + 1]\n ? parseFloat(yAxisCategories[y + 1]!)\n : parseFloat(yAxisCategories[y]!) + parseFloat(yAxisCategories[y]!) - parseFloat(yAxisCategories[y - 1]!); // Top cell, upper bound need to be calculated from previous cell\n\n return `\n <div>\n <div style=\"${tooltipHeader.styles}\">${formattedDate} ${formattedTime}</div>\n <div style=\"${tooltipContentStyles.styles}\">\n <div style=\"${labelStyles.styles}\">\n ${marker}\n <strong>${formatValue(lowerBound, yAxisFormat)} - ${formatValue(upperBound, yAxisFormat)}</strong>\n </div>\n <div>\n ${formatValue(parseFloat(label), countFormat)}\n </div>\n </div>\n </div>\n `;\n}\n"],"names":["css","getDateAndTime","formatValue","generateTooltipHTML","data","label","marker","xAxisCategories","yAxisCategories","theme","yAxisFormat","countFormat","x","y","xAxisLabel","formattedDate","formattedTime","tooltipHeader","palette","grey","tooltipContentStyles","labelStyles","lowerBound","parseFloat","upperBound","styles"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,GAAG,QAAe,gBAAgB;AAC3C,SAASC,cAAc,QAAQ,yBAAyB;AACxD,SAAwBC,WAAW,QAAQ,mBAAmB;AAc9D,OAAO,SAASC,oBAAoB,EAClCC,IAAI,EACJC,KAAK,EACLC,MAAM,EACNC,eAAe,EACfC,eAAe,EACfC,KAAK,EACLC,WAAW,EACXC,WAAW,EACQ;IACnB,MAAM,CAACC,GAAGC,EAAE,GAAGT;IACf,MAAMU,aAAaP,eAAe,CAACK,EAAE;IAErC,MAAM,EAAEG,aAAa,EAAEC,aAAa,EAAE,GAAGf,eAAea;IAExD,MAAMG,gBAAgBjB,GAAG,CAAC;6BACC,EAAES,MAAMS,OAAO,CAACC,IAAI,CAAC,IAAI,CAAC;;EAErD,CAAC;IAED,MAAMC,uBAAuBpB,GAAG,CAAC;;;;EAIjC,CAAC;IAED,MAAMqB,cAAcrB,GAAG,CAAC;;EAExB,CAAC;IAED,MAAMsB,aAAaC,WAAWf,eAAe,CAACK,EAAE;IAChD,MAAMW,aAAahB,eAAe,CAACK,IAAI,EAAE,GACrCU,WAAWf,eAAe,CAACK,IAAI,EAAE,IACjCU,WAAWf,eAAe,CAACK,EAAE,IAAKU,WAAWf,eAAe,CAACK,EAAE,IAAKU,WAAWf,eAAe,CAACK,IAAI,EAAE,GAAI,iEAAiE;IAE9K,OAAO,CAAC;;kBAEQ,EAAEI,cAAcQ,MAAM,CAAC,EAAE,EAAEV,cAAc,CAAC,EAAEC,cAAc;kBAC1D,EAAEI,qBAAqBK,MAAM,CAAC;oBAC5B,EAAEJ,YAAYI,MAAM,CAAC;UAC/B,EAAEnB,OAAO;kBACD,EAAEJ,YAAYoB,YAAYZ,aAAa,GAAG,EAAER,YAAYsB,YAAYd,aAAa;;;UAGzF,EAAER,YAAYqB,WAAWlB,QAAQM,aAAa;;;;EAItD,CAAC;AACH"}
|
package/lib/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './HeatMapChartOptionsEditorSettings';\nexport * from './HeatMapChartPanel';\nexport * from './HeatMapChart';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,sCAAsC;AACpD,cAAc,sBAAsB;AACpC,cAAc,iBAAiB"}
|
package/lib/env.d.js
CHANGED
package/lib/env.d.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/env.d.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../src/env.d.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/// <reference types=\"@rsbuild/core/types\" />\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,6CAA6C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPluginModule.d.ts","sourceRoot":"","sources":["../../src/getPluginModule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getPluginModule.d.ts","sourceRoot":"","sources":["../../src/getPluginModule.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,oBAAoB,EAAoB,MAAM,2BAA2B,CAAC;AAGnF;;GAEG;AACH,wBAAgB,eAAe,IAAI,oBAAoB,CAUtD"}
|
package/lib/getPluginModule.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the \"License\");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an \"AS IS\" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
1
13
|
import packageJson from '../package.json';
|
|
2
14
|
/**
|
|
3
15
|
* Returns the plugin module information from package.json
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/getPluginModule.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../src/getPluginModule.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PluginModuleResource, PluginModuleSpec } from '@perses-dev/plugin-system';\nimport packageJson from '../package.json';\n\n/**\n * Returns the plugin module information from package.json\n */\nexport function getPluginModule(): PluginModuleResource {\n const { name, version, perses } = packageJson;\n return {\n kind: 'PluginModule',\n metadata: {\n name,\n version,\n },\n spec: perses as PluginModuleSpec,\n };\n}\n"],"names":["packageJson","getPluginModule","name","version","perses","kind","metadata","spec"],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,OAAOA,iBAAiB,kBAAkB;AAE1C;;CAEC,GACD,OAAO,SAASC;IACd,MAAM,EAAEC,IAAI,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAGJ;IAClC,OAAO;QACLK,MAAM;QACNC,UAAU;YACRJ;YACAC;QACF;QACAI,MAAMH;IACR;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/heat-map-chart-model.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../src/heat-map-chart-model.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Definition, FormatOptions } from '@perses-dev/core';\nimport { OptionsEditorProps } from '@perses-dev/plugin-system';\n\nexport const DEFAULT_FORMAT: FormatOptions = { unit: 'decimal' };\nexport const DEFAULT_MIN_PERCENT = 0;\nexport const DEFAULT_MAX_PERCENT = 100;\nexport const DEFAULT_MIN_PERCENT_DECIMAL = 0;\nexport const DEFAULT_MAX_PERCENT_DECIMAL = 1;\n\n/**\n * The schema for a HeatMapChart panel.\n */\nexport interface HeatMapChartDefinition extends Definition<HeatMapChartOptions> {\n kind: 'HeatMapChart';\n}\n\n/**\n * The Options object type supported by the HeatMapChart panel plugin.\n */\nexport interface HeatMapChartOptions {\n yAxisFormat?: FormatOptions;\n countFormat?: FormatOptions;\n showVisualMap?: boolean;\n}\n\nexport type HeatMapChartOptionsEditorProps = OptionsEditorProps<HeatMapChartOptions>;\n\n/**\n * Creates the initial/empty options for a HeatMapChart panel.\n */\nexport function createInitialHeatMapChartOptions(): HeatMapChartOptions {\n return {\n yAxisFormat: DEFAULT_FORMAT,\n countFormat: DEFAULT_FORMAT,\n showVisualMap: true,\n };\n}\n"],"names":["DEFAULT_FORMAT","unit","DEFAULT_MIN_PERCENT","DEFAULT_MAX_PERCENT","DEFAULT_MIN_PERCENT_DECIMAL","DEFAULT_MAX_PERCENT_DECIMAL","createInitialHeatMapChartOptions","yAxisFormat","countFormat","showVisualMap"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAKjC,OAAO,MAAMA,iBAAgC;IAAEC,MAAM;AAAU,EAAE;AACjE,OAAO,MAAMC,sBAAsB,EAAE;AACrC,OAAO,MAAMC,sBAAsB,IAAI;AACvC,OAAO,MAAMC,8BAA8B,EAAE;AAC7C,OAAO,MAAMC,8BAA8B,EAAE;AAoB7C;;CAEC,GACD,OAAO,SAASC;IACd,OAAO;QACLC,aAAaP;QACbQ,aAAaR;QACbS,eAAe;IACjB;AACF"}
|
package/lib/index-federation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index-federation.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../src/index-federation.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport('./bootstrap');\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,MAAM,CAAC"}
|
package/lib/index.js
CHANGED
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport { getPluginModule } from './getPluginModule';\nexport { HeatMapChartPanel } from './components';\nexport * from './heat-map-chart-model';\nexport * from './HeatMapChart';\n"],"names":["getPluginModule","HeatMapChartPanel"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,eAAe,QAAQ,oBAAoB;AACpD,SAASC,iBAAiB,QAAQ,eAAe;AACjD,cAAc,yBAAyB;AACvC,cAAc,iBAAiB"}
|
package/lib/setup-tests.js
CHANGED
package/lib/setup-tests.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/setup-tests.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../src/setup-tests.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport '@testing-library/jest-dom';\n\n// Always mock e-charts during tests since we don't have a proper canvas in jsdom\njest.mock('echarts/core');\n"],"names":["jest","mock"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,4BAA4B;AAEnC,iFAAiF;AACjFA,KAAKC,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-transform.d.ts","sourceRoot":"","sources":["../../../src/utils/data-transform.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"data-transform.d.ts","sourceRoot":"","sources":["../../../src/utils/data-transform.ts"],"names":[],"mappings":"AAaA,OAAO,EAAsB,SAAS,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,GAAG,SAAS,GAAG,SAAS,CAG7G;AAED,wBAAgB,0BAA0B,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,MAAM,EAAE,CAU1E"}
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the \"License\");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an \"AS IS\" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
1
13
|
import { getCommonTimeScale } from '@perses-dev/core';
|
|
2
14
|
export function getCommonTimeScaleForQueries(queries) {
|
|
3
15
|
const seriesData = queries.map((query)=>query.data);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/data-transform.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/data-transform.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { getCommonTimeScale, TimeScale, TimeSeriesData } from '@perses-dev/core';\nimport { PanelData } from '@perses-dev/plugin-system';\n\nexport function getCommonTimeScaleForQueries(queries: Array<PanelData<TimeSeriesData>>): TimeScale | undefined {\n const seriesData = queries.map((query) => query.data);\n return getCommonTimeScale(seriesData);\n}\n\nexport function generateCompleteTimestamps(timescale?: TimeScale): number[] {\n if (!timescale) {\n return [];\n }\n const { startMs, endMs, stepMs } = timescale;\n const timestamps: number[] = [];\n for (let time = startMs; time <= endMs; time += stepMs) {\n timestamps.push(time);\n }\n return timestamps;\n}\n"],"names":["getCommonTimeScale","getCommonTimeScaleForQueries","queries","seriesData","map","query","data","generateCompleteTimestamps","timescale","startMs","endMs","stepMs","timestamps","time","push"],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,kBAAkB,QAAmC,mBAAmB;AAGjF,OAAO,SAASC,6BAA6BC,OAAyC;IACpF,MAAMC,aAAaD,QAAQE,GAAG,CAAC,CAACC,QAAUA,MAAMC,IAAI;IACpD,OAAON,mBAAmBG;AAC5B;AAEA,OAAO,SAASI,2BAA2BC,SAAqB;IAC9D,IAAI,CAACA,WAAW;QACd,OAAO,EAAE;IACX;IACA,MAAM,EAAEC,OAAO,EAAEC,KAAK,EAAEC,MAAM,EAAE,GAAGH;IACnC,MAAMI,aAAuB,EAAE;IAC/B,IAAK,IAAIC,OAAOJ,SAASI,QAAQH,OAAOG,QAAQF,OAAQ;QACtDC,WAAWE,IAAI,CAACD;IAClB;IACA,OAAOD;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/get-formatted-axis-label.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/get-formatted-axis-label.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { formatWithTimeZone } from '@perses-dev/components';\n\n// https://echarts.apache.org/en/option.html#xAxis.axisLabel.formatter\nexport function getFormattedHeatmapAxisLabel(rangeMs: number, timezone: string) {\n return function (value: number): string {\n const dayMs = 86400000;\n const monthMs = 2629440000;\n const yearMs = 31536000000;\n\n const timeStamp = new Date(Number(value));\n\n // more than 5 years\n if (rangeMs > yearMs * 5) {\n return formatWithTimeZone(timeStamp, 'yyy', timezone);\n }\n\n // more than 2 years\n if (rangeMs > yearMs * 2) {\n return formatWithTimeZone(timeStamp, 'MMM yyy', timezone);\n }\n\n // between 5 days to 6 months\n if (rangeMs > dayMs * 10 && rangeMs < monthMs * 6) {\n return formatWithTimeZone(timeStamp, 'dd.MM', timezone); // 12-01\n }\n\n // between 2 and 10 days\n if (rangeMs > dayMs * 2 && rangeMs <= dayMs * 10) {\n return formatWithTimeZone(timeStamp, 'dd.MM HH:mm', timezone); // 12-01; // 12-01 12:30\n }\n\n return formatWithTimeZone(timeStamp, 'HH:mm', timezone);\n };\n}\n"],"names":["formatWithTimeZone","getFormattedHeatmapAxisLabel","rangeMs","timezone","value","dayMs","monthMs","yearMs","timeStamp","Date","Number"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,kBAAkB,QAAQ,yBAAyB;AAE5D,sEAAsE;AACtE,OAAO,SAASC,6BAA6BC,OAAe,EAAEC,QAAgB;IAC5E,OAAO,SAAUC,KAAa;QAC5B,MAAMC,QAAQ;QACd,MAAMC,UAAU;QAChB,MAAMC,SAAS;QAEf,MAAMC,YAAY,IAAIC,KAAKC,OAAON;QAElC,oBAAoB;QACpB,IAAIF,UAAUK,SAAS,GAAG;YACxB,OAAOP,mBAAmBQ,WAAW,OAAOL;QAC9C;QAEA,oBAAoB;QACpB,IAAID,UAAUK,SAAS,GAAG;YACxB,OAAOP,mBAAmBQ,WAAW,WAAWL;QAClD;QAEA,6BAA6B;QAC7B,IAAID,UAAUG,QAAQ,MAAMH,UAAUI,UAAU,GAAG;YACjD,OAAON,mBAAmBQ,WAAW,SAASL,WAAW,QAAQ;QACnE;QAEA,wBAAwB;QACxB,IAAID,UAAUG,QAAQ,KAAKH,WAAWG,QAAQ,IAAI;YAChD,OAAOL,mBAAmBQ,WAAW,eAAeL,WAAW,wBAAwB;QACzF;QAEA,OAAOH,mBAAmBQ,WAAW,SAASL;IAChD;AACF"}
|
package/lib/utils/index.js
CHANGED
package/lib/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/index.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './data-transform';\nexport * from './get-formatted-axis-label';\nexport * from './thresholds';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,mBAAmB;AACjC,cAAc,6BAA6B;AAC3C,cAAc,eAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thresholds.d.ts","sourceRoot":"","sources":["../../../src/utils/thresholds.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"thresholds.d.ts","sourceRoot":"","sources":["../../../src/utils/thresholds.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,gBAAgB,GAAG,SAAS,EACxC,WAAW,EAAE,iBAAiB,EAC9B,YAAY,EAAE,MAAM,GACnB,MAAM,GAAG,IAAI,CAcf"}
|
package/lib/utils/thresholds.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the \"License\");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an \"AS IS\" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
1
13
|
export function getColorFromThresholds(value, thresholds, chartsTheme, defaultColor) {
|
|
2
14
|
if (thresholds?.steps) {
|
|
3
15
|
const matchingColors = thresholds.steps.map((step, index)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/thresholds.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/thresholds.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ThresholdOptions } from '@perses-dev/core';\nimport { PersesChartsTheme } from '@perses-dev/components';\n\nexport function getColorFromThresholds(\n value: number,\n thresholds: ThresholdOptions | undefined,\n chartsTheme: PersesChartsTheme,\n defaultColor: string\n): string | null {\n if (thresholds?.steps) {\n const matchingColors = thresholds.steps\n .map((step, index) => {\n if (value >= step.value) {\n return step.color ?? chartsTheme.thresholds.palette[index] ?? thresholds.defaultColor ?? defaultColor;\n }\n return null;\n })\n .filter((color): color is string => color !== null);\n\n return matchingColors[matchingColors.length - 1] ?? thresholds.defaultColor ?? defaultColor;\n }\n return thresholds?.defaultColor ?? defaultColor;\n}\n"],"names":["getColorFromThresholds","value","thresholds","chartsTheme","defaultColor","steps","matchingColors","map","step","index","color","palette","filter","length"],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAKjC,OAAO,SAASA,uBACdC,KAAa,EACbC,UAAwC,EACxCC,WAA8B,EAC9BC,YAAoB;IAEpB,IAAIF,YAAYG,OAAO;QACrB,MAAMC,iBAAiBJ,WAAWG,KAAK,CACpCE,GAAG,CAAC,CAACC,MAAMC;YACV,IAAIR,SAASO,KAAKP,KAAK,EAAE;gBACvB,OAAOO,KAAKE,KAAK,IAAIP,YAAYD,UAAU,CAACS,OAAO,CAACF,MAAM,IAAIP,WAAWE,YAAY,IAAIA;YAC3F;YACA,OAAO;QACT,GACCQ,MAAM,CAAC,CAACF,QAA2BA,UAAU;QAEhD,OAAOJ,cAAc,CAACA,eAAeO,MAAM,GAAG,EAAE,IAAIX,WAAWE,YAAY,IAAIA;IACjF;IACA,OAAOF,YAAYE,gBAAgBA;AACrC"}
|
package/mf-manifest.json
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
"name": "HeatMapChart",
|
|
6
6
|
"type": "app",
|
|
7
7
|
"buildInfo": {
|
|
8
|
-
"buildVersion": "0.4.0-
|
|
8
|
+
"buildVersion": "0.4.0-rc.1",
|
|
9
9
|
"buildName": "@perses-dev/heatmap-chart-plugin"
|
|
10
10
|
},
|
|
11
11
|
"remoteEntry": {
|
|
12
|
-
"name": "__mf/js/HeatMapChart.
|
|
12
|
+
"name": "__mf/js/HeatMapChart.3d6939cb.js",
|
|
13
13
|
"path": "",
|
|
14
14
|
"type": "global"
|
|
15
15
|
},
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
{
|
|
29
29
|
"id": "HeatMapChart:@perses-dev/components",
|
|
30
30
|
"name": "@perses-dev/components",
|
|
31
|
-
"version": "0.53.0-
|
|
31
|
+
"version": "0.53.0-rc.2",
|
|
32
32
|
"singleton": true,
|
|
33
|
-
"requiredVersion": "^0.53.0-
|
|
33
|
+
"requiredVersion": "^0.53.0-rc.2",
|
|
34
34
|
"assets": {
|
|
35
35
|
"js": {
|
|
36
36
|
"async": [],
|
|
37
37
|
"sync": [
|
|
38
|
-
"__mf/js/async/
|
|
38
|
+
"__mf/js/async/983.84770ead.js"
|
|
39
39
|
]
|
|
40
40
|
},
|
|
41
41
|
"css": {
|
|
@@ -47,14 +47,14 @@
|
|
|
47
47
|
{
|
|
48
48
|
"id": "HeatMapChart:@perses-dev/core",
|
|
49
49
|
"name": "@perses-dev/core",
|
|
50
|
-
"version": "0.53.0-
|
|
50
|
+
"version": "0.53.0-rc.0",
|
|
51
51
|
"singleton": true,
|
|
52
|
-
"requiredVersion": "^0.53.0-
|
|
52
|
+
"requiredVersion": "^0.53.0-rc.0",
|
|
53
53
|
"assets": {
|
|
54
54
|
"js": {
|
|
55
55
|
"async": [],
|
|
56
56
|
"sync": [
|
|
57
|
-
"__mf/js/async/12.
|
|
57
|
+
"__mf/js/async/12.6b37fcc7.js"
|
|
58
58
|
]
|
|
59
59
|
},
|
|
60
60
|
"css": {
|
|
@@ -149,7 +149,7 @@
|
|
|
149
149
|
"js": {
|
|
150
150
|
"sync": [
|
|
151
151
|
"__mf/js/async/700.a5530423.js",
|
|
152
|
-
"__mf/js/async/__federation_expose_HeatMapChart.
|
|
152
|
+
"__mf/js/async/__federation_expose_HeatMapChart.158cef2e.js"
|
|
153
153
|
],
|
|
154
154
|
"async": [
|
|
155
155
|
"__mf/js/async/888.944e0384.js"
|
package/mf-stats.json
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
"name": "HeatMapChart",
|
|
6
6
|
"type": "app",
|
|
7
7
|
"buildInfo": {
|
|
8
|
-
"buildVersion": "0.4.0-
|
|
8
|
+
"buildVersion": "0.4.0-rc.1",
|
|
9
9
|
"buildName": "@perses-dev/heatmap-chart-plugin"
|
|
10
10
|
},
|
|
11
11
|
"remoteEntry": {
|
|
12
|
-
"name": "__mf/js/HeatMapChart.
|
|
12
|
+
"name": "__mf/js/HeatMapChart.3d6939cb.js",
|
|
13
13
|
"path": "",
|
|
14
14
|
"type": "global"
|
|
15
15
|
},
|
|
@@ -27,17 +27,17 @@
|
|
|
27
27
|
"shared": [
|
|
28
28
|
{
|
|
29
29
|
"singleton": true,
|
|
30
|
-
"requiredVersion": "^0.53.0-
|
|
30
|
+
"requiredVersion": "^0.53.0-rc.2",
|
|
31
31
|
"shareScope": "default",
|
|
32
32
|
"name": "@perses-dev/components",
|
|
33
|
-
"version": "0.53.0-
|
|
33
|
+
"version": "0.53.0-rc.2",
|
|
34
34
|
"eager": false,
|
|
35
35
|
"id": "HeatMapChart:@perses-dev/components",
|
|
36
36
|
"assets": {
|
|
37
37
|
"js": {
|
|
38
38
|
"async": [],
|
|
39
39
|
"sync": [
|
|
40
|
-
"__mf/js/async/
|
|
40
|
+
"__mf/js/async/983.84770ead.js"
|
|
41
41
|
]
|
|
42
42
|
},
|
|
43
43
|
"css": {
|
|
@@ -51,17 +51,17 @@
|
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
"singleton": true,
|
|
54
|
-
"requiredVersion": "^0.53.0-
|
|
54
|
+
"requiredVersion": "^0.53.0-rc.0",
|
|
55
55
|
"shareScope": "default",
|
|
56
56
|
"name": "@perses-dev/core",
|
|
57
|
-
"version": "0.53.0-
|
|
57
|
+
"version": "0.53.0-rc.0",
|
|
58
58
|
"eager": false,
|
|
59
59
|
"id": "HeatMapChart:@perses-dev/core",
|
|
60
60
|
"assets": {
|
|
61
61
|
"js": {
|
|
62
62
|
"async": [],
|
|
63
63
|
"sync": [
|
|
64
|
-
"__mf/js/async/12.
|
|
64
|
+
"__mf/js/async/12.6b37fcc7.js"
|
|
65
65
|
]
|
|
66
66
|
},
|
|
67
67
|
"css": {
|
|
@@ -183,7 +183,7 @@
|
|
|
183
183
|
"js": {
|
|
184
184
|
"sync": [
|
|
185
185
|
"__mf/js/async/700.a5530423.js",
|
|
186
|
-
"__mf/js/async/__federation_expose_HeatMapChart.
|
|
186
|
+
"__mf/js/async/__federation_expose_HeatMapChart.158cef2e.js"
|
|
187
187
|
],
|
|
188
188
|
"async": [
|
|
189
189
|
"__mf/js/async/888.944e0384.js"
|