@perses-dev/timeseries-chart-plugin 0.14.0-beta.0 → 0.14.0-beta.2
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/TimeSeriesChart.b9caac04.js +7 -0
- package/__mf/js/async/121.fde1320e.js +2 -0
- package/__mf/js/async/{527.f97d1b86.js → 182.9e1e293f.js} +9 -9
- package/__mf/js/async/192.66c6659d.js +1 -0
- package/__mf/js/async/2.166bda4f.js +1 -0
- package/__mf/js/async/235.76fd7af2.js +1 -0
- package/__mf/js/async/274.e4ed32f7.js +2 -0
- package/__mf/js/async/319.8e262f9c.js +1 -0
- package/__mf/js/async/356.52455d93.js +1 -0
- package/__mf/js/async/384.f40367cc.js +1 -0
- package/__mf/js/async/392.8cb3dcaa.js +2 -0
- package/__mf/js/async/463.f5dc7759.js +7 -0
- package/__mf/js/async/{694.0fb9ee5a.js.LICENSE.txt → 463.f5dc7759.js.LICENSE.txt} +41 -1
- package/__mf/js/async/465.add3260a.js +1 -0
- package/__mf/js/async/470.beedcbcc.js +2 -0
- package/__mf/js/async/522.806db24f.js +22 -0
- package/__mf/js/async/525.8b92c616.js +37 -0
- package/__mf/js/async/587.828c454a.js +1 -0
- package/__mf/js/async/597.0c5bd6dd.js +2 -0
- package/__mf/js/async/612.b2f31132.js +3 -0
- package/__mf/js/async/616.804d525d.js +1 -0
- package/__mf/js/async/663.892b9ad5.js +1 -0
- package/__mf/js/async/700.25c7e5dd.js +1 -0
- package/__mf/js/async/724.f74ffa12.js +1 -0
- package/__mf/js/async/730.058dea58.js +2 -0
- package/__mf/js/async/865.cb917066.js +2 -0
- package/__mf/js/async/941.3bb54150.js +2 -0
- package/__mf/js/async/955.52ca0671.js +1 -0
- package/__mf/js/async/968.2dd830b3.js +1 -0
- package/__mf/js/async/__federation_expose_TimeSeriesChart.4ddb01e0.js +1 -0
- package/__mf/js/async/lib-router.ecb51f08.js +2 -0
- package/__mf/js/{main.35c70c1e.js → main.f55169be.js} +7 -7
- package/lib/GeneralSettingsEditor.d.ts +2 -2
- package/lib/GeneralSettingsEditor.d.ts.map +1 -1
- package/lib/GeneralSettingsEditor.js +7 -7
- package/lib/GeneralSettingsEditor.js.map +1 -1
- package/lib/QuerySettingsEditor.d.ts +2 -2
- package/lib/QuerySettingsEditor.d.ts.map +1 -1
- package/lib/QuerySettingsEditor.js +11 -11
- package/lib/QuerySettingsEditor.js.map +1 -1
- package/lib/TimeSeriesChart.d.ts +3 -3
- package/lib/TimeSeriesChart.d.ts.map +1 -1
- package/lib/TimeSeriesChart.js +5 -5
- package/lib/TimeSeriesChart.js.map +1 -1
- package/lib/TimeSeriesChartBase.d.ts +4 -4
- package/lib/TimeSeriesChartBase.d.ts.map +1 -1
- package/lib/TimeSeriesChartBase.js +12 -12
- package/lib/TimeSeriesChartBase.js.map +1 -1
- package/lib/TimeSeriesChartPanel.d.ts +4 -4
- package/lib/TimeSeriesChartPanel.d.ts.map +1 -1
- package/lib/TimeSeriesChartPanel.js +11 -11
- package/lib/TimeSeriesChartPanel.js.map +1 -1
- package/lib/TimeSeriesExportAction.d.ts +1 -1
- package/lib/TimeSeriesExportAction.d.ts.map +1 -1
- package/lib/TimeSeriesExportAction.js +5 -5
- package/lib/TimeSeriesExportAction.js.map +1 -1
- package/lib/VisualOptionsEditor.d.ts +2 -2
- package/lib/VisualOptionsEditor.d.ts.map +1 -1
- package/lib/VisualOptionsEditor.js +4 -4
- package/lib/VisualOptionsEditor.js.map +1 -1
- package/lib/YAxisOptionsEditor.d.ts +2 -2
- package/lib/YAxisOptionsEditor.d.ts.map +1 -1
- package/lib/YAxisOptionsEditor.js +3 -3
- package/lib/YAxisOptionsEditor.js.map +1 -1
- package/lib/annotations/AnnotationTooltip.d.ts +2 -2
- package/lib/annotations/AnnotationTooltip.d.ts.map +1 -1
- package/lib/annotations/AnnotationTooltip.js +6 -6
- package/lib/annotations/AnnotationTooltip.js.map +1 -1
- package/lib/bootstrap.js +2 -2
- package/lib/getPluginModule.d.ts +1 -1
- package/lib/getPluginModule.d.ts.map +1 -1
- package/lib/getPluginModule.js +3 -1
- package/lib/getPluginModule.js.map +1 -1
- package/lib/index-federation.js +1 -1
- package/lib/index.js +9 -9
- package/lib/index.js.map +1 -1
- package/lib/setup-tests.d.ts +1 -1
- package/lib/setup-tests.d.ts.map +1 -1
- package/lib/setup-tests.js +2 -2
- package/lib/setup-tests.js.map +1 -1
- package/lib/test/mock-query-results.d.ts +1 -1
- package/lib/test/mock-query-results.d.ts.map +1 -1
- package/lib/test/mock-query-results.js.map +1 -1
- package/lib/time-series-chart-model.d.ts +3 -3
- package/lib/time-series-chart-model.d.ts.map +1 -1
- package/lib/time-series-chart-model.js.map +1 -1
- package/lib/utils/annotation.d.ts +2 -2
- package/lib/utils/annotation.d.ts.map +1 -1
- package/lib/utils/annotation.js.map +1 -1
- package/lib/utils/data-transform.d.ts +5 -5
- package/lib/utils/data-transform.d.ts.map +1 -1
- package/lib/utils/data-transform.js +3 -3
- package/lib/utils/data-transform.js.map +1 -1
- package/lib/utils/palette-gen.d.ts +1 -1
- package/lib/utils/palette-gen.d.ts.map +1 -1
- package/lib/utils/palette-gen.js +1 -1
- package/lib/utils/palette-gen.js.map +1 -1
- package/lib/utils/palette.js +1 -1
- package/lib/utils/palette.js.map +1 -1
- package/lib/utils/timezone-formatter.js +1 -1
- package/mf-manifest.json +37 -81
- package/mf-stats.json +39 -91
- package/package.json +11 -11
- package/__mf/js/TimeSeriesChart.7c5da441.js +0 -7
- package/__mf/js/async/121.c3c0e54f.js +0 -2
- package/__mf/js/async/163.cce4c882.js +0 -22
- package/__mf/js/async/177.2fef2962.js +0 -1
- package/__mf/js/async/187.f5e8932b.js +0 -1
- package/__mf/js/async/192.c3dd56d5.js +0 -1
- package/__mf/js/async/2.60fa4a40.js +0 -1
- package/__mf/js/async/202.29f2b119.js +0 -37
- package/__mf/js/async/208.b9f374ad.js +0 -7
- package/__mf/js/async/208.b9f374ad.js.LICENSE.txt +0 -39
- package/__mf/js/async/235.d23c8ef0.js +0 -1
- package/__mf/js/async/274.72dfa9c8.js +0 -2
- package/__mf/js/async/356.8170c96d.js +0 -1
- package/__mf/js/async/392.b9ba5bf2.js +0 -2
- package/__mf/js/async/470.e09f33b7.js +0 -2
- package/__mf/js/async/491.85194549.js +0 -1
- package/__mf/js/async/52.0d78de2b.js +0 -1
- package/__mf/js/async/568.45da2c30.js +0 -1
- package/__mf/js/async/587.c9460696.js +0 -1
- package/__mf/js/async/588.0a1aa144.js +0 -1
- package/__mf/js/async/616.79484ac8.js +0 -1
- package/__mf/js/async/626.9d2c051c.js +0 -2
- package/__mf/js/async/682.971bf8bf.js +0 -3
- package/__mf/js/async/694.0fb9ee5a.js +0 -2
- package/__mf/js/async/702.785cd635.js +0 -2
- package/__mf/js/async/71.8c6cf914.js +0 -1
- package/__mf/js/async/724.c45dcf5b.js +0 -1
- package/__mf/js/async/873.04a201bf.js +0 -1
- package/__mf/js/async/941.b89f8595.js +0 -2
- package/__mf/js/async/955.176fe200.js +0 -1
- package/__mf/js/async/968.2a9fb1a0.js +0 -1
- package/__mf/js/async/978.a9865b23.js +0 -1
- package/__mf/js/async/996.bd40c9c2.js +0 -2
- package/__mf/js/async/__federation_expose_TimeSeriesChart.0f989a8c.js +0 -1
- package/__mf/js/async/lib-router.319c02cd.js +0 -2
- package/lib/cjs/GeneralSettingsEditor.js +0 -103
- package/lib/cjs/QuerySettingsEditor.js +0 -666
- package/lib/cjs/TimeSeriesChart.js +0 -51
- package/lib/cjs/TimeSeriesChartBase.js +0 -488
- package/lib/cjs/TimeSeriesChartPanel.js +0 -456
- package/lib/cjs/TimeSeriesExportAction.js +0 -124
- package/lib/cjs/VisualOptionsEditor.js +0 -161
- package/lib/cjs/YAxisOptionsEditor.js +0 -118
- package/lib/cjs/annotations/AnnotationTooltip.js +0 -370
- package/lib/cjs/bootstrap.js +0 -26
- package/lib/cjs/env.d.js +0 -14
- package/lib/cjs/getPluginModule.js +0 -39
- package/lib/cjs/index-federation.js +0 -55
- package/lib/cjs/index.js +0 -44
- package/lib/cjs/setup-tests.js +0 -19
- package/lib/cjs/test/mock-query-results.js +0 -403
- package/lib/cjs/time-series-chart-model.js +0 -225
- package/lib/cjs/utils/annotation.js +0 -37
- package/lib/cjs/utils/data-transform.js +0 -243
- package/lib/cjs/utils/palette-gen.js +0 -75
- package/lib/cjs/utils/palette.js +0 -83
- package/lib/cjs/utils/timezone-formatter.js +0 -48
- /package/__mf/css/async/{208.85c2cbf6.css → 463.85c2cbf6.css} +0 -0
- /package/__mf/js/async/{121.c3c0e54f.js.LICENSE.txt → 121.fde1320e.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{527.f97d1b86.js.LICENSE.txt → 182.9e1e293f.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{274.72dfa9c8.js.LICENSE.txt → 274.e4ed32f7.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{392.b9ba5bf2.js.LICENSE.txt → 392.8cb3dcaa.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{470.e09f33b7.js.LICENSE.txt → 470.beedcbcc.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{163.cce4c882.js.LICENSE.txt → 522.806db24f.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{626.9d2c051c.js.LICENSE.txt → 597.0c5bd6dd.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{702.785cd635.js.LICENSE.txt → 865.cb917066.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{941.b89f8595.js.LICENSE.txt → 941.3bb54150.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{lib-router.319c02cd.js.LICENSE.txt → lib-router.ecb51f08.js.LICENSE.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/YAxisOptionsEditor.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, TextField } from '@mui/material';\
|
|
1
|
+
{"version":3,"sources":["../../src/YAxisOptionsEditor.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, TextField } from '@mui/material';\nimport { OptionsEditorControl, OptionsEditorGroup, FormatControls, SettingsAutocomplete } from '@perses-dev/components';\nimport type { ReactElement } from 'react';\n\nimport type { TimeSeriesChartYAxisOptions } from './time-series-chart-model';\nimport {\n DEFAULT_FORMAT,\n DEFAULT_Y_AXIS,\n Y_AXIS_CONFIG,\n LOG_BASE_CONFIG,\n LOG_BASE_OPTIONS,\n} from './time-series-chart-model';\n\nexport interface YAxisOptionsEditorProps {\n value: TimeSeriesChartYAxisOptions;\n onChange: (yAxis: TimeSeriesChartYAxisOptions) => void;\n}\n\nexport function YAxisOptionsEditor({ value, onChange }: YAxisOptionsEditorProps): ReactElement {\n const logBase = value.logBase ? LOG_BASE_CONFIG[value.logBase] : undefined;\n\n return (\n <OptionsEditorGroup title=\"Y Axis\">\n <OptionsEditorControl\n label=\"Show\"\n control={\n <Switch\n checked={value.show ?? DEFAULT_Y_AXIS.show}\n onChange={(e): void => {\n onChange({\n ...value,\n show: e.target.checked,\n });\n }}\n />\n }\n />\n <FormatControls\n value={value.format ?? DEFAULT_FORMAT}\n onChange={(newFormat): void =>\n onChange({\n ...value,\n format: newFormat,\n })\n }\n />\n <OptionsEditorControl\n label={Y_AXIS_CONFIG.logBase.label}\n control={\n <SettingsAutocomplete\n value={{\n ...logBase,\n id: logBase?.label ?? 'None',\n }}\n options={LOG_BASE_OPTIONS}\n onChange={(__, newValue) => {\n const updatedValue: TimeSeriesChartYAxisOptions = {\n ...value,\n logBase: newValue.log ?? undefined,\n };\n onChange(updatedValue);\n }}\n disabled={value === undefined}\n disableClearable\n ></SettingsAutocomplete>\n }\n />\n <OptionsEditorControl\n label={Y_AXIS_CONFIG.label.label}\n control={\n <TextField\n value={value.label ?? ''}\n inputProps={{ 'aria-label': 'enter y axis label' }}\n onChange={(e) =>\n onChange({\n ...value,\n label: e.target.value,\n })\n }\n placeholder=\"Default\"\n />\n }\n />\n <OptionsEditorControl\n label={Y_AXIS_CONFIG.min.label}\n control={\n <TextField\n type=\"number\"\n value={value.min ?? ''}\n onChange={(e) => {\n // ensure empty value resets to undef to allow chart to calculate min\n const newValue = e.target.value ? Number(e.target.value) : undefined;\n onChange({\n ...value,\n min: newValue,\n });\n }}\n placeholder=\"Default\"\n />\n }\n />\n <OptionsEditorControl\n label={Y_AXIS_CONFIG.max.label}\n control={\n <TextField\n type=\"number\"\n value={value.max ?? ''}\n onChange={(e) => {\n // ensure empty value resets to undef to allow chart to calculate max\n const newValue = e.target.value ? Number(e.target.value) : undefined;\n onChange({\n ...value,\n max: newValue,\n });\n }}\n placeholder=\"Default\"\n />\n }\n />\n </OptionsEditorGroup>\n );\n}\n"],"names":["Switch","TextField","OptionsEditorControl","OptionsEditorGroup","FormatControls","SettingsAutocomplete","DEFAULT_FORMAT","DEFAULT_Y_AXIS","Y_AXIS_CONFIG","LOG_BASE_CONFIG","LOG_BASE_OPTIONS","YAxisOptionsEditor","value","onChange","logBase","undefined","title","label","control","checked","show","e","target","format","newFormat","id","options","__","newValue","updatedValue","log","disabled","disableClearable","inputProps","placeholder","min","type","Number","max"],"mappings":";AAAA,+BAA+B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AOT,cAAcS,KAAK,CAACA,KAAK;gBAChCC,uBACE,KAACjB;oBACCW,OAAOA,MAAMK,KAAK,IAAI;oBACtBgB,YAAY;wBAAE,cAAc;oBAAqB;oBACjDpB,UAAU,CAACQ,IACTR,SAAS;4BACP,GAAGD,KAAK;4BACRK,OAAOI,EAAEC,MAAM,CAACV,KAAK;wBACvB;oBAEFsB,aAAY;;;0BAIlB,KAAChC;gBACCe,OAAOT,cAAc2B,GAAG,CAAClB,KAAK;gBAC9BC,uBACE,KAACjB;oBACCmC,MAAK;oBACLxB,OAAOA,MAAMuB,GAAG,IAAI;oBACpBtB,UAAU,CAACQ;wBACT,qEAAqE;wBACrE,MAAMO,WAAWP,EAAEC,MAAM,CAACV,KAAK,GAAGyB,OAAOhB,EAAEC,MAAM,CAACV,KAAK,IAAIG;wBAC3DF,SAAS;4BACP,GAAGD,KAAK;4BACRuB,KAAKP;wBACP;oBACF;oBACAM,aAAY;;;0BAIlB,KAAChC;gBACCe,OAAOT,cAAc8B,GAAG,CAACrB,KAAK;gBAC9BC,uBACE,KAACjB;oBACCmC,MAAK;oBACLxB,OAAOA,MAAM0B,GAAG,IAAI;oBACpBzB,UAAU,CAACQ;wBACT,qEAAqE;wBACrE,MAAMO,WAAWP,EAAEC,MAAM,CAACV,KAAK,GAAGyB,OAAOhB,EAAEC,MAAM,CAACV,KAAK,IAAIG;wBAC3DF,SAAS;4BACP,GAAGD,KAAK;4BACR0B,KAAKV;wBACP;oBACF;oBACAM,aAAY;;;;;AAMxB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { CursorCoordinates } from '@perses-dev/components';
|
|
1
2
|
import type { LineSeriesOption } from 'echarts';
|
|
2
|
-
import {
|
|
3
|
-
import { TimeSeriesAnnotation } from '../utils/annotation';
|
|
3
|
+
import type { TimeSeriesAnnotation } from '../utils/annotation';
|
|
4
4
|
export interface AnnotationTooltipProps {
|
|
5
5
|
annotation: TimeSeriesAnnotation;
|
|
6
6
|
containerId?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnnotationTooltip.d.ts","sourceRoot":"","sources":["../../../src/annotations/AnnotationTooltip.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AnnotationTooltip.d.ts","sourceRoot":"","sources":["../../../src/annotations/AnnotationTooltip.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAYhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAKhD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,oBAAoB,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sBAAsB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC;IACrE,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACpC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,wBAAgB,iBAAiB,CAAC,EAChC,UAAU,EACV,WAAW,EACX,sBAAsB,EACtB,SAAS,EACT,aAAoB,EACpB,YAAY,GACb,EAAE,sBAAsB,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CA2G7C;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,oBAAoB,EAAE,GAAG,SAAS,GAAG,gBAAgB,EAAE,CAwHzG"}
|
|
@@ -11,12 +11,12 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
11
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
|
-
import { Box, Divider, Portal, Stack, Typography } from
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
14
|
+
import { Box, Divider, Portal, Stack, Typography } from "@mui/material";
|
|
15
|
+
import { assembleTransform, getDateAndTime, getTooltipStyles, PIN_TOOLTIP_HELP_TEXT, TOOLTIP_BG_COLOR_FALLBACK, TOOLTIP_MAX_WIDTH, UNPIN_TOOLTIP_HELP_TEXT, useMousePosition } from "@perses-dev/components";
|
|
16
|
+
import { DEFAULT_ANNOTATION_COLOR } from "@perses-dev/plugin-system";
|
|
17
|
+
import Pin from "mdi-material-ui/Pin";
|
|
18
|
+
import PinOutline from "mdi-material-ui/PinOutline";
|
|
19
|
+
import useResizeObserver from "use-resize-observer";
|
|
20
20
|
export function AnnotationTooltip({ annotation, containerId, formatWithUserTimeZone, pinnedPos, enablePinning = true, onUnpinClick }) {
|
|
21
21
|
const mousePos = useMousePosition();
|
|
22
22
|
const { height, width, ref: tooltipRef } = useResizeObserver();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/annotations/AnnotationTooltip.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 { Box, Divider, Portal, Stack, Typography } from '@mui/material';\nimport Pin from 'mdi-material-ui/Pin';\nimport PinOutline from 'mdi-material-ui/PinOutline';\nimport useResizeObserver from 'use-resize-observer';\nimport type { LineSeriesOption } from 'echarts';\nimport {\n assembleTransform,\n CursorCoordinates,\n getDateAndTime,\n getTooltipStyles,\n PIN_TOOLTIP_HELP_TEXT,\n TOOLTIP_BG_COLOR_FALLBACK,\n TOOLTIP_MAX_WIDTH,\n UNPIN_TOOLTIP_HELP_TEXT,\n useMousePosition,\n} from '@perses-dev/components';\nimport { DEFAULT_ANNOTATION_COLOR } from '@perses-dev/plugin-system';\nimport { TimeSeriesAnnotation } from '../utils/annotation';\n\nexport interface AnnotationTooltipProps {\n annotation: TimeSeriesAnnotation;\n containerId?: string;\n formatWithUserTimeZone: (date: Date, formatString: string) => string;\n pinnedPos: CursorCoordinates | null;\n enablePinning?: boolean;\n onUnpinClick?: () => void;\n}\n\nexport function AnnotationTooltip({\n annotation,\n containerId,\n formatWithUserTimeZone,\n pinnedPos,\n enablePinning = true,\n onUnpinClick,\n}: AnnotationTooltipProps): JSX.Element | null {\n const mousePos = useMousePosition();\n const { height, width, ref: tooltipRef } = useResizeObserver<HTMLDivElement>();\n\n const isPinned = pinnedPos !== null;\n if (!isPinned && mousePos === null) return null;\n\n const containerElement = containerId ? document.querySelector(containerId) : undefined;\n const maxHeight = containerElement ? containerElement.getBoundingClientRect().height : undefined;\n const transform = assembleTransform(mousePos, pinnedPos, height ?? 0, width ?? 0, containerElement);\n\n const start = getDateAndTime(annotation.start, formatWithUserTimeZone);\n const end = annotation.end !== undefined ? getDateAndTime(annotation.end, formatWithUserTimeZone) : null;\n\n return (\n <Portal container={containerElement}>\n <Box ref={tooltipRef} sx={(theme) => getTooltipStyles(theme, pinnedPos, maxHeight)} style={{ transform }}>\n <Stack spacing={0.5}>\n <Box\n sx={(theme) => ({\n width: '100%',\n maxWidth: TOOLTIP_MAX_WIDTH,\n padding: theme.spacing(1.5, 2, 0.5, 2),\n backgroundColor: theme.palette.designSystem?.grey[800] ?? TOOLTIP_BG_COLOR_FALLBACK,\n position: 'sticky',\n top: 0,\n left: 0,\n })}\n >\n <Box sx={{ display: 'flex', alignItems: 'center', paddingBottom: 0.5, width: '100%' }}>\n <Box\n sx={{\n width: 8,\n height: 8,\n borderRadius: '50%',\n backgroundColor: annotation.color ?? DEFAULT_ANNOTATION_COLOR,\n marginRight: 1,\n flexShrink: 0,\n }}\n />\n <Box sx={{ flexGrow: 1, minWidth: 0 }}>\n <Typography variant=\"caption\">\n {start.formattedDate} - <strong>{start.formattedTime}</strong>\n </Typography>\n {end && (\n <>\n <Typography variant=\"caption\">{' → '}</Typography>\n <Typography variant=\"caption\">\n {end.formattedDate} - <strong>{end.formattedTime}</strong>\n </Typography>\n </>\n )}\n </Box>\n {enablePinning && (\n <Stack direction=\"row\" alignItems=\"center\" sx={{ marginLeft: 1, flexShrink: 0 }}>\n <Typography sx={{ marginRight: 0.5, fontSize: 11, verticalAlign: 'middle' }}>\n {isPinned ? UNPIN_TOOLTIP_HELP_TEXT : PIN_TOOLTIP_HELP_TEXT}\n </Typography>\n {isPinned ? (\n <Pin\n onClick={() => {\n if (onUnpinClick !== undefined) onUnpinClick();\n }}\n sx={{ fontSize: 16, cursor: 'pointer' }}\n />\n ) : (\n <PinOutline sx={{ fontSize: 16 }} />\n )}\n </Stack>\n )}\n </Box>\n <Divider sx={(theme) => ({ width: '100%', borderColor: theme.palette.grey['500'] })} />\n </Box>\n <Box sx={(theme) => ({ padding: theme.spacing(0.5, 2, 1.5, 2) })}>\n {annotation.title && (\n <Typography variant=\"caption\" sx={{ display: 'block', fontWeight: 'bold', marginBottom: 0.5 }}>\n {annotation.title}\n </Typography>\n )}\n {annotation.legend && (\n <Typography variant=\"caption\" sx={{ display: 'block', marginBottom: 0.5 }}>\n {annotation.legend}\n </Typography>\n )}\n {annotation.tags && Object.keys(annotation.tags).length > 0 && (\n <Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 0.5, marginTop: 0.5 }}>\n {Object.entries(annotation.tags).map(([key, value]) => (\n <Box\n key={key}\n sx={(theme) => ({\n backgroundColor: theme.palette.grey['700'],\n borderRadius: '4px',\n padding: '2px 6px',\n fontSize: '0.7rem',\n fontFamily: 'monospace',\n })}\n >\n {key}: {value}\n </Box>\n ))}\n </Box>\n )}\n </Box>\n </Stack>\n </Box>\n </Portal>\n );\n}\n\n/**\n * Build ECharts series options for rendering annotations as markArea (range),\n * markLine (vertical dashed lines) and markPoint (triangle markers under the X-axis).\n */\nexport function buildAnnotationSeries(annotations: TimeSeriesAnnotation[] | undefined): LineSeriesOption[] {\n if (!annotations?.length) return [];\n\n const markAreaData: Array<[{ xAxis: number; itemStyle?: { color: string; opacity: number } }, { xAxis: number }]> =\n [];\n const markLineData: Array<{\n xAxis: number;\n lineStyle?: { color: string; width: number; type: 'dashed' | 'solid' | 'dotted' };\n label?: { show: boolean };\n annotationIndex?: number;\n }> = [];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const markPointData: any[] = [];\n\n annotations.forEach((annotation, index) => {\n const color = annotation.color ?? DEFAULT_ANNOTATION_COLOR;\n const opacity = 0.3;\n\n if (annotation.end !== undefined) {\n // Range annotation - use markArea and markLine (silent) + markers at start/end\n markLineData.push({\n xAxis: annotation.start,\n lineStyle: { color, width: 2, type: 'dashed' as const },\n label: { show: false },\n annotationIndex: index,\n });\n\n markLineData.push({\n xAxis: annotation.end,\n lineStyle: { color, width: 2, type: 'dashed' as const },\n label: { show: false },\n annotationIndex: index,\n });\n\n markAreaData.push([\n {\n xAxis: annotation.start,\n itemStyle: { color, opacity },\n },\n { xAxis: annotation.end },\n ]);\n\n // Add start and end markers\n for (const isStart of [true, false]) {\n markPointData.push({\n coord: [isStart ? annotation.start : annotation.end, 0],\n symbol: 'triangle',\n symbolSize: [12, 12],\n symbolRotate: 0,\n symbolOffset: [0, 4], // Position below X-axis\n itemStyle: { color },\n annotationIndex: index,\n emphasis: {\n disabled: true,\n },\n isStart: isStart,\n isEnd: !isStart,\n });\n }\n } else {\n // Point annotation - use markLine (silent) + single marker\n markLineData.push({\n xAxis: annotation.start,\n lineStyle: { color, width: 2, type: 'dashed' as const },\n label: { show: false },\n annotationIndex: index,\n });\n\n // Add point marker\n markPointData.push({\n coord: [annotation.start, 0],\n symbol: 'triangle',\n symbolSize: [12, 10],\n symbolRotate: 0,\n symbolOffset: [0, '120%'], // Position below X-axis\n itemStyle: { color },\n annotationIndex: index,\n isPoint: true,\n });\n }\n });\n\n const series: LineSeriesOption = {\n type: 'line',\n data: [],\n silent: false,\n markArea:\n markAreaData.length > 0\n ? {\n silent: true, // Make area silent, only markers are interactive\n data: markAreaData,\n label: {\n show: false,\n },\n }\n : undefined,\n markLine:\n markLineData.length > 0\n ? {\n silent: true, // Non-interactive: hovering the dashed line keeps the TimeSeries tooltip\n symbol: ['none', 'none'],\n data: markLineData,\n lineStyle: {\n type: 'dashed',\n },\n }\n : undefined,\n markPoint:\n markPointData.length > 0\n ? {\n silent: false, // Markers are interactive\n data: markPointData,\n label: {\n show: false,\n },\n }\n : undefined,\n };\n\n return [series];\n}\n"],"names":["Box","Divider","Portal","Stack","Typography","Pin","PinOutline","useResizeObserver","assembleTransform","getDateAndTime","getTooltipStyles","PIN_TOOLTIP_HELP_TEXT","TOOLTIP_BG_COLOR_FALLBACK","TOOLTIP_MAX_WIDTH","UNPIN_TOOLTIP_HELP_TEXT","useMousePosition","DEFAULT_ANNOTATION_COLOR","AnnotationTooltip","annotation","containerId","formatWithUserTimeZone","pinnedPos","enablePinning","onUnpinClick","mousePos","height","width","ref","tooltipRef","isPinned","containerElement","document","querySelector","undefined","maxHeight","getBoundingClientRect","transform","start","end","container","sx","theme","style","spacing","maxWidth","padding","backgroundColor","palette","designSystem","grey","position","top","left","display","alignItems","paddingBottom","borderRadius","color","marginRight","flexShrink","flexGrow","minWidth","variant","formattedDate","strong","formattedTime","direction","marginLeft","fontSize","verticalAlign","onClick","cursor","borderColor","title","fontWeight","marginBottom","legend","tags","Object","keys","length","flexWrap","gap","marginTop","entries","map","key","value","fontFamily","buildAnnotationSeries","annotations","markAreaData","markLineData","markPointData","forEach","index","opacity","push","xAxis","lineStyle","type","label","show","annotationIndex","itemStyle","isStart","coord","symbol","symbolSize","symbolRotate","symbolOffset","emphasis","disabled","isEnd","isPoint","series","data","silent","markArea","markLine","markPoint"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;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AA2D;YAC3Db,aAAaK,IAAI,CAAC;gBAChBC,OAAOhF,WAAWmB,KAAK;gBACvB8D,WAAW;oBAAE1C;oBAAO/B,OAAO;oBAAG0E,MAAM;gBAAkB;gBACtDC,OAAO;oBAAEC,MAAM;gBAAM;gBACrBC,iBAAiBR;YACnB;YAEA,mBAAmB;YACnBF,cAAcI,IAAI,CAAC;gBACjBS,OAAO;oBAACxF,WAAWmB,KAAK;oBAAE;iBAAE;gBAC5BsE,QAAQ;gBACRC,YAAY;oBAAC;oBAAI;iBAAG;gBACpBC,cAAc;gBACdC,cAAc;oBAAC;oBAAG;iBAAO;gBACzBN,WAAW;oBAAE/C;gBAAM;gBACnB8C,iBAAiBR;gBACjBmB,SAAS;YACX;QACF;IACF;IAEA,MAAMC,SAA2B;QAC/Bf,MAAM;QACNgB,MAAM,EAAE;QACRC,QAAQ;QACRC,UACE3B,aAAaX,MAAM,GAAG,IAClB;YACEqC,QAAQ;YACRD,MAAMzB;YACNU,OAAO;gBACLC,MAAM;YACR;QACF,IACArE;QACNsF,UACE3B,aAAaZ,MAAM,GAAG,IAClB;YACEqC,QAAQ;YACRV,QAAQ;gBAAC;gBAAQ;aAAO;YACxBS,MAAMxB;YACNO,WAAW;gBACTC,MAAM;YACR;QACF,IACAnE;QACNuF,WACE3B,cAAcb,MAAM,GAAG,IACnB;YACEqC,QAAQ;YACRD,MAAMvB;YACNQ,OAAO;gBACLC,MAAM;YACR;QACF,IACArE;IACR;IAEA,OAAO;QAACkF;KAAO;AACjB"}
|
|
1
|
+
{"version":3,"sources":["../../../src/annotations/AnnotationTooltip.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 { Box, Divider, Portal, Stack, Typography } from '@mui/material';\nimport type { CursorCoordinates } from '@perses-dev/components';\nimport {\n assembleTransform,\n getDateAndTime,\n getTooltipStyles,\n PIN_TOOLTIP_HELP_TEXT,\n TOOLTIP_BG_COLOR_FALLBACK,\n TOOLTIP_MAX_WIDTH,\n UNPIN_TOOLTIP_HELP_TEXT,\n useMousePosition,\n} from '@perses-dev/components';\nimport { DEFAULT_ANNOTATION_COLOR } from '@perses-dev/plugin-system';\nimport type { LineSeriesOption } from 'echarts';\nimport Pin from 'mdi-material-ui/Pin';\nimport PinOutline from 'mdi-material-ui/PinOutline';\nimport useResizeObserver from 'use-resize-observer';\n\nimport type { TimeSeriesAnnotation } from '../utils/annotation';\n\nexport interface AnnotationTooltipProps {\n annotation: TimeSeriesAnnotation;\n containerId?: string;\n formatWithUserTimeZone: (date: Date, formatString: string) => string;\n pinnedPos: CursorCoordinates | null;\n enablePinning?: boolean;\n onUnpinClick?: () => void;\n}\n\nexport function AnnotationTooltip({\n annotation,\n containerId,\n formatWithUserTimeZone,\n pinnedPos,\n enablePinning = true,\n onUnpinClick,\n}: AnnotationTooltipProps): JSX.Element | null {\n const mousePos = useMousePosition();\n const { height, width, ref: tooltipRef } = useResizeObserver<HTMLDivElement>();\n\n const isPinned = pinnedPos !== null;\n if (!isPinned && mousePos === null) return null;\n\n const containerElement = containerId ? document.querySelector(containerId) : undefined;\n const maxHeight = containerElement ? containerElement.getBoundingClientRect().height : undefined;\n const transform = assembleTransform(mousePos, pinnedPos, height ?? 0, width ?? 0, containerElement);\n\n const start = getDateAndTime(annotation.start, formatWithUserTimeZone);\n const end = annotation.end !== undefined ? getDateAndTime(annotation.end, formatWithUserTimeZone) : null;\n\n return (\n <Portal container={containerElement}>\n <Box ref={tooltipRef} sx={(theme) => getTooltipStyles(theme, pinnedPos, maxHeight)} style={{ transform }}>\n <Stack spacing={0.5}>\n <Box\n sx={(theme) => ({\n width: '100%',\n maxWidth: TOOLTIP_MAX_WIDTH,\n padding: theme.spacing(1.5, 2, 0.5, 2),\n backgroundColor: theme.palette.designSystem?.grey[800] ?? TOOLTIP_BG_COLOR_FALLBACK,\n position: 'sticky',\n top: 0,\n left: 0,\n })}\n >\n <Box sx={{ display: 'flex', alignItems: 'center', paddingBottom: 0.5, width: '100%' }}>\n <Box\n sx={{\n width: 8,\n height: 8,\n borderRadius: '50%',\n backgroundColor: annotation.color ?? DEFAULT_ANNOTATION_COLOR,\n marginRight: 1,\n flexShrink: 0,\n }}\n />\n <Box sx={{ flexGrow: 1, minWidth: 0 }}>\n <Typography variant=\"caption\">\n {start.formattedDate} - <strong>{start.formattedTime}</strong>\n </Typography>\n {end && (\n <>\n <Typography variant=\"caption\">{' → '}</Typography>\n <Typography variant=\"caption\">\n {end.formattedDate} - <strong>{end.formattedTime}</strong>\n </Typography>\n </>\n )}\n </Box>\n {enablePinning && (\n <Stack direction=\"row\" alignItems=\"center\" sx={{ marginLeft: 1, flexShrink: 0 }}>\n <Typography sx={{ marginRight: 0.5, fontSize: 11, verticalAlign: 'middle' }}>\n {isPinned ? UNPIN_TOOLTIP_HELP_TEXT : PIN_TOOLTIP_HELP_TEXT}\n </Typography>\n {isPinned ? (\n <Pin\n onClick={() => {\n if (onUnpinClick !== undefined) onUnpinClick();\n }}\n sx={{ fontSize: 16, cursor: 'pointer' }}\n />\n ) : (\n <PinOutline sx={{ fontSize: 16 }} />\n )}\n </Stack>\n )}\n </Box>\n <Divider sx={(theme) => ({ width: '100%', borderColor: theme.palette.grey['500'] })} />\n </Box>\n <Box sx={(theme) => ({ padding: theme.spacing(0.5, 2, 1.5, 2) })}>\n {annotation.title && (\n <Typography variant=\"caption\" sx={{ display: 'block', fontWeight: 'bold', marginBottom: 0.5 }}>\n {annotation.title}\n </Typography>\n )}\n {annotation.legend && (\n <Typography variant=\"caption\" sx={{ display: 'block', marginBottom: 0.5 }}>\n {annotation.legend}\n </Typography>\n )}\n {annotation.tags && Object.keys(annotation.tags).length > 0 && (\n <Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 0.5, marginTop: 0.5 }}>\n {Object.entries(annotation.tags).map(([key, value]) => (\n <Box\n key={key}\n sx={(theme) => ({\n backgroundColor: theme.palette.grey['700'],\n borderRadius: '4px',\n padding: '2px 6px',\n fontSize: '0.7rem',\n fontFamily: 'monospace',\n })}\n >\n {key}: {value}\n </Box>\n ))}\n </Box>\n )}\n </Box>\n </Stack>\n </Box>\n </Portal>\n );\n}\n\n/**\n * Build ECharts series options for rendering annotations as markArea (range),\n * markLine (vertical dashed lines) and markPoint (triangle markers under the X-axis).\n */\nexport function buildAnnotationSeries(annotations: TimeSeriesAnnotation[] | undefined): LineSeriesOption[] {\n if (!annotations?.length) return [];\n\n const markAreaData: Array<[{ xAxis: number; itemStyle?: { color: string; opacity: number } }, { xAxis: number }]> =\n [];\n const markLineData: Array<{\n xAxis: number;\n lineStyle?: { color: string; width: number; type: 'dashed' | 'solid' | 'dotted' };\n label?: { show: boolean };\n annotationIndex?: number;\n }> = [];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const markPointData: any[] = [];\n\n annotations.forEach((annotation, index) => {\n const color = annotation.color ?? DEFAULT_ANNOTATION_COLOR;\n const opacity = 0.3;\n\n if (annotation.end !== undefined) {\n // Range annotation - use markArea and markLine (silent) + markers at start/end\n markLineData.push({\n xAxis: annotation.start,\n lineStyle: { color, width: 2, type: 'dashed' as const },\n label: { show: false },\n annotationIndex: index,\n });\n\n markLineData.push({\n xAxis: annotation.end,\n lineStyle: { color, width: 2, type: 'dashed' as const },\n label: { show: false },\n annotationIndex: index,\n });\n\n markAreaData.push([\n {\n xAxis: annotation.start,\n itemStyle: { color, opacity },\n },\n { xAxis: annotation.end },\n ]);\n\n // Add start and end markers\n for (const isStart of [true, false]) {\n markPointData.push({\n coord: [isStart ? annotation.start : annotation.end, 0],\n symbol: 'triangle',\n symbolSize: [12, 12],\n symbolRotate: 0,\n symbolOffset: [0, 4], // Position below X-axis\n itemStyle: { color },\n annotationIndex: index,\n emphasis: {\n disabled: true,\n },\n isStart: isStart,\n isEnd: !isStart,\n });\n }\n } else {\n // Point annotation - use markLine (silent) + single marker\n markLineData.push({\n xAxis: annotation.start,\n lineStyle: { color, width: 2, type: 'dashed' as const },\n label: { show: false },\n annotationIndex: index,\n });\n\n // Add point marker\n markPointData.push({\n coord: [annotation.start, 0],\n symbol: 'triangle',\n symbolSize: [12, 10],\n symbolRotate: 0,\n symbolOffset: [0, '120%'], // Position below X-axis\n itemStyle: { color },\n annotationIndex: index,\n isPoint: true,\n });\n }\n });\n\n const series: LineSeriesOption = {\n type: 'line',\n data: [],\n silent: false,\n markArea:\n markAreaData.length > 0\n ? {\n silent: true, // Make area silent, only markers are interactive\n data: markAreaData,\n label: {\n show: false,\n },\n }\n : undefined,\n markLine:\n markLineData.length > 0\n ? {\n silent: true, // Non-interactive: hovering the dashed line keeps the TimeSeries tooltip\n symbol: ['none', 'none'],\n data: markLineData,\n lineStyle: {\n type: 'dashed',\n },\n }\n : undefined,\n markPoint:\n markPointData.length > 0\n ? {\n silent: false, // Markers are interactive\n data: markPointData,\n label: {\n show: false,\n },\n }\n : undefined,\n };\n\n return [series];\n}\n"],"names":["Box","Divider","Portal","Stack","Typography","assembleTransform","getDateAndTime","getTooltipStyles","PIN_TOOLTIP_HELP_TEXT","TOOLTIP_BG_COLOR_FALLBACK","TOOLTIP_MAX_WIDTH","UNPIN_TOOLTIP_HELP_TEXT","useMousePosition","DEFAULT_ANNOTATION_COLOR","Pin","PinOutline","useResizeObserver","AnnotationTooltip","annotation","containerId","formatWithUserTimeZone","pinnedPos","enablePinning","onUnpinClick","mousePos","height","width","ref","tooltipRef","isPinned","containerElement","document","querySelector","undefined","maxHeight","getBoundingClientRect","transform","start","end","container","sx","theme","style","spacing","maxWidth","padding","backgroundColor","palette","designSystem","grey","position","top","left","display","alignItems","paddingBottom","borderRadius","color","marginRight","flexShrink","flexGrow","minWidth","variant","formattedDate","strong","formattedTime","direction","marginLeft","fontSize","verticalAlign","onClick","cursor","borderColor","title","fontWeight","marginBottom","legend","tags","Object","keys","length","flexWrap","gap","marginTop","entries","map","key","value","fontFamily","buildAnnotationSeries","annotations","markAreaData","markLineData","markPointData","forEach","index","opacity","push","xAxis","lineStyle","type","label","show","annotationIndex","itemStyle","isStart","coord","symbol","symbolSize","symbolRotate","symbolOffset","emphasis","disabled","isEnd","isPoint","series","data","silent","markArea","markLine","markPoint"],"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,EAAEC,OAAO,EAAEC,MAAM,EAAEC,KAAK,EAAEC,UAAU,QAAQ,gBAAgB;AAExE,SACEC,iBAAiB,EACjBC,cAAc,EACdC,gBAAgB,EAChBC,qBAAqB,EACrBC,yBAAyB,EACzBC,iBAAiB,EACjBC,uBAAuB,EACvBC,gBAAgB,QACX,yBAAyB;AAChC,SAASC,wBAAwB,QAAQ,4BAA4B;AAErE,OAAOC,SAAS,sBAAsB;AACtC,OAAOC,gBAAgB,6BAA6B;AACpD,OAAOC,uBAAuB,sBAAsB;AAapD,OAAO,SAASC,kBAAkB,EAChCC,UAAU,EACVC,WAAW,EACXC,sBAAsB,EACtBC,SAAS,EACTC,gBAAgB,IAAI,EACpBC,YAAY,EACW;IACvB,MAAMC,WAAWZ;IACjB,MAAM,EAAEa,MAAM,EAAEC,KAAK,EAAEC,KAAKC,UAAU,EAAE,GAAGZ;IAE3C,MAAMa,WAAWR,cAAc;IAC/B,IAAI,CAACQ,YAAYL,aAAa,MAAM,OAAO;IAE3C,MAAMM,mBAAmBX,cAAcY,SAASC,aAAa,CAACb,eAAec;IAC7E,MAAMC,YAAYJ,mBAAmBA,iBAAiBK,qBAAqB,GAAGV,M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ACArE;IACR;IAEA,OAAO;QAACkF;KAAO;AACjB"}
|
package/lib/bootstrap.js
CHANGED
|
@@ -11,8 +11,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
11
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
|
-
import React from
|
|
15
|
-
import ReactDOM from
|
|
14
|
+
import React from "react";
|
|
15
|
+
import ReactDOM from "react-dom/client";
|
|
16
16
|
const root = ReactDOM.createRoot(document.getElementById('root'));
|
|
17
17
|
root.render(/*#__PURE__*/ _jsx(React.StrictMode, {}));
|
|
18
18
|
|
package/lib/getPluginModule.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPluginModule.d.ts","sourceRoot":"","sources":["../../src/getPluginModule.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,oBAAoB,EAAoB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"getPluginModule.d.ts","sourceRoot":"","sources":["../../src/getPluginModule.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,oBAAoB,EAAoB,MAAM,2BAA2B,CAAC;AAIxF;;GAEG;AACH,wBAAgB,eAAe,IAAI,oBAAoB,CAUtD"}
|
package/lib/getPluginModule.js
CHANGED
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
import packageJson from
|
|
13
|
+
import packageJson from "../package.json" with {
|
|
14
|
+
type: 'json'
|
|
15
|
+
};
|
|
14
16
|
/**
|
|
15
17
|
* Returns the plugin module information from package.json
|
|
16
18
|
*/ export function getPluginModule() {
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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 type { PluginModuleResource, PluginModuleSpec } from '@perses-dev/plugin-system';\n\nimport packageJson from '../package.json' with { type: '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","type","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;AAIjC,OAAOA,iBAAiB,uBAAuB;IAAEC,MAAM;AAAO,EAAE;AAEhE;;CAEC,GACD,OAAO,SAASC;IACd,MAAM,EAAEC,IAAI,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAGL;IAClC,OAAO;QACLM,MAAM;QACNC,UAAU;YACRJ;YACAC;QACF;QACAI,MAAMH;IACR;AACF"}
|
package/lib/index-federation.js
CHANGED
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
import(
|
|
13
|
+
import("./bootstrap.js");
|
|
14
14
|
|
|
15
15
|
//# sourceMappingURL=index-federation.js.map
|
package/lib/index.js
CHANGED
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
export { getPluginModule } from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
16
|
-
export * from
|
|
17
|
-
export * from
|
|
18
|
-
export * from
|
|
19
|
-
export * from
|
|
20
|
-
export * from
|
|
21
|
-
export * from
|
|
13
|
+
export { getPluginModule } from "./getPluginModule.js";
|
|
14
|
+
export * from "./TimeSeriesChart.js";
|
|
15
|
+
export * from "./GeneralSettingsEditor.js";
|
|
16
|
+
export * from "./QuerySettingsEditor.js";
|
|
17
|
+
export * from "./VisualOptionsEditor.js";
|
|
18
|
+
export * from "./YAxisOptionsEditor.js";
|
|
19
|
+
export * from "./TimeSeriesChartPanel.js";
|
|
20
|
+
export * from "./TimeSeriesChartBase.js";
|
|
21
|
+
export * from "./time-series-chart-model.js";
|
|
22
22
|
|
|
23
23
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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 * from './TimeSeriesChart';\nexport * from './GeneralSettingsEditor';\nexport * from './QuerySettingsEditor';\nexport * from './VisualOptionsEditor';\nexport * from './YAxisOptionsEditor';\nexport * from './TimeSeriesChartPanel';\nexport * from './TimeSeriesChartBase';\nexport * from './time-series-chart-model';\n"],"names":["getPluginModule"],"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,
|
|
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 * from './TimeSeriesChart';\nexport * from './GeneralSettingsEditor';\nexport * from './QuerySettingsEditor';\nexport * from './VisualOptionsEditor';\nexport * from './YAxisOptionsEditor';\nexport * from './TimeSeriesChartPanel';\nexport * from './TimeSeriesChartBase';\nexport * from './time-series-chart-model';\n"],"names":["getPluginModule"],"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,uBAAoB;AACpD,cAAc,uBAAoB;AAClC,cAAc,6BAA0B;AACxC,cAAc,2BAAwB;AACtC,cAAc,2BAAwB;AACtC,cAAc,0BAAuB;AACrC,cAAc,4BAAyB;AACvC,cAAc,2BAAwB;AACtC,cAAc,+BAA4B"}
|
package/lib/setup-tests.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|
|
1
|
+
import '@testing-library/jest-dom/vitest';
|
|
2
2
|
//# sourceMappingURL=setup-tests.d.ts.map
|
package/lib/setup-tests.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-tests.d.ts","sourceRoot":"","sources":["../../src/setup-tests.ts"],"names":[],"mappings":"AAaA,OAAO,
|
|
1
|
+
{"version":3,"file":"setup-tests.d.ts","sourceRoot":"","sources":["../../src/setup-tests.ts"],"names":[],"mappings":"AAaA,OAAO,kCAAkC,CAAC"}
|
package/lib/setup-tests.js
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
import
|
|
13
|
+
import "@testing-library/jest-dom/vitest";
|
|
14
14
|
// Always mock e-charts during tests since we don't have a proper canvas in jsdom
|
|
15
|
-
|
|
15
|
+
vi.mock('echarts/core');
|
|
16
16
|
|
|
17
17
|
//# sourceMappingURL=setup-tests.js.map
|
package/lib/setup-tests.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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\
|
|
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/vitest';\n\n// Always mock e-charts during tests since we don't have a proper canvas in jsdom\nvi.mock('echarts/core');\n"],"names":["vi","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,mCAAmC;AAE1C,iFAAiF;AACjFA,GAAGC,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock-query-results.d.ts","sourceRoot":"","sources":["../../../src/test/mock-query-results.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"mock-query-results.d.ts","sourceRoot":"","sources":["../../../src/test/mock-query-results.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,eAAO,MAAM,wCAAwC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DpD,CAAC;AAEF,eAAO,MAAM,yCAAyC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDrD,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE,cAsC9C,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,cAgC/C,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgElC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/test/mock-query-results.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 { TimeSeriesData } from '@perses-dev/spec';\n\nexport const MOCK_TIME_SERIES_QUERY_RESULT_MULTIVALUE = [\n {\n status: 'success',\n fetchStatus: 'idle',\n isLoading: false,\n isSuccess: true,\n isError: false,\n data: {\n timeRange: {\n start: new Date(1666625490000),\n end: new Date(1666625535000),\n },\n stepMs: 24379,\n series: [\n {\n name: 'device=\"/dev/vda1\", env=\"demo\", fstype=\"ext4\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/\"',\n values: [\n [1666479357903, 0.27700745551584494],\n [1666479382282, 0.27701284657366565],\n ],\n labels: {\n device: '/dev/vda1',\n env: 'demo',\n fstype: 'ext4',\n instance: 'demo.do.prometheus.io:9100',\n job: 'node',\n mountpoint: '/',\n },\n },\n {\n name: 'device=\"/dev/vda15\", env=\"demo\", fstype=\"vfat\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/boot/efi\"',\n values: [\n [1666479357903, 0.08486496097624885],\n [1666479382282, 0.08486496097624885],\n ],\n labels: {\n device: '/dev/vda15',\n env: 'demo',\n fstype: 'vfat',\n instance: 'demo.do.prometheus.io:9100',\n job: 'node',\n mountpoint: '/boot/efi',\n },\n },\n ],\n },\n dataUpdatedAt: 1666500979895,\n error: null,\n errorUpdatedAt: 0,\n failureCount: 0,\n errorUpdateCount: 0,\n isFetched: true,\n isFetchedAfterMount: true,\n isFetching: false,\n isRefetching: false,\n isLoadingError: false,\n isPaused: false,\n isPlaceholderData: false,\n isPreviousData: false,\n isRefetchError: false,\n isStale: true,\n },\n];\n\nexport const MOCK_TIME_SERIES_QUERY_RESULT_SINGLEVALUE = [\n {\n status: 'success',\n fetchStatus: 'idle',\n isLoading: false,\n isSuccess: true,\n isError: false,\n data: {\n timeRange: {\n start: new Date(1666625535000),\n end: new Date(1666625535000),\n },\n stepMs: 24379,\n series: [\n {\n name: 'device=\"/dev/vda1\", env=\"demo\", fstype=\"ext4\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/\"',\n values: [[1666479357903, 0.27700745551584494]],\n labels: {\n device: '/dev/vda1',\n env: 'demo',\n fstype: 'ext4',\n instance: 'demo.do.prometheus.io:9100',\n job: 'node',\n mountpoint: '/',\n },\n },\n {\n name: 'device=\"/dev/vda15\", env=\"demo\", fstype=\"vfat\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/boot/efi\"',\n values: [[1666479357903, 0.08486496097624885]],\n labels: {\n device: '/dev/vda15',\n env: 'demo',\n fstype: 'vfat',\n instance: 'demo.do.prometheus.io:9100',\n job: 'node',\n mountpoint: '/boot/efi',\n },\n },\n ],\n },\n dataUpdatedAt: 1666500979895,\n error: null,\n errorUpdatedAt: 0,\n failureCount: 0,\n errorUpdateCount: 0,\n isFetched: true,\n isFetchedAfterMount: true,\n isFetching: false,\n isRefetching: false,\n isLoadingError: false,\n isPaused: false,\n isPlaceholderData: false,\n isPreviousData: false,\n isRefetchError: false,\n isStale: true,\n },\n];\n\nexport const MOCK_TIME_SERIES_DATA_MULTIVALUE: TimeSeriesData = {\n timeRange: {\n start: new Date(1666625490000),\n end: new Date(1666625535000),\n },\n stepMs: 24379,\n series: [\n {\n name: 'device=\"/dev/vda1\", env=\"demo\", fstype=\"ext4\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/\"',\n values: [\n [1666479357903, 0.27700745551584494],\n [1666479382282, 0.27701284657366565],\n ],\n labels: {\n device: '/dev/vda1',\n env: 'demo',\n fstype: 'ext4',\n instance: 'demo.do.prometheus.io:9100',\n job: 'node',\n mountpoint: '/',\n },\n },\n {\n name: 'device=\"/dev/vda15\", env=\"demo\", fstype=\"vfat\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/boot/efi\"',\n values: [\n [1666479357903, 0.08486496097624885],\n [1666479382282, 0.08486496097624885],\n ],\n labels: {\n device: '/dev/vda15',\n env: 'demo',\n fstype: 'vfat',\n instance: 'demo.do.prometheus.io:9100',\n job: 'node',\n mountpoint: '/boot/efi',\n },\n },\n ],\n};\n\nexport const MOCK_TIME_SERIES_DATA_SINGLEVALUE: TimeSeriesData = {\n timeRange: {\n start: new Date(1666625535000),\n end: new Date(1666625535000),\n },\n stepMs: 24379,\n series: [\n {\n name: 'device=\"/dev/vda1\", env=\"demo\", fstype=\"ext4\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/\"',\n values: [[1666479357903, 0.27700745551584494]],\n labels: {\n device: '/dev/vda1',\n env: 'demo',\n fstype: 'ext4',\n instance: 'demo.do.prometheus.io:9100',\n job: 'node',\n mountpoint: '/',\n },\n },\n {\n name: 'device=\"/dev/vda15\", env=\"demo\", fstype=\"vfat\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/boot/efi\"',\n values: [[1666479357903, 0.08486496097624885]],\n labels: {\n device: '/dev/vda15',\n env: 'demo',\n fstype: 'vfat',\n instance: 'demo.do.prometheus.io:9100',\n job: 'node',\n mountpoint: '/boot/efi',\n },\n },\n ],\n};\n\nexport const MOCK_NULL_QUERY_RESULT = [\n {\n status: 'success',\n fetchStatus: 'idle',\n isLoading: false,\n isSuccess: true,\n isError: false,\n data: {\n timeRange: {\n start: new Date(1677376110000),\n end: new Date(1677376410000),\n },\n stepMs: 15000,\n series: [\n {\n name: 'node_memory_Buffers_bytes{env=\"demo\",instance=\"demo.do.prometheus.io:9100\",job=\"node\"}',\n values: [\n [1677376110000, 40000000],\n [1677376125000, 40000000],\n [1677376140000, null],\n [1677376155000, null],\n [1677376170000, null],\n [1677376185000, null],\n [1677376200000, null],\n [1677376215000, 40013824],\n [1677376230000, 40038400],\n [1677376245000, 40054784],\n [1677376260000, 40071168],\n [1677376275000, 40075264],\n [1677376290000, 40091648],\n [1677376305000, 40099840],\n [1677376320000, 40120320],\n [1677376335000, 40128512],\n [1677376350000, 40153088],\n [1677376365000, 40165376],\n [1677376380000, 40177664],\n [1677376395000, 40194048],\n [1677376410000, 40198144],\n ],\n formattedName: 'node_memory_Buffers_bytes{env=\"demo\",instance=\"demo.do.prometheus.io:9100\",job=\"node\"}',\n labels: {\n env: 'demo',\n instance: 'demo.do.prometheus.io:9100',\n job: 'node',\n },\n },\n ],\n },\n dataUpdatedAt: 1677376410000,\n error: null,\n errorUpdatedAt: 0,\n failureCount: 0,\n errorUpdateCount: 0,\n isFetched: true,\n isFetchedAfterMount: true,\n isFetching: false,\n isRefetching: false,\n isLoadingError: false,\n isPaused: false,\n isPlaceholderData: false,\n isPreviousData: false,\n isRefetchError: false,\n isStale: true,\n },\n];\n"],"names":["MOCK_TIME_SERIES_QUERY_RESULT_MULTIVALUE","status","fetchStatus","isLoading","isSuccess","isError","data","timeRange","start","Date","end","stepMs","series","name","values","labels","device","env","fstype","instance","job","mountpoint","dataUpdatedAt","error","errorUpdatedAt","failureCount","errorUpdateCount","isFetched","isFetchedAfterMount","isFetching","isRefetching","isLoadingError","isPaused","isPlaceholderData","isPreviousData","isRefetchError","isStale","MOCK_TIME_SERIES_QUERY_RESULT_SINGLEVALUE","MOCK_TIME_SERIES_DATA_MULTIVALUE","MOCK_TIME_SERIES_DATA_SINGLEVALUE","MOCK_NULL_QUERY_RESULT","formattedName"],"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;AAIjC,OAAO,MAAMA,2CAA2C;IACtD;QACEC,QAAQ;QACRC,aAAa;QACbC,WAAW;QACXC,WAAW;QACXC,SAAS;QACTC,MAAM;YACJC,WAAW;gBACTC,OAAO,IAAIC,KAAK;gBAChBC,KAAK,IAAID,KAAK;YAChB;YACAE,QAAQ;YACRC,QAAQ;gBACN;oBACEC,MAAM;oBACNC,QAAQ;wBACN;4BAAC;4BAAe;yBAAoB;wBACpC;4BAAC;4BAAe;yBAAoB;qBACrC;oBACDC,QAAQ;wBACNC,QAAQ;wBACRC,KAAK;wBACLC,QAAQ;wBACRC,UAAU;wBACVC,KAAK;wBACLC,YAAY;oBACd;gBACF;gBACA;oBACER,MAAM;oBACNC,QAAQ;wBACN;4BAAC;4BAAe;yBAAoB;wBAC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AS;wBACzB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAK;wBACrB;4BAAC;4BAAe;yBAAK;wBACrB;4BAAC;4BAAe;yBAAK;wBACrB;4BAAC;4BAAe;yBAAK;wBACrB;4BAAC;4BAAe;yBAAK;wBACrB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAS;qBAC1B;oBACD2B,eAAe;oBACf1B,QAAQ;wBACNE,KAAK;wBACLE,UAAU;wBACVC,KAAK;oBACP;gBACF;aACD;QACH;QACAE,eAAe;QACfC,OAAO;QACPC,gBAAgB;QAChBC,cAAc;QACdC,kBAAkB;QAClBC,WAAW;QACXC,qBAAqB;QACrBC,YAAY;QACZC,cAAc;QACdC,gBAAgB;QAChBC,UAAU;QACVC,mBAAmB;QACnBC,gBAAgB;QAChBC,gBAAgB;QAChBC,SAAS;IACX;CACD,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/test/mock-query-results.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 type { TimeSeriesData } from '@perses-dev/spec';\n\nexport const MOCK_TIME_SERIES_QUERY_RESULT_MULTIVALUE = [\n {\n status: 'success',\n fetchStatus: 'idle',\n isLoading: false,\n isSuccess: true,\n isError: false,\n data: {\n timeRange: {\n start: new Date(1666625490000),\n end: new Date(1666625535000),\n },\n stepMs: 24379,\n series: [\n {\n name: 'device=\"/dev/vda1\", env=\"demo\", fstype=\"ext4\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/\"',\n values: [\n [1666479357903, 0.27700745551584494],\n [1666479382282, 0.27701284657366565],\n ],\n labels: {\n device: '/dev/vda1',\n env: 'demo',\n fstype: 'ext4',\n instance: 'demo.do.prometheus.io:9100',\n job: 'node',\n mountpoint: '/',\n },\n },\n {\n name: 'device=\"/dev/vda15\", env=\"demo\", fstype=\"vfat\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/boot/efi\"',\n values: [\n [1666479357903, 0.08486496097624885],\n [1666479382282, 0.08486496097624885],\n ],\n labels: {\n device: '/dev/vda15',\n env: 'demo',\n fstype: 'vfat',\n instance: 'demo.do.prometheus.io:9100',\n job: 'node',\n mountpoint: '/boot/efi',\n },\n },\n ],\n },\n dataUpdatedAt: 1666500979895,\n error: null,\n errorUpdatedAt: 0,\n failureCount: 0,\n errorUpdateCount: 0,\n isFetched: true,\n isFetchedAfterMount: true,\n isFetching: false,\n isRefetching: false,\n isLoadingError: false,\n isPaused: false,\n isPlaceholderData: false,\n isPreviousData: false,\n isRefetchError: false,\n isStale: true,\n },\n];\n\nexport const MOCK_TIME_SERIES_QUERY_RESULT_SINGLEVALUE = [\n {\n status: 'success',\n fetchStatus: 'idle',\n isLoading: false,\n isSuccess: true,\n isError: false,\n data: {\n timeRange: {\n start: new Date(1666625535000),\n end: new Date(1666625535000),\n },\n stepMs: 24379,\n series: [\n {\n name: 'device=\"/dev/vda1\", env=\"demo\", fstype=\"ext4\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/\"',\n values: [[1666479357903, 0.27700745551584494]],\n labels: {\n device: '/dev/vda1',\n env: 'demo',\n fstype: 'ext4',\n instance: 'demo.do.prometheus.io:9100',\n job: 'node',\n mountpoint: '/',\n },\n },\n {\n name: 'device=\"/dev/vda15\", env=\"demo\", fstype=\"vfat\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/boot/efi\"',\n values: [[1666479357903, 0.08486496097624885]],\n labels: {\n device: '/dev/vda15',\n env: 'demo',\n fstype: 'vfat',\n instance: 'demo.do.prometheus.io:9100',\n job: 'node',\n mountpoint: '/boot/efi',\n },\n },\n ],\n },\n dataUpdatedAt: 1666500979895,\n error: null,\n errorUpdatedAt: 0,\n failureCount: 0,\n errorUpdateCount: 0,\n isFetched: true,\n isFetchedAfterMount: true,\n isFetching: false,\n isRefetching: false,\n isLoadingError: false,\n isPaused: false,\n isPlaceholderData: false,\n isPreviousData: false,\n isRefetchError: false,\n isStale: true,\n },\n];\n\nexport const MOCK_TIME_SERIES_DATA_MULTIVALUE: TimeSeriesData = {\n timeRange: {\n start: new Date(1666625490000),\n end: new Date(1666625535000),\n },\n stepMs: 24379,\n series: [\n {\n name: 'device=\"/dev/vda1\", env=\"demo\", fstype=\"ext4\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/\"',\n values: [\n [1666479357903, 0.27700745551584494],\n [1666479382282, 0.27701284657366565],\n ],\n labels: {\n device: '/dev/vda1',\n env: 'demo',\n fstype: 'ext4',\n instance: 'demo.do.prometheus.io:9100',\n job: 'node',\n mountpoint: '/',\n },\n },\n {\n name: 'device=\"/dev/vda15\", env=\"demo\", fstype=\"vfat\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/boot/efi\"',\n values: [\n [1666479357903, 0.08486496097624885],\n [1666479382282, 0.08486496097624885],\n ],\n labels: {\n device: '/dev/vda15',\n env: 'demo',\n fstype: 'vfat',\n instance: 'demo.do.prometheus.io:9100',\n job: 'node',\n mountpoint: '/boot/efi',\n },\n },\n ],\n};\n\nexport const MOCK_TIME_SERIES_DATA_SINGLEVALUE: TimeSeriesData = {\n timeRange: {\n start: new Date(1666625535000),\n end: new Date(1666625535000),\n },\n stepMs: 24379,\n series: [\n {\n name: 'device=\"/dev/vda1\", env=\"demo\", fstype=\"ext4\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/\"',\n values: [[1666479357903, 0.27700745551584494]],\n labels: {\n device: '/dev/vda1',\n env: 'demo',\n fstype: 'ext4',\n instance: 'demo.do.prometheus.io:9100',\n job: 'node',\n mountpoint: '/',\n },\n },\n {\n name: 'device=\"/dev/vda15\", env=\"demo\", fstype=\"vfat\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/boot/efi\"',\n values: [[1666479357903, 0.08486496097624885]],\n labels: {\n device: '/dev/vda15',\n env: 'demo',\n fstype: 'vfat',\n instance: 'demo.do.prometheus.io:9100',\n job: 'node',\n mountpoint: '/boot/efi',\n },\n },\n ],\n};\n\nexport const MOCK_NULL_QUERY_RESULT = [\n {\n status: 'success',\n fetchStatus: 'idle',\n isLoading: false,\n isSuccess: true,\n isError: false,\n data: {\n timeRange: {\n start: new Date(1677376110000),\n end: new Date(1677376410000),\n },\n stepMs: 15000,\n series: [\n {\n name: 'node_memory_Buffers_bytes{env=\"demo\",instance=\"demo.do.prometheus.io:9100\",job=\"node\"}',\n values: [\n [1677376110000, 40000000],\n [1677376125000, 40000000],\n [1677376140000, null],\n [1677376155000, null],\n [1677376170000, null],\n [1677376185000, null],\n [1677376200000, null],\n [1677376215000, 40013824],\n [1677376230000, 40038400],\n [1677376245000, 40054784],\n [1677376260000, 40071168],\n [1677376275000, 40075264],\n [1677376290000, 40091648],\n [1677376305000, 40099840],\n [1677376320000, 40120320],\n [1677376335000, 40128512],\n [1677376350000, 40153088],\n [1677376365000, 40165376],\n [1677376380000, 40177664],\n [1677376395000, 40194048],\n [1677376410000, 40198144],\n ],\n formattedName: 'node_memory_Buffers_bytes{env=\"demo\",instance=\"demo.do.prometheus.io:9100\",job=\"node\"}',\n labels: {\n env: 'demo',\n instance: 'demo.do.prometheus.io:9100',\n job: 'node',\n },\n },\n ],\n },\n dataUpdatedAt: 1677376410000,\n error: null,\n errorUpdatedAt: 0,\n failureCount: 0,\n errorUpdateCount: 0,\n isFetched: true,\n isFetchedAfterMount: true,\n isFetching: false,\n isRefetching: false,\n isLoadingError: false,\n isPaused: false,\n isPlaceholderData: false,\n isPreviousData: false,\n isRefetchError: false,\n isStale: true,\n },\n];\n"],"names":["MOCK_TIME_SERIES_QUERY_RESULT_MULTIVALUE","status","fetchStatus","isLoading","isSuccess","isError","data","timeRange","start","Date","end","stepMs","series","name","values","labels","device","env","fstype","instance","job","mountpoint","dataUpdatedAt","error","errorUpdatedAt","failureCount","errorUpdateCount","isFetched","isFetchedAfterMount","isFetching","isRefetching","isLoadingError","isPaused","isPlaceholderData","isPreviousData","isRefetchError","isStale","MOCK_TIME_SERIES_QUERY_RESULT_SINGLEVALUE","MOCK_TIME_SERIES_DATA_MULTIVALUE","MOCK_TIME_SERIES_DATA_SINGLEVALUE","MOCK_NULL_QUERY_RESULT","formattedName"],"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;AAIjC,OAAO,MAAMA,2CAA2C;IACtD;QACEC,QAAQ;QACRC,aAAa;QACbC,WAAW;QACXC,WAAW;QACXC,SAAS;QACTC,MAAM;YACJC,WAAW;gBACTC,OAAO,IAAIC,KAAK;gBAChBC,KAAK,IAAID,KAAK;YAChB;YACAE,QAAQ;YACRC,QAAQ;gBACN;oBACEC,MAAM;oBACNC,QAAQ;wBACN;4BAAC;4BAAe;yBAAoB;wBACpC;4BAAC;4BAAe;yBAAoB;qBACrC;oBACDC,QAAQ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AAM;YACJC,WAAW;gBACTC,OAAO,IAAIC,KAAK;gBAChBC,KAAK,IAAID,KAAK;YAChB;YACAE,QAAQ;YACRC,QAAQ;gBACN;oBACEC,MAAM;oBACNC,QAAQ;wBACN;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAK;wBACrB;4BAAC;4BAAe;yBAAK;wBACrB;4BAAC;4BAAe;yBAAK;wBACrB;4BAAC;4BAAe;yBAAK;wBACrB;4BAAC;4BAAe;yBAAK;wBACrB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAS;wBACzB;4BAAC;4BAAe;yBAAS;qBAC1B;oBACD2B,eAAe;oBACf1B,QAAQ;wBACNE,KAAK;wBACLE,UAAU;wBACVC,KAAK;oBACP;gBACF;aACD;QACH;QACAE,eAAe;QACfC,OAAO;QACPC,gBAAgB;QAChBC,cAAc;QACdC,kBAAkB;QAClBC,WAAW;QACXC,qBAAqB;QACrBC,YAAY;QACZC,cAAc;QACdC,gBAAgB;QAChBC,UAAU;QACVC,mBAAmB;QACnBC,gBAAgB;QAChBC,gBAAgB;QAChBC,SAAS;IACX;CACD,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FormatOptions, ThresholdOptions } from '@perses-dev/components';
|
|
2
|
-
import { OptionsEditorProps, LegendSpecOptions } from '@perses-dev/plugin-system';
|
|
3
|
-
import { Definition } from '@perses-dev/spec';
|
|
1
|
+
import type { FormatOptions, ThresholdOptions } from '@perses-dev/components';
|
|
2
|
+
import type { OptionsEditorProps, LegendSpecOptions } from '@perses-dev/plugin-system';
|
|
3
|
+
import type { Definition } from '@perses-dev/spec';
|
|
4
4
|
/**
|
|
5
5
|
* Line style options for time series charts.
|
|
6
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time-series-chart-model.d.ts","sourceRoot":"","sources":["../../src/time-series-chart-model.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"time-series-chart-model.d.ts","sourceRoot":"","sources":["../../src/time-series-chart-model.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,UAAU,CAAC,sBAAsB,CAAC;IACnF,IAAI,EAAE,iBAAiB,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,KAAK,CAAC,EAAE,2BAA2B,CAAC;IACpC,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,MAAM,CAAC,EAAE,4BAA4B,CAAC;IACtC,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,aAAa,CAAC,EAAE,oBAAoB,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OA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\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 { FormatOptions, ThresholdOptions } from '@perses-dev/components';\nimport { OptionsEditorProps, LegendSpecOptions } from '@perses-dev/plugin-system';\nimport { Definition } from '@perses-dev/spec';\n\n/**\n * Line style options for time series charts.\n */\nexport type LineStyleType = 'solid' | 'dashed' | 'dotted';\n\n/**\n * The schema for a TimeSeriesChart panel.\n */\nexport interface TimeSeriesChartDefinition extends Definition<TimeSeriesChartOptions> {\n kind: 'TimeSeriesChart';\n}\n\n/**\n * The Options object supported by the TimeSeriesChartPanel plugin.\n */\nexport interface TimeSeriesChartOptions {\n legend?: LegendSpecOptions;\n yAxis?: TimeSeriesChartYAxisOptions;\n thresholds?: ThresholdOptions;\n visual?: TimeSeriesChartVisualOptions;\n tooltip?: TooltipSpecOptions;\n querySettings?: QuerySettingsOptions[];\n}\n\nexport interface QuerySettingsOptions {\n queryIndex: number;\n colorMode?: 'fixed' | 'fixed-single';\n colorValue?: string;\n lineStyle?: LineStyleType;\n areaOpacity?: number;\n format?: FormatOptions;\n /**\n * If true, the query's series values are negated for display so they render\n * below the X axis. The original (positive) values are preserved for legend\n * calculations and CSV export, matching Grafana's `transform: \"negative-Y\"` behavior.\n */\n negativeY?: boolean;\n stack?: boolean;\n}\n\nexport type TimeSeriesChartOptionsEditorProps = OptionsEditorProps<TimeSeriesChartOptions>;\n\nexport interface TimeSeriesChartYAxisOptions {\n show?: boolean;\n label?: string;\n format?: FormatOptions;\n min?: number;\n max?: number;\n logBase?: LOG_BASE;\n}\n\nexport interface TooltipSpecOptions {\n enablePinning: boolean;\n}\n\nexport interface TimeSeriesChartPaletteOptions {\n mode: 'auto' | 'categorical';\n}\n\nexport type TimeSeriesChartVisualOptions = {\n display?: 'line' | 'bar';\n lineWidth?: number;\n lineStyle?: LineStyleType;\n areaOpacity?: number;\n showPoints?: 'auto' | 'always';\n palette?: TimeSeriesChartPaletteOptions;\n pointRadius?: number;\n stack?: StackOptions;\n connectNulls?: boolean;\n};\n\nexport const DEFAULT_FORMAT: FormatOptions = {\n unit: 'decimal',\n shortValues: true,\n};\n\nexport const DEFAULT_Y_AXIS: TimeSeriesChartYAxisOptions = {\n show: true,\n label: '',\n format: DEFAULT_FORMAT,\n min: undefined,\n max: undefined,\n logBase: undefined,\n};\n\nexport const Y_AXIS_CONFIG = {\n show: { label: 'Show' },\n label: { label: 'Label' },\n unit: { label: 'Unit' },\n min: { label: 'Min' },\n max: { label: 'Max' },\n logBase: { label: 'Log Base' },\n};\n\nexport const DEFAULT_DISPLAY = 'line';\nexport const DEFAULT_LINE_WIDTH = 1.25;\nexport const DEFAULT_LINE_STYLE = 'solid';\nexport const DEFAULT_AREA_OPACITY = 0;\n// How much larger datapoint symbols are than line width, also applied in VisualOptionsEditor.\nexport const POINT_SIZE_OFFSET = 1.5;\nexport const DEFAULT_POINT_RADIUS = DEFAULT_LINE_WIDTH + POINT_SIZE_OFFSET;\nexport const DEFAULT_CONNECT_NULLS = false;\n\nexport const DEFAULT_VISUAL: TimeSeriesChartVisualOptions = {\n display: DEFAULT_DISPLAY,\n lineWidth: DEFAULT_LINE_WIDTH,\n lineStyle: DEFAULT_LINE_STYLE,\n areaOpacity: DEFAULT_AREA_OPACITY,\n pointRadius: DEFAULT_POINT_RADIUS,\n connectNulls: DEFAULT_CONNECT_NULLS,\n};\n\n// Controls how often static threshold values should be plotted so threshold data shows\n// in tooltip without flicker.\nexport const THRESHOLD_PLOT_INTERVAL = 15;\n\nexport const VISUAL_CONFIG = {\n lineWidth: {\n label: 'Line Width',\n testId: 'slider-line-width',\n min: 0.25,\n max: 3,\n step: 0.25,\n },\n lineStyle: {\n label: 'Line Style',\n },\n pointRadius: {\n label: 'Point Radius',\n testId: 'slider-point-radius',\n min: 0,\n max: 6,\n step: 0.25,\n },\n areaOpacity: {\n label: 'Area Opacity',\n testId: 'slider-area-opacity',\n min: 0,\n max: 1,\n step: 0.05,\n },\n stack: {\n label: 'Stack Series',\n },\n connectNulls: {\n label: 'Connect Nulls',\n },\n};\n\n// None is equivalent to undefined since stack is optional\nexport type StackOptions = 'none' | 'all'; // TODO: add percent option support\n\nexport const STACK_CONFIG = {\n none: { label: 'None' },\n all: { label: 'All' },\n // TODO: enable option after 'Percent' implemented\n // percent: { label: 'Percent', disabled: true }, // hidden since not implemented yet\n};\n\nexport const STACK_OPTIONS = Object.entries(STACK_CONFIG).map(([id, config]) => {\n return {\n id: id as StackOptions,\n ...config,\n };\n});\n\nexport const LINE_STYLE_CONFIG = {\n solid: { label: 'Solid' },\n dashed: { label: 'Dashes' },\n dotted: { label: 'Dots' },\n};\n\nexport const OPACITY_CONFIG = {\n label: 'Opacity',\n testId: 'slider-opacity',\n min: 0,\n max: 1,\n step: 0.05,\n};\n\n// LogBase outlines the allowed log bases for the log-supported charts.\nexport type LOG_BASE = undefined | 2 | 10;\n\n// Single source of truth for log base configuration\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\n// Options array for SettingsAutocomplete\nexport const LOG_BASE_OPTIONS = Object.entries(LOG_BASE_CONFIG).map(([id, config]) => ({\n id: id as string,\n ...config,\n}));\n\n// Both of these constants help produce a value that is LESS THAN the initial value.\n// For positive values, we multiply by a number less than 1 to get this outcome.\n// For negative values, we multiply to a number greater than 1 to get this outcome.\nexport const POSITIVE_MIN_VALUE_MULTIPLIER = 0.8;\nexport const NEGATIVE_MIN_VALUE_MULTIPLIER = 1.2;\n\n/**\n * Creates an initial/empty options object for the TimeSeriesChartPanel.\n */\nexport function createInitialTimeSeriesChartOptions(): TimeSeriesChartOptions {\n return {};\n}\n"],"names":["DEFAULT_FORMAT","unit","shortValues","DEFAULT_Y_AXIS","show","label","format","min","undefined","max","logBase","Y_AXIS_CONFIG","DEFAULT_DISPLAY","DEFAULT_LINE_WIDTH","DEFAULT_LINE_STYLE","DEFAULT_AREA_OPACITY","POINT_SIZE_OFFSET","DEFAULT_POINT_RADIUS","DEFAULT_CONNECT_NULLS","DEFAULT_VISUAL","display","lineWidth","lineStyle","areaOpacity","pointRadius","connectNulls","THRESHOLD_PLOT_INTERVAL","VISUAL_CONFIG","testId","step","stack","STACK_CONFIG","none","all","STACK_OPTIONS","Object","entries","map","id","config","LINE_STYLE_CONFIG","solid","dashed","dotted","OPACITY_CONFIG","LOG_BASE_CONFIG","log","LOG_BASE_OPTIONS","POSITIVE_MIN_VALUE_MULTIPLIER","NEGATIVE_MIN_VALUE_MULTIPLIER","createInitialTimeSeriesChartOptions"],"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;AA6EjC,OAAO,MAAMA,iBAAgC;IAC3CC,MAAM;IACNC,aAAa;AACf,EAAE;AAEF,OAAO,MAAMC,iBAA8C;IACzDC,MAAM;IACNC,OAAO;IACPC,QAAQN;IACRO,KAAKC;IACLC,KAAKD;IACLE,SAASF;AACX,EAAE;AAEF,OAAO,MAAMG,gBAAgB;IAC3BP,MAAM;QAAEC,OAAO;IAAO;IACtBA,OAAO;QAAEA,OAAO;IAAQ;IACxBJ,MAAM;QAAEI,OAAO;IAAO;IACtBE,KAAK;QAAEF,OAAO;IAAM;IACpBI,KAAK;QAAEJ,OAAO;IAAM;IACpBK,SAAS;QAAEL,OAAO;IAAW;AAC/B,EAAE;AAEF,OAAO,MAAMO,kBAAkB,OAAO;AACtC,OAAO,MAAMC,qBAA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OAAO;IACPuB,QAAQ;IACRrB,KAAK;IACLE,KAAK;IACLoB,MAAM;AACR,EAAE;AAKF,oDAAoD;AACpD,OAAO,MAAMgB,kBAAoE;IAC/Eb,MAAM;QAAE3B,OAAO;QAAQyC,KAAKtC;IAAU;IACtC,KAAK;QAAEH,OAAO;QAAKyC,KAAK;IAAE;IAC1B,MAAM;QAAEzC,OAAO;QAAMyC,KAAK;IAAG;AAC/B,EAAE;AAEF,yCAAyC;AACzC,OAAO,MAAMC,mBAAmBZ,OAAOC,OAAO,CAACS,iBAAiBR,GAAG,CAAC,CAAC,CAACC,IAAIC,OAAO,GAAM,CAAA;QACrFD,IAAIA;QACJ,GAAGC,MAAM;IACX,CAAA,GAAI;AAEJ,oFAAoF;AACpF,gFAAgF;AAChF,mFAAmF;AACnF,OAAO,MAAMS,gCAAgC,IAAI;AACjD,OAAO,MAAMC,gCAAgC,IAAI;AAEjD;;CAEC,GACD,OAAO,SAASC;IACd,OAAO,CAAC;AACV"}
|
|
1
|
+
{"version":3,"sources":["../../src/time-series-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 type { FormatOptions, ThresholdOptions } from '@perses-dev/components';\nimport type { OptionsEditorProps, LegendSpecOptions } from '@perses-dev/plugin-system';\nimport type { Definition } from '@perses-dev/spec';\n\n/**\n * Line style options for time series charts.\n */\nexport type LineStyleType = 'solid' | 'dashed' | 'dotted';\n\n/**\n * The schema for a TimeSeriesChart panel.\n */\nexport interface TimeSeriesChartDefinition extends Definition<TimeSeriesChartOptions> {\n kind: 'TimeSeriesChart';\n}\n\n/**\n * The Options object supported by the TimeSeriesChartPanel plugin.\n */\nexport interface TimeSeriesChartOptions {\n legend?: LegendSpecOptions;\n yAxis?: TimeSeriesChartYAxisOptions;\n thresholds?: ThresholdOptions;\n visual?: TimeSeriesChartVisualOptions;\n tooltip?: TooltipSpecOptions;\n querySettings?: QuerySettingsOptions[];\n}\n\nexport interface QuerySettingsOptions {\n queryIndex: number;\n colorMode?: 'fixed' | 'fixed-single';\n colorValue?: string;\n lineStyle?: LineStyleType;\n areaOpacity?: number;\n format?: FormatOptions;\n /**\n * If true, the query's series values are negated for display so they render\n * below the X axis. The original (positive) values are preserved for legend\n * calculations and CSV export, matching Grafana's `transform: \"negative-Y\"` behavior.\n */\n negativeY?: boolean;\n stack?: boolean;\n}\n\nexport type TimeSeriesChartOptionsEditorProps = OptionsEditorProps<TimeSeriesChartOptions>;\n\nexport interface TimeSeriesChartYAxisOptions {\n show?: boolean;\n label?: string;\n format?: FormatOptions;\n min?: number;\n max?: number;\n logBase?: LOG_BASE;\n}\n\nexport interface TooltipSpecOptions {\n enablePinning: boolean;\n}\n\nexport interface TimeSeriesChartPaletteOptions {\n mode: 'auto' | 'categorical';\n}\n\nexport type TimeSeriesChartVisualOptions = {\n display?: 'line' | 'bar';\n lineWidth?: number;\n lineStyle?: LineStyleType;\n areaOpacity?: number;\n showPoints?: 'auto' | 'always';\n palette?: TimeSeriesChartPaletteOptions;\n pointRadius?: number;\n stack?: StackOptions;\n connectNulls?: boolean;\n};\n\nexport const DEFAULT_FORMAT: FormatOptions = {\n unit: 'decimal',\n shortValues: true,\n};\n\nexport const DEFAULT_Y_AXIS: TimeSeriesChartYAxisOptions = {\n show: true,\n label: '',\n format: DEFAULT_FORMAT,\n min: undefined,\n max: undefined,\n logBase: undefined,\n};\n\nexport const Y_AXIS_CONFIG = {\n show: { label: 'Show' },\n label: { label: 'Label' },\n unit: { label: 'Unit' },\n min: { label: 'Min' },\n max: { label: 'Max' },\n logBase: { label: 'Log Base' },\n};\n\nexport const DEFAULT_DISPLAY = 'line';\nexport const DEFAULT_LINE_WIDTH = 1.25;\nexport const DEFAULT_LINE_STYLE = 'solid';\nexport const DEFAULT_AREA_OPACITY = 0;\n// How much larger datapoint symbols are than line width, also applied in VisualOptionsEditor.\nexport const POINT_SIZE_OFFSET = 1.5;\nexport const DEFAULT_POINT_RADIUS = DEFAULT_LINE_WIDTH + POINT_SIZE_OFFSET;\nexport const DEFAULT_CONNECT_NULLS = false;\n\nexport const DEFAULT_VISUAL: TimeSeriesChartVisualOptions = {\n display: DEFAULT_DISPLAY,\n lineWidth: DEFAULT_LINE_WIDTH,\n lineStyle: DEFAULT_LINE_STYLE,\n areaOpacity: DEFAULT_AREA_OPACITY,\n pointRadius: DEFAULT_POINT_RADIUS,\n connectNulls: DEFAULT_CONNECT_NULLS,\n};\n\n// Controls how often static threshold values should be plotted so threshold data shows\n// in tooltip without flicker.\nexport const THRESHOLD_PLOT_INTERVAL = 15;\n\nexport const VISUAL_CONFIG = {\n lineWidth: {\n label: 'Line Width',\n testId: 'slider-line-width',\n min: 0.25,\n max: 3,\n step: 0.25,\n },\n lineStyle: {\n label: 'Line Style',\n },\n pointRadius: {\n label: 'Point Radius',\n testId: 'slider-point-radius',\n min: 0,\n max: 6,\n step: 0.25,\n },\n areaOpacity: {\n label: 'Area Opacity',\n testId: 'slider-area-opacity',\n min: 0,\n max: 1,\n step: 0.05,\n },\n stack: {\n label: 'Stack Series',\n },\n connectNulls: {\n label: 'Connect Nulls',\n },\n};\n\n// None is equivalent to undefined since stack is optional\nexport type StackOptions = 'none' | 'all'; // TODO: add percent option support\n\nexport const STACK_CONFIG = {\n none: { label: 'None' },\n all: { label: 'All' },\n // TODO: enable option after 'Percent' implemented\n // percent: { label: 'Percent', disabled: true }, // hidden since not implemented yet\n};\n\nexport const STACK_OPTIONS = Object.entries(STACK_CONFIG).map(([id, config]) => {\n return {\n id: id as StackOptions,\n ...config,\n };\n});\n\nexport const LINE_STYLE_CONFIG = {\n solid: { label: 'Solid' },\n dashed: { label: 'Dashes' },\n dotted: { label: 'Dots' },\n};\n\nexport const OPACITY_CONFIG = {\n label: 'Opacity',\n testId: 'slider-opacity',\n min: 0,\n max: 1,\n step: 0.05,\n};\n\n// LogBase outlines the allowed log bases for the log-supported charts.\nexport type LOG_BASE = undefined | 2 | 10;\n\n// Single source of truth for log base configuration\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\n// Options array for SettingsAutocomplete\nexport const LOG_BASE_OPTIONS = Object.entries(LOG_BASE_CONFIG).map(([id, config]) => ({\n id: id as string,\n ...config,\n}));\n\n// Both of these constants help produce a value that is LESS THAN the initial value.\n// For positive values, we multiply by a number less than 1 to get this outcome.\n// For negative values, we multiply to a number greater than 1 to get this outcome.\nexport const POSITIVE_MIN_VALUE_MULTIPLIER = 0.8;\nexport const NEGATIVE_MIN_VALUE_MULTIPLIER = 1.2;\n\n/**\n * Creates an initial/empty options object for the TimeSeriesChartPanel.\n */\nexport function createInitialTimeSeriesChartOptions(): TimeSeriesChartOptions {\n return {};\n}\n"],"names":["DEFAULT_FORMAT","unit","shortValues","DEFAULT_Y_AXIS","show","label","format","min","undefined","max","logBase","Y_AXIS_CONFIG","DEFAULT_DISPLAY","DEFAULT_LINE_WIDTH","DEFAULT_LINE_STYLE","DEFAULT_AREA_OPACITY","POINT_SIZE_OFFSET","DEFAULT_POINT_RADIUS","DEFAULT_CONNECT_NULLS","DEFAULT_VISUAL","display","lineWidth","lineStyle","areaOpacity","pointRadius","connectNulls","THRESHOLD_PLOT_INTERVAL","VISUAL_CONFIG","testId","step","stack","STACK_CONFIG","none","all","STACK_OPTIONS","Object","entries","map","id","config","LINE_STYLE_CONFIG","solid","dashed","dotted","OPACITY_CONFIG","LOG_BASE_CONFIG","log","LOG_BASE_OPTIONS","POSITIVE_MIN_VALUE_MULTIPLIER","NEGATIVE_MIN_VALUE_MULT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gCAAgC,IAAI;AAEjD;;CAEC,GACD,OAAO,SAASC;IACd,OAAO,CAAC;AACV"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { AnnotationSpecWithData } from '@perses-dev/dashboards';
|
|
2
|
+
import type { AnnotationData, AnnotationDisplay } from '@perses-dev/spec';
|
|
3
3
|
export type TimeSeriesAnnotation = AnnotationData & AnnotationDisplay;
|
|
4
4
|
export declare function convertAnnotationToTimeSeriesAnnotation(annotations: AnnotationSpecWithData[]): TimeSeriesAnnotation[];
|
|
5
5
|
//# sourceMappingURL=annotation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotation.d.ts","sourceRoot":"","sources":["../../../src/utils/annotation.ts"],"names":[],"mappings":"AAaA,OAAO,
|
|
1
|
+
{"version":3,"file":"annotation.d.ts","sourceRoot":"","sources":["../../../src/utils/annotation.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1E,MAAM,MAAM,oBAAoB,GAAG,cAAc,GAAG,iBAAiB,CAAC;AAEtE,wBAAgB,uCAAuC,CAAC,WAAW,EAAE,sBAAsB,EAAE,GAAG,oBAAoB,EAAE,CAcrH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/annotation.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 {
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/annotation.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 type { AnnotationSpecWithData } from '@perses-dev/dashboards';\nimport type { AnnotationData, AnnotationDisplay } from '@perses-dev/spec';\n\nexport type TimeSeriesAnnotation = AnnotationData & AnnotationDisplay;\n\nexport function convertAnnotationToTimeSeriesAnnotation(annotations: AnnotationSpecWithData[]): TimeSeriesAnnotation[] {\n const result: TimeSeriesAnnotation[] = [];\n for (const annotation of annotations) {\n for (const item of annotation.data) {\n if (annotation.definition.display.hidden) {\n continue;\n }\n result.push({\n ...annotation.definition.display,\n ...item,\n });\n }\n }\n return result;\n}\n"],"names":["convertAnnotationToTimeSeriesAnnotation","annotations","result","annotation","item","data","definition","display","hidden","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;AAOjC,OAAO,SAASA,wCAAwCC,WAAqC;IAC3F,MAAMC,SAAiC,EAAE;IACzC,KAAK,MAAMC,cAAcF,YAAa;QACpC,KAAK,MAAMG,QAAQD,WAAWE,IAAI,CAAE;YAClC,IAAIF,WAAWG,UAAU,CAACC,OAAO,CAACC,MAAM,EAAE;gBACxC;YACF;YACAN,OAAOO,IAAI,CAAC;gBACV,GAAGN,WAAWG,UAAU,CAACC,OAAO;gBAChC,GAAGH,IAAI;YACT;QACF;IACF;IACA,OAAOF;AACT"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import type { LegacyTimeSeries, EChartsDataFormat, TimeSeriesOption, StepOptions } from '@perses-dev/components';
|
|
2
|
+
import type { useTimeSeriesQueries, PanelData } from '@perses-dev/plugin-system';
|
|
3
|
+
import type { TimeScale, TimeSeries, TimeSeriesData } from '@perses-dev/spec';
|
|
1
4
|
import type { YAXisComponentOption } from 'echarts';
|
|
2
|
-
import { LineSeriesOption } from 'echarts/charts';
|
|
3
|
-
import {
|
|
4
|
-
import { useTimeSeriesQueries, PanelData } from '@perses-dev/plugin-system';
|
|
5
|
-
import { TimeScale, TimeSeries, TimeSeriesData } from '@perses-dev/spec';
|
|
6
|
-
import { TimeSeriesChartVisualOptions, TimeSeriesChartYAxisOptions, LineStyleType } from '../time-series-chart-model';
|
|
5
|
+
import type { LineSeriesOption } from 'echarts/charts';
|
|
6
|
+
import type { TimeSeriesChartVisualOptions, TimeSeriesChartYAxisOptions, LineStyleType } from '../time-series-chart-model';
|
|
7
7
|
export type RunningQueriesState = ReturnType<typeof useTimeSeriesQueries>;
|
|
8
8
|
export declare const EMPTY_GRAPH_DATA: EChartsDataFormat;
|
|
9
9
|
export declare const HIDE_DATAPOINTS_LIMIT = 70;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-transform.d.ts","sourceRoot":"","sources":["../../../src/utils/data-transform.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"data-transform.d.ts","sourceRoot":"","sources":["../../../src/utils/data-transform.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EAEjB,gBAAgB,EAChB,WAAW,EACZ,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAwB,MAA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8BD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,GAAE,2BAAgC,GAAG,oBAAoB,CAgDnG;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI7C"}
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
import { OPTIMIZED_MODE_SERIES_LIMIT, getCommonTimeScale } from
|
|
14
|
-
import { DEFAULT_AREA_OPACITY, DEFAULT_CONNECT_NULLS, DEFAULT_LINE_WIDTH, DEFAULT_POINT_RADIUS, DEFAULT_Y_AXIS, POSITIVE_MIN_VALUE_MULTIPLIER, NEGATIVE_MIN_VALUE_MULTIPLIER } from
|
|
13
|
+
import { OPTIMIZED_MODE_SERIES_LIMIT, getCommonTimeScale } from "@perses-dev/components";
|
|
14
|
+
import { DEFAULT_AREA_OPACITY, DEFAULT_CONNECT_NULLS, DEFAULT_LINE_WIDTH, DEFAULT_POINT_RADIUS, DEFAULT_Y_AXIS, POSITIVE_MIN_VALUE_MULTIPLIER, NEGATIVE_MIN_VALUE_MULTIPLIER } from "../time-series-chart-model.js";
|
|
15
15
|
export const EMPTY_GRAPH_DATA = {
|
|
16
16
|
timeSeries: [],
|
|
17
17
|
xAxis: [],
|
|
@@ -223,7 +223,7 @@ function findMax(data) {
|
|
|
223
223
|
*/ export function roundDown(num) {
|
|
224
224
|
const magnitude = Math.floor(Math.log10(Math.abs(num)));
|
|
225
225
|
const firstDigit = Math.floor(num / Math.pow(10, magnitude));
|
|
226
|
-
return firstDigit * Math.pow(10, magnitude);
|
|
226
|
+
return Number((firstDigit * Math.pow(10, magnitude)).toPrecision(1));
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
//# sourceMappingURL=data-transform.js.map
|