bfg-common 1.5.739 → 1.5.741

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 (98) hide show
  1. package/CODE_STYLE.md +109 -109
  2. package/assets/img/icons/icons-sprite-dark-3.svg +227 -227
  3. package/assets/img/icons/icons-sprite-dark-5.svg +488 -488
  4. package/assets/img/icons/icons-sprite-light-3.svg +227 -227
  5. package/assets/img/icons/icons-sprite-light-5.svg +488 -488
  6. package/components/atoms/TheIcon3.vue +50 -50
  7. package/components/atoms/collapse/CollapseNav.vue +170 -170
  8. package/components/atoms/perPage/PerPage.vue +58 -58
  9. package/components/atoms/table/dataGrid/DataGrid.vue +1718 -1718
  10. package/components/atoms/table/dataGrid/DataGridPagination.vue +97 -97
  11. package/components/atoms/table/dataGrid/lib/config/settingsTable.ts +94 -94
  12. package/components/atoms/table/dataGrid/lib/utils/export.ts +16 -16
  13. package/components/common/backup/storage/actions/add/lib/utils.ts +51 -51
  14. package/components/common/browse/blocks/contents/filesNew/Skeleton.vue +18 -18
  15. package/components/common/diagramMain/modals/lib/config/vCenterModal.ts +48 -48
  16. package/components/common/diagramMain/port/Port.vue +580 -580
  17. package/components/common/layout/console/Console.vue +70 -70
  18. package/components/common/layout/theHeader/userMenu/modals/preferences/lib/models/types.ts +7 -7
  19. package/components/common/pages/backups/DetailView.vue +52 -52
  20. package/components/common/pages/backups/lib/models/interfaces.ts +36 -36
  21. package/components/common/pages/backups/modals/Modals.vue +243 -243
  22. package/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/lib/config/options.ts +6 -6
  23. package/components/common/pages/backups/modals/createBackup/lib/config/readyToCompleteOptions.ts +69 -69
  24. package/components/common/pages/backups/modals/lib/config/restore.ts +116 -116
  25. package/components/common/pages/backups/modals/lib/models/interfaces.ts +187 -187
  26. package/components/common/pages/backups/modals/restore/Restore.vue +302 -302
  27. package/components/common/pages/backups/modals/restore/disks/Disks.vue +50 -50
  28. package/components/common/pages/backups/modals/restore/lib/config/readyToCompleteOptions.ts +94 -94
  29. package/components/common/pages/backups/modals/restore/lib/config/steps.ts +130 -130
  30. package/components/common/pages/backups/modals/restore/name/lib/models/interfaces.ts +6 -6
  31. package/components/common/pages/backups/modals/restore/types/New.vue +95 -95
  32. package/components/common/pages/backups/modals/restore/types/Old.vue +62 -62
  33. package/components/common/pages/backups/modals/restore/types/Types.vue +31 -31
  34. package/components/common/pages/home/lib/models/interfaces.ts +48 -48
  35. package/components/common/pages/home/widgets/hosts/Hosts.vue +27 -27
  36. package/components/common/pages/home/widgets/hosts/lib/config/items.ts +23 -23
  37. package/components/common/pages/home/widgets/vms/VmsOld.vue +35 -35
  38. package/components/common/pages/home/widgets/vms/lib/config/items.ts +19 -19
  39. package/components/common/pages/scheduledTasks/lib/utils/utils.ts +84 -84
  40. package/components/common/pages/tasks/Tasks.vue +125 -125
  41. package/components/common/pages/tasks/table/Table.vue +373 -373
  42. package/components/common/pages/tasks/table/lib/config/config.ts +279 -279
  43. package/components/common/pages/tasks/table/lib/models/interfaces.ts +9 -9
  44. package/components/common/readyToComplete/ReadyToComplete.vue +17 -17
  45. package/components/common/select/radio/RadioGroup.vue +137 -137
  46. package/components/common/spiceConsole/Drawer.vue +420 -420
  47. package/components/common/spiceConsole/SpiceConsole.vue +184 -184
  48. package/components/common/spiceConsole/lib/models/interfaces.ts +5 -5
  49. package/components/common/tools/Actions.vue +207 -207
  50. package/components/common/treeView/TreeView.vue +52 -52
  51. package/components/common/vm/actions/clone/lib/config/steps.ts +295 -295
  52. package/components/common/vm/actions/clone/new/New.vue +438 -438
  53. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/shares/lib/config/options.ts +28 -28
  54. package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/Memory.vue +283 -283
  55. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Order.vue +156 -156
  56. package/components/common/vm/actions/common/select/compatibility/Old.vue +107 -107
  57. package/components/common/vm/actions/common/select/createType/lib/models/interfaces.ts +5 -5
  58. package/components/common/vm/actions/common/select/options/New.vue +264 -264
  59. package/components/common/vm/actions/common/select/options/Options.vue +58 -58
  60. package/components/common/vm/actions/common/select/storage/Old.vue +125 -125
  61. package/components/common/vm/actions/common/select/storage/new/New.vue +311 -311
  62. package/components/common/vm/actions/common/select/storage/new/lib/models/interfaces.ts +5 -5
  63. package/components/common/vm/actions/common/select/storage/new/lib/utils/utils.ts +21 -21
  64. package/components/common/vm/actions/common/select/template/old/Old.vue +50 -50
  65. package/components/common/vm/actions/editSettings/new/Skeleton.vue +88 -88
  66. package/components/common/wizards/common/compatibility/Compatibility.vue +35 -35
  67. package/components/common/wizards/common/steps/computeResource/New.vue +93 -93
  68. package/components/common/wizards/common/steps/name/Name.vue +178 -178
  69. package/components/common/wizards/common/steps/name/New.vue +221 -221
  70. package/components/common/wizards/common/steps/name/Old.vue +121 -121
  71. package/components/common/wizards/common/steps/name/lib/models/interfaces.ts +4 -4
  72. package/components/common/wizards/common/steps/name/location/New.vue +40 -40
  73. package/components/common/wizards/datastore/add/Add.vue +227 -227
  74. package/components/common/wizards/datastore/add/lib/utils.ts +85 -85
  75. package/components/common/wizards/datastore/add/steps/typeMode/lib/config/typeOptions.ts +43 -43
  76. package/composables/useAppVersion.ts +21 -21
  77. package/composables/useBrowse.ts +24 -24
  78. package/composables/useLocal.ts +6 -6
  79. package/composables/useLocalCommon.ts +39 -39
  80. package/lib/models/types.ts +59 -59
  81. package/package.json +1 -1
  82. package/plugins/console.ts +21 -21
  83. package/plugins/mouse.ts +21 -21
  84. package/plugins/panelStates.ts +70 -70
  85. package/plugins/text.ts +59 -59
  86. package/public/spice-console/application/clientgui.js +854 -854
  87. package/public/spice-console/application/packetfactory.js +211 -211
  88. package/public/spice-console/application/virtualmouse.js +147 -147
  89. package/public/spice-console/lib/images/bitmap.js +203 -203
  90. package/public/spice-console/network/spicechannel.js +440 -440
  91. package/public/spice-console/process/cursorprocess.js +128 -128
  92. package/public/spice-console/process/inputprocess.js +227 -227
  93. package/public/spice-console/process/mainprocess.js +212 -212
  94. package/public/spice-console/run.js +210 -210
  95. package/store/main/mutations.ts +7 -7
  96. package/store/main/state.ts +7 -7
  97. package/store/tasks/mappers/recentTasks.ts +123 -123
  98. package/store/tasks/mutations.ts +82 -82
