bfg-common 1.5.417 → 1.5.419

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 (61) hide show
  1. package/components/common/modals/confirmation/ConfirmationNew.vue +1 -1
  2. package/components/common/pages/backups/Backups.vue +102 -0
  3. package/components/common/pages/backups/DetailView.vue +52 -0
  4. package/components/common/pages/backups/lib/models/interfaces.ts +24 -0
  5. package/components/common/pages/backups/lib/models/types.ts +7 -0
  6. package/components/common/pages/backups/modals/Modals.vue +229 -0
  7. package/components/common/pages/backups/modals/createBackup/CreateBackup.vue +371 -0
  8. package/components/common/pages/backups/modals/createBackup/configuration/Configuration.vue +29 -0
  9. package/components/common/pages/backups/modals/createBackup/configuration/backupWindow/BackupWindow.vue +26 -0
  10. package/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/MaxBandwidth.vue +65 -0
  11. package/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/lib/config/options.ts +6 -0
  12. package/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/lib/models/types.ts +1 -0
  13. package/components/common/pages/backups/modals/createBackup/configuration/strategy/Strategy.vue +36 -0
  14. package/components/common/pages/backups/modals/createBackup/datastores/Datastores.vue +58 -0
  15. package/components/common/pages/backups/modals/createBackup/datastores/tableView/TableView.vue +94 -0
  16. package/components/common/pages/backups/modals/createBackup/datastores/tableView/lib/config/keys.ts +14 -0
  17. package/components/common/pages/backups/modals/createBackup/datastores/tableView/lib/config/table.ts +117 -0
  18. package/components/common/pages/backups/modals/createBackup/datastores/tableView/lib/models/types.ts +10 -0
  19. package/components/common/pages/backups/modals/createBackup/disks/Disks.vue +28 -0
  20. package/components/common/pages/backups/modals/createBackup/disks/tableView/TableView.vue +105 -0
  21. package/components/common/pages/backups/modals/createBackup/disks/tableView/lib/config/keys.ts +12 -0
  22. package/components/common/pages/backups/modals/createBackup/disks/tableView/lib/config/table.ts +117 -0
  23. package/components/common/pages/backups/modals/createBackup/disks/tableView/lib/models/interfaces.ts +4 -0
  24. package/components/common/pages/backups/modals/createBackup/disks/tableView/lib/models/types.ts +10 -0
  25. package/components/common/pages/backups/modals/createBackup/general/General.vue +48 -0
  26. package/components/common/pages/backups/modals/createBackup/lib/config/createBackup.ts +14 -0
  27. package/components/common/pages/backups/modals/createBackup/lib/config/steps.ts +117 -0
  28. package/components/common/pages/backups/modals/createBackup/lib/config/strategyOptions.ts +12 -0
  29. package/components/common/pages/backups/modals/createBackup/lib/models/interfaces.ts +8 -0
  30. package/components/common/pages/backups/modals/createBackup/readyToComplete/ReadyToComplete.vue +15 -0
  31. package/components/common/pages/backups/modals/lib/config/createBackup.ts +16 -0
  32. package/components/common/pages/backups/modals/lib/config/restore.ts +115 -0
  33. package/components/common/pages/backups/modals/lib/models/interfaces.ts +164 -0
  34. package/components/common/pages/backups/modals/restore/Restore.vue +388 -0
  35. package/components/common/pages/backups/modals/restore/disks/Disks.vue +28 -0
  36. package/components/common/pages/backups/modals/restore/disks/tableView/TableView.vue +101 -0
  37. package/components/common/pages/backups/modals/restore/disks/tableView/lib/config/keys.ts +14 -0
  38. package/components/common/pages/backups/modals/restore/disks/tableView/lib/config/table.ts +114 -0
  39. package/components/common/pages/backups/modals/restore/disks/tableView/lib/models/interfaces.ts +4 -0
  40. package/components/common/pages/backups/modals/restore/disks/tableView/lib/models/types.ts +10 -0
  41. package/components/common/pages/backups/modals/restore/lib/config/steps.ts +92 -0
  42. package/components/common/pages/backups/modals/restore/name/Name.vue +159 -0
  43. package/components/common/pages/backups/modals/restore/networks/Networks.vue +67 -0
  44. package/components/common/pages/backups/modals/restore/networks/table/Table.vue +216 -0
  45. package/components/common/pages/backups/modals/restore/networks/table/adapterType/AdapterType.vue +32 -0
  46. package/components/common/pages/backups/modals/restore/networks/table/adapterType/lib/config/options.ts +8 -0
  47. package/components/common/pages/backups/modals/restore/networks/table/lib/config/networkTable.ts +82 -0
  48. package/components/common/pages/backups/modals/restore/networks/table/lib/config/tableKeys.ts +10 -0
  49. package/components/common/pages/backups/modals/restore/networks/table/lib/models/types.ts +6 -0
  50. package/components/common/pages/backups/modals/restore/types/Types.vue +61 -0
  51. package/components/common/pages/backups/modals/restore/types/lib/config/descriptions.ts +7 -0
  52. package/components/common/pages/backups/modals/restore/types/lib/config/typeOptions.ts +24 -0
  53. package/components/common/pages/backups/tools/Tools.vue +75 -0
  54. package/components/common/pages/backups/tools/lib/config/tabs.ts +36 -0
  55. package/components/common/pages/scheduledTasks/lib/models/interfaces.ts +35 -0
  56. package/components/common/pages/scheduledTasks/lib/models/types.ts +16 -0
  57. package/components/common/pages/scheduledTasks/lib/utils/utils.ts +84 -0
  58. package/components/common/treeView/TreeView.vue +52 -0
  59. package/lib/models/interfaces.ts +1 -1
  60. package/package.json +1 -1
  61. /package/components/common/{backup/actions → pages/backups/modals}/deleteBackup/DeleteBackup.vue +0 -0
