bfg-common 1.4.368 → 1.4.370

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.
@@ -8,6 +8,7 @@
8
8
  v-model="selectedSourceNetwork"
9
9
  :key="uniqueKey"
10
10
  :networks="dataNetwork"
11
+ :source-networks="sourceNetworks"
11
12
  :type="tableType"
12
13
  @select-network="onSelectNetwork"
13
14
  />
@@ -45,10 +46,13 @@
45
46
 
46
47
  <script lang="ts" setup>
47
48
  import type { UI_I_Localization } from '~/lib/models/interfaces'
49
+ import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
48
50
  import type { UI_I_SelectNetworksFormLocal } from '~/components/common/wizards/vm/migrate/select/network/lib/models/interfaces'
49
51
 
50
52
  const model = defineModel<UI_I_SelectNetworksFormLocal>({ required: true })
53
+
51
54
  const localization = computed<UI_I_Localization>(() => useLocal())
55
+ const { $store }: any = useNuxtApp()
52
56
 
53
57
  const selectedSourceNetwork = ref<string | null>(null)
54
58
  const uniqueKey = ref<number>(0)
@@ -79,14 +83,39 @@ const networkDetailsHeadline = computed<string>(() =>
79
83
  )
80
84
  )
81
85
 
86
+ // TODO эти данные бутут приходить из апи все надо поменять
87
+ const sourceNetworks = computed<UI_I_NetworkTableItem[]>(() => [
88
+ {
89
+ id: 1,
90
+ name: 'VM Network 1',
91
+ net_bridge: 'VM Network 1',
92
+ },
93
+ {
94
+ id: 2,
95
+ name: 'VM-VLAN105',
96
+ net_bridge: 'VM-VLAN105',
97
+ },
98
+ {
99
+ id: 3,
100
+ name: 'VM Network 2',
101
+ net_bridge: 'VM Network 2',
102
+ },
103
+ ])
104
+
82
105
  const dataNetwork = computed(() => {
106
+ // TODO надо потом все поменять когда будет заприсы
83
107
  return [
84
108
  {
85
109
  vm_name: 'vm-horizon-1',
86
110
  network_adapter: 'Network adapter 1',
87
111
  source_network: 'VM-VLAN105',
88
112
  used_by: '1 VMs / 1 Network adapters',
89
- destination_network: ['VM Network 1', 'VM-VLAN105', 'VM Network 2'],
113
+ destination_network: [
114
+ { text: 'VM Network 1', value: 'VM Network 1' },
115
+ { text: 'VM-VLAN105', value: 'VM-VLAN105' },
116
+ { text: 'VM Network 2', value: 'VM Network 2' },
117
+ { text: `${localization.value.common.browse}...`, value: 'browser' },
118
+ ],
90
119
  },
91
120
  ]
92
121
  })
@@ -22,19 +22,26 @@
22
22
  v-model="item.data.value"
23
23
  data-id="network-select"
24
24
  :disabled="item.data.disabled"
25
- @change="onSelect(item.data)"
25
+ @change="onSelectNetwork(item.data)"
26
26
  @click.stop
27
27
  >
28
28
  <option
29
- v-for="option in item.data.option"
30
- :key="option"
31
- :value="option"
32
- :label="option"
29
+ v-for="(option, key) in item.data.option"
30
+ :key="key"
31
+ :value="option.value"
32
+ :label="option.text"
33
33
  />
34
34
  </select>
35
35
  </span>
36
36
  </template>
37
37
  </atoms-table-data-grid>
38
+
39
+ <common-vm-actions-common-customize-hardware-virtual-hardware-new-network-location
40
+ :location-modal-is-show="isShowSelectNetworkModal"
41
+ :networks-table="props.sourceNetworks"
42
+ @hide="onHideLocationModal"
43
+ @select="onSelectLocation"
44
+ />
38
45
  </div>
39
46
  </template>
40
47
 
@@ -45,12 +52,14 @@ import type {
45
52
  UI_I_HeadItem,
46
53
  UI_I_BodyItem,
47
54
  } from '~/components/atoms/table/dataGrid/lib/models/interfaces'
55
+ import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
48
56
  import type { UI_T_MigrateSelectNetwork } from '~/components/common/wizards/vm/migrate/select/network/table/network/lib/models/types'
49
57
  import * as basicTable from '~/components/common/wizards/vm/migrate/select/network/table/network/lib/config/basicTable'
50
58
  import * as advancedTable from '~/components/common/wizards/vm/migrate/select/network/table/network/lib/config/advancedTable'
51
59
 
52
60
  const props = defineProps<{
53
61
  networks: UI_T_MigrateSelectNetwork[]
62
+ sourceNetworks: UI_I_NetworkTableItem[]
54
63
  type: 'basic' | 'advanced'
55
64
  }>()
56
65
  const emits = defineEmits<{
@@ -65,6 +74,14 @@ const pagination = ref<UI_I_Pagination>({
65
74
  pageSize: 100,
66
75
  })
67
76
 
77
+ const isShowSelectNetworkModal = ref<boolean>(false)
78
+ const onHideLocationModal = (): void => {
79
+ isShowSelectNetworkModal.value = false
80
+ }
81
+ const onSelectLocation = (_network: UI_I_NetworkTableItem): void => {
82
+ isShowSelectNetworkModal.value = false
83
+ }
84
+
68
85
  const table: any = {
69
86
  basic: basicTable,
70
87
  advanced: advancedTable,
@@ -77,7 +94,12 @@ const bodyItems = computed<UI_I_BodyItem[][]>(() => {
77
94
  return table[props.type].bodyItems(props.networks)
78
95
  })
79
96
 
80
- const onSelect = (data: any): void => {
97
+ const onSelectNetwork = (data: any): void => {
98
+ if (data?.value === 'browser') {
99
+ isShowSelectNetworkModal.value = true
100
+ return
101
+ }
102
+
81
103
  emits('select-network', data)
82
104
  }
83
105
  watch(
@@ -86,7 +108,7 @@ watch(
86
108
  const tableData = bodyItems.value[0]
87
109
  const itemKey = newValue === 'basic' ? 2 : 3
88
110
  const data = tableData[itemKey].data
89
- onSelect(data)
111
+ onSelectNetwork(data)
90
112
  },
91
113
  { deep: true, immediate: true }
92
114
  )
@@ -109,5 +131,4 @@ watch(
109
131
  }
110
132
  }
111
133
  }
112
-
113
134
  </style>
@@ -44,8 +44,8 @@ export const bodyItems = (
44
44
  sourceNetwork: network.source_network,
45
45
  disabled: false,
46
46
  value: network.destination_network.find(
47
- (item: string) => item === network.source_network
48
- ),
47
+ (item) => item.value === network.source_network
48
+ ).text,
49
49
  option: network.destination_network,
50
50
  }
51
51
 
@@ -42,8 +42,8 @@ export const bodyItems = (
42
42
  sourceNetwork: network.source_network,
43
43
  disabled: false,
44
44
  value: network.destination_network.find(
45
- (item) => item === network.source_network
46
- ),
45
+ (item) => item.value === network.source_network
46
+ ).text,
47
47
  option: network.destination_network,
48
48
  }
49
49
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.4.368",
4
+ "version": "1.4.370",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",