@@ -1,302 +1,302 @@
1
- <template>
2
- <component
3
- :is="currentComponent"
4
- v-model="model"
5
- v-model:is-show-confirm="isShowConfirm"
6
- :wizard="wizard"
7
- :selected-scheme="selectedScheme"
8
- :alert-messages="alertMessages"
9
- :storage-submit="storageSubmit"
10
- :datastore="props.datastore"
11
- :datastore-loading="props.datastoreLoading"
12
- :networks="props.networks"
13
- :ready-complete-data="readyToCompleteInfo"
14
- :selected-storage="selectedStorage"
15
- :is-loading="isLoading"
16
- :errors="errors"
17
- @change-storage="onChangeStorage"
18
- @get-datastore="getDatastoreTableFunc"
19
- @get-networks="onGetNetworks"
20
- @change-steps="onChangeSteps"
21
- @submit-confirm="onFinish"
22
- @hide="onHideModal"
23
- @submit-wizard="onSubmitWizard"
24
- @remove-validation-errors="onRemoveValidationErrors"
25
- />
26
- </template>
27
-
28
- <script setup lang="ts">
29
- import type {
30
- UI_I_WizardStep,
31
- UI_I_ValidationReturn,
32
- } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
33
- import Wizard from '~/node_modules/bfg-uikit/components/ui/wizard/lib/utils/utils'
34
- import type { UI_I_Localization } from '~/lib/models/interfaces'
35
- import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
36
- import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
37
- import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
38
- import type { UI_I_NameCheck } from '~/components/common/pages/backups/modals/restore/name/lib/models/interfaces'
39
- import type { UI_I_RestoreForm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
40
- import {
41
- stepsSchemeInitial,
42
- stepsFunc,
43
- dynamicSteps,
44
- } from '~/components/common/pages/backups/modals/restore/lib/config/steps'
45
- import { restoreCodes } from '~/components/common/pages/backups/modals/restore/lib/config/restoreCodes'
46
- import { readyToCompleteOptions } from '~/components/common/pages/backups/modals/restore/lib/config/readyToCompleteOptions'
47
- import {
48
- checkDisksValidation,
49
- checkNameValidation,
50
- } from '~/components/common/pages/backups/modals/restore/validation/validation'
51
-
52
- const model = defineModel<UI_I_RestoreForm>({ required: true })
53
-
54
- const props = defineProps<{
55
- datastore: UI_I_DatastoreTableItem[]
56
- datastoreLoading: boolean
57
- networks: UI_I_NetworkTableItem[]
58
- }>()
59
- const emits = defineEmits<{
60
- (event: 'get-datastore', value: string): void
61
- (event: 'get-networks', value: string): void
62
- (event: 'check-name', value: UI_I_NameCheck): void
63
- (event: 'finish'): void
64
- (event: 'hide'): void
65
- }>()
66
-
67
- const { $store }: any = useNuxtApp()
68
-
69
- const localization = computed<UI_I_Localization>(() => useLocal())
70
-
71
- const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
72
- const currentComponent = computed(() =>
73
- isNewView.value
74
- ? defineAsyncComponent(() => import('./New.vue'))
75
- : defineAsyncComponent(() => import('./Old.vue'))
76
- )
77
-
78
- const wizard: Wizard = new Wizard(
79
- stepsFunc(localization.value),
80
- stepsSchemeInitial
81
- )
82
- const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
83
-
84
- watch(
85
- () => model.value.restore_code,
86
- (newValue) => {
87
- wizard.changeScheme(newValue - 1)
88
- },
89
- { immediate: true }
90
- )
91
- const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
92
- const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
93
- wizard.changeSteps(value, validationFunc)
94
- }
95
-
96
- const storageSubmit = ref<null | Function>(null)
97
-
98
- const validationFunc = async (
99
- value: UI_I_WizardStep[],
100
- currentStep: UI_I_WizardStep,
101
- nextStep: UI_I_WizardStep
102
- ): Promise<UI_I_ValidationReturn> => {
103
- let stepHasError = false
104
- const stepShouldStop = {
105
- ifOnCurrentStep: false,
106
- ifFromAnyStep: false,
107
- stoppageStepId: -1,
108
- }
109
-
110
- wizard.setLoader(true)
111
-
112
- if (
113
- wizard.isValidateForStep(
114
- dynamicSteps.selectName,
115
- currentStep.id,
116
- nextStep.id
117
- )
118
- ) {
119
- const nameValidation = await checkNameValidation(
120
- value,
121
- model.value.pvm.name,
122
- wizard,
123
- localization.value,
124
- showValidationErrors,
125
- onRemoveValidationErrors,
126
- emits
127
- )
128
-
129
- value = nameValidation.newValue
130
- stepHasError = stepHasError || nameValidation.stepHasError
131
- }
132
-
133
- if (
134
- wizard.isValidateForStep(
135
- dynamicSteps.selectStorage,
136
- currentStep.id,
137
- nextStep.id
138
- )
139
- ) {
140
- const validation = await checkStorage(value)
141
-
142
- value = validation.newValue
143
- stepHasError = stepHasError || validation.stepHasError
144
- }
145
-
146
- if (
147
- wizard.isValidateForStep(
148
- dynamicSteps.selectDisks,
149
- currentStep.id,
150
- nextStep.id
151
- )
152
- ) {
153
- const validation = checkDisksValidation(
154
- value,
155
- !!model.value?.pvm.disk_devices.length,
156
- wizard,
157
- localization.value,
158
- showValidationErrors,
159
- onRemoveValidationErrors
160
- )
161
-
162
- value = validation.newValue
163
- stepHasError = stepHasError || validation.stepHasError
164
- }
165
-
166
- wizard.setLoader(false)
167
-
168
- return {
169
- newValue: value,
170
- stepHasError,
171
- stepShouldStop,
172
- }
173
- }
174
-
175
- const checkStorage = async (
176
- value: UI_I_WizardStep[]
177
- ): Promise<UI_I_ValidationReturn> => {
178
- let stepHasError = false
179
-
180
- return new Promise((resolve) => {
181
- storageSubmit.value = (isValid: boolean): void => {
182
- if (!isValid) {
183
- stepHasError = wizard.setValidation(
184
- dynamicSteps.selectStorage,
185
- 'storage',
186
- {
187
- fieldMessage: localization.value.common.selectStorage,
188
- alertMessage:
189
- localization.value.common.selectValidDestinationStorage,
190
- }
191
- )
192
- } else if (wizard.hasMessage(dynamicSteps.selectStorage, 'storage')) {
193
- value = wizard.removeValidation(
194
- dynamicSteps.selectStorage,
195
- 'storage',
196
- value
197
- )
198
- }
199
-
200
- resolve({
201
- stepHasError,
202
- newValue: value,
203
- })
204
- storageSubmit.value = null
205
- }
206
- })
207
- }
208
-
209
- const getDatastoreTableFunc = async (): Promise<void> => {
210
- emits('get-datastore', model.value.bucket)
211
- }
212
-
213
- const selectedStorageName = ref<string>('')
214
- const selectedStorage = ref<UI_I_DatastoreTableItem | null>(null)
215
- const onChangeStorage = (storage: UI_I_DatastoreTableItem | null): void => {
216
- if (!storage) return
217
-
218
- selectedStorageName.value = storage.name
219
- selectedStorage.value = storage
220
- model.value.pvm.storage = {
221
- id: storage.id,
222
- folder: '',
223
- }
224
- }
225
-
226
- const loadingCount = ref<number>(0)
227
- const isLoading = computed<boolean>(() => loadingCount.value !== 0)
228
- // В Сфере и Прокураторе одно и тоже
229
- const getPvm = async (): Promise<void> => {
230
- loadingCount.value++
231
- await $store.dispatch('backup/A_GET_PVM', {
232
- target: model.value.backup_storage,
233
- bucketId: model.value.bucket, // TODO bucket поменять на vm так как это сейчас vm
234
- backupId: model.value.backup,
235
- })
236
-
237
- loadingCount.value--
238
- }
239
- getPvm()
240
- // В Сфере и Прокураторе одно и тоже
241
- const getBackupDisks = async (): Promise<void> => {
242
- loadingCount.value++
243
- await $store.dispatch('backup/A_GET_BACKUP_DISKS', {
244
- target: model.value.backup_storage,
245
- bucketId: model.value.bucket, // TODO bucket поменять на vm так как это сейчас vm
246
- backupId: model.value.backup,
247
- })
248
-
249
- model.value.pvm.disk_devices = [] // ToDo если не обнулить тогда в форме всегда будет выбранны диски
250
- loadingCount.value--
251
- }
252
- getBackupDisks()
253
-
254
- const readyToCompleteInfo = computed<UI_I_TableInfoItem[]>(() =>
255
- readyToCompleteOptions(
256
- model.value,
257
- localization.value,
258
- selectedStorageName.value
259
- )
260
- )
261
-
262
- const errors = ref<string[]>([])
263
- const showValidationErrors = (data: string[]): void => {
264
- errors.value = data
265
- }
266
- const onRemoveValidationErrors = (): void => {
267
- errors.value = []
268
- }
269
-
270
- const onFinish = (): void => {
271
- emits('finish')
272
- }
273
- const onHideModal = (): void => {
274
- emits('hide')
275
- }
276
-
277
- const isShowConfirm = ref<boolean>(false)
278
-
279
- const onSubmitWizard = (): void => {
280
- if (model.value.restore_code === restoreCodes.existing) {
281
- isShowConfirm.value = true
282
- } else {
283
- onFinish()
284
- }
285
- }
286
-
287
- const onGetNetworks = (hostId: string): void => {
288
- emits('get-networks', hostId)
289
- }
290
- </script>
291
-
292
- <style scoped lang="scss">
293
- :deep(.modal-body) {
294
- display: flex;
295
- flex-direction: column;
296
- }
297
-
298
- .loader-wrap {
299
- background-color: rgba(0, 0, 0, 0.3);
300
- z-index: var(--z-fixed);
301
- }
302
- </style>
1
+ <template>
2
+ <component
3
+ :is="currentComponent"
4
+ v-model="model"
5
+ v-model:is-show-confirm="isShowConfirm"
6
+ :wizard="wizard"
7
+ :selected-scheme="selectedScheme"
8
+ :alert-messages="alertMessages"
9
+ :storage-submit="storageSubmit"
10
+ :datastore="props.datastore"
11
+ :datastore-loading="props.datastoreLoading"
12
+ :networks="props.networks"
13
+ :ready-complete-data="readyToCompleteInfo"
14
+ :selected-storage="selectedStorage"
15
+ :is-loading="isLoading"
16
+ :errors="errors"
17
+ @change-storage="onChangeStorage"
18
+ @get-datastore="getDatastoreTableFunc"
19
+ @get-networks="onGetNetworks"
20
+ @change-steps="onChangeSteps"
21
+ @submit-confirm="onFinish"
22
+ @hide="onHideModal"
23
+ @submit-wizard="onSubmitWizard"
24
+ @remove-validation-errors="onRemoveValidationErrors"
25
+ />
26
+ </template>
27
+
28
+ <script setup lang="ts">
29
+ import type {
30
+ UI_I_WizardStep,
31
+ UI_I_ValidationReturn,
32
+ } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
33
+ import Wizard from '~/node_modules/bfg-uikit/components/ui/wizard/lib/utils/utils'
34
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
35
+ import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
36
+ import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
37
+ import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
38
+ import type { UI_I_NameCheck } from '~/components/common/pages/backups/modals/restore/name/lib/models/interfaces'
39
+ import type { UI_I_RestoreForm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
40
+ import {
41
+ stepsSchemeInitial,
42
+ stepsFunc,
43
+ dynamicSteps,
44
+ } from '~/components/common/pages/backups/modals/restore/lib/config/steps'
45
+ import { restoreCodes } from '~/components/common/pages/backups/modals/restore/lib/config/restoreCodes'
46
+ import { readyToCompleteOptions } from '~/components/common/pages/backups/modals/restore/lib/config/readyToCompleteOptions'
47
+ import {
48
+ checkDisksValidation,
49
+ checkNameValidation,
50
+ } from '~/components/common/pages/backups/modals/restore/validation/validation'
51
+
52
+ const model = defineModel<UI_I_RestoreForm>({ required: true })
53
+
54
+ const props = defineProps<{
55
+ datastore: UI_I_DatastoreTableItem[]
56
+ datastoreLoading: boolean
57
+ networks: UI_I_NetworkTableItem[]
58
+ }>()
59
+ const emits = defineEmits<{
60
+ (event: 'get-datastore', value: string): void
61
+ (event: 'get-networks', value: string): void
62
+ (event: 'check-name', value: UI_I_NameCheck): void
63
+ (event: 'finish'): void
64
+ (event: 'hide'): void
65
+ }>()
66
+
67
+ const { $store }: any = useNuxtApp()
68
+
69
+ const localization = computed<UI_I_Localization>(() => useLocal())
70
+
71
+ const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
72
+ const currentComponent = computed(() =>
73
+ isNewView.value
74
+ ? defineAsyncComponent(() => import('./New.vue'))
75
+ : defineAsyncComponent(() => import('./Old.vue'))
76
+ )
77
+
78
+ const wizard: Wizard = new Wizard(
79
+ stepsFunc(localization.value),
80
+ stepsSchemeInitial
81
+ )
82
+ const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
83
+
84
+ watch(
85
+ () => model.value.restore_code,
86
+ (newValue) => {
87
+ wizard.changeScheme(newValue - 1)
88
+ },
89
+ { immediate: true }
90
+ )
91
+ const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
92
+ const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
93
+ wizard.changeSteps(value, validationFunc)
94
+ }
95
+
96
+ const storageSubmit = ref<null | Function>(null)
97
+
98
+ const validationFunc = async (
99
+ value: UI_I_WizardStep[],
100
+ currentStep: UI_I_WizardStep,
101
+ nextStep: UI_I_WizardStep
102
+ ): Promise<UI_I_ValidationReturn> => {
103
+ let stepHasError = false
104
+ const stepShouldStop = {
105
+ ifOnCurrentStep: false,
106
+ ifFromAnyStep: false,
107
+ stoppageStepId: -1,
108
+ }
109
+
110
+ wizard.setLoader(true)
111
+
112
+ if (
113
+ wizard.isValidateForStep(
114
+ dynamicSteps.selectName,
115
+ currentStep.id,
116
+ nextStep.id
117
+ )
118
+ ) {
119
+ const nameValidation = await checkNameValidation(
120
+ value,
121
+ model.value.pvm.name,
122
+ wizard,
123
+ localization.value,
124
+ showValidationErrors,
125
+ onRemoveValidationErrors,
126
+ emits
127
+ )
128
+
129
+ value = nameValidation.newValue
130
+ stepHasError = stepHasError || nameValidation.stepHasError
131
+ }
132
+
133
+ if (
134
+ wizard.isValidateForStep(
135
+ dynamicSteps.selectStorage,
136
+ currentStep.id,
137
+ nextStep.id
138
+ )
139
+ ) {
140
+ const validation = await checkStorage(value)
141
+
142
+ value = validation.newValue
143
+ stepHasError = stepHasError || validation.stepHasError
144
+ }
145
+
146
+ if (
147
+ wizard.isValidateForStep(
148
+ dynamicSteps.selectDisks,
149
+ currentStep.id,
150
+ nextStep.id
151
+ )
152
+ ) {
153
+ const validation = checkDisksValidation(
154
+ value,
155
+ !!model.value?.pvm.disk_devices.length,
156
+ wizard,
157
+ localization.value,
158
+ showValidationErrors,
159
+ onRemoveValidationErrors
160
+ )
161
+
162
+ value = validation.newValue
163
+ stepHasError = stepHasError || validation.stepHasError
164
+ }
165
+
166
+ wizard.setLoader(false)
167
+
168
+ return {
169
+ newValue: value,
170
+ stepHasError,
171
+ stepShouldStop,
172
+ }
173
+ }
174
+
175
+ const checkStorage = async (
176
+ value: UI_I_WizardStep[]
177
+ ): Promise<UI_I_ValidationReturn> => {
178
+ let stepHasError = false
179
+
180
+ return new Promise((resolve) => {
181
+ storageSubmit.value = (isValid: boolean): void => {
182
+ if (!isValid) {
183
+ stepHasError = wizard.setValidation(
184
+ dynamicSteps.selectStorage,
185
+ 'storage',
186
+ {
187
+ fieldMessage: localization.value.common.selectStorage,
188
+ alertMessage:
189
+ localization.value.common.selectValidDestinationStorage,
190
+ }
191
+ )
192
+ } else if (wizard.hasMessage(dynamicSteps.selectStorage, 'storage')) {
193
+ value = wizard.removeValidation(
194
+ dynamicSteps.selectStorage,
195
+ 'storage',
196
+ value
197
+ )
198
+ }
199
+
200
+ resolve({
201
+ stepHasError,
202
+ newValue: value,
203
+ })
204
+ storageSubmit.value = null
205
+ }
206
+ })
207
+ }
208
+
209
+ const getDatastoreTableFunc = async (): Promise<void> => {
210
+ emits('get-datastore', model.value.bucket)
211
+ }
212
+
213
+ const selectedStorageName = ref<string>('')
214
+ const selectedStorage = ref<UI_I_DatastoreTableItem | null>(null)
215
+ const onChangeStorage = (storage: UI_I_DatastoreTableItem | null): void => {
216
+ if (!storage) return
217
+
218
+ selectedStorageName.value = storage.name
219
+ selectedStorage.value = storage
220
+ model.value.pvm.storage = {
221
+ id: storage.id,
222
+ folder: '',
223
+ }
224
+ }
225
+
226
+ const loadingCount = ref<number>(0)
227
+ const isLoading = computed<boolean>(() => loadingCount.value !== 0)
228
+ // В Сфере и Прокураторе одно и тоже
229
+ const getPvm = async (): Promise<void> => {
230
+ loadingCount.value++
231
+ await $store.dispatch('backup/A_GET_PVM', {
232
+ target: model.value.backup_storage,
233
+ bucketId: model.value.bucket, // TODO bucket поменять на vm так как это сейчас vm
234
+ backupId: model.value.backup,
235
+ })
236
+
237
+ loadingCount.value--
238
+ }
239
+ getPvm()
240
+ // В Сфере и Прокураторе одно и тоже
241
+ const getBackupDisks = async (): Promise<void> => {
242
+ loadingCount.value++
243
+ await $store.dispatch('backup/A_GET_BACKUP_DISKS', {
244
+ target: model.value.backup_storage,
245
+ bucketId: model.value.bucket, // TODO bucket поменять на vm так как это сейчас vm
246
+ backupId: model.value.backup,
247
+ })
248
+
249
+ model.value.pvm.disk_devices = [] // ToDo если не обнулить тогда в форме всегда будет выбранны диски
250
+ loadingCount.value--
251
+ }
252
+ getBackupDisks()
253
+
254
+ const readyToCompleteInfo = computed<UI_I_TableInfoItem[]>(() =>
255
+ readyToCompleteOptions(
256
+ model.value,
257
+ localization.value,
258
+ selectedStorageName.value
259
+ )
260
+ )
261
+
262
+ const errors = ref<string[]>([])
263
+ const showValidationErrors = (data: string[]): void => {
264
+ errors.value = data
265
+ }
266
+ const onRemoveValidationErrors = (): void => {
267
+ errors.value = []
268
+ }
269
+
270
+ const onFinish = (): void => {
271
+ emits('finish')
272
+ }
273
+ const onHideModal = (): void => {
274
+ emits('hide')
275
+ }
276
+
277
+ const isShowConfirm = ref<boolean>(false)
278
+
279
+ const onSubmitWizard = (): void => {
280
+ if (model.value.restore_code === restoreCodes.existing) {
281
+ isShowConfirm.value = true
282
+ } else {
283
+ onFinish()
284
+ }
285
+ }
286
+
287
+ const onGetNetworks = (hostId: string): void => {
288
+ emits('get-networks', hostId)
289
+ }
290
+ </script>
291
+
292
+ <style scoped lang="scss">
293
+ :deep(.modal-body) {
294
+ display: flex;
295
+ flex-direction: column;
296
+ }
297
+
298
+ .loader-wrap {
299
+ background-color: rgba(0, 0, 0, 0.3);
300
+ z-index: var(--z-fixed);
301
+ }
302
+ </style>