bfg-common 1.5.539 → 1.5.541

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.
Files changed (42) hide show
  1. package/components/common/pages/backups/modals/createBackup/CreateBackup.vue +195 -195
  2. package/components/common/pages/backups/modals/createBackup/datastores/tableView/new/TableView.vue +3 -3
  3. package/components/common/pages/backups/modals/createBackup/disks/tableView/new/lib/config/table.ts +1 -0
  4. package/components/common/pages/backups/modals/restore/Restore.vue +78 -196
  5. package/components/common/pages/backups/modals/restore/RestoreNew.vue +289 -0
  6. package/components/common/pages/backups/modals/restore/RestoreOld.vue +173 -0
  7. package/components/common/pages/backups/modals/restore/disks/Disks.vue +32 -27
  8. package/components/common/pages/backups/modals/restore/disks/DisksNew.vue +17 -0
  9. package/components/common/pages/backups/modals/restore/disks/DisksOld.vue +21 -0
  10. package/components/common/pages/backups/modals/restore/disks/tableView/new/Table.vue +126 -0
  11. package/components/common/pages/backups/modals/restore/disks/tableView/new/lib/config/table.ts +175 -0
  12. package/components/common/pages/backups/modals/restore/disks/tableView/{TableView.vue → old/Table.vue} +6 -3
  13. package/components/common/pages/backups/modals/restore/disks/tableView/{lib → old/lib}/config/keys.ts +1 -1
  14. package/components/common/pages/backups/modals/restore/disks/tableView/{lib → old/lib}/config/table.ts +117 -117
  15. package/components/common/pages/backups/modals/restore/disks/tableView/{lib → old/lib}/models/types.ts +1 -1
  16. package/components/common/pages/backups/modals/restore/lib/config/readyToCompleteOptions.ts +62 -0
  17. package/components/common/pages/backups/modals/restore/lib/config/steps.ts +21 -21
  18. package/components/common/pages/backups/modals/restore/name/Name.vue +31 -166
  19. package/components/common/pages/backups/modals/restore/name/NameNew.vue +98 -0
  20. package/components/common/pages/backups/modals/restore/name/NameOld.vue +86 -0
  21. package/components/common/pages/backups/modals/restore/networks/Networks.vue +64 -70
  22. package/components/common/pages/backups/modals/restore/networks/NetworksNew.vue +78 -0
  23. package/components/common/pages/backups/modals/restore/networks/NetworksOld.vue +48 -0
  24. package/components/common/pages/backups/modals/restore/networks/table/new/Table.vue +269 -0
  25. package/components/common/pages/backups/modals/restore/networks/table/new/lib/config/table.ts +127 -0
  26. package/components/common/pages/backups/modals/restore/networks/table/{Table.vue → old/Table.vue} +219 -214
  27. package/components/common/pages/backups/modals/restore/networks/table/{adapterType → old/adapterType}/AdapterType.vue +1 -1
  28. package/components/common/pages/backups/modals/restore/networks/table/{lib → old/lib}/config/networkTable.ts +1 -1
  29. package/components/common/pages/backups/modals/restore/networks/table/old/lib/config/tableKeys.ts +8 -0
  30. package/components/common/pages/backups/modals/restore/types/Types.vue +9 -50
  31. package/components/common/pages/backups/modals/restore/types/TypesNew.vue +95 -0
  32. package/components/common/pages/backups/modals/restore/types/TypesOld.vue +61 -0
  33. package/components/common/pages/backups/modals/restore/types/lib/config/descriptions.ts +1 -0
  34. package/components/common/pages/backups/modals/restore/types/lib/config/typeOptions.ts +25 -25
  35. package/components/common/pages/backups/modals/restore/validation/validation.ts +108 -0
  36. package/components/common/pages/hardwareHealth/tableView/lib/config/sensorTable.ts +1 -1
  37. package/components/common/pages/hardwareHealth/tableView/modal/SensorWarning.vue +1 -1
  38. package/components/common/tooltip/Help.vue +5 -0
  39. package/package.json +1 -1
  40. package/components/common/pages/backups/modals/restore/networks/table/lib/config/tableKeys.ts +0 -10
  41. /package/components/common/pages/backups/modals/restore/networks/table/{adapterType → old/adapterType}/lib/config/options.ts +0 -0
  42. /package/components/common/pages/backups/modals/restore/networks/table/{lib → old/lib}/models/types.ts +0 -0
