bfg-common 1.3.179 → 1.3.181

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.
@@ -508,14 +508,14 @@ interface API_UI_I_ListIndex {
508
508
 
509
509
  export interface API_UI_I_SwitchItem {
510
510
  id: string
511
- state: API_UI_I_State
511
+ state?: API_UI_I_State
512
512
  index?: API_UI_I_ListIndex
513
513
  mtu: number
514
514
  security: API_UI_I_Security
515
515
  shaping: API_UI_I_Shaping
516
516
  teaming: API_UI_I_Teaming
517
517
  nics: UI_I_AdapterStatus
518
- networks?: string[]
518
+ networks: string[]
519
519
 
520
520
  num_ports?: string // TODO MAMMA MIA, WHERE IS IIIIIT?
521
521
  }
@@ -3,12 +3,14 @@ import {
3
3
  UI_I_SelectedPort,
4
4
  UI_I_NetworksWithPositions,
5
5
  UI_I_AdaptersWithPositions,
6
- UI_I_SwitchLine,
7
6
  UI_I_SelectedSwitchPositions,
8
7
  UI_I_DiagramDataFull,
9
8
  UI_I_AdaptersHeight,
10
9
  UI_I_Adapter,
11
10
  UI_I_AdaptersPositions,
11
+ UI_I_AdapterStatus,
12
+ UI_I_NetworkFull,
13
+ API_UI_I_SwitchItem,
12
14
  } from '~/components/common/diagramMain/lib/models/interfaces'
13
15
  import {
14
16
  UI_E_NetworkType,
@@ -216,3 +218,33 @@ export const getAdaptersPositions = (
216
218
  adapters,
217
219
  }
218
220
  }
221
+
222
+ export const makeSwitchSendData = (
223
+ data: UI_I_DiagramDataFull,
224
+ adapterStatus: UI_I_AdapterStatus
225
+ ): API_UI_I_SwitchItem => {
226
+ return {
227
+ id: data.id,
228
+ mtu: data.networking.mtu,
229
+ networks: data.networks.map((network: UI_I_NetworkFull) => network.title),
230
+ nics: adapterStatus,
231
+ security: {
232
+ promiscuous: data.networking.securityPolicy[0].value,
233
+ forged_transmits: data.networking.securityPolicy[1].value,
234
+ mac_change: data.networking.securityPolicy[2].value,
235
+ },
236
+ teaming: {
237
+ notify_switches: data.networking.nicTeamingPolicy[0].value,
238
+ mode: data.networking.nicTeamingPolicy[1].value,
239
+ link_detection_mode: data.networking.nicTeamingPolicy[2].value,
240
+ failback: data.networking.nicTeamingPolicy[3].value,
241
+ },
242
+ shaping: {
243
+ inherit: false,
244
+ enabled: !!data.networking.shapingPolicy[0].value,
245
+ average_bw: data.networking.average_bw,
246
+ peak_bw: data.networking.peak_bw,
247
+ burst_size: data.networking.burst_size,
248
+ },
249
+ }
250
+ }
@@ -223,7 +223,7 @@ const localization = computed<UI_I_Localization>(() => useLocal())
223
223
  const { $binary } = useNuxtApp()
224
224
 
225
225
  const dropdownItems = computed<UI_I_DropdownTreeItem[]>(() =>
226
- dropdownItemsFunc(localization.value, props.state)
226
+ dropdownItemsFunc(localization.value, props.state, props.passthroughDevices)
227
227
  )
228
228
 
229
229
  const hardDisksIndex = ref<number[]>([0])
@@ -277,12 +277,18 @@ const addHardDisk = (
277
277
  source,
278
278
  attach: true,
279
279
  boot_order: 0, // Убираем галочку
280
- provision_type: provisionType
280
+ provision_type: provisionType,
281
281
  })
282
282
  sendData()
283
283
  }
284
284
  const onAddExistHardDisk = (file: UI_I_FileTreeNode): void => {
285
- addHardDisk(false, $binary.bToGb(file.size), file.path, 'exist', file.provisioned_type)
285
+ addHardDisk(
286
+ false,
287
+ $binary.bToGb(file.size),
288
+ file.path,
289
+ 'exist',
290
+ file.provisioned_type
291
+ )
286
292
  }
