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,14 +1,12 @@
1
1
  <template>
2
- <common-pages-backups-backups-new-skeleton v-if="props.backupsLoading" />
3
2
  <div
4
- v-else
5
3
  :class="[
6
4
  'backups-page grid h-inherit p-4 overflow-hidden ',
7
5
  { 'selected gap-3': props.detailData },
8
6
  ]"
9
7
  >
10
- <div class="left-content overflow-auto grid p-4">
11
- <div class="flex justify-between gap-4 flex-wrap">
8
+ <div class="left-content grid p-4">
9
+ <div class="flex justify-between">
12
10
  <h3 class="title-block font-[500] text-[16px]">
13
11
  {{ localization.inventoryTabs.backups }} ({{
14
12
  props.backupsTree.length
@@ -19,11 +17,10 @@
19
17
  v-permission="props.createBackupPermission"
20
18
  test-id="take-backup-btn"
21
19
  size="md"
22
- class="create-backup-button"
23
20
  @click="emits('set-action', 'createBackup')"
24
21
  >
25
- <ui-icon name="plus" width="20" height="20" class="mr-2 icon" />
26
- {{ localization.common.createBackup }}
22
+ <ui-icon name="plus" width="20" height="20" class="mr-2" />
23
+ {{ localization.common.createBackup }}...
27
24
  </ui-button>
28
25
  </div>
29
26
  <div
@@ -31,17 +28,16 @@
31
28
  class="backups-tree-content overflow-y-auto my-4 px-2 pb-2"
32
29
  >
33
30
  <ui-tree
31
+ :is-loading="props.backupsLoading"
34
32
  :nodes="props.backupsTree"
35
33
  @select-node="emits('select-node', $event)"
36
34
  @toggle-node="emits('show-nodes', $event.id)"
37
35
  @show-context-menu="showContextMenu"
38
36
  >
39
37
  <template #content="{ node }">
40
- <div class="flex-align-center gap-2">
38
+ <div class="flex-align-center">
41
39
  <span :class="['node-icon', node.iconClassName]"></span>
42
- <span class="node-name text-ellipsis text-3">{{
43
- node.name
44
- }}</span>
40
+ <span class="node-name text-ellipsis">{{ node.name }}</span>
45
41
  </div>
46
42
  </template>
47
43
  </ui-tree>
@@ -56,7 +52,7 @@
56
52
  <p class="title-block font-[400] text-[16px] mt-2">
57
53
  {{ localization.common.noBackupsAvailable }}
58
54
  </p>
59
- <p class="description-block mt-[6px] text-[13px] text-center">
55
+ <p class="description-block mt-[6px] text-[13px]">
60
56
  {{ localization.common.noBackupsAvailableDesc }}
61
57
  </p>
62
58
  </div>
@@ -82,7 +78,7 @@
82
78
  v-if="props.detailData"
83
79
  class="backups-details overflow-hidden flex-direction-column p-4"
84
80
  >
85
- <div class="flex justify-between mb-6 gap-4 pr-4 flex-wrap">
81
+ <div class="flex justify-between mb-6">
86
82
  <h3 class="title-block font-[500] text-[16px]">
87
83
  {{ localization.common.backupDetails }}
88
84
  </h3>
@@ -146,13 +142,7 @@
146
142
  </ui-tooltip>
147
143
  </div>
148
144
  </div>
149
- <div
150
- ref="detailsScrollBlock"
151
- :class="[
152
- 'grid row-gap-3 pr-4 overflow-y-auto details-scroll-block',
153
- { 'has-scroll': hasScroll },
154
- ]"
155
- >
145
+ <div class="grid row-gap-3 overflow-y-auto">
156
146
  <ui-info-block
157
147
  v-for="(item, index) in currentDetailsData"
158
148
  :key="index"
@@ -163,12 +153,9 @@
163
153
  <ui-icon
164
154
  v-if="item.labelIcon"
165
155
  :name="item.labelIcon"
166
- :class="[
167
- 'info-label-icon mr-[10px]',
168
- `icon-name-${item.labelIcon}`,
169
- ]"
170
156
  width="20"
171
157
  height="20"
158
+ class="info-label-icon mr-[10px]"
172
159
  />
173
160
  <span class="info-label">{{ item.label }}</span>
174
161
  </div>
@@ -196,8 +183,6 @@
196
183
  </template>
197
184
 
198
185
  <script setup lang="ts">
199
- import { useTemplateRef } from 'vue'
200
- import { useElementSize } from '@vueuse/core'
201
186
  import type { UI_I_InfoBlock } from '~/node_modules/bfg-uikit/components/ui/infoBlock/models/interfaces'
202
187
  import type { UI_I_Localization } from '~/lib/models/interfaces'
203
188
  import type { UI_I_BackupsTreeNode } from '~/components/common/pages/backups/lib/models/interfaces'
@@ -236,15 +221,6 @@ const onSelectContextMenuItem = (actionType: UI_T_BackupActionType): void => {
236
221
  const currentDetailsData = computed<UI_I_InfoBlock[]>(() =>
237
222
  constructDetails(localization.value, props.detailData)
238
223
  )
239
-
240
- const detailsElement = useTemplateRef<HTMLDivElement>('detailsScrollBlock')
241
- const { height } = useElementSize(detailsElement)
242
-
243
- const hasScroll = computed<boolean>(
244
- () =>
245
- height.value &&
246
- detailsElement.value?.scrollHeight > detailsElement.value?.clientHeight
247
- )
248
224
  </script>
249
225
 
250
226
  <style>
@@ -252,9 +228,7 @@ const hasScroll = computed<boolean>(
252
228
  --backups-page-inner-block-bg: #ffffff;
253
229
  --backups-page-title-color: #4d5d69;
254
230
  --backups-page-tree-border-color: #e9ebed;
255
- --backups-page-tree-block-bg-color: #ffffff;
256
231
  --backups-page-details-action-color: #4d5d69;
257
- --backups-page-details-action-line-color: #e9ebeda3;
258
232
  --backups-page-details-action-hover-color: #213444;
259
233
  --backups-page-info-block-label-color: #4d5d69;
260
234
  --backups-page-info-block-value-color: #182531;
@@ -263,9 +237,7 @@ const hasScroll = computed<boolean>(
263
237
  --backups-page-inner-block-bg: #334453;
264
238
  --backups-page-title-color: #e9eaec;
265
239
  --backups-page-tree-border-color: #e9ebed1f;
266
- --backups-page-tree-block-bg-color: #1b2a371f;
267
240
  --backups-page-details-action-color: #e9eaec;
268
- --backups-page-details-action-line-color: #e9ebed1f;
269
241
  --backups-page-details-action-hover-color: #ffffff;
270
242
  --backups-page-info-block-label-color: #e9eaec;
271
243
  --backups-page-info-block-value-color: #e9eaec;
@@ -281,13 +253,6 @@ const hasScroll = computed<boolean>(
281
253
  .title-block {
282
254
  color: var(--backups-page-title-color);
283
255
  }
284
- .create-backup-button {
285
- white-space: nowrap;
286
-
287
- .icon {
288
- min-width: 20px;
289
- }
290
- }
291
256
 
292
257
  .left-content {
293
258
  background-color: var(--backups-page-inner-block-bg);
@@ -298,24 +263,15 @@ const hasScroll = computed<boolean>(
298
263
  .backups-tree-content {
299
264
  border: 1px solid var(--backups-page-tree-border-color);
300
265
  border-radius: 8px;
301
- background-color: var(--backups-page-tree-block-bg-color);
302
266
 
303
- :deep(.tree-container) {
304
- width: max-content;
305
- min-width: 100%;
267
+ :deep(.tree-content) {
268
+ padding-right: 8px;
306
269
 
307
- .tree-content {
308
- //padding-right: 8px;
270
+ .node-wrapper {
271
+ border-radius: 4px;
309
272
 
310
- .node-wrapper {
311
- border-radius: 4px;
312
-
313
- .toggle-button-empty {
314
- display: none;
315
- }
316
- .node-element {
317
- line-height: 20px;
318
- }
273
+ .node-element {
274
+ line-height: 20px;
319
275
  }
320
276
  }
321
277
  }
@@ -327,10 +283,6 @@ const hasScroll = computed<boolean>(
327
283
  }
328
284
  }
329
285
  .delete-all {
330
- &.disabled {
331
- color: #bdc3c7;
332
- }
333
-
334
286
  &:not(.disabled) {
335
287
  color: #ea3223;
336
288
  }
@@ -340,18 +292,12 @@ const hasScroll = computed<boolean>(
340
292
  background-color: var(--backups-page-inner-block-bg);
341
293
  box-shadow: 0 1px 4px 0 #00000014;
342
294
  border-radius: 8px;
343
- padding-right: 0;
344
295
 
345
296
  .details-actions-block {
346
297
  .border-line {
347
298
  width: 1px;
348
299
  height: 20px;
349
- background-color: var(--backups-page-details-action-line-color);
350
- }
351
- .restore-backups-btn {
352
- :deep(path) {
353
- stroke-width: 1.7;
354
- }
300
+ background-color: #e9ebeda3;
355
301
  }
356
302
  .restore-backups-btn,
357
303
  .edit-backups-btn {
@@ -365,38 +311,18 @@ const hasScroll = computed<boolean>(
365
311
  color: #ea3223;
366
312
  }
367
313
  }
368
- .details-scroll-block {
369
- padding-right: 0;
370
-
371
- &:not(.has-scroll) {
372
- padding-right: 16px;
373
- }
374
- }
375
314
  .info-block-label-content {
376
315
  .info-label-icon {
377
316
  color: #9da6ad;
378
317
  min-width: 20px;
379
-
380
- &.icon-name-vsphere-icon-storage-system-refresh {
381
- :deep(path) {
382
- stroke-width: 1.4;
383
- }
384
- }
385
318
  }
386
319
  .info-label {
387
- margin-top: 1px;
388
- line-height: 18px;
320
+ margin-top: 2.5px;
389
321
  color: var(--backups-page-info-block-label-color);
390
322
  }
391
323
  }
392
324
  .empty-description {
393
325
  color: #9da6ad;
394
- margin-top: 1px;
395
- line-height: 18px;
396
- text-align: right;
397
- }
398
- :deep(.ui-main-info-block-item) {
399
- grid-column-gap: 10px;
400
326
  }
401
327
  :deep(.ui-main-info-block-item-right) {
402
328
  white-space: unset !important;
@@ -407,25 +333,12 @@ const hasScroll = computed<boolean>(
407
333
  }
408
334
  :deep(.ui-main-info-block-item-right-value) {
409
335
  color: var(--backups-page-info-block-value-color);
410
- font-size: 13px;
411
- font-weight: 400;
412
- line-height: 18px;
413
- margin-top: 1px;
414
336
  }
415
337
  :deep(.ui-main-info-block-item-right-open) {
416
338
  display: none;
417
339
  }
418
340
  }
419
341
  }
420
- :root.dark-theme {
421
- .left-content {
422
- .delete-all {
423
- &.disabled {
424
- opacity: 0.44;
425
- }
426
- }
427
- }
428
- }
429
342
 
430
343
  @media (max-width: 1200px) {
431
344
  .backups-page {
@@ -433,7 +346,6 @@ const hasScroll = computed<boolean>(
433
346
 
434
347
  &.selected {
435
348
  grid-template-columns: 1fr;
436
- grid-template-rows: minmax(189px, 1fr) 1fr;
437
349
  }
438
350
 
439
351
  .backups-details {
@@ -80,26 +80,20 @@ const onSelectContextMenuItem = (item: UI_I_ContextMenuItem): void => {
80
80
 
81
81
  <style scoped lang="scss">
82
82
  .backups-context-menu-view {
83
- :deep(.context-wrap) {
84
- min-width: 112px;
83
+ :deep(.menu-item) {
84
+ .context-icon {
85
+ display: none;
86
+ }
85
87
 
86
- .menu-item {
87
- .context-icon {
88
- display: none;
89
- }
88
+ .item-ui-icon {
89
+ margin-right: 8px;
90
+ }
90
91
 
91
- .item-ui-icon {
92
- margin-right: 8px;
93
- width: 16px;
94
- height: 16px;
95
- }
92
+ &:last-child {
93
+ color: #ea3223;
96
94
 
97
- &:last-child {
95
+ .context-link:hover {
98
96
  color: #ea3223;
99
-
100
- .context-link:hover {
101
- color: #ea3223;
102
- }
103
97
  }
104
98
  }
105
99
  }
@@ -24,7 +24,7 @@
24
24
  test-id="add-vm-backup-general-error-alert"
25
25
  type="error"
26
26
  size="md"
27
- class="mb-3"
27
+ class="mb-4"
28
28
  />
29
29
 
30
30
  <div class="subtitle-block flex-row items-start">
@@ -38,6 +38,7 @@
38
38
  v-model="model"
39
39
  :show="selectedStep.id === dynamicSteps.general"
40
40
  :messages-fields="selectedStep.fields"
41
+ :alert-messages="[]"
41
42
  />
42
43
  </div>
43
44
  </template>
@@ -55,7 +56,7 @@
55
56
  test-id="add-vm-backup-disks-error-alert"
56
57
  type="error"
57
58
  size="md"
58
- class="mb-3"
59
+ class="mb-4"
59
60
  />
60
61
 
61
62
  <div class="subtitle-block flex-row w-full items-start">
@@ -69,6 +70,7 @@
69
70
  v-model="model"
70
71
  :disks="props.disks"
71
72
  :disks-loading="props.disksLoading"
73
+ :alert-messages="[]"
72
74
  />
73
75
  </div>
74
76
  </template>
@@ -86,7 +88,7 @@
86
88
  test-id="add-vm-backup-datastores-error-alert"
87
89
  type="error"
88
90
  size="md"
89
- class="mb-3"
91
+ class="mb-4"
90
92
  />
91
93
 
92
94
  <div class="subtitle-block flex-row w-full items-start">
@@ -118,7 +120,7 @@
118
120
  test-id="add-vm-backup-configuration-error-alert"
119
121
  type="error"
120
122
  size="md"
121
- class="mb-3"
123
+ class="mb-4"
122
124
  />
123
125
 
124
126
  <div class="subtitle-block flex-row items-start">
@@ -148,7 +150,7 @@
148
150
  </div>
149
151
  </template>
150
152
  <template #content>
151
- <div class="mt-4">
153
+ <div class="my-4">
152
154
  <div class="ready-to-complete">
153
155
  <common-ready-to-complete :data="props.readyToCompleteData" />
154
156
  </div>
@@ -263,11 +265,22 @@ const onCreateDatastore = (): void => emits('submit')
263
265
  grid-template-columns: auto 1fr;
264
266
  align-items: flex-start;
265
267
  }
266
- :deep(.details-list):nth-child(1) {
267
- .details-item-value {
268
- white-space: break-spaces;
269
- overflow: auto;
268
+ :deep(.details-list) {
269
+ grid-template-columns: minmax(100px, max-content) minmax(150px, 100%);
270
+
271
+ .details-item-label, .details-item-value {
272
+ display: -webkit-box;
273
+ -webkit-line-clamp: 2;
274
+ -webkit-box-orient: vertical;
275
+ overflow: hidden;
276
+ white-space: normal;
277
+ overflow-wrap: anywhere;
270
278
  }
271
279
  }
272
280
  }
281
+
282
+ :deep(.ui-wizard-content-with-subtitle) {
283
+ scrollbar-gutter: stable;
284
+ padding-right: 16px;
285
+ }
273
286
  </style>
@@ -31,6 +31,7 @@
31
31
  <ui-input
32
32
  v-model="maxBindwidthLocal"
33
33
  :error="props.messagesFields.bandWidth.field"
34
+ type="number"
34
35
  test-id="vm-backup-max-bandwidth-input"
35
36
  class="max-bandwidth-input"
36
37
  />
@@ -114,7 +115,8 @@ const maxBindwidthLocal = computed<number>({
114
115
  &-row {
115
116
  min-height: 36px;
116
117
  width: 100%;
117
- display: flex;
118
+ display: grid;
119
+ grid-template-columns: minmax(150px, 250px) minmax(150px, 100%);
118
120
  column-gap: 16px;
119
121
  align-items: center;
120
122
 
@@ -171,9 +173,10 @@ const maxBindwidthLocal = computed<number>({
171
173
  width: fit-content;
172
174
  }
173
175
 
174
- .strategy-select.capitalize, :deep(.ui-select-toggle-button) {
175
- text-transform: capitalize;
176
+ .strategy-select :deep(.ui-popup-window) {
177
+ min-width: max-content !important;
176
178
  }
179
+
177
180
  &-max-band {
178
181
  display: flex;
179
182
  gap: 12px;
@@ -181,6 +184,17 @@ const maxBindwidthLocal = computed<number>({
181
184
  .max-bandwidth-input {
182
185
  max-width: 276px;
183
186
  width: 100%;
187
+
188
+ :deep(input.ui-main-input[type="number"]) {
189
+ appearance: textfield;
190
+ -moz-appearance: textfield;
191
+ }
192
+
193
+ :deep(input.ui-main-input[type="number"]::-webkit-outer-spin-button),
194
+ :deep(input.ui-main-input[type="number"]::-webkit-inner-spin-button) {
195
+ -webkit-appearance: none;
196
+ margin: 0;
197
+ }
184
198
  }
185
199
 
186
200
  .max-bandwidth-select {
@@ -1,29 +1,29 @@
1
- <template>
2
- <atoms-stack-block
3
- :has-children="false"
4
- test-id="backup-window-stack-block"
5
- >
6
- <template #stackBlockKey>
7
- <span>{{ localization.common.backupWindow }}</span>
8
- </template>
9
- <template #stackBlockContent>
10
- <input
11
- v-model="model.start_window_min"
12
- data-id="hours-input"
13
- type="number"
14
- class="hrs"
15
- />
16
- </template>
17
- </atoms-stack-block>
18
- </template>
19
-
20
- <script lang="ts" setup>
21
- import type { UI_I_Localization } from '~/lib/models/interfaces'
22
- import type { UI_I_CreateBackupForm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
23
-
24
- const model = defineModel<UI_I_CreateBackupForm>({ required: true })
25
-
26
- const localization = computed<UI_I_Localization>(() => useLocal())
27
- </script>
28
-
29
- <style lang="scss" scoped></style>
1
+ <template>
2
+ <atoms-stack-block
3
+ :has-children="false"
4
+ test-id="backup-window-stack-block"
5
+ >
6
+ <template #stackBlockKey>
7
+ <span>{{ localization.common.backupWindow }}</span>
8
+ </template>
9
+ <template #stackBlockContent>
10
+ <input
11
+ v-model="model.start_window_min"
12
+ data-id="hours-input"
13
+ type="number"
14
+ class="hrs"
15
+ />
16
+ </template>
17
+ </atoms-stack-block>
18
+ </template>
19
+
20
+ <script lang="ts" setup>
21
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
22
+ import type { UI_I_CreateBackupForm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
23
+
24
+ const model = defineModel<UI_I_CreateBackupForm>({ required: true })
25
+
26
+ const localization = computed<UI_I_Localization>(() => useLocal())
27
+ </script>
28
+
29
+ <style lang="scss" scoped></style>
@@ -1,69 +1,69 @@
1
- <template>
2
- <atoms-stack-block
3
- :has-children="false"
4
- test-id="backup-max-bandwidth-stack-block"
5
- >
6
- <template #stackBlockKey>
7
- <span>{{ localization.common.maxBandwidth }}</span>
8
- </template>
9
- <template #stackBlockContent>
10
- <div class="flex-align-center">
11
- <input
12
- v-model="maxBindwidthLocal"
13
- data-id="mbps-input"
14
- type="number"
15
- class="mbps"
16
- />
17
-
18
- <common-select-input
19
- v-model="selectedType"
20
- :data="maxBandwidthOptionsLocal"
21
- test-id="backup-max-bandwidth-type"
22
- class="ml-1"
23
- />
24
- </div>
25
- </template>
26
- </atoms-stack-block>
27
- </template>
28
-
29
- <script lang="ts" setup>
30
- import type { UI_I_Localization } from '~/lib/models/interfaces'
31
- import type { UI_I_CreateBackupForm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
32
- import type { UI_T_BandwidthOption } from '~/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/lib/models/types'
33
- import type { UI_I_SelectInputItem } from '~/components/common/select/input/lib/models/interfaces'
34
- import { maxBandwidthOptions } from '~/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/lib/config/options'
35
-
36
- const model = defineModel<UI_I_CreateBackupForm>({ required: true })
37
-
38
- const localization = computed<UI_I_Localization>(() => useLocal())
39
- const { $binary }: any = useNuxtApp()
40
-
41
- const maxBandwidthOptionsLocal =
42
- ref<UI_I_SelectInputItem[]>(maxBandwidthOptions)
43
-
44
- const maxBindwidthLocal = computed<number>({
45
- get() {
46
- return selectedType.value === 1
47
- ? $binary.bToGb(model.value.bandwidth_limit)
48
- : $binary.bToMb(model.value.bandwidth_limit)
49
- },
50
- set(newValue: number) {
51
- model.value.bandwidth_limit =
52
- selectedType.value === 1
53
- ? $binary.gbToB(newValue)
54
- : $binary.mbToB(newValue)
55
- },
56
- })
57
-
58
- const selectedType = ref<UI_T_BandwidthOption>(0)
59
- watch(selectedType, (newValue) => {
60
- if (newValue === 1) model.value.bandwidth_limit *= 1_024
61
- else model.value.bandwidth_limit /= 1_024
62
- })
63
- </script>
64
-
65
- <style lang="scss" scoped>
66
- #backup-transaction-logs {
67
- margin: 4px 4px 0 0;
68
- }
69
- </style>
1
+ <template>
2
+ <atoms-stack-block
3
+ :has-children="false"
4
+ test-id="backup-max-bandwidth-stack-block"
5
+ >
6
+ <template #stackBlockKey>
7
+ <span>{{ localization.common.maxBandwidth }}</span>
8
+ </template>
9
+ <template #stackBlockContent>
10
+ <div class="flex-align-center">
11
+ <input
12
+ v-model="maxBindwidthLocal"
13
+ data-id="mbps-input"
14
+ type="number"
15
+ class="mbps"
16
+ />
17
+
18
+ <common-select-input
19
+ v-model="selectedType"
20
+ :data="maxBandwidthOptionsLocal"
21
+ test-id="backup-max-bandwidth-type"
22
+ class="ml-1"
23
+ />
24
+ </div>
25
+ </template>
26
+ </atoms-stack-block>
27
+ </template>
28
+
29
+ <script lang="ts" setup>
30
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
31
+ import type { UI_I_CreateBackupForm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
32
+ import type { UI_T_BandwidthOption } from '~/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/lib/models/types'
33
+ import type { UI_I_SelectInputItem } from '~/components/common/select/input/lib/models/interfaces'
34
+ import { maxBandwidthOptions } from '~/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/lib/config/options'
35
+
36
+ const model = defineModel<UI_I_CreateBackupForm>({ required: true })
37
+
38
+ const localization = computed<UI_I_Localization>(() => useLocal())
39
+ const { $binary }: any = useNuxtApp()
40
+
41
+ const maxBandwidthOptionsLocal =
42
+ ref<UI_I_SelectInputItem[]>(maxBandwidthOptions)
43
+
44
+ const maxBindwidthLocal = computed<number>({
45
+ get() {
46
+ return selectedType.value === 1
47
+ ? $binary.bToGb(model.value.bandwidth_limit)
48
+ : $binary.bToMb(model.value.bandwidth_limit)
49
+ },
50
+ set(newValue: number) {
51
+ model.value.bandwidth_limit =
52
+ selectedType.value === 1
53
+ ? $binary.gbToB(newValue)
54
+ : $binary.mbToB(newValue)
55
+ },
56
+ })
57
+
58
+ const selectedType = ref<UI_T_BandwidthOption>(0)
59
+ watch(selectedType, (newValue) => {
60
+ if (newValue === 1) model.value.bandwidth_limit *= 1_024
61
+ else model.value.bandwidth_limit /= 1_024
62
+ })
63
+ </script>
64
+
65
+ <style lang="scss" scoped>
66
+ #backup-transaction-logs {
67
+ margin: 4px 4px 0 0;
68
+ }
69
+ </style>
@@ -1,6 +1,6 @@
1
- import type {UI_I_SelectInputItem} from "~/components/common/select/input/lib/models/interfaces";
2
-
3
- export const maxBandwidthOptions: UI_I_SelectInputItem[] = [
4
- { label: 'Mbps', value: 0 },
5
- { label: 'Gbps', value: 1 },
6
- ]
1
+ import type {UI_I_SelectInputItem} from "~/components/common/select/input/lib/models/interfaces";
2
+
3
+ export const maxBandwidthOptions: UI_I_SelectInputItem[] = [
4
+ { label: 'Mbps', value: 0 },
5
+ { label: 'Gbps', value: 1 },
6
+ ]