bfg-common 1.5.757 → 1.5.759

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 (35) hide show
  1. package/assets/localization/local_be.json +4 -2
  2. package/assets/localization/local_en.json +4 -2
  3. package/assets/localization/local_hy.json +4 -2
  4. package/assets/localization/local_kk.json +4 -2
  5. package/assets/localization/local_ru.json +8 -6
  6. package/assets/localization/local_zh.json +3 -1
  7. package/components/common/browse/blocks/lib/models/types.ts +1 -1
  8. package/components/common/browse/lib/models/interfaces.ts +5 -5
  9. package/components/common/diagramMain/modals/lib/config/vCenterModal.ts +48 -48
  10. package/components/common/diagramMain/network/Contents.vue +497 -497
  11. package/components/common/diagramMain/port/Port.vue +580 -580
  12. package/components/common/pages/backups/backupsNew/BackupsNew.vue +19 -107
  13. package/components/common/pages/backups/backupsNew/contextMenuView/ContextMenuView.vue +10 -16
  14. package/components/common/pages/backups/modals/createBackup/New.vue +22 -9
  15. package/components/common/pages/backups/modals/createBackup/configuration/ConfigurationNew.vue +17 -3
  16. package/components/common/pages/backups/modals/createBackup/configuration/backupWindow/BackupWindow.vue +29 -29
  17. package/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/MaxBandwidth.vue +69 -69
  18. package/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/lib/config/options.ts +6 -6
  19. package/components/common/pages/backups/modals/createBackup/configuration/strategy/Strategy.vue +38 -38
  20. package/components/common/pages/backups/modals/createBackup/datastores/tableView/new/lib/config/table.ts +8 -8
  21. package/components/common/pages/backups/modals/createBackup/disks/tableView/new/TableView.vue +1 -1
  22. package/components/common/pages/backups/modals/createBackup/disks/tableView/new/lib/config/table.ts +7 -7
  23. package/components/common/pages/backups/modals/createBackup/general/GeneralNew.vue +1 -1
  24. package/components/common/pages/backups/modals/createBackup/lib/config/readyToCompleteOptions.ts +5 -5
  25. package/components/common/pages/backups/modals/createBackup/lib/config/steps.ts +1 -1
  26. package/components/common/pages/backups/modals/createBackup/lib/config/strategyOptions.ts +14 -2
  27. package/components/common/pages/backups/modals/createBackup/lib/models/interfaces.ts +8 -8
  28. package/components/common/pages/backups/modals/createBackup/lib/validation/validations.ts +6 -6
  29. package/components/common/vm/snapshots/new/New.vue +12 -11
  30. package/components/common/vm/snapshots/new/Skeleton.vue +2 -26
  31. package/components/common/wizards/network/add/Add.vue +6 -9
  32. package/components/common/wizards/network/add/lib/config/initialData.ts +1 -2
  33. package/package.json +1 -1
  34. package/plugins/time.ts +58 -58
  35. package/components/common/pages/backups/backupsNew/Skeleton.vue +0 -136
