bfg-common 1.3.111 → 1.3.113

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.
@@ -15,6 +15,7 @@
15
15
  v-for="(item2, key2) in item.children"
16
16
  :id="`${props.testId}-item-${key}-${key2}`"
17
17
  :key="key2"
18
+ :disabled="item2.disabled"
18
19
  class="btn dropdown-item"
19
20
  @click="select(item2)"
20
21
  >
@@ -1,6 +1,7 @@
1
1
  export interface UI_I_DropdownTreeItemChild {
2
2
  text: string
3
3
  value: number
4
+ disabled?: boolean
4
5
  }
5
6
 
6
7
  export interface UI_I_DropdownTreeItem {
@@ -104,6 +104,8 @@
104
104
  :error-validation-fields="props.errorValidationFields"
105
105
  :passthrough-devices="props.passthroughDevices"
106
106
  :type="pciDevicesType[key]"
107
+ :is-edit="props.isEdit"
108
+ :state="props.state"
107
109
  @remove="onRemovePciDevice(pciDevicesIndex[key])"
108
110
  @send-data="
109
111
  onSendDataPciDevicesMethod($event, pciDevicesIndex[key])
@@ -222,7 +224,7 @@ const localization = computed<UI_I_Localization>(() => useLocal())
222
224
  const { $binary } = useNuxtApp()
223
225
 
224
226
  const dropdownItems = computed<UI_I_DropdownTreeItem[]>(() =>
225
- dropdownItemsFunc(localization.value)
227
+ dropdownItemsFunc(localization.value, props.state)
226
228
  )
227
229
 
228
230
  const hardDisksIndex = ref<number[]>([0])
@@ -2,7 +2,8 @@ import { UI_I_Localization } from '~/lib/models/interfaces'
2
2
  import { UI_I_DropdownTreeItem } from '~/components/atoms/dropdown/tree/lib/models/interfaces'
3
3
 
4
4
  export const dropdownItemsFunc = (
5
- localization: UI_I_Localization
5
+ localization: UI_I_Localization,
6
+ state: string | number | undefined
6
7
  ): UI_I_DropdownTreeItem[] => {
7
8
  const { $text } = useNuxtApp()
8
9
 
@@ -33,7 +34,7 @@ export const dropdownItemsFunc = (
33
34
  {
34
35
  text: 'Other Devices',
35
36
  children: [
36
- { text: 'PCI Device', value: 10 },
37
+ { text: 'PCI Device', value: 10, disabled: state === 2 },
37
38
  // { text: 'Watchdog Timer', value: 11 },
38
39
  // { text: 'Precision Clock', value: 12 },
39
40
  // { text: 'Serial Port', value: 13 },
@@ -1,157 +1,171 @@
1
- <template>
2
- <div class="hardware-pci-device">
3
- <atoms-stack-block :has-children="true" removable @remove="removePciDevice">
4
- <template #stackBlockKey>
5
- <div class="flex-align-center">
6
- <span>{{ label }}</span>
7
- </div>
8
- </template>
9
- <template #stackBlockContent>
10
- <span class="main-label">
11
- {{ selectedLabel }}
12
- </span>
13
- </template>
14
- <template #stackChildren>
15
- <template v-if="props.type === 'new'">
16
- <common-vm-actions-common-customize-hardware-virtual-hardware-new-pci-device-type-selection
17
- v-model="selectedType"
18
- :options="pciDeviceTypeOptions"
19
- :pci-device-index="props.index"
20
- />
21
-
22
- <common-vm-actions-common-customize-hardware-virtual-hardware-new-pci-device-direct-path-io
23
- v-show="selectedType.value === 'direct_path_io'"
24
- v-model="directPathIo"
25
- :pci-device-index="props.index"
26
- :passthrough-devices="props.passthroughDevices"
27
- />
28
- <common-vm-actions-common-customize-hardware-virtual-hardware-new-pci-device-dynamic-direct-path-io
29
- v-show="selectedType.value === 'dynamic_direct_path_io'"
30
- v-model="dynamicDirectPathIo"
31
- :pci-device-index="props.index"
32
- :passthrough-devices="props.passthroughDevices"
33
- />
34
- <common-vm-actions-common-customize-hardware-virtual-hardware-new-pci-device-nvidia-grid
35
- v-show="selectedType.value === 'nvidia_grid'"
36
- v-model="nvidiaGridProfile"
37
- :pci-device-index="props.index"
38
- />
39
- </template>
40
-
41
- <common-vm-actions-common-customize-hardware-virtual-hardware-new-pci-device-note />
42
- </template>
43
- </atoms-stack-block>
44
- </div>
45
- </template>
46
-
47
- <script setup lang="ts">
48
- import { UI_I_Localization } from '~/lib/models/interfaces'
49
- import { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
50
- import {
51
- UI_I_ConfigureAllPciDevicesItem,
52
- UI_I_ConfigurePciDevicesTable,
53
- } from '~/lib/models/store/host/interfaces'
54
- import {
55
- UI_I_PciDevice,
56
- UI_I_SendDataNewPciDevice,
57
- } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
58
- import { UI_T_PciDeviceType } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/types'
59
- import { pciDeviceTypeOptionsConfig } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/lib/config/options'
60
-
61
- const props = defineProps<{
62
- index: number
63
- pciDevice: UI_I_PciDevice
64
- passthroughDevices: UI_I_ConfigurePciDevicesTable
65
- type: UI_T_PciDeviceType
66
- // isEdit: boolean
67
- // errorValidationFields: UI_I_ErrorValidationField<string>[]
68
- }>()
69
- const emits = defineEmits<{
70
- (event: 'send-data', value: UI_I_SendDataNewPciDevice): void
71
- (event: 'remove'): void
72
- }>()
73
-
74
- const localization = computed<UI_I_Localization>(() => useLocal())
75
-
76
- const label = computed<string>(() => {
77
- if (props.type === 'edit')
78
- return `${localization.value.newPciDevice} ${props.index + 1}`
79
-
80
- return `${localization.value.pciDevice} *`
81
- })
82
-
83
- const selectedLabel = computed<string>(() => {
84
- switch (selectedType.value.value) {
85
- case 'direct_path_io':
86
- return `${directPathIo.value.id}|${directPathIo.value.device_name}`
87
- case 'dynamic_direct_path_io':
88
- return dynamicDirectPathIo.value
89
- default:
90
- return nvidiaGridProfile.value
91
- }
92
- })
93
-
94
- const pciDeviceTypeOptions = ref<UI_I_OptionItem[]>(pciDeviceTypeOptionsConfig)
95
- const selectedType = ref<UI_I_OptionItem>(pciDeviceTypeOptionsConfig[0])
96
-
97
- const directPathIo = ref<UI_I_ConfigureAllPciDevicesItem>(
98
- props.passthroughDevices[0]
99
- )
100
- const dynamicDirectPathIo = ref<string>('')
101
- const nvidiaGridProfile = ref<string>('')
102
-
103
- watch(
104
- props.pciDevice,
105
- (newValue) => {
106
- const passthroughDevice = props.passthroughDevices.find(
107
- (item) => item.id === newValue.id
108
- )
109
- passthroughDevice && (directPathIo.value = passthroughDevice) // Todo change
110
- },
111
- { immediate: true }
112
- )
113
-
114
- const sendData = computed<UI_I_SendDataNewPciDevice>(() => {
115
- switch (selectedType.value.value) {
116
- case 'direct_path_io':
117
- return {
118
- address: directPathIo.value.address,
119
- vendor_name: directPathIo.value.vendor_name,
120
- class_name: directPathIo.value.class_name,
121
- device_name: directPathIo.value.device_name,
122
- }
123
- case 'dynamic_direct_path_io':
124
- return {
125
- address: '',
126
- vendor_name: '',
127
- class_name: '',
128
- device_name: '',
129
- }
130
- default:
131
- return {
132
- address: '',
133
- vendor_name: '',
134
- class_name: '',
135
- device_name: '',
136
- }
137
- }
138
- })
139
-
140
- watch(
141
- sendData,
142
- (newValue) => {
143
- emits('send-data', newValue)
144
- },
145
- { immediate: true }
146
- )
147
-
148
- const removePciDevice = (): void => {
149
- emits('remove')
150
- }
151
- </script>
152
-
153
- <style scoped lang="scss">
154
- #network-connect {
155
- margin-right: 4px;
156
- }
157
- </style>
1
+ <template>
2
+ <div class="hardware-pci-device">
3
+ <atoms-stack-block
4
+ :has-children="true"
5
+ :removable="isRemovable"
6
+ @remove="removePciDevice"
7
+ >
8
+ <template #stackBlockKey>
9
+ <div class="flex-align-center">
10
+ <span>{{ label }}</span>
11
+ </div>
12
+ </template>
13
+ <template #stackBlockContent>
14
+ <span class="main-label">
15
+ {{ selectedLabel }}
16
+ </span>
17
+ </template>
18
+ <template #stackChildren>
19
+ <!-- <template v-if="props.type === 'new'">-->
20
+ <template v-if="props.state !== 2">
21
+ <common-vm-actions-common-customize-hardware-virtual-hardware-new-pci-device-type-selection
22
+ v-model="selectedType"
23
+ :options="pciDeviceTypeOptions"
24
+ :pci-device-index="props.index"
25
+ />
26
+
27
+ <common-vm-actions-common-customize-hardware-virtual-hardware-new-pci-device-direct-path-io
28
+ v-show="selectedType.value === 'direct_path_io'"
29
+ v-model="directPathIo"
30
+ :pci-device-index="props.index"
31
+ :passthrough-devices="props.passthroughDevices"
32
+ />
33
+ <common-vm-actions-common-customize-hardware-virtual-hardware-new-pci-device-dynamic-direct-path-io
34
+ v-show="selectedType.value === 'dynamic_direct_path_io'"
35
+ v-model="dynamicDirectPathIo"
36
+ :pci-device-index="props.index"
37
+ :passthrough-devices="props.passthroughDevices"
38
+ />
39
+ <common-vm-actions-common-customize-hardware-virtual-hardware-new-pci-device-nvidia-grid
40
+ v-show="selectedType.value === 'nvidia_grid'"
41
+ v-model="nvidiaGridProfile"
42
+ :pci-device-index="props.index"
43
+ />
44
+ </template>
45
+
46
+ <common-vm-actions-common-customize-hardware-virtual-hardware-new-pci-device-note />
47
+ </template>
48
+ </atoms-stack-block>
49
+ </div>
50
+ </template>
51
+
52
+ <script setup lang="ts">
53
+ import { UI_I_Localization } from '~/lib/models/interfaces'
54
+ import { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
55
+ import {
56
+ UI_I_ConfigureAllPciDevicesItem,
57
+ UI_I_ConfigurePciDevicesTable,
58
+ } from '~/lib/models/store/host/interfaces'
59
+ import {
60
+ UI_I_PciDevice,
61
+ UI_I_SendDataNewPciDevice,
62
+ } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
63
+ import { UI_T_PciDeviceType } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/types'
64
+ import { pciDeviceTypeOptionsConfig } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/lib/config/options'
65
+
66
+ const props = defineProps<{
67
+ index: number
68
+ pciDevice: UI_I_PciDevice
69
+ passthroughDevices: UI_I_ConfigurePciDevicesTable
70
+ type: UI_T_PciDeviceType
71
+ isEdit: boolean
72
+ state?: string | number
73
+ // errorValidationFields: UI_I_ErrorValidationField<string>[]
74
+ }>()
75
+ const emits = defineEmits<{
76
+ (event: 'send-data', value: UI_I_SendDataNewPciDevice): void
77
+ (event: 'remove'): void
78
+ }>()
79
+
80
+ const localization = computed<UI_I_Localization>(() => useLocal())
81
+
82
+ const isRunning = computed<boolean>(() => {
83
+ return props.state === 2
84
+ })
85
+
86
+ const isRemovable = computed<boolean>(() => {
87
+ return !props.isEdit || !isRunning.value
88
+ })
89
+
90
+ const label = computed<string>(() => {
91
+ if (props.type === 'edit')
92
+ return `${localization.value.newPciDevice} ${props.index + 1}`
93
+
94
+ return `${localization.value.pciDevice} *`
95
+ })
96
+
97
+ const selectedLabel = computed<string>(() => {
98
+ switch (selectedType.value.value) {
99
+ case 'direct_path_io':
100
+ return `${directPathIo.value.address}|${directPathIo.value.device_name}`
101
+ case 'dynamic_direct_path_io':
102
+ return dynamicDirectPathIo.value
103
+ default:
104
+ return nvidiaGridProfile.value
105
+ }
106
+ })
107
+
108
+ const pciDeviceTypeOptions = ref<UI_I_OptionItem[]>(pciDeviceTypeOptionsConfig)
109
+ const selectedType = ref<UI_I_OptionItem>(pciDeviceTypeOptionsConfig[0])
110
+
111
+ const directPathIo = ref<UI_I_ConfigureAllPciDevicesItem>(
112
+ props.passthroughDevices[0]
113
+ )
114
+ const dynamicDirectPathIo = ref<string>('')
115
+ const nvidiaGridProfile = ref<string>('')
116
+
117
+ watch(
118
+ props.pciDevice,
119
+ (newValue) => {
120
+ const passthroughDevice = props.passthroughDevices.find(
121
+ (item) => item.address === newValue.address
122
+ )
123
+ passthroughDevice && (directPathIo.value = passthroughDevice) // Todo change
124
+ },
125
+ { immediate: true }
126
+ )
127
+
128
+ const sendData = computed<UI_I_SendDataNewPciDevice>(() => {
129
+ switch (selectedType.value.value) {
130
+ case 'direct_path_io':
131
+ return {
132
+ address: directPathIo.value.address,
133
+ vendor_name: directPathIo.value.vendor_name,
134
+ class_name: directPathIo.value.class_name,
135
+ device_name: directPathIo.value.device_name,
136
+ }
137
+ case 'dynamic_direct_path_io':
138
+ return {
139
+ address: '',
140
+ vendor_name: '',
141
+ class_name: '',
142
+ device_name: '',
143
+ }
144
+ default:
145
+ return {
146
+ address: '',
147
+ vendor_name: '',
148
+ class_name: '',
149
+ device_name: '',
150
+ }
151
+ }
152
+ })
153
+
154
+ watch(
155
+ sendData,
156
+ (newValue) => {
157
+ emits('send-data', newValue)
158
+ },
159
+ { immediate: true }
160
+ )
161
+
162
+ const removePciDevice = (): void => {
163
+ emits('remove')
164
+ }
165
+ </script>
166
+
167
+ <style scoped lang="scss">
168
+ #network-connect {
169
+ margin-right: 4px;
170
+ }
171
+ </style>
@@ -8,7 +8,7 @@
8
8
  :key="item.id"
9
9
  :value="item"
10
10
  >
11
- {{ item.id }} | {{ item.device_name }}
11
+ {{ item.address }} | {{ item.device_name }}
12
12
  </option>
13
13
  </select>
14
14
  </div>
@@ -1,7 +1,7 @@
1
1
  import { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
2
2
 
3
3
  export const pciDeviceTypeOptionsConfig: UI_I_OptionItem[] = [
4
- { text: 'DirectPath IO', value: 'direct_path_io' },
5
- { text: 'Dynamic DirectPath IO', value: 'dynamic_direct_path_io' },
6
- { text: 'NVIDIA GRID vGPU', value: 'nvidia_grid' },
4
+ { text: 'DP I/O', value: 'direct_path_io' },
5
+ { text: 'Dynamic DP I/O', value: 'dynamic_direct_path_io' },
6
+ { text: 'GRID vGPU', value: 'nvidia_grid' },
7
7
  ]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.3.111",
4
+ "version": "1.3.113",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",