bfg-common 1.4.66 → 1.4.68

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.
@@ -234,8 +234,8 @@ const localization = computed<UI_I_Localization>(() => useLocal())
234
234
 
235
235
  watch(
236
236
  () => props.capabilities,
237
- (newValue) => {
238
- if (newValue) mapCapabilities(props.capabilities)
237
+ () => {
238
+ if (props.capabilities) mapCapabilities(props.capabilities)
239
239
  },
240
240
  { deep: true, immediate: true }
241
241
  )
@@ -36,6 +36,7 @@
36
36
  :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
37
37
  :passthrough-devices="props.passthroughDevices"
38
38
  :project="props.project"
39
+ :guest-machine-type="guestMachineTypeLocal"
39
40
  @send-data="onSendDataVirtualHardwareMethod"
40
41
  @get-storage="emits('get-storage', $event)"
41
42
  @get-folders-or-files="emits('get-folders-or-files', $event)"
@@ -45,6 +45,7 @@
45
45
  :datastore="props.datastore"
46
46
  :is-edit="props.isEdit"
47
47
  :state="props.state"
48
+ :guest-machine-type="props.guestMachineType"
48
49
  @remove="onRemoveHardDisk(hardDisksIndex[key], item)"
49
50
  @roll-back="onRollBackHardDisk(hardDisksIndex[key])"
50
51
  @send-data="onSendDataNewHardDiskMethod($event, hardDisksIndex[key])"
@@ -80,6 +81,7 @@
80
81
  :error-validation-fields="props.errorValidationFields"
81
82
  :is-edit="props.isEdit"
82
83
  :state="props.state"
84
+ :guest-machine-type="props.guestMachineType"
83
85
  @remove-error-by-title="emits('remove-error-by-title', $event)"
84
86
  @get-storage="emits('get-storage', $event)"
85
87
  @get-folders-or-files="emits('get-folders-or-files', $event)"
@@ -210,6 +212,7 @@ const props = defineProps<{
210
212
  pciDevices?: UI_I_SendDataNewPciDevice[]
211
213
  passthroughDevices?: UI_I_PciDevice[]
212
214
  project: UI_T_Project
215
+ guestMachineType?: UI_I_OptionItem | null
213
216
  }>()
214
217
  const emits = defineEmits<{
215
218
  (event: 'send-data', value: UI_I_SendDataVirtualHardware): void
@@ -83,6 +83,7 @@ const props = defineProps<{
83
83
  disabled?: boolean
84
84
  shortOptions?: boolean
85
85
  helpText?: string
86
+ guestMachineType?: UI_I_OptionItem | null
86
87
  }>()
87
88
  const emits = defineEmits<{
88
89
  (event: 'update:bus', value: string): void
@@ -91,7 +92,9 @@ const emits = defineEmits<{
91
92
 
92
93
  const helpId = ref<string>(`bus-field-help-icon${useUniqueId()}`)
93
94
 
94
- const busOptions = computed<UI_I_OptionItem[]>(() => capabilities.bus)
95
+ const busOptions = computed<UI_I_OptionItem[]>(() =>
96
+ props.guestMachineType ? capabilities.bus[props.guestMachineType.value] : []
97
+ )
95
98
 
96
99
  const busLocal = computed<string>({
97
100
  get() {
@@ -80,6 +80,7 @@
80
80
  :test-id="`vm-wizard-cd-dvd-bus-field-${props.index}`"
81
81
  short-options
82
82
  component-type="disk_devices"
83
+ :guest-machine-type="props.guestMachineType"
83
84
  @remove-error-by-title="emits('remove-error-by-title', $event)"
84
85
  />
85
86
  </template>
@@ -129,6 +130,7 @@ const props = defineProps<{
129
130
  type: UI_T_CdDvdType
130
131
  isEdit: boolean
131
132
  state?: string | number
133
+ guestMachineType?: UI_I_OptionItem | null
132
134
  }>()
133
135
 
134
136
  const emits = defineEmits<{
@@ -162,6 +162,7 @@
162
162
  :help-text="localization.common.busVirtioHelpDesc"
163
163
  :test-id="`vm-wizard-disk-bus-field-${props.index}`"
164
164
  component-type="disk_devices"
165
+ :guest-machine-type="props.guestMachineType"
165
166
  @remove-error-by-title="emits('remove-error-by-title', $event)"
166
167
  />
167
168
  </template>
@@ -192,6 +193,7 @@ const props = defineProps<{
192
193
  datastore: UI_I_DatastoreTableItem[]
193
194
  isEdit: boolean
194
195
  state?: string | number
196
+ guestMachineType?: UI_I_OptionItem | null
195
197
  }>()
196
198
  const emits = defineEmits<{
197
199
  (event: 'send-data', value: UI_I_SendDataNewHardDisk): void
@@ -338,7 +338,7 @@ export const capabilities: UI_I_Compatibility = {
338
338
  },
339
339
  ],
340
340
  },
341
- bus: [],
341
+ bus: {},
342
342
  maxCpus: 140,
343
343
  maxMemory: 262144, // 256 GB
344
344
  }
@@ -27,20 +27,17 @@ export const mapCapabilities = (
27
27
  }
28
28
  )
29
29
 
30
+ Object.keys(capabilitiesFromApi.bus_types).forEach(key => {
31
+ capabilities.bus[key] = Object.keys(capabilitiesFromApi.bus_types[key]).map(
32
+ (key2) => {
33
+ return {
34
+ text: capabilitiesFromApi.bus_types[key][key2],
35
+ value: key2,
36
+ }
37
+ }
38
+ )
39
+ })
40
+
30
41
  capabilities.maxCpus = capabilitiesFromApi.max_vcpus
31
42
  capabilities.maxMemory = $binary.kbToMb(capabilitiesFromApi.max_mem_kib)
32
43
  }
33
-
34
- export const mapCapabilitiesBus = (machineType: string): void => {
35
- if (capabilities.dataFromApi) {
36
- const buseType = capabilities.dataFromApi.bus_types[machineType]
37
- capabilities.bus = Object.keys(buseType).map(
38
- (key) => {
39
- return {
40
- text: buseType[key],
41
- value: key,
42
- }
43
- }
44
- )
45
- }
46
- }
@@ -28,7 +28,7 @@ export interface UI_I_Compatibility {
28
28
  guestOsVersions: UI_I_ArbitraryObject<UI_I_OptionItem[]>
29
29
  machineTypes: UI_I_OptionItem[]
30
30
  cpuModels: UI_I_OptionItem[]
31
- bus: UI_I_OptionItem[]
31
+ bus: UI_I_ArbitraryObject<UI_I_OptionItem[]>
32
32
  maxCpus: number
33
33
  maxMemory: number
34
34
  dataFromApi?: UI_I_Capabilities
@@ -98,7 +98,6 @@ import type {
98
98
  } from '~/lib/models/interfaces'
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
- import { mapCapabilitiesBus } from '~/components/common/vm/actions/common/lib/utils/capabilities'
102
101
 
103
102
  const props = defineProps<{
104
103
  familiesOptions: UI_I_OptionItem[]
@@ -122,13 +121,6 @@ watch(
122
121
  },
123
122
  { immediate: true }
124
123
  )
125
- watch(
126
- selectedMachineType,
127
- (newValue) => {
128
- newValue && mapCapabilitiesBus(newValue.value)
129
- },
130
- { immediate: true, deep: true }
131
- )
132
124
 
133
125
  const osOptions = ref<UI_I_OptionItem[]>(props.familiesOptions)
134
126
  const selectedOS = ref<UI_I_OptionItem | null>(null)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.4.66",
4
+ "version": "1.4.68",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",
@@ -16,7 +16,7 @@
16
16
  "@vueuse/core": "^10.1.2",
17
17
  "@vueuse/nuxt": "^10.1.2",
18
18
  "eslint-config-prettier": "^8.5.0",
19
- "nuxt": "3.11.2",
19
+ "nuxt": "3.13.1",
20
20
  "prettier": "2.7.1",
21
21
  "sass": "^1.54.9",
22
22
  "sass-loader": "^10.3.1",