bfg-common 1.3.42 → 1.3.44

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.
@@ -547,6 +547,8 @@ const changeAll = (e: UI_I_HTMLSelectElement): void => {
547
547
  const newSelectedRow: (number | string)[] = []
548
548
  if (e.target.checked) {
549
549
  bodyItemsPresent.value.forEach((row) => {
550
+ if (row[0]?.disabled) return
551
+
550
552
  newSelectedRow.push(row[0].id)
551
553
  })
552
554
  }
@@ -3,7 +3,7 @@
3
3
  <common-wizards-vm-migrate-select-network-table-disk
4
4
  v-model="selected"
5
5
  :type="tableType"
6
- :data-table="[]"
6
+ :networks="[]"
7
7
  />
8
8
 
9
9
  <div class="vm-migrate-advanced-view-button">
@@ -11,9 +11,9 @@
11
11
  class="btn btn-sm migrate-network-advanced-btn"
12
12
  @click="isShowNetworkBasic = !isShowNetworkBasic"
13
13
  >
14
- <span v-if="isShowNetworkBasic"> &#x226A; </span>
14
+ <span v-if="!isShowNetworkBasic"> &#x226A; </span>
15
15
  {{ buttonText }}
16
- <span v-if="!isShowNetworkBasic"> &#8811; </span>
16
+ <span v-if="isShowNetworkBasic"> &#8811; </span>
17
17
  </button>
18
18
  </div>
19
19
 
@@ -30,11 +30,11 @@ import type { UI_I_Localization } from '~/lib/models/interfaces'
30
30
 
31
31
  const localization = computed<UI_I_Localization>(() => useLocal())
32
32
 
33
- const selected = ref<number[]>([])
34
- const isShowNetworkBasic = ref<boolean>(false)
33
+ const selected = ref<number | null>(null)
34
+ const isShowNetworkBasic = ref<boolean>(true)
35
35
 
36
36
  const buttonText = computed(
37
- () => localization.value[isShowNetworkBasic.value ? 'basic' : 'advanced']
37
+ () => localization.value[isShowNetworkBasic.value ? 'advanced' : 'basic']
38
38
  )
39
39
 
40
40
  const tableType = computed<string>(() =>
@@ -1,20 +1,35 @@
1
1
  <template>
2
2
  <div class="table-wrap">
3
3
  <atoms-table-data-grid
4
- v-model:selected-row="selectedRow"
4
+ v-model:selected-row="selectedNetworkLocal"
5
5
  v-model:column-keys="columnKeys"
6
6
  v-model:page-size="pagination.pageSize"
7
7
  v-model:page="pagination.page"
8
- type="checkbox"
9
8
  :head-items="headItems"
10
9
  :body-items="bodyItems"
11
10
  :total-items="bodyItems.length"
12
11
  :total-pages="1"
12
+ class="select-network"
13
13
  server-off
14
14
  hide-footer
15
15
  hide-page-size
16
- @sorting="sorting"
17
16
  >
17
+ <template #select="{ item }">
18
+ <span class="select select-network__select">
19
+ <select
20
+ :id="item.data.id"
21
+ v-model="item.data.value"
22
+ :disabled="item.data.disabled"
23
+ >
24
+ <option
25
+ v-for="option in item.data.option"
26
+ :key="option"
27
+ :value="option"
28
+ :label="option"
29
+ />
30
+ </select>
31
+ </span>
32
+ </template>
18
33
  </atoms-table-data-grid>
19
34
  </div>
20
35
  </template>
@@ -27,20 +42,26 @@ import type {
27
42
  UI_I_HeadItem,
28
43
  UI_I_BodyItem,
29
44
  } from '~/components/atoms/table/dataGrid/lib/models/interfaces'
45
+ import type { UI_T_MigrateSelectNetwork } from '~/components/common/wizards/vm/migrate/select/network/table/disk/lib/models/types'
30
46
  import * as basicTable from '~/components/common/wizards/vm/migrate/select/network/table/disk/lib/config/basicTable'
31
47
  import * as advancedTable from '~/components/common/wizards/vm/migrate/select/network/table/disk/lib/config/advancedTable'
32
48
 
33
49
  const props = defineProps<{
34
- modelValue: number[]
35
- dataTable: any[]
50
+ modelValue: number | null
51
+ networks: UI_T_MigrateSelectNetwork[]
36
52
  type: 'basic' | 'advanced'
37
53
  }>()
38
54
  const emits = defineEmits<{
39
- (event: 'update:model-value', value: number[] | null): void
55
+ (event: 'update:model-value', value: number | null): void
40
56
  }>()
41
57
 
42
58
  const localization = computed<UI_I_Localization>(() => useLocal())
43
59
 
60
+ const pagination = ref<UI_I_Pagination>({
61
+ page: 1,
62
+ pageSize: 100,
63
+ })
64
+
44
65
  const table: any = {
45
66
  basic: basicTable,
46
67
  advanced: advancedTable,
@@ -57,29 +78,28 @@ watch(localization, () => {
57
78
  })
58
79
 
59
80
  const bodyItems = computed<UI_I_BodyItem[][]>(() => {
60
- return table[props.type].bodyItems(props.dataTable)
81
+ return table[props.type].bodyItems(props.networks)
61
82
  })
62
83
 
63
- const sort = ref<string | null>(null)
64
- const pagination = ref<UI_I_Pagination>({
65
- page: 1,
66
- pageSize: 100,
67
- })
68
-
69
- const sorting = (data: [string, boolean]): void => {
70
- const [column, status] = data
71
- const direction = status ? 'asc' : 'desc'
72
- sort.value = `${column}.${direction}`
73
- }
74
-
75
- const selectedRow = computed<number[]>({
84
+ const selectedNetworkLocal = computed<number | null>({
76
85
  get() {
77
86
  return props.modelValue
78
87
  },
79
- set(newValue: number[]) {
88
+ set(newValue: number | null) {
80
89
  emits('update:model-value', newValue)
81
90
  },
82
91
  })
83
92
  </script>
84
93
 
85
- <style lang="scss" scoped></style>
94
+ <style lang="scss" scoped>
95
+ .select-network {
96
+ &__select {
97
+ width: 100%;
98
+ height: 24px;
99
+ min-width: 107px;
100
+ & > select {
101
+ height: 100%;
102
+ }
103
+ }
104
+ }
105
+ </style>
@@ -1,13 +1,10 @@
1
1
  import type {
2
- UI_I_ColumnKey,
3
2
  UI_I_HeadItem,
4
3
  UI_I_BodyItem,
5
4
  } from '~/components/atoms/table/dataGrid/lib/models/interfaces'
6
5
  import type { UI_I_Localization } from '~/lib/models/interfaces'
7
- import {
8
- constructColumnKey,
9
- constructHeadItem,
10
- } from '~/components/atoms/table/dataGrid/lib/utils/constructDataTable'
6
+ import { constructHeadItem } from '~/components/atoms/table/dataGrid/lib/utils/constructDataTable'
7
+ import type { UI_I_MigrateSelectNetworkAdvancedItem } from '~/components/common/wizards/vm/migrate/select/network/table/disk/lib/models/interfaces'
11
8
  import { networkAdvancedTableItemKeys } from '~/components/common/wizards/vm/migrate/select/network/table/disk/lib/config/tableKeys'
12
9
 
13
10
  const getItems = (
@@ -26,52 +23,53 @@ const getItems = (
26
23
  ]
27
24
  }
28
25
 
29
- export const columnKeys = (
30
- localization: UI_I_Localization
31
- ): UI_I_ColumnKey[] => {
32
- const result: UI_I_ColumnKey[] = []
33
- getItems(localization).forEach((item, i) => {
34
- const col = `col${i}`
35
- result.push(constructColumnKey(col, item[0], item[1]))
36
- })
37
- return result
38
- }
39
-
40
26
  export const headItems = (localization: UI_I_Localization): UI_I_HeadItem[] => {
41
27
  const result: UI_I_HeadItem[] = []
42
28
  getItems(localization).forEach((item, i) => {
43
- const col = `col${i}`
44
- result.push(constructHeadItem(col, item[0], item[3], true, item[2]))
29
+ const col = i === 3 ? 'select' : `col${i}`
30
+ result.push(constructHeadItem(col, item[0], item[3], false, item[2]))
45
31
  })
46
32
  return result
47
33
  }
48
34
 
49
- export const bodyItems = (data: any[]): UI_I_BodyItem[][] => {
35
+ export const bodyItems = (
36
+ data: UI_I_MigrateSelectNetworkAdvancedItem[]
37
+ ): UI_I_BodyItem[][] => {
50
38
  const bodyItems: UI_I_BodyItem[][] = []
51
39
 
52
- data.forEach((storage: any, key: number) => {
53
- bodyItems.push([
54
- {
55
- key: 'col0',
56
- text: storage[networkAdvancedTableItemKeys[0]],
57
- id: key,
58
- },
59
- {
60
- key: 'col1',
61
- text: storage[networkAdvancedTableItemKeys[1]],
62
- id: key,
63
- },
64
- {
65
- key: 'col2',
66
- text: storage[networkAdvancedTableItemKeys[2]],
67
- id: key,
68
- },
69
- {
70
- key: 'col3',
71
- text: storage[networkAdvancedTableItemKeys[3]],
72
- id: key,
73
- },
74
- ])
75
- })
40
+ data.forEach(
41
+ (network: UI_I_MigrateSelectNetworkAdvancedItem, key: number) => {
42
+ const data = {
43
+ id: `${network.vm_name}-select`,
44
+ disabled: false,
45
+ value: network.destination_network[0],
46
+ option: network.destination_network,
47
+ }
48
+
49
+ bodyItems.push([
50
+ {
51
+ key: 'col0',
52
+ text: network[networkAdvancedTableItemKeys[0]],
53
+ id: key,
54
+ },
55
+ {
56
+ key: 'col1',
57
+ text: network[networkAdvancedTableItemKeys[1]],
58
+ id: key,
59
+ },
60
+ {
61
+ key: 'col2',
62
+ text: network[networkAdvancedTableItemKeys[2]],
63
+ id: key,
64
+ },
65
+ {
66
+ key: 'select',
67
+ text: network[networkAdvancedTableItemKeys[3]],
68
+ data,
69
+ id: key,
70
+ },
71
+ ])
72
+ }
73
+ )
76
74
  return bodyItems
77
75
  }
@@ -1,13 +1,10 @@
1
1
  import type {
2
- UI_I_ColumnKey,
3
2
  UI_I_HeadItem,
4
3
  UI_I_BodyItem,
5
4
  } from '~/components/atoms/table/dataGrid/lib/models/interfaces'
6
5
  import type { UI_I_Localization } from '~/lib/models/interfaces'
7
- import {
8
- constructColumnKey,
9
- constructHeadItem,
10
- } from '~/components/atoms/table/dataGrid/lib/utils/constructDataTable'
6
+ import { constructHeadItem } from '~/components/atoms/table/dataGrid/lib/utils/constructDataTable'
7
+ import type { UI_I_MigrateSelectNetworkBasicItem } from '~/components/common/wizards/vm/migrate/select/network/table/disk/lib/models/interfaces'
11
8
  import { networkBasicsTableItemKeys } from '~/components/common/wizards/vm/migrate/select/network/table/disk/lib/config/tableKeys'
12
9
 
13
10
  const getItems = (
@@ -25,44 +22,43 @@ const getItems = (
25
22
  ]
26
23
  }
27
24
 
28
- export const columnKeys = (
29
- localization: UI_I_Localization
30
- ): UI_I_ColumnKey[] => {
31
- const result: UI_I_ColumnKey[] = []
32
- getItems(localization).forEach((item, i) => {
33
- const col = `col${i}`
34
- result.push(constructColumnKey(col, item[0], item[1]))
35
- })
36
- return result
37
- }
38
-
39
25
  export const headItems = (localization: UI_I_Localization): UI_I_HeadItem[] => {
40
26
  const result: UI_I_HeadItem[] = []
41
27
  getItems(localization).forEach((item, i) => {
42
- const col = `col${i}`
43
- result.push(constructHeadItem(col, item[0], item[3], true, item[2]))
28
+ const col = i === 2 ? 'select' : `col${i}`
29
+ result.push(constructHeadItem(col, item[0], item[3], false, item[2]))
44
30
  })
45
31
  return result
46
32
  }
47
33
 
48
- export const bodyItems = (data: any[]): UI_I_BodyItem[][] => {
34
+ export const bodyItems = (
35
+ data: UI_I_MigrateSelectNetworkBasicItem[]
36
+ ): UI_I_BodyItem[][] => {
49
37
  const bodyItems: UI_I_BodyItem[][] = []
50
38
 
51
- data.forEach((storage: any, key: number) => {
39
+ data.forEach((network: UI_I_MigrateSelectNetworkBasicItem, key: number) => {
40
+ const data = {
41
+ id: `${network.source_network}-select`,
42
+ disabled: false,
43
+ value: network.destination_network[0],
44
+ option: network.destination_network,
45
+ }
46
+
52
47
  bodyItems.push([
53
48
  {
54
49
  key: 'col0',
55
- text: storage[networkBasicsTableItemKeys[0]],
50
+ text: network[networkBasicsTableItemKeys[0]],
56
51
  id: key,
57
52
  },
58
53
  {
59
54
  key: 'col1',
60
- text: storage[networkBasicsTableItemKeys[1]],
55
+ text: network[networkBasicsTableItemKeys[1]],
61
56
  id: key,
62
57
  },
63
58
  {
64
- key: 'col2',
65
- text: storage[networkBasicsTableItemKeys[2]],
59
+ key: 'select',
60
+ text: network[networkBasicsTableItemKeys[2]],
61
+ data,
66
62
  id: key,
67
63
  },
68
64
  ])
@@ -1 +1,12 @@
1
+ export interface UI_I_MigrateSelectNetworkBasicItem {
2
+ source_network: string
3
+ used_by: string
4
+ destination_network: string
5
+ }
1
6
 
7
+ export interface UI_I_MigrateSelectNetworkAdvancedItem {
8
+ vm_name: string
9
+ network_adapter: string
10
+ source_network: string
11
+ destination_network: string
12
+ }
@@ -1,3 +1,8 @@
1
+ import type {
2
+ UI_I_MigrateSelectNetworkBasicItem,
3
+ UI_I_MigrateSelectNetworkAdvancedItem,
4
+ } from '~/components/common/wizards/vm/migrate/select/network/table/disk/lib/models/interfaces'
5
+
1
6
  export type UI_T_NetworkAdvancedTableKeysTuple = [
2
7
  'vm_name',
3
8
  'network_adapter',
@@ -10,3 +15,7 @@ export type UI_T_NetworkBasicsTableTableKeysTuple = [
10
15
  'used_by',
11
16
  'destination_network'
12
17
  ]
18
+
19
+ export type UI_T_MigrateSelectNetwork =
20
+ | UI_I_MigrateSelectNetworkBasicItem
21
+ | UI_I_MigrateSelectNetworkAdvancedItem
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.3.42",
4
+ "version": "1.3.44",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",