@cloudtower/eagle 0.32.40 → 0.32.41

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 (91) hide show
  1. package/dist/__test__/mockLineChart.d.ts +4 -0
  2. package/dist/cjs/core/ConfigProvider/index.js +5 -5
  3. package/dist/cjs/core/LineChart/LineChartActions.js +52 -0
  4. package/dist/cjs/core/LineChart/LineChartLegend.js +101 -0
  5. package/dist/cjs/core/LineChart/LineChartToolBar.js +56 -0
  6. package/dist/cjs/core/LineChart/Pointer.js +45 -0
  7. package/dist/cjs/core/LineChart/RenderChart.js +304 -0
  8. package/dist/cjs/core/LineChart/TooltipFormatter.js +70 -0
  9. package/dist/cjs/core/LineChart/index.js +66 -0
  10. package/dist/cjs/core/LineChart/styled.js +35 -0
  11. package/dist/cjs/core/LineChart/type.js +30 -0
  12. package/dist/cjs/core/LineChart/utils.js +394 -0
  13. package/dist/cjs/core/Loading/index.js +2 -2
  14. package/dist/cjs/core/Progress/progress.widgets.js +1 -1
  15. package/dist/cjs/core/Timeline/Timeline.widget.js +4 -4
  16. package/dist/cjs/core/Timeline/index.js +4 -4
  17. package/dist/cjs/core/index.js +9 -9
  18. package/dist/cjs/coreX/CheckPointList/index.js +3 -3
  19. package/dist/cjs/coreX/CircleLoading/index.js +4 -4
  20. package/dist/cjs/coreX/DateRangePicker/Calendar.js +1 -1
  21. package/dist/cjs/coreX/Dialogs/DeleteDialog/DeleteDialog.js +47 -0
  22. package/dist/cjs/coreX/Dialogs/RejectDialog/RejectDialog.js +87 -0
  23. package/dist/cjs/coreX/Dialogs/RejectDialog/RejectDialog.type.js +11 -0
  24. package/dist/cjs/coreX/Dialogs/SmallDialog.js +86 -0
  25. package/dist/cjs/index.js +168 -131
  26. package/dist/cjs/stats1.html +1 -1
  27. package/dist/cjs/utils/constants.js +1 -1
  28. package/dist/cjs/utils/tower.js +81 -0
  29. package/dist/components.css +2512 -2178
  30. package/dist/esm/core/ConfigProvider/index.js +3 -3
  31. package/dist/esm/core/LineChart/LineChartActions.js +46 -0
  32. package/dist/esm/core/LineChart/LineChartLegend.js +91 -0
  33. package/dist/esm/core/LineChart/LineChartToolBar.js +50 -0
  34. package/dist/esm/core/LineChart/Pointer.js +38 -0
  35. package/dist/esm/core/LineChart/RenderChart.js +296 -0
  36. package/dist/esm/core/LineChart/TooltipFormatter.js +63 -0
  37. package/dist/esm/core/LineChart/index.js +57 -0
  38. package/dist/esm/core/LineChart/styled.js +25 -0
  39. package/dist/esm/core/LineChart/type.js +26 -0
  40. package/dist/esm/core/LineChart/utils.js +369 -0
  41. package/dist/esm/core/Loading/index.js +1 -1
  42. package/dist/esm/core/Progress/progress.widgets.js +1 -1
  43. package/dist/esm/core/Timeline/Timeline.widget.js +3 -3
  44. package/dist/esm/core/Timeline/index.js +3 -3
  45. package/dist/esm/coreX/CheckPointList/index.js +3 -3
  46. package/dist/esm/coreX/CircleLoading/index.js +3 -3
  47. package/dist/esm/coreX/DateRangePicker/Calendar.js +1 -1
  48. package/dist/esm/coreX/Dialogs/DeleteDialog/DeleteDialog.js +41 -0
  49. package/dist/esm/coreX/Dialogs/RejectDialog/RejectDialog.js +81 -0
  50. package/dist/esm/coreX/Dialogs/RejectDialog/RejectDialog.type.js +9 -0
  51. package/dist/esm/coreX/Dialogs/SmallDialog.js +80 -0
  52. package/dist/esm/index.js +10 -2
  53. package/dist/esm/stats1.html +1 -1
  54. package/dist/esm/utils/constants.js +1 -1
  55. package/dist/esm/utils/tower.js +77 -1
  56. package/dist/src/antd.d.ts +1 -1
  57. package/dist/src/core/ConfigProvider/index.d.ts +2 -2
  58. package/dist/src/core/LineChart/LineChartActions.d.ts +7 -0
  59. package/dist/src/core/LineChart/LineChartLegend.d.ts +18 -0
  60. package/dist/src/core/LineChart/LineChartToolBar.d.ts +20 -0
  61. package/dist/src/core/LineChart/Pointer.d.ts +6 -0
  62. package/dist/src/core/LineChart/RenderChart.d.ts +45 -0
  63. package/dist/src/core/LineChart/TooltipFormatter.d.ts +10 -0
  64. package/dist/src/core/LineChart/__test__/h5_css.test.d.ts +1 -0
  65. package/dist/src/core/LineChart/index.d.ts +8 -0
  66. package/dist/src/core/LineChart/styled.d.ts +12 -0
  67. package/dist/src/core/LineChart/type.d.ts +191 -0
  68. package/dist/src/core/LineChart/utils.d.ts +56 -0
  69. package/dist/src/core/Metric/metric.d.ts +1 -1
  70. package/dist/src/core/Timeline/Timeline.type.d.ts +2 -2
  71. package/dist/src/core/index.d.ts +4 -1
  72. package/dist/src/coreX/CheckPointList/index.d.ts +1 -1
  73. package/dist/src/coreX/Dialogs/DeleteDialog/DeleteDialog.d.ts +3 -0
  74. package/dist/src/coreX/Dialogs/DeleteDialog/DeleteDialog.type.d.ts +19 -0
  75. package/dist/src/coreX/Dialogs/DeleteDialog/index.d.ts +2 -0
  76. package/dist/src/coreX/Dialogs/RejectDialog/RejectDialog.d.ts +3 -0
  77. package/dist/src/coreX/Dialogs/RejectDialog/RejectDialog.type.d.ts +59 -0
  78. package/dist/src/coreX/Dialogs/RejectDialog/index.d.ts +2 -0
  79. package/dist/src/coreX/Dialogs/SmallDialog.d.ts +31 -0
  80. package/dist/src/coreX/Dialogs/index.d.ts +3 -0
  81. package/dist/src/coreX/index.d.ts +2 -1
  82. package/dist/src/utils/tower.d.ts +12 -0
  83. package/dist/stories/docs/core/LineChart.stories.d.ts +16 -0
  84. package/dist/stories/docs/core/Timeline.stories.d.ts +2 -2
  85. package/dist/stories/docs/coreX/CheckPointList.stories.d.ts +1 -1
  86. package/dist/stories/docs/coreX/Dialogs/DeleteDialog.stories.d.ts +37 -0
  87. package/dist/stories/docs/coreX/Dialogs/RejectDialog.stories.d.ts +89 -0
  88. package/dist/stories/docs/coreX/Show.stories.d.ts +2 -2
  89. package/dist/style.css +2158 -1862
  90. package/dist/variables.scss +2 -0
  91. package/package.json +5 -6
