bfg-common 1.2.140 → 1.2.142

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.
@@ -43,7 +43,7 @@
43
43
  :submit="selectStorageSubmit"
44
44
  :get-datastore-table-func="props.getDatastoreTableFunc"
45
45
  :datastore="props.datastore"
46
- :connected-storage-id="connectedStorageIdOnVm"
46
+ :connected-storage-id-default="connectedStorageIdOnVm"
47
47
  :configure-per-disks="props.configurePerDisks"
48
48
  @next-step="onSelectStorageAndNext"
49
49
  />
@@ -45,25 +45,26 @@ const storageDetailsFunc = (
45
45
  permissions: ['batch-configure'],
46
46
  },
47
47
  {
48
- label: localization.diskFormat,
49
- value: diskFormat.text,
48
+ label: name,
49
+ value: '',
50
50
  permissions: ['configure-disk'],
51
51
  },
52
52
  ]
53
53
 
54
54
  if (isActivePerDiskTab && selectStorage.configureDisks) {
55
- const perDiskItems: UI_I_MigrateReadyBlockData[] = selectStorage.configureDisks.map(
56
- (item) => ({
57
- label: item.name,
58
- value: `${item.file} ${item.disk_format}`,
55
+ const perDiskItems: UI_I_MigrateReadyBlockData[] =
56
+ selectStorage.configureDisks.map((item) => ({
57
+ label: item.file,
58
+ value: `${item.datastore} (${item.disk_format})`,
59
59
  permissions: ['configure-disk'],
60
60
  isProperty: true,
61
- })
62
- )
61
+ }))
63
62
  result = result.concat(perDiskItems)
64
63
  }
65
64
 
66
- return result.filter((option) => option.permissions.includes(selectStorage.tab))
65
+ return result.filter((option) =>
66
+ option.permissions.includes(selectStorage.tab)
67
+ )
67
68
  }