@@ -0,0 +1,115 @@
1
+ import type { UI_I_RestoreForm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
2
+
3
+ export const restoreDefaultFormFunc = (): UI_I_RestoreForm => {
4
+ return {
5
+ restore_code: 2,
6
+ backup_storage: '',
7
+ bucket: '',
8
+ backup: '',
9
+ pvm: {
10
+ deployment_name: '',
11
+ name: '',
12
+ uuid: '',
13
+ compatibility: '',
14
+ guest_os_family: '',
15
+ guest_os_version: '',
16
+ storage: {
17
+ id: '',
18
+ folder: '',
19
+ },
20
+ machine_type: '',
21
+ cpu: {
22
+ vcpus: -1,
23
+ max_vcpus: -1,
24
+ core_per_socket: -1,
25
+ model: '',
26
+ reservation_mhz: -1,
27
+ limit_mhz: -1,
28
+ shares: -1,
29
+ hotplug: false,
30
+ },
31
+ memory: {
32
+ size_mb: -1,
33
+ hotplug: false,
34
+ reservation_mb: -1,
35
+ limit_mb: -1,
36
+ },
37
+ video_card: {
38
+ adapter: '',
39
+ displays: -1,
40
+ memory_mb: -1,
41
+ },
42
+ usb_controllers: [],
43
+ input_devices: [],
44
+ disk_devices: [],
45
+ network_devices: [],
46
+ passthrough_pci_devices: [],
47
+ options: {
48
+ remote_console: {
49
+ type: '',
50
+ port: -1,
51
+ keymap: '',
52
+ password: '',
53
+ guest_os_lock: false,
54
+ limit_sessions: -1,
55
+ spice: {
56
+ img_compression: '',
57
+ jpeg_compression: '',
58
+ zlib_glz_compression: '',
59
+ streaming_mode: '',
60
+ playback_compression: false,
61
+ file_transfer: false,
62
+ clipboard: false,
63
+ },
64
+ },
65
+ guest_tools: {
66
+ enabled: false,
67
+ synchronized_time: false,
68
+ },
69
+ boot_options: {
70
+ firmware: '',
71
+ boot_delay_ms: -1,
72
+ boot_menu: false,
73
+ },
74
+ },
75
+ monitoring: {
76
+ state: -1,
77
+ memory: {
78
+ dram_read_bandwidth: -1,
79
+ pmem_read_bandwidth: -1,
80
+ provisioned_mb: -1,
81
+ used_mb: -1,
82
+ resident_set_size_mb: -1,
83
+ },
84
+ cpu: {
85
+ current_vcpus: -1,
86
+ provisioned_mhz: -1,
87
+ used_mhz: -1,
88
+ },
89
+ storage: {
90
+ provisioned_space_mb: -1,
91
+ used_space_mb: -1,
92
+ allocated_space_mb: -1,
93
+ },
94
+ networks: null,
95
+ uptime: {
96
+ start_time: '',
97
+ uptime_ms: -1,
98
+ uptime_humanized: '',
99
+ },
100
+ guest_tools: {
101
+ status: '',
102
+ version: '',
103
+ ip: '',
104
+ dns_name: '',
105
+ },
106
+ evc_cpu_mode: '',
107
+ evc_graphics_mode: '',
108
+ encryption: '',
109
+ tpm: '',
110
+ vbs: '',
111
+ },
112
+ snapshots: {},
113
+ },
114
+ }
115
+ }
@@ -0,0 +1,164 @@
1
+ export interface API_UI_I_Pvm {
2
+ compatibility: string
3
+ deployment_name: string
4
+ guest_os_family: string
5
+ guest_os_version: string
6
+ machine_type: string
7
+ name: string
8
+ uuid: string
9
+ cpu: {
10
+ core_per_socket: number
11
+ hotplug: boolean
12
+ limit_mhz: number
13
+ max_vcpus: number
14
+ model: string
15
+ reservation_mhz: number
16
+ shares: number
17
+ vcpus: number
18
+ }
19
+ disk_devices: {
20
+ allocated_mb: number
21
+ boot_order: number
22
+ bus: string
23
+ cache: string
24
+ capacity_mb: number
25
+ device_type: string
26
+ discard: string
27
+ disk_mode: string
28
+ free_mb: number
29
+ io: string
30
+ limit_iops: number
31
+ location: string
32
+ provision_type: string
33
+ read_only: boolean
34
+ shares: number
35
+ sharing: boolean
36
+ source: string
37
+ storage_id: string
38
+ target: string
39
+ used_mb: number
40
+ volume_path: string
41
+ }[]
42
+ input_devices: {
43
+ bus: string
44
+ type: string
45
+ }[]
46
+ memory: {
47
+ hotplug: boolean
48
+ limit_mb: number
49
+ reservation_mb: number
50
+ size_mb: number
51
+ }
52
+ monitoring: {
53
+ cpu: {
54
+ current_vcpus: number
55
+ provisioned_mhz: number
56
+ used_mhz: number
57
+ }
58
+ encryption: string
59
+ evc_cpu_mode: string
60
+ evc_graphics_mode: string
61
+ guest_tools: {
62
+ dns_name: string
63
+ ip: string
64
+ status: string
65
+ version: string
66
+ }
67
+ memory: {
68
+ dram_read_bandwidth: number
69
+ pmem_read_bandwidth: number
70
+ provisioned_mb: number
71
+ resident_set_size_mb: number
72
+ used_mb: number
73
+ }
74
+ networks: null // ?
75
+ state: number
76
+ storage: {
77
+ allocated_space_mb: number
78
+ provisioned_space_mb: number
79
+ used_space_mb: number
80
+ }
81
+ tpm: string
82
+ uptime: {
83
+ start_time: string
84
+ uptime_humanized: string
85
+ uptime_ms: number
86
+ }
87
+ vbs: string
88
+ }
89
+ network_devices: {
90
+ boot_order: number
91
+ import_source_id: string
92
+ mac: string
93
+ model: string
94
+ net_bridge: string
95
+ network: string
96
+ target: string
97
+ }[]
98
+ options: {
99
+ boot_options: {
100
+ boot_delay_ms: number
101
+ boot_menu: boolean
102
+ firmware: string
103
+ }
104
+ guest_tools: {
105
+ enabled: boolean
106
+ synchronized_time: boolean
107
+ }
108
+ remote_console: {
109
+ guest_os_lock: boolean
110
+ keymap: string
111
+ limit_sessions: number
112
+ password: string
113
+ port: number
114
+ spice: {
115
+ clipboard: boolean
116
+ file_transfer: boolean
117
+ img_compression: string
118
+ jpeg_compression: string
119
+ playback_compression: boolean
120
+ streaming_mode: string
121
+ zlib_glz_compression: string
122
+ }
123
+ type: string
124
+ }
125
+ }
126
+ passthrough_pci_devices: any[]
127
+ snapshots: any
128
+ storage: {
129
+ folder: string
130
+ id: string
131
+ }
132
+ usb_controllers: {
133
+ type: string
134
+ }[]
135
+ video_card: {
136
+ adapter: string
137
+ displays: number
138
+ memory_mb: number
139
+ }
140
+ }
141
+ export interface UI_I_Pvm extends API_UI_I_Pvm {}
142
+
143
+ export interface UI_I_CreateBackupFormDiskDevice {
144
+ location: string,
145
+ target: string,
146
+ }
147
+ export interface UI_I_CreateBackupForm {
148
+ target: string
149
+ name: string
150
+ description: string
151
+ disk_devices: UI_I_CreateBackupFormDiskDevice[]
152
+ backup_storage: string
153
+ strategy: 0 | 1 | 2
154
+ // start_window_min: number
155
+ bandwidth_limit: number
156
+ }
157
+
158
+ export interface UI_I_RestoreForm {
159
+ restore_code: 1 | 2 | 3 // 1 - disk only, 2 - existing, 3 - asNew
160
+ backup_storage: string
161
+ bucket: string
162
+ backup: string
163
+ pvm: UI_I_Pvm
164
+ }
@@ -0,0 +1,388 @@
1
+ <template>
2
+ <div class="restore">
3
+ <atoms-wizard
4
+ show
5
+ :wizard="wizard"
6
+ :selected-scheme="selectedScheme"
7
+ :title="localization.common.restore"
8
+ :localization="localization"
9
+ test-id="restore"
10
+ @change-steps="onChangeSteps"
11
+ @hide="onHideModal"
12
+ @submit="onRestore"
13
+ >
14
+ <template #modalBody="{ selectedStep }">
15
+ <div
16
+ v-show="isLoading"
17
+ class="loader-wrap absolute left-0 right-0 top-0 bottom-0"
18
+ >
19
+ <atoms-loader-pre-loader
20
+ id="loader"
21
+ :show="isLoading"
22
+ class="absolute-center"
23
+ test-id="backup-restore-spinner"
24
+ />
25
+ </div>
26
+ <atoms-alert
27
+ v-show="errors.length"
28
+ :items="errors"
29
+ status="alert-danger"
30
+ test-id="restore-alert"
31
+ @remove="onRemoveValidationErrors"
32
+ />
33
+
34
+ <common-pages-backups-modals-restore-types
35
+ v-show="selectedStep.id === 0"
36
+ v-model="model"
37
+ />
38
+
39
+ <common-pages-backups-modals-restore-name
40
+ v-show="selectedStep.id === 1"
41
+ v-model="model"
42
+ :show="selectedStep.id === 1"
43
+ :name-form-submit="nameFormSubmit"
44
+ @check-name="onCheckName(...$event)"
45
+ />
46
+
47
+ <!-- TODO refactoring-->
48
+ <common-vm-actions-common-select-storage
49
+ v-show="selectedStep.id === 2"
50
+ :storage-submit="storageSubmit"
51
+ :datastore="props.datastore"
52
+ :is-datastore-loading="props.datastoreLoading"
53
+ :storage="model.pvm.storage"
54
+ :get-datastore-table-func="getDatastoreTableFunc"
55
+ @submit="onChangeStorage"
56
+ />
57
+
58
+ <common-pages-backups-modals-restore-disks
59
+ v-show="selectedStep.id === 3"
60
+ v-model="model"
61
+ />
62
+ <common-pages-backups-modals-restore-networks
63
+ v-if="selectedStep.id === 4"
64
+ v-model="model"
65
+ :alert-messages="[]"
66
+ :networks="props.networks"
67
+ @get-networks="onGetNetworks"
68
+ />
69
+
70
+ <common-ready-to-complete
71
+ v-show="selectedStep.id === 5"
72
+ :data="readyToCompleteInfo"
73
+ />
74
+ </template>
75
+ </atoms-wizard>
76
+ </div>
77
+
78
+ <common-modals-confirmation
79
+ v-if="isShowConfirm"
80
+ :headline="localization.common.attention"
81
+ :description="localization.common.restoreBackupConfirmDescription"
82
+ @hide-modal="isShowConfirm = false"
83
+ @confirm="onFinish"
84
+ />
85
+ </template>
86
+
87
+ <script setup lang="ts">
88
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
89
+ import type {
90
+ UI_I_WizardStep,
91
+ UI_I_ValidationReturn,
92
+ } from '~/components/atoms/wizard/lib/models/interfaces'
93
+ import Wizard from '~/components/atoms/wizard/lib/utils/utils'
94
+ import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
95
+ import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
96
+ import type { API_UI_I_Error } from '~/lib/models/store/interfaces'
97
+ import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
98
+ // import type { I_RestoreForm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
99
+ import {
100
+ stepsSchemeInitial,
101
+ stepsFunc,
102
+ } from '~/components/common/pages/backups/modals/restore/lib/config/steps'
103
+ // import { datastoreTableFunc } from '~/components/templates/inventory/actions/vm/lib/utils'
104
+
105
+ const model = defineModel<I_RestoreForm>({ required: true })
106
+
107
+ const props = defineProps<{
108
+ datastore: UI_I_DatastoreTableItem[]
109
+ datastoreLoading: boolean
110
+ networks: UI_I_NetworkTableItem[]
111
+ }>()
112
+ const emits = defineEmits<{
113
+ (event: 'get-datastore', value: string): void
114
+ (event: 'get-networks', value: string): void
115
+ (event: 'check-name', value: any): void // ??
116
+ (event: 'finish'): void
117
+ (event: 'hide'): void
118
+ }>()
119
+
120
+ const { $store } = useNuxtApp()
121
+
122
+ const localization = computed<UI_I_Localization>(() => useLocal())
123
+
124
+ const wizard: Wizard = new Wizard(
125
+ stepsFunc(localization.value),
126
+ stepsSchemeInitial
127
+ )
128
+
129
+ watch(
130
+ () => model.value.restore_code,
131
+ (newValue) => {
132
+ wizard.changeScheme(newValue - 1)
133
+ },
134
+ { immediate: true }
135
+ )
136
+ const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
137
+ const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
138
+ wizard.changeSteps(value, validationFunc)
139
+ }
140
+
141
+ const nameFormSubmit = ref<null | Function>(null)
142
+ const storageSubmit = ref<null | Function>(null)
143
+
144
+ const validationFunc = async (
145
+ value: UI_I_WizardStep[],
146
+ currentStep: UI_I_WizardStep,
147
+ nextStep: UI_I_WizardStep
148
+ ): Promise<UI_I_ValidationReturn> => {
149
+ let stepHasError = false
150
+ const stepShouldStop = {
151
+ ifOnCurrentStep: false,
152
+ ifFromAnyStep: false,
153
+ stoppageStepId: -1,
154
+ }
155
+
156
+ wizard.setLoader(true)
157
+
158
+ if (wizard.isValidateForStep(1, currentStep.id, nextStep.id)) {
159
+ const nameValidation = await checkName(value)
160
+
161
+ value = nameValidation.newValue
162
+ stepHasError = stepHasError || nameValidation.stepHasError
163
+ }
164
+
165
+ if (wizard.isValidateForStep(2, currentStep.id, nextStep.id)) {
166
+ const validation = await checkStorage(value)
167
+
168
+ value = validation.newValue
169
+ stepHasError = stepHasError || validation.stepHasError
170
+ }
171
+
172
+ if (wizard.isValidateForStep(3, currentStep.id, nextStep.id)) {
173
+ const validation = checkDisks(value)
174
+
175
+ value = validation.newValue
176
+ stepHasError = stepHasError || validation.stepHasError
177
+ }
178
+
179
+ wizard.setLoader(false)
180
+
181
+ return {
182
+ newValue: value,
183
+ stepHasError,
184
+ stepShouldStop,
185
+ }
186
+ }
187
+
188
+ const checkName = async (
189
+ value: UI_I_WizardStep[]
190
+ ): Promise<UI_I_ValidationReturn> => {
191
+ let stepHasError = false
192
+
193
+ return new Promise((resolve) => {
194
+ nameFormSubmit.value = (isValid: boolean): void => {
195
+ if (!isValid) {
196
+ stepHasError = wizard.setValidation(1, 'name', {
197
+ fieldMessage: 'aaa',
198
+ alertMessage: 'aaa',
199
+ })
200
+ } else if (wizard.hasMessage(1, 'name')) {
201
+ value = wizard.removeValidation(1, 'name', value)
202
+ }
203
+
204
+ resolve({
205
+ stepHasError,
206
+ newValue: value,
207
+ })
208
+ nameFormSubmit.value = null
209
+ }
210
+ })
211
+ }
212
+
213
+ const checkStorage = async (
214
+ value: UI_I_WizardStep[]
215
+ ): Promise<UI_I_ValidationReturn> => {
216
+ let stepHasError = false
217
+
218
+ return new Promise((resolve) => {
219
+ storageSubmit.value = (isValid: boolean): void => {
220
+ if (!isValid) {
221
+ stepHasError = wizard.setValidation(2, 'storage', {
222
+ fieldMessage: 'aaa',
223
+ alertMessage: 'aaa',
224
+ })
225
+ } else if (wizard.hasMessage(2, 'storage')) {
226
+ value = wizard.removeValidation(2, 'storage', value)
227
+ }
228
+
229
+ resolve({
230
+ stepHasError,
231
+ newValue: value,
232
+ })
233
+ storageSubmit.value = null
234
+ }
235
+ })
236
+ }
237
+
238
+ const checkDisks = (value: UI_I_WizardStep[]): UI_I_ValidationReturn => {
239
+ let stepHasError = false
240
+
241
+ const isValidStores = !!model.value?.pvm.disk_devices.length
242
+ if (!isValidStores) {
243
+ stepHasError = wizard.setValidation(3, 'disk_devices', {
244
+ fieldMessage: localization.value.common.diskIsRequired,
245
+ alertMessage: localization.value.common.diskIsRequired,
246
+ })
247
+ showValidationErrors([localization.value.common.diskIsRequired])
248
+ } else if (wizard.hasMessage(3, 'disk_devices')) {
249
+ value = wizard.removeValidation(3, 'disk_devices', value)
250
+ onRemoveValidationErrors()
251
+ }
252
+
253
+ return {
254
+ stepHasError,
255
+ newValue: value,
256
+ }
257
+ }
258
+
259
+ const getDatastoreTableFunc = async (
260
+ payload: UI_I_TablePayload
261
+ ): Promise<void> => {
262
+ console.log(payload, 111);
263
+ emits('get-datastore', model.value.bucket)
264
+ }
265
+
266
+ const selectedStorageName = ref<string>('')
267
+ const onChangeStorage = (storage: UI_I_DatastoreTableItem | null): void => {
268
+ if (!storage) return
269
+ selectedStorageName.value = storage.name
270
+ model.value.pvm.storage = {
271
+ id: storage.id,
272
+ folder: '',
273
+ }
274
+ }
275
+
276
+ const onCheckName = async (
277
+ name: string,
278
+ cb: (error: API_UI_I_Error) => void
279
+ ): Promise<void> => {
280
+ emits('check-name', { name, cb })
281
+ }
282
+
283
+ const isLoading = ref<boolean>(true)
284
+ // В Сфере и Прокураторе одно и тоже
285
+ const getPvm = async (): Promise<void> => {
286
+ await $store.dispatch('backup/A_GET_PVM', {
287
+ target: model.value.backup_storage,
288
+ bucketId: model.value.bucket, // TODO bucket поменять на vm так как это сейчас vm
289
+ backupId: model.value.backup,
290
+ })
291
+
292
+ model.value.pvm = useDeepCopy($store.getters['backup/getPvm'])
293
+ isLoading.value = false
294
+ }
295
+ getPvm()
296
+
297
+ const readyToCompleteInfo = computed<UI_I_TableInfoItem[]>(() => {
298
+ const result = []
299
+
300
+ switch (model.value.restore_code) {
301
+ case 1:
302
+ case 2:
303
+ result.push({
304
+ label: localization.value.common.backup,
305
+ value: model.value.backup,
306
+ })
307
+ break
308
+ case 3:
309
+ result.push({
310
+ label: localization.value.common.vmName,
311
+ value: model.value.pvm.name,
312
+ })
313
+
314
+ // Datastores
315
+ result.push({
316
+ label: localization.value.common.datastore,
317
+ value: selectedStorageName.value,
318
+ })
319
+
320
+ // Disks
321
+ model.value.pvm.disk_devices.forEach((disk_device, i) => {
322
+ if (!disk_device.source) return
323
+
324
+ result.push({
325
+ label: `${localization.value.common.disk} ${i}`,
326
+ value: disk_device.source,
327
+ })
328
+ })
329
+
330
+ // Networks
331
+ model.value.pvm.network_devices.forEach((network) => {
332
+ result.push({
333
+ label: localization.value.common.network,
334
+ value: network.network,
335
+ })
336
+ })
337
+ break
338
+ // case 1:
339
+ // result.push({
340
+ // label: localization.value.common.vmName,
341
+ // value: model.value.pvm.name,
342
+ // })
343
+ // break
344
+ }
345
+
346
+ return result
347
+ })
348
+
349
+ const errors = ref<string[]>([])
350
+ const showValidationErrors = (data: string[]): void => {
351
+ errors.value = data
352
+ }
353
+ const onRemoveValidationErrors = (): void => {
354
+ errors.value = []
355
+ }
356
+
357
+ const onFinish = (): void => {
358
+ emits('finish')
359
+ }
360
+ const onHideModal = (): void => {
361
+ emits('hide')
362
+ }
363
+
364
+ const onRestore = (): void => {
365
+ if (model.value.restore_code === 2) {
366
+ isShowConfirm.value = true
367
+ } else {
368
+ onFinish()
369
+ }
370
+ }
371
+
372
+ const isShowConfirm = ref<boolean>(false)
373
+
374
+ const onGetNetworks = (hostId: string): void => {
375
+ emits('get-networks', hostId)
376
+ }
377
+ </script>
378
+
379
+ <style scoped lang="scss">
380
+ :deep(.modal-body) {
381
+ display: flex;
382
+ flex-direction: column;
383
+ }
384
+ .loader-wrap {
385
+ background-color: rgba(0, 0, 0, 0.3);
386
+ z-index: var(--z-fixed);
387
+ }
388
+ </style>
@@ -0,0 +1,28 @@
1
+ <template>
2
+ <div class="disks h-full">
3
+ <common-pages-backups-modals-restore-disks-table-view
4
+ v-model:selected="model.pvm.disk_devices"
5
+ :data-table="disks"
6
+ :total-items="disks.length"
7
+ :total-pages="1"
8
+ />
9
+ </div>
10
+ </template>
11
+
12
+ <script lang="ts" setup>
13
+ // import type { I_RestoreForm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
14
+ import type { UI_I_Pvm } from '~/lib/models/store/vm/interfaces'
15
+
16
+ const model = defineModel<I_RestoreForm>({ required: true })
17
+
18
+ const { $store } = useNuxtApp()
19
+
20
+ const disks = computed<UI_I_Pvm['disk_devices']>(
21
+ () =>
22
+ $store.getters['backup/getPvm']?.disk_devices.filter(
23
+ (disk: UI_I_Pvm['disk_devices'][0]) => disk.source
24
+ ) || []
25
+ )
26
+ </script>
27
+
28
+ <style lang="scss" scoped></style>