@@ -1,117 +1,117 @@
1
- import type {
2
- UI_I_HeadItem,
3
- UI_I_ColumnKey,
4
- UI_I_BodyItem,
5
- } from '~/components/atoms/table/dataGrid/lib/models/interfaces'
6
- import type { UI_I_Localization } from '~/lib/models/interfaces'
7
- import type { UI_I_RestoreForm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
8
- import {
9
- constructHeadItem,
10
- constructColumnKey,
11
- } from '~/components/atoms/table/dataGrid/lib/utils/constructDataTable'
12
- import { tableKeys } from '~/components/common/pages/backups/modals/restore/disks/tableView/lib/config/keys'
13
-
14
- const getItems = (
15
- localization: UI_I_Localization
16
- ): [string, boolean, string, string][] => {
17
- return [
18
- [localization.common.source, true, '180px', tableKeys[0]],
19
- [localization.common.deviceType, true, '180px', tableKeys[1]],
20
- [localization.common.bus, true, '180px', tableKeys[2]],
21
- [localization.common.target, true, '180px', tableKeys[3]],
22
- [localization.common.capacity, true, '180px', tableKeys[4]],
23
- [localization.common.used, true, '180px', tableKeys[5]],
24
- [localization.common.free, true, '180px', tableKeys[6]],
25
- [localization.common.volumePath, true, '180px', tableKeys[7]],
26
- ]
27
- }
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
- result.push(
34
- constructColumnKey(`col${i}`, item[0], item[1], `show-column-${item[3]}`)
35
- )
36
- })
37
- return result
38
- }
39
- export const headItems = (localization: UI_I_Localization): UI_I_HeadItem[] => {
40
- const result: UI_I_HeadItem[] = []
41
- getItems(localization).forEach((item, i) => {
42
- result.push(
43
- constructHeadItem(
44
- `col${i}`,
45
- item[0],
46
- item[3],
47
- true,
48
- item[2],
49
- undefined,
50
- item[3]
51
- )
52
- )
53
- })
54
- return result
55
- }
56
-
57
- export const bodyItems = (
58
- data: UI_I_RestoreForm['pvm']['disk_devices']
59
- ): UI_I_BodyItem[][] => {
60
- const { $binary }: any = useNuxtApp()
61
- const lang = useLocalStorage('lang') === 'ru_RU' ? 'ru' : 'en'
62
-
63
- const bodyItems: UI_I_BodyItem[][] = []
64
- data.forEach((disk: UI_I_RestoreForm['pvm']['disk_devices'][0]) => {
65
- bodyItems.push([
66
- {
67
- key: 'col0',
68
- text: disk[tableKeys[0]],
69
- id: disk.source,
70
- data: {
71
- location: disk.source,
72
- target: disk.target,
73
- },
74
- },
75
- {
76
- key: 'col1',
77
- text: disk[tableKeys[1]],
78
- id: disk.source,
79
- },
80
- {
81
- key: 'col2',
82
- text: disk[tableKeys[2]],
83
- id: disk.source,
84
- },
85
- {
86
- key: 'col3',
87
- text: disk[tableKeys[3]],
88
- id: disk.source,
89
- },
90
- {
91
- key: 'col4',
92
- text: $binary.round(disk[tableKeys[4]], false, lang),
93
- id: disk.source,
94
- },
95
- {
96
- key: 'col5',
97
- text: $binary.round(
98
- disk[tableKeys[4]] - disk[tableKeys[6]],
99
- false,
100
- lang
101
- ),
102
- id: disk.source,
103
- },
104
- {
105
- key: 'col6',
106
- text: $binary.round(disk[tableKeys[6]], false, lang),
107
- id: disk.source,
108
- },
109
- {
110
- key: 'col7',
111
- text: disk[tableKeys[7]],
112
- id: disk.source,
113
- },
114
- ])
115
- })
116
- return bodyItems
117
- }
1
+ import type {
2
+ UI_I_HeadItem,
3
+ UI_I_ColumnKey,
4
+ UI_I_BodyItem,
5
+ } from '~/components/atoms/table/dataGrid/lib/models/interfaces'
6
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
7
+ import type { UI_I_RestoreForm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
8
+ import {
9
+ constructHeadItem,
10
+ constructColumnKey,
11
+ } from '~/components/atoms/table/dataGrid/lib/utils/constructDataTable'
12
+ import { tableKeys } from '~/components/common/pages/backups/modals/restore/disks/tableView/old/lib/config/keys'
13
+
14
+ const getItems = (
15
+ localization: UI_I_Localization
16
+ ): [string, boolean, string, string][] => {
17
+ return [
18
+ [localization.common.source, true, '180px', tableKeys[0]],
19
+ [localization.common.deviceType, true, '180px', tableKeys[1]],
20
+ [localization.common.bus, true, '180px', tableKeys[2]],
21
+ [localization.common.target, true, '180px', tableKeys[3]],
22
+ [localization.common.capacity, true, '180px', tableKeys[4]],
23
+ [localization.common.used, true, '180px', tableKeys[5]],
24
+ [localization.common.free, true, '180px', tableKeys[6]],
25
+ [localization.common.volumePath, true, '180px', tableKeys[7]],
26
+ ]
27
+ }
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
+ result.push(
34
+ constructColumnKey(`col${i}`, item[0], item[1], `show-column-${item[3]}`)
35
+ )
36
+ })
37
+ return result
38
+ }
39
+ export const headItems = (localization: UI_I_Localization): UI_I_HeadItem[] => {
40
+ const result: UI_I_HeadItem[] = []
41
+ getItems(localization).forEach((item, i) => {
42
+ result.push(
43
+ constructHeadItem(
44
+ `col${i}`,
45
+ item[0],
46
+ item[3],
47
+ true,
48
+ item[2],
49
+ undefined,
50
+ item[3]
51
+ )
52
+ )
53
+ })
54
+ return result
55
+ }
56
+
57
+ export const bodyItems = (
58
+ data: UI_I_RestoreForm['pvm']['disk_devices']
59
+ ): UI_I_BodyItem[][] => {
60
+ const { $binary }: any = useNuxtApp()
61
+ const lang = useLocalStorage('lang') === 'ru_RU' ? 'ru' : 'en'
62
+
63
+ const bodyItems: UI_I_BodyItem[][] = []
64
+ data.forEach((disk: UI_I_RestoreForm['pvm']['disk_devices'][0]) => {
65
+ bodyItems.push([
66
+ {
67
+ key: 'col0',
68
+ text: disk[tableKeys[0]],
69
+ id: disk.source,
70
+ data: {
71
+ location: disk.source,
72
+ target: disk.target,
73
+ },
74
+ },
75
+ {
76
+ key: 'col1',
77
+ text: disk[tableKeys[1]],
78
+ id: disk.source,
79
+ },
80
+ {
81
+ key: 'col2',
82
+ text: disk[tableKeys[2]],
83
+ id: disk.source,
84
+ },
85
+ {
86
+ key: 'col3',
87
+ text: disk[tableKeys[3]],
88
+ id: disk.source,
89
+ },
90
+ {
91
+ key: 'col4',
92
+ text: $binary.round(disk[tableKeys[4]], false, lang),
93
+ id: disk.source,
94
+ },
95
+ {
96
+ key: 'col5',
97
+ text: $binary.round(
98
+ disk[tableKeys[4]] - disk[tableKeys[6]],
99
+ false,
100
+ lang
101
+ ),
102
+ id: disk.source,
103
+ },
104
+ {
105
+ key: 'col6',
106
+ text: $binary.round(disk[tableKeys[6]], false, lang),
107
+ id: disk.source,
108
+ },
109
+ {
110
+ key: 'col7',
111
+ text: disk[tableKeys[7]],
112
+ id: disk.source,
113
+ },
114
+ ])
115
+ })
116
+ return bodyItems
117
+ }
@@ -6,5 +6,5 @@ export type UI_T_DiskTableKeysTuple = [
6
6
  'capacity_mb',
7
7
  'used_mb',
8
8
  'free_mb',
9
- 'volume_path',
9
+ 'volume_path'
10
10
  ]
