bfg-common 1.3.111 → 1.3.112

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,170 @@
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
+ <common-vm-actions-common-customize-hardware-virtual-hardware-new-pci-device-type-selection
21
+ v-model="selectedType"
22
+ :options="pciDeviceTypeOptions"
23
+ :pci-device-index="props.index"
24
+ />
25
+
26
+ <common-vm-actions-common-customize-hardware-virtual-hardware-new-pci-device-direct-path-io
27
+ v-show="selectedType.value === 'direct_path_io'"
28
+ v-model="directPathIo"
29
+ :pci-device-index="props.index"
30
+ :passthrough-devices="props.passthroughDevices"
31
+ />
32
+ <common-vm-actions-common-customize-hardware-virtual-hardware-new-pci-device-dynamic-direct-path-io
33
+ v-show="selectedType.value === 'dynamic_direct_path_io'"
34
+ v-model="dynamicDirectPathIo"
35
+ :pci-device-index="props.index"
36
+ :passthrough-devices="props.passthroughDevices"
37
+ />
38
+ <common-vm-actions-common-customize-hardware-virtual-hardware-new-pci-device-nvidia-grid
39
+ v-show="selectedType.value === 'nvidia_grid'"
40
+ v-model="nvidiaGridProfile"
41
+ :pci-device-index="props.index"
42
+ />
43
+ </template>
44
+
45
+ <common-vm-actions-common-customize-hardware-virtual-hardware-new-pci-device-note />
46
+ </template>
47
+ </atoms-stack-block>
48
+ </div>
49
+ </template>
50
+
51
+ <script setup lang="ts">
52
+ import { UI_I_Localization } from '~/lib/models/interfaces'
53
+ import { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
54
+ import {
55
+ UI_I_ConfigureAllPciDevicesItem,
56
+ UI_I_ConfigurePciDevicesTable,
57
+ } from '~/lib/models/store/host/interfaces'
58
+ import {
59
+ UI_I_PciDevice,
60
+ UI_I_SendDataNewPciDevice,
61
+ } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
62
+ import { UI_T_PciDeviceType } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/types'
63
+ import { pciDeviceTypeOptionsConfig } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/lib/config/options'
64
+
65
+ const props = defineProps<{
66
+ index: number
67
+ pciDevice: UI_I_PciDevice
68
+ passthroughDevices: UI_I_ConfigurePciDevicesTable
69
+ type: UI_T_PciDeviceType
70
+ isEdit: boolean
71
+ state?: string | number
72
+ // errorValidationFields: UI_I_ErrorValidationField<string>[]
73
+ }>()
74
+ const emits = defineEmits<{
75
+ (event: 'send-data', value: UI_I_SendDataNewPciDevice): void
76
+ (event: 'remove'): void
77
+ }>()
78
+
79
+ const localization = computed<UI_I_Localization>(() => useLocal())
80
+
81
+ const isRunning = computed<boolean>(() => {
82
+ return props.state === 2
83
+ })
84
+
85
+ const isRemovable = computed<boolean>(() => {
86
+ return !props.isEdit || !isRunning.value
87
+ })
88
+
89
+ const label = computed<string>(() => {
90
+ if (props.type === 'edit')
91
+ return `${localization.value.newPciDevice} ${props.index + 1}`
92
+
93
+ return `${localization.value.pciDevice} *`
94
+ })
95
+
96
+ const selectedLabel = computed<string>(() => {
97
+ switch (selectedType.value.value) {
98
+ case 'direct_path_io':
99
+ return `${directPathIo.value.address}|${directPathIo.value.device_name}`
100
+ case 'dynamic_direct_path_io':
101
+ return dynamicDirectPathIo.value
102
+ default:
103
+ return nvidiaGridProfile.value
104
+ }
105
+ })
106
+
107
+ const pciDeviceTypeOptions = ref<UI_I_OptionItem[]>(pciDeviceTypeOptionsConfig)
108
+ const selectedType = ref<UI_I_OptionItem>(pciDeviceTypeOptionsConfig[0])
109
+
110
+ const directPathIo = ref<UI_I_ConfigureAllPciDevicesItem>(
111
+ props.passthroughDevices[0]
112
+ )
113
+ const dynamicDirectPathIo = ref<string>('')
114
+ const nvidiaGridProfile = ref<string>('')
115
+
116
+ watch(
117
+ props.pciDevice,
118
+ (newValue) => {
119
+ const passthroughDevice = props.passthroughDevices.find(
120
+ (item) => item.address === newValue.address
121
+ )
122
+ passthroughDevice && (directPathIo.value = passthroughDevice) // Todo change
123
+ },
124
+ { immediate: true }
125
+ )
126
+
127
+ const sendData = computed<UI_I_SendDataNewPciDevice>(() => {
128
+ switch (selectedType.value.value) {
129
+ case 'direct_path_io':
130
+ return {
131
+ address: directPathIo.value.address,
132
+ vendor_name: directPathIo.value.vendor_name,
133
+ class_name: directPathIo.value.class_name,
134
+ device_name: directPathIo.value.device_name,
135
+ }
136
+ case 'dynamic_direct_path_io':
137
+ return {
138
+ address: '',
139
+ vendor_name: '',
140
+ class_name: '',
141
+ device_name: '',
142
+ }
143
+ default:
144
+ return {
145
+ address: '',
146
+ vendor_name: '',
147
+ class_name: '',
148
+ device_name: '',
149
+ }
150
+ }
151
+ })
152
+
153
+ watch(
154
+ sendData,
155
+ (newValue) => {
156
+ emits('send-data', newValue)
157
+ },
158
+ { immediate: true }
159
+ )
160
+
161
+ const removePciDevice = (): void => {
162
+ emits('remove')
163
+ }
164
+ </script>
165
+
166
+ <style scoped lang="scss">
167
+ #network-connect {
168
+ margin-right: 4px;
169
+ }
170
+ </style>
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.112",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",