bfg-common 1.5.733 → 1.5.736
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.
- package/components/common/backup/storage/actions/add/steps/typeMode/tooltip/Tooltip.vue +33 -33
- package/components/common/pages/backups/modals/createBackup/CreateBackup.vue +6 -10
- package/components/common/pages/backups/modals/createBackup/Old.vue +8 -10
- package/components/common/pages/backups/modals/createBackup/configuration/backupWindow/BackupWindow.vue +29 -29
- package/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/MaxBandwidth.vue +69 -69
- package/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/lib/config/options.ts +6 -6
- package/components/common/pages/backups/modals/createBackup/configuration/strategy/Strategy.vue +38 -38
- package/components/common/pages/backups/modals/createBackup/datastores/Datastores.vue +6 -0
- package/components/common/pages/backups/modals/createBackup/datastores/DatastoresOld.vue +22 -2
- package/components/common/pages/backups/modals/createBackup/disks/Disks.vue +6 -0
- package/components/common/pages/backups/modals/createBackup/disks/DisksOld.vue +22 -1
- package/components/common/pages/backups/modals/createBackup/general/General.vue +7 -1
- package/components/common/pages/backups/modals/createBackup/general/GeneralOld.vue +17 -0
- package/components/common/pages/backups/modals/createBackup/lib/models/interfaces.ts +8 -8
- package/components/common/pages/backups/modals/createBackup/lib/validation/validations.ts +0 -8
- package/components/common/vm/snapshots/DetailView.vue +90 -0
- package/components/common/vm/snapshots/Old.vue +71 -0
- package/components/common/vm/snapshots/Snapshots.vue +82 -0
- package/components/common/vm/snapshots/lib/models/types.ts +11 -0
- package/components/common/vm/snapshots/modals/confirm/Confirm.vue +48 -0
- package/components/common/vm/snapshots/modals/confirm/New.vue +113 -0
- package/components/common/vm/snapshots/modals/confirm/Old.vue +140 -0
- package/components/common/vm/snapshots/modals/confirm/lib/config/modalTexts.ts +30 -0
- package/components/common/vm/snapshots/modals/confirm/lib/models/enums.ts +19 -0
- package/components/common/vm/snapshots/new/New.vue +389 -0
- package/components/common/vm/snapshots/new/contextMenuView/ContextMenuView.vue +96 -0
- package/components/common/vm/snapshots/new/contextMenuView/lib/config/contextMenuItems.ts +34 -0
- package/components/common/vm/snapshots/new/lib/models/interfaces.ts +12 -0
- package/components/common/vm/snapshots/new/lib/utils/contextMenu.ts +29 -0
- package/components/common/vm/snapshots/new/lib/utils/details.ts +48 -0
- package/components/common/vm/snapshots/tools/Tools.vue +56 -0
- package/components/common/vm/snapshots/tools/lib/config/tabsPannel.ts +39 -0
- package/components/common/wizards/datastore/add/steps/typeMode/tooltip/Tooltip.vue +33 -33
- package/package.json +1 -1
- package/store/inventory/modules/snapshots/lib/models/interfaces.ts +45 -0
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="general">
|
|
3
|
+
<atoms-alert
|
|
4
|
+
v-show="props.alertMessages.length"
|
|
5
|
+
status="alert-danger"
|
|
6
|
+
:items="props.alertMessages"
|
|
7
|
+
test-id="create-backup-name-alert"
|
|
8
|
+
@remove="onRemoveErrors"
|
|
9
|
+
/>
|
|
10
|
+
|
|
3
11
|
<form @submit.prevent>
|
|
4
12
|
<div class="field flex pt-4">
|
|
5
13
|
<label for="general-name">{{ localization.common.name }}:</label>
|
|
@@ -29,11 +37,16 @@
|
|
|
29
37
|
<script lang="ts" setup>
|
|
30
38
|
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
31
39
|
import type { UI_I_CreateBackupForm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
|
|
40
|
+
import { dynamicSteps } from '~/components/common/pages/backups/modals/createBackup/lib/config/steps'
|
|
32
41
|
|
|
33
42
|
const model = defineModel<UI_I_CreateBackupForm>({ required: true })
|
|
34
43
|
|
|
35
44
|
const props = defineProps<{
|
|
36
45
|
show: boolean
|
|
46
|
+
alertMessages: string[]
|
|
47
|
+
}>()
|
|
48
|
+
const emits = defineEmits<{
|
|
49
|
+
(event: 'remove-validation-errors', value: number): void
|
|
37
50
|
}>()
|
|
38
51
|
|
|
39
52
|
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
@@ -51,6 +64,10 @@ watch(
|
|
|
51
64
|
}, 0)
|
|
52
65
|
}
|
|
53
66
|
)
|
|
67
|
+
|
|
68
|
+
const onRemoveErrors = (): void => {
|
|
69
|
+
emits('remove-validation-errors', dynamicSteps.general)
|
|
70
|
+
}
|
|
54
71
|
</script>
|
|
55
72
|
|
|
56
73
|
<style lang="scss" scoped>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export interface UI_I_DynamicSteps {
|
|
2
|
-
general: number
|
|
3
|
-
disks: number
|
|
4
|
-
datastores: number
|
|
5
|
-
configuration: number
|
|
6
|
-
readyComplete: number
|
|
7
|
-
schedulingOptions: number
|
|
8
|
-
}
|
|
1
|
+
export interface UI_I_DynamicSteps {
|
|
2
|
+
general: number
|
|
3
|
+
disks: number
|
|
4
|
+
datastores: number
|
|
5
|
+
configuration: number
|
|
6
|
+
readyComplete: number
|
|
7
|
+
schedulingOptions: number
|
|
8
|
+
}
|
|
@@ -76,8 +76,6 @@ export const checkDisks = (
|
|
|
76
76
|
backupForm: UI_I_CreateBackupForm,
|
|
77
77
|
wizard: Wizard,
|
|
78
78
|
localization: UI_I_Localization,
|
|
79
|
-
showValidationErrors: (data: string[]) => void,
|
|
80
|
-
onRemoveValidationErrors: () => void
|
|
81
79
|
): UI_I_ValidationReturn => {
|
|
82
80
|
let stepHasError = false
|
|
83
81
|
const isValidStores = !!backupForm?.disk_devices.length
|
|
@@ -87,10 +85,8 @@ export const checkDisks = (
|
|
|
87
85
|
fieldMessage: localization.common.diskIsRequired,
|
|
88
86
|
alertMessage: localization.common.diskIsRequired
|
|
89
87
|
})
|
|
90
|
-
showValidationErrors([localization.common.diskIsRequired])
|
|
91
88
|
} else if (wizard.hasMessage(dynamicSteps.disks, 'disk_devices')) {
|
|
92
89
|
value = wizard.removeValidation(dynamicSteps.disks, 'disk_devices', value)
|
|
93
|
-
onRemoveValidationErrors()
|
|
94
90
|
}
|
|
95
91
|
|
|
96
92
|
return {
|
|
@@ -104,8 +100,6 @@ export const checkDatastore = (
|
|
|
104
100
|
backupForm: UI_I_CreateBackupForm,
|
|
105
101
|
wizard: Wizard,
|
|
106
102
|
localization: UI_I_Localization,
|
|
107
|
-
showValidationErrors: (data: string[]) => void,
|
|
108
|
-
onRemoveValidationErrors: () => void
|
|
109
103
|
): UI_I_ValidationReturn => {
|
|
110
104
|
let stepHasError = false
|
|
111
105
|
const isValidStorage = !!backupForm?.backup_storage.length
|
|
@@ -115,10 +109,8 @@ export const checkDatastore = (
|
|
|
115
109
|
fieldMessage: localization.common.datastoreIsRequired,
|
|
116
110
|
alertMessage: localization.common.datastoreIsRequired
|
|
117
111
|
})
|
|
118
|
-
showValidationErrors([localization.common.datastoreIsRequired])
|
|
119
112
|
} else if (wizard.hasMessage(dynamicSteps.datastores, 'backup_storage')) {
|
|
120
113
|
value = wizard.removeValidation(dynamicSteps.datastores, 'backup_storage', value)
|
|
121
|
-
onRemoveValidationErrors()
|
|
122
114
|
}
|
|
123
115
|
|
|
124
116
|
return { stepHasError, newValue: value }
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="detail-view overflow-auto py-0 px-6">
|
|
3
|
+
<table
|
|
4
|
+
v-if="detailData"
|
|
5
|
+
class="table table-noborder"
|
|
6
|
+
data-id="detail-view-table"
|
|
7
|
+
>
|
|
8
|
+
<tbody>
|
|
9
|
+
<tr>
|
|
10
|
+
<td class="left">{{ localization.common.name }}</td>
|
|
11
|
+
<td class="left snapshot-name-label" data-id="vm-snapshot-name">
|
|
12
|
+
{{ detailData.name }}
|
|
13
|
+
</td>
|
|
14
|
+
</tr>
|
|
15
|
+
<tr>
|
|
16
|
+
<td class="left">{{ localization.common.description }}</td>
|
|
17
|
+
<td
|
|
18
|
+
class="left snapshot-name-label"
|
|
19
|
+
data-id="vm-snapshot-description"
|
|
20
|
+
>
|
|
21
|
+
{{ detailData.description }}
|
|
22
|
+
</td>
|
|
23
|
+
</tr>
|
|
24
|
+
<tr>
|
|
25
|
+
<td class="left">{{ localization.common.timestamp }}</td>
|
|
26
|
+
<td class="left snapshot-name-label" data-id="vm-snapshot-timestamp">
|
|
27
|
+
{{ detailData.timestamp }}
|
|
28
|
+
</td>
|
|
29
|
+
</tr>
|
|
30
|
+
<tr>
|
|
31
|
+
<td class="left">{{ localization.common.size }}</td>
|
|
32
|
+
<td class="left snapshot-name-label">{{ detailData.size }}</td>
|
|
33
|
+
</tr>
|
|
34
|
+
<tr>
|
|
35
|
+
<td class="left">
|
|
36
|
+
{{ localization.common.snapshotTheVirtualMachinesMemory }}
|
|
37
|
+
</td>
|
|
38
|
+
<td class="left snapshot-name-label" data-id="vm-snapshot-of-memory">
|
|
39
|
+
{{ detailData.snapshot_the_virtual_machines_memory }}
|
|
40
|
+
</td>
|
|
41
|
+
</tr>
|
|
42
|
+
<tr>
|
|
43
|
+
<td class="left">
|
|
44
|
+
{{ localization.common.quiesceGuestFileSystem }}
|
|
45
|
+
</td>
|
|
46
|
+
<td
|
|
47
|
+
class="left snapshot-name-label"
|
|
48
|
+
data-id="vm-snapshot-file-system"
|
|
49
|
+
>
|
|
50
|
+
{{ detailData.quiesce_guest_file_system }}
|
|
51
|
+
</td>
|
|
52
|
+
</tr>
|
|
53
|
+
</tbody>
|
|
54
|
+
</table>
|
|
55
|
+
</div>
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<script setup lang="ts">
|
|
59
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
60
|
+
import type { UI_I_SnapshotsDetails } from '~/store/inventory/modules/snapshots/lib/models/interfaces'
|
|
61
|
+
|
|
62
|
+
const props = defineProps<{
|
|
63
|
+
detail: UI_I_SnapshotsDetails | null
|
|
64
|
+
}>()
|
|
65
|
+
|
|
66
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
67
|
+
|
|
68
|
+
const detailData = ref<any | null>(null)
|
|
69
|
+
watch(
|
|
70
|
+
() => props.detail,
|
|
71
|
+
(newValue) => {
|
|
72
|
+
if (!newValue) return
|
|
73
|
+
|
|
74
|
+
detailData.value = newValue
|
|
75
|
+
},
|
|
76
|
+
{ immediate: true, deep: true }
|
|
77
|
+
)
|
|
78
|
+
</script>
|
|
79
|
+
|
|
80
|
+
<style scoped lang="scss">
|
|
81
|
+
.detail-view {
|
|
82
|
+
width: 50%;
|
|
83
|
+
|
|
84
|
+
.table {
|
|
85
|
+
.left:not(.snapshot-name-label) {
|
|
86
|
+
width: 320px;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
</style>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="main-content-snapshots h-full overflow-hidden">
|
|
3
|
+
<common-vm-snapshots-tools
|
|
4
|
+
:snapshots-count="props.snapshotsTree.length"
|
|
5
|
+
:snapshots-loading="props.snapshotsLoading"
|
|
6
|
+
@select="emits('show-modal', $event)"
|
|
7
|
+
/>
|
|
8
|
+
|
|
9
|
+
<atoms-loader-pre-loader
|
|
10
|
+
v-show="props.snapshotsLoading"
|
|
11
|
+
id="loader"
|
|
12
|
+
class="snapshots-loading w-full h-full flex items-center justify-center"
|
|
13
|
+
test-id="snapshots-tree-spinner"
|
|
14
|
+
show
|
|
15
|
+
/>
|
|
16
|
+
<div class="fill-parent w-full h-full">
|
|
17
|
+
<div
|
|
18
|
+
v-if="props.snapshotsTree.length"
|
|
19
|
+
class="snapshot-view mt-1 flex w-full"
|
|
20
|
+
>
|
|
21
|
+
<common-tree-view
|
|
22
|
+
:loading="props.snapshotsLoading"
|
|
23
|
+
:nodes="props.snapshotsTree"
|
|
24
|
+
@select-node="emits('select-node', $event)"
|
|
25
|
+
@show-nodes="emits('show-nodes', $event)"
|
|
26
|
+
/>
|
|
27
|
+
<common-vm-snapshots-detail-view :detail="props.detailData" />
|
|
28
|
+
</div>
|
|
29
|
+
<div v-else class="empty-block flex items-center justify-center w-full">
|
|
30
|
+
{{ localization.common.noSnapshotAvailable }}
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script setup lang="ts">
|
|
37
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
38
|
+
import type {
|
|
39
|
+
UI_I_SnapshotsDetails,
|
|
40
|
+
UI_I_SnapshotsTreeNode,
|
|
41
|
+
} from '~/store/inventory/modules/snapshots/lib/models/interfaces'
|
|
42
|
+
import type { UI_T_SnapshotActionType } from '~/components/common/vm/snapshots/lib/models/types'
|
|
43
|
+
|
|
44
|
+
const props = defineProps<{
|
|
45
|
+
snapshotsTree: UI_I_SnapshotsTreeNode[]
|
|
46
|
+
snapshotsLoading: boolean
|
|
47
|
+
detailData: UI_I_SnapshotsDetails | null
|
|
48
|
+
}>()
|
|
49
|
+
|
|
50
|
+
const emits = defineEmits<{
|
|
51
|
+
(event: 'show-modal', value: UI_T_SnapshotActionType): void
|
|
52
|
+
(event: 'select-node', value: UI_I_SnapshotsTreeNode): void
|
|
53
|
+
(event: 'show-nodes', value: string): void
|
|
54
|
+
}>()
|
|
55
|
+
|
|
56
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<style scoped lang="scss">
|
|
60
|
+
.main-content-snapshots {
|
|
61
|
+
padding: 10px 5px 10px 0;
|
|
62
|
+
|
|
63
|
+
.fill-parent {
|
|
64
|
+
overflow: visible;
|
|
65
|
+
|
|
66
|
+
.snapshot-view {
|
|
67
|
+
height: 90%;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
</style>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
:is="currentComponent"
|
|
4
|
+
:snapshots-tree="props.snapshotsTree"
|
|
5
|
+
:snapshots-loading="props.snapshotsLoading"
|
|
6
|
+
:detail-data="detailData"
|
|
7
|
+
@show-modal="onShowModal"
|
|
8
|
+
@select-node="onSelectNode"
|
|
9
|
+
@show-nodes="onShowNodes"
|
|
10
|
+
/>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
15
|
+
import type { UI_T_SnapshotActionType } from '~/components/common/vm/snapshots/lib/models/types'
|
|
16
|
+
import type {
|
|
17
|
+
UI_I_SnapshotsDetails,
|
|
18
|
+
UI_I_SnapshotsTreeNode,
|
|
19
|
+
} from '~/store/inventory/modules/snapshots/lib/models/interfaces'
|
|
20
|
+
|
|
21
|
+
const props = defineProps<{
|
|
22
|
+
snapshotsTree: UI_I_SnapshotsTreeNode
|
|
23
|
+
snapshotsLoading: boolean
|
|
24
|
+
}>()
|
|
25
|
+
|
|
26
|
+
const emits = defineEmits<{
|
|
27
|
+
(event: 'select-node', value: UI_I_SnapshotsTreeNode): void
|
|
28
|
+
(event: 'show-nodes', value: string): void
|
|
29
|
+
(event: 'show-modal', value: UI_T_SnapshotActionType): void
|
|
30
|
+
}>()
|
|
31
|
+
|
|
32
|
+
const { $recursion, $store }: any = useNuxtApp()
|
|
33
|
+
|
|
34
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
35
|
+
|
|
36
|
+
const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
|
|
37
|
+
const currentComponent = computed(() =>
|
|
38
|
+
isNewView.value
|
|
39
|
+
? defineAsyncComponent(() => import('./new/New.vue'))
|
|
40
|
+
: defineAsyncComponent(() => import('./Old.vue'))
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
const detailData = computed<UI_I_SnapshotsDetails | null>(() => {
|
|
44
|
+
const node: UI_I_SnapshotsTreeNode =
|
|
45
|
+
$recursion.find(props.snapshotsTree, true, 'isActive', 'nodes') || null
|
|
46
|
+
|
|
47
|
+
if (!node) return null
|
|
48
|
+
|
|
49
|
+
let snapshot_the_virtual_machines_memory = ''
|
|
50
|
+
let quiesce_guest_file_system = ''
|
|
51
|
+
|
|
52
|
+
if (isNewView.value) {
|
|
53
|
+
snapshot_the_virtual_machines_memory = node.memory?.enabled ? 'yes' : 'no'
|
|
54
|
+
quiesce_guest_file_system = node.quiesce_fs ? 'yes' : 'no'
|
|
55
|
+
} else {
|
|
56
|
+
snapshot_the_virtual_machines_memory = node.memory?.enabled
|
|
57
|
+
? localization.value.common.yes
|
|
58
|
+
: localization.value.common.no
|
|
59
|
+
quiesce_guest_file_system = node.quiesce_fs
|
|
60
|
+
? localization.value.common.yes
|
|
61
|
+
: localization.value.common.no
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
...node,
|
|
66
|
+
snapshot_the_virtual_machines_memory,
|
|
67
|
+
quiesce_guest_file_system,
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
const onSelectNode = (item: UI_I_SnapshotsTreeNode): void => {
|
|
71
|
+
emits('select-node', item.type === 'location' ? item.parent_id : item.id)
|
|
72
|
+
}
|
|
73
|
+
const onShowNodes = (id: string): void => {
|
|
74
|
+
emits('show-nodes', id)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const onShowModal = (action: UI_T_SnapshotActionType): void => {
|
|
78
|
+
emits('show-modal', action)
|
|
79
|
+
}
|
|
80
|
+
</script>
|
|
81
|
+
|
|
82
|
+
<style scoped lang="scss"></style>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
:is="currentComponent"
|
|
4
|
+
v-model:suspend-on-revert="suspendOnRevert"
|
|
5
|
+
:type="props.type"
|
|
6
|
+
:snapshot="props.snapshot"
|
|
7
|
+
:snapshots-count="props.snapshotsCount"
|
|
8
|
+
:vm-state="props.vmState"
|
|
9
|
+
@hide="emits('hide')"
|
|
10
|
+
@submit="emits('submit', suspendOnRevert)"
|
|
11
|
+
/>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script setup lang="ts">
|
|
15
|
+
import type { UI_I_SnapshotsTreeNode } from '~/store/inventory/modules/snapshots/lib/models/interfaces'
|
|
16
|
+
import type { UI_T_SnapshotActionType } from '~/components/common/vm/snapshots/lib/models/types'
|
|
17
|
+
|
|
18
|
+
const props = withDefaults(
|
|
19
|
+
defineProps<{
|
|
20
|
+
type: UI_T_SnapshotActionType
|
|
21
|
+
snapshot: UI_I_SnapshotsTreeNode | null
|
|
22
|
+
snapshotsCount: number
|
|
23
|
+
targets: string[]
|
|
24
|
+
vmState?: number | null
|
|
25
|
+
}>(),
|
|
26
|
+
{
|
|
27
|
+
vmState: null,
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
const emits = defineEmits<{
|
|
32
|
+
(event: 'hide'): void
|
|
33
|
+
(event: 'submit', value: boolean): void
|
|
34
|
+
}>()
|
|
35
|
+
|
|
36
|
+
const { $store }: any = useNuxtApp()
|
|
37
|
+
|
|
38
|
+
const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
|
|
39
|
+
const currentComponent = computed(() =>
|
|
40
|
+
isNewView.value
|
|
41
|
+
? defineAsyncComponent(() => import('./New.vue'))
|
|
42
|
+
: defineAsyncComponent(() => import('./Old.vue'))
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
const suspendOnRevert = ref<boolean>(false)
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<style scoped lang="scss"></style>
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<common-modals-confirmation
|
|
3
|
+
:headline="title"
|
|
4
|
+
:description="descriptionText"
|
|
5
|
+
:modal-texts="modalTextsLocal"
|
|
6
|
+
:loading="false"
|
|
7
|
+
:icon-name="modalIcon"
|
|
8
|
+
test-id="vm-snapshots-modal"
|
|
9
|
+
is-new-view
|
|
10
|
+
@hide-modal="emits('hide')"
|
|
11
|
+
@confirm="emits('submit')"
|
|
12
|
+
>
|
|
13
|
+
<template v-if="props.type === 'revert'" #otherContent>
|
|
14
|
+
<div class="confirm-modal-checkbox-content mt-4 p-3">
|
|
15
|
+
<ui-checkbox
|
|
16
|
+
v-model="suspendOnRevert"
|
|
17
|
+
:label-text="
|
|
18
|
+
localization.common
|
|
19
|
+
.suspendThisVirtualMachineWhenRevertingToSelectedSnapshot
|
|
20
|
+
"
|
|
21
|
+
:disabled="props.vmState === 2"
|
|
22
|
+
test-id="vm-snapshots-modal-revert-checkbox"
|
|
23
|
+
class="confirm-modal-checkbox flex items-start"
|
|
24
|
+
size="md"
|
|
25
|
+
/>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
</common-modals-confirmation>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script setup lang="ts">
|
|
32
|
+
import type { UI_I_ModalTexts } from '~/node_modules/bfg-uikit/components/ui/modal/models/interfaces'
|
|
33
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
34
|
+
import type { UI_I_SnapshotsTreeNode } from '~/store/inventory/modules/snapshots/lib/models/interfaces'
|
|
35
|
+
import type { UI_T_SnapshotActionType } from '~/components/common/vm/snapshots/lib/models/types'
|
|
36
|
+
import { UI_E_TitleModal } from '~/components/common/vm/snapshots/modals/confirm/lib/models/enums'
|
|
37
|
+
import { modalTexts } from '~/components/common/vm/snapshots/modals/confirm/lib/config/modalTexts'
|
|
38
|
+
|
|
39
|
+
const suspendOnRevert = defineModel<boolean>('suspendOnRevert', {
|
|
40
|
+
required: true,
|
|
41
|
+
})
|
|
42
|
+
const props = defineProps<{
|
|
43
|
+
type: UI_T_SnapshotActionType
|
|
44
|
+
snapshot: UI_I_SnapshotsTreeNode | null
|
|
45
|
+
snapshotsCount: number
|
|
46
|
+
vmState: number | null
|
|
47
|
+
}>()
|
|
48
|
+
|
|
49
|
+
const emits = defineEmits<{
|
|
50
|
+
(event: 'hide'): void
|
|
51
|
+
(event: 'submit'): void
|
|
52
|
+
}>()
|
|
53
|
+
|
|
54
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
55
|
+
|
|
56
|
+
const modalTextsLocal = computed<UI_I_ModalTexts>(() =>
|
|
57
|
+
modalTexts(localization.value, props.type)
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
const title = computed<string>(() =>
|
|
61
|
+
props.snapshotsCount === 1 && props.type === 'delete'
|
|
62
|
+
? localization.value.snapshots.deleteTheLastSnapshot
|
|
63
|
+
: localization.value.snapshots[UI_E_TitleModal[props.type]] || ''
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
const modalIcon = computed<string>(() =>
|
|
67
|
+
props.type === 'delete_all' ||
|
|
68
|
+
(props.snapshotsCount === 1 && props.type === 'delete')
|
|
69
|
+
? 'circle-warning'
|
|
70
|
+
: 'info-status'
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
const descriptionText = computed<string>(() => {
|
|
74
|
+
let description: string
|
|
75
|
+
|
|
76
|
+
switch (props.type) {
|
|
77
|
+
case 'delete_all':
|
|
78
|
+
description = localization.value.snapshots.deleteAllSnapshotsDescription
|
|
79
|
+
break
|
|
80
|
+
|
|
81
|
+
case 'revert':
|
|
82
|
+
description =
|
|
83
|
+
localization.value.snapshots.revertToSnapshotDescription.replace(
|
|
84
|
+
'{0}',
|
|
85
|
+
props.snapshot?.name || ''
|
|
86
|
+
)
|
|
87
|
+
break
|
|
88
|
+
|
|
89
|
+
default:
|
|
90
|
+
description =
|
|
91
|
+
props.snapshotsCount === 1
|
|
92
|
+
? localization.value.snapshots.deleteLastSnapshotsDescription
|
|
93
|
+
: localization.value.snapshots.deleteSnapshotConfirmationDescription.replace(
|
|
94
|
+
'{0}',
|
|
95
|
+
props.snapshot?.name || ''
|
|
96
|
+
)
|
|
97
|
+
break
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return description
|
|
101
|
+
})
|
|
102
|
+
</script>
|
|
103
|
+
|
|
104
|
+
<style scoped lang="scss">
|
|
105
|
+
.confirm-modal-checkbox-content {
|
|
106
|
+
background-color: #e9ebed66;
|
|
107
|
+
border-radius: 8px;
|
|
108
|
+
|
|
109
|
+
.confirm-modal-checkbox {
|
|
110
|
+
height: max-content;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
</style>
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<atoms-modal
|
|
3
|
+
:title="title"
|
|
4
|
+
test-id="vm-snapshots-modal"
|
|
5
|
+
width="576px"
|
|
6
|
+
show
|
|
7
|
+
@hide="onHide"
|
|
8
|
+
@submit="onConfirm"
|
|
9
|
+
>
|
|
10
|
+
<template #modalBody>
|
|
11
|
+
<div v-if="props.type === 'revert'">
|
|
12
|
+
<p class="description-text" data-id="description-revert-content">
|
|
13
|
+
{{ descriptionRevertContent }}
|
|
14
|
+
</p>
|
|
15
|
+
<div class="flex-row mt-1">
|
|
16
|
+
<div
|
|
17
|
+
:class="[
|
|
18
|
+
'clr-checkbox-wrapper flex-align-center w-100',
|
|
19
|
+
{ disabled: props.vmState === 2 },
|
|
20
|
+
]"
|
|
21
|
+
>
|
|
22
|
+
<input
|
|
23
|
+
id="suspend-on-revert"
|
|
24
|
+
v-model="suspendOnRevert"
|
|
25
|
+
:disabled="props.vmState === 2"
|
|
26
|
+
data-id="suspend-on-revert-checkbox"
|
|
27
|
+
type="checkbox"
|
|
28
|
+
class="checkbox-btn"
|
|
29
|
+
/>
|
|
30
|
+
<label for="suspend-on-revert" class="clr-control-label">{{
|
|
31
|
+
localization.common
|
|
32
|
+
.suspendThisVirtualMachineWhenRevertingToSelectedSnapshot
|
|
33
|
+
}}</label>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
<div v-else-if="props.type === 'delete'">
|
|
38
|
+
<p class="description-text" data-id="description-delete-content">
|
|
39
|
+
{{ descriptionDeleteContent }}
|
|
40
|
+
</p>
|
|
41
|
+
</div>
|
|
42
|
+
<div v-else-if="props.type === 'delete_all'">
|
|
43
|
+
<p class="description-text" data-id="delete-all-snapshots-description">
|
|
44
|
+
{{ localization.snapshots.deleteAllSnapshotsDescription }}
|
|
45
|
+
</p>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
48
|
+
<template #modalFooter>
|
|
49
|
+
<button
|
|
50
|
+
id="snapshot-confirm-modal-close-button"
|
|
51
|
+
data-id="snapshot-confirm-modal-close-button"
|
|
52
|
+
class="btn btn-outline"
|
|
53
|
+
@click="onHide"
|
|
54
|
+
>
|
|
55
|
+
{{ localization.common.cancel }}
|
|
56
|
+
</button>
|
|
57
|
+
<button
|
|
58
|
+
id="snapshot-confirm-modal-apply-button"
|
|
59
|
+
data-id="snapshot-confirm-modal-apply-button"
|
|
60
|
+
class="btn btn-danger"
|
|
61
|
+
@click="onConfirm"
|
|
62
|
+
>
|
|
63
|
+
{{ titleConfirmButton }}
|
|
64
|
+
</button>
|
|
65
|
+
</template>
|
|
66
|
+
</atoms-modal>
|
|
67
|
+
</template>
|
|
68
|
+
|
|
69
|
+
<script setup lang="ts">
|
|
70
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
71
|
+
import type { UI_I_SnapshotsTreeNode } from '~/store/inventory/modules/snapshots/lib/models/interfaces'
|
|
72
|
+
import type { UI_T_SnapshotActionType } from '~/components/common/vm/snapshots/lib/models/types'
|
|
73
|
+
import {
|
|
74
|
+
UI_E_TitleConfirmModal,
|
|
75
|
+
UI_E_TitleModal,
|
|
76
|
+
} from '~/components/common/vm/snapshots/modals/confirm/lib/models/enums'
|
|
77
|
+
|
|
78
|
+
const suspendOnRevert = defineModel<boolean>('suspendOnRevert', {
|
|
79
|
+
required: true,
|
|
80
|
+
})
|
|
81
|
+
const props = defineProps<{
|
|
82
|
+
type: UI_T_SnapshotActionType
|
|
83
|
+
snapshot: UI_I_SnapshotsTreeNode | null
|
|
84
|
+
snapshotsCount: number
|
|
85
|
+
vmState: number | null
|
|
86
|
+
}>()
|
|
87
|
+
|
|
88
|
+
const emits = defineEmits<{
|
|
89
|
+
(event: 'hide'): void
|
|
90
|
+
(event: 'submit'): void
|
|
91
|
+
}>()
|
|
92
|
+
|
|
93
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
94
|
+
|
|
95
|
+
const title = computed<string>(() =>
|
|
96
|
+
props.snapshotsCount === 1 && props.type === 'delete'
|
|
97
|
+
? localization.value.snapshots.deleteTheLastSnapshot
|
|
98
|
+
: localization.value.snapshots[UI_E_TitleModal[props.type]] || ''
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
const titleConfirmButton = computed<string>(
|
|
102
|
+
() => localization.value.common[UI_E_TitleConfirmModal[props.type]] || ''
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
const descriptionRevertContent = computed<string>(() =>
|
|
106
|
+
localization.value.snapshots.revertToSnapshotDescription.replace(
|
|
107
|
+
'{0}',
|
|
108
|
+
props.snapshot?.name || ''
|
|
109
|
+
)
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
const descriptionDeleteContent = computed<string>(() =>
|
|
113
|
+
props.snapshotsCount === 1
|
|
114
|
+
? localization.value.snapshots.deleteLastSnapshotsDescription
|
|
115
|
+
: localization.value.snapshots.deleteSnapshotConfirmationDescription.replace(
|
|
116
|
+
'{0}',
|
|
117
|
+
props.snapshot?.name || ''
|
|
118
|
+
)
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
const onHide = (): void => {
|
|
122
|
+
emits('hide')
|
|
123
|
+
}
|
|
124
|
+
const onConfirm = (): void => {
|
|
125
|
+
emits('submit')
|
|
126
|
+
}
|
|
127
|
+
</script>
|
|
128
|
+
|
|
129
|
+
<style scoped lang="scss">
|
|
130
|
+
.description-text {
|
|
131
|
+
font-size: 14px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.clr-checkbox-wrapper.disabled {
|
|
135
|
+
.clr-control-label {
|
|
136
|
+
opacity: 0.3;
|
|
137
|
+
cursor: not-allowed;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
</style>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { UI_I_ModalTexts } from '~/node_modules/bfg-uikit/components/ui/modal/models/interfaces'
|
|
2
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
3
|
+
import type {
|
|
4
|
+
UI_T_SnapshotActionType,
|
|
5
|
+
UI_T_TakeOrEdit,
|
|
6
|
+
} from '~/components/common/vm/snapshots/lib/models/types'
|
|
7
|
+
|
|
8
|
+
export const modalTexts = (
|
|
9
|
+
localization: UI_I_Localization,
|
|
10
|
+
type: UI_T_SnapshotActionType | UI_T_TakeOrEdit
|
|
11
|
+
): UI_I_ModalTexts => {
|
|
12
|
+
const actionTextMap: Record<
|
|
13
|
+
UI_T_SnapshotActionType | UI_T_TakeOrEdit,
|
|
14
|
+
string
|
|
15
|
+
> = {
|
|
16
|
+
take: localization.common.create,
|
|
17
|
+
group_take: localization.common.create,
|
|
18
|
+
groupTake: localization.common.create,
|
|
19
|
+
edit: localization.common.save,
|
|
20
|
+
revert: localization.common.revert,
|
|
21
|
+
delete: localization.common.delete,
|
|
22
|
+
delete_all: localization.common.deleteAll,
|
|
23
|
+
group_delete_all: localization.common.deleteAll,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
button1: localization.common.cancel,
|
|
28
|
+
button2: actionTextMap[type],
|
|
29
|
+
}
|
|
30
|
+
}
|