@@ -0,0 +1,62 @@
1
+ import type {UI_I_RestoreForm} from "~/components/common/pages/backups/modals/lib/models/interfaces";
2
+ import type {UI_I_Localization} from "~/lib/models/interfaces";
3
+ import type {UI_I_TableInfoItem} from "~/components/atoms/table/info/lib/models/interfaces";
4
+ import { restoreCodes } from '~/components/common/pages/backups/modals/restore/lib/config/restoreCodes'
5
+
6
+
7
+ export const readyToCompleteOptions = (model: UI_I_RestoreForm, localization: UI_I_Localization, selectedStorageName: string): UI_I_TableInfoItem[] => {
8
+ const result = []
9
+
10
+ switch (model.restore_code) {
11
+ case restoreCodes.diskOnly:
12
+ case restoreCodes.existing:
13
+ result.push({
14
+ label: localization.common.backup,
15
+ value: model.backup,
16
+ iconClassName: 'icon-backup'
17
+ })
18
+ break
19
+ case restoreCodes.asNew:
20
+ result.push({
21
+ label: localization.common.vmName,
22
+ value: model.pvm.name,
23
+ iconClassName: 'vsphere-icon-vm'
24
+ })
25
+
26
+ // Datastores
27
+ result.push({
28
+ label: localization.common.datastore,
29
+ value: selectedStorageName,
30
+ iconClassName: 'vsphere-icon-datastore'
31
+ })
32
+
33
+ // Disks
34
+ model.pvm.disk_devices.forEach((disk_device, i) => {
35
+ if (!disk_device.source) return
36
+
37
+ result.push({
38
+ label: `${localization.common.disk} ${i}`,
39
+ value: disk_device.source,
40
+ iconClassName: 'icon-vSphere-dsVmDisk'
41
+ })
42
+ })
43
+
44
+ // Networks
45
+ model.pvm.network_devices.forEach((network) => {
46
+ result.push({
47
+ label: localization.common.network,
48
+ value: network.network,
49
+ iconClassName: 'vsphere-icon-network'
50
+ })
51
+ })
52
+ break
53
+ // case 1:
54
+ // result.push({
55
+ // label: localization.value.common.vmName,
56
+ // value: model.value.pvm.name,
57
+ // })
58
+ // break
59
+ }
60
+
61
+ return result
62
+ }
@@ -8,7 +8,7 @@ export const dynamicSteps = {
8
8
  selectStorage: 2,
9
9
  selectDisks: 3,
10
10
  selectNetwork: 4,
11
- readyComplete: 5,
11
+ readyComplete: 5
12
12
  }
