@perses-dev/heatmap-chart-plugin 0.4.0-rc.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mf/js/{HeatMapChart.64173994.js → HeatMapChart.a5f52cc0.js} +3 -3
- package/__mf/js/async/12.4ae967ba.js +2 -0
- package/__mf/js/async/180.c67f24c4.js +71 -0
- package/__mf/js/async/392.81aab132.js +2 -0
- package/__mf/js/async/980.092bc51a.js +83 -0
- package/__mf/js/async/__federation_expose_HeatMapChart.c74c73d1.js +23 -0
- package/__mf/js/{main.73ddd86d.js → main.69b7f04b.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 +97 -20
- package/lib/cjs/components/HeatMapChartOptionsEditorSettings.js +61 -6
- package/lib/cjs/components/HeatMapChartPanel.js +87 -38
- package/lib/cjs/components/HeatMapTooltip.js +6 -6
- 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 +25 -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.d.ts +6 -3
- package/lib/components/HeatMapChart.d.ts.map +1 -1
- package/lib/components/HeatMapChart.js +97 -20
- package/lib/components/HeatMapChart.js.map +1 -1
- package/lib/components/HeatMapChartOptionsEditorSettings.d.ts.map +1 -1
- package/lib/components/HeatMapChartOptionsEditorSettings.js +64 -9
- package/lib/components/HeatMapChartOptionsEditorSettings.js.map +1 -1
- package/lib/components/HeatMapChartPanel.d.ts.map +1 -1
- package/lib/components/HeatMapChartPanel.js +87 -38
- package/lib/components/HeatMapChartPanel.js.map +1 -1
- package/lib/components/HeatMapTooltip.d.ts +1 -2
- package/lib/components/HeatMapTooltip.d.ts.map +1 -1
- package/lib/components/HeatMapTooltip.js +6 -6
- 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.d.ts +13 -0
- package/lib/heat-map-chart-model.d.ts.map +1 -1
- package/lib/heat-map-chart-model.js +19 -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 +13 -13
- package/mf-stats.json +13 -13
- package/package.json +4 -4
- package/__mf/js/async/12.4a0642db.js +0 -2
- package/__mf/js/async/277.34ae0ac5.js +0 -71
- package/__mf/js/async/392.de783cd4.js +0 -2
- package/__mf/js/async/700.a5530423.js +0 -83
- package/__mf/js/async/__federation_expose_HeatMapChart.5ef80ecb.js +0 -23
- /package/__mf/js/async/{12.4a0642db.js.LICENSE.txt → 12.4ae967ba.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{277.34ae0ac5.js.LICENSE.txt → 180.c67f24c4.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{392.de783cd4.js.LICENSE.txt → 392.81aab132.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{700.a5530423.js.LICENSE.txt → 980.092bc51a.js.LICENSE.txt} +0 -0
|
@@ -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;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,MA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;IACF,GAAG;QAACT,mBAAmB4B;QAAQ3B;KAAa;IAE5C,yCAAyC;IACzC,IAAIA,aAAaS,MAAM,GAAG,GAAG;QAC3B,qBACE,KAACxB;YAAM+D,gBAAe;YAASrB,QAAO;sBACpC,cAAA,KAACzC;gBAAW+D,SAAQ;gBAAQC,WAAU;0BAAS;;;IAKrD;IAEA,iDAAiD;IACjD,IAAI/C,KAAKM,MAAM,KAAK,GAAG;QACrB,qBACE,KAACxB;YAAM+D,gBAAe;YAASrB,QAAO;sBACpC,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
|
+
{"version":3,"sources":["../../../src/components/HeatMapChartPanel.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, LOG_BASE } from '../heat-map-chart-model';\nimport { generateCompleteTimestamps, getCommonTimeScaleForQueries } from '../utils';\nimport { HeatMapChart, HeatMapDataItem } from './HeatMapChart';\n\n/**\n * Helper function to get the effective lower bound for log scale.\n * For values <= 0, we use a small fraction of the upper bound.\n */\nconst getEffectiveLowerBound = (lowerBound: number, upperBound: number, logBase: LOG_BASE): number => {\n if (logBase === undefined || lowerBound > 0) {\n return lowerBound;\n }\n // For log scales with non-positive lower bounds, use a small fraction of upper bound\n // This ensures the bucket is still visible on the log scale\n return upperBound * 0.001;\n};\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 min,\n max,\n countMin,\n countMax,\n timeScale,\n }: {\n data: HeatMapDataItem[];\n xAxisCategories: number[];\n min?: number;\n max?: number;\n countMin: number;\n countMax: number;\n timeScale?: TimeScale;\n } = useMemo(() => {\n if (!queryResults || queryResults.length === 0) {\n return {\n data: [],\n xAxisCategories: [],\n min: 0,\n max: 0,\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 min: 0,\n max: 0,\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 const logBase = pluginSpec.logBase;\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 for (const [, histogram] of series?.histograms ?? []) {\n for (const bucket of histogram?.buckets ?? []) {\n const [, lowerBound, upperBound, count] = bucket;\n let lowerBoundFloat = parseFloat(lowerBound);\n const upperBoundFloat = parseFloat(upperBound);\n const countFloat = parseFloat(count);\n\n // For logarithmic scales, skip buckets that would be entirely non-positive\n if (logBase !== undefined && upperBoundFloat <= 0) {\n continue;\n }\n\n // For log scales, adjust non-positive lower bounds\n if (logBase !== undefined) {\n lowerBoundFloat = getEffectiveLowerBound(lowerBoundFloat, upperBoundFloat, logBase);\n }\n\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 data: HeatMapDataItem[] = [];\n // Each bucket becomes a rectangle spanning [lowerBound, upperBound] at the given x index\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 const [, lowerBound, upperBound, count] = bucket;\n let lowerBoundFloat = parseFloat(lowerBound);\n const upperBoundFloat = parseFloat(upperBound);\n\n // For logarithmic scales, skip buckets that would be entirely non-positive\n if (logBase !== undefined && upperBoundFloat <= 0) {\n continue;\n }\n\n // For log scales, adjust non-positive lower bounds\n if (logBase !== undefined) {\n lowerBoundFloat = getEffectiveLowerBound(lowerBoundFloat, upperBoundFloat, logBase);\n }\n\n data.push({\n value: [itemIndexOnXaxis, lowerBoundFloat, upperBoundFloat, parseFloat(count)],\n label: count,\n });\n }\n }\n return {\n data,\n xAxisCategories,\n min: lowestBound === Infinity ? undefined : lowestBound,\n max: highestBound === -Infinity ? undefined : highestBound,\n countMin,\n countMax,\n timeScale,\n };\n }, [pluginSpec.logBase, queryResults]);\n\n // Use configured min/max if provided, otherwise use calculated values\n // For logarithmic scales, ignore user-provided min if it's <= 0 (log of non-positive is undefined)\n // and let ECharts auto-calculate the range to avoid rendering issues\n const finalMin = useMemo(() => {\n if (pluginSpec.logBase !== undefined) {\n // For log scale, ignore min if it's <= 0 or let ECharts auto-calculate\n if (pluginSpec.min !== undefined && pluginSpec.min <= 0) {\n return undefined; // Let ECharts auto-calculate\n }\n return pluginSpec.min ?? min;\n }\n return pluginSpec.min ?? min;\n }, [pluginSpec.logBase, pluginSpec.min, min]);\n\n const finalMax = useMemo(() => {\n if (pluginSpec.logBase !== undefined) {\n // For log scale, ignore max if it's <= 0\n if (pluginSpec.max !== undefined && pluginSpec.max <= 0) {\n return undefined; // Let ECharts auto-calculate\n }\n return pluginSpec.max ?? max;\n }\n return pluginSpec.max ?? max;\n }, [pluginSpec.logBase, pluginSpec.max, max]);\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 yAxisFormat={yAxisFormat}\n countFormat={countFormat}\n countMin={countMin}\n countMax={countMax}\n timeScale={timeScale}\n showVisualMap={pluginSpec.showVisualMap}\n min={finalMin}\n max={finalMax}\n logBase={pluginSpec.logBase}\n />\n </Stack>\n );\n}\n"],"names":["Stack","Typography","merge","useMemo","DEFAULT_FORMAT","generateCompleteTimestamps","getCommonTimeScaleForQueries","HeatMapChart","getEffectiveLowerBound","lowerBound","upperBound","logBase","undefined","HeatMapChartPanel","props","spec","pluginSpec","contentDimensions","queryResults","yAxisFormat","countFormat","data","xAxisCategories","min","max","countMin","countMax","timeScale","length","series","histograms","lowestBound","Infinity","highestBound","histogram","bucket","buckets","count","lowerBoundFloat","parseFloat","upperBoundFloat","countFloat","time","itemIndexOnXaxis","findIndex","v","push","value","label","finalMin","finalMax","justifyContent","height","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,QAAuC,0BAA0B;AACxF,SAASC,0BAA0B,EAAEC,4BAA4B,QAAQ,WAAW;AACpF,SAASC,YAAY,QAAyB,iBAAiB;AAE/D;;;CAGC,GACD,MAAMC,yBAAyB,CAACC,YAAoBC,YAAoBC;IACtE,IAAIA,YAAYC,aAAaH,aAAa,GAAG;QAC3C,OAAOA;IACT;IACA,qFAAqF;IACrF,4DAA4D;IAC5D,OAAOC,aAAa;AACtB;AAIA,OAAO,SAASG,kBAAkBC,KAA6B;IAC7D,MAAM,EAAEC,MAAMC,UAAU,EAAEC,iBAAiB,EAAEC,YAAY,EAAE,GAAGJ;IAE9D,qDAAqD;IACrD,MAAMK,cAAcjB,MAAM,CAAC,GAAGE,gBAAgBY,WAAWG,WAAW;IACpE,MAAMC,cAAclB,MAAM,CAAC,GAAGE,gBAAgBY,WAAWI,WAAW;IAEpE,MAAM,EACJC,IAAI,EACJC,eAAe,EACfC,GAAG,EACHC,GAAG,EACHC,QAAQ,EACRC,QAAQ,EACRC,SA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0B;YACLzB,KAAK0B;YACLvC,SAASK,WAAWL,OAAO;;;AAInC"}
|
|
@@ -6,11 +6,10 @@ interface CustomTooltipProps {
|
|
|
6
6
|
label: string;
|
|
7
7
|
marker: string;
|
|
8
8
|
xAxisCategories: number[];
|
|
9
|
-
yAxisCategories: string[];
|
|
10
9
|
theme: Theme;
|
|
11
10
|
yAxisFormat?: FormatOptions;
|
|
12
11
|
countFormat?: FormatOptions;
|
|
13
12
|
}
|
|
14
|
-
export declare function generateTooltipHTML({ data, label, marker, xAxisCategories,
|
|
13
|
+
export declare function generateTooltipHTML({ data, label, marker, xAxisCategories, theme, yAxisFormat, countFormat, }: CustomTooltipProps): string;
|
|
15
14
|
export {};
|
|
16
15
|
//# sourceMappingURL=HeatMapTooltip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeatMapTooltip.d.ts","sourceRoot":"","sources":["../../../src/components/HeatMapTooltip.ts"],"names":[],"mappings":"AAaA,OAAO,EAAO,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAe,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,UAAU,kBAAkB;IAC1B,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,
|
|
1
|
+
{"version":3,"file":"HeatMapTooltip.d.ts","sourceRoot":"","sources":["../../../src/components/HeatMapTooltip.ts"],"names":[],"mappings":"AAaA,OAAO,EAAO,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAe,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,UAAU,kBAAkB;IAC1B,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,WAAW,CAAC,EAAE,aAAa,CAAC;CAC7B;AAED,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,KAAK,EACL,MAAM,EACN,eAAe,EACf,KAAK,EACL,WAAW,EACX,WAAW,GACZ,EAAE,kBAAkB,GAAG,MAAM,CAsC7B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
import { css } from '@mui/material';
|
|
14
14
|
import { getDateAndTime } from '@perses-dev/components';
|
|
15
15
|
import { formatValue } from '@perses-dev/core';
|
|
16
|
-
export function generateTooltipHTML({ data, label, marker, xAxisCategories,
|
|
17
|
-
const [
|
|
18
|
-
const xAxisLabel = xAxisCategories[
|
|
16
|
+
export function generateTooltipHTML({ data, label, marker, xAxisCategories, theme, yAxisFormat, countFormat }) {
|
|
17
|
+
const [xIndex, yLower, yUpper] = data;
|
|
18
|
+
const xAxisLabel = xAxisCategories[xIndex];
|
|
19
19
|
const { formattedDate, formattedTime } = getDateAndTime(xAxisLabel);
|
|
20
20
|
const tooltipHeader = css`
|
|
21
21
|
border-bottom: 1px solid ${theme.palette.grey[500]};
|
|
@@ -29,8 +29,8 @@ export function generateTooltipHTML({ data, label, marker, xAxisCategories, yAxi
|
|
|
29
29
|
const labelStyles = css`
|
|
30
30
|
margin-right: 16px;
|
|
31
31
|
`;
|
|
32
|
-
const lowerBound =
|
|
33
|
-
const upperBound =
|
|
32
|
+
const lowerBound = yLower;
|
|
33
|
+
const upperBound = yUpper;
|
|
34
34
|
return `
|
|
35
35
|
<div>
|
|
36
36
|
<div style="${tooltipHeader.styles}">${formattedDate} ${formattedTime}</div>
|
|
@@ -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 theme: Theme;\n yAxisFormat?: FormatOptions;\n countFormat?: FormatOptions;\n}\n\nexport function generateTooltipHTML({\n data,\n label,\n marker,\n xAxisCategories,\n theme,\n yAxisFormat,\n countFormat,\n}: CustomTooltipProps): string {\n const [xIndex, yLower, yUpper] = data;\n const xAxisLabel = xAxisCategories[xIndex];\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 = yLower;\n const upperBound = yUpper;\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","theme","yAxisFormat","countFormat","xIndex","yLower","yUpper","xAxisLabel","formattedDate","formattedTime","tooltipHeader","palette","grey","tooltipContentStyles","labelStyles","lowerBound","upperBound","styles","parseFloat"],"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;AAa9D,OAAO,SAASC,oBAAoB,EAClCC,IAAI,EACJC,KAAK,EACLC,MAAM,EACNC,eAAe,EACfC,KAAK,EACLC,WAAW,EACXC,WAAW,EACQ;IACnB,MAAM,CAACC,QAAQC,QAAQC,OAAO,GAAGT;IACjC,MAAMU,aAAaP,eAAe,CAACI,OAAO;IAE1C,MAAM,EAAEI,aAAa,EAAEC,aAAa,EAAE,GAAGf,eAAea;IAExD,MAAMG,gBAAgBjB,GAAG,CAAC;6BACC,EAAEQ,MAAMU,OAAO,CAACC,IAAI,CAAC,IAAI,CAAC;;EAErD,CAAC;IAED,MAAMC,uBAAuBpB,GAAG,CAAC;;;;EAIjC,CAAC;IAED,MAAMqB,cAAcrB,GAAG,CAAC;;EAExB,CAAC;IAED,MAAMsB,aAAaV;IACnB,MAAMW,aAAaV;IAEnB,OAAO,CAAC;;kBAEQ,EAAEI,cAAcO,MAAM,CAAC,EAAE,EAAET,cAAc,CAAC,EAAEC,cAAc;kBAC1D,EAAEI,qBAAqBI,MAAM,CAAC;oBAC5B,EAAEH,YAAYG,MAAM,CAAC;UAC/B,EAAElB,OAAO;kBACD,EAAEJ,YAAYoB,YAAYb,aAAa,GAAG,EAAEP,YAAYqB,YAAYd,aAAa;;;UAGzF,EAAEP,YAAYuB,WAAWpB,QAAQK,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"}
|
|
@@ -5,6 +5,16 @@ export declare const DEFAULT_MIN_PERCENT = 0;
|
|
|
5
5
|
export declare const DEFAULT_MAX_PERCENT = 100;
|
|
6
6
|
export declare const DEFAULT_MIN_PERCENT_DECIMAL = 0;
|
|
7
7
|
export declare const DEFAULT_MAX_PERCENT_DECIMAL = 1;
|
|
8
|
+
export type LOG_BASE = undefined | 2 | 10;
|
|
9
|
+
export declare const LOG_BASE_CONFIG: Record<string, {
|
|
10
|
+
label: string;
|
|
11
|
+
log: LOG_BASE;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const LOG_BASE_OPTIONS: {
|
|
14
|
+
label: string;
|
|
15
|
+
log: LOG_BASE;
|
|
16
|
+
id: string;
|
|
17
|
+
}[];
|
|
8
18
|
/**
|
|
9
19
|
* The schema for a HeatMapChart panel.
|
|
10
20
|
*/
|
|
@@ -18,6 +28,9 @@ export interface HeatMapChartOptions {
|
|
|
18
28
|
yAxisFormat?: FormatOptions;
|
|
19
29
|
countFormat?: FormatOptions;
|
|
20
30
|
showVisualMap?: boolean;
|
|
31
|
+
logBase?: LOG_BASE;
|
|
32
|
+
min?: number;
|
|
33
|
+
max?: number;
|
|
21
34
|
}
|
|
22
35
|
export type HeatMapChartOptionsEditorProps = OptionsEditorProps<HeatMapChartOptions>;
|
|
23
36
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heat-map-chart-model.d.ts","sourceRoot":"","sources":["../../src/heat-map-chart-model.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,eAAO,MAAM,cAAc,EAAE,aAAmC,CAAC;AACjE,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,eAAO,MAAM,mBAAmB,MAAM,CAAC;AACvC,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAC7C,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,UAAU,CAAC,mBAAmB,CAAC;IAC7E,IAAI,EAAE,cAAc,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,EAAE,aAAa,C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gB,gCAAgC,IAAI,mBAAmB,CAMtE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -17,6 +17,24 @@ export const DEFAULT_MIN_PERCENT = 0;
|
|
|
17
17
|
export const DEFAULT_MAX_PERCENT = 100;
|
|
18
18
|
export const DEFAULT_MIN_PERCENT_DECIMAL = 0;
|
|
19
19
|
export const DEFAULT_MAX_PERCENT_DECIMAL = 1;
|
|
20
|
+
export const LOG_BASE_CONFIG = {
|
|
21
|
+
none: {
|
|
22
|
+
label: 'None',
|
|
23
|
+
log: undefined
|
|
24
|
+
},
|
|
25
|
+
'2': {
|
|
26
|
+
label: '2',
|
|
27
|
+
log: 2
|
|
28
|
+
},
|
|
29
|
+
'10': {
|
|
30
|
+
label: '10',
|
|
31
|
+
log: 10
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
export const LOG_BASE_OPTIONS = Object.entries(LOG_BASE_CONFIG).map(([id, config])=>({
|
|
35
|
+
id: id,
|
|
36
|
+
...config
|
|
37
|
+
}));
|
|
20
38
|
/**
|
|
21
39
|
* Creates the initial/empty options for a HeatMapChart panel.
|
|
22
40
|
*/ export function createInitialHeatMapChartOptions() {
|
|
@@ -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\nexport type LOG_BASE = undefined | 2 | 10;\n\nexport const LOG_BASE_CONFIG: Record<string, { label: string; log: LOG_BASE }> = {\n none: { label: 'None', log: undefined },\n '2': { label: '2', log: 2 },\n '10': { label: '10', log: 10 },\n};\n\nexport const LOG_BASE_OPTIONS = Object.entries(LOG_BASE_CONFIG).map(([id, config]) => ({\n id: id as string,\n ...config,\n}));\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 logBase?: LOG_BASE;\n min?: number;\n max?: number;\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","LOG_BASE_CONFIG","none","label","log","undefined","LOG_BASE_OPTIONS","Object","entries","map","id","config","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;AAI7C,OAAO,MAAMC,kBAAoE;IAC/EC,MAAM;QAAEC,OAAO;QAAQC,KAAKC;IAAU;IACtC,KAAK;QAAEF,OAAO;QAAKC,KAAK;IAAE;IAC1B,MAAM;QAAED,OAAO;QAAMC,KAAK;IAAG;AAC/B,EAAE;AAEF,OAAO,MAAME,mBAAmBC,OAAOC,OAAO,CAACP,iBAAiBQ,GAAG,CAAC,CAAC,CAACC,IAAIC,OAAO,GAAM,CAAA;QACrFD,IAAIA;QACJ,GAAGC,MAAM;IACX,CAAA,GAAI;AAuBJ;;CAEC,GACD,OAAO,SAASC;IACd,OAAO;QACLC,aAAalB;QACbmB,aAAanB;QACboB,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",
|
|
9
9
|
"buildName": "@perses-dev/heatmap-chart-plugin"
|
|
10
10
|
},
|
|
11
11
|
"remoteEntry": {
|
|
12
|
-
"name": "__mf/js/HeatMapChart.
|
|
12
|
+
"name": "__mf/js/HeatMapChart.a5f52cc0.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",
|
|
32
32
|
"singleton": true,
|
|
33
|
-
"requiredVersion": "^0.53.0
|
|
33
|
+
"requiredVersion": "^0.53.0",
|
|
34
34
|
"assets": {
|
|
35
35
|
"js": {
|
|
36
36
|
"async": [],
|
|
37
37
|
"sync": [
|
|
38
|
-
"__mf/js/async/
|
|
38
|
+
"__mf/js/async/180.c67f24c4.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.2",
|
|
51
51
|
"singleton": true,
|
|
52
|
-
"requiredVersion": "^0.53.0-
|
|
52
|
+
"requiredVersion": "^0.53.0-rc.2",
|
|
53
53
|
"assets": {
|
|
54
54
|
"js": {
|
|
55
55
|
"async": [],
|
|
56
56
|
"sync": [
|
|
57
|
-
"__mf/js/async/12.
|
|
57
|
+
"__mf/js/async/12.4ae967ba.js"
|
|
58
58
|
]
|
|
59
59
|
},
|
|
60
60
|
"css": {
|
|
@@ -85,14 +85,14 @@
|
|
|
85
85
|
{
|
|
86
86
|
"id": "HeatMapChart:lodash",
|
|
87
87
|
"name": "lodash",
|
|
88
|
-
"version": "4.17.
|
|
88
|
+
"version": "4.17.23",
|
|
89
89
|
"singleton": true,
|
|
90
|
-
"requiredVersion": "^4.17.
|
|
90
|
+
"requiredVersion": "^4.17.23",
|
|
91
91
|
"assets": {
|
|
92
92
|
"js": {
|
|
93
93
|
"async": [],
|
|
94
94
|
"sync": [
|
|
95
|
-
"__mf/js/async/392.
|
|
95
|
+
"__mf/js/async/392.81aab132.js"
|
|
96
96
|
]
|
|
97
97
|
},
|
|
98
98
|
"css": {
|
|
@@ -148,8 +148,8 @@
|
|
|
148
148
|
"assets": {
|
|
149
149
|
"js": {
|
|
150
150
|
"sync": [
|
|
151
|
-
"__mf/js/async/
|
|
152
|
-
"__mf/js/async/__federation_expose_HeatMapChart.
|
|
151
|
+
"__mf/js/async/980.092bc51a.js",
|
|
152
|
+
"__mf/js/async/__federation_expose_HeatMapChart.c74c73d1.js"
|
|
153
153
|
],
|
|
154
154
|
"async": [
|
|
155
155
|
"__mf/js/async/888.944e0384.js"
|