bfg-common 1.4.786 → 1.4.787

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.
@@ -105,7 +105,7 @@
105
105
  v-model:limit-iops-type="limitIopsType"
106
106
  :index="props.index"
107
107
  :error-validation-fields="props.errorValidationFields"
108
- :disabled="props.isRunning"
108
+ :disabled="props.isRunning && props.type !== 'new'"
109
109
  @valid="limitIopsInvalid = $event"
110
110
  @remove-error-by-title="emits('remove-error-by-title', $event)"
111
111
  />
@@ -137,7 +137,7 @@
137
137
  v-model:limit-iops-type="limitIopsType"
138
138
  :index="props.index"
139
139
  :error-validation-fields="props.errorValidationFields"
140
- :disabled="props.isRunning"
140
+ :disabled="props.isRunning && props.type !== 'new'"
141
141
  @valid="limitIopsInvalid = $event"
142
142
  @remove-error-by-title="emits('remove-error-by-title', $event)"
143
143
  />
@@ -1,288 +1,288 @@
1
- <template>
2
- <div class="migrate-vm">
3
- <atoms-wizard
4
- show
5
- :wizard="wizard"
6
- :selected-scheme="selectedScheme"
7
- :title="title"
8
- :localization="localization"
9
- class="migrate-vm-wizard"
10
- test-id="migrate-vm-wizard"
11
- @change-steps="onChangeSteps"
12
- @hide="onHideModal"
13
- @submit="onFinish"
14
- >
15
- <template #modalBody="{ selectedStep }">
16
- <common-pages-scheduled-tasks-modals-common-new-task-form
17
- v-if="selectedStep.id === 0"
18
- v-model="modelSchedulerTask"
19
- :target="selectedVirtualMachine"
20
- />
21
-
22
- <common-wizards-vm-migrate-select-type
23
- v-if="selectedStep.id === 1"
24
- v-model="form.migrate_type"
25
- :project="props.project"
26
- />
27
-
28
- <common-wizards-vm-migrate-select-target-server
29
- v-if="selectedStep.id === 2"
30
- v-model="form.target_server"
31
- v-model:connect-server="isConnectSourceServer"
32
- :wizard="wizard"
33
- />
34
-
35
- <common-wizards-vm-migrate-select-compute-resource
36
- v-show="selectedStep.id === 3"
37
- v-model="form"
38
- :alert-messages="alertMessages[3]"
39
- :get-compute-resource-data="props.getComputeResourceData"
40
- :compute-resource-data="props.computeResourceTableData"
41
- :compute-resource-tree="props.computeResourceTree"
42
- @hide-alert="onHideAlert"
43
- />
44
-
45
- <common-wizards-vm-migrate-select-storage
46
- v-show="selectedStep.id === 4"
47
- v-model="form"
48
- :alert-messages="alertMessages[4]"
49
- :get-datastore-table-func="props.getDatastoreTableFunc"
50
- :datastore="props.datastore"
51
- :connected-storage-id-default="connectedStorageIdOnVm"
52
- :configure-per-disks="props.configurePerDisks"
53
- @hide-alert="onHideAlert"
54
- />
55
-
56
- <common-wizards-vm-migrate-select-network
57
- v-show="selectedStep.id === 5"
58
- v-model="form.network"
59
- />
60
-
61
- <common-wizards-vm-migrate-select-priority
62
- v-if="selectedStep.id === 6"
63
- v-model="form.vMotion_priority"
64
- />
65
-
66
- <common-ready-to-complete
67
- v-if="selectedStep.id === 7"
68
- :data="dataReadyView"
69
- />
70
- </template>
71
- </atoms-wizard>
72
- </div>
73
- </template>
74
-
75
- <script setup lang="ts">
76
- import type {
77
- UI_I_WizardStep,
78
- UI_I_ValidationReturn,
79
- } from '~/components/atoms/wizard/lib/models/interfaces'
80
- import Wizard from '~/components/atoms/wizard/lib/utils/utils'
81
- import {
82
- stepsFunc,
83
- stepsSchemeInitial,
84
- } from '~/components/common/wizards/vm/migrate/lib/config/steps'
85
- import type { UI_I_Localization } from '~/lib/models/interfaces'
86
- import type { UI_T_Project } from '~/lib/models/types'
87
- import type {
88
- UI_I_MigrateFormLocal,
89
- UI_I_ChangeStepsSchemes,
90
- } from '~/components/common/wizards/vm/migrate/lib/models/interfaces'
91
- import type { UI_T_VmMigrateType } from '~/components/common/wizards/vm/migrate/select/type/lib/models/types'
92
- import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
93
- import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
94
- import type { UI_I_VmSettings } from '~/lib/models/store/vm/interfaces'
95
- import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
96
- import type { UI_I_StorageConfigurePerDiskItem } from '~/components/common/wizards/vm/migrate/select/storage/configure/disk/table/lib/models/interfaces'
97
- import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
98
- import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
99
- import { constructDataReadyViewFunc } from '~/components/common/wizards/vm/migrate/lib/config/constructDataReady'
100
- import * as validation from '~/components/common/wizards/vm/migrate/lib/validations'
101
-
102
- const props = withDefaults(
103
- defineProps<{
104
- project: UI_T_Project
105
- isScheduledTasks: boolean
106
- isEditScheduledTasks: boolean
107
- vmSettings: UI_I_VmSettings | null
108
- vmName: string
109
- getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
110
- getComputeResourceData: (payload: UI_I_TablePayload) => Promise<void>
111
- datastore: UI_I_DatastoreTableItem[]
112
- configurePerDisks: UI_I_StorageConfigurePerDiskItem[]
113
- computeResourceTableData?: any
114
- computeResourceTree?: UI_I_TreeNode | null
115
- selectedVirtualMachine?: string
116
- }>(),
117
- {
118
- computeResourceTree: null,
119
- }
120
- )
121
- const emits = defineEmits<{
122
- (event: 'hide'): void
123
- (event: 'finish', value: UI_I_MigrateFormLocal): void
124
- }>()
125
- const modelSchedulerTask = defineModel<UI_I_ScheduleNewTasksForm>(
126
- 'schedulerForm',
127
- { required: true }
128
- )
129
-
130
- const localization = computed<UI_I_Localization>(() => useLocal())
131
-
132
- const wizard: Wizard = new Wizard(
133
- stepsFunc(localization.value, props.isScheduledTasks),
134
- stepsSchemeInitial
135
- )
136
-
137
- const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
138
- const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
139
-
140
- const title = computed<string>(() => {
141
- const { scheduleNewTasks, scheduleTaskEdit, migrate } =
142
- localization.value.common
143
- let result = migrate
144
- if (props.isScheduledTasks) {
145
- const schedulerMode = props.isEditScheduledTasks
146
- ? scheduleTaskEdit
147
- : scheduleNewTasks
148
-
149
- result = `${schedulerMode} (${migrate})`
150
- }
151
-
152
- return result
153
- })
154
-
155
- const isConnectSourceServer = ref<boolean>(false)
156
- const form = ref<UI_I_MigrateFormLocal>({
157
- migrate_type: props.project === 'procurator' ? 'storage' : 'resource',
158
- disk_format: 0,
159
- storage: null,
160
- configure: {
161
- type: 'batch-configure',
162
- disks: [],
163
- },
164
- target_server: {
165
- fqdn: '',
166
- user: '',
167
- password: '',
168
- },
169
- network: {
170
- data: null,
171
- },
172
- resource: {
173
- selectedNode: null,
174
- host: null,
175
- cluster: null,
176
- resourcePool: null,
177
- vApps: null,
178
- },
179
- vMotion_priority: 'high',
180
- })
181
-
182
- const validationFunc = async (
183
- value: UI_I_WizardStep[],
184
- currentStep: UI_I_WizardStep,
185
- nextStep: UI_I_WizardStep
186
- ): Promise<UI_I_ValidationReturn> => {
187
- let stepHasError = false
188
-
189
- // if (wizard.isValidateForStep(3, currentStep.id, nextStep.id)) {
190
- // const nameValidation = await validation.checkSelectedResourceSync(
191
- // localization.value,
192
- // form.value.resource,
193
- // wizard,
194
- // value
195
- // )
196
- //
197
- // value = nameValidation.newValue
198
- //
199
- // stepHasError = nameValidation.stepHasError
200
- // }
201
-
202
- if (wizard.isValidateForStep(4, currentStep.id, nextStep.id)) {
203
- const nameValidation = await validation.checkSelectedDatastoreSync(
204
- localization.value,
205
- form.value.storage,
206
- wizard,
207
- value
208
- )
209
-
210
- value = nameValidation.newValue
211
-
212
- stepHasError = nameValidation.stepHasError
213
- }
214
-
215
- return {
216
- newValue: value,
217
- stepHasError,
218
- }
219
- }
220
- const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> =>
221
- wizard.changeSteps(value, validationFunc)
222
-
223
- // Choosing Scheme
224
- watch(
225
- () => form.value.migrate_type,
226
- (newValue: UI_T_VmMigrateType) => {
227
- const schemes: UI_I_ChangeStepsSchemes = {
228
- procurator: {
229
- storage: props.isScheduledTasks ? 1 : 0,
230
- },
231
- sphere: {
232
- storage: props.isScheduledTasks ? 1 : 0,
233
- resource: props.isScheduledTasks ? 3 : 2,
234
- 'resource-storage': 2,
235
- server: 3,
236
- },
237
- }
238
-
239
- const projectSchemes = schemes[props.project]
240
-
241
- if (projectSchemes && projectSchemes[newValue] !== undefined) {
242
- wizard.changeScheme(projectSchemes[newValue] as number)
243
- }
244
- },
245
- { deep: true, immediate: true }
246
- )
247
-
248
- watch(
249
- modelSchedulerTask,
250
- (newValue: UI_I_ScheduleNewTasksForm) => {
251
- if (props.isScheduledTasks) wizard.setDisabledNextButton(newValue.isValid)
252
- },
253
- { immediate: true, deep: true }
254
- )
255
-
256
- const loading = ref<boolean>(false)
257
-
258
- const connectedStorageIdOnVm = computed<string>(
259
- () => props.vmSettings?.storage.id || ''
260
- )
261
-
262
- const dataReadyView = computed<UI_I_TableInfoItem>(() =>
263
- constructDataReadyViewFunc(props.vmName, form.value)
264
- )
265
- const onFinish = (): void => {
266
- loading.value = true
267
- emits('finish', form.value)
268
- loading.value = false
269
- }
270
-
271
- const onHideModal = (): void => {
272
- emits('hide')
273
- }
274
-
275
- const onHideAlert = (stepId: number): void => {
276
- wizard.hideAlertMessagesByStepId(stepId)
277
- }
278
- </script>
279
-
280
- <style scoped lang="scss">
281
- @import 'assets/scss/common/mixins.scss';
282
- .migrate-vm {
283
- :deep(.modal-body) {
284
- height: inherit;
285
- @include flex($dir: column);
286
- }
287
- }
288
- </style>
1
+ <template>
2
+ <div class="migrate-vm">
3
+ <atoms-wizard
4
+ show
5
+ :wizard="wizard"
6
+ :selected-scheme="selectedScheme"
7
+ :title="title"
8
+ :localization="localization"
9
+ class="migrate-vm-wizard"
10
+ test-id="migrate-vm-wizard"
11
+ @change-steps="onChangeSteps"
12
+ @hide="onHideModal"
13
+ @submit="onFinish"
14
+ >
15
+ <template #modalBody="{ selectedStep }">
16
+ <common-pages-scheduled-tasks-modals-common-new-task-form
17
+ v-if="selectedStep.id === 0"
18
+ v-model="modelSchedulerTask"
19
+ :target="selectedVirtualMachine"
20
+ />
21
+
22
+ <common-wizards-vm-migrate-select-type
23
+ v-if="selectedStep.id === 1"
24
+ v-model="form.migrate_type"
25
+ :project="props.project"
26
+ />
27
+
28
+ <common-wizards-vm-migrate-select-target-server
29
+ v-if="selectedStep.id === 2"
30
+ v-model="form.target_server"
31
+ v-model:connect-server="isConnectSourceServer"
32
+ :wizard="wizard"
33
+ />
34
+
35
+ <common-wizards-vm-migrate-select-compute-resource
36
+ v-show="selectedStep.id === 3"
37
+ v-model="form"
38
+ :alert-messages="alertMessages[3]"
39
+ :get-compute-resource-data="props.getComputeResourceData"
40
+ :compute-resource-data="props.computeResourceTableData"
41
+ :compute-resource-tree="props.computeResourceTree"
42
+ @hide-alert="onHideAlert"
43
+ />
44
+
45
+ <common-wizards-vm-migrate-select-storage
46
+ v-show="selectedStep.id === 4"
47
+ v-model="form"
48
+ :alert-messages="alertMessages[4]"
49
+ :get-datastore-table-func="props.getDatastoreTableFunc"
50
+ :datastore="props.datastore"
51
+ :connected-storage-id-default="connectedStorageIdOnVm"
52
+ :configure-per-disks="props.configurePerDisks"
53
+ @hide-alert="onHideAlert"
54
+ />
55
+
56
+ <common-wizards-vm-migrate-select-network
57
+ v-show="selectedStep.id === 5"
58
+ v-model="form.network"
59
+ />
60
+
61
+ <common-wizards-vm-migrate-select-priority
62
+ v-if="selectedStep.id === 6"
63
+ v-model="form.vMotion_priority"
64
+ />
65
+
66
+ <common-ready-to-complete
67
+ v-if="selectedStep.id === 7"
68
+ :data="dataReadyView"
69
+ />
70
+ </template>
71
+ </atoms-wizard>
72
+ </div>
73
+ </template>
74
+
75
+ <script setup lang="ts">
76
+ import type {
77
+ UI_I_WizardStep,
78
+ UI_I_ValidationReturn,
79
+ } from '~/components/atoms/wizard/lib/models/interfaces'
80
+ import Wizard from '~/components/atoms/wizard/lib/utils/utils'
81
+ import {
82
+ stepsFunc,
83
+ stepsSchemeInitial,
84
+ } from '~/components/common/wizards/vm/migrate/lib/config/steps'
85
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
86
+ import type { UI_T_Project } from '~/lib/models/types'
87
+ import type {
88
+ UI_I_MigrateFormLocal,
89
+ UI_I_ChangeStepsSchemes,
90
+ } from '~/components/common/wizards/vm/migrate/lib/models/interfaces'
91
+ import type { UI_T_VmMigrateType } from '~/components/common/wizards/vm/migrate/select/type/lib/models/types'
92
+ import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
93
+ import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
94
+ import type { UI_I_VmSettings } from '~/lib/models/store/vm/interfaces'
95
+ import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
96
+ import type { UI_I_StorageConfigurePerDiskItem } from '~/components/common/wizards/vm/migrate/select/storage/configure/disk/table/lib/models/interfaces'
97
+ import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
98
+ import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
99
+ import { constructDataReadyViewFunc } from '~/components/common/wizards/vm/migrate/lib/config/constructDataReady'
100
+ import * as validation from '~/components/common/wizards/vm/migrate/lib/validations'
101
+
102
+ const props = withDefaults(
103
+ defineProps<{
104
+ project: UI_T_Project
105
+ isScheduledTasks: boolean
106
+ isEditScheduledTasks: boolean
107
+ vmSettings: UI_I_VmSettings | null
108
+ vmName: string
109
+ getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
110
+ getComputeResourceData: (payload: UI_I_TablePayload) => Promise<void>
111
+ datastore: UI_I_DatastoreTableItem[]
112
+ configurePerDisks: UI_I_StorageConfigurePerDiskItem[]
113
+ computeResourceTableData?: any
114
+ computeResourceTree?: UI_I_TreeNode | null
115
+ selectedVirtualMachine?: string
116
+ }>(),
117
+ {
118
+ computeResourceTree: null,
119
+ }
120
+ )
121
+ const emits = defineEmits<{
122
+ (event: 'hide'): void
123
+ (event: 'finish', value: UI_I_MigrateFormLocal): void
124
+ }>()
125
+ const modelSchedulerTask = defineModel<UI_I_ScheduleNewTasksForm>(
126
+ 'schedulerForm',
127
+ { required: true }
128
+ )
129
+
130
+ const localization = computed<UI_I_Localization>(() => useLocal())
131
+
132
+ const wizard: Wizard = new Wizard(
133
+ stepsFunc(localization.value, props.isScheduledTasks),
134
+ stepsSchemeInitial
135
+ )
136
+
137
+ const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
138
+ const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
139
+
140
+ const title = computed<string>(() => {
141
+ const { scheduleNewTasks, scheduleTaskEdit, migrate } =
142
+ localization.value.common
143
+ let result = migrate
144
+ if (props.isScheduledTasks) {
145
+ const schedulerMode = props.isEditScheduledTasks
146
+ ? scheduleTaskEdit
147
+ : scheduleNewTasks
148
+
149
+ result = `${schedulerMode} (${migrate})`
150
+ }
151
+
152
+ return result
153
+ })
154
+
155
+ const isConnectSourceServer = ref<boolean>(false)
156
+ const form = ref<UI_I_MigrateFormLocal>({
157
+ migrate_type: props.project === 'procurator' ? 'storage' : 'resource',
158
+ disk_format: 0,
159
+ storage: null,
160
+ configure: {
161
+ type: 'batch-configure',
162
+ disks: [],
163
+ },
164
+ target_server: {
165
+ fqdn: '',
166
+ user: '',
167
+ password: '',
168
+ },
169
+ network: {
170
+ data: null,
171
+ },
172
+ resource: {
173
+ selectedNode: null,
174
+ host: null,
175
+ cluster: null,
176
+ resourcePool: null,
177
+ vApps: null,
178
+ },
179
+ vMotion_priority: 'high',
180
+ })
181
+
182
+ const validationFunc = async (
183
+ value: UI_I_WizardStep[],
184
+ currentStep: UI_I_WizardStep,
185
+ nextStep: UI_I_WizardStep
186
+ ): Promise<UI_I_ValidationReturn> => {
187
+ let stepHasError = false
188
+
189
+ if (wizard.isValidateForStep(3, currentStep.id, nextStep.id)) {
190
+ const nameValidation = await validation.checkSelectedResourceSync(
191
+ localization.value,
192
+ form.value.resource,
193
+ wizard,
194
+ value
195
+ )
196
+
197
+ value = nameValidation.newValue
198
+
199
+ stepHasError = nameValidation.stepHasError
200
+ }
201
+
202
+ if (wizard.isValidateForStep(4, currentStep.id, nextStep.id)) {
203
+ const nameValidation = await validation.checkSelectedDatastoreSync(
204
+ localization.value,
205
+ form.value.storage,
206
+ wizard,
207
+ value
208
+ )
209
+
210
+ value = nameValidation.newValue
211
+
212
+ stepHasError = nameValidation.stepHasError
213
+ }
214
+
215
+ return {
216
+ newValue: value,
217
+ stepHasError,
218
+ }
219
+ }
220
+ const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> =>
221
+ wizard.changeSteps(value, validationFunc)
222
+
223
+ // Choosing Scheme
224
+ watch(
225
+ () => form.value.migrate_type,
226
+ (newValue: UI_T_VmMigrateType) => {
227
+ const schemes: UI_I_ChangeStepsSchemes = {
228
+ procurator: {
229
+ storage: props.isScheduledTasks ? 1 : 0,
230
+ },
231
+ sphere: {
232
+ storage: props.isScheduledTasks ? 1 : 0,
233
+ resource: props.isScheduledTasks ? 3 : 2,
234
+ 'resource-storage': 2,
235
+ server: 3,
236
+ },
237
+ }
238
+
239
+ const projectSchemes = schemes[props.project]
240
+
241
+ if (projectSchemes && projectSchemes[newValue] !== undefined) {
242
+ wizard.changeScheme(projectSchemes[newValue] as number)
243
+ }
244
+ },
245
+ { deep: true, immediate: true }
246
+ )
247
+
248
+ watch(
249
+ modelSchedulerTask,
250
+ (newValue: UI_I_ScheduleNewTasksForm) => {
251
+ if (props.isScheduledTasks) wizard.setDisabledNextButton(newValue.isValid)
252
+ },
253
+ { immediate: true, deep: true }
254
+ )
255
+
256
+ const loading = ref<boolean>(false)
257
+
258
+ const connectedStorageIdOnVm = computed<string>(
259
+ () => props.vmSettings?.storage.id || ''
260
+ )
261
+
262
+ const dataReadyView = computed<UI_I_TableInfoItem>(() =>
263
+ constructDataReadyViewFunc(props.vmName, form.value)
264
+ )
265
+ const onFinish = (): void => {
266
+ loading.value = true
267
+ emits('finish', form.value)
268
+ loading.value = false
269
+ }
270
+
271
+ const onHideModal = (): void => {
272
+ emits('hide')
273
+ }
274
+
275
+ const onHideAlert = (stepId: number): void => {
276
+ wizard.hideAlertMessagesByStepId(stepId)
277
+ }
278
+ </script>
279
+
280
+ <style scoped lang="scss">
281
+ @import 'assets/scss/common/mixins.scss';
282
+ .migrate-vm {
283
+ :deep(.modal-body) {
284
+ height: inherit;
285
+ @include flex($dir: column);
286
+ }
287
+ }
288
+ </style>
@@ -53,9 +53,9 @@ import type { UI_I_CollapseNavItem } from '~/components/atoms/collapse/lib/model
53
53
  import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
54
54
  import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
55
55
  import type { UI_T_SelectComputeResourceTabType } from '~/components/common/wizards/vm/migrate/select/storage/lib/models/types'
56
- import type { UI_E_ComputeResourceTabKamelKeys } from '~/components/common/wizards/vm/migrate/select/computeResource/lib/models/enums'
57
56
  import type { UI_I_MigrateFormLocal } from '~/components/common/wizards/vm/migrate/lib/models/interfaces'
58
57
  import type { UI_I_SelectedTableDataKeys } from '~/components/common/wizards/vm/migrate/select/computeResource/lib/models/interfaces'
58
+ import { UI_E_ComputeResourceTabKamelKeys } from '~/components/common/wizards/vm/migrate/select/computeResource/lib/models/enums'
59
59
  import { vmMigrateComputeResourceTabsFunc } from '~/components/common/wizards/vm/migrate/select/computeResource/lib/config/tabsPannel'
60
60
 
61
61
  const props = defineProps<{
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.4.786",
4
+ "version": "1.4.787",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",