13
13
 
14
14
  export const stepsFunc = (
@@ -18,42 +18,42 @@ export const stepsFunc = (
18
18
  {
19
19
  id: dynamicSteps.selectType,
20
20
  stepName: '',
21
- title: localization.common.selectAType,
21
+ title: localization.backup.selectType,
22
22
  subTitle: '',
23
23
  status: UI_E_WIZARD_STATUS.SELECTED,
24
24
  isValid: true,
25
25
  fields: {},
26
- testId: 'backup-restore-type',
26
+ testId: 'backup-restore-type'
27
27
  },
28
28
  {
29
29
  id: dynamicSteps.selectName,
30
30
  stepName: '',
31
31
  title: localization.common.selectName,
32
- subTitle: '',
32
+ subTitle: 'Specify a unique name for the virtual machine.',
33
33
  status: UI_E_WIZARD_STATUS.INACTIVE,
34
34
  isValid: true,
35
35
  testId: 'backup-restore-select-name',
36
36
  fields: {
37
37
  name: {
38
38
  field: '',
39
- alert: '',
40
- },
41
- },
39
+ alert: ''
40
+ }
41
+ }
42
42
  },
43
43
  {
44
44
  id: dynamicSteps.selectStorage,
45
45
  stepName: '',
46
46
  title: localization.common.selectStorage,
47
- subTitle: '',
47
+ subTitle: 'Select a storage for the configuration and disk files.',
48
48
  status: UI_E_WIZARD_STATUS.INACTIVE,
49
49
  isValid: true,
50
50
  testId: 'backup-restore-select-storage',
51
51
  fields: {
52
52
  storage: {
53
53
  field: '',
54
- alert: '',
55
- },
56
- },
54
+ alert: ''
55
+ }
56
+ }
57
57
  },