@@ -1,38 +1,38 @@
1
- <template>
2
- <atoms-stack-block
3
- :has-children="false"
4
- test-id="backup-strategy-stack-block"
5
- >
6
- <template #stackBlockKey>
7
- <span>{{ localization.common.strategy }}</span>
8
- </template>
9
- <template #stackBlockContent>
10
- <common-select-input
11
- v-model="model.strategy"
12
- :data="strategyOptions"
13
- test-id="backup-strategy"
14
- />
15
- </template>
16
- </atoms-stack-block>
17
- </template>
18
-
19
- <script lang="ts" setup>
20
- import type { UI_I_Localization } from '~/lib/models/interfaces'
21
- import type { UI_I_CreateBackupForm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
22
- import type { UI_I_SelectInputItem } from '~/components/common/select/input/lib/models/interfaces'
23
- import { strategyOptionsFunc } from '~/components/common/pages/backups/modals/createBackup/lib/config/strategyOptions'
24
-
25
- const model = defineModel<UI_I_CreateBackupForm>({ required: true })
26
-
27
- const localization = computed<UI_I_Localization>(() => useLocal())
28
-
29
- const strategyOptions = ref<UI_I_SelectInputItem[]>(
30
- strategyOptionsFunc(localization.value)
31
- )
32
- </script>
33
-
34
- <style lang="scss" scoped>
35
- #backup-transaction-logs {
36
- margin: 4px 4px 0 0;
37
- }
38
- </style>
1
+ <template>
2
+ <atoms-stack-block
3
+ :has-children="false"
4
+ test-id="backup-strategy-stack-block"
5
+ >
6
+ <template #stackBlockKey>
7
+ <span>{{ localization.common.strategy }}</span>
8
+ </template>
9
+ <template #stackBlockContent>
10
+ <common-select-input
11
+ v-model="model.strategy"
12
+ :data="strategyOptions"
13
+ test-id="backup-strategy"
14
+ />
15
+ </template>
16
+ </atoms-stack-block>
17
+ </template>
18
+
19
+ <script lang="ts" setup>
20
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
21
+ import type { UI_I_CreateBackupForm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
22
+ import type { UI_I_SelectInputItem } from '~/components/common/select/input/lib/models/interfaces'
23
+ import { strategyOptionsFunc } from '~/components/common/pages/backups/modals/createBackup/lib/config/strategyOptions'
24
+
25
+ const model = defineModel<UI_I_CreateBackupForm>({ required: true })
26
+
27
+ const localization = computed<UI_I_Localization>(() => useLocal())
28
+
29
+ const strategyOptions = ref<UI_I_SelectInputItem[]>(
30
+ strategyOptionsFunc(localization.value)
31
+ )
32
+ </script>
33
+
34
+ <style lang="scss" scoped>
35
+ #backup-transaction-logs {
36
+ margin: 4px 4px 0 0;
37
+ }
38
+ </style>
@@ -7,7 +7,7 @@ import type { UI_I_Localization } from '~/lib/models/interfaces'
7
7
  import type {
8
8
  UI_I_BackupDatastore,
9
9
  } from '~/components/common/pages/backups/modals/lib/models/interfaces'
10
- import { datastoreLocalizationByState } from '~/components/common/lib/config/states'
10
+ import {backupStorageIconByState, datastoreLocalizationByState} from '~/components/common/lib/config/states'
11
11
  import type {
12
12
  I_BackupDatastoreChipStatus
13
13
  } from "~/components/common/pages/backups/modals/createBackup/datastores/tableView/new/lib/models/interfaces";
@@ -22,7 +22,7 @@ export const getHeaderDataFunc = (
22
22
  text: localization.common.name,
23
23
  isSortable: true,
24
24
  sort: 'asc',
25
- width: '104px',
25
+ width: '160px',
26
26
  show: true,
27
27
  filter: true
28
28
  },
@@ -32,7 +32,7 @@ export const getHeaderDataFunc = (
32
32
  text: localization.common.state,
33
33
  isSortable: true,
34
34
  sort: 'asc',
35
- width: '128px',
35
+ width: '160px',
36
36
  show: true,
37
37
  filter: true
38
38
  },
@@ -42,7 +42,7 @@ export const getHeaderDataFunc = (
42
42
  text: localization.common.capacity,
43
43
  isSortable: true,
44
44
  sort: 'asc',
45
- width: '96px',
45
+ width: '120px',
46
46
  show: true,
47
47
  filter: true
48
48
  },
@@ -52,7 +52,7 @@ export const getHeaderDataFunc = (
52
52
  text: localization.common.provisioned,
53
53
  isSortable: true,
54
54
  sort: 'asc',
55
- width: '96px',
55
+ width: '128px',
56
56
  show: true,
57
57
  filter: true
58
58
  },
@@ -82,7 +82,7 @@ export const getHeaderDataFunc = (
82
82
  text: localization.common.type,
83
83
  isSortable: true,
84
84
  sort: 'asc',
85
- width: '80',
85
+ width: '104px',
86
86
  show: true,
87
87
  filter: true
88
88
  },
@@ -92,7 +92,7 @@ export const getHeaderDataFunc = (
92
92
  text: localization.common.location,
93
93
  isSortable: true,
94
94
  sort: 'asc',
95
- width: '160px',
95
+ width: '184px',
96
96
  show: true,
97
97
  filter: true
98
98
  }
