bfg-common 1.5.741 → 1.5.743
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/vm/snapshots/lib/models/interfaces.ts +5 -0
- package/components/common/vm/snapshots/modals/confirm/New.vue +1 -1
- package/components/common/vm/snapshots/modals/takeOrEdit/Old.vue +220 -0
- package/components/common/vm/snapshots/modals/takeOrEdit/TakeOrEdit.vue +51 -0
- package/components/common/vm/snapshots/modals/takeOrEdit/new/New.vue +168 -0
- package/components/common/vm/snapshots/modals/takeOrEdit/new/lib/utils/getSnapshotsName.ts +15 -0
- package/package.json +1 -1
- /package/components/common/vm/snapshots/modals/{confirm/lib → lib}/config/modalTexts.ts +0 -0
|
@@ -34,7 +34,7 @@ import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
|
34
34
|
import type { UI_I_SnapshotsTreeNode } from '~/store/inventory/modules/snapshots/lib/models/interfaces'
|
|
35
35
|
import type { UI_T_SnapshotActionType } from '~/components/common/vm/snapshots/lib/models/types'
|
|
36
36
|
import { UI_E_TitleModal } from '~/components/common/vm/snapshots/modals/confirm/lib/models/enums'
|
|
37
|
-
import { modalTexts } from '~/components/common/vm/snapshots/modals/
|
|
37
|
+
import { modalTexts } from '~/components/common/vm/snapshots/modals/lib/config/modalTexts'
|
|
38
38
|
|
|
39
39
|
const suspendOnRevert = defineModel<boolean>('suspendOnRevert', {
|
|
40
40
|
required: true,
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<atoms-modal
|
|
3
|
+
:title="title"
|
|
4
|
+
:modal-loading="props.isLoading"
|
|
5
|
+
test-id="vm-take-edit-snapshot-modal"
|
|
6
|
+
width="576px"
|
|
7
|
+
show
|
|
8
|
+
@hide="onHide"
|
|
9
|
+
@submit="onSubmit"
|
|
10
|
+
>
|
|
11
|
+
<template #modalBody>
|
|
12
|
+
<div v-if="formLocal" class="form-block mt-1">
|
|
13
|
+
<div class="form-group flex justify-between mb-5">
|
|
14
|
+
<label for="snapshotName" class="label-form-group">
|
|
15
|
+
<span>{{ localization.common.name }}</span>
|
|
16
|
+
</label>
|
|
17
|
+
|
|
18
|
+
<div :class="['clr-control-container', isNameError && 'clr-error']">
|
|
19
|
+
<div class="flex-align-center">
|
|
20
|
+
<input
|
|
21
|
+
id="snapshotName"
|
|
22
|
+
v-model="formLocal.name"
|
|
23
|
+
data-id="snapshot-name-input"
|
|
24
|
+
class="clr-input input-form w-full"
|
|
25
|
+
type="text"
|
|
26
|
+
size="40"
|
|
27
|
+
maxlength="80"
|
|
28
|
+
autofocus
|
|
29
|
+
@input="onCheckNameValidation"
|
|
30
|
+
/>
|
|
31
|
+
</div>
|
|
32
|
+
<div
|
|
33
|
+
v-if="isNameError"
|
|
34
|
+
class="clr-subtext"
|
|
35
|
+
data-id="snapshot-name-field-require"
|
|
36
|
+
>
|
|
37
|
+
{{ localization.common.fieldRequired }}
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
<div class="form-group flex justify-between mb-5">
|
|
42
|
+
<label for="snapshotDescription" class="label-form-group">
|
|
43
|
+
<span>{{ localization.common.description }}</span>
|
|
44
|
+
</label>
|
|
45
|
+
<textarea
|
|
46
|
+
id="snapshotDescription"
|
|
47
|
+
v-model="formLocal.description"
|
|
48
|
+
data-id="snapshot-description-textarea"
|
|
49
|
+
cols="80"
|
|
50
|
+
rows="4"
|
|
51
|
+
class="textarea-form"
|
|
52
|
+
/>
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
<div v-if="props.type === 'take'">
|
|
56
|
+
<div class="flex-row first">
|
|
57
|
+
<div
|
|
58
|
+
:class="[
|
|
59
|
+
'clr-checkbox-wrapper checkbox-content flex-align-center w-100',
|
|
60
|
+
{ disabled: props.isDisabledSaveVm },
|
|
61
|
+
]"
|
|
62
|
+
>
|
|
63
|
+
<input
|
|
64
|
+
id="include-virtual-machines-memory"
|
|
65
|
+
v-model="isIncludeVirtualMachinesMemory"
|
|
66
|
+
:disabled="props.isDisabledSaveVm"
|
|
67
|
+
data-id="include-virtual-machines-memory-checkbox"
|
|
68
|
+
type="checkbox"
|
|
69
|
+
class="checkbox-btn"
|
|
70
|
+
/>
|
|
71
|
+
<label
|
|
72
|
+
for="include-virtual-machines-memory"
|
|
73
|
+
class="clr-control-label"
|
|
74
|
+
>{{ localization.snapshots.saveVirtualMachineMemory }}</label
|
|
75
|
+
>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
<div class="flex-row mb-1">
|
|
80
|
+
<div
|
|
81
|
+
class="clr-checkbox-wrapper checkbox-content disabled flex-align-center w-100"
|
|
82
|
+
>
|
|
83
|
+
<input
|
|
84
|
+
id="quiesce-guest-file-system-requires-vm-tools"
|
|
85
|
+
v-model="isQuiesceGuestFileSystemRequiresVMTools"
|
|
86
|
+
data-id="quiesce-guest-file-system-requires-vm-tools-checkbox"
|
|
87
|
+
type="checkbox"
|
|
88
|
+
class="checkbox-btn"
|
|
89
|
+
disabled
|
|
90
|
+
/>
|
|
91
|
+
<label
|
|
92
|
+
for="quiesce-guest-file-system-requires-vm-tools"
|
|
93
|
+
class="clr-control-label"
|
|
94
|
+
>{{
|
|
95
|
+
localization.common.quiesceGuestFileSystemRequiresVMTools
|
|
96
|
+
}}</label
|
|
97
|
+
>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
</template>
|
|
103
|
+
<template #modalFooter>
|
|
104
|
+
<button
|
|
105
|
+
id="take-snapshot-modal-close-button"
|
|
106
|
+
data-id="take-snapshot-modal-close-button"
|
|
107
|
+
class="btn btn-outline"
|
|
108
|
+
@click="onHide"
|
|
109
|
+
>
|
|
110
|
+
{{ localization.common.cancel }}
|
|
111
|
+
</button>
|
|
112
|
+
<button
|
|
113
|
+
id="take-snapshot-modal-apply-button"
|
|
114
|
+
:disabled="isNameError"
|
|
115
|
+
data-id="take-snapshot-modal-apply-button"
|
|
116
|
+
class="btn btn-primary"
|
|
117
|
+
@click="onSubmit"
|
|
118
|
+
>
|
|
119
|
+
{{ applyButtonText }}
|
|
120
|
+
</button>
|
|
121
|
+
</template>
|
|
122
|
+
</atoms-modal>
|
|
123
|
+
</template>
|
|
124
|
+
|
|
125
|
+
<script setup lang="ts">
|
|
126
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
127
|
+
import type { UI_T_TakeOrEdit } from '~/components/common/vm/snapshots/lib/models/types'
|
|
128
|
+
import type { UI_I_TakeEditSnapshot } from '~/components/common/vm/snapshots/lib/models/interfaces'
|
|
129
|
+
|
|
130
|
+
const formLocal = defineModel<UI_I_TakeEditSnapshot>('formLocal', {
|
|
131
|
+
required: true,
|
|
132
|
+
})
|
|
133
|
+
const isIncludeVirtualMachinesMemory = defineModel<boolean>(
|
|
134
|
+
'isIncludeVmMemory',
|
|
135
|
+
{ required: true }
|
|
136
|
+
)
|
|
137
|
+
const isQuiesceGuestFileSystemRequiresVMTools = defineModel<boolean>(
|
|
138
|
+
'isQuiesceGuestFileSystem',
|
|
139
|
+
{ required: true }
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
const props = defineProps<{
|
|
143
|
+
type: UI_T_TakeOrEdit
|
|
144
|
+
isDisabledSaveVm: boolean
|
|
145
|
+
isLoading: boolean
|
|
146
|
+
}>()
|
|
147
|
+
|
|
148
|
+
const emits = defineEmits<{
|
|
149
|
+
(event: 'hide'): void
|
|
150
|
+
(event: 'submit'): void
|
|
151
|
+
}>()
|
|
152
|
+
|
|
153
|
+
const { $text }: any = useNuxtApp()
|
|
154
|
+
|
|
155
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
156
|
+
|
|
157
|
+
const title = computed<string>(() =>
|
|
158
|
+
props.type === 'take' || props.type === 'groupTake'
|
|
159
|
+
? $text.toLowerCaseByIndex(localization.value.common.takeSnapshot, [1])
|
|
160
|
+
: localization.value.common.editSnapshot
|
|
161
|
+
)
|
|
162
|
+
const applyButtonText = computed<string>(() =>
|
|
163
|
+
props.type === 'take' || props.type === 'groupTake'
|
|
164
|
+
? localization.value.common.create
|
|
165
|
+
: localization.value.common.edit
|
|
166
|
+
)
|
|
167
|
+
const isNameError = computed<boolean>(() => !formLocal.value.name.trim())
|
|
168
|
+
|
|
169
|
+
const onCheckNameValidation = (): void => {
|
|
170
|
+
formLocal.value.name = formLocal.value.name.replace(/^\s+/, '')
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const onHide = (): void => {
|
|
174
|
+
emits('hide')
|
|
175
|
+
}
|
|
176
|
+
const onSubmit = (): void => {
|
|
177
|
+
emits('submit')
|
|
178
|
+
}
|
|
179
|
+
</script>
|
|
180
|
+
|
|
181
|
+
<style scoped lang="scss">
|
|
182
|
+
.form-block {
|
|
183
|
+
padding-right: 10px;
|
|
184
|
+
|
|
185
|
+
.form-group {
|
|
186
|
+
.clr-control-container {
|
|
187
|
+
min-height: 48px;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.label-form-group {
|
|
191
|
+
width: 240px;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.textarea-form {
|
|
195
|
+
width: 309px;
|
|
196
|
+
box-shadow: none;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.clr-checkbox-wrapper.disabled {
|
|
200
|
+
.clr-control-label {
|
|
201
|
+
opacity: 0.3;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.flex-row.first {
|
|
207
|
+
margin-bottom: 10px;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.checkbox-content {
|
|
211
|
+
&.disabled {
|
|
212
|
+
opacity: 0.5;
|
|
213
|
+
|
|
214
|
+
label {
|
|
215
|
+
cursor: not-allowed;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
</style>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
:is="currentComponent"
|
|
4
|
+
v-model:form-local="formLocal"
|
|
5
|
+
v-model:is-include-vm-memory="isIncludeVmMemory"
|
|
6
|
+
v-model:is-quiesce-guest-file-system="isQuiesceGuestFileSystem"
|
|
7
|
+
:type="props.type"
|
|
8
|
+
:is-disabled-save-vm="isDisabledSaveVm"
|
|
9
|
+
:is-loading="isLoading"
|
|
10
|
+
@hide="emits('hide')"
|
|
11
|
+
@submit="emits('submit')"
|
|
12
|
+
/>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
import type { UI_I_TakeEditSnapshot } from '~/components/common/vm/snapshots/lib/models/interfaces'
|
|
17
|
+
import type { UI_T_TakeOrEdit } from '~/components/common/vm/snapshots/lib/models/types'
|
|
18
|
+
|
|
19
|
+
const formLocal = defineModel<UI_I_TakeEditSnapshot>('formLocal', {
|
|
20
|
+
required: true,
|
|
21
|
+
})
|
|
22
|
+
const isIncludeVmMemory = defineModel<boolean>('isIncludeVmMemory', {
|
|
23
|
+
required: true,
|
|
24
|
+
})
|
|
25
|
+
const isQuiesceGuestFileSystem = defineModel<boolean>(
|
|
26
|
+
'isQuiesceGuestFileSystem',
|
|
27
|
+
{ required: true }
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
const props = defineProps<{
|
|
31
|
+
type: UI_T_TakeOrEdit
|
|
32
|
+
isDisabledSaveVm: boolean
|
|
33
|
+
isLoading: boolean
|
|
34
|
+
}>()
|
|
35
|
+
|
|
36
|
+
const emits = defineEmits<{
|
|
37
|
+
(event: 'hide'): void
|
|
38
|
+
(event: 'submit'): void
|
|
39
|
+
}>()
|
|
40
|
+
|
|
41
|
+
const { $store }: any = useNuxtApp()
|
|
42
|
+
|
|
43
|
+
const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
|
|
44
|
+
const currentComponent = computed(() =>
|
|
45
|
+
isNewView.value
|
|
46
|
+
? defineAsyncComponent(() => import('./new/New.vue'))
|
|
47
|
+
: defineAsyncComponent(() => import('./Old.vue'))
|
|
48
|
+
)
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<style scoped lang="scss"></style>
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ui-modal
|
|
3
|
+
:title="title"
|
|
4
|
+
:texts="modalTextsLocal"
|
|
5
|
+
:is-loading="props.isLoading"
|
|
6
|
+
width="560px"
|
|
7
|
+
test-id="vm-take-edit-snapshot-modal"
|
|
8
|
+
show
|
|
9
|
+
@hide="emits('hide')"
|
|
10
|
+
@submit="onSubmit"
|
|
11
|
+
>
|
|
12
|
+
<template #content>
|
|
13
|
+
<div
|
|
14
|
+
v-if="props.type === 'edit' && formLocal.snapshot_id === -1"
|
|
15
|
+
class="pt-3 px-8"
|
|
16
|
+
>
|
|
17
|
+
<ui-skeleton-item
|
|
18
|
+
width="100%"
|
|
19
|
+
height="36"
|
|
20
|
+
border-radius="8"
|
|
21
|
+
class="mb-6"
|
|
22
|
+
/>
|
|
23
|
+
<ui-skeleton-item
|
|
24
|
+
width="100%"
|
|
25
|
+
height="84"
|
|
26
|
+
border-radius="8"
|
|
27
|
+
class="mb-6"
|
|
28
|
+
/>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<div v-else class="pt-4 pb-2 px-8">
|
|
32
|
+
<div v-if="alertMessages?.length" class="mb-6">
|
|
33
|
+
<ui-alert
|
|
34
|
+
:messages="alertMessages"
|
|
35
|
+
test-id="vm-take-edit-snapshot-modal-error-alert"
|
|
36
|
+
type="error"
|
|
37
|
+
size="md"
|
|
38
|
+
hide-close-button
|
|
39
|
+
button
|
|
40
|
+
/>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<ui-input
|
|
44
|
+
v-model="formLocal.name"
|
|
45
|
+
:label="localization.common.name"
|
|
46
|
+
:error="nameError"
|
|
47
|
+
test-id="vm-take-edit-snapshot-modal-name-input"
|
|
48
|
+
class="form__input mb-6"
|
|
49
|
+
input-style="rounded"
|
|
50
|
+
size="md"
|
|
51
|
+
@change="onCheckNameValidation"
|
|
52
|
+
/>
|
|
53
|
+
<ui-textarea
|
|
54
|
+
id="vm-take-edite-snapshot-modal-description"
|
|
55
|
+
v-model="formLocal.description"
|
|
56
|
+
:label="`${localization.common.description} (${localization.common.optional})`"
|
|
57
|
+
test-id="vm-take-edit-snapshot-modal-name-input"
|
|
58
|
+
height="84"
|
|
59
|
+
size="sm"
|
|
60
|
+
/>
|
|
61
|
+
|
|
62
|
+
<div v-if="props.type === 'take'" class="mt-6">
|
|
63
|
+
<ui-checkbox
|
|
64
|
+
v-model="isIncludeVirtualMachinesMemory"
|
|
65
|
+
:label-text="localization.snapshots.saveVirtualMachineMemory"
|
|
66
|
+
:disabled="props.isDisabledSaveVm"
|
|
67
|
+
class="mb-3 flex items-start"
|
|
68
|
+
test-id="vm-take-edit-snapshot-modal-save-memory-checkbox"
|
|
69
|
+
size="md"
|
|
70
|
+
/>
|
|
71
|
+
<ui-checkbox
|
|
72
|
+
v-model="isQuiesceGuestFileSystemRequiresVMTools"
|
|
73
|
+
:label-text="
|
|
74
|
+
localization.common.quiesceGuestFileSystemRequiresVMTools
|
|
75
|
+
"
|
|
76
|
+
class="flex items-start"
|
|
77
|
+
test-id="vm-take-edit-snapshot-modal-quiesce-guest-file-system-checkbox"
|
|
78
|
+
size="md"
|
|
79
|
+
disabled
|
|
80
|
+
/>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
</template>
|
|
84
|
+
<template #footerLeftContent><span></span></template>
|
|
85
|
+
</ui-modal>
|
|
86
|
+
</template>
|
|
87
|
+
|
|
88
|
+
<script setup lang="ts">
|
|
89
|
+
import type { UI_I_ModalTexts } from '~/node_modules/bfg-uikit/components/ui/modal/models/interfaces'
|
|
90
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
91
|
+
import type { UI_I_TakeEditSnapshot } from '~/components/common/vm/snapshots/lib/models/interfaces'
|
|
92
|
+
import type { UI_T_TakeOrEdit } from '~/components/common/vm/snapshots/lib/models/types'
|
|
93
|
+
import { modalTexts } from '~/components/common/vm/snapshots/modals/lib/config/modalTexts'
|
|
94
|
+
import { getSnapshotsName } from '~/components/common/vm/snapshots/modals/takeOrEdit/new/lib/utils/getSnapshotsName'
|
|
95
|
+
|
|
96
|
+
const formLocal = defineModel<UI_I_TakeEditSnapshot>('formLocal', {
|
|
97
|
+
required: true,
|
|
98
|
+
})
|
|
99
|
+
const isIncludeVirtualMachinesMemory = defineModel<boolean>(
|
|
100
|
+
'isIncludeVmMemory',
|
|
101
|
+
{ required: true }
|
|
102
|
+
)
|
|
103
|
+
const isQuiesceGuestFileSystemRequiresVMTools = defineModel<boolean>(
|
|
104
|
+
'isQuiesceGuestFileSystem',
|
|
105
|
+
{ required: true }
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
const props = defineProps<{
|
|
109
|
+
type: UI_T_TakeOrEdit
|
|
110
|
+
isDisabledSaveVm: boolean
|
|
111
|
+
isLoading: boolean
|
|
112
|
+
}>()
|
|
113
|
+
|
|
114
|
+
const emits = defineEmits<{
|
|
115
|
+
(event: 'hide'): void
|
|
116
|
+
(event: 'submit'): void
|
|
117
|
+
}>()
|
|
118
|
+
|
|
119
|
+
const { $store }: any = useNuxtApp()
|
|
120
|
+
|
|
121
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
122
|
+
|
|
123
|
+
const snapshots = computed<string[]>(() =>
|
|
124
|
+
getSnapshotsName($store.getters['vmSnapshots/getSnapshotsTree'])
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
const alertMessages = ref<string[]>([])
|
|
128
|
+
|
|
129
|
+
const title = computed<string>(() => {
|
|
130
|
+
let titleType =
|
|
131
|
+
props.type === 'take'
|
|
132
|
+
? localization.value.common.takeSnapshot
|
|
133
|
+
: localization.value.common.editSnapshot
|
|
134
|
+
|
|
135
|
+
titleType = titleType.replace('snapshot', 'Snapshot')
|
|
136
|
+
|
|
137
|
+
return titleType
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
const onCheckNameValidation = (): void => {
|
|
141
|
+
formLocal.value.name = formLocal.value.name.replace(/^\s+/, '')
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const nameError = ref<string>('')
|
|
145
|
+
|
|
146
|
+
const modalTextsLocal = computed<UI_I_ModalTexts>(() =>
|
|
147
|
+
modalTexts(localization.value, props.type)
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
const onSubmit = (): void => {
|
|
151
|
+
const name = formLocal.value.name.trim()
|
|
152
|
+
|
|
153
|
+
if (!name) {
|
|
154
|
+
nameError.value = localization.value.common.fieldRequired
|
|
155
|
+
return
|
|
156
|
+
}
|
|
157
|
+
if (snapshots.value.includes(name)) {
|
|
158
|
+
alertMessages.value = [
|
|
159
|
+
localization.value.common.nameAlreadyExists.replace('{0}', name),
|
|
160
|
+
]
|
|
161
|
+
nameError.value = ' '
|
|
162
|
+
return
|
|
163
|
+
}
|
|
164
|
+
emits('submit')
|
|
165
|
+
}
|
|
166
|
+
</script>
|
|
167
|
+
|
|
168
|
+
<style scoped lang="scss"></style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { UI_I_SnapshotsTreeNode } from '~/store/inventory/modules/snapshots/lib/models/interfaces'
|
|
2
|
+
|
|
3
|
+
export const getSnapshotsName = (
|
|
4
|
+
snapshots: UI_I_SnapshotsTreeNode[],
|
|
5
|
+
result: string[] = []
|
|
6
|
+
): string[] => {
|
|
7
|
+
for (let i = 0; i < snapshots.length; i++) {
|
|
8
|
+
result.push(snapshots[i].name)
|
|
9
|
+
|
|
10
|
+
if (snapshots[i].nodes.length) {
|
|
11
|
+
getSnapshotsName(snapshots[i].nodes, result)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return result
|
|
15
|
+
}
|
package/package.json
CHANGED
|
File without changes
|