bfg-common 1.5.749 → 1.5.750

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.
@@ -118,6 +118,11 @@ const descriptionText = computed<string>(() => {
118
118
 
119
119
  .confirm-modal-checkbox {
120
120
  height: max-content;
121
+
122
+ :deep(.ui-checkbox-label-text) {
123
+ line-height: 18px;
124
+ margin-top: 1px;
125
+ }
121
126
  }
122
127
  }
123
128
  </style>
@@ -11,8 +11,8 @@ export enum UI_E_TitleConfirmModal {
11
11
  export enum UI_E_TitleModal {
12
12
  'take' = '',
13
13
  'edit' = '',
14
- 'revert' = 'revertToSnapshotConfirmation',
15
- 'delete' = 'deleteSnapshotConfirmation',
14
+ 'revert' = 'revertToSnapshot',
15
+ 'delete' = 'deleteSnapshot',
16
16
  'delete_all' = 'deleteAllSnapshots',
17
17
  'group_delete_all' = 'deleteAllSnapshots',
18
18
  'group_take' = '',
@@ -45,7 +45,7 @@
45
45
  :label="localization.common.name"
46
46
  :error="nameError"
47
47
  test-id="vm-take-edit-snapshot-modal-name-input"
48
- class="form__input mb-6"
48
+ class="mb-6"
49
49
  input-style="rounded"
50
50
  size="md"
51
51
  @change="onCheckNameValidation"
@@ -57,6 +57,7 @@
57
57
  test-id="vm-take-edit-snapshot-modal-name-input"
58
58
  height="84"
59
59
  size="sm"
60
+ class="vm-take-edit-textarea"
60
61
  />
61
62
 
62
63
  <div v-if="props.type === 'take'" class="mt-6">
@@ -64,7 +65,7 @@
64
65
  v-model="isIncludeVirtualMachinesMemory"
65
66
  :label-text="localization.snapshots.saveVirtualMachineMemory"
66
67
  :disabled="props.isDisabledSaveVm"
67
- class="mb-3 flex items-start"
68
+ class="mb-3 flex items-start bottom-checkbox"
68
69
  test-id="vm-take-edit-snapshot-modal-save-memory-checkbox"
69
70
  size="md"
70
71
  />
@@ -73,7 +74,7 @@
73
74
  :label-text="
74
75
  localization.common.quiesceGuestFileSystemRequiresVMTools
75
76
  "
76
- class="flex items-start"
77
+ class="flex items-start bottom-checkbox"
77
78
  test-id="vm-take-edit-snapshot-modal-quiesce-guest-file-system-checkbox"
78
79
  size="md"
79
80
  disabled
@@ -129,8 +130,8 @@ const alertMessages = ref<string[]>([])
129
130
  const title = computed<string>(() => {
130
131
  let titleType =
131
132
  props.type === 'take'
132
- ? localization.value.common.takeSnapshot
133
- : localization.value.common.editSnapshot
133
+ ? localization.value.snapshots.newSnapshot
134
+ : localization.value.snapshots.editSnapshot
134
135
 
135
136
  titleType = titleType.replace('snapshot', 'Snapshot')
136
137
 
@@ -158,11 +159,26 @@ const onSubmit = (): void => {
158
159
  alertMessages.value = [
159
160
  localization.value.common.nameAlreadyExists.replace('{0}', name),
160
161
  ]
161
- nameError.value = ' ' // Чтобы поле отображало рамку ошибки
162
+ nameError.value = ' '
162
163
  return
163
164
  }
164
165
  emits('submit')
165
166
  }
166
167
  </script>
167
168
 
168
- <style scoped lang="scss"></style>
169
+ <style scoped lang="scss">
170
+ .vm-take-edit-textarea {
171
+ :deep(.ui-main .ui-main-textarea) {
172
+ line-height: 18px;
173
+ height: 72px !important;
174
+ }
175
+ }
176
+ .bottom-checkbox {
177
+ height: unset !important;
178
+
179
+ :deep(.ui-checkbox-label-text) {
180
+ line-height: 18px;
181
+ margin-top: 1px;
182
+ }
183
+ }
184
+ </style>
@@ -1,27 +1,30 @@
1
1
  <template>
2
+ <common-vm-snapshots-new-skeleton v-if="props.snapshotsLoading" />
2
3
  <div
4
+ v-else
3
5
  :class="[
4
6
  'snapshots-page grid h-inherit p-4 overflow-hidden ',
5
7
  { 'selected gap-3': props.detailData },
6
8
  ]"
7
9
  >
8
10
  <div class="left-content overflow-auto grid p-4">
9
- <div class="flex justify-between">
11
+ <div class="flex justify-between gap-4 flex-wrap">
10
12
  <h3 class="title-block font-[500] text-[16px]">
11
13
  {{ localization.inventoryTabs.snapshots }} ({{ snapshotsCount }})
12
14
  </h3>
13
15
  <ui-button
14
16
  test-id="take-snapshot-btn"
15
17
  size="md"
18
+ class="take-snapshot-button"
16
19
  @click="emits('show-modal', 'take')"
17
20
  >
18
21
  <ui-icon
19
22
  name="icon-snapshotTake"
20
23
  width="20"
21
24
  height="20"
22
- class="mr-2"
25
+ class="mr-2 icon"
23
26
  />
24
- {{ localization.common.takeSnapshot }}
27
+ {{ localization.snapshots.takeSnapshot }}
25
28
  </ui-button>
26
29
  </div>
27
30
  <div
@@ -29,16 +32,17 @@
29
32
  class="snapshots-tree-content overflow-y-auto my-4 px-2 pb-2"
30
33
  >
31
34
  <ui-tree
32
- :is-loading="props.snapshotsLoading"
33
35
  :nodes="props.snapshotsTree"
34
36
  @select-node="emits('select-node', $event)"
35
37
  @toggle-node="emits('show-nodes', $event.id)"
36
38
  @show-context-menu="showContextMenu"
37
39
  >
38
40
  <template #content="{ node }">
39
- <div class="flex-align-center">
41
+ <div class="flex-align-center gap-2">
40
42
  <span :class="['node-icon', node.iconClassName]"></span>
41
- <span class="node-name text-ellipsis">{{ node.name }}</span>
43
+ <span class="node-name text-ellipsis text-3">{{
44
+ node.name
45
+ }}</span>
42
46
  </div>
43
47
  </template>
44
48
  </ui-tree>
@@ -53,7 +57,7 @@
53
57
  <p class="title-block font-[400] text-[16px] mt-2">
54
58
  {{ localization.snapshots.noSnapshotsAvailable }}
55
59
  </p>
56
- <p class="description-block mt-[6px] text-[13px]">
60
+ <p class="description-block mt-[6px] text-[13px] text-center">
57
61
  {{ localization.snapshots.noSnapshotsAvailableDesc }}
58
62
  </p>
59
63
  </div>
@@ -78,7 +82,7 @@
78
82
  v-if="props.detailData"
79
83
  class="snapshot-details overflow-hidden flex-direction-column p-4"
80
84
  >
81
- <div class="flex justify-between mb-6">
85
+ <div class="flex justify-between mb-6 gap-4 pr-4 flex-wrap">
82
86
  <h3 class="title-block font-[500] text-[16px]">
83
87
  {{ localization.snapshots.snapshotDetails }}
84
88
  </h3>
@@ -168,7 +172,13 @@
168
172
  </ui-tooltip>
169
173
  </div>
170
174
  </div>
171
- <div class="grid row-gap-3 overflow-y-auto">
175
+ <div
176
+ ref="detailsScrollBlock"
177
+ :class="[
178
+ 'grid row-gap-3 pr-4 overflow-y-auto details-scroll-block',
179
+ { 'has-scroll': hasScroll },
180
+ ]"
181
+ >
172
182
  <ui-info-block
173
183
  v-for="(item, index) in currentDetailsData"
174
184
  :key="index"
@@ -179,9 +189,12 @@
179
189
  <ui-icon
180
190
  v-if="item.labelIcon"
181
191
  :name="item.labelIcon"
192
+ :class="[
193
+ 'info-label-icon mr-[10px]',
194
+ `icon-name-${item.labelIcon}`,
195
+ ]"
182
196
  width="20"
183
197
  height="20"
184
- class="info-label-icon mr-[10px]"
185
198
  />
186
199
  <span class="info-label">{{ item.label }}</span>
187
200
  </div>
@@ -214,6 +227,7 @@
214
227
  </template>
215
228
 
216
229
  <script setup lang="ts">
230
+ import { useElementSize } from '@vueuse/core'
217
231
  import type { UI_I_InfoBlock } from '~/node_modules/bfg-uikit/components/ui/infoBlock/models/interfaces'
218
232
  import type { UI_I_Localization } from '~/lib/models/interfaces'
219
233
  import type { UI_T_SnapshotActionType } from '~/components/common/vm/snapshots/lib/models/types'
@@ -253,6 +267,20 @@ const { showContextMenu, contextMenuShow, contextMenu } = utils.getContextMenu()
253
267
  const onSelectContextMenuItem = (actionType: UI_T_SnapshotActionType): void => {
254
268
  emits('show-modal', actionType)
255
269
  }
270
+
271
+ const detailsScrollBlock = ref<HTMLElement | null>(null)
272
+ const { height } = useElementSize(detailsScrollBlock)
273
+ const hasScroll = ref<boolean>(false)
274
+ const checkScroll = (): void => {
275
+ const element = detailsScrollBlock.value
276
+ if (element) {
277
+ hasScroll.value = element.scrollHeight > element.clientHeight
278
+ }
279
+ }
280
+
281
+ watch(height, () => {
282
+ checkScroll()
283
+ })
256
284
  </script>
257
285
 
258
286
  <style>
@@ -260,7 +288,9 @@ const onSelectContextMenuItem = (actionType: UI_T_SnapshotActionType): void => {
260
288
  --snapshots-page-inner-block-bg: #ffffff;
261
289
  --snapshots-page-title-color: #4d5d69;
262
290
  --snapshots-page-tree-border-color: #e9ebed;
291
+ --snapshots-page-tree-block-bg-color: #ffffff;
263
292
  --snapshots-page-details-action-color: #4d5d69;
293
+ --snapshots-page-details-action-line-color: #e9ebeda3;
264
294
  --snapshots-page-details-action-hover-color: #213444;
265
295
  --snapshots-page-info-block-label-color: #4d5d69;
266
296
  --snapshots-page-info-block-value-color: #182531;
@@ -269,7 +299,9 @@ const onSelectContextMenuItem = (actionType: UI_T_SnapshotActionType): void => {
269
299
  --snapshots-page-inner-block-bg: #334453;
270
300
  --snapshots-page-title-color: #e9eaec;
271
301
  --snapshots-page-tree-border-color: #e9ebed1f;
302
+ --snapshots-page-tree-block-bg-color: #1b2a371f;
272
303
  --snapshots-page-details-action-color: #e9eaec;
304
+ --snapshots-page-details-action-line-color: #e9ebed1f;
273
305
  --snapshots-page-details-action-hover-color: #ffffff;
274
306
  --snapshots-page-info-block-label-color: #e9eaec;
275
307
  --snapshots-page-info-block-value-color: #e9eaec;
@@ -285,6 +317,13 @@ const onSelectContextMenuItem = (actionType: UI_T_SnapshotActionType): void => {
285
317
  .title-block {
286
318
  color: var(--snapshots-page-title-color);
287
319
  }
320
+ .take-snapshot-button {
321
+ white-space: nowrap;
322
+
323
+ .icon {
324
+ min-width: 20px;
325
+ }
326
+ }
288
327
 
289
328
  .left-content {
290
329
  background-color: var(--snapshots-page-inner-block-bg);
@@ -295,13 +334,14 @@ const onSelectContextMenuItem = (actionType: UI_T_SnapshotActionType): void => {
295
334
  .snapshots-tree-content {
296
335
  border: 1px solid var(--snapshots-page-tree-border-color);
297
336
  border-radius: 8px;
337
+ background-color: var(--snapshots-page-tree-block-bg-color);
298
338
 
299
339
  :deep(.tree-container) {
300
340
  width: max-content;
301
341
  min-width: 100%;
302
342
 
303
343
  .tree-content {
304
- padding-right: 8px;
344
+ //padding-right: 8px;
305
345
 
306
346
  .node-wrapper {
307
347
  border-radius: 4px;
@@ -320,6 +360,10 @@ const onSelectContextMenuItem = (actionType: UI_T_SnapshotActionType): void => {
320
360
  }
321
361
  }
322
362
  .delete-all {
363
+ &.disabled {
364
+ color: #bdc3c7;
365
+ }
366
+
323
367
  &:not(.disabled) {
324
368
  color: #ea3223;
325
369
  }
@@ -329,12 +373,18 @@ const onSelectContextMenuItem = (actionType: UI_T_SnapshotActionType): void => {
329
373
  background-color: var(--snapshots-page-inner-block-bg);
330
374
  box-shadow: 0 1px 4px 0 #00000014;
331
375
  border-radius: 8px;
376
+ padding-right: 0;
332
377
 
333
378
  .details-actions-block {
334
379
  .border-line {
335
380
  width: 1px;
336
381
  height: 20px;
337
- background-color: #e9ebeda3;
382
+ background-color: var(--snapshots-page-details-action-line-color);
383
+ }
384
+ .revert-snapshot-btn {
385
+ :deep(path) {
386
+ stroke-width: 1.6;
387
+ }
338
388
  }
339
389
  .revert-snapshot-btn,
340
390
  .edit-snapshot-btn {
@@ -348,18 +398,40 @@ const onSelectContextMenuItem = (actionType: UI_T_SnapshotActionType): void => {
348
398
  color: #ea3223;
349
399
  }
350
400
  }
401
+ .details-scroll-block {
402
+ padding-right: 0;
403
+
404
+ &:not(.has-scroll) {
405
+ padding-right: 16px;
406
+ }
407
+ }
351
408
  .info-block-label-content {
352
409
  .info-label-icon {
353
410
  color: #9da6ad;
354
411
  min-width: 20px;
412
+
413
+ &.icon-name-icon-snapshotTake {
414
+ :deep(path) {
415
+ stroke-width: 1.3;
416
+ }
417
+ }
418
+ &.icon-name-settings {
419
+ :deep(path) {
420
+ stroke-width: 1.7;
421
+ }
422
+ }
355
423
  }
356
424
  .info-label {
357
- margin-top: 2.5px;
425
+ margin-top: 1px;
426
+ line-height: 18px;
358
427
  color: var(--snapshots-page-info-block-label-color);
359
428
  }
360
429
  }
361
430
  .empty-description {
362
431
  color: #9da6ad;
432
+ margin-top: 1px;
433
+ line-height: 18px;
434
+ text-align: right;
363
435
  }
364
436
  :deep(.ui-main-info-block-item-right) {
365
437
  white-space: unset !important;
@@ -372,12 +444,23 @@ const onSelectContextMenuItem = (actionType: UI_T_SnapshotActionType): void => {
372
444
  color: var(--snapshots-page-info-block-value-color);
373
445
  font-size: 13px;
374
446
  font-weight: 400;
447
+ line-height: 18px;
448
+ margin-top: 1px;
375
449
  }
376
450
  :deep(.ui-main-info-block-item-right-open) {
377
451
  display: none;
378
452
  }
379
453
  }
380
454
  }
455
+ :root.dark-theme {
456
+ .left-content {
457
+ .delete-all {
458
+ &.disabled {
459
+ opacity: 0.44;
460
+ }
461
+ }
462
+ }
463
+ }
381
464
 
382
465
  @media (max-width: 1200px) {
383
466
  .snapshots-page {
@@ -0,0 +1,112 @@
1
+ <template>
2
+ <div class="skeleton-page grid gap-3 p-4 h-inherit overflow-hidden">
3
+ <div class="left-content grid p-4">
4
+ <div class="flex justify-between gap-4 flex-wrap">
5
+ <ui-skeleton-item width="80" height="20" />
6
+ <ui-skeleton-item width="160" height="36" />
7
+ </div>
8
+ <div class="border-block flex flex-col py-3 px-4 my-4">
9
+ <ui-skeleton-item width="100%" height="20" />
10
+ <ui-skeleton-item width="50%" height="20" />
11
+ <ui-skeleton-item width="30%" height="20" />
12
+ <ui-skeleton-item width="70%" height="20" />
13
+ <ui-skeleton-item width="20%" height="20" />
14
+ <ui-skeleton-item width="50%" height="20" />
15
+ <ui-skeleton-item width="80%" height="20" />
16
+ <ui-skeleton-item width="70%" height="20" />
17
+ <ui-skeleton-item width="20%" height="20" />
18
+ </div>
19
+ <ui-skeleton-item width="96" height="20" class="ml-auto" />
20
+ </div>
21
+ <div class="right-content grid p-4">
22
+ <div class="flex justify-between gap-4 flex-wrap top-container">
23
+ <ui-skeleton-item width="80" height="20" />
24
+ <div class="actions-block flex">
25
+ <ui-skeleton-item width="20" height="20" />
26
+ <div class="line-border"></div>
27
+ <ui-skeleton-item width="20" height="20" />
28
+ <div class="line-border"></div>
29
+ <ui-skeleton-item width="20" height="20" />
30
+ </div>
31
+ </div>
32
+ <div class="details-block flex flex-col my-6">
33
+ <div
34
+ v-for="index in detailsItemsCount"
35
+ :key="index"
36
+ class="details-block-item flex p-3"
37
+ >
38
+ <ui-skeleton-item width="20" height="20" class="mr-[10px]" />
39
+ <ui-skeleton-item width="144" height="20" />
40
+ <ui-skeleton-item width="144" height="20" class="ml-auto" />
41
+ </div>
42
+ </div>
43
+ </div>
44
+ </div>
45
+ </template>
46
+
47
+ <script setup lang="ts">
48
+ const detailsItemsCount = ref<number>(6)
49
+ </script>
50
+
51
+ <style>
52
+ :root {
53
+ --snapshots-left-skeleton-border-color: #e9ebed;
54
+ --snapshots-right-skeleton-action-line-border-color: #e9ebeda3;
55
+ --snapshots-right-skeleton-item-bg-color: #e9ebed66;
56
+ }
57
+ :root.dark-theme {
58
+ --snapshots-left-skeleton-border-color: #e9ebed1f;
59
+ --snapshots-right-skeleton-action-line-border-color: #e9ebed1f;
60
+ --snapshots-right-skeleton-item-bg-color: #e9ebed0f;
61
+ }
62
+ </style>
63
+
64
+ <style scoped lang="scss">
65
+ .skeleton-page {
66
+ grid-template-columns: repeat(2, calc(50% - 6px));
67
+
68
+ .left-content,
69
+ .right-content {
70
+ background-color: var(--snapshots-page-inner-block-bg);
71
+ box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.0784313725);
72
+ border-radius: 8px;
73
+ grid-template-rows: max-content 1fr max-content;
74
+ overflow: hidden;
75
+ }
76
+ .border-block {
77
+ border: 1px solid var(--snapshots-left-skeleton-border-color);
78
+ border-radius: 8px;
79
+ grid-row-gap: 10px;
80
+ overflow: auto;
81
+
82
+ :deep(.skeleton-item) {
83
+ min-height: 20px;
84
+ }
85
+ }
86
+ .right-content {
87
+ .top-container {
88
+ .actions-block {
89
+ grid-column-gap: 10px;
90
+
91
+ .line-border {
92
+ border: 1px solid
93
+ var(--snapshots-right-skeleton-action-line-border-color);
94
+ }
95
+ }
96
+ }
97
+ .details-block {
98
+ grid-row-gap: 10px;
99
+ overflow: auto;
100
+
101
+ .details-block-item {
102
+ background-color: var(--snapshots-right-skeleton-item-bg-color);
103
+ border-radius: 6px;
104
+ }
105
+
106
+ :deep(.skeleton-item) {
107
+ min-height: 20px;
108
+ }
109
+ }
110
+ }
111
+ }
112
+ </style>
@@ -54,6 +54,7 @@ const showContextMenu = (data: UI_I_ContextData): void => {
54
54
  contextMenu.value.type = node.type
55
55
  contextMenu.value.titleText = node.name
56
56
  contextMenu.value.titleIconClassName = node.iconClassName
57
+ contextMenu.value.items = contextMenuItemsFunc(localization.value)
57
58
  }
58
59
 
59
60
  watch(
@@ -75,20 +76,26 @@ const onSelectContextMenuItem = (item: UI_I_ContextMenuItem): void => {
75
76
 
76
77
  <style scoped lang="scss">
77
78
  .snapshot-context-menu-view {
78
- :deep(.menu-item) {
79
- .context-icon {
80
- display: none;
81
- }
79
+ :deep(.context-wrap) {
80
+ min-width: 112px;
82
81
 
83
- .item-ui-icon {
84
- margin-right: 8px;
85
- }
82
+ .menu-item {
83
+ .context-icon {
84
+ display: none;
85
+ }
86
86
 
87
- &:last-child {
88
- color: #ea3223;
87
+ .item-ui-icon {
88
+ margin-right: 8px;
89
+ width: 16px;
90
+ height: 16px;
91
+ }
89
92
 
90
- .context-link:hover {
93
+ &:last-child {
91
94
  color: #ea3223;
95
+
96
+ .context-link:hover {
97
+ color: #ea3223;
98
+ }
92
99
  }
93
100
  }
94
101
  }
@@ -31,7 +31,7 @@ export const constructDetails = (
31
31
  label: localization.common.size,
32
32
  value: detailData.size || '--',
33
33
  items: [],
34
- labelIcon: 'disk',
34
+ labelIcon: 'size',
35
35
  },
36
36
  {
37
37
  label: localization.snapshots.snapshotVMMemory,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.5.749",
4
+ "version": "1.5.750",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",
@@ -18,7 +18,7 @@
18
18
  "@vueuse/core": "10.1.2",
19
19
  "@vueuse/nuxt": "10.1.2",
20
20
  "bfg-nuxt-3-graph": "1.0.27",
21
- "bfg-uikit": "1.0.538",
21
+ "bfg-uikit": "1.0.539",
22
22
  "eslint-config-prettier": "^8.5.0",
23
23
  "eslint-plugin-myrules": "file:./eslint",
24
24
  "nuxt": "3.11.2",
package/plugins/time.ts CHANGED
@@ -1,58 +1,58 @@
1
- import { defineNuxtPlugin } from '#app'
2
- import type { UI_T_LangValue } from '~/lib/models/types'
3
- export default defineNuxtPlugin(() => {
4
- const time = function (): any {
5
- const self: any = {}
6
- self.millisecondsToHour = function (ms: number): number {
7
- return ~~(ms / 1000 / 60 / 60 / 24)
8
- }
9
- self.formatTime = (
10
- seconds: number,
11
- lang: UI_T_LangValue = 'ru_RU'
12
- ): string => {
13
- const units = {
14
- en_US: { s: 's', m: 'm', h: 'h' },
15
- ru_RU: { s: 'с', m: 'м', h: 'ч' },
16
- hy_AM: { s: 'վ', m: 'ր', h: 'ժ' },
17
- be_BY: { s: 'с', m: 'хв', h: 'г' },
18
- kk_KZ: { s: 'сек', m: 'мин', h: 'сағ' },
19
- zh_CHS: { s: '秒', m: '分', h: '时' },
20
- BROWSER: { s: 's', m: 'm', h: 'h' },
21
- }
22
-
23
- const unit = units[lang] || units.en_US
24
-
25
- if (seconds < 60) {
26
- return `${seconds}${unit.s}`
27
- }
28
-
29
- const hours = Math.floor(seconds / 3600)
30
- const minutes = Math.floor((seconds % 3600) / 60)
31
- const secs = seconds % 60
32
-
33
- let result = ''
34
-
35
- if (hours > 0) {
36
- result += `${hours}${unit.h} `
37
- }
38
-
39
- if (minutes > 0) {
40
- result += `${minutes}${unit.m} `
41
- }
42
-
43
- if (secs > 0) {
44
- result += `${secs}${unit.s}`
45
- }
46
-
47
- return result.trim()
48
- }
49
-
50
- return self
51
- }.call({})
52
-
53
- return {
54
- provide: {
55
- time,
56
- },
57
- }
58
- })
1
+ import { defineNuxtPlugin } from '#app'
2
+ import type { UI_T_LangValue } from '~/lib/models/types'
3
+ export default defineNuxtPlugin(() => {
4
+ const time = function (): any {
5
+ const self: any = {}
6
+ self.millisecondsToHour = function (ms: number): number {
7
+ return ~~(ms / 1000 / 60 / 60 / 24)
8
+ }
9
+ self.formatTime = (
10
+ seconds: number,
11
+ lang: UI_T_LangValue = 'ru_RU'
12
+ ): string => {
13
+ const units = {
14
+ en_US: { s: 's', m: 'm', h: 'h' },
15
+ ru_RU: { s: 'с', m: 'м', h: 'ч' },
16
+ hy_AM: { s: 'վ', m: 'ր', h: 'ժ' },
17
+ be_BY: { s: 'с', m: 'хв', h: 'г' },
18
+ kk_KZ: { s: 'сек', m: 'мин', h: 'сағ' },
19
+ zh_CHS: { s: '秒', m: '分', h: '时' },
20
+ BROWSER: { s: 's', m: 'm', h: 'h' },
21
+ }
22
+
23
+ const unit = units[lang] || units.en_US
24
+
25
+ if (seconds < 60) {
26
+ return `${seconds}${unit.s}`
27
+ }
28
+
29
+ const hours = Math.floor(seconds / 3600)
30
+ const minutes = Math.floor((seconds % 3600) / 60)
31
+ const secs = seconds % 60
32
+
33
+ let result = ''
34
+
35
+ if (hours > 0) {
36
+ result += `${hours}${unit.h} `
37
+ }
38
+
39
+ if (minutes > 0) {
40
+ result += `${minutes}${unit.m} `
41
+ }
42
+
43
+ if (secs > 0) {
44
+ result += `${secs}${unit.s}`
45
+ }
46
+
47
+ return result.trim()
48
+ }
49
+
50
+ return self
51
+ }.call({})
52
+
53
+ return {
54
+ provide: {
55
+ time,
56
+ },
57
+ }
58
+ })