bfg-common 1.4.7 → 1.4.9

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 (54) hide show
  1. package/assets/localization/local_be.json +3 -0
  2. package/assets/localization/local_en.json +3 -0
  3. package/assets/localization/local_hy.json +3 -0
  4. package/assets/localization/local_kk.json +3 -0
  5. package/assets/localization/local_ru.json +3 -0
  6. package/assets/localization/local_zh.json +2566 -2563
  7. package/components/atoms/modal/bySteps/BySteps.vue +253 -253
  8. package/components/common/browse/blocks/Title.vue +91 -91
  9. package/components/common/browse/blocks/info/Date.vue +21 -21
  10. package/components/common/context/recursion/Recursion.vue +86 -86
  11. package/components/common/context/recursion/RecursionNew.vue +198 -198
  12. package/components/common/context/recursion/RecursionOld.vue +212 -212
  13. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/form/lib/config/dateForm.ts +1 -1
  14. package/components/common/pages/hardwareHealth/HardwareHealth.vue +45 -62
  15. package/components/common/pages/hardwareHealth/historyTestimony/Graph.vue +332 -0
  16. package/components/common/pages/hardwareHealth/historyTestimony/lib/models/interfaces.ts +9 -0
  17. package/components/common/pages/hardwareHealth/historyTestimony/tools/Tools.vue +375 -0
  18. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/ChartOptionsModal.vue +469 -0
  19. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/Notification.vue +30 -0
  20. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/actions/Actions.vue +157 -0
  21. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/actions/SaveOptionsModal.vue +81 -0
  22. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/actions/lib/utils/optionsActions.ts +25 -0
  23. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/Counters.vue +89 -0
  24. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/table/Table.vue +174 -0
  25. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/table/lib/config/tableConfig.ts +89 -0
  26. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/table/lib/models/types.ts +5 -0
  27. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/timespan/Timespan.vue +64 -0
  28. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/timespan/form/Form.vue +539 -0
  29. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/timespan/form/lib/config/dateForm.ts +115 -0
  30. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/lib/config/optionsMetrics.ts +17 -0
  31. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/lib/models/interfaces.ts +15 -0
  32. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/lib/models/types.ts +1 -0
  33. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/metrics/Metrics.vue +31 -0
  34. package/components/common/pages/hardwareHealth/historyTestimony/tools/lib/config/toolbar.ts +78 -0
  35. package/components/common/pages/hardwareHealth/historyTestimony/tools/lib/models/interfaces.ts +9 -0
  36. package/components/common/pages/hardwareHealth/tableView/TableView.vue +4 -10
  37. package/components/common/pages/hardwareHealth/tableView/lib/config/historyTestimonyTable.ts +128 -0
  38. package/components/common/pages/hardwareHealth/tableView/lib/config/sensorTable.ts +7 -11
  39. package/components/common/pages/hardwareHealth/tableView/lib/config/tableKeys.ts +6 -7
  40. package/components/common/pages/hardwareHealth/tableView/lib/models/interfaces.ts +2 -0
  41. package/components/common/pages/hardwareHealth/tableView/lib/models/types.ts +9 -4
  42. package/components/common/split/horizontal/HorizontalNew.vue +321 -321
  43. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/CpuHotPlug.vue +52 -52
  44. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Hv.vue +99 -99
  45. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/streamingMode/StreamingMode.vue +85 -85
  46. package/components/common/wizards/datastore/add/Add.vue +437 -437
  47. package/composables/productNameLocal.ts +30 -30
  48. package/lib/models/interfaces.ts +1 -0
  49. package/lib/models/types.ts +1 -0
  50. package/package.json +1 -1
  51. package/plugins/recursion.ts +293 -293
  52. package/public/spice-console/lib/images/bitmap.js +203 -203
  53. package/store/tasks/mappers/recentTasks.ts +45 -45
  54. package/components/common/pages/hardwareHealth/Graph.vue +0 -84
