@perses-dev/heatmap-chart-plugin 0.5.0 → 0.6.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.
Files changed (94) hide show
  1. package/__mf/js/{HeatMapChart.6c4e6e06.js → HeatMapChart.6613b45e.js} +7 -7
  2. package/__mf/js/async/121.e63b0807.js +2 -0
  3. package/__mf/js/async/362.8b36602d.js +1 -0
  4. package/__mf/js/async/392.f80b3f92.js +2 -0
  5. package/__mf/js/async/470.6b4b5f7b.js +2 -0
  6. package/__mf/js/async/569.8e18ce20.js +71 -0
  7. package/__mf/js/async/888.52ddc939.js +1 -0
  8. package/__mf/js/async/941.ea6b3111.js +2 -0
  9. package/__mf/js/async/963.9dc879ab.js +1 -0
  10. package/__mf/js/async/{980.03e0a41f.js → 980.f28cf53e.js} +2 -2
  11. package/__mf/js/async/{__federation_expose_HeatMapChart.b3d43042.js → __federation_expose_HeatMapChart.a270bda0.js} +2 -2
  12. package/__mf/js/{main.bec55b3a.js → main.4b170e45.js} +3 -3
  13. package/lib/HeatMapChart.d.ts +3 -3
  14. package/lib/HeatMapChart.d.ts.map +1 -1
  15. package/lib/HeatMapChart.js +2 -2
  16. package/lib/HeatMapChart.js.map +1 -1
  17. package/lib/bootstrap.js +2 -2
  18. package/lib/components/HeatMapChart.d.ts +4 -4
  19. package/lib/components/HeatMapChart.d.ts.map +1 -1
  20. package/lib/components/HeatMapChart.js +8 -8
  21. package/lib/components/HeatMapChart.js.map +1 -1
  22. package/lib/components/HeatMapChartOptionsEditorSettings.d.ts +2 -2
  23. package/lib/components/HeatMapChartOptionsEditorSettings.d.ts.map +1 -1
  24. package/lib/components/HeatMapChartOptionsEditorSettings.js +6 -6
  25. package/lib/components/HeatMapChartOptionsEditorSettings.js.map +1 -1
  26. package/lib/components/HeatMapChartPanel.d.ts +4 -4
  27. package/lib/components/HeatMapChartPanel.d.ts.map +1 -1
  28. package/lib/components/HeatMapChartPanel.js +6 -6
  29. package/lib/components/HeatMapChartPanel.js.map +1 -1
  30. package/lib/components/HeatMapTooltip.d.ts +3 -3
  31. package/lib/components/HeatMapTooltip.d.ts.map +1 -1
  32. package/lib/components/HeatMapTooltip.js +2 -2
  33. package/lib/components/HeatMapTooltip.js.map +1 -1
  34. package/lib/components/index.js +3 -3
  35. package/lib/components/index.js.map +1 -1
  36. package/lib/getPluginModule.d.ts +1 -1
  37. package/lib/getPluginModule.d.ts.map +1 -1
  38. package/lib/getPluginModule.js +3 -1
  39. package/lib/getPluginModule.js.map +1 -1
  40. package/lib/heat-map-chart-model.d.ts +3 -3
  41. package/lib/heat-map-chart-model.d.ts.map +1 -1
  42. package/lib/heat-map-chart-model.js.map +1 -1
  43. package/lib/index-federation.js +1 -1
  44. package/lib/index.js +4 -4
  45. package/lib/index.js.map +1 -1
  46. package/lib/setup-tests.d.ts +1 -1
  47. package/lib/setup-tests.d.ts.map +1 -1
  48. package/lib/setup-tests.js +2 -2
  49. package/lib/setup-tests.js.map +1 -1
  50. package/lib/utils/data-transform.d.ts +2 -2
  51. package/lib/utils/data-transform.d.ts.map +1 -1
  52. package/lib/utils/data-transform.js +1 -1
  53. package/lib/utils/data-transform.js.map +1 -1
  54. package/lib/utils/get-formatted-axis-label.js +1 -1
  55. package/lib/utils/index.js +3 -3
  56. package/lib/utils/index.js.map +1 -1
  57. package/lib/utils/thresholds.d.ts +1 -1
  58. package/lib/utils/thresholds.d.ts.map +1 -1
  59. package/lib/utils/thresholds.js.map +1 -1
  60. package/mf-manifest.json +18 -18
  61. package/mf-stats.json +18 -18
  62. package/package.json +10 -10
  63. package/__mf/js/async/121.c8aa4904.js +0 -2
  64. package/__mf/js/async/392.97acdaa7.js +0 -2
  65. package/__mf/js/async/470.c23991fd.js +0 -2
  66. package/__mf/js/async/535.e475e67c.js +0 -1
  67. package/__mf/js/async/695.a3b5a24f.js +0 -71
  68. package/__mf/js/async/888.6a71bc7f.js +0 -1
  69. package/__mf/js/async/941.86aff2f9.js +0 -2
  70. package/__mf/js/async/963.ddc66183.js +0 -1
  71. package/lib/cjs/HeatMapChart.js +0 -40
  72. package/lib/cjs/bootstrap.js +0 -26
  73. package/lib/cjs/components/HeatMapChart.js +0 -227
  74. package/lib/cjs/components/HeatMapChartOptionsEditorSettings.js +0 -140
  75. package/lib/cjs/components/HeatMapChartPanel.js +0 -227
  76. package/lib/cjs/components/HeatMapTooltip.js +0 -57
  77. package/lib/cjs/components/index.js +0 -32
  78. package/lib/cjs/env.d.js +0 -14
  79. package/lib/cjs/getPluginModule.js +0 -39
  80. package/lib/cjs/heat-map-chart-model.js +0 -80
  81. package/lib/cjs/index-federation.js +0 -55
  82. package/lib/cjs/index.js +0 -47
  83. package/lib/cjs/setup-tests.js +0 -19
  84. package/lib/cjs/utils/data-transform.js +0 -46
  85. package/lib/cjs/utils/get-formatted-axis-label.js +0 -48
  86. package/lib/cjs/utils/index.js +0 -32
  87. package/lib/cjs/utils/thresholds.js +0 -34
  88. /package/__mf/css/async/{695.85c2cbf6.css → 569.85c2cbf6.css} +0 -0
  89. /package/__mf/js/async/{121.c8aa4904.js.LICENSE.txt → 121.e63b0807.js.LICENSE.txt} +0 -0
  90. /package/__mf/js/async/{392.97acdaa7.js.LICENSE.txt → 392.f80b3f92.js.LICENSE.txt} +0 -0
  91. /package/__mf/js/async/{470.c23991fd.js.LICENSE.txt → 470.6b4b5f7b.js.LICENSE.txt} +0 -0
  92. /package/__mf/js/async/{695.a3b5a24f.js.LICENSE.txt → 569.8e18ce20.js.LICENSE.txt} +0 -0
  93. /package/__mf/js/async/{941.86aff2f9.js.LICENSE.txt → 941.ea6b3111.js.LICENSE.txt} +0 -0
  94. /package/__mf/js/async/{980.03e0a41f.js.LICENSE.txt → 980.f28cf53e.js.LICENSE.txt} +0 -0