58
58
  {
59
59
  id: dynamicSteps.selectDisks,
@@ -65,31 +65,31 @@ export const stepsFunc = (
65
65
  fields: {
66
66
  disk_devices: {
67
67
  field: '',
68
- alert: '',
69
- },
68
+ alert: ''
69
+ }
70
70
  },
71
- testId: 'backup-restore-select--disks',
71
+ testId: 'backup-restore-select--disks'
72
72
  },
73
73
  {
74
74
  id: dynamicSteps.selectNetwork,
75
75
  stepName: '',
76
76
  title: localization.common.selectNetwork,
77
- subTitle: '',
77
+ subTitle: 'Select adapter types and networks in Procurator.',
78
78
  status: UI_E_WIZARD_STATUS.INACTIVE,
79
79
  isValid: true,
80
80
  testId: 'backup-restore-select-network',
81
- fields: {},
81
+ fields: {}
82
82
  },
83
83
  {
84
84
  id: dynamicSteps.readyComplete,
85
85
  stepName: '',
86
86
  title: localization.common.readyComplete,
87
- subTitle: localization.common.clickFinishRestore,
87
+ subTitle: localization.backup.restoreBackupReviewSubtitle,
88
88
  status: UI_E_WIZARD_STATUS.INACTIVE,
89
89
  isValid: true,
90
90
  testId: 'backup-restore-ready-complete',
91
- fields: {},
92
- },
91
+ fields: {}
92
+ }
93
93
  ]
94
94
  }
95
95
 
@@ -103,6 +103,6 @@ export const stepsSchemeInitial = [
103
103
  dynamicSteps.selectStorage,
104
104
  dynamicSteps.selectDisks,
105
105
  dynamicSteps.selectNetwork,
106
- dynamicSteps.readyComplete,
107
- ], // as new
106
+ dynamicSteps.readyComplete
107
+ ] // as new
108
108
  ]
