@perses-dev/timeseries-chart-plugin 0.12.1 → 0.13.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mf/css/async/907.85c2cbf6.css +1 -0
- package/__mf/font/inter-cyrillic-300-normal.432f2b21.woff +0 -0
- package/__mf/font/inter-cyrillic-300-normal.9da91009.woff2 +0 -0
- package/__mf/font/inter-cyrillic-400-normal.372704ff.woff2 +0 -0
- package/__mf/font/inter-cyrillic-400-normal.a6b6ef6f.woff +0 -0
- package/__mf/font/inter-cyrillic-500-normal.7c15bba8.woff2 +0 -0
- package/__mf/font/inter-cyrillic-500-normal.b9f8c929.woff +0 -0
- package/__mf/font/inter-cyrillic-600-normal.2f42892a.woff2 +0 -0
- package/__mf/font/inter-cyrillic-600-normal.c3987adc.woff +0 -0
- package/__mf/font/inter-cyrillic-700-normal.93eba3c3.woff +0 -0
- package/__mf/font/inter-cyrillic-700-normal.e9e5b2dc.woff2 +0 -0
- package/__mf/font/inter-cyrillic-900-normal.f285bd7a.woff2 +0 -0
- package/__mf/font/inter-cyrillic-900-normal.ffbd8a3a.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-300-normal.95bb9038.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-300-normal.cfc143a9.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-400-normal.2a31c04b.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-400-normal.f572b170.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-500-normal.5a6bb1da.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-500-normal.fe0d9b14.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-600-normal.ecbdecad.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-600-normal.f7b3c15b.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-700-normal.4b4022a6.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-700-normal.74b516d2.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-900-normal.9970ddb5.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-900-normal.a0d59adc.woff2 +0 -0
- package/__mf/font/inter-greek-300-normal.0d7be683.woff2 +0 -0
- package/__mf/font/inter-greek-300-normal.8f0b988e.woff +0 -0
- package/__mf/font/inter-greek-400-normal.cc58c11b.woff +0 -0
- package/__mf/font/inter-greek-400-normal.d7020e3c.woff2 +0 -0
- package/__mf/font/inter-greek-500-normal.d9a33207.woff +0 -0
- package/__mf/font/inter-greek-500-normal.f41f43db.woff2 +0 -0
- package/__mf/font/inter-greek-600-normal.4ec0c1c1.woff +0 -0
- package/__mf/font/inter-greek-600-normal.cc532937.woff2 +0 -0
- package/__mf/font/inter-greek-700-normal.5ec6c758.woff +0 -0
- package/__mf/font/inter-greek-700-normal.97f0eeeb.woff2 +0 -0
- package/__mf/font/inter-greek-900-normal.46b66369.woff2 +0 -0
- package/__mf/font/inter-greek-900-normal.9ae3a3c5.woff +0 -0
- package/__mf/font/inter-greek-ext-300-normal.10247a66.woff2 +0 -0
- package/__mf/font/inter-greek-ext-300-normal.4668e5cb.woff +0 -0
- package/__mf/font/inter-greek-ext-400-normal.4ce1df5d.woff2 +0 -0
- package/__mf/font/inter-greek-ext-400-normal.88ede1ea.woff +0 -0
- package/__mf/font/inter-greek-ext-500-normal.7a4aa726.woff +0 -0
- package/__mf/font/inter-greek-ext-500-normal.cbd51e2d.woff2 +0 -0
- package/__mf/font/inter-greek-ext-600-normal.089a95ee.woff +0 -0
- package/__mf/font/inter-greek-ext-600-normal.1f33d317.woff2 +0 -0
- package/__mf/font/inter-greek-ext-700-normal.31f1075d.woff +0 -0
- package/__mf/font/inter-greek-ext-700-normal.827cd618.woff2 +0 -0
- package/__mf/font/inter-greek-ext-900-normal.531bcee7.woff +0 -0
- package/__mf/font/inter-greek-ext-900-normal.8a9b36b9.woff2 +0 -0
- package/__mf/font/inter-latin-300-normal.15fb600d.woff2 +0 -0
- package/__mf/font/inter-latin-300-normal.6f95f590.woff +0 -0
- package/__mf/font/inter-latin-400-normal.2c7a775c.woff +0 -0
- package/__mf/font/inter-latin-400-normal.ef6d3f52.woff2 +0 -0
- package/__mf/font/inter-latin-500-normal.b7b43ace.woff2 +0 -0
- package/__mf/font/inter-latin-500-normal.cb4c8ceb.woff +0 -0
- package/__mf/font/inter-latin-600-normal.8fb1a964.woff2 +0 -0
- package/__mf/font/inter-latin-600-normal.ce0f5f43.woff +0 -0
- package/__mf/font/inter-latin-700-normal.953b7aa5.woff2 +0 -0
- package/__mf/font/inter-latin-700-normal.9c21d4dc.woff +0 -0
- package/__mf/font/inter-latin-900-normal.2a8028ec.woff2 +0 -0
- package/__mf/font/inter-latin-900-normal.fa252135.woff +0 -0
- package/__mf/font/inter-latin-ext-300-normal.167cc8c9.woff2 +0 -0
- package/__mf/font/inter-latin-ext-300-normal.f695be66.woff +0 -0
- package/__mf/font/inter-latin-ext-400-normal.32a25442.woff2 +0 -0
- package/__mf/font/inter-latin-ext-400-normal.4edcaace.woff +0 -0
- package/__mf/font/inter-latin-ext-500-normal.a19a84a6.woff +0 -0
- package/__mf/font/inter-latin-ext-500-normal.d9b491de.woff2 +0 -0
- package/__mf/font/inter-latin-ext-600-normal.38b075d8.woff2 +0 -0
- package/__mf/font/inter-latin-ext-600-normal.49faa47a.woff +0 -0
- package/__mf/font/inter-latin-ext-700-normal.93534b50.woff +0 -0
- package/__mf/font/inter-latin-ext-700-normal.b63daa1a.woff2 +0 -0
- package/__mf/font/inter-latin-ext-900-normal.0efdb307.woff +0 -0
- package/__mf/font/inter-latin-ext-900-normal.9c0fc2c7.woff2 +0 -0
- package/__mf/font/inter-vietnamese-300-normal.aad496d8.woff +0 -0
- package/__mf/font/inter-vietnamese-300-normal.ad9ef503.woff2 +0 -0
- package/__mf/font/inter-vietnamese-400-normal.a9dd2faf.woff +0 -0
- package/__mf/font/inter-vietnamese-400-normal.de4fc44f.woff2 +0 -0
- package/__mf/font/inter-vietnamese-500-normal.7c0a695f.woff2 +0 -0
- package/__mf/font/inter-vietnamese-500-normal.a3a73b95.woff +0 -0
- package/__mf/font/inter-vietnamese-600-normal.9d518599.woff2 +0 -0
- package/__mf/font/inter-vietnamese-600-normal.c5ce3fcb.woff +0 -0
- package/__mf/font/inter-vietnamese-700-normal.bc68b199.woff +0 -0
- package/__mf/font/inter-vietnamese-700-normal.faf12809.woff2 +0 -0
- package/__mf/font/inter-vietnamese-900-normal.2b782045.woff +0 -0
- package/__mf/font/inter-vietnamese-900-normal.e639b65a.woff2 +0 -0
- package/__mf/js/TimeSeriesChart.f9dd142d.js +7 -0
- package/__mf/js/async/121.df4898d6.js +2 -0
- package/__mf/js/async/177.56f1be10.js +1 -0
- package/__mf/js/async/187.2cc43fac.js +24 -0
- package/__mf/js/async/192.beef3a1a.js +1 -0
- package/__mf/js/async/2.c3740bb9.js +1 -0
- package/__mf/js/async/235.c24f24f7.js +1 -0
- package/__mf/js/async/274.d112354f.js +2 -0
- package/__mf/js/async/356.9f551c8a.js +1 -0
- package/__mf/js/async/392.2350fb02.js +2 -0
- package/__mf/js/async/470.a4fd777e.js +2 -0
- package/__mf/js/async/491.6f81cf51.js +1 -0
- package/__mf/js/async/568.cdcaf97d.js +1 -0
- package/__mf/js/async/587.c12780da.js +1 -0
- package/__mf/js/async/588.6662e16a.js +1 -0
- package/__mf/js/async/616.52acb1b4.js +1 -0
- package/__mf/js/async/681.8d61b348.js +110 -0
- package/__mf/js/async/681.8d61b348.js.LICENSE.txt +27 -0
- package/__mf/js/async/702.de247ad8.js +2 -0
- package/__mf/js/async/71.84e486c9.js +1 -0
- package/__mf/js/async/724.3439df06.js +1 -0
- package/__mf/js/async/78.91de282a.js +1 -0
- package/__mf/js/async/780.12a33d06.js +39 -0
- package/__mf/js/async/{390.ad50daba.js.LICENSE.txt → 780.12a33d06.js.LICENSE.txt} +11 -23
- package/__mf/js/async/873.9aad328a.js +1 -0
- package/__mf/js/async/907.5ce8f69d.js +7 -0
- package/__mf/js/async/{472.fd3069f0.js.LICENSE.txt → 907.5ce8f69d.js.LICENSE.txt} +19 -1
- package/__mf/js/async/941.c0e2d25e.js +2 -0
- package/__mf/js/async/968.6de5fa7c.js +1 -0
- package/__mf/js/async/978.5c14e175.js +1 -0
- package/__mf/js/async/__federation_expose_TimeSeriesChart.d1167045.js +1 -0
- package/__mf/js/async/lib-router.1934857d.js +2 -0
- package/__mf/js/main.2bb9f3e3.js +7 -0
- package/lib/QuerySettingsEditor.d.ts.map +1 -1
- package/lib/QuerySettingsEditor.js +179 -167
- package/lib/QuerySettingsEditor.js.map +1 -1
- package/lib/TimeSeriesChartBase.d.ts +2 -2
- package/lib/TimeSeriesChartBase.d.ts.map +1 -1
- package/lib/TimeSeriesChartBase.js +12 -11
- package/lib/TimeSeriesChartBase.js.map +1 -1
- package/lib/TimeSeriesChartPanel.d.ts +1 -1
- package/lib/TimeSeriesChartPanel.d.ts.map +1 -1
- package/lib/TimeSeriesChartPanel.js +2 -3
- package/lib/TimeSeriesChartPanel.js.map +1 -1
- package/lib/cjs/QuerySettingsEditor.js +177 -165
- package/lib/cjs/TimeSeriesChartBase.js +13 -12
- package/lib/cjs/TimeSeriesChartPanel.js +4 -5
- package/lib/cjs/utils/data-transform.js +1 -2
- package/lib/cjs/utils/timezone-formatter.js +48 -0
- package/lib/test/mock-query-results.d.ts +1 -1
- package/lib/test/mock-query-results.js.map +1 -1
- package/lib/time-series-chart-model.d.ts +2 -1
- package/lib/time-series-chart-model.d.ts.map +1 -1
- package/lib/time-series-chart-model.js.map +1 -1
- package/lib/utils/data-transform.d.ts +2 -2
- package/lib/utils/data-transform.d.ts.map +1 -1
- package/lib/utils/data-transform.js +1 -2
- package/lib/utils/data-transform.js.map +1 -1
- package/lib/utils/timezone-formatter.d.ts +5 -0
- package/lib/utils/timezone-formatter.d.ts.map +1 -0
- package/lib/utils/timezone-formatter.js +42 -0
- package/lib/utils/timezone-formatter.js.map +1 -0
- package/mf-manifest.json +62 -52
- package/mf-stats.json +74 -56
- package/package.json +4 -4
- package/__mf/css/async/442.d3010b86.css +0 -1
- package/__mf/css/async/61.d3010b86.css +0 -1
- package/__mf/css/async/823.d3010b86.css +0 -1
- package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
- package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
- package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
- package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
- package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
- package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
- package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
- package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
- package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
- package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
- package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
- package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
- package/__mf/js/TimeSeriesChart.734ed3ec.js +0 -6
- package/__mf/js/async/121.a742c022.js +0 -2
- package/__mf/js/async/177.97e14ed0.js +0 -1
- package/__mf/js/async/192.30450189.js +0 -1
- package/__mf/js/async/2.68ee9e1b.js +0 -1
- package/__mf/js/async/235.a53a2591.js +0 -1
- package/__mf/js/async/274.8e8950b6.js +0 -2
- package/__mf/js/async/356.dee0f34a.js +0 -1
- package/__mf/js/async/390.ad50daba.js +0 -110
- package/__mf/js/async/392.550376f0.js +0 -2
- package/__mf/js/async/470.4c93905a.js +0 -2
- package/__mf/js/async/472.fd3069f0.js +0 -7
- package/__mf/js/async/489.8bb61ec9.js +0 -1
- package/__mf/js/async/491.35fc6280.js +0 -1
- package/__mf/js/async/544.4dd63985.js +0 -2
- package/__mf/js/async/544.4dd63985.js.LICENSE.txt +0 -15
- package/__mf/js/async/558.5a41ebcc.js +0 -1
- package/__mf/js/async/587.40becf9b.js +0 -1
- package/__mf/js/async/588.33924c3f.js +0 -1
- package/__mf/js/async/616.6d37f37b.js +0 -1
- package/__mf/js/async/634.8646a5de.js +0 -24
- package/__mf/js/async/702.5d93a78a.js +0 -2
- package/__mf/js/async/71.e481dbdb.js +0 -1
- package/__mf/js/async/78.362ece9d.js +0 -1
- package/__mf/js/async/867.12a42f78.js +0 -38
- package/__mf/js/async/873.11e0e15e.js +0 -1
- package/__mf/js/async/941.5331fb70.js +0 -2
- package/__mf/js/async/968.2ea36b8a.js +0 -1
- package/__mf/js/async/978.844227d5.js +0 -1
- package/__mf/js/async/__federation_expose_TimeSeriesChart.54276867.js +0 -1
- package/__mf/js/async/lib-router.9730f5e9.js +0 -2
- package/__mf/js/main.22e0e85a.js +0 -6
- /package/__mf/js/async/{121.a742c022.js.LICENSE.txt → 121.df4898d6.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{634.8646a5de.js.LICENSE.txt → 187.2cc43fac.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{274.8e8950b6.js.LICENSE.txt → 274.d112354f.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{392.550376f0.js.LICENSE.txt → 392.2350fb02.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{470.4c93905a.js.LICENSE.txt → 470.a4fd777e.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{702.5d93a78a.js.LICENSE.txt → 702.de247ad8.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{941.5331fb70.js.LICENSE.txt → 941.c0e2d25e.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{lib-router.9730f5e9.js.LICENSE.txt → lib-router.1934857d.js.LICENSE.txt} +0 -0
|
@@ -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/core';\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,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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,2CAA2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C,YAAY;QACZC,cAAc;QACdC,gBAAgB;QAChBC,UAAU;QACVC,mBAAmB;QACnBC,gBAAgB;QAChBC,gBAAgB;QAChBC,SAAS;IACX;CACD,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FormatOptions, ThresholdOptions } from '@perses-dev/components';
|
|
2
2
|
import { OptionsEditorProps, LegendSpecOptions } from '@perses-dev/plugin-system';
|
|
3
|
+
import { Definition } from '@perses-dev/spec';
|
|
3
4
|
/**
|
|
4
5
|
* Line style options for time series charts.
|
|
5
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,
|
|
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;AACzE,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;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,EA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yright 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/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 { 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\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;AAsEjC,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,OAA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GC,MAAM;IACX;AACF,GAAG;AAEH,OAAO,MAAMC,oBAAoB;IAC/BC,OAAO;QAAEpC,OAAO;IAAQ;IACxBqC,QAAQ;QAAErC,OAAO;IAAS;IAC1BsC,QAAQ;QAAEtC,OAAO;IAAO;AAC1B,EAAE;AAEF,OAAO,MAAMuC,iBAAiB;IAC5BvC,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,8 +1,8 @@
|
|
|
1
1
|
import type { YAXisComponentOption } from 'echarts';
|
|
2
2
|
import { LineSeriesOption } from 'echarts/charts';
|
|
3
|
-
import {
|
|
4
|
-
import { LegacyTimeSeries, EChartsDataFormat, TimeSeriesOption } from '@perses-dev/components';
|
|
3
|
+
import { LegacyTimeSeries, EChartsDataFormat, TimeSeriesOption, StepOptions } from '@perses-dev/components';
|
|
5
4
|
import { useTimeSeriesQueries, PanelData } from '@perses-dev/plugin-system';
|
|
5
|
+
import { TimeScale, TimeSeries, TimeSeriesData } from '@perses-dev/spec';
|
|
6
6
|
import { 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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-transform.d.ts","sourceRoot":"","sources":["../../../src/utils/data-transform.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AACnE,OAAO,
|
|
1
|
+
{"version":3,"file":"data-transform.d.ts","sourceRoot":"","sources":["../../../src/utils/data-transform.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAEL,gBAAgB,EAChB,iBAAiB,EAEjB,gBAAgB,EAChB,WAAW,EAEZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAwB,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAQL,4BAA4B,EAC5B,2BAA2B,EAC3B,aAAa,EACd,MAAM,4BAA4B,CAAC;AAEpC,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAE1E,eAAO,MAAM,gBAAgB,EAAE,iBAI9B,CAAC;AAEF,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,GAAG,SAAS,GAAG,SAAS,CAG7G;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,EAAE,EAAE,MAAM,EACV,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,4BAA4B,EACpC,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,MAAM,EACpB,aAAa,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,aAAa,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,EACnE,UAAU,CAAC,EAAE,MAAM,GAClB,gBAAgB,CA2ElB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,GAAG,gBAAgB,CA2B9G;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,gBAAgB,EAAE,GAAG,UAAU,EAAE,EACvC,GAAG,CAAC,EAAE,MAAM,EACZ,GAAG,CAAC,EAAE,MAAM,GACX,MAAM,CAMR;AA4BD;;;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,7 @@
|
|
|
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 { getCommonTimeScale } from '@perses-dev/
|
|
14
|
-
import { OPTIMIZED_MODE_SERIES_LIMIT } from '@perses-dev/components';
|
|
13
|
+
import { OPTIMIZED_MODE_SERIES_LIMIT, getCommonTimeScale } from '@perses-dev/components';
|
|
15
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';
|
|
16
15
|
export const EMPTY_GRAPH_DATA = {
|
|
17
16
|
timeSeries: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/data-transform.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { YAXisComponentOption } from 'echarts';\nimport { LineSeriesOption, BarSeriesOption } from 'echarts/charts';\nimport {\n StepOptions,\n TimeScale,\n TimeSeries,\n TimeSeriesValueTuple,\n getCommonTimeScale,\n TimeSeriesData,\n} from '@perses-dev/core';\nimport {\n OPTIMIZED_MODE_SERIES_LIMIT,\n LegacyTimeSeries,\n EChartsDataFormat,\n EChartsValues,\n TimeSeriesOption,\n} from '@perses-dev/components';\nimport { useTimeSeriesQueries, PanelData } from '@perses-dev/plugin-system';\nimport {\n DEFAULT_AREA_OPACITY,\n DEFAULT_CONNECT_NULLS,\n DEFAULT_LINE_WIDTH,\n DEFAULT_POINT_RADIUS,\n DEFAULT_Y_AXIS,\n POSITIVE_MIN_VALUE_MULTIPLIER,\n NEGATIVE_MIN_VALUE_MULTIPLIER,\n TimeSeriesChartVisualOptions,\n TimeSeriesChartYAxisOptions,\n LineStyleType,\n} from '../time-series-chart-model';\n\nexport type RunningQueriesState = ReturnType<typeof useTimeSeriesQueries>;\n\nexport const EMPTY_GRAPH_DATA: EChartsDataFormat = {\n timeSeries: [],\n xAxis: [],\n legendItems: [],\n};\n\nexport const HIDE_DATAPOINTS_LIMIT = 70;\n\nexport const BLUR_FADEOUT_OPACITY = 0.5;\n\n/**\n * Given a list of running queries, calculates a common time scale for use on\n * the x axis (i.e. start/end dates and a step that is divisible into all of\n * the queries' steps).\n */\nexport function getCommonTimeScaleForQueries(queries: Array<PanelData<TimeSeriesData>>): TimeScale | undefined {\n const seriesData = queries.map((query) => query.data);\n return getCommonTimeScale(seriesData);\n}\n\n/**\n * Gets ECharts line series option properties for regular trends\n */\nexport function getTimeSeries(\n id: string,\n datasetIndex: number,\n formattedName: string,\n visual: TimeSeriesChartVisualOptions,\n timeScale: TimeScale,\n paletteColor: string,\n querySettings?: { lineStyle?: LineStyleType; areaOpacity?: number },\n yAxisIndex?: number\n): TimeSeriesOption {\n const lineWidth = visual.lineWidth ?? DEFAULT_LINE_WIDTH;\n const pointRadius = visual.pointRadius ?? DEFAULT_POINT_RADIUS;\n\n // Shows datapoint symbols when selected time range is roughly 15 minutes or less\n const minuteMs = 60000;\n let showPoints = timeScale.rangeMs <= minuteMs * 15;\n // Allows overriding default behavior and opt-in to always show all symbols (can hurt performance)\n if (visual.showPoints === 'always') {\n showPoints = true;\n }\n\n if (visual.display === 'bar') {\n const series: BarSeriesOption = {\n type: 'bar',\n id: id,\n datasetIndex,\n name: formattedName,\n color: paletteColor,\n stack: visual.stack === 'all' ? visual.stack : undefined,\n yAxisIndex: yAxisIndex,\n label: {\n show: false,\n },\n };\n return series;\n }\n\n const series: LineSeriesOption = {\n type: 'line',\n id: id,\n datasetIndex,\n name: formattedName,\n connectNulls: visual.connectNulls ?? DEFAULT_CONNECT_NULLS,\n color: paletteColor,\n stack: visual.stack === 'all' ? visual.stack : undefined,\n yAxisIndex: yAxisIndex,\n sampling: 'lttb',\n progressiveThreshold: OPTIMIZED_MODE_SERIES_LIMIT, // https://echarts.apache.org/en/option.html#series-lines.progressiveThreshold\n showSymbol: showPoints,\n showAllSymbol: true,\n symbolSize: pointRadius,\n lineStyle: {\n width: lineWidth,\n type: (querySettings?.lineStyle ?? visual.lineStyle) as LineStyleType,\n },\n areaStyle: {\n opacity: querySettings?.areaOpacity ?? visual.areaOpacity ?? DEFAULT_AREA_OPACITY,\n },\n // https://echarts.apache.org/en/option.html#series-line.emphasis\n emphasis: {\n focus: 'series',\n disabled: visual.areaOpacity !== undefined && visual.areaOpacity > 0, // prevents flicker when moving cursor between shaded regions\n lineStyle: {\n width: lineWidth + 1,\n opacity: 1,\n type: visual.lineStyle,\n },\n },\n selectedMode: 'single',\n select: {\n itemStyle: {\n borderColor: paletteColor,\n borderWidth: pointRadius + 0.5,\n },\n },\n blur: {\n lineStyle: {\n width: lineWidth,\n opacity: BLUR_FADEOUT_OPACITY,\n type: visual.lineStyle,\n },\n },\n };\n return series;\n}\n\n/**\n * Gets threshold-specific line series styles\n * markLine cannot be used since it does not update yAxis max / min\n * and threshold data needs to show in the tooltip\n */\nexport function getThresholdSeries(name: string, threshold: StepOptions, seriesIndex: number): LineSeriesOption {\n return {\n type: 'line',\n name: name,\n id: name,\n datasetId: name,\n datasetIndex: seriesIndex,\n color: threshold.color,\n label: {\n show: false,\n },\n lineStyle: {\n type: 'dashed',\n width: 2,\n },\n emphasis: {\n focus: 'series',\n lineStyle: {\n width: 2.5,\n },\n },\n blur: {\n lineStyle: {\n opacity: BLUR_FADEOUT_OPACITY,\n },\n },\n };\n}\n\n/**\n * Converts percent threshold into absolute step value\n * If max is undefined, use the max value from time series data as default\n */\nexport function convertPercentThreshold(\n percent: number,\n data: LegacyTimeSeries[] | TimeSeries[],\n max?: number,\n min?: number\n): number {\n const percentDecimal = percent / 100;\n const adjustedMax = max ?? findMax(data);\n const adjustedMin = min ?? 0;\n const total = adjustedMax - adjustedMin;\n return percentDecimal * total + adjustedMin;\n}\n\nfunction findMax(data: LegacyTimeSeries[] | TimeSeries[]): number {\n let max = 0;\n if (data.length && data[0] !== undefined && (data as TimeSeries[])[0]?.values) {\n (data as TimeSeries[]).forEach((series) => {\n series.values.forEach((valueTuple: TimeSeriesValueTuple) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [_, value] = valueTuple;\n if (typeof value === 'number' && value > max) {\n max = value;\n }\n });\n });\n } else {\n (data as LegacyTimeSeries[]).forEach((series) => {\n if (series.data !== undefined) {\n series.data.forEach((value: EChartsValues) => {\n if (typeof value === 'number' && value > max) {\n max = value;\n }\n });\n }\n });\n }\n return max;\n}\n\n/**\n * Converts Perses panel yAxis from dashboard spec to ECharts supported yAxis options.\n * Handles both linear and logarithmic scales with appropriate min/max calculations.\n */\nexport function convertPanelYAxis(inputAxis: TimeSeriesChartYAxisOptions = {}): YAXisComponentOption {\n // Determine the appropriate min value based on scale type and user input\n let minValue: YAXisComponentOption['min'];\n if (inputAxis.logBase !== undefined) {\n // For logarithmic scales without explicit min:\n // Let ECharts auto-calculate the range based on data to avoid issues with\n // function-based calculations which can result in improper ranges (e.g., 1-10)\n minValue = undefined;\n } else if (inputAxis?.min !== undefined) {\n // User explicitly set a min value - use it for both linear and log scales\n minValue = inputAxis.min;\n } else {\n // For linear scales without explicit min:\n // Use dynamic calculation with padding for better visualization\n // https://echarts.apache.org/en/option.html#yAxis.min\n minValue = (value): number => {\n if (value.min >= 0 && value.min <= 1) {\n // Helps with PercentDecimal units, or datasets that return 0 or 1 booleans\n return 0;\n }\n\n // Note: We can tweak the MULTIPLIER constants if we want\n // TODO: Experiment with using a padding that is based on the difference between max value and min value\n if (value.min > 0) {\n return roundDown(value.min * POSITIVE_MIN_VALUE_MULTIPLIER);\n } else {\n return roundDown(value.min * NEGATIVE_MIN_VALUE_MULTIPLIER);\n }\n };\n }\n\n // Build the yAxis configuration\n const yAxis: YAXisComponentOption = {\n show: inputAxis?.show ?? DEFAULT_Y_AXIS.show,\n min: minValue,\n max: inputAxis?.max,\n };\n\n // Apply logarithmic scale settings if requested\n if (inputAxis.logBase !== undefined) {\n return {\n ...yAxis,\n type: 'log',\n logBase: inputAxis.logBase,\n };\n }\n\n return yAxis;\n}\n\n/**\n * Rounds down to nearest number with one significant digit.\n *\n * Examples:\n * 1. 675 --> 600\n * 2. 0.567 --> 0.5\n * 3. -12 --> -20\n */\nexport function roundDown(num: number): number {\n const magnitude = Math.floor(Math.log10(Math.abs(num)));\n const firstDigit = Math.floor(num / Math.pow(10, magnitude));\n return firstDigit * Math.pow(10, magnitude);\n}\n"],"names":["getCommonTimeScale","OPTIMIZED_MODE_SERIES_LIMIT","DEFAULT_AREA_OPACITY","DEFAULT_CONNECT_NULLS","DEFAULT_LINE_WIDTH","DEFAULT_POINT_RADIUS","DEFAULT_Y_AXIS","POSITIVE_MIN_VALUE_MULTIPLIER","NEGATIVE_MIN_VALUE_MULTIPLIER","EMPTY_GRAPH_DATA","timeSeries","xAxis","legendItems","HIDE_DATAPOINTS_LIMIT","BLUR_FADEOUT_OPACITY","getCommonTimeScaleForQueries","queries","seriesData","map","query","data","getTimeSeries","id","datasetIndex","formattedName","visual","timeScale","paletteColor","querySettings","yAxisIndex","lineWidth","pointRadius","minuteMs","showPoints","rangeMs","display","series","type","name","color","stack","undefined","label","show","connectNulls","sampling","progressiveThreshold","showSymbol","showAllSymbol","symbolSize","lineStyle","width","areaStyle","opacity","areaOpacity","emphasis","focus","disabled","selectedMode","select","itemStyle","borderColor","borderWidth","blur","getThresholdSeries","threshold","seriesIndex","datasetId","convertPercentThreshold","percent","max","min","percentDecimal","adjustedMax","findMax","adjustedMin","total","length","values","forEach","valueTuple","_","value","convertPanelYAxis","inputAxis","minValue","logBase","roundDown","yAxis","num","magnitude","Math","floor","log10","abs","firstDigit","pow"],"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,SAKEA,kBAAkB,QAEb,mBAAmB;AAC1B,SACEC,2BAA2B,QAKtB,yBAAyB;AAEhC,SACEC,oBAAoB,EACpBC,qBAAqB,EACrBC,kBAAkB,EAClBC,oBAAoB,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UL,MAAMX,GAAG,GAAG/D;YAC/B;QACF;IACF;IAEA,gCAAgC;IAChC,MAAMgF,QAA8B;QAClC7C,MAAMyC,WAAWzC,QAAQrC,eAAeqC,IAAI;QAC5C4B,KAAKc;QACLf,KAAKc,WAAWd;IAClB;IAEA,gDAAgD;IAChD,IAAIc,UAAUE,OAAO,KAAK7C,WAAW;QACnC,OAAO;YACL,GAAG+C,KAAK;YACRnD,MAAM;YACNiD,SAASF,UAAUE,OAAO;QAC5B;IACF;IAEA,OAAOE;AACT;AAEA;;;;;;;CAOC,GACD,OAAO,SAASD,UAAUE,GAAW;IACnC,MAAMC,YAAYC,KAAKC,KAAK,CAACD,KAAKE,KAAK,CAACF,KAAKG,GAAG,CAACL;IACjD,MAAMM,aAAaJ,KAAKC,KAAK,CAACH,MAAME,KAAKK,GAAG,CAAC,IAAIN;IACjD,OAAOK,aAAaJ,KAAKK,GAAG,CAAC,IAAIN;AACnC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/data-transform.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { YAXisComponentOption } from 'echarts';\nimport { LineSeriesOption, BarSeriesOption } from 'echarts/charts';\nimport {\n OPTIMIZED_MODE_SERIES_LIMIT,\n LegacyTimeSeries,\n EChartsDataFormat,\n EChartsValues,\n TimeSeriesOption,\n StepOptions,\n getCommonTimeScale,\n} from '@perses-dev/components';\nimport { useTimeSeriesQueries, PanelData } from '@perses-dev/plugin-system';\nimport { TimeScale, TimeSeries, TimeSeriesData, TimeSeriesValueTuple } from '@perses-dev/spec';\nimport {\n DEFAULT_AREA_OPACITY,\n DEFAULT_CONNECT_NULLS,\n DEFAULT_LINE_WIDTH,\n DEFAULT_POINT_RADIUS,\n DEFAULT_Y_AXIS,\n POSITIVE_MIN_VALUE_MULTIPLIER,\n NEGATIVE_MIN_VALUE_MULTIPLIER,\n TimeSeriesChartVisualOptions,\n TimeSeriesChartYAxisOptions,\n LineStyleType,\n} from '../time-series-chart-model';\n\nexport type RunningQueriesState = ReturnType<typeof useTimeSeriesQueries>;\n\nexport const EMPTY_GRAPH_DATA: EChartsDataFormat = {\n timeSeries: [],\n xAxis: [],\n legendItems: [],\n};\n\nexport const HIDE_DATAPOINTS_LIMIT = 70;\n\nexport const BLUR_FADEOUT_OPACITY = 0.5;\n\n/**\n * Given a list of running queries, calculates a common time scale for use on\n * the x axis (i.e. start/end dates and a step that is divisible into all of\n * the queries' steps).\n */\nexport function getCommonTimeScaleForQueries(queries: Array<PanelData<TimeSeriesData>>): TimeScale | undefined {\n const seriesData = queries.map((query) => query.data);\n return getCommonTimeScale(seriesData);\n}\n\n/**\n * Gets ECharts line series option properties for regular trends\n */\nexport function getTimeSeries(\n id: string,\n datasetIndex: number,\n formattedName: string,\n visual: TimeSeriesChartVisualOptions,\n timeScale: TimeScale,\n paletteColor: string,\n querySettings?: { lineStyle?: LineStyleType; areaOpacity?: number },\n yAxisIndex?: number\n): TimeSeriesOption {\n const lineWidth = visual.lineWidth ?? DEFAULT_LINE_WIDTH;\n const pointRadius = visual.pointRadius ?? DEFAULT_POINT_RADIUS;\n\n // Shows datapoint symbols when selected time range is roughly 15 minutes or less\n const minuteMs = 60000;\n let showPoints = timeScale.rangeMs <= minuteMs * 15;\n // Allows overriding default behavior and opt-in to always show all symbols (can hurt performance)\n if (visual.showPoints === 'always') {\n showPoints = true;\n }\n\n if (visual.display === 'bar') {\n const series: BarSeriesOption = {\n type: 'bar',\n id: id,\n datasetIndex,\n name: formattedName,\n color: paletteColor,\n stack: visual.stack === 'all' ? visual.stack : undefined,\n yAxisIndex: yAxisIndex,\n label: {\n show: false,\n },\n };\n return series;\n }\n\n const series: LineSeriesOption = {\n type: 'line',\n id: id,\n datasetIndex,\n name: formattedName,\n connectNulls: visual.connectNulls ?? DEFAULT_CONNECT_NULLS,\n color: paletteColor,\n stack: visual.stack === 'all' ? visual.stack : undefined,\n yAxisIndex: yAxisIndex,\n sampling: 'lttb',\n progressiveThreshold: OPTIMIZED_MODE_SERIES_LIMIT, // https://echarts.apache.org/en/option.html#series-lines.progressiveThreshold\n showSymbol: showPoints,\n showAllSymbol: true,\n symbolSize: pointRadius,\n lineStyle: {\n width: lineWidth,\n type: (querySettings?.lineStyle ?? visual.lineStyle) as LineStyleType,\n },\n areaStyle: {\n opacity: querySettings?.areaOpacity ?? visual.areaOpacity ?? DEFAULT_AREA_OPACITY,\n },\n // https://echarts.apache.org/en/option.html#series-line.emphasis\n emphasis: {\n focus: 'series',\n disabled: visual.areaOpacity !== undefined && visual.areaOpacity > 0, // prevents flicker when moving cursor between shaded regions\n lineStyle: {\n width: lineWidth + 1,\n opacity: 1,\n type: visual.lineStyle,\n },\n },\n selectedMode: 'single',\n select: {\n itemStyle: {\n borderColor: paletteColor,\n borderWidth: pointRadius + 0.5,\n },\n },\n blur: {\n lineStyle: {\n width: lineWidth,\n opacity: BLUR_FADEOUT_OPACITY,\n type: visual.lineStyle,\n },\n },\n };\n return series;\n}\n\n/**\n * Gets threshold-specific line series styles\n * markLine cannot be used since it does not update yAxis max / min\n * and threshold data needs to show in the tooltip\n */\nexport function getThresholdSeries(name: string, threshold: StepOptions, seriesIndex: number): LineSeriesOption {\n return {\n type: 'line',\n name: name,\n id: name,\n datasetId: name,\n datasetIndex: seriesIndex,\n color: threshold.color,\n label: {\n show: false,\n },\n lineStyle: {\n type: 'dashed',\n width: 2,\n },\n emphasis: {\n focus: 'series',\n lineStyle: {\n width: 2.5,\n },\n },\n blur: {\n lineStyle: {\n opacity: BLUR_FADEOUT_OPACITY,\n },\n },\n };\n}\n\n/**\n * Converts percent threshold into absolute step value\n * If max is undefined, use the max value from time series data as default\n */\nexport function convertPercentThreshold(\n percent: number,\n data: LegacyTimeSeries[] | TimeSeries[],\n max?: number,\n min?: number\n): number {\n const percentDecimal = percent / 100;\n const adjustedMax = max ?? findMax(data);\n const adjustedMin = min ?? 0;\n const total = adjustedMax - adjustedMin;\n return percentDecimal * total + adjustedMin;\n}\n\nfunction findMax(data: LegacyTimeSeries[] | TimeSeries[]): number {\n let max = 0;\n if (data.length && data[0] !== undefined && (data as TimeSeries[])[0]?.values) {\n (data as TimeSeries[]).forEach((series) => {\n series.values.forEach((valueTuple: TimeSeriesValueTuple) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [_, value] = valueTuple;\n if (typeof value === 'number' && value > max) {\n max = value;\n }\n });\n });\n } else {\n (data as LegacyTimeSeries[]).forEach((series) => {\n if (series.data !== undefined) {\n series.data.forEach((value: EChartsValues) => {\n if (typeof value === 'number' && value > max) {\n max = value;\n }\n });\n }\n });\n }\n return max;\n}\n\n/**\n * Converts Perses panel yAxis from dashboard spec to ECharts supported yAxis options.\n * Handles both linear and logarithmic scales with appropriate min/max calculations.\n */\nexport function convertPanelYAxis(inputAxis: TimeSeriesChartYAxisOptions = {}): YAXisComponentOption {\n // Determine the appropriate min value based on scale type and user input\n let minValue: YAXisComponentOption['min'];\n if (inputAxis.logBase !== undefined) {\n // For logarithmic scales without explicit min:\n // Let ECharts auto-calculate the range based on data to avoid issues with\n // function-based calculations which can result in improper ranges (e.g., 1-10)\n minValue = undefined;\n } else if (inputAxis?.min !== undefined) {\n // User explicitly set a min value - use it for both linear and log scales\n minValue = inputAxis.min;\n } else {\n // For linear scales without explicit min:\n // Use dynamic calculation with padding for better visualization\n // https://echarts.apache.org/en/option.html#yAxis.min\n minValue = (value): number => {\n if (value.min >= 0 && value.min <= 1) {\n // Helps with PercentDecimal units, or datasets that return 0 or 1 booleans\n return 0;\n }\n\n // Note: We can tweak the MULTIPLIER constants if we want\n // TODO: Experiment with using a padding that is based on the difference between max value and min value\n if (value.min > 0) {\n return roundDown(value.min * POSITIVE_MIN_VALUE_MULTIPLIER);\n } else {\n return roundDown(value.min * NEGATIVE_MIN_VALUE_MULTIPLIER);\n }\n };\n }\n\n // Build the yAxis configuration\n const yAxis: YAXisComponentOption = {\n show: inputAxis?.show ?? DEFAULT_Y_AXIS.show,\n min: minValue,\n max: inputAxis?.max,\n };\n\n // Apply logarithmic scale settings if requested\n if (inputAxis.logBase !== undefined) {\n return {\n ...yAxis,\n type: 'log',\n logBase: inputAxis.logBase,\n };\n }\n\n return yAxis;\n}\n\n/**\n * Rounds down to nearest number with one significant digit.\n *\n * Examples:\n * 1. 675 --> 600\n * 2. 0.567 --> 0.5\n * 3. -12 --> -20\n */\nexport function roundDown(num: number): number {\n const magnitude = Math.floor(Math.log10(Math.abs(num)));\n const firstDigit = Math.floor(num / Math.pow(10, magnitude));\n return firstDigit * Math.pow(10, magnitude);\n}\n"],"names":["OPTIMIZED_MODE_SERIES_LIMIT","getCommonTimeScale","DEFAULT_AREA_OPACITY","DEFAULT_CONNECT_NULLS","DEFAULT_LINE_WIDTH","DEFAULT_POINT_RADIUS","DEFAULT_Y_AXIS","POSITIVE_MIN_VALUE_MULTIPLIER","NEGATIVE_MIN_VALUE_MULTIPLIER","EMPTY_GRAPH_DATA","timeSeries","xAxis","legendItems","HIDE_DATAPOINTS_LIMIT","BLUR_FADEOUT_OPACITY","getCommonTimeScaleForQueries","queries","seriesData","map","query","data","getTimeSeries","id","datasetIndex","formattedName","visual","timeScale","paletteColor","querySettings","yAxisIndex","lineWidth","pointRadius","minuteMs","showPoints","rangeMs","display","series","type","name","color","stack","undefined","label","show","connectNulls","sampling","progressiveThreshold","showSymbol","showAllSymbol","symbolSize","lineStyle","width","areaStyle","opacity","areaOpacity","emphasis","focus","disabled","selectedMode","select","itemStyle","borderColor","borderWidth","blur","getThresholdSeries","threshold","seriesIndex","datasetId","convertPercentThreshold","percent","max","min","percentDecimal","adjustedMax","findMax","adjustedMin","total","length","values","forEach","valueTuple","_","value","convertPanelYAxis","inputAxis","minValue","logBase","roundDown","yAxis","num","magnitude","Math","floor","log10","abs","firstDigit","pow"],"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,SACEA,2BAA2B,EAM3BC,kBAAkB,QACb,yBAAyB;AAGhC,SACEC,oBAAoB,EACpBC,qBAAqB,EACrBC,kBAAkB,EAClBC,oBAAoB,EACpBC,cAAc,EACdC,6BAA6B,EAC7BC,6BAA6B,QAIxB,6BAA6B;AAIpC,OAAO,MAAMC,mBAAsC;IACjDC,YAAY,EAAE;IACdC,OAAO,EAAE;IACTC,aAAa,EAAE;AACjB,EAAE;AAEF,OAAO,MAAMC,wBAAwB,GAAG;AAExC,OAAO,MAAMC,uBAAuB,IAAI;AAExC;;;;CAIC,GACD,OAAO,SAASC,6BAA6BC,OAAyC;IACpF,MAAMC,aAAaD,QAAQE,GAAG,CAAC,CAACC,QAAUA,MAAMC,IAAI;IACpD,OAAOnB,mBAAmBgB;AAC5B;AAEA;;CAEC,GACD,OAAO,SAASI,cACdC,EAAU,EACVC,YAAoB,EACpBC,aAAqB,EACrBC,MAAoC,EACpCC,SAAoB,EACpBC,YAAoB,EACpBC,aAAmE,EACnEC,UAAmB;IAEnB,MAAMC,YAAYL,OAAOK,SAAS,IAAI1B;IACtC,MAAM2B,cAAcN,OAAOM,WAAW,IAAI1B;IAE1C,iFAAiF;IACjF,MAAM2B,WAAW;IACjB,IAAIC,aAAaP,UAAUQ,OAAO,IAAIF,WAAW;IACjD,kGAAkG;IAClG,IAAIP,OAAOQ,UAAU,KAAK,UAAU;QAClCA,aAAa;IACf;IAEA,IAAIR,OAAOU,OAAO,KAAK,OAAO;QAC5B,MAAMC,SAA0B;YAC9BC,MAAM;YAC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AAO,IAAI2C,WAAWb,QAAQ9B,WAAW;QACvC,0EAA0E;QAC1E4C,WAAWD,UAAUb,GAAG;IAC1B,OAAO;QACL,0CAA0C;QAC1C,gEAAgE;QAChE,sDAAsD;QACtDc,WAAW,CAACH;YACV,IAAIA,MAAMX,GAAG,IAAI,KAAKW,MAAMX,GAAG,IAAI,GAAG;gBACpC,2EAA2E;gBAC3E,OAAO;YACT;YAEA,yDAAyD;YACzD,wGAAwG;YACxG,IAAIW,MAAMX,GAAG,GAAG,GAAG;gBACjB,OAAOgB,UAAUL,MAAMX,GAAG,GAAGhE;YAC/B,OAAO;gBACL,OAAOgF,UAAUL,MAAMX,GAAG,GAAG/D;YAC/B;QACF;IACF;IAEA,gCAAgC;IAChC,MAAMgF,QAA8B;QAClC7C,MAAMyC,WAAWzC,QAAQrC,eAAeqC,IAAI;QAC5C4B,KAAKc;QACLf,KAAKc,WAAWd;IAClB;IAEA,gDAAgD;IAChD,IAAIc,UAAUE,OAAO,KAAK7C,WAAW;QACnC,OAAO;YACL,GAAG+C,KAAK;YACRnD,MAAM;YACNiD,SAASF,UAAUE,OAAO;QAC5B;IACF;IAEA,OAAOE;AACT;AAEA;;;;;;;CAOC,GACD,OAAO,SAASD,UAAUE,GAAW;IACnC,MAAMC,YAAYC,KAAKC,KAAK,CAACD,KAAKE,KAAK,CAACF,KAAKG,GAAG,CAACL;IACjD,MAAMM,aAAaJ,KAAKC,KAAK,CAACH,MAAME,KAAKK,GAAG,CAAC,IAAIN;IACjD,OAAOK,aAAaJ,KAAKK,GAAG,CAAC,IAAIN;AACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timezone-formatter.d.ts","sourceRoot":"","sources":["../../../src/utils/timezone-formatter.ts"],"names":[],"mappings":"AAmBA;;GAEG;AACH,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAC/D,OAAO,MAAM,KAAG,MAAM,CAyBxC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { formatWithTimeZone } from '@perses-dev/components';
|
|
14
|
+
const DAY_MS = 86400000;
|
|
15
|
+
const MONTH_MS = 2629440000;
|
|
16
|
+
const YEAR_MS = 31536000000;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a timezone-aware axis formatter function for different time ranges
|
|
19
|
+
*/ export function createTimezoneAwareAxisFormatter(rangeMs, timeZone) {
|
|
20
|
+
return function(value) {
|
|
21
|
+
const timeStamp = new Date(Number(value));
|
|
22
|
+
// more than 5 years
|
|
23
|
+
if (rangeMs > YEAR_MS * 5) {
|
|
24
|
+
return formatWithTimeZone(timeStamp, 'yyyy', timeZone);
|
|
25
|
+
}
|
|
26
|
+
// more than 2 years
|
|
27
|
+
if (rangeMs > YEAR_MS * 2) {
|
|
28
|
+
return formatWithTimeZone(timeStamp, 'MMM yyyy', timeZone);
|
|
29
|
+
}
|
|
30
|
+
// between 10 days to 6 months
|
|
31
|
+
if (rangeMs > DAY_MS * 10 && rangeMs < MONTH_MS * 6) {
|
|
32
|
+
return formatWithTimeZone(timeStamp, 'dd.MM', timeZone);
|
|
33
|
+
}
|
|
34
|
+
// between 2 and 10 days
|
|
35
|
+
if (rangeMs > DAY_MS * 2 && rangeMs <= DAY_MS * 10) {
|
|
36
|
+
return formatWithTimeZone(timeStamp, 'dd.MM HH:mm', timeZone);
|
|
37
|
+
}
|
|
38
|
+
return formatWithTimeZone(timeStamp, 'HH:mm', timeZone);
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=timezone-formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/timezone-formatter.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { formatWithTimeZone } from '@perses-dev/components';\n\nconst DAY_MS = 86400000;\nconst MONTH_MS = 2629440000;\nconst YEAR_MS = 31536000000;\n\n/**\n * Creates a timezone-aware axis formatter function for different time ranges\n */\nexport function createTimezoneAwareAxisFormatter(rangeMs: number, timeZone: string) {\n return function (value: number): string {\n const timeStamp = new Date(Number(value));\n\n // more than 5 years\n if (rangeMs > YEAR_MS * 5) {\n return formatWithTimeZone(timeStamp, 'yyyy', timeZone);\n }\n\n // more than 2 years\n if (rangeMs > YEAR_MS * 2) {\n return formatWithTimeZone(timeStamp, 'MMM yyyy', timeZone);\n }\n\n // between 10 days to 6 months\n if (rangeMs > DAY_MS * 10 && rangeMs < MONTH_MS * 6) {\n return formatWithTimeZone(timeStamp, 'dd.MM', timeZone);\n }\n\n // between 2 and 10 days\n if (rangeMs > DAY_MS * 2 && rangeMs <= DAY_MS * 10) {\n return formatWithTimeZone(timeStamp, 'dd.MM HH:mm', timeZone);\n }\n\n return formatWithTimeZone(timeStamp, 'HH:mm', timeZone);\n };\n}\n"],"names":["formatWithTimeZone","DAY_MS","MONTH_MS","YEAR_MS","createTimezoneAwareAxisFormatter","rangeMs","timeZone","value","timeStamp","Date","Number"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,kBAAkB,QAAQ,yBAAyB;AAE5D,MAAMC,SAAS;AACf,MAAMC,WAAW;AACjB,MAAMC,UAAU;AAEhB;;CAEC,GACD,OAAO,SAASC,iCAAiCC,OAAe,EAAEC,QAAgB;IAChF,OAAO,SAAUC,KAAa;QAC5B,MAAMC,YAAY,IAAIC,KAAKC,OAAOH;QAElC,oBAAoB;QACpB,IAAIF,UAAUF,UAAU,GAAG;YACzB,OAAOH,mBAAmBQ,WAAW,QAAQF;QAC/C;QAEA,oBAAoB;QACpB,IAAID,UAAUF,UAAU,GAAG;YACzB,OAAOH,mBAAmBQ,WAAW,YAAYF;QACnD;QAEA,8BAA8B;QAC9B,IAAID,UAAUJ,SAAS,MAAMI,UAAUH,WAAW,GAAG;YACnD,OAAOF,mBAAmBQ,WAAW,SAASF;QAChD;QAEA,wBAAwB;QACxB,IAAID,UAAUJ,SAAS,KAAKI,WAAWJ,SAAS,IAAI;YAClD,OAAOD,mBAAmBQ,WAAW,eAAeF;QACtD;QAEA,OAAON,mBAAmBQ,WAAW,SAASF;IAChD;AACF"}
|
package/mf-manifest.json
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
"name": "TimeSeriesChart",
|
|
6
6
|
"type": "app",
|
|
7
7
|
"buildInfo": {
|
|
8
|
-
"buildVersion": "0.
|
|
8
|
+
"buildVersion": "0.13.0-beta.1",
|
|
9
9
|
"buildName": "@perses-dev/timeseries-chart-plugin"
|
|
10
10
|
},
|
|
11
11
|
"remoteEntry": {
|
|
12
|
-
"name": "__mf/js/TimeSeriesChart.
|
|
12
|
+
"name": "__mf/js/TimeSeriesChart.f9dd142d.js",
|
|
13
13
|
"path": "",
|
|
14
14
|
"type": "global"
|
|
15
15
|
},
|
|
@@ -20,8 +20,7 @@
|
|
|
20
20
|
"api": ""
|
|
21
21
|
},
|
|
22
22
|
"globalName": "TimeSeriesChart",
|
|
23
|
-
"pluginVersion": "
|
|
24
|
-
"prefetchInterface": false,
|
|
23
|
+
"pluginVersion": "2.4.0",
|
|
25
24
|
"getPublicPath": "function() { const prefix = window.PERSES_PLUGIN_ASSETS_PATH || window.PERSES_APP_CONFIG?.api_prefix || \"\"; return prefix + \"/plugins/TimeSeriesChart/\"; }"
|
|
26
25
|
},
|
|
27
26
|
"shared": [
|
|
@@ -35,34 +34,36 @@
|
|
|
35
34
|
"js": {
|
|
36
35
|
"async": [],
|
|
37
36
|
"sync": [
|
|
38
|
-
"__mf/js/async/274.
|
|
37
|
+
"__mf/js/async/274.d112354f.js"
|
|
39
38
|
]
|
|
40
39
|
},
|
|
41
40
|
"css": {
|
|
42
41
|
"async": [],
|
|
43
42
|
"sync": []
|
|
44
43
|
}
|
|
45
|
-
}
|
|
44
|
+
},
|
|
45
|
+
"fallback": ""
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
48
|
"id": "TimeSeriesChart:@emotion/styled",
|
|
49
49
|
"name": "@emotion/styled",
|
|
50
|
-
"version": "11.14.
|
|
50
|
+
"version": "11.14.1",
|
|
51
51
|
"singleton": true,
|
|
52
|
-
"requiredVersion": "^11.14.
|
|
52
|
+
"requiredVersion": "^11.14.1",
|
|
53
53
|
"assets": {
|
|
54
54
|
"js": {
|
|
55
55
|
"async": [],
|
|
56
56
|
"sync": [
|
|
57
|
-
"__mf/js/async/235.
|
|
58
|
-
"__mf/js/async/616.
|
|
57
|
+
"__mf/js/async/235.c24f24f7.js",
|
|
58
|
+
"__mf/js/async/616.52acb1b4.js"
|
|
59
59
|
]
|
|
60
60
|
},
|
|
61
61
|
"css": {
|
|
62
62
|
"async": [],
|
|
63
63
|
"sync": []
|
|
64
64
|
}
|
|
65
|
-
}
|
|
65
|
+
},
|
|
66
|
+
"fallback": ""
|
|
66
67
|
},
|
|
67
68
|
{
|
|
68
69
|
"id": "TimeSeriesChart:@hookform/resolvers",
|
|
@@ -74,53 +75,58 @@
|
|
|
74
75
|
"js": {
|
|
75
76
|
"async": [],
|
|
76
77
|
"sync": [
|
|
77
|
-
"__mf/js/async/587.
|
|
78
|
-
"__mf/js/async/968.
|
|
78
|
+
"__mf/js/async/587.c12780da.js",
|
|
79
|
+
"__mf/js/async/968.6de5fa7c.js"
|
|
79
80
|
]
|
|
80
81
|
},
|
|
81
82
|
"css": {
|
|
82
83
|
"async": [],
|
|
83
84
|
"sync": []
|
|
84
85
|
}
|
|
85
|
-
}
|
|
86
|
+
},
|
|
87
|
+
"fallback": ""
|
|
86
88
|
},
|
|
87
89
|
{
|
|
88
90
|
"id": "TimeSeriesChart:@perses-dev/components",
|
|
89
91
|
"name": "@perses-dev/components",
|
|
90
|
-
"version": "0.
|
|
92
|
+
"version": "0.54.0-beta.3",
|
|
91
93
|
"singleton": true,
|
|
92
|
-
"requiredVersion": "^0.
|
|
94
|
+
"requiredVersion": "^0.54.0-beta.3",
|
|
93
95
|
"assets": {
|
|
94
96
|
"js": {
|
|
95
97
|
"async": [],
|
|
96
98
|
"sync": [
|
|
97
|
-
"__mf/js/async/
|
|
99
|
+
"__mf/js/async/907.5ce8f69d.js"
|
|
98
100
|
]
|
|
99
101
|
},
|
|
100
102
|
"css": {
|
|
101
103
|
"async": [],
|
|
102
|
-
"sync": [
|
|
104
|
+
"sync": [
|
|
105
|
+
"__mf/css/async/907.85c2cbf6.css"
|
|
106
|
+
]
|
|
103
107
|
}
|
|
104
|
-
}
|
|
108
|
+
},
|
|
109
|
+
"fallback": ""
|
|
105
110
|
},
|
|
106
111
|
{
|
|
107
112
|
"id": "TimeSeriesChart:@perses-dev/plugin-system",
|
|
108
113
|
"name": "@perses-dev/plugin-system",
|
|
109
|
-
"version": "0.
|
|
114
|
+
"version": "0.54.0-beta.3",
|
|
110
115
|
"singleton": true,
|
|
111
|
-
"requiredVersion": "^0.
|
|
116
|
+
"requiredVersion": "^0.54.0-beta.3",
|
|
112
117
|
"assets": {
|
|
113
118
|
"js": {
|
|
114
119
|
"async": [],
|
|
115
120
|
"sync": [
|
|
116
|
-
"__mf/js/async/
|
|
121
|
+
"__mf/js/async/187.2cc43fac.js"
|
|
117
122
|
]
|
|
118
123
|
},
|
|
119
124
|
"css": {
|
|
120
125
|
"async": [],
|
|
121
126
|
"sync": []
|
|
122
127
|
}
|
|
123
|
-
}
|
|
128
|
+
},
|
|
129
|
+
"fallback": ""
|
|
124
130
|
},
|
|
125
131
|
{
|
|
126
132
|
"id": "TimeSeriesChart:date-fns",
|
|
@@ -132,14 +138,15 @@
|
|
|
132
138
|
"js": {
|
|
133
139
|
"async": [],
|
|
134
140
|
"sync": [
|
|
135
|
-
"__mf/js/async/192.
|
|
141
|
+
"__mf/js/async/192.beef3a1a.js"
|
|
136
142
|
]
|
|
137
143
|
},
|
|
138
144
|
"css": {
|
|
139
145
|
"async": [],
|
|
140
146
|
"sync": []
|
|
141
147
|
}
|
|
142
|
-
}
|
|
148
|
+
},
|
|
149
|
+
"fallback": ""
|
|
143
150
|
},
|
|
144
151
|
{
|
|
145
152
|
"id": "TimeSeriesChart:echarts",
|
|
@@ -151,33 +158,35 @@
|
|
|
151
158
|
"js": {
|
|
152
159
|
"async": [],
|
|
153
160
|
"sync": [
|
|
154
|
-
"__mf/js/async/873.
|
|
161
|
+
"__mf/js/async/873.9aad328a.js"
|
|
155
162
|
]
|
|
156
163
|
},
|
|
157
164
|
"css": {
|
|
158
165
|
"async": [],
|
|
159
166
|
"sync": []
|
|
160
167
|
}
|
|
161
|
-
}
|
|
168
|
+
},
|
|
169
|
+
"fallback": ""
|
|
162
170
|
},
|
|
163
171
|
{
|
|
164
172
|
"id": "TimeSeriesChart:lodash",
|
|
165
173
|
"name": "lodash",
|
|
166
|
-
"version": "4.
|
|
174
|
+
"version": "4.18.1",
|
|
167
175
|
"singleton": true,
|
|
168
|
-
"requiredVersion": "^4.
|
|
176
|
+
"requiredVersion": "^4.18.1",
|
|
169
177
|
"assets": {
|
|
170
178
|
"js": {
|
|
171
179
|
"async": [],
|
|
172
180
|
"sync": [
|
|
173
|
-
"__mf/js/async/392.
|
|
181
|
+
"__mf/js/async/392.2350fb02.js"
|
|
174
182
|
]
|
|
175
183
|
},
|
|
176
184
|
"css": {
|
|
177
185
|
"async": [],
|
|
178
186
|
"sync": []
|
|
179
187
|
}
|
|
180
|
-
}
|
|
188
|
+
},
|
|
189
|
+
"fallback": ""
|
|
181
190
|
},
|
|
182
191
|
{
|
|
183
192
|
"id": "TimeSeriesChart:react-dom",
|
|
@@ -189,14 +198,15 @@
|
|
|
189
198
|
"js": {
|
|
190
199
|
"async": [],
|
|
191
200
|
"sync": [
|
|
192
|
-
"__mf/js/async/470.
|
|
201
|
+
"__mf/js/async/470.a4fd777e.js"
|
|
193
202
|
]
|
|
194
203
|
},
|
|
195
204
|
"css": {
|
|
196
205
|
"async": [],
|
|
197
206
|
"sync": []
|
|
198
207
|
}
|
|
199
|
-
}
|
|
208
|
+
},
|
|
209
|
+
"fallback": ""
|
|
200
210
|
},
|
|
201
211
|
{
|
|
202
212
|
"id": "TimeSeriesChart:react",
|
|
@@ -208,14 +218,15 @@
|
|
|
208
218
|
"js": {
|
|
209
219
|
"async": [],
|
|
210
220
|
"sync": [
|
|
211
|
-
"__mf/js/async/121.
|
|
221
|
+
"__mf/js/async/121.df4898d6.js"
|
|
212
222
|
]
|
|
213
223
|
},
|
|
214
224
|
"css": {
|
|
215
225
|
"async": [],
|
|
216
226
|
"sync": []
|
|
217
227
|
}
|
|
218
|
-
}
|
|
228
|
+
},
|
|
229
|
+
"fallback": ""
|
|
219
230
|
},
|
|
220
231
|
{
|
|
221
232
|
"id": "TimeSeriesChart:date-fns-tz",
|
|
@@ -227,14 +238,15 @@
|
|
|
227
238
|
"js": {
|
|
228
239
|
"async": [],
|
|
229
240
|
"sync": [
|
|
230
|
-
"__mf/js/async/978.
|
|
241
|
+
"__mf/js/async/978.5c14e175.js"
|
|
231
242
|
]
|
|
232
243
|
},
|
|
233
244
|
"css": {
|
|
234
245
|
"async": [],
|
|
235
246
|
"sync": []
|
|
236
247
|
}
|
|
237
|
-
}
|
|
248
|
+
},
|
|
249
|
+
"fallback": ""
|
|
238
250
|
}
|
|
239
251
|
],
|
|
240
252
|
"remotes": [],
|
|
@@ -245,28 +257,26 @@
|
|
|
245
257
|
"assets": {
|
|
246
258
|
"js": {
|
|
247
259
|
"sync": [
|
|
248
|
-
"__mf/js/async/702.
|
|
249
|
-
"__mf/js/async/
|
|
250
|
-
"__mf/js/async/78.
|
|
251
|
-
"__mf/js/async/
|
|
252
|
-
"__mf/js/async/
|
|
253
|
-
"__mf/js/async/__federation_expose_TimeSeriesChart.54276867.js"
|
|
260
|
+
"__mf/js/async/702.de247ad8.js",
|
|
261
|
+
"__mf/js/async/681.8d61b348.js",
|
|
262
|
+
"__mf/js/async/78.91de282a.js",
|
|
263
|
+
"__mf/js/async/724.3439df06.js",
|
|
264
|
+
"__mf/js/async/__federation_expose_TimeSeriesChart.d1167045.js"
|
|
254
265
|
],
|
|
255
266
|
"async": [
|
|
256
|
-
"__mf/js/async/
|
|
257
|
-
"__mf/js/async/
|
|
258
|
-
"__mf/js/async/
|
|
259
|
-
"__mf/js/async/
|
|
260
|
-
"__mf/js/async/491.
|
|
261
|
-
"__mf/js/async/lib-router.
|
|
262
|
-
"__mf/js/async/177.
|
|
267
|
+
"__mf/js/async/588.6662e16a.js",
|
|
268
|
+
"__mf/js/async/356.9f551c8a.js",
|
|
269
|
+
"__mf/js/async/71.84e486c9.js",
|
|
270
|
+
"__mf/js/async/780.12a33d06.js",
|
|
271
|
+
"__mf/js/async/491.6f81cf51.js",
|
|
272
|
+
"__mf/js/async/lib-router.1934857d.js",
|
|
273
|
+
"__mf/js/async/177.56f1be10.js"
|
|
263
274
|
]
|
|
264
275
|
},
|
|
265
276
|
"css": {
|
|
266
277
|
"sync": [],
|
|
267
278
|
"async": [
|
|
268
|
-
"__mf/css/async/
|
|
269
|
-
"__mf/css/async/823.d3010b86.css"
|
|
279
|
+
"__mf/css/async/907.85c2cbf6.css"
|
|
270
280
|
]
|
|
271
281
|
}
|
|
272
282
|
},
|