287
293
  const onRemoveHardDisk = (
288
294
  index: number,
@@ -1,53 +1,59 @@
1
- import { UI_I_Localization } from '~/lib/models/interfaces'
2
- import { UI_I_DropdownTreeItem } from '~/components/atoms/dropdown/tree/lib/models/interfaces'
3
-
4
- export const dropdownItemsFunc = (
5
- localization: UI_I_Localization,
6
- state: string | number | undefined
7
- ): UI_I_DropdownTreeItem[] => {
8
- const { $text } = useNuxtApp()
9
-
10
- return [
11
- {
12
- text: localization.disksDrivesStorage,
13
- children: [
14
- { text: $text.toCapitalizeEveryWord(localization.hardDisk), value: 1 },
15
- {
16
- text: $text.toCapitalizeEveryWord(localization.existingHardDisk),
17
- value: 2,
18
- },
19
- // { text: 'RDM Disk', value: 2 },
20
- // { text: 'Host USB Device', value: 3 },
21
- // { text: 'NVDIMM', value: 4 },
22
- { text: localization.cdDvdDrive, value: 5 },
23
- ],
24
- },
25
- // {
26
- // text: 'Controllers',
27
- // children: [
28
- // { text: 'NVMe Controller', value: 6 },
29
- // { text: 'SATA Controller', value: 7 },
30
- // { text: 'SCSI Controller', value: 8 },
31
- // { text: 'USB Controller', value: 9 },
32
- // ],
33
- // },
34
- {
35
- text: 'Other Devices',
36
- children: [
37
- { text: 'PCI Device', value: 10, disabled: state === 2 },
38
- // { text: 'Watchdog Timer', value: 11 },
39
- // { text: 'Precision Clock', value: 12 },
40
- // { text: 'Serial Port', value: 13 },
41
- ],
42
- },
43
- {
44
- text: localization.network,
45
- children: [
46
- {
47
- text: $text.toCapitalizeEveryWord(localization.networkAdapter),
48
- value: 14,
49
- },
50
- ],
51
- },
52
- ]
53
- }
1
+ import { UI_I_Localization } from '~/lib/models/interfaces'
2
+ import { UI_I_DropdownTreeItem } from '~/components/atoms/dropdown/tree/lib/models/interfaces'
3
+ import { UI_I_PciDevice } from '~/lib/models/store/vm/interfaces'
4
+
5
+ export const dropdownItemsFunc = (
6
+ localization: UI_I_Localization,
7
+ state: string | number | undefined,
8
+ passthroughDevices?: UI_I_PciDevice[]
9
+ ): UI_I_DropdownTreeItem[] => {
10
+ const { $text } = useNuxtApp()
11
+
12
+ return [
13
+ {
14
+ text: localization.disksDrivesStorage,
15
+ children: [
16
+ { text: $text.toCapitalizeEveryWord(localization.hardDisk), value: 1 },
17
+ {
18
+ text: $text.toCapitalizeEveryWord(localization.existingHardDisk),
19
+ value: 2,
20
+ },
21
+ // { text: 'RDM Disk', value: 2 },
22
+ // { text: 'Host USB Device', value: 3 },
23
+ // { text: 'NVDIMM', value: 4 },
24
+ { text: localization.cdDvdDrive, value: 5 },
25
+ ],
26
+ },
27
+ // {
28
+ // text: 'Controllers',
29
+ // children: [
30
+ // { text: 'NVMe Controller', value: 6 },
31
+ // { text: 'SATA Controller', value: 7 },
32
+ // { text: 'SCSI Controller', value: 8 },
33
+ // { text: 'USB Controller', value: 9 },
34
+ // ],
35
+ // },
36
+ {
37
+ text: 'Other Devices',
38
+ children: [
39
+ {
40
+ text: 'PCI Device',
41
+ value: 10,
42
+ disabled: state === 2 || !passthroughDevices?.length,
43
+ },
44
+ // { text: 'Watchdog Timer', value: 11 },
45
+ // { text: 'Precision Clock', value: 12 },
46
+ // { text: 'Serial Port', value: 13 },
47
+ ],
48
+ },
49
+ {
50
+ text: localization.network,
51
+ children: [
52
+ {
53
+ text: $text.toCapitalizeEveryWord(localization.networkAdapter),
54
+ value: 14,
55
+ },
56
+ ],
57
+ },
58
+ ]
59
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.3.179",
4
+ "version": "1.3.181",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",