@@ -1,166 +1,31 @@
1
- <template>
2
- <div class="select-name">
3
- <atoms-alert
4
- v-show="errors.length"
5
- :items="errors"
6
- status="alert-danger"
7
- test-id="name-alert"
8
- @remove="onRemoveValidationErrors"
9
- />
10
-
11
- <form
12
- id="virtual-machine-form"
13
- class="flex items-center pt-5"
14
- @submit.prevent
15
- >
16
- <label for="virtual-machine-name"
17
- >{{ localization.common.virtualMachineName }}:</label
18
- >
19
- <input
20
- id="virtual-machine-name"
21
- v-model.trim="model.pvm.name"
22
- data-id="virtual-machine-name-input"
23
- type="text"
24
- maxlength="54"
25
- />
26
- </form>
27
- </div>
28
- </template>
29
-
30
- <script setup lang="ts">
31
- import type { UI_I_Localization } from '~/lib/models/interfaces'
32
- import type { UI_I_NameCheck } from '~/components/common/pages/backups/modals/restore/name/lib/models/interfaces'
33
- import type { UI_I_RestoreForm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
34
-
35
- const model = defineModel<UI_I_RestoreForm>({ required: true })
36
-
37
- const props = defineProps<{
38
- show: boolean
39
- nameFormSubmit: null | Function
40
- }>()
41
- const emits = defineEmits<{
42
- (event: 'check-name', value: UI_I_NameCheck): void
43
- }>()
44
-
45
- const localization = computed<UI_I_Localization>(() => useLocal())
46
-
47
- watch(
48
- () => props.nameFormSubmit,
49
- (newValue) => {
50
- newValue && submit(newValue)
51
- }
52
- )
53
-
54
- const submit = async (cb: Function): Promise<void> => {
55
- const name = model.value.pvm.name
56
-
57
- if (name !== '') {
58
- const isNameValid = await checkNameIsValid(name)
59
- if (!isNameValid) {
60
- // @ts-ignore
61
- cb(false)
62
- return
63
- }
64
- }
65
-
66
- onRemoveValidationErrors()
67
- // @ts-ignore
68
- cb(true)
69
- }
70
- const checkNameIsValid = async (name: string): Promise<boolean> => {
71
- return new Promise((resolve) => {
72
- emits('check-name', {
73
- name,
74
- cb: (error): void => {
75
- const status = error?.statusCode || 200
76
- switch (status) {
77
- case 400: // Empty name
78
- showValidationErrors([
79
- localization.value.common.emptyNameValidationDescription,
80
- ])
81
- resolve(false)
82
- break
83
- case 405: // Invalid kind
84
- showValidationErrors([
85
- localization.value.common.kindValidationDescription,
86
- ])
87
- resolve(false)
88
- break
89
- case 406: // Invalid name
90
- showValidationErrors([
91
- localization.value.common.nameValidationDescription,
92
- ])
93
- resolve(false)
94
- break
95
- case 409: // Name exist
96
- showValidationErrors([
97
- localization.value.common.vmNameExistInSelectedLocation,
98
- ])
99
- resolve(false)
100
- break
101
- }
102
-
103
- resolve(true)
104
- },
105
- })
106
- })
107
- }
108
-
109
- const errors = ref<string[]>([])
110
- const showValidationErrors = (data: string[]): void => {
111
- errors.value = data
112
- }
113
- const onRemoveValidationErrors = (): void => {
114
- errors.value = []
115
- }
116
-
117
- watch(
118
- () => props.show,
119
- (newValue) => {
120
- if (!newValue) return
121
-
122
- const input = document.getElementById('virtual-machine-name')
123
- if (!input) return
124
-
125
- setTimeout(() => {
126
- input.focus()
127
- }, 0)
128
- }
129
- )
130
- </script>
131
-
132
- <style scoped lang="scss">
133
- .select-name {
134
- form {
135
- label {
136
- width: 216px;
137
- }
138
- input {
139
- width: 345px;
140
- }
141
- }
142
-
143
- .tree-view-wrap {
144
- position: relative;
145
- border: 1px solid #000;
146
- padding: 5px;
147
- max-height: 300px;
148
- min-height: 200px;
149
- overflow: auto;
150
- margin-bottom: 10px;
151
- }
152
- }
153
- .content-signpost {
154
- .icon-show-help {
155
- cursor: pointer;
156
- }
157
-
158
- .help-title {
159
- font-size: 22px;
160
- margin-bottom: 24px;
161
- }
162
- .signpost {
163
- max-width: 360px;
164
- }
165
- }
166
- </style>
1
+ <template>
2
+ <common-pages-backups-modals-restore-name-new
3
+ v-if="isNewView"
4
+ v-model="model"
5
+ :messages-fields="props.messagesFields"
6
+ />
7
+ <common-pages-backups-modals-restore-name-old
8
+ v-else
9
+ v-model="model"
10
+ :show="props.show"
11
+ />
12
+ </template>
13
+
14
+ <script setup lang="ts">
15
+ import type { UI_I_ErrorFields } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
16
+ import type { UI_I_RestoreForm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
17
+ import type { UI_I_ArbitraryObject } from '~/lib/models/interfaces'
18
+
19
+ const model = defineModel<UI_I_RestoreForm>({ required: true })
20
+
21
+ const props = defineProps<{
22
+ show: boolean
23
+ messagesFields?: UI_I_ArbitraryObject<UI_I_ErrorFields>
24
+ }>()
25
+
26
+ const { $store }: any = useNuxtApp()
27
+
28
+ const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
29
+ </script>
30
+
31
+ <style scoped lang="scss"></style>