68
69
  export const constructDataReadyViewFunc = (
69
70
  type: UI_T_VmMigrateType,
@@ -4,6 +4,7 @@
4
4
  v-if="isShowSelectedPerDisks"
5
5
  v-model="isShowSelectedPerDisks"
6
6
  v-model:active-tab="activeTab"
7
+ v-model:connected-storage-id-local="connectedStorageIdLocal"
7
8
  :data="selectedPerDisks"
8
9
  />
9
10
 
@@ -21,16 +22,23 @@
21
22
  v-model:vm-disk-format="dataLocal.vmDiskFormat"
22
23
  :get-datastore-table-func="props.getDatastoreTableFunc"
23
24
  :datastore="props.datastore"
24
- :connected-storage-id="props.connectedStorageId"
25
+ :connected-storage-id="connectedStorageId"
25
26
  @update-selected-datastore="dataLocal.storage = $event"
26
- />
27
+ >
28
+ <template v-if="isShowSelectedPerDisks" #buttonConfirm>
29
+ <button class="btn btn-sm btn-primary" @click="onApplyChanges">
30
+ {{ localization.confirm }}
31
+ </button>
32
+ </template>
33
+ </common-wizards-vm-migrate-select-storage-configure-batch>
27
34
 
28
35
  <common-wizards-vm-migrate-select-storage-configure-disk
29
36
  v-show="activeTab === 'configure-disk'"
30
37
  v-model="isShowSelectedPerDisks"
38
+ v-model:selected-per-disk-keys="selectedPerDiskKeys"
31
39
  v-model:active-tab="activeTab"
32
- :configure-per-disks="props.configurePerDisks"
33
- @update-selected-per-disks="selectedPerDisks = $event"
40
+ :configure-per-disks="configurePerDisksLocal"
41
+ @update-selected-per-disks="onChangePerDiskStorage"
34
42
  />
35
43
 
36
44
  <common-wizards-vm-common-validation-compatibility
@@ -58,7 +66,7 @@ const props = defineProps<{
58
66
  submit: number
59
67
  getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
60
68
  datastore: UI_I_DatastoreTableItem[]
61
- connectedStorageId: string | null
69
+ connectedStorageIdDefault: string | null
62
70
  configurePerDisks: UI_I_StorageConfigurePerDiskItem[]
63
71
  }>()
64
72
  const emits = defineEmits<{
@@ -74,8 +82,48 @@ const selectStorageTabs = computed<UI_I_CollapseNavItem[]>(() =>
74
82
 
75
83
  // const selectedStorage = ref<UI_I_DatastoreTableItem | null>(null)
76
84
  const isShowSelectedPerDisks = ref<boolean>(false)
85
+
86
+ const selectedPerDiskKeys = ref<number[]>([])
77
87
  const selectedPerDisks = ref<UI_I_StorageConfigurePerDiskItem[]>([])
78
88
 
89
+ const configurePerDisksLocal = ref<UI_I_StorageConfigurePerDiskItem[]>(
90
+ props.configurePerDisks
91
+ )
92
+
93
+ const connectedStorageIdLocal = ref<string>('')
94
+ const connectedStorageId = computed<string | null>(
95
+ () => connectedStorageIdLocal.value || props.connectedStorageIdDefault
96
+ )
97
+ const onChangePerDiskStorage = (
98
+ event: UI_I_StorageConfigurePerDiskItem[]
99
+ ): void => {
100
+ connectedStorageIdLocal.value = event[0].datastore_id
101
+
102
+ selectedPerDisks.value = event
103
+ }
104
+
105
+ const onApplyChanges = (): void => {
106
+ /* TODO сделать рефакторинг потом */
107
+ configurePerDisksLocal.value.forEach((disk) => {
108
+ const selectedDisk = selectedPerDisks.value.find(
109
+ (selected) =>
110
+ selected.virtual_machine === disk.virtual_machine &&
111
+ selected.file === disk.file &&
112
+ selected.datastore_id === disk.datastore_id
113
+ )!
114
+
115
+ if (selectedDisk) {
116
+ ({ name: disk.datastore, id: disk.datastore_id } =
117
+ dataLocal.value.storage)
118
+ }
119
+ })
120
+
121
+ isShowSelectedPerDisks.value = false
122
+ activeTab.value = 'configure-disk'
123
+ selectedPerDisks.value = []
124
+ selectedPerDiskKeys.value = []
125
+ }
126
+
79
127
  const dataLocal = ref<UI_I_SelectStorageDataLocal>({
80
128
  vmDiskFormat: 'same-format-source',
81
129
  storage: null,
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div>
2
+ <div class="configure-batch-mode">
3
3
  <common-wizards-vm-migrate-select-storage-disk-format
4
4
  v-model:vm-disk-format="selectedVmDiskFormat"
5
5
  />
@@ -24,6 +24,13 @@
24
24
  :connected-storage-id="props.connectedStorageId"
25
25
  @update-selected-datastore="emits('update-selected-datastore', $event)"
26
26
  />
27
+
28
+ <div
29
+ v-if="$slots.buttonConfirm"
30
+ class="clr-justify-content-end configure-batch-mode__button"
31
+ >
32
+ <slot name="buttonConfirm"></slot>
33
+ </div>
27
34
  </div>
28
35
  </template>
29
36
 
@@ -58,4 +65,10 @@ const selectedVmDiskFormat = computed<string>({
58
65
  })
59
66
  </script>
60
67
 
61
- <style lang="scss" scoped></style>
68
+ <style lang="scss" scoped>
69
+ .configure-batch-mode {
70
+ &__button {
71
+ display: flex;
72
+ }
73
+ }
74
+ </style>
@@ -12,7 +12,7 @@
12
12
  </div>
13
13
 
14
14
  <common-wizards-vm-migrate-select-storage-table-disk
15
- v-model:selected-per-disk="selectedPerDiskKeys"
15
+ v-model:selected-per-disk="selectedPerDiskKeysLocal"
16
16
  :configure-per-disks="props.configurePerDisks"
17
17
  />
18
18
  </div>
@@ -25,11 +25,13 @@ import type { UI_T_VmMigrateSelectStorageTab } from '~/components/common/wizards
25
25
 
26
26
  const props = defineProps<{
27
27
  modelValue: boolean
28
+ selectedPerDiskKeys: number[]
28
29
  configurePerDisks: UI_I_StorageConfigurePerDiskItem[]
29
30
  activeTab: UI_T_VmMigrateSelectStorageTab
30
31
  }>()
31
32
  const emits = defineEmits<{
32
33
  (event: 'update:model-value', value: boolean): void
34
+ (event: 'update:selected-per-disk-keys', value: number[]): void
33
35
  (
34
36
  event: 'update-selected-per-disks',
35
37
  value: UI_I_StorageConfigurePerDiskItem[]
@@ -39,13 +41,12 @@ const emits = defineEmits<{
39
41
 
40
42
  const localization = computed<UI_I_Localization>(() => useLocal())
41
43
 
42
- const selectedPerDiskKeys = ref<number[]>([])
43
44
  const selectedDisksFromTable = computed<UI_I_StorageConfigurePerDiskItem[]>(
44
45
  () => {
45
46
  if (!props.configurePerDisks) return []
46
47
 
47
48
  return props.configurePerDisks.filter((_: never, key: number) =>
48
- selectedPerDiskKeys.value.includes(key)
49
+ selectedPerDiskKeysLocal.value.includes(key)
49
50
  )
50
51
  }
51
52
  )
@@ -56,6 +57,15 @@ const onConfigure = (): void => {
56
57
  activeTabValue.value = 'batch-configure'
57
58
  }
58
59
 
60
+ const selectedPerDiskKeysLocal = computed<number[]>({
61
+ get(): number[] {
62
+ return props.selectedPerDiskKeys
63
+ },
64
+ set(newValue: number[]) {
65
+ emits('update:selected-per-disk-keys', newValue)
66
+ },
67
+ })
68
+
59
69
  const activeTabValue = computed<UI_T_VmMigrateSelectStorageTab>({
60
70
  get() {
61
71
  return props.activeTab
@@ -34,21 +34,24 @@ import type { UI_T_VmMigrateSelectStorageTab } from '~/components/common/wizards
34
34
  const props = defineProps<{
35
35
  modelValue: boolean
36
36
  activeTab: UI_T_VmMigrateSelectStorageTab
37
+ connectedStorageIdLocal: string
37
38
  data: any[]
38
39
  }>()
39
40
  const emits = defineEmits<{
40
41
  (event: 'update:model-value', value: boolean): void
41
42
  (event: 'update:active-tab', value: UI_T_VmMigrateSelectStorageTab): void
43
+ (event: 'update:connected-storage-id-local', value: string): void
42
44
  }>()
43
45
 
44
46
  const localization = computed<UI_I_Localization>(() => useLocal())
45
47
 
46
48
  const normalizedData = computed<string[]>(() =>
47
- props.data.map((item) => `${item.name} | ${item.file}`)
49
+ props.data.map((item) => `${item.virtual_machine} | ${item.file}`)
48
50
  )
49
51
 
50
52
  const onGoBack = (): void => {
51
53
  emits('update:model-value', false)
54
+ emits('update:connected-storage-id-local', '')
52
55
  activeTabValue.value = 'configure-disk'
53
56
  }
54
57
 
@@ -56,7 +59,7 @@ const activeTabValue = computed<UI_T_VmMigrateSelectStorageTab>({
56
59
  get() {
57
60
  return props.activeTab
58
61
  },
59
- set(newValue: string) {
62
+ set(newValue: UI_T_VmMigrateSelectStorageTab) {
60
63
  emits('update:active-tab', newValue)
61
64
  },
62
65
  })
@@ -81,8 +81,8 @@ const getStorage = async (): Promise<void> => {
81
81
  }
82
82
 
83
83
  props.getDatastoreTableFunc(payload).then(() => {
84
- selectedStorageKey.value = null
85
- setStorageFromProps()
84
+ // selectedStorageKey.value = null
85
+ // setStorageFromProps()
86
86
  })
87
87
  }
88
88
  getStorage()
@@ -100,6 +100,14 @@ const setStorageFromProps = (): void => {
100
100
  if (item.id === props.connectedStorageId) changeStorage(index)
101
101
  })
102
102
  }
103
+
104
+ watch(
105
+ () => props.connectedStorageId,
106
+ (newValue) => {
107
+ if (!props.datastore.length || !newValue) return
108
+ setStorageFromProps()
109
+ }
110
+ )
103
111
  </script>
104
112
 
105
113
  <style lang="scss" scoped></style>
@@ -14,11 +14,15 @@ const getItems = (
14
14
  localization: UI_I_Localization
15
15
  ): [string, boolean, string, string][] => {
16
16
  return [
17
- [localization.virtualMachine, true, '96px', vmMigrateDiskTableItemKeys[0]],
17
+ [localization.virtualMachine, true, '200px', vmMigrateDiskTableItemKeys[0]],
18
18
  [localization.diskGroup, false, '138px', vmMigrateDiskTableItemKeys[1]],
19
- [localization.file, true, '110px', vmMigrateDiskTableItemKeys[2]],
20
- [localization.storage, true, '96px', vmMigrateDiskTableItemKeys[3]],
21
- // [localization.diskFormat, true, '110px', vmMigrateDiskTableItemKeys[4]],
19
+ [localization.file, true, '180px', vmMigrateDiskTableItemKeys[2]],
20
+ [localization.storage, true, '120px', vmMigrateDiskTableItemKeys[3]],
21
+ [localization.diskFormat, true, '180px', vmMigrateDiskTableItemKeys[4]],
22
+ [localization.sharing, true, '120px', vmMigrateDiskTableItemKeys[5]],
23
+ [localization.target, true, '120px', vmMigrateDiskTableItemKeys[6]],
24
+ [localization.cache, true, '120px', vmMigrateDiskTableItemKeys[7]],
25
+ [localization.diskMode, true, '180px', vmMigrateDiskTableItemKeys[8]],
22
26
  ]
23
27
  }
24
28
 
@@ -69,6 +73,32 @@ export const bodyItems = (
69
73
  text: storage[vmMigrateDiskTableItemKeys[3]],
70
74
  id: key,
71
75
  },
76
+ {
77
+ key: 'col4',
78
+ text: storage[vmMigrateDiskTableItemKeys[4]],
79
+ id: key,
80
+ },
81
+ {
82
+ key: 'col5',
83
+ text: storage[vmMigrateDiskTableItemKeys[5]],
84
+ id: key,
85
+ },
86
+
87
+ {
88
+ key: 'col6',
89
+ text: storage[vmMigrateDiskTableItemKeys[6]],
90
+ id: key,
91
+ },
92
+ {
93
+ key: 'col7',
94
+ text: storage[vmMigrateDiskTableItemKeys[7]],
95
+ id: key,
96
+ },
97
+ {
98
+ key: 'col8',
99
+ text: storage[vmMigrateDiskTableItemKeys[8]],
100
+ id: key,
101
+ },
72
102
  ])
73
103
  })
74
104
  return bodyItems
@@ -5,4 +5,9 @@ export const vmMigrateDiskTableItemKeys: UI_T_VmMigrateDiskTableTuple = [
5
5
  'disk_group',
6
6
  'file',
7
7
  'datastore',
8
+ 'provision_type',
9
+ 'sharing',
10
+ 'target',
11
+ 'cache',
12
+ 'disk_mode',
8
13
  ]
@@ -1,18 +1,23 @@
1
- export interface API_UI_I_StorageConfigurePerDiskItem {
2
- virtual_machine: string
3
- target: string
4
- disk_group: string
5
- disk_source: string
6
- disk_size: string
7
- file: string
8
- datastore: string
1
+ interface API_UI_I_ExtraValuePerDiskItem {
2
+ cache: string
9
3
  datastore_id: string
10
- sharing: string
11
- read_only: string
4
+ discard: string
12
5
  disk_mode: string
13
- cache: string
6
+ disk_size: number
7
+ disk_source: string
14
8
  io_control: string
15
- discard: string
9
+ read_only: string
10
+ sharing: string
11
+ target: string
12
+ }
13
+
14
+ export interface API_UI_I_StorageConfigurePerDiskItem {
15
+ disk_format: 0 | 1 | 2 | 3
16
+ disk_group: string
17
+ file: string
18
+ storage: string
19
+ virtual_machine: string
20
+ extra: API_UI_I_ExtraValuePerDiskItem
16
21
  }
17
22
 
18
23
  export interface UI_I_StorageConfigurePerDiskItem
@@ -2,5 +2,10 @@ export type UI_T_VmMigrateDiskTableTuple = [
2
2
  'virtual_machine',
3
3
  'disk_group',
4
4
  'file',
5
- 'datastore'
5
+ 'datastore',
6
+ 'provision_type',
7
+ 'sharing',
8
+ 'target',
9
+ 'cache',
10
+ 'disk_mode'
6
11
  ]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.2.140",
4
+ "version": "1.2.142",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",