@@ -179,7 +179,7 @@ export const getBodyDataFunc = (
179
179
  col: 'col0',
180
180
  text: datastore.name,
181
181
  data: {
182
- iconClassName: [3, 5, 6].includes(datastore.state) ? 'vsphere-icon-datastore-error' : 'vsphere-icon-datastore',
182
+ iconClassName: `icon-${backupStorageIconByState[datastore.state]}`,
183
183
  id: datastore.id
184
184
  }
185
185
  },
@@ -61,7 +61,7 @@ const texts = computed<UI_I_TableTexts>(() => ({
61
61
  searchHere: localization.value.common.searchHere,
62
62
  rowsPerPage: localization.value.common.rowsPerPage,
63
63
  of: localization.value.common.of,
64
- selected: localization.value.common.selected,
64
+ selected: localization.value.common.selected2,
65
65
  columns: localization.value.common.columns,
66
66
  previous: localization.value.common.previous,
67
67
  next: localization.value.common.next,
@@ -19,7 +19,7 @@ export const getHeaderDataFunc = (
19
19
  text: localization.common.source,
20
20
  isSortable: true,
21
21
  sort: 'asc',
22
- width: '368px',
22
+ width: '352px',
23
23
  show: true,
24
24
  filter: true
25
25
  },
@@ -29,7 +29,7 @@ export const getHeaderDataFunc = (
29
29
  text: localization.common.deviceType,
30
30
  isSortable: true,
31
31
  sort: 'asc',
32
- width: '136px',
32
+ width: '160px',
33
33
  show: true,
34
34
  filter: true
35
35
  },
@@ -39,7 +39,7 @@ export const getHeaderDataFunc = (
39
39
  text: localization.common.bus,
40
40
  isSortable: true,
41
41
  sort: 'asc',
42
- width: '112px',
42
+ width: '136px',
43
43
  show: true,
44
44
  filter: true
45
45
  },
@@ -49,7 +49,7 @@ export const getHeaderDataFunc = (
49
49
  text: localization.common.target,
50
50
  isSortable: true,
51
51
  sort: 'asc',
52
- width: '112px',
52
+ width: '136px',
53
53
  show: true,
54
54
  filter: true
55
55
  },
@@ -59,7 +59,7 @@ export const getHeaderDataFunc = (
59
59
  text: localization.common.capacity,
60
60
  isSortable: true,
61
61
  sort: 'asc',
62
- width: '112px',
62
+ width: '136px',
63
63
  show: true,
64
64
  filter: true
65
65
  },
@@ -69,7 +69,7 @@ export const getHeaderDataFunc = (
69
69
  text: localization.common.used,
70
70
  isSortable: true,
71
71
  sort: 'asc',
72
- width: '112px',
72
+ width: '136px',
73
73
  show: true,
74
74
  filter: true
75
75
  },
@@ -79,7 +79,7 @@ export const getHeaderDataFunc = (
79
79
  text: localization.common.free,
80
80
  isSortable: true,
81
81
  sort: 'asc',
82
- width: '112px',
82
+ width: '136px',
83
83
  show: true,
84
84
  filter: true
85
85
  },
@@ -30,7 +30,7 @@
30
30
  v-model="model.description"
31
31
  :placeholder="localization.common.description"
32
32
  test-id="vm-backup-name-input"
33
- height="84"
33
+ height="92"
34
34
  />
35
35
  </div>
36
36
  </div>
@@ -18,12 +18,12 @@ export const readyToCompleteOptions = (
18
18
  // General
19
19
  {
20
20
  label: localization.common.name,
21
- value: backupForm.name,
21
+ value: backupForm.name || '--',
22
22
  iconClassName: 'icon-backup',
23
23
  },
24
24
  {
25
25
  label: localization.common.description,
26
- value: backupForm.description,
26
+ value: backupForm.description || '--',
27
27
  },
28
28
  ]
29
29
 
@@ -31,7 +31,7 @@ export const readyToCompleteOptions = (
31
31
  backupForm.disk_devices.forEach((disk_device, i) => {
32
32
  result.push({
33
33
  label: `${localization.common.disk} ${i + 1}`,
34
- value: disk_device.location,
34
+ value: disk_device.location || '--',
35
35
  iconClassName: 'icon-vSphere-dsVmDisk',
36
36
  })
37
37
  })
@@ -42,7 +42,7 @@ export const readyToCompleteOptions = (
42
42
  )
43
43
  result.push({
44
44
  label: localization.common.datastore,
45
- value: datastore?.name || '',
45
+ value: datastore?.name || '--',
46
46
  iconClassName: 'vsphere-icon-datastore',
47
47
  })
48
48
 
@@ -51,7 +51,7 @@ export const readyToCompleteOptions = (
51
51
  label: localization.common.strategy,
52
52
  value:
53
53
  strategyOptions.find((option) => option.value === backupForm.strategy)
54
- ?.label || '',
54
+ ?.label || '--',
55
55
  })
56
56
 
57
57
  const gbSizeByB = 1_073_741_824
@@ -62,7 +62,7 @@ export const stepsFunc = (
62
62
  stepName: '',
63
63
  title: localization.common.datastores,
64
64
 
65
- subTitle: localization.common.selectStorageConfigurationDiskFiles2,
65
+ subTitle: localization.common.selectBackupStorageConfigurationDiskFiles,
66
66
  status: UI_E_WIZARD_STATUS.INACTIVE,
67
67
  isValid: true,
68
68
  fields: {
@@ -2,12 +2,24 @@ import type { UI_I_Localization } from '~/lib/models/interfaces'
2
2
  import type { UI_I_SelectInputItem } from '~/components/common/select/input/lib/models/interfaces'
3
3
 
4
4
  export const strategyOptionsFunc = (
5
- localization: UI_I_Localization
5
+ localization: UI_I_Localization
6
6
  ): UI_I_SelectInputItem[] => {
7
- return [
7
+ const { $text } = useNuxtApp()
8
+ const isLangEn = useLocalStorage('lang') === 'en_US'
9
+
10
+ let labels = [
8
11
  { label: localization.common.fullBackup, value: 0 },
9
12
  { label: localization.common.incrementalBackup, value: 1 },
10
13
  { label: localization.common.differentialBackup, value: 2 },
11
14
  ]
15
+
16
+ if(isLangEn) {
17
+ labels = labels.map((item) => ({
18
+ ...item,
19
+ label: $text.toCapitalizeEveryWord(item.label)
20
+ }))
21
+ }
22
+
23
+ return labels
12
24
  }
13
25
 
@@ -1,8 +1,8 @@
1
- export interface UI_I_DynamicSteps {
2
- general: number
3
- disks: number
4
- datastores: number
5
- configuration: number
6
- readyComplete: number
7
- schedulingOptions: number
8
- }
1
+ export interface UI_I_DynamicSteps {
2
+ general: number
3
+ disks: number
4
+ datastores: number
5
+ configuration: number
6
+ readyComplete: number
7
+ schedulingOptions: number
8
+ }
@@ -20,7 +20,7 @@ export const checkName = async (
20
20
  if (!name) {
21
21
  stepHasError = wizard.setValidation(dynamicSteps.general, 'name', {
22
22
  fieldMessage: localization.common.fieldRequired,
23
- alertMessage: localization.common.fieldRequired
23
+ alertMessage: ''
24
24
  })
25
25
  wizard.setLoader(false)
26
26
  return {
@@ -53,7 +53,7 @@ export const checkName = async (
53
53
 
54
54
  if (stepErrorMessage) {
55
55
  stepHasError = wizard.setValidation(dynamicSteps.general, 'name', {
56
- fieldMessage: stepErrorMessage,
56
+ fieldMessage: ' ',
57
57
  alertMessage: stepErrorMessage
58
58
  })
59
59
  } else if (wizard.hasMessage(dynamicSteps.general, 'name')) {
@@ -82,8 +82,8 @@ export const checkDisks = (
82
82
 
83
83
  if (!isValidStores) {
84
84
  stepHasError = wizard.setValidation(dynamicSteps.disks, 'disk_devices', {
85
- fieldMessage: localization.common.diskIsRequired,
86
- alertMessage: localization.common.diskIsRequired
85
+ fieldMessage: localization.common.selectLeastOneDisk,
86
+ alertMessage: localization.common.selectLeastOneDisk
87
87
  })
88
88
  } else if (wizard.hasMessage(dynamicSteps.disks, 'disk_devices')) {
89
89
  value = wizard.removeValidation(dynamicSteps.disks, 'disk_devices', value)
@@ -106,8 +106,8 @@ export const checkDatastore = (
106
106
 
107
107
  if (!isValidStorage) {
108
108
  stepHasError = wizard.setValidation(dynamicSteps.datastores, 'backup_storage', {
109
- fieldMessage: localization.common.datastoreIsRequired,
110
- alertMessage: localization.common.datastoreIsRequired
109
+ fieldMessage: localization.common.selectBackupStorageToProceed,
110
+ alertMessage: localization.common.selectBackupStorageToProceed
111
111
  })
112
112
  } else if (wizard.hasMessage(dynamicSteps.datastores, 'backup_storage')) {
113
113
  value = wizard.removeValidation(dynamicSteps.datastores, 'backup_storage', value)
@@ -227,7 +227,6 @@
227
227
  </template>
228
228
 
229
229
  <script setup lang="ts">
230
- import { useTemplateRef } from 'vue'
231
230
  import { useElementSize } from '@vueuse/core'
232
231
  import type { UI_I_InfoBlock } from '~/node_modules/bfg-uikit/components/ui/infoBlock/models/interfaces'
233
232
  import type { UI_I_Localization } from '~/lib/models/interfaces'
@@ -269,14 +268,19 @@ const onSelectContextMenuItem = (actionType: UI_T_SnapshotActionType): void => {
269
268
  emits('show-modal', actionType)
270
269
  }
271
270
 
272
- const detailsElement = useTemplateRef<HTMLDivElement>('detailsScrollBlock')
273
- const { height } = useElementSize(detailsElement)
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
+ }
274
280
 
275
- const hasScroll = computed<boolean>(
276
- () =>
277
- height.value &&
278
- detailsElement.value?.scrollHeight > detailsElement.value?.clientHeight
279
- )
281
+ watch(height, () => {
282
+ checkScroll()
283
+ })
280
284
  </script>
281
285
 
282
286
  <style>
@@ -429,9 +433,6 @@ const hasScroll = computed<boolean>(
429
433
  line-height: 18px;
430
434
  text-align: right;
431
435
  }
432
- :deep(.ui-main-info-block-item) {
433
- grid-column-gap: 10px;
434
- }
435
436
  :deep(.ui-main-info-block-item-right) {
436
437
  white-space: unset !important;
437
438
  max-width: 50%;
@@ -19,7 +19,7 @@
19
19
  <ui-skeleton-item width="96" height="20" class="ml-auto" />
20
20
  </div>
21
21
  <div class="right-content grid p-4">
22
- <div class="flex justify-between gap-4 pr-4 flex-wrap top-container">
22
+ <div class="flex justify-between gap-4 flex-wrap top-container">
23
23
  <ui-skeleton-item width="80" height="20" />
24
24
  <div class="actions-block flex">
25
25
  <ui-skeleton-item width="20" height="20" />
@@ -29,13 +29,7 @@
29
29
  <ui-skeleton-item width="20" height="20" />
30
30
  </div>
31
31
  </div>
32
- <div
33
- ref="detailsScrollBlock"
34
- :class="[
35
- 'details-block flex flex-col my-6',
36
- { 'has-scroll': hasScroll },
37
- ]"
38
- >
32
+ <div class="details-block flex flex-col my-6">
39
33
  <div
40
34
  v-for="index in detailsItemsCount"
41
35
  :key="index"
@@ -51,19 +45,7 @@
51
45
  </template>
52
46
 
53
47
  <script setup lang="ts">
54
- import { useTemplateRef } from 'vue'
55
- import { useElementSize } from '@vueuse/core'
56
-
57
48
  const detailsItemsCount = ref<number>(6)
58
-
59
- const detailsElement = useTemplateRef<HTMLDivElement>('detailsScrollBlock')
60
- const { height } = useElementSize(detailsElement)
61
-
62
- const hasScroll = computed<boolean>(
63
- () =>
64
- height.value &&
65
- detailsElement.value?.scrollHeight > detailsElement.value?.clientHeight
66
- )
67
49
  </script>
68
50
 
69
51
  <style>
@@ -102,8 +84,6 @@ const hasScroll = computed<boolean>(
102
84
  }
103
85
  }
104
86
  .right-content {
105
- padding-right: 0;
106
-
107
87
  .top-container {
108
88
  .actions-block {
109
89
  grid-column-gap: 10px;
@@ -118,10 +98,6 @@ const hasScroll = computed<boolean>(
118
98
  grid-row-gap: 10px;
119
99
  overflow: auto;
120
100
 
121
- &:not(.has-scroll) {
122
- padding-right: 16px;
123
- }
124
-
125
101
  .details-block-item {
126
102
  background-color: var(--snapshots-right-skeleton-item-bg-color);
127
103
  border-radius: 6px;
@@ -251,12 +251,10 @@ const globalPermissions = computed<any>(
251
251
 
252
252
  // Step's content data (connectionType)
253
253
  const connectionType = ref<string>(
254
- globalPermissions.value === undefined
255
- ? '0'
256
- : !globalPermissions.value?.['Networks.CreateSysx'] &&
257
- !globalPermissions.value?.['Networks.CreatePortGroup']
254
+ !globalPermissions.value['Networks.CreateSysx'] &&
255
+ !globalPermissions.value['Networks.CreatePortGroup']
258
256
  ? '2'
259
- : !globalPermissions.value?.['Networks.CreateSysx']
257
+ : !globalPermissions.value['Networks.CreateSysx']
260
258
  ? '1'
261
259
  : '0'
262
260
  )
@@ -293,7 +291,7 @@ const onChangeAdapterStatus = (adapterStatusNew: UI_I_AdapterStatus): void => {
293
291
  // Step's content data and changers (targetDevice)
294
292
  const targetDevice = ref<UI_I_TargetDevice>(
295
293
  useDeepCopy(
296
- targetDeviceInitialFunc(globalPermissions.value?.['Networks.UpdateSwitch'])
294
+ targetDeviceInitialFunc(globalPermissions.value['Networks.UpdateSwitch'])
297
295
  )
298
296
  )
299
297
  const mtuFromSwitch = ref<number>(1500)
@@ -387,8 +385,7 @@ watch(
387
385
  : (targetDevice.value.selected = '0')
388
386
  newCT === '1' && (targetDevice.value.selected = '1')
389
387
  newCT === '2' &&
390
- (globalPermissions.value === undefined ||
391
- globalPermissions.value?.['Networks.UpdateSwitch']
388
+ (globalPermissions.value['Networks.UpdateSwitch']
392
389
  ? (targetDevice.value.selected = '2')
393
390
  : (targetDevice.value.selected = '3'))
394
391
  }
@@ -518,7 +515,7 @@ const reset = (): void => {
518
515
  wizard.reset()
519
516
  connectionTypeLocal.value = '0'
520
517
  targetDevice.value = useDeepCopy(
521
- targetDeviceInitialFunc(globalPermissions.value?.['Networks.UpdateSwitch'])
518
+ targetDeviceInitialFunc(globalPermissions.value['Networks.UpdateSwitch'])
522
519
  )
523
520
  connectionSettings.value = useDeepCopy(connectionSettingsInitial)
524
521
  portProperties.value = useDeepCopy(portPropertiesInitial)
@@ -25,8 +25,7 @@ export const servicesInitial: UI_I_Services = {
25
25
  export const targetDeviceInitialFunc = (
26
26
  updateSwitchPermission: boolean
27
27
  ): UI_I_TargetDevice => ({
28
- selected:
29
- updateSwitchPermission === undefined || updateSwitchPermission ? '1' : '3',
28
+ selected: updateSwitchPermission ? '1' : '3',
30
29
  network: '',
31
30
  switch: '',
32
31
  standardSwitch: '',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.5.757",
4
+ "version": "1.5.759",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",
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
+ })