@@ -0,0 +1,539 @@
1
+ <template>
2
+ <div class="chart-option-timespan-split">
3
+ <div class="vertical-flex-container">
4
+ <div class="timespan-objects-section-direction">
5
+ <label for="chart-timespan-type-select"
6
+ >{{ localization.common.timespan }}:</label
7
+ >
8
+ <div class="vertical-flex-container chart-option-timespan-settings">
9
+ <div class="timespan-select chart-option-setting-row">
10
+ <div class="view-select-label horizontal-flex-container">
11
+ <div class="select">
12
+ <select
13
+ id="chart-timespan-type-select"
14
+ v-model="localSelectedTimespan"
15
+ data-id="chart-timespan-type-select"
16
+ >
17
+ <option
18
+ v-for="(item, index) in timespanOptions"
19
+ :key="index"
20
+ :value="item.value"
21
+ >
22
+ {{ item.text }}
23
+ </option>
24
+ </select>
25
+ </div>
26
+ </div>
27
+ </div>
28
+ <div
29
+ :class="[
30
+ 'custom-timespan-settings-container',
31
+ { active: localSelectedTimespan === 'custom_interval' },
32
+ ]"
33
+ >
34
+ <table>
35
+ <tbody>
36
+ <tr>
37
+ <td class="relative">
38
+ <input
39
+ id="custom-time-lastInput"
40
+ v-model="localPeriodType"
41
+ data-id="custom-time-lastInput"
42
+ type="radio"
43
+ value="last"
44
+ class="custom-radio-button"
45
+ name="lastFrom"
46
+ />
47
+ <label
48
+ for="custom-time-lastInput"
49
+ class="custom-radio-label"
50
+ >
51
+ {{ periodTypeText }}:
52
+ </label>
53
+ </td>
54
+ <td>
55
+ <div
56
+ :class="[
57
+ 'custom-timespan-type-last-container',
58
+ { active: localPeriodType === 'last' },
59
+ ]"
60
+ >
61
+ <input
62
+ id="chart-option-setting-row"
63
+ v-model="localLast"
64
+ data-id="chart-option-setting-row"
65
+ type="number"
66
+ class="chart-option-setting-row custom-time-input"
67
+ />
68
+ <div
69
+ class="chart-option-setting-row custom-time-input inline-block"
70
+ >
71
+ <div
72
+ class="view-select-label horizontal-flex-container"
73
+ >
74
+ <div class="select">
75
+ <select
76
+ id="chart-timespan-type-select"
77
+ v-model="localSelectedCustomTime"
78
+ data-id="chart-timespan-type-select"
79
+ >
80
+ <option
81
+ v-for="(item, index) in customTimeOptions"
82
+ :key="index"
83
+ :value="item.value"
84
+ >
85
+ {{ item.text }}
86
+ </option>
87
+ </select>
88
+ </div>
89
+ </div>
90
+ </div>
91
+ </div>
92
+ </td>
93
+ </tr>
94
+ <tr>
95
+ <td class="relative">
96
+ <input
97
+ id="custom-time-fromInput"
98
+ v-model="localPeriodType"
99
+ data-id="custom-time-from-input"
100
+ type="radio"
101
+ value="period"
102
+ class="custom-radio-button"
103
+ name="lastFrom"
104
+ />
105
+ <label
106
+ for="custom-time-fromInput"
107
+ class="custom-radio-label text-capitalize text-right"
108
+ >{{ localization.common.from2 }}:
109
+ </label>
110
+ </td>
111
+ <td>
112
+ <div
113
+ :class="[
114
+ 'date-container-row disabled-container calendar-date-row',
115
+ { active: localPeriodType === 'period' },
116
+ ]"
117
+ >
118
+ <input
119
+ id="current-date-from"
120
+ v-model.lazy="localCurrentDateFrom"
121
+ data-id="current-date-from-input"
122
+ type="text"
123
+ class="chart-option-setting-row custom-time-input first-from"
124
+ />
125
+ <div class="section-datepicker">
126
+ <atoms-datepicker
127
+ v-model="dateFrom"
128
+ :lang="props.language"
129
+ class="calendar-from calendar-popup btn-show-hide-calendar"
130
+ @update="onUpdateDateFrom"
131
+ />
132
+ </div>
133
+ <input
134
+ id="current-time-from"
135
+ v-model="currentTimeFrom"
136
+ data-id="current-time-from-input"
137
+ type="text"
138
+ class="chart-option-setting-row custom-time-input"
139
+ />
140
+ </div>
141
+ </td>
142
+ </tr>
143
+ <tr>
144
+ <td class="custom-time-label-text text-right">
145
+ {{ localization.common.to2 }}:
146
+ </td>
147
+ <td>
148
+ <div
149
+ :class="[
150
+ 'date-container-row disabled-container calendar-date-row',
151
+ { active: localPeriodType === 'period' },
152
+ ]"
153
+ >
154
+ <input
155
+ id="current-date-to"
156
+ v-model.lazy="currentDateTo"
157
+ data-id="current-date-to-input"
158
+ type="text"
159
+ class="chart-option-setting-row custom-time-input first-to"
160
+ />
161
+ <div class="section-datepicker">
162
+ <atoms-datepicker
163
+ v-model="dateTo"
164
+ :lang="props.language"
165
+ class="calendar-from calendar-popup btn-show-hide-calendar"
166
+ @update="onUpdateDateTo"
167
+ />
168
+ </div>
169
+ <input
170
+ id="current-time-to"
171
+ v-model="currentTimeTo"
172
+ data-id="current-time-to-input"
173
+ type="text"
174
+ class="chart-option-setting-row custom-time-input"
175
+ />
176
+ </div>
177
+ </td>
178
+ </tr>
179
+ <tr>
180
+ <td></td>
181
+ <td
182
+ :class="[
183
+ 'disabled-container',
184
+ { active: localPeriodType === 'period' },
185
+ ]"
186
+ >
187
+ <span> ({{ localization.common.isoTimeFormat }}) </span>
188
+ </td>
189
+ </tr>
190
+ </tbody>
191
+ </table>
192
+ </div>
193
+ </div>
194
+ </div>
195
+ <div class="horizontal-flex-container chart-type-container">
196
+ <div class="view-select-label horizontal-flex-container">
197
+ <label for="chart-type-select" class="label-select"
198
+ >{{ localization.common.chartType }}:</label
199
+ >
200
+ <div class="select">
201
+ <select
202
+ id="chart-type-select"
203
+ v-model="chartType"
204
+ data-id="chart-type-select"
205
+ >
206
+ <option
207
+ v-for="(item, index) in chartTypeOptions"
208
+ :key="index"
209
+ :value="item.value"
210
+ >
211
+ {{ item.text }}
212
+ </option>
213
+ </select>
214
+ </div>
215
+ </div>
216
+ </div>
217
+ </div>
218
+ </div>
219
+ </template>
220
+
221
+ <script setup lang="ts">
222
+ import { format } from 'date-fns'
223
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
224
+ import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
225
+ import {
226
+ timespanFunc,
227
+ customTimeFunc,
228
+ chartTypeFunc,
229
+ } from '~/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/timespan/form/lib/config/dateForm'
230
+
231
+ const props = defineProps<{
232
+ language: string
233
+ selectedChartType: string
234
+ selectedTimespanType: string
235
+ unitsCount: number
236
+ periodType: string
237
+ selectedCustomTime: string
238
+ customDateFrom: string
239
+ customDateTo: string
240
+ customTimeFrom: string
241
+ customTimeTo: string
242
+ }>()
243
+
244
+ const emits = defineEmits<{
245
+ (event: 'update-chart-type', value: string): void
246
+ (event: 'update-custom-time', value: string): void
247
+ (event: 'update-timespan-type', value: string): void
248
+ (event: 'update-unit-count', value: number): void
249
+ (event: 'update-period-type', value: string): void
250
+ (event: 'update-custom-date-from', value: string): void
251
+ (event: 'update-custom-date-to', value: string): void
252
+ (event: 'update-custom-time-from', value: string): void
253
+ (event: 'update-custom-time-to', value: string): void
254
+ }>()
255
+
256
+ const { $formattedDate, $isDate, $getTimeFormat, $getUnixByDate } = useNuxtApp()
257
+
258
+ const localization = computed<UI_I_Localization>(() => useLocal())
259
+
260
+ const timespanOptions = computed<UI_I_OptionItem[]>(() =>
261
+ timespanFunc(localization.value)
262
+ )
263
+ const localSelectedTimespan = ref<string>(
264
+ props.selectedTimespanType || timespanOptions.value[0].value
265
+ )
266
+ watch(
267
+ () => props.selectedTimespanType,
268
+ (newValue) => {
269
+ localSelectedTimespan.value = newValue || timespanOptions.value[0].value
270
+ }
271
+ )
272
+ const localPeriodType = ref<string>('last')
273
+ watch(
274
+ () => props.periodType,
275
+ (newValue) => {
276
+ localPeriodType.value = newValue || 'last'
277
+ },
278
+ { immediate: true }
279
+ )
280
+
281
+ watch(
282
+ localSelectedTimespan,
283
+ (newValue) => {
284
+ emits('update-timespan-type', newValue)
285
+ },
286
+ { immediate: true }
287
+ )
288
+
289
+ watch(
290
+ localPeriodType,
291
+ (newValue) => {
292
+ const currentValue = newValue || 'period'
293
+ emits('update-period-type', currentValue)
294
+ },
295
+ { immediate: true }
296
+ )
297
+
298
+ const localLast = ref<number>(1)
299
+ watch(
300
+ localLast,
301
+ (newValue) => {
302
+ emits('update-unit-count', newValue)
303
+ },
304
+ { immediate: true }
305
+ )
306
+ watch(
307
+ () => props.unitsCount,
308
+ (newValue) => {
309
+ localLast.value = newValue > 0 ? newValue : 1
310
+ },
311
+ { immediate: true }
312
+ )
313
+
314
+ const localSelectedCustomTime = ref<string>('hours')
315
+ const customTimeOptions = computed<UI_I_OptionItem[]>(() => {
316
+ const lang = useLocalStorage('lang')
317
+
318
+ return customTimeFunc(localization.value, localLast.value, lang)
319
+ })
320
+ watch(
321
+ () => props.selectedCustomTime,
322
+ (newValue) => {
323
+ localSelectedCustomTime.value = newValue || 'hours'
324
+ },
325
+ { immediate: true }
326
+ )
327
+ watch(
328
+ localSelectedCustomTime,
329
+ (newValue) => {
330
+ emits('update-custom-time', newValue)
331
+ },
332
+ { immediate: true }
333
+ )
334
+
335
+ const chartType = ref<string>('line_graph')
336
+ const chartTypeOptions = computed<UI_I_OptionItem[]>(() =>
337
+ chartTypeFunc(localization.value)
338
+ )
339
+
340
+ const periodTypeText = computed<string>(() => {
341
+ let text = ''
342
+ const lang = useLocalStorage('lang')
343
+
344
+ if (lang !== 'ru_RU') text = localization.value.last
345
+ else text = getCorrectPeriodTypeText(localLast.value)
346
+
347
+ return text
348
+ })
349
+
350
+ const getCorrectPeriodTypeText = (hours: number): string => {
351
+ let prefix: string
352
+
353
+ if (!hours) return getCorrectPeriodTypeText.prefix
354
+
355
+ if (hours % 10 === 1 && hours % 100 !== 11) prefix = 'Последний'
356
+ else prefix = 'Последние'
357
+
358
+ getCorrectPeriodTypeText.prefix = prefix
359
+ return prefix
360
+ }
361
+
362
+ const setCurrentChartType = (): void => {
363
+ const selected = props.selectedChartType
364
+ let result = 'line_graph'
365
+
366
+ if (selected === 'spline') result = 'line_graph'
367
+ else if (selected === 'area') result = 'stacked_graph'
368
+
369
+ chartType.value = result
370
+ }
371
+
372
+ watch(
373
+ () => props.selectedChartType,
374
+ () => {
375
+ setCurrentChartType()
376
+ },
377
+ { immediate: true }
378
+ )
379
+
380
+ watch(
381
+ chartType,
382
+ (newValue) => {
383
+ let currentValue = 'spline'
384
+
385
+ if (newValue === 'line_graph') currentValue = 'spline'
386
+ else if (newValue === 'stacked_graph') currentValue = 'area'
387
+
388
+ emits('update-chart-type', currentValue)
389
+ },
390
+ { immediate: true }
391
+ )
392
+
393
+ const yesterday = new Date().setDate(new Date().getDate() - 1)
394
+ const dateFrom = ref<number>(yesterday)
395
+ const dateTo = ref<number>(new Date().getTime())
396
+
397
+ const localCurrentDateFrom = ref<string>('')
398
+ const currentDateTo = ref<string>('')
399
+ const currentTimeFrom = ref<string>('')
400
+ const currentTimeTo = ref<string>('')
401
+
402
+ const getCurrentTime = (): void => {
403
+ localCurrentDateFrom.value =
404
+ props.customDateFrom || $formattedDate(yesterday, '')
405
+ currentDateTo.value = props.customDateTo || $formattedDate(new Date(), '')
406
+
407
+ const currentTime = format(new Date(), $getTimeFormat(true))
408
+ currentTimeFrom.value = props.customTimeFrom || currentTime
409
+ currentTimeTo.value = props.customTimeTo || currentTime
410
+ }
411
+
412
+ const onUpdateDateFrom = (val: number): void => {
413
+ if (!val) return
414
+
415
+ localCurrentDateFrom.value = $formattedDate(new Date(val), '')
416
+ }
417
+ watch(localCurrentDateFrom, (newValue) => {
418
+ emits('update-custom-date-from', newValue)
419
+ if (!newValue) return
420
+
421
+ if ($isDate(newValue)) dateFrom.value = $getUnixByDate(newValue)
422
+ })
423
+
424
+ const onUpdateDateTo = (val: number): void => {
425
+ if (!val) return
426
+
427
+ currentDateTo.value = $formattedDate(new Date(val), '')
428
+ }
429
+ watch(currentDateTo, (newValue) => {
430
+ emits('update-custom-date-to', newValue)
431
+ if (!newValue) return
432
+
433
+ if ($isDate(newValue)) dateTo.value = $getUnixByDate(newValue)
434
+ })
435
+ watch(currentTimeFrom, (newValue) => {
436
+ emits('update-custom-time-from', newValue)
437
+ })
438
+ watch(currentTimeTo, (newValue) => {
439
+ emits('update-custom-time-to', newValue)
440
+ })
441
+
442
+ onMounted(() => {
443
+ getCurrentTime()
444
+ })
445
+ </script>
446
+
447
+ <style scoped lang="scss">
448
+ .chart-option-timespan-split {
449
+ overflow-x: auto;
450
+ //flex-basis: 56%;
451
+ padding: 5px;
452
+
453
+ .timespan-objects-section-direction {
454
+ display: flex;
455
+ flex-direction: row;
456
+ align-items: flex-start;
457
+
458
+ .chart-option-timespan-settings {
459
+ margin-left: 15px;
460
+
461
+ .chart-option-setting-row {
462
+ width: 150px;
463
+ margin-bottom: 5px;
464
+ }
465
+
466
+ .custom-radio-button {
467
+ position: absolute;
468
+ opacity: 0;
469
+
470
+ &:checked + .custom-radio-label:before {
471
+ box-shadow: inset 0 0 0 6px #0079b8;
472
+ border: none;
473
+ }
474
+ }
475
+ .custom-radio-label {
476
+ display: block;
477
+ position: relative;
478
+ min-height: 19.2px;
479
+ padding-left: 23px;
480
+ cursor: pointer;
481
+ line-height: 19.2px;
482
+ color: #454545;
483
+
484
+ &:before {
485
+ position: absolute;
486
+ top: 3px;
487
+ left: 0;
488
+ content: '';
489
+ display: inline-block;
490
+ height: 16px;
491
+ width: 16px;
492
+ border: 0.8px solid #565656;
493
+ border-radius: 50%;
494
+ }
495
+ }
496
+
497
+ .calendar-date-row {
498
+ display: flex;
499
+ align-items: center;
500
+
501
+ .custom-time-input.first-from,
502
+ .custom-time-input.first-to {
503
+ max-width: 114px;
504
+ }
505
+ .btn-show-hide-calendar {
506
+ margin: 0 9px;
507
+ cursor: pointer;
508
+ }
509
+ }
510
+
511
+ .custom-time-input {
512
+ margin-left: 8px;
513
+ margin-right: 8px;
514
+ max-width: 140px;
515
+ }
516
+ }
517
+
518
+ .custom-timespan-settings-container:not(.active),
519
+ .custom-timespan-type-last-container:not(.active),
520
+ .disabled-container:not(.active) {
521
+ opacity: 0.6;
522
+ pointer-events: none;
523
+ }
524
+ }
525
+
526
+ .chart-type-container {
527
+ margin-top: 15px;
528
+
529
+ .horizontal-flex-container {
530
+ display: flex;
531
+ flex-direction: row;
532
+
533
+ .select {
534
+ margin-left: 15px;
535
+ }
536
+ }
537
+ }
538
+ }
539
+ </style>
@@ -0,0 +1,115 @@
1
+ import type {
2
+ UI_I_ArbitraryObject,
3
+ UI_I_Localization,
4
+ } from '~/lib/models/interfaces'
5
+ import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
6
+
7
+ export const timespanFunc = (
8
+ localization: UI_I_Localization
9
+ ): UI_I_OptionItem[] => [
10
+ {
11
+ text: localization.common.realTime,
12
+ value: 'real_time',
13
+ },
14
+ {
15
+ text: localization.common.lastDay,
16
+ value: 'last_day',
17
+ },
18
+ {
19
+ text: localization.common.lastWeek,
20
+ value: 'last_week',
21
+ },
22
+ {
23
+ text: localization.common.lastMonth,
24
+ value: 'last_month',
25
+ },
26
+ // {
27
+ // text: localization.common.lastYear,
28
+ // value: 'last_year',
29
+ // },
30
+ {
31
+ text: localization.common.customInterval,
32
+ value: 'custom_interval',
33
+ },
34
+ ]
35
+
36
+ export const customTimeFunc = (
37
+ localization: UI_I_Localization,
38
+ value: number,
39
+ lang: string
40
+ ): UI_I_OptionItem[] => {
41
+ const isLangRu = lang === 'ru_RU'
42
+
43
+ const hourText = isLangRu
44
+ ? getCorrectRuForm(value, 'hour')
45
+ : localization.common.hours2
46
+ const dayText = isLangRu
47
+ ? getCorrectRuForm(value, 'day')
48
+ : localization.common.days2
49
+ const weekText = isLangRu
50
+ ? getCorrectRuForm(value, 'week')
51
+ : localization.common.weeks2
52
+ const monthText = isLangRu
53
+ ? getCorrectRuForm(value, 'month')
54
+ : localization.common.months2
55
+
56
+ return [
57
+ {
58
+ text: hourText,
59
+ value: 'hours',
60
+ },
61
+ {
62
+ text: dayText,
63
+ value: 'days',
64
+ },
65
+ {
66
+ text: weekText,
67
+ value: 'weeks',
68
+ },
69
+ {
70
+ text: monthText,
71
+ value: 'months',
72
+ },
73
+ ]
74
+ }
75
+
76
+ export const chartTypeFunc = (
77
+ localization: UI_I_Localization
78
+ ): UI_I_OptionItem[] => [
79
+ {
80
+ text: localization.common.lineGraph,
81
+ value: 'line_graph',
82
+ },
83
+ {
84
+ text: localization.common.stackedGraph,
85
+ value: 'stacked_graph',
86
+ },
87
+ ]
88
+
89
+ const getCorrectRuForm = (value: number, type: string): string => {
90
+ const forms: UI_I_ArbitraryObject<string[]> = {
91
+ hour: ['Час', 'Часа', 'Часов'],
92
+ day: ['День', 'Дня', 'Дней'],
93
+ week: ['Неделя', 'Недели', 'Недель'],
94
+ month: ['Месяц', 'Месяца', 'Месяцев'],
95
+ }
96
+
97
+ let text: string
98
+
99
+ if (!value) {
100
+ return getCorrectRuForm[type]
101
+ }
102
+
103
+ if (value % 10 === 1 && value % 100 !== 11) {
104
+ text = forms[type][0]
105
+ } else if (
106
+ [2, 3, 4].includes(value % 10) &&
107
+ ![12, 13, 14].includes(value % 100)
108
+ ) {
109
+ text = forms[type][1]
110
+ } else {
111
+ text = forms[type][2]
112
+ }
113
+ getCorrectRuForm[type] = text
114
+ return text
115
+ }
@@ -0,0 +1,17 @@
1
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
2
+ import type { UI_I_VerticalTabs } from '~/components/atoms/tabs/lib/models/interfaces'
3
+
4
+ export const metricsFunc = (
5
+ localization: UI_I_Localization
6
+ ): UI_I_VerticalTabs[] => [
7
+ {
8
+ text: localization.common.power,
9
+ value: 'power',
10
+ testId: 'metric-item-power-button',
11
+ },
12
+ {
13
+ text: localization.inventoryMonitor.temperature,
14
+ value: 'temperature',
15
+ testId: 'metric-item-temperature-button',
16
+ },
17
+ ]
@@ -0,0 +1,15 @@
1
+ export interface UI_I_OptionsForm {
2
+ fields: string
3
+ optionName: string
4
+ metric: string
5
+ periodName: string
6
+ periodType: string
7
+ unitCount: number
8
+ localTimespanType: string
9
+ dateFrom: string
10
+ timeFrom: string
11
+ dateTo: string
12
+ timeTo: string
13
+ chartType: string
14
+ period: number[]
15
+ }
@@ -0,0 +1 @@
1
+ export type UI_T_Chart = 'power' | 'temperature'