bfg-common 1.5.38 → 1.5.39

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.
@@ -81,11 +81,13 @@
81
81
  selectedStep.id === dynamicSteps.selectGuestOSMachineType ||
82
82
  selectedStep.id === dynamicSteps.selectGuestOS
83
83
  "
84
+ v-model:machine-type="vmForm.guestMachineType"
85
+ v-model:guest-os-family="vmForm.guestOsFamily"
86
+ v-model:guest-os-version="vmForm.guestOsVersion"
84
87
  :families-options="guestOsFamilies"
85
88
  :versions-options="guestOsVersions"
86
89
  :machine-types-options="machineTypes"
87
90
  :error-validation-fields="props.errorValidationFields"
88
- @change="onChangeOs"
89
91
  @remove-error-by-title="emits('remove-error-by-title', $event)"
90
92
  />
91
93
  <common-vm-actions-common-customize-hardware
@@ -594,11 +596,6 @@ const onChangeCompatibility = (compatibility: UI_I_OptionItem): void => {
594
596
  const version = compatibility.value.split('-')[1]
595
597
  compatibilityInfo.value = `${localization.value.common.compatibility}: ${compatibility.text} (${localization.value.common.vmVersion} ${version})`
596
598
  }
597
- const onChangeOs = (data: UI_I_OsChange): void => {
598
- vmForm.value.guestMachineType = data.selectedMachineType
599
- vmForm.value.guestOsFamily = data.selectedOS
600
- vmForm.value.guestOsVersion = data.selectedVersion
601
- }
602
599
  const customizeHardware = ref<UI_I_SendDataCustomizeHardware | null>(null)