@@ -0,0 +1,26 @@
1
+ var ILineChartTimeUnit = /* @__PURE__ */ ((ILineChartTimeUnit2) => {
2
+ ILineChartTimeUnit2["Day"] = "DAY";
3
+ ILineChartTimeUnit2["Hour"] = "HOUR";
4
+ ILineChartTimeUnit2["Month"] = "MONTH";
5
+ return ILineChartTimeUnit2;
6
+ })(ILineChartTimeUnit || {});
7
+ var ILineChartMetricUnit = /* @__PURE__ */ ((ILineChartMetricUnit2) => {
8
+ ILineChartMetricUnit2["Count"] = "COUNT";
9
+ ILineChartMetricUnit2["DataRateBit"] = "DATA_RATE_BIT";
10
+ ILineChartMetricUnit2["DataRateByte"] = "DATA_RATE_BYTE";
11
+ ILineChartMetricUnit2["DataSize"] = "DATA_SIZE";
12
+ ILineChartMetricUnit2["Frequency"] = "FREQUENCY";
13
+ ILineChartMetricUnit2["Load"] = "LOAD";
14
+ ILineChartMetricUnit2["Percent"] = "PERCENT";
15
+ ILineChartMetricUnit2["Ratio"] = "RATIO";
16
+ ILineChartMetricUnit2["Temperature"] = "TEMPERATURE";
17
+ ILineChartMetricUnit2["Time"] = "TIME";
18
+ return ILineChartMetricUnit2;
19
+ })(ILineChartMetricUnit || {});
20
+ var ILineChartGraphType = /* @__PURE__ */ ((ILineChartGraphType2) => {
21
+ ILineChartGraphType2["Area"] = "AREA";
22
+ ILineChartGraphType2["Stack"] = "STACK";
23
+ return ILineChartGraphType2;
24
+ })(ILineChartGraphType || {});
25
+
26
+ export { ILineChartGraphType, ILineChartMetricUnit, ILineChartTimeUnit };
@@ -0,0 +1,369 @@
1
+ import { ILineChartMetricUnit, ILineChartGraphType } from './type.js';
2
+ import { HOUR, DAY, SECOND, MINUTE, unitRules, formatPercent, formatCount, formatBytes, formatBps, formatBitPerSecond, formatNanoSecond, formatFrequency, formatTemperature } from '../../utils/tower.js';
3
+ import dayjs from 'dayjs';
4
+ import _ from 'lodash';
5
+
6
+ var __defProp = Object.defineProperty;
7
+ var __defProps = Object.defineProperties;
8
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
9
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __spreadValues = (a, b) => {
14
+ for (var prop in b || (b = {}))
15
+ if (__hasOwnProp.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ if (__getOwnPropSymbols)
18
+ for (var prop of __getOwnPropSymbols(b)) {
19
+ if (__propIsEnum.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ }
22
+ return a;
23
+ };
24
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
+ var __objRest = (source, exclude) => {
26
+ var target = {};
27
+ for (var prop in source)
28
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
29
+ target[prop] = source[prop];
30
+ if (source != null && __getOwnPropSymbols)
31
+ for (var prop of __getOwnPropSymbols(source)) {
32
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
33
+ target[prop] = source[prop];
34
+ }
35
+ return target;
36
+ };
37
+ function filterLineChartPointsByDateRange(points, dateRange) {
38
+ const [startDate, endDate] = dateRange != null ? dateRange : [dayjs(), dayjs()];
39
+ return points == null ? void 0 : points.filter((point) => {
40
+ const pointDate = dayjs(point.t);
41
+ if (startDate && pointDate.isBefore(startDate)) {
42
+ return false;
43
+ }
44
+ if (endDate && pointDate.isAfter(endDate)) {
45
+ return false;
46
+ }
47
+ return true;
48
+ });
49
+ }
50
+ const parseLineChartRange = (range) => {
51
+ const span = parseInt(range.slice(0, range.length - 1));
52
+ const unit = range.slice(range.length - 1);
53
+ return { span, unit };
54
+ };
55
+ function getRangeTimestamp(dateRange) {
56
+ const [startDate, endDate] = dateRange;
57
+ return endDate.valueOf() - startDate.valueOf();
58
+ }
59
+ const lineChartXaxisCal = (lastTime, dateRange, width) => {
60
+ const tangeTime = getRangeTimestamp(dateRange);
61
+ const baseline = lastTime || dateRange[1].valueOf();
62
+ if (width < 290) {
63
+ const tick = tangeTime / 4;
64
+ return [baseline - tick * 3, baseline - tick];
65
+ } else if (width < 380) {
66
+ const tick = tangeTime / 6;
67
+ return [baseline - tick * 5, baseline - tick * 3, baseline - tick];
68
+ } else {
69
+ const tick = tangeTime / 8;
70
+ return [
71
+ baseline - tick * 7,
72
+ baseline - tick * 5,
73
+ baseline - tick * 3,
74
+ baseline - tick
75
+ ];
76
+ }
77
+ };
78
+ const lineChartTickFormatter = (tick, dateRange) => {
79
+ const rangeTime = getLineChartRangeTimestamp(dateRange);
80
+ if (rangeTime <= 2 * HOUR * 1e3) {
81
+ return dayjs(tick).format("HH:mm:ss");
82
+ }
83
+ if (rangeTime <= 4 * DAY * 1e3) {
84
+ return dayjs(tick).format("MM/DD HH:mm:ss");
85
+ }
86
+ return dayjs(tick).format("MM/DD");
87
+ };
88
+ function getLineChartXAxisDomain(dateRange, xaxisLastTime) {
89
+ const [startDate, endDate] = dateRange;
90
+ return [startDate.valueOf(), xaxisLastTime != null ? xaxisLastTime : endDate.valueOf()];
91
+ }
92
+ const getLineChartRangeTimestamp = (dateRange) => {
93
+ const [startDate, endDate] = dateRange;
94
+ return endDate.valueOf() - startDate.valueOf();
95
+ };
96
+ const getLineChartStep = (dateRange) => {
97
+ const [startDate, endDate] = dateRange;
98
+ const range = endDate.valueOf() - startDate.valueOf();
99
+ if (range <= 2 * 60 * 60 * 1e3) {
100
+ return SECOND * 30 * 1e3;
101
+ }
102
+ if (range <= 24 * 60 * 60 * 1e3) {
103
+ return MINUTE * 5 * 1e3;
104
+ }
105
+ if (range <= 7 * 24 * 60 * 60 * 1e3) {
106
+ return MINUTE * 30 * 1e3;
107
+ }
108
+ if (range <= 30 * 24 * 60 * 60 * 1e3) {
109
+ return DAY * 1e3;
110
+ }
111
+ return DAY * 1e3;
112
+ };
113
+ const filterLineChartDataOverlapping = (data, startTimestamp, length, step, tolerance) => {
114
+ const points = [...new Array(Math.round(length))].map((_2, index) => {
115
+ return startTimestamp + index * step;
116
+ }).map((timestamp) => {
117
+ const closestPoint = _.minBy(
118
+ data.filter((value) => {
119
+ return Math.abs(value.t - timestamp) < tolerance;
120
+ }),
121
+ (value) => {
122
+ return Math.abs(value.t - timestamp);
123
+ }
124
+ );
125
+ if (closestPoint == null) {
126
+ return {
127
+ t: timestamp,
128
+ v: -Infinity
129
+ };
130
+ }
131
+ return closestPoint;
132
+ });
133
+ return points;
134
+ };
135
+ const convertLineChartDataStruct = (streams) => {
136
+ const points = streams.flatMap((points2, index) => {
137
+ return points2.map((point) => {
138
+ return __spreadProps(__spreadValues({}, point), { [`v${index}`]: point.v });
139
+ });
140
+ });
141
+ const groupedPoints = _.groupBy(points, (point) => {
142
+ return point.t;
143
+ });
144
+ const combinedPoints = Object.entries(groupedPoints).map(([key, values]) => {
145
+ return values.reduce((p, c) => {
146
+ const _a = __spreadValues(__spreadValues({}, p), c), values2 = __objRest(_a, ["v"]);
147
+ return values2;
148
+ }, {});
149
+ });
150
+ return combinedPoints;
151
+ };
152
+ const filterLineChartOverlappingMetric = (metric, dateRange) => {
153
+ const range = getLineChartRangeTimestamp(dateRange);
154
+ return __spreadProps(__spreadValues({}, metric), {
155
+ sample_streams: metric.sample_streams.map((stream) => __spreadProps(__spreadValues({}, stream), {
156
+ points: filterLineChartDataOverlapping(
157
+ stream.points,
158
+ dateRange[0].valueOf(),
159
+ range / stream.step,
160
+ stream.step,
161
+ stream.tolerance
162
+ )
163
+ }))
164
+ });
165
+ };
166
+ const deletePointsOutOfRange = (data, timeRange, now) => {
167
+ const first = now - getLineChartRangeTimestamp(timeRange);
168
+ return (data == null ? void 0 : data.filter((item) => {
169
+ return item.t >= first && item.t <= now;
170
+ })) || [];
171
+ };
172
+ const getFirstExpectedTimestamp = (data, timeRange, now, step, dateRange) => {
173
+ const first = timeRange ? now - getLineChartRangeTimestamp(timeRange) : dayjs(dateRange == null ? void 0 : dateRange[0]).valueOf();
174
+ const firstRealTimestamp = data[0].t;
175
+ return firstRealTimestamp - Math.floor((firstRealTimestamp - first) / step) * step;
176
+ };
177
+ const getFaultToleranceTime = (timeRange) => {
178
+ const [startDate, endDate] = timeRange;
179
+ const range = endDate.valueOf() - startDate.valueOf();
180
+ switch (range) {
181
+ case 5 * MINUTE:
182
+ return 5 * 1e3;
183
+ case 15 * MINUTE:
184
+ return 15 * 1e3;
185
+ case 1 * HOUR:
186
+ return 60 * 1e3;
187
+ case 2 * HOUR:
188
+ return 120 * 1e3;
189
+ case 24 * HOUR:
190
+ return 10 * 60 * 1e3;
191
+ case 7 * DAY:
192
+ case 30 * DAY:
193
+ return 60 * 60 * 1e3;
194
+ case 182 * DAY:
195
+ return 24 * 60 * 60 * 1e3;
196
+ }
197
+ return 120 * 1e3;
198
+ };
199
+ const addMissingDataWithZero = (data, timeRange, unit, step, dateRange) => {
200
+ const now = Date.now();
201
+ const inRangePoints = deletePointsOutOfRange(data, timeRange, now);
202
+ if (!inRangePoints.length) {
203
+ return [];
204
+ }
205
+ const firsExpectedTimestamp = getFirstExpectedTimestamp(
206
+ inRangePoints,
207
+ timeRange,
208
+ now,
209
+ step,
210
+ dateRange
211
+ );
212
+ const expectedPoints = [];
213
+ const tolerance = getFaultToleranceTime(timeRange);
214
+ if (inRangePoints[0].t - firsExpectedTimestamp > tolerance + step) {
215
+ inRangePoints.unshift({
216
+ t: firsExpectedTimestamp,
217
+ v: -Infinity
218
+ });
219
+ }
220
+ if (now - inRangePoints[inRangePoints.length - 1].t > tolerance + step) {
221
+ inRangePoints.push({
222
+ t: now,
223
+ v: -Infinity
224
+ });
225
+ }
226
+ inRangePoints.forEach((item, index) => {
227
+ var _a;
228
+ expectedPoints.push({
229
+ t: item == null ? void 0 : item.t,
230
+ v: item == null ? void 0 : item.v
231
+ });
232
+ if (index + 1 <= inRangePoints.length - 1) {
233
+ const nowTimeRange = ((_a = inRangePoints[index + 1]) == null ? void 0 : _a.t) - (item == null ? void 0 : item.t);
234
+ if (nowTimeRange > tolerance + step) {
235
+ const n = Math.floor(nowTimeRange / step);
236
+ for (let i = 1; i < n; i++) {
237
+ expectedPoints.push({
238
+ t: (item == null ? void 0 : item.t) + step * i,
239
+ v: -Infinity
240
+ });
241
+ }
242
+ }
243
+ }
244
+ });
245
+ return filterLineChartPointsByDateRange(
246
+ expectedPoints.map((p) => __spreadProps(__spreadValues({}, p), { unit })),
247
+ dateRange
248
+ );
249
+ };
250
+ const convertLineChartUnit = (value, from, to, decimals) => {
251
+ if (from === to || !value)
252
+ return value;
253
+ const ruleIndex = unitRules.findIndex((rule) => rule.unit.includes(from));
254
+ if (ruleIndex === -1) {
255
+ return value;
256
+ }
257
+ const { unit, divider } = unitRules[ruleIndex];
258
+ let fromIdx = unit.indexOf(from);
259
+ const toIdx = unit.indexOf(to);
260
+ if (toIdx === -1) {
261
+ return value;
262
+ }
263
+ if (fromIdx < toIdx) {
264
+ while (fromIdx < toIdx) {
265
+ value /= divider[fromIdx];
266
+ fromIdx++;
267
+ }
268
+ } else {
269
+ while (fromIdx > toIdx) {
270
+ value *= divider[fromIdx - 1];
271
+ fromIdx--;
272
+ }
273
+ }
274
+ return _.isInteger(value) ? value : _.isNil(decimals) ? value : parseFloat(value.toFixed(decimals));
275
+ };
276
+ const UNIT_FORMATTER = {
277
+ [ILineChartMetricUnit.Percent]: [formatPercent, "%", 2, false],
278
+ [ILineChartMetricUnit.Ratio]: [formatPercent, "%"],
279
+ [ILineChartMetricUnit.Count]: [formatCount, ""],
280
+ [ILineChartMetricUnit.DataSize]: [formatBytes, "B"],
281
+ [ILineChartMetricUnit.DataRateByte]: [formatBps, "Bps"],
282
+ [ILineChartMetricUnit.DataRateBit]: [formatBitPerSecond, "bps"],
283
+ [ILineChartMetricUnit.Time]: [formatNanoSecond, "ns"],
284
+ [ILineChartMetricUnit.Frequency]: [formatFrequency, "Hz"],
285
+ [ILineChartMetricUnit.Temperature]: [formatTemperature, "\u2103"],
286
+ [ILineChartMetricUnit.Load]: [formatCount, ""]
287
+ };
288
+ const getLineChartYDataMax = (dataPoints, type) => {
289
+ const values = dataPoints.map((p) => {
290
+ if (_.isNumber(p == null ? void 0 : p.v)) {
291
+ return p.v;
292
+ }
293
+ const entries = Object.entries(p);
294
+ if (type === ILineChartGraphType.Stack) {
295
+ let sum = 0;
296
+ for (const [key, value] of entries) {
297
+ if (/^v(\d*)$/.test(key) && _.isNumber(value)) {
298
+ sum += value;
299
+ }
300
+ }
301
+ return sum;
302
+ } else {
303
+ let max = 0;
304
+ for (const [key, value] of entries) {
305
+ if (/^v(\d*)$/.test(key) && _.isNumber(value) && value > max) {
306
+ max = value;
307
+ }
308
+ }
309
+ return max;
310
+ }
311
+ });
312
+ return Math.max(...values, 0);
313
+ };
314
+ const getYAxisUpperBound = (max, type) => {
315
+ const DIVISOR = 2;
316
+ switch (type) {
317
+ case ILineChartMetricUnit.Count:
318
+ case ILineChartMetricUnit.Load:
319
+ case ILineChartMetricUnit.DataSize:
320
+ case ILineChartMetricUnit.DataRateByte:
321
+ case ILineChartMetricUnit.Time:
322
+ case ILineChartMetricUnit.Frequency:
323
+ case ILineChartMetricUnit.DataRateBit:
324
+ case ILineChartMetricUnit.Temperature: {
325
+ const [format, base] = UNIT_FORMATTER[type];
326
+ const { value, unit } = format(max);
327
+ const _value = Math.ceil(Number(value) / DIVISOR) * DIVISOR;
328
+ return convertLineChartUnit(_value, unit, base);
329
+ }
330
+ case ILineChartMetricUnit.Percent: {
331
+ const [format, base, decimals, saturated] = UNIT_FORMATTER[type];
332
+ const { value, unit } = format(max, decimals, saturated);
333
+ const _value = Math.ceil(Number(value) / DIVISOR) * DIVISOR;
334
+ return convertLineChartUnit(_value, unit, base);
335
+ }
336
+ case ILineChartMetricUnit.Ratio: {
337
+ const [format, base] = UNIT_FORMATTER[type];
338
+ const { value, unit } = format(max * 100);
339
+ const _value = Math.ceil(Number(value) / DIVISOR) * DIVISOR;
340
+ return convertLineChartUnit(_value, unit, base) / 100;
341
+ }
342
+ default:
343
+ return 2;
344
+ }
345
+ };
346
+ const getYAxisDomain = (dataPoints, graphType, unitType) => {
347
+ const max = getLineChartYDataMax(dataPoints, graphType);
348
+ if (!max) {
349
+ if (unitType === ILineChartMetricUnit.Ratio) {
350
+ return [0, 1];
351
+ } else {
352
+ return [0, 2];
353
+ }
354
+ }
355
+ return [0, getYAxisUpperBound(max, unitType)];
356
+ };
357
+ function lineChartYaxisTickFormatter(value, unit) {
358
+ if (_.isNil(unit)) {
359
+ return `${value}`;
360
+ }
361
+ if (_.isNil(value)) {
362
+ return "0";
363
+ }
364
+ const [format] = UNIT_FORMATTER[unit];
365
+ const { value: _value, unit: _unit } = format(value);
366
+ return `${_value} ${_unit}`;
367
+ }
368
+
369
+ export { UNIT_FORMATTER, addMissingDataWithZero, convertLineChartDataStruct, convertLineChartUnit, deletePointsOutOfRange, filterLineChartDataOverlapping, filterLineChartOverlappingMetric, filterLineChartPointsByDateRange, getFirstExpectedTimestamp, getLineChartRangeTimestamp, getLineChartStep, getLineChartXAxisDomain, getLineChartYDataMax, getYAxisDomain, getYAxisUpperBound, lineChartTickFormatter, lineChartXaxisCal, lineChartYaxisTickFormatter, parseLineChartRange };
@@ -1,7 +1,7 @@
1
1
  import { LoadingWrapper, LoadingLine1, LoadingLine2, LoadingLine3 } from './style.js';
2
2
  import { FullView } from '../Styled/index.js';
3
- import React__default, { Fragment } from 'react';
4
3
  import cs from 'classnames';
4
+ import React__default, { Fragment } from 'react';
5
5
 
6
6
  var __defProp = Object.defineProperty;
7
7
  var __defProps = Object.defineProperties;
@@ -1,8 +1,8 @@
1
1
  import { styled } from '@linaria/react';
2
2
  import Link from '../Link/index.js';
3
- import { splitMap } from '../../utils/constants.js';
4
3
  import { IconField, Info } from './components.js';
5
4
  import Tag from '../Tag/index.js';
5
+ import { splitMap } from '../../utils/constants.js';
6
6
  import React__default from 'react';
7
7
 
8
8
  var __defProp = Object.defineProperty;
@@ -1,12 +1,12 @@
1
- import React__default from 'react';
2
1
  import { cx } from '@linaria/core';
3
- import { splitMap } from '../../utils/constants.js';
4
2
  import Link from '../Link/index.js';
3
+ import Tag from '../Tag/index.js';
5
4
  import { Typo } from '../Typo/index.js';
6
5
  import OverflowTooltip from '../../coreX/OverflowTooltip/index.js';
7
- import Tag from '../Tag/index.js';
6
+ import { splitMap } from '../../utils/constants.js';
8
7
  import { Flex } from 'antd5';
9
8
  import cs from 'classnames';
9
+ import React__default from 'react';
10
10
  import { InfoTextWrapper, SubInfoTextWrapper } from './Timeline.style.js';
11
11
  import { Show } from '../../coreX/Show/index.js';
12
12
 
@@ -1,11 +1,11 @@
1
1
  import { CheckmarkDoneSuccessCorrect16GreenIcon, XmarkFailed16RedIcon, Loading16GradientBlueIcon, NoticeTriangleFill16YellowIcon, WaitingBreathingLed16YellowIcon, TimelineNotStart16GrayIcon } from '@cloudtower/icons-react';
2
2
  import { cx } from '@linaria/core';
3
- import { Timeline as Timeline$1, Flex } from 'antd5';
4
- import React__default from 'react';
5
- import { EmptyWrapper, TimelineWrapper, TimelineItemWrapper } from './Timeline.style.js';
6
3
  import Alert from '../Alert/index.js';
7
4
  import Icon from '../Icon/index.js';
5
+ import { Timeline as Timeline$1, Flex } from 'antd5';
8
6
  import cs from 'classnames';
7
+ import React__default from 'react';
8
+ import { EmptyWrapper, TimelineWrapper, TimelineItemWrapper } from './Timeline.style.js';
9
9
  import { TimelineArea } from './Timeline.widget.js';
10
10
 
11
11
  var __defProp = Object.defineProperty;
@@ -1,8 +1,8 @@
1
- import React__default, { useState, useCallback } from 'react';
2
- import useParrotTranslation from '../../hooks/useParrotTranslation.js';
3
1
  import { XmarkFailedSeriousWarningFill16RedIcon, CheckmarkDoneSuccessCircleFill16GreenIcon, Loading16GradientBlueIcon, NoticeTriangleFill16YellowIcon } from '@cloudtower/icons-react';
4
- import { List } from 'antd5';
5
2
  import { cx } from '@linaria/core';
3
+ import useParrotTranslation from '../../hooks/useParrotTranslation.js';
4
+ import { List } from 'antd5';
5
+ import React__default, { useState, useCallback } from 'react';
6
6
  import { CheckPointItemStyle, CheckPointListStyle, EmptyWrapper } from './checkpointlist.style.js';
7
7
  import { Show } from '../Show/index.js';
8
8
  import Icon from '../../core/Icon/index.js';
@@ -1,8 +1,8 @@
1
- import { FullView } from '../../core/Styled/index.js';
1
+ import { Loading64GradientBlueIcon } from '@cloudtower/icons-react';
2
2
  import Icon from '../../core/Icon/index.js';
3
- import React__default, { Fragment } from 'react';
3
+ import { FullView } from '../../core/Styled/index.js';
4
4
  import cs from 'classnames';
5
- import { Loading64GradientBlueIcon } from '@cloudtower/icons-react';
5
+ import React__default, { Fragment } from 'react';
6
6
 
7
7
  var __defProp = Object.defineProperty;
8
8
  var __defProps = Object.defineProperties;
@@ -1,4 +1,5 @@
1
1
  import { ArrowChevronUp16BoldBlueIcon, ArrowChevronDown16BoldBlueIcon } from '@cloudtower/icons-react';
2
+ import { parrotI18n } from '@cloudtower/parrot';
2
3
  import { cx } from '@linaria/core';
3
4
  import Button from '../../core/Button/index.js';
4
5
  import Icon from '../../core/Icon/index.js';
@@ -10,7 +11,6 @@ import dayjs from 'dayjs';
10
11
  import React__default, { useState, useEffect, useRef } from 'react';
11
12
  import { getDiffMonthAndDate, getTime, checkDateNotInRange, getClassNameForDateBlock } from './common.js';
12
13
  import { CalendarStyle } from './DateRangePicker.style.js';
13
- import { parrotI18n } from '@cloudtower/parrot';
14
14
  import { getCalendarTitle } from '../common/getCalendarTitle.js';
15
15
 
16
16
  const Year = (props) => {
@@ -0,0 +1,41 @@
1
+ import { cx } from '@linaria/core';
2
+ import { Typo } from '../../../core/Typo/index.js';
3
+ import useParrotTranslation from '../../../hooks/useParrotTranslation.js';
4
+ import React__default from 'react';
5
+ import { SmallDialog } from '../SmallDialog.js';
6
+
7
+ const ContentStyle = "E_cevhqx7";
8
+ const SecondaryDescStyle = "E_snbqlt4";
9
+ const DeleteDialog = props => {
10
+ const {
11
+ t
12
+ } = useParrotTranslation();
13
+ const {
14
+ title,
15
+ description,
16
+ secondaryDesc,
17
+ cancelText = t("common.cancel"),
18
+ okText = t("common.delete"),
19
+ onOk,
20
+ onCancel,
21
+ className
22
+ } = props;
23
+ return /* @__PURE__ */React__default.createElement(SmallDialog, {
24
+ title,
25
+ showOk: true,
26
+ onOk,
27
+ onCancel,
28
+ className,
29
+ okText,
30
+ cancelText,
31
+ okButtonProps: {
32
+ danger: true
33
+ }
34
+ }, description && /* @__PURE__ */React__default.createElement("div", {
35
+ className: cx(ContentStyle, Typo.Label.l2_regular)
36
+ }, description), secondaryDesc && /* @__PURE__ */React__default.createElement("div", {
37
+ className: cx(SecondaryDescStyle, Typo.Label.l3_regular)
38
+ }, secondaryDesc));
39
+ };
40
+
41
+ export { DeleteDialog };
@@ -0,0 +1,81 @@
1
+ import { cx } from '@linaria/core';
2
+ import { Typo } from '../../../core/Typo/index.js';
3
+ import React__default from 'react';
4
+ import { SmallDialog } from '../SmallDialog.js';
5
+ import { RejectDialogType } from './RejectDialog.type.js';
6
+
7
+ const ContentList = "E_c1ss4prm";
8
+ const MultiRejectContentList = "E_ms3tlei";
9
+ const Description = "E_du44iy7";
10
+ const SecondaryDesc = "E_s1qmhanr";
11
+ const Divider = "E_drje1h0";
12
+ const SingleRejectContent = ({
13
+ content
14
+ }) => {
15
+ if (Array.isArray(content) && content.length > 1) {
16
+ return /* @__PURE__ */React__default.createElement("div", {
17
+ className: cx(ContentList)
18
+ }, content.map((reason, index) => /* @__PURE__ */React__default.createElement("li", {
19
+ className: Typo.Label.l4_regular,
20
+ key: index
21
+ }, index + 1, ". ", reason)));
22
+ }
23
+ return /* @__PURE__ */React__default.createElement("div", {
24
+ className: cx(ContentList, Typo.Label.l4_regular)
25
+ }, content);
26
+ };
27
+ const MultiRejectContent = ({
28
+ content
29
+ }) => /* @__PURE__ */React__default.createElement("div", {
30
+ className: cx(MultiRejectContentList)
31
+ }, Object.entries(content).map(([name, reasons], index) => /* @__PURE__ */React__default.createElement("li", {
32
+ className: Typo.Label.l4_regular,
33
+ key: index
34
+ }, name, ": ", reasons.join("; "))));
35
+ const RejectDialog = props => {
36
+ const {
37
+ title,
38
+ cancelText,
39
+ description,
40
+ className,
41
+ footerClassName
42
+ } = props;
43
+ const renderContent = () => {
44
+ switch (props.type) {
45
+ case RejectDialogType.Single:
46
+ return /* @__PURE__ */React__default.createElement(SingleRejectContent, {
47
+ content: props.content
48
+ });
49
+ case RejectDialogType.All:
50
+ case RejectDialogType.Part:
51
+ return /* @__PURE__ */React__default.createElement(React__default.Fragment, null, props.secondaryDesc && /* @__PURE__ */React__default.createElement("div", {
52
+ className: cx(SecondaryDesc, Typo.Label.l4_regular)
53
+ }, props.secondaryDesc), props.type === RejectDialogType.Part && /* @__PURE__ */React__default.createElement(React__default.Fragment, null, /* @__PURE__ */React__default.createElement("div", {
54
+ className: Divider
55
+ }), /* @__PURE__ */React__default.createElement("div", {
56
+ className: cx(Description, Typo.Label.l3_regular)
57
+ }, props.partialDescription)), /* @__PURE__ */React__default.createElement(MultiRejectContent, {
58
+ content: props.content
59
+ }));
60
+ case RejectDialogType.Custom:
61
+ return props.customContent;
62
+ }
63
+ };
64
+ return /* @__PURE__ */React__default.createElement(SmallDialog, {
65
+ title,
66
+ cancelText,
67
+ showOk: props.type === RejectDialogType.Part,
68
+ okText: props.type === RejectDialogType.Part ? props.okText : void 0,
69
+ onOk: props.type === RejectDialogType.Part ? props.onOk : void 0,
70
+ okButtonProps: {
71
+ danger: props.type === RejectDialogType.Part
72
+ },
73
+ onCancel: props.onCancel,
74
+ className,
75
+ footerClassName
76
+ }, description && /* @__PURE__ */React__default.createElement("div", {
77
+ className: cx(Description, Typo.Label.l3_regular)
78
+ }, description), renderContent());
79
+ };
80
+
81
+ export { RejectDialog };
@@ -0,0 +1,9 @@
1
+ var RejectDialogType = /* @__PURE__ */ ((RejectDialogType2) => {
2
+ RejectDialogType2["Single"] = "RejectSingle";
3
+ RejectDialogType2["All"] = "RejectAll";
4
+ RejectDialogType2["Part"] = "RejectPart";
5
+ RejectDialogType2["Custom"] = "RejectCustom";
6
+ return RejectDialogType2;
7
+ })(RejectDialogType || {});
8
+
9
+ export { RejectDialogType };