@@ -1,227 +0,0 @@
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
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- Object.defineProperty(exports, "HeatMapChartPanel", {
18
- enumerable: true,
19
- get: function() {
20
- return HeatMapChartPanel;
21
- }
22
- });
23
- const _jsxruntime = require("react/jsx-runtime");
24
- const _material = require("@mui/material");
25
- const _merge = /*#__PURE__*/ _interop_require_default(require("lodash/merge"));
26
- const _react = require("react");
27
- const _heatmapchartmodel = require("../heat-map-chart-model");
28
- const _utils = require("../utils");
29
- const _HeatMapChart = require("./HeatMapChart");
30
- function _interop_require_default(obj) {
31
- return obj && obj.__esModule ? obj : {
32
- default: obj
33
- };
34
- }
35
- /**
36
- * Helper function to get the effective lower bound for log scale.
37
- * For values <= 0, we use a small fraction of the upper bound.
38
- */ const getEffectiveLowerBound = (lowerBound, upperBound, logBase)=>{
39
- if (logBase === undefined || lowerBound > 0) {
40
- return lowerBound;
41
- }
42
- // For log scales with non-positive lower bounds, use a small fraction of upper bound
43
- // This ensures the bucket is still visible on the log scale
44
- return upperBound * 0.001;
45
- };
46
- function HeatMapChartPanel(props) {
47
- const { spec: pluginSpec, contentDimensions, queryResults } = props;
48
- // ensures all default format properties set if undef
49
- const yAxisFormat = (0, _merge.default)({}, _heatmapchartmodel.DEFAULT_FORMAT, pluginSpec.yAxisFormat);
50
- const countFormat = (0, _merge.default)({}, _heatmapchartmodel.DEFAULT_FORMAT, pluginSpec.countFormat);
51
- const { data, xAxisCategories, min, max, countMin, countMax, timeScale } = (0, _react.useMemo)(()=>{
52
- if (!queryResults || queryResults.length === 0) {
53
- return {
54
- data: [],
55
- xAxisCategories: [],
56
- min: 0,
57
- max: 0,
58
- countMin: 0,
59
- countMax: 0,
60
- timeScale: undefined
61
- };
62
- }
63
- if (queryResults.length !== 1 || queryResults[0].data.series.length !== 1 || queryResults[0].data.series[0].histograms === undefined) {
64
- return {
65
- data: [],
66
- xAxisCategories: [],
67
- min: 0,
68
- max: 0,
69
- countMin: 0,
70
- countMax: 0,
71
- timeScale: undefined
72
- };
73
- }
74
- const series = queryResults[0].data.series[0];
75
- const timeScale = (0, _utils.getCommonTimeScaleForQueries)(queryResults);
76
- const xAxisCategories = (0, _utils.generateCompleteTimestamps)(timeScale);
77
- const logBase = pluginSpec.logBase;
78
- // Dummy value that will be replaced at the first iteration
79
- let lowestBound = Infinity;
80
- let highestBound = -Infinity;
81
- let countMin = Infinity;
82
- let countMax = -Infinity;
83
- for (const [, histogram] of series?.histograms ?? []){
84
- for (const bucket of histogram?.buckets ?? []){
85
- const [, lowerBound, upperBound, count] = bucket;
86
- let lowerBoundFloat = parseFloat(lowerBound);
87
- const upperBoundFloat = parseFloat(upperBound);
88
- const countFloat = parseFloat(count);
89
- // For logarithmic scales, skip buckets that would be entirely non-positive
90
- if (logBase !== undefined && upperBoundFloat <= 0) {
91
- continue;
92
- }
93
- // For log scales, adjust non-positive lower bounds
94
- if (logBase !== undefined) {
95
- lowerBoundFloat = getEffectiveLowerBound(lowerBoundFloat, upperBoundFloat, logBase);
96
- }
97
- if (lowerBoundFloat < lowestBound) {
98
- lowestBound = lowerBoundFloat;
99
- }
100
- if (upperBoundFloat > highestBound) {
101
- highestBound = upperBoundFloat;
102
- }
103
- if (countFloat < countMin) {
104
- countMin = countFloat;
105
- }
106
- if (countFloat > countMax) {
107
- countMax = countFloat;
108
- }
109
- }
110
- }
111
- const data = [];
112
- // Each bucket becomes a rectangle spanning [lowerBound, upperBound] at the given x index
113
- for (const [time, histogram] of series?.histograms ?? []){
114
- const itemIndexOnXaxis = xAxisCategories.findIndex((v)=>v === time * 1000);
115
- for (const bucket of histogram?.buckets ?? []){
116
- const [, lowerBound, upperBound, count] = bucket;
117
- let lowerBoundFloat = parseFloat(lowerBound);
118
- const upperBoundFloat = parseFloat(upperBound);
119
- // For logarithmic scales, skip buckets that would be entirely non-positive
120
- if (logBase !== undefined && upperBoundFloat <= 0) {
121
- continue;
122
- }
123
- // For log scales, adjust non-positive lower bounds
124
- if (logBase !== undefined) {
125
- lowerBoundFloat = getEffectiveLowerBound(lowerBoundFloat, upperBoundFloat, logBase);
126
- }
127
- data.push({
128
- value: [
129
- itemIndexOnXaxis,
130
- lowerBoundFloat,
131
- upperBoundFloat,
132
- parseFloat(count)
133
- ],
134
- label: count
135
- });
136
- }
137
- }
138
- return {
139
- data,
140
- xAxisCategories,
141
- min: lowestBound === Infinity ? undefined : lowestBound,
142
- max: highestBound === -Infinity ? undefined : highestBound,
143
- countMin,
144
- countMax,
145
- timeScale
146
- };
147
- }, [
148
- pluginSpec.logBase,
149
- queryResults
150
- ]);
151
- // Use configured min/max if provided, otherwise use calculated values
152
- // For logarithmic scales, ignore user-provided min if it's <= 0 (log of non-positive is undefined)
153
- // and let ECharts auto-calculate the range to avoid rendering issues
154
- const finalMin = (0, _react.useMemo)(()=>{
155
- if (pluginSpec.logBase !== undefined) {
156
- // For log scale, ignore min if it's <= 0 or let ECharts auto-calculate
157
- if (pluginSpec.min !== undefined && pluginSpec.min <= 0) {
158
- return undefined; // Let ECharts auto-calculate
159
- }
160
- return pluginSpec.min ?? min;
161
- }
162
- return pluginSpec.min ?? min;
163
- }, [
164
- pluginSpec.logBase,
165
- pluginSpec.min,
166
- min
167
- ]);
168
- const finalMax = (0, _react.useMemo)(()=>{
169
- if (pluginSpec.logBase !== undefined) {
170
- // For log scale, ignore max if it's <= 0
171
- if (pluginSpec.max !== undefined && pluginSpec.max <= 0) {
172
- return undefined; // Let ECharts auto-calculate
173
- }
174
- return pluginSpec.max ?? max;
175
- }
176
- return pluginSpec.max ?? max;
177
- }, [
178
- pluginSpec.logBase,
179
- pluginSpec.max,
180
- max
181
- ]);
182
- // TODO: add support for multiple queries
183
- if (queryResults.length > 1) {
184
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
185
- justifyContent: "center",
186
- height: "100%",
187
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
188
- variant: "body2",
189
- textAlign: "center",
190
- children: "Only one query at a time is supported for now"
191
- })
192
- });
193
- }
194
- // Mo data message handled inside chart component
195
- if (data.length === 0) {
196
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
197
- justifyContent: "center",
198
- height: "100%",
199
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
200
- variant: "body2",
201
- textAlign: "center",
202
- children: "No data available (only native histograms are supported for now)"
203
- })
204
- });
205
- }
206
- if (contentDimensions === undefined) return null;
207
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
208
- direction: "row",
209
- justifyContent: "center",
210
- alignItems: "center",
211
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_HeatMapChart.HeatMapChart, {
212
- width: contentDimensions.width,
213
- height: contentDimensions.height,
214
- data: data,
215
- xAxisCategories: xAxisCategories,
216
- yAxisFormat: yAxisFormat,
217
- countFormat: countFormat,
218
- countMin: countMin,
219
- countMax: countMax,
220
- timeScale: timeScale,
221
- showVisualMap: pluginSpec.showVisualMap,
222
- min: finalMin,
223
- max: finalMax,
224
- logBase: pluginSpec.logBase
225
- })
226
- });
227
- }
@@ -1,57 +0,0 @@
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
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- Object.defineProperty(exports, "generateTooltipHTML", {
18
- enumerable: true,
19
- get: function() {
20
- return generateTooltipHTML;
21
- }
22
- });
23
- const _material = require("@mui/material");
24
- const _components = require("@perses-dev/components");
25
- function generateTooltipHTML({ data, label, marker, xAxisCategories, theme, yAxisFormat, countFormat }) {
26
- const [xIndex, yLower, yUpper] = data;
27
- const xAxisLabel = xAxisCategories[xIndex];
28
- const { formattedDate, formattedTime } = (0, _components.getDateAndTime)(xAxisLabel);
29
- const tooltipHeader = (0, _material.css)`
30
- border-bottom: 1px solid ${theme.palette.grey[500]};
31
- padding-bottom: 8px;
32
- `;
33
- const tooltipContentStyles = (0, _material.css)`
34
- display: flex;
35
- justify-content: space-between;
36
- padding-top: 8px;
37
- `;
38
- const labelStyles = (0, _material.css)`
39
- margin-right: 16px;
40
- `;
41
- const lowerBound = yLower;
42
- const upperBound = yUpper;
43
- return `
44
- <div>
45
- <div style="${tooltipHeader.styles}">${formattedDate} - ${formattedTime}</div>
46
- <div style="${tooltipContentStyles.styles}">
47
- <div style="${labelStyles.styles}">
48
- ${marker}
49
- <strong>${(0, _components.formatValue)(lowerBound, yAxisFormat)} - ${(0, _components.formatValue)(upperBound, yAxisFormat)}</strong>
50
- </div>
51
- <div>
52
- ${(0, _components.formatValue)(parseFloat(label), countFormat)}
53
- </div>
54
- </div>
55
- </div>
56
- `;
57
- }
@@ -1,32 +0,0 @@
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
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- _export_star(require("./HeatMapChartOptionsEditorSettings"), exports);
18
- _export_star(require("./HeatMapChartPanel"), exports);
19
- _export_star(require("./HeatMapChart"), exports);
20
- function _export_star(from, to) {
21
- Object.keys(from).forEach(function(k) {
22
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
23
- Object.defineProperty(to, k, {
24
- enumerable: true,
25
- get: function() {
26
- return from[k];
27
- }
28
- });
29
- }
30
- });
31
- return from;
32
- }
package/lib/cjs/env.d.js DELETED
@@ -1,14 +0,0 @@
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
- /// <reference types="@rsbuild/core/types" />
14
- "use strict";
@@ -1,39 +0,0 @@
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
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- Object.defineProperty(exports, "getPluginModule", {
18
- enumerable: true,
19
- get: function() {
20
- return getPluginModule;
21
- }
22
- });
23
- const _packagejson = /*#__PURE__*/ _interop_require_default(require("../package.json"));
24
- function _interop_require_default(obj) {
25
- return obj && obj.__esModule ? obj : {
26
- default: obj
27
- };
28
- }
29
- function getPluginModule() {
30
- const { name, version, perses } = _packagejson.default;
31
- return {
32
- kind: 'PluginModule',
33
- metadata: {
34
- name,
35
- version
36
- },
37
- spec: perses
38
- };
39
- }
@@ -1,80 +0,0 @@
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
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- function _export(target, all) {
18
- for(var name in all)Object.defineProperty(target, name, {
19
- enumerable: true,
20
- get: Object.getOwnPropertyDescriptor(all, name).get
21
- });
22
- }
23
- _export(exports, {
24
- get DEFAULT_FORMAT () {
25
- return DEFAULT_FORMAT;
26
- },
27
- get DEFAULT_MAX_PERCENT () {
28
- return DEFAULT_MAX_PERCENT;
29
- },
30
- get DEFAULT_MAX_PERCENT_DECIMAL () {
31
- return DEFAULT_MAX_PERCENT_DECIMAL;
32
- },
33
- get DEFAULT_MIN_PERCENT () {
34
- return DEFAULT_MIN_PERCENT;
35
- },
36
- get DEFAULT_MIN_PERCENT_DECIMAL () {
37
- return DEFAULT_MIN_PERCENT_DECIMAL;
38
- },
39
- get LOG_BASE_CONFIG () {
40
- return LOG_BASE_CONFIG;
41
- },
42
- get LOG_BASE_OPTIONS () {
43
- return LOG_BASE_OPTIONS;
44
- },
45
- get createInitialHeatMapChartOptions () {
46
- return createInitialHeatMapChartOptions;
47
- }
48
- });
49
- const DEFAULT_FORMAT = {
50
- unit: 'decimal'
51
- };
52
- const DEFAULT_MIN_PERCENT = 0;
53
- const DEFAULT_MAX_PERCENT = 100;
54
- const DEFAULT_MIN_PERCENT_DECIMAL = 0;
55
- const DEFAULT_MAX_PERCENT_DECIMAL = 1;
56
- const LOG_BASE_CONFIG = {
57
- none: {
58
- label: 'None',
59
- log: undefined
60
- },
61
- '2': {
62
- label: '2',
63
- log: 2
64
- },
65
- '10': {
66
- label: '10',
67
- log: 10
68
- }
69
- };
70
- const LOG_BASE_OPTIONS = Object.entries(LOG_BASE_CONFIG).map(([id, config])=>({
71
- id: id,
72
- ...config
73
- }));
74
- function createInitialHeatMapChartOptions() {
75
- return {
76
- yAxisFormat: DEFAULT_FORMAT,
77
- countFormat: DEFAULT_FORMAT,
78
- showVisualMap: true
79
- };
80
- }
@@ -1,55 +0,0 @@
1
- "use strict";
2
- function _getRequireWildcardCache(nodeInterop) {
3
- if (typeof WeakMap !== "function") return null;
4
- var cacheBabelInterop = new WeakMap();
5
- var cacheNodeInterop = new WeakMap();
6
- return (_getRequireWildcardCache = function(nodeInterop) {
7
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
8
- })(nodeInterop);
9
- }
10
- function _interop_require_wildcard(obj, nodeInterop) {
11
- if (!nodeInterop && obj && obj.__esModule) {
12
- return obj;
13
- }
14
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
15
- return {
16
- default: obj
17
- };
18
- }
19
- var cache = _getRequireWildcardCache(nodeInterop);
20
- if (cache && cache.has(obj)) {
21
- return cache.get(obj);
22
- }
23
- var newObj = {
24
- __proto__: null
25
- };
26
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
27
- for(var key in obj){
28
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
29
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
30
- if (desc && (desc.get || desc.set)) {
31
- Object.defineProperty(newObj, key, desc);
32
- } else {
33
- newObj[key] = obj[key];
34
- }
35
- }
36
- }
37
- newObj.default = obj;
38
- if (cache) {
39
- cache.set(obj, newObj);
40
- }
41
- return newObj;
42
- }
43
- // Copyright The Perses Authors
44
- // Licensed under the Apache License, Version 2.0 (the "License");
45
- // you may not use this file except in compliance with the License.
46
- // You may obtain a copy of the License at
47
- //
48
- // http://www.apache.org/licenses/LICENSE-2.0
49
- //
50
- // Unless required by applicable law or agreed to in writing, software
51
- // distributed under the License is distributed on an "AS IS" BASIS,
52
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
53
- // See the License for the specific language governing permissions and
54
- // limitations under the License.
55
- Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("./bootstrap")));
package/lib/cjs/index.js DELETED
@@ -1,47 +0,0 @@
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
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- function _export(target, all) {
18
- for(var name in all)Object.defineProperty(target, name, {
19
- enumerable: true,
20
- get: Object.getOwnPropertyDescriptor(all, name).get
21
- });
22
- }
23
- _export(exports, {
24
- get HeatMapChartPanel () {
25
- return _components.HeatMapChartPanel;
26
- },
27
- get getPluginModule () {
28
- return _getPluginModule.getPluginModule;
29
- }
30
- });
31
- const _getPluginModule = require("./getPluginModule");
32
- const _components = require("./components");
33
- _export_star(require("./heat-map-chart-model"), exports);
34
- _export_star(require("./HeatMapChart"), exports);
35
- function _export_star(from, to) {
36
- Object.keys(from).forEach(function(k) {
37
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
38
- Object.defineProperty(to, k, {
39
- enumerable: true,
40
- get: function() {
41
- return from[k];
42
- }
43
- });
44
- }
45
- });
46
- return from;
47
- }
@@ -1,19 +0,0 @@
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
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- require("@testing-library/jest-dom");
18
- // Always mock e-charts during tests since we don't have a proper canvas in jsdom
19
- jest.mock('echarts/core');
@@ -1,46 +0,0 @@
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
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- function _export(target, all) {
18
- for(var name in all)Object.defineProperty(target, name, {
19
- enumerable: true,
20
- get: Object.getOwnPropertyDescriptor(all, name).get
21
- });
22
- }
23
- _export(exports, {
24
- get generateCompleteTimestamps () {
25
- return generateCompleteTimestamps;
26
- },
27
- get getCommonTimeScaleForQueries () {
28
- return getCommonTimeScaleForQueries;
29
- }
30
- });
31
- const _components = require("@perses-dev/components");
32
- function getCommonTimeScaleForQueries(queries) {
33
- const seriesData = queries.map((query)=>query.data);
34
- return (0, _components.getCommonTimeScale)(seriesData);
35
- }
36
- function generateCompleteTimestamps(timescale) {
37
- if (!timescale) {
38
- return [];
39
- }
40
- const { startMs, endMs, stepMs } = timescale;
41
- const timestamps = [];
42
- for(let time = startMs; time <= endMs; time += stepMs){
43
- timestamps.push(time);
44
- }
45
- return timestamps;
46
- }
@@ -1,48 +0,0 @@
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
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- Object.defineProperty(exports, "getFormattedHeatmapAxisLabel", {
18
- enumerable: true,
19
- get: function() {
20
- return getFormattedHeatmapAxisLabel;
21
- }
22
- });
23
- const _components = require("@perses-dev/components");
24
- function getFormattedHeatmapAxisLabel(rangeMs, timezone) {
25
- return function(value) {
26
- const dayMs = 86400000;
27
- const monthMs = 2629440000;
28
- const yearMs = 31536000000;
29
- const timeStamp = new Date(Number(value));
30
- // more than 5 years
31
- if (rangeMs > yearMs * 5) {
32
- return (0, _components.formatWithTimeZone)(timeStamp, 'yyy', timezone);
33
- }
34
- // more than 2 years
35
- if (rangeMs > yearMs * 2) {
36
- return (0, _components.formatWithTimeZone)(timeStamp, 'MMM yyy', timezone);
37
- }
38
- // between 5 days to 6 months
39
- if (rangeMs > dayMs * 10 && rangeMs < monthMs * 6) {
40
- return (0, _components.formatWithTimeZone)(timeStamp, 'dd.MM', timezone); // 12-01
41
- }
42
- // between 2 and 10 days
43
- if (rangeMs > dayMs * 2 && rangeMs <= dayMs * 10) {
44
- return (0, _components.formatWithTimeZone)(timeStamp, 'dd.MM HH:mm', timezone); // 12-01; // 12-01 12:30
45
- }
46
- return (0, _components.formatWithTimeZone)(timeStamp, 'HH:mm', timezone);
47
- };
48
- }