603
600
  const onChangeCustomizeHardware = (
604
601
  data: UI_I_SendDataCustomizeHardware
@@ -39,6 +39,17 @@
39
39
  v-show="selectedStep.id === dynamicSteps.selectOptions"
40
40
  @change="onChangeSelectOptions"
41
41
  />
42
+ <common-vm-actions-common-select-os
43
+ v-show="selectedStep.id === dynamicSteps.selectGuestOSMachineType"
44
+ v-model:machine-type="guestMachineType"
45
+ v-model:guest-os-family="guestOsFamily"
46
+ v-model:guest-os-version="guestOsVersion"
47
+ :families-options="guestOsFamilies"
48
+ :versions-options="guestOsVersions"
49
+ :machine-types-options="machineTypes"
50
+ :error-validation-fields="props.errorValidationFields"
51
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
52
+ />
42
53
  <common-vm-actions-common-customize-hardware
43
54
  v-show="selectedStep.id === dynamicSteps.customizeHardware"
44
55
  v-model:vm-name="vmName"
@@ -103,7 +114,10 @@ import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interface
103
114
  import type { API_UI_I_Error } from '~/lib/models/store/interfaces'
104
115
  import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
105
116
  import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
106
- import type { UI_I_Localization } from '~/lib/models/interfaces'
117
+ import type {
118
+ UI_I_ArbitraryObject,
119
+ UI_I_Localization,
120
+ } from '~/lib/models/interfaces'
107
121
  import type { UI_I_SendDataCustomizeHardware } from '~/components/common/vm/actions/common/customizeHardware/lib/models/interfaces'
108
122
  import type { UI_I_ErrorValidationField } from '~/lib/models/store/interfaces'
109
123
  import type {
@@ -132,6 +146,7 @@ import type {
132
146
  } from '~/components/atoms/wizard/lib/models/interfaces'
133
147
  import type { UI_I_Capabilities } from '~/components/common/vm/actions/common/lib/models/interfaces'
134
148
  import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
149
+ import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
135
150
  import {
136
151
  stepsSchemeInitial,
137
152
  stepsFunc,
@@ -140,6 +155,7 @@ import {
140
155
  import Wizard from '~/components/atoms/wizard/lib/utils/utils'
141
156
  import { mapCapabilities } from '~/components/common/vm/actions/common/lib/utils/capabilities'
142
157
  import { scheduledTaskDefaultFormFunc } from '~/components/common/pages/scheduledTasks/modals/lib/config/createScheduledTask'
158
+ import { capabilities } from '~/components/common/vm/actions/common/lib/config/capabilities'
143
159
 
144
160
  const props = defineProps<{
145
161
  project: UI_T_Project
@@ -199,7 +215,9 @@ const title = computed<string>(() => {
199
215
  watch(
200
216
  () => props.capabilities,
201
217
  () => {
202
- if (props.capabilities) mapCapabilities(props.capabilities)
218
+ if (props.capabilities) {
219
+ mapCapabilities(props.capabilities)
220
+ }
203
221
  },
204
222
  { deep: true, immediate: true }
205
223
  )
@@ -518,8 +536,23 @@ const customizeHardwareSubmit = ref<null | Function>(null)
518
536
 
519
537
  const vmSettings = computed<UI_I_VmSettings | null>(() => props.vmSettings)
520
538
  const vmName = ref<string>(vmSettings.value?.name || '')
539
+
540
+ const guestMachineType = ref<UI_I_OptionItem | null>(null)
541
+ const guestOsFamily = ref<UI_I_OptionItem | null>(null)
542
+ const guestOsVersion = ref<UI_I_OptionItem | null>(null)
543
+
544
+ const guestOsFamilies = ref<UI_I_OptionItem[]>(capabilities.guestOsFamilies)
545
+ const guestOsVersions = ref<UI_I_ArbitraryObject<UI_I_OptionItem[]>>(
546
+ capabilities.guestOsVersions
547
+ )
548
+ const machineTypes = ref<UI_I_OptionItem[]>(capabilities.machineTypes)
549
+
521
550
  watch(vmSettings, (newValue) => {
522
551
  vmName.value = newValue?.name || ''
552
+
553
+ if (newValue?.guestOsFamily) guestOsFamily.value = newValue.guestOsFamily
554
+ if (newValue?.guestMachineType) guestMachineType.value = newValue.guestMachineType
555
+ if (newValue?.guestOsVersion) guestOsVersion.value = newValue.guestOsVersion
523
556
  })
524
557
 
525
558
  const onHideModal = (): void => {
@@ -16,7 +16,7 @@
16
16
  <template #elem>
17
17
  <select
18
18
  id="vm-wizard-machine-type-select"
19
- v-model="selectedMachineType"
19
+ v-model="machineType"
20
20
  data-id="vm-wizard-machine-type-select"
21
21
  class="table-cell"
22
22
  >
@@ -45,7 +45,7 @@
45
45
  <template #elem>
46
46
  <select
47
47
  id="vm-wizard-os-select"
48
- v-model="selectedOS"
48
+ v-model="guestOsFamily"
49
49
  data-id="vm-wizard-os-select"
50
50
  class="table-cell"
51
51
  @change="onChangeOS"
@@ -71,7 +71,7 @@
71
71
  <template #elem>
72
72
  <select
73
73
  id="vm-wizard-os-version-select"
74
- v-model="selectedVersion"
74
+ v-model="guestOsVersion"
75
75
  data-id="vm-wizard-os-version-select"
76
76
  class="table-cell"
77
77
  >
@@ -99,6 +99,10 @@ import type {
99
99
  import type { UI_I_ErrorValidationField } from '~/lib/models/store/interfaces'
100
100
  import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
101
101
 
102
+ const machineType = defineModel<UI_I_OptionItem | null>('machine-type', {required: true})
103
+ const guestOsFamily = defineModel<UI_I_OptionItem | null>('guest-os-family', {required: true})
104
+ const guestOsVersion = defineModel<UI_I_OptionItem | null>('guest-os-version', {required: true})
105
+
102
106
  const props = defineProps<{
103
107
  familiesOptions: UI_I_OptionItem[]
104
108
  machineTypesOptions: UI_I_OptionItem[]
@@ -106,70 +110,52 @@ const props = defineProps<{
106
110
  errorValidationFields: UI_I_ErrorValidationField[]
107
111
  }>()
108
112
  const emits = defineEmits<{
109
- (event: 'change', value: UI_I_OsChange): void
110
113
  (event: 'remove-error-by-title', value: string): void
111
114
  }>()
112
115
  const localization = computed<UI_I_Localization>(() => useLocal())
113
116
 
114
117
  const machineTypeOptions = ref<UI_I_OptionItem[]>(props.machineTypesOptions)
115
- const selectedMachineType = ref<UI_I_OptionItem | null>(null)
116
118
  watch(
117
119
  () => props.machineTypesOptions,
118
120
  (newValue) => {
119
121
  machineTypeOptions.value = [...newValue]
122
+ if (machineType.value) return
123
+
120
124
  const q35MachineIndex = newValue.findIndex(item => item.value.toLowerCase().includes('q35'))
121
125
  if (q35MachineIndex === -1) {
122
- selectedMachineType.value = newValue[0]
126
+ machineType.value = newValue[0]
123
127
  } else {
124
- selectedMachineType.value = newValue[q35MachineIndex]
128
+ machineType.value = newValue[q35MachineIndex]
125
129
  }
126
130
  },
127
131
  { immediate: true }
128
132
  )
129
133
 
130
134
  const osOptions = ref<UI_I_OptionItem[]>(props.familiesOptions)
131
- const selectedOS = ref<UI_I_OptionItem | null>(null)
132
135
  watch(
133
136
  () => props.familiesOptions,
134
137
  (newValue) => {
135
138
  osOptions.value = [...newValue]
136
- selectedOS.value = newValue[0]
139
+ if (guestOsFamily.value) return
140
+ guestOsFamily.value = newValue[0]
137
141
  },
138
142
  { immediate: true }
139
143
  )
140
144
  const onChangeOS = (): void => {
141
- selectedVersion.value = versionsOptions.value[0]
145
+ guestOsVersion.value = versionsOptions.value[0]
142
146
  }
143
147
 
144
148
  const versionsOptions = computed<UI_I_OptionItem[]>(() => {
145
- if (!selectedOS.value) return []
149
+ if (!guestOsFamily.value) return []
146
150
 
147
- return props.versionsOptions[selectedOS.value.value] || []
151
+ return props.versionsOptions[guestOsFamily.value.value] || []
148
152
  })
149
- const selectedVersion = ref<UI_I_OptionItem | null>(null)
150
153
  watch(
151
154
  versionsOptions,
152
155
  () => {
153
- selectedVersion.value = versionsOptions.value[0]
154
- },
155
- { immediate: true }
156
- )
156
+ if (guestOsVersion.value) return
157
157
 
158
- const windowsVirtualization = ref<boolean>(false)
159
-
160
- // const isShowHelp = ref<boolean>(false)
161
-
162
- watch(
163
- [selectedMachineType, selectedOS, selectedVersion, windowsVirtualization],
164
- () => {
165
- if (!selectedOS.value) return
166
-
167
- emits('change', {
168
- selectedMachineType: selectedMachineType.value,
169
- selectedOS: selectedOS.value,
170
- selectedVersion: selectedVersion.value,
171
- windowsVirtualization: windowsVirtualization.value,
172
- })
158
+ guestOsVersion.value = versionsOptions.value[0]
173
159
  },
174
160
  { immediate: true }
175
161
  )
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.5.38",
4
+ "version": "1.5.39",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",