bfg-common 1.5.733 → 1.5.735
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/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/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 +8 -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
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="[
|
|
4
|
+
'snapshots-page grid h-inherit p-4 overflow-hidden ',
|
|
5
|
+
{ 'selected gap-3': props.detailData },
|
|
6
|
+
]"
|
|
7
|
+
>
|
|
8
|
+
<div class="left-content overflow-auto grid p-4">
|
|
9
|
+
<div class="flex justify-between">
|
|
10
|
+
<h3 class="title-block font-[500] text-[16px]">
|
|
11
|
+
{{ localization.inventoryTabs.snapshots }} ({{ snapshotsCount }})
|
|
12
|
+
</h3>
|
|
13
|
+
<ui-button
|
|
14
|
+
test-id="take-snapshot-btn"
|
|
15
|
+
size="md"
|
|
16
|
+
@click="emits('show-modal', 'take')"
|
|
17
|
+
>
|
|
18
|
+
<ui-icon
|
|
19
|
+
name="icon-snapshotTake"
|
|
20
|
+
width="20"
|
|
21
|
+
height="20"
|
|
22
|
+
class="mr-2"
|
|
23
|
+
/>
|
|
24
|
+
{{ localization.common.takeSnapshot }}
|
|
25
|
+
</ui-button>
|
|
26
|
+
</div>
|
|
27
|
+
<div
|
|
28
|
+
v-if="props.snapshotsTree.length"
|
|
29
|
+
class="snapshots-tree-content overflow-y-auto my-4 px-2 pb-2"
|
|
30
|
+
>
|
|
31
|
+
<ui-tree
|
|
32
|
+
:is-loading="props.snapshotsLoading"
|
|
33
|
+
:nodes="props.snapshotsTree"
|
|
34
|
+
@select-node="emits('select-node', $event)"
|
|
35
|
+
@toggle-node="emits('show-nodes', $event.id)"
|
|
36
|
+
@show-context-menu="showContextMenu"
|
|
37
|
+
>
|
|
38
|
+
<template #content="{ node }">
|
|
39
|
+
<div class="flex-align-center">
|
|
40
|
+
<span :class="['node-icon', node.iconClassName]"></span>
|
|
41
|
+
<span class="node-name text-ellipsis">{{ node.name }}</span>
|
|
42
|
+
</div>
|
|
43
|
+
</template>
|
|
44
|
+
</ui-tree>
|
|
45
|
+
</div>
|
|
46
|
+
<div v-else class="empty-block grid justify-items-center content-center">
|
|
47
|
+
<ui-icon
|
|
48
|
+
name="not-found-magnifier"
|
|
49
|
+
width="28"
|
|
50
|
+
height="28"
|
|
51
|
+
color="#9da6ad"
|
|
52
|
+
/>
|
|
53
|
+
<p class="title-block font-[400] text-[16px] mt-2">
|
|
54
|
+
{{ localization.snapshots.noSnapshotsAvailable }}
|
|
55
|
+
</p>
|
|
56
|
+
<p class="description-block mt-[6px] text-[13px]">
|
|
57
|
+
{{ localization.snapshots.noSnapshotsAvailableDesc }}
|
|
58
|
+
</p>
|
|
59
|
+
</div>
|
|
60
|
+
<ui-button
|
|
61
|
+
:disabled="!props.snapshotsTree.length"
|
|
62
|
+
:class="[
|
|
63
|
+
'delete-all w-max ml-auto',
|
|
64
|
+
{ disabled: !props.snapshotsTree.length },
|
|
65
|
+
]"
|
|
66
|
+
test-id="delete-all-snapshots-btn"
|
|
67
|
+
size="md"
|
|
68
|
+
variant="text"
|
|
69
|
+
is-without-sizes
|
|
70
|
+
is-without-height
|
|
71
|
+
@click="emits('show-modal', 'delete_all')"
|
|
72
|
+
>
|
|
73
|
+
<ui-icon name="delete" width="20" height="20" class="mr-2" />
|
|
74
|
+
{{ localization.common.deleteAll }}
|
|
75
|
+
</ui-button>
|
|
76
|
+
</div>
|
|
77
|
+
<div
|
|
78
|
+
v-if="props.detailData"
|
|
79
|
+
class="snapshot-details overflow-hidden flex-direction-column p-4"
|
|
80
|
+
>
|
|
81
|
+
<div class="flex justify-between mb-6">
|
|
82
|
+
<h3 class="title-block font-[500] text-[16px]">
|
|
83
|
+
{{ localization.snapshots.snapshotDetails }}
|
|
84
|
+
</h3>
|
|
85
|
+
<div class="details-actions-block flex column-gap-4">
|
|
86
|
+
<ui-tooltip
|
|
87
|
+
id="revert-snapshot-btn"
|
|
88
|
+
test-id="revert-snapshot-btn-tooltip"
|
|
89
|
+
size="md"
|
|
90
|
+
position="bottom"
|
|
91
|
+
position-by-tooltip="center"
|
|
92
|
+
show-type="variant-1"
|
|
93
|
+
>
|
|
94
|
+
<template #target>
|
|
95
|
+
<div id="revert-snapshot-btn" class="popped tooltip">
|
|
96
|
+
<ui-button
|
|
97
|
+
test-id="revert-snapshot-btn"
|
|
98
|
+
size="md"
|
|
99
|
+
variant="text"
|
|
100
|
+
class="revert-snapshot-btn"
|
|
101
|
+
is-without-sizes
|
|
102
|
+
is-without-height
|
|
103
|
+
@click="emits('show-modal', 'revert')"
|
|
104
|
+
>
|
|
105
|
+
<ui-icon name="revert" width="20" height="20" />
|
|
106
|
+
</ui-button>
|
|
107
|
+
</div>
|
|
108
|
+
</template>
|
|
109
|
+
<template #content>
|
|
110
|
+
{{ localization.common.revert }}
|
|
111
|
+
</template>
|
|
112
|
+
</ui-tooltip>
|
|
113
|
+
<div class="border-line"></div>
|
|
114
|
+
<ui-tooltip
|
|
115
|
+
id="edit-snapshot-btn"
|
|
116
|
+
test-id="edit-snapshot-btn-tooltip"
|
|
117
|
+
size="md"
|
|
118
|
+
position="bottom"
|
|
119
|
+
position-by-tooltip="center"
|
|
120
|
+
show-type="variant-1"
|
|
121
|
+
>
|
|
122
|
+
<template #target>
|
|
123
|
+
<div id="edit-snapshot-btn" class="popped tooltip">
|
|
124
|
+
<ui-button
|
|
125
|
+
test-id="edit-snapshot-btn"
|
|
126
|
+
size="md"
|
|
127
|
+
variant="text"
|
|
128
|
+
class="edit-snapshot-btn"
|
|
129
|
+
is-without-sizes
|
|
130
|
+
is-without-height
|
|
131
|
+
@click="emits('show-modal', 'edit')"
|
|
132
|
+
>
|
|
133
|
+
<ui-icon name="edit" width="20" height="20" />
|
|
134
|
+
</ui-button>
|
|
135
|
+
</div>
|
|
136
|
+
</template>
|
|
137
|
+
<template #content>
|
|
138
|
+
{{ localization.common.edit }}
|
|
139
|
+
</template>
|
|
140
|
+
</ui-tooltip>
|
|
141
|
+
<div class="border-line"></div>
|
|
142
|
+
<ui-tooltip
|
|
143
|
+
id="delete-snapshot-btn"
|
|
144
|
+
test-id="delete-snapshot-btn-tooltip"
|
|
145
|
+
size="md"
|
|
146
|
+
position="bottom"
|
|
147
|
+
position-by-tooltip="center"
|
|
148
|
+
show-type="variant-1"
|
|
149
|
+
>
|
|
150
|
+
<template #target>
|
|
151
|
+
<div id="delete-snapshot-btn" class="popped tooltip">
|
|
152
|
+
<ui-button
|
|
153
|
+
test-id="delete-snapshot-btn"
|
|
154
|
+
size="md"
|
|
155
|
+
variant="text"
|
|
156
|
+
class="delete-snapshot-btn"
|
|
157
|
+
is-without-sizes
|
|
158
|
+
is-without-height
|
|
159
|
+
@click="emits('show-modal', 'delete')"
|
|
160
|
+
>
|
|
161
|
+
<ui-icon name="delete" width="20" height="20" />
|
|
162
|
+
</ui-button>
|
|
163
|
+
</div>
|
|
164
|
+
</template>
|
|
165
|
+
<template #content>
|
|
166
|
+
{{ localization.common.delete }}
|
|
167
|
+
</template>
|
|
168
|
+
</ui-tooltip>
|
|
169
|
+
</div>
|
|
170
|
+
</div>
|
|
171
|
+
<div class="grid row-gap-3 overflow-y-auto">
|
|
172
|
+
<ui-info-block
|
|
173
|
+
v-for="(item, index) in currentDetailsData"
|
|
174
|
+
:key="index"
|
|
175
|
+
:data="item"
|
|
176
|
+
>
|
|
177
|
+
<template v-if="item.labelIcon" #labelBlock>
|
|
178
|
+
<div class="info-block-label-content flex items-start">
|
|
179
|
+
<ui-icon
|
|
180
|
+
v-if="item.labelIcon"
|
|
181
|
+
:name="item.labelIcon"
|
|
182
|
+
width="20"
|
|
183
|
+
height="20"
|
|
184
|
+
class="info-label-icon mr-[10px]"
|
|
185
|
+
/>
|
|
186
|
+
<span class="info-label">{{ item.label }}</span>
|
|
187
|
+
</div>
|
|
188
|
+
</template>
|
|
189
|
+
<template #valueBlock>
|
|
190
|
+
<span
|
|
191
|
+
v-if="item.value === 'empty-description'"
|
|
192
|
+
class="empty-description"
|
|
193
|
+
>
|
|
194
|
+
{{ localization.snapshots.snapshotHasNoDescriptionYet }}
|
|
195
|
+
</span>
|
|
196
|
+
<ui-status-pill
|
|
197
|
+
v-if="item.labelIcon === 'settings' && item.value"
|
|
198
|
+
:text="localization.common[item.value.toLowerCase()]"
|
|
199
|
+
:type="item.value === 'yes' ? 'success' : 'error'"
|
|
200
|
+
size="md"
|
|
201
|
+
with-icon
|
|
202
|
+
/>
|
|
203
|
+
</template>
|
|
204
|
+
</ui-info-block>
|
|
205
|
+
</div>
|
|
206
|
+
</div>
|
|
207
|
+
</div>
|
|
208
|
+
|
|
209
|
+
<common-vm-snapshots-new-context-menu-view
|
|
210
|
+
:show="contextMenuShow"
|
|
211
|
+
:context-data="contextMenu"
|
|
212
|
+
@select-action="onSelectContextMenuItem"
|
|
213
|
+
/>
|
|
214
|
+
</template>
|
|
215
|
+
|
|
216
|
+
<script setup lang="ts">
|
|
217
|
+
import type { UI_I_InfoBlock } from '~/node_modules/bfg-uikit/components/ui/infoBlock/models/interfaces'
|
|
218
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
219
|
+
import type { UI_T_SnapshotActionType } from '~/components/common/vm/snapshots/lib/models/types'
|
|
220
|
+
import type {
|
|
221
|
+
UI_I_SnapshotsDetails,
|
|
222
|
+
UI_I_SnapshotsTreeNode,
|
|
223
|
+
} from '~/store/inventory/modules/snapshots/lib/models/interfaces'
|
|
224
|
+
import * as utils from '~/components/common/vm/snapshots/new/lib/utils/contextMenu'
|
|
225
|
+
import { constructDetails } from '~/components/common/vm/snapshots/new/lib/utils/details'
|
|
226
|
+
|
|
227
|
+
const props = defineProps<{
|
|
228
|
+
snapshotsTree: UI_I_SnapshotsTreeNode[]
|
|
229
|
+
snapshotsLoading: boolean
|
|
230
|
+
detailData: UI_I_SnapshotsDetails | null
|
|
231
|
+
}>()
|
|
232
|
+
|
|
233
|
+
const emits = defineEmits<{
|
|
234
|
+
(event: 'show-modal', value: UI_T_SnapshotActionType): void
|
|
235
|
+
(event: 'select-node', value: UI_I_SnapshotsTreeNode): void
|
|
236
|
+
(event: 'show-nodes', value: string): void
|
|
237
|
+
}>()
|
|
238
|
+
|
|
239
|
+
const { $recursion }: any = useNuxtApp()
|
|
240
|
+
|
|
241
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
242
|
+
|
|
243
|
+
const snapshotsCount = computed<string>(() =>
|
|
244
|
+
$recursion.calcCount(props.snapshotsTree, 'nodes', ['snapshot'], ['type'])
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
const currentDetailsData = computed<UI_I_InfoBlock[]>(() =>
|
|
248
|
+
constructDetails(localization.value, props.detailData)
|
|
249
|
+
)
|
|
250
|
+
|
|
251
|
+
const { showContextMenu, contextMenuShow, contextMenu } = utils.getContextMenu()
|
|
252
|
+
|
|
253
|
+
const onSelectContextMenuItem = (actionType: UI_T_SnapshotActionType): void => {
|
|
254
|
+
emits('show-modal', actionType)
|
|
255
|
+
}
|
|
256
|
+
</script>
|
|
257
|
+
|
|
258
|
+
<style>
|
|
259
|
+
:root {
|
|
260
|
+
--snapshots-page-inner-block-bg: #ffffff;
|
|
261
|
+
--snapshots-page-title-color: #4d5d69;
|
|
262
|
+
--snapshots-page-tree-border-color: #e9ebed;
|
|
263
|
+
--snapshots-page-details-action-color: #4d5d69;
|
|
264
|
+
--snapshots-page-details-action-hover-color: #213444;
|
|
265
|
+
--snapshots-page-info-block-label-color: #4d5d69;
|
|
266
|
+
--snapshots-page-info-block-value-color: #182531;
|
|
267
|
+
}
|
|
268
|
+
:root.dark-theme {
|
|
269
|
+
--snapshots-page-inner-block-bg: #334453;
|
|
270
|
+
--snapshots-page-title-color: #e9eaec;
|
|
271
|
+
--snapshots-page-tree-border-color: #e9ebed1f;
|
|
272
|
+
--snapshots-page-details-action-color: #e9eaec;
|
|
273
|
+
--snapshots-page-details-action-hover-color: #ffffff;
|
|
274
|
+
--snapshots-page-info-block-label-color: #e9eaec;
|
|
275
|
+
--snapshots-page-info-block-value-color: #e9eaec;
|
|
276
|
+
}
|
|
277
|
+
</style>
|
|
278
|
+
|
|
279
|
+
<style scoped lang="scss">
|
|
280
|
+
.snapshots-page {
|
|
281
|
+
&.selected {
|
|
282
|
+
grid-template-columns: repeat(2, calc(50% - 6px));
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.title-block {
|
|
286
|
+
color: var(--snapshots-page-title-color);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.left-content {
|
|
290
|
+
background-color: var(--snapshots-page-inner-block-bg);
|
|
291
|
+
box-shadow: 0 1px 4px 0 #00000014;
|
|
292
|
+
border-radius: 8px;
|
|
293
|
+
grid-template-rows: max-content 1fr max-content;
|
|
294
|
+
|
|
295
|
+
.snapshots-tree-content {
|
|
296
|
+
border: 1px solid var(--snapshots-page-tree-border-color);
|
|
297
|
+
border-radius: 8px;
|
|
298
|
+
|
|
299
|
+
:deep(.tree-container) {
|
|
300
|
+
width: max-content;
|
|
301
|
+
min-width: 100%;
|
|
302
|
+
|
|
303
|
+
.tree-content {
|
|
304
|
+
padding-right: 8px;
|
|
305
|
+
|
|
306
|
+
.node-wrapper {
|
|
307
|
+
border-radius: 4px;
|
|
308
|
+
|
|
309
|
+
.node-element {
|
|
310
|
+
line-height: 20px;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.empty-block {
|
|
318
|
+
.description-block {
|
|
319
|
+
color: #9da6ad;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
.delete-all {
|
|
323
|
+
&:not(.disabled) {
|
|
324
|
+
color: #ea3223;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
.snapshot-details {
|
|
329
|
+
background-color: var(--snapshots-page-inner-block-bg);
|
|
330
|
+
box-shadow: 0 1px 4px 0 #00000014;
|
|
331
|
+
border-radius: 8px;
|
|
332
|
+
|
|
333
|
+
.details-actions-block {
|
|
334
|
+
.border-line {
|
|
335
|
+
width: 1px;
|
|
336
|
+
height: 20px;
|
|
337
|
+
background-color: #e9ebeda3;
|
|
338
|
+
}
|
|
339
|
+
.revert-snapshot-btn,
|
|
340
|
+
.edit-snapshot-btn {
|
|
341
|
+
color: var(--snapshots-page-details-action-color);
|
|
342
|
+
|
|
343
|
+
&:hover {
|
|
344
|
+
color: var(--snapshots-page-details-action-hover-color);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
.delete-snapshot-btn {
|
|
348
|
+
color: #ea3223;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
.info-block-label-content {
|
|
352
|
+
.info-label-icon {
|
|
353
|
+
color: #9da6ad;
|
|
354
|
+
min-width: 20px;
|
|
355
|
+
}
|
|
356
|
+
.info-label {
|
|
357
|
+
margin-top: 2.5px;
|
|
358
|
+
color: var(--snapshots-page-info-block-label-color);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
.empty-description {
|
|
362
|
+
color: #9da6ad;
|
|
363
|
+
}
|
|
364
|
+
:deep(.ui-main-info-block-item-right) {
|
|
365
|
+
white-space: unset !important;
|
|
366
|
+
max-width: 50%;
|
|
367
|
+
}
|
|
368
|
+
:deep(.ui-main-info-block-item-right-value-parent) {
|
|
369
|
+
white-space: unset !important;
|
|
370
|
+
}
|
|
371
|
+
:deep(.ui-main-info-block-item-right-value) {
|
|
372
|
+
color: var(--snapshots-page-info-block-value-color);
|
|
373
|
+
font-size: 13px;
|
|
374
|
+
font-weight: 400;
|
|
375
|
+
}
|
|
376
|
+
:deep(.ui-main-info-block-item-right-open) {
|
|
377
|
+
display: none;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
@media (max-width: 1200px) {
|
|
383
|
+
.snapshots-page {
|
|
384
|
+
&.selected {
|
|
385
|
+
grid-template-columns: 1fr;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
</style>
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="snapshot-context-menu-view">
|
|
3
|
+
<common-context
|
|
4
|
+
:action-loading="null"
|
|
5
|
+
:context-menu="contextMenu"
|
|
6
|
+
@select-item="onSelectContextMenuItem"
|
|
7
|
+
@hide="onHideContextMenu"
|
|
8
|
+
/>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
14
|
+
import type {
|
|
15
|
+
UI_I_ContextMenu,
|
|
16
|
+
UI_I_ContextMenuItem,
|
|
17
|
+
} from '~/components/common/context/lib/models/interfaces'
|
|
18
|
+
import type { UI_I_ContextData } from '~/components/common/vm/snapshots/new/lib/models/interfaces'
|
|
19
|
+
import type { UI_T_SnapshotActionType } from '~/components/common/vm/snapshots/lib/models/types'
|
|
20
|
+
import { contextMenuItemsFunc } from '~/components/common/vm/snapshots/new/contextMenuView/lib/config/contextMenuItems'
|
|
21
|
+
|
|
22
|
+
const props = defineProps<{
|
|
23
|
+
contextData: UI_I_ContextData
|
|
24
|
+
show: number
|
|
25
|
+
}>()
|
|
26
|
+
|
|
27
|
+
const emits = defineEmits<{
|
|
28
|
+
(event: 'select-action', value: UI_T_SnapshotActionType): void
|
|
29
|
+
}>()
|
|
30
|
+
|
|
31
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
32
|
+
|
|
33
|
+
const contextMenu = ref<UI_I_ContextMenu<'snapshot'>>({
|
|
34
|
+
x: -9999,
|
|
35
|
+
y: -9999,
|
|
36
|
+
id: '',
|
|
37
|
+
type: 'snapshot',
|
|
38
|
+
titleText: '',
|
|
39
|
+
titleIconClassName: '',
|
|
40
|
+
items: contextMenuItemsFunc(localization.value),
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const showContextMenu = (data: UI_I_ContextData): void => {
|
|
44
|
+
const event = data.event
|
|
45
|
+
const node = data.node
|
|
46
|
+
|
|
47
|
+
if (!event || !node) return
|
|
48
|
+
|
|
49
|
+
event.preventDefault()
|
|
50
|
+
|
|
51
|
+
contextMenu.value.x = event.clientX
|
|
52
|
+
contextMenu.value.y = event.clientY
|
|
53
|
+
contextMenu.value.id = '' + node.id
|
|
54
|
+
contextMenu.value.type = node.type
|
|
55
|
+
contextMenu.value.titleText = node.name
|
|
56
|
+
contextMenu.value.titleIconClassName = node.iconClassName
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
watch(
|
|
60
|
+
() => props.show,
|
|
61
|
+
() => {
|
|
62
|
+
showContextMenu(props.contextData)
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
const onHideContextMenu = (): void => {
|
|
67
|
+
contextMenu.value.x = -9999
|
|
68
|
+
contextMenu.value.y = -9999
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const onSelectContextMenuItem = (item: UI_I_ContextMenuItem): void => {
|
|
72
|
+
emits('select-action', item.actionType)
|
|
73
|
+
}
|
|
74
|
+
</script>
|
|
75
|
+
|
|
76
|
+
<style scoped lang="scss">
|
|
77
|
+
.snapshot-context-menu-view {
|
|
78
|
+
:deep(.menu-item) {
|
|
79
|
+
.context-icon {
|
|
80
|
+
display: none;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.item-ui-icon {
|
|
84
|
+
margin-right: 8px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&:last-child {
|
|
88
|
+
color: #ea3223;
|
|
89
|
+
|
|
90
|
+
.context-link:hover {
|
|
91
|
+
color: #ea3223;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
</style>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
2
|
+
import type { UI_I_ContextMenuItem } from '~/components/common/context/lib/models/interfaces'
|
|
3
|
+
|
|
4
|
+
export const contextMenuItemsFunc = (
|
|
5
|
+
localization: UI_I_Localization
|
|
6
|
+
): UI_I_ContextMenuItem[] => [
|
|
7
|
+
{
|
|
8
|
+
key: useUniqueId(),
|
|
9
|
+
name: localization.common.revert,
|
|
10
|
+
actionType: 'revert',
|
|
11
|
+
iconClassName: '',
|
|
12
|
+
iconName: 'revert',
|
|
13
|
+
testId: 'revert-snapshot-vm',
|
|
14
|
+
items: [],
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
key: useUniqueId(),
|
|
18
|
+
name: localization.common.edit,
|
|
19
|
+
actionType: 'edit',
|
|
20
|
+
iconClassName: '',
|
|
21
|
+
iconName: 'edit',
|
|
22
|
+
testId: 'edit-snapshot-vm',
|
|
23
|
+
items: [],
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
key: useUniqueId(),
|
|
27
|
+
name: localization.common.delete,
|
|
28
|
+
actionType: 'delete',
|
|
29
|
+
iconClassName: '',
|
|
30
|
+
iconName: 'delete',
|
|
31
|
+
testId: 'delete-snapshot-vm',
|
|
32
|
+
items: [],
|
|
33
|
+
},
|
|
34
|
+
]
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { UI_I_SnapshotsDetails } from '~/store/inventory/modules/snapshots/lib/models/interfaces'
|
|
2
|
+
|
|
3
|
+
export interface UI_I_ContextData {
|
|
4
|
+
event: null | MouseEvent
|
|
5
|
+
node: null | UI_I_SnapshotsDetails
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface UI_I_Context {
|
|
9
|
+
contextMenuShow: Ref<number>
|
|
10
|
+
contextMenu: Ref<UI_I_ContextData>
|
|
11
|
+
showContextMenu: any
|
|
12
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
UI_I_ContextData,
|
|
3
|
+
UI_I_Context,
|
|
4
|
+
} from '~/components/common/vm/snapshots/new/lib/models/interfaces'
|
|
5
|
+
|
|
6
|
+
const contextMenuShow = ref<number>(0)
|
|
7
|
+
|
|
8
|
+
const contextMenu = ref<UI_I_ContextData>({
|
|
9
|
+
event: null,
|
|
10
|
+
node: null,
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
export function getContextMenu(): UI_I_Context {
|
|
14
|
+
const showContextMenu = (data: UI_I_ContextData | null): void => {
|
|
15
|
+
if (!data) return
|
|
16
|
+
|
|
17
|
+
data.event?.preventDefault()
|
|
18
|
+
|
|
19
|
+
contextMenu.value.event = data.event
|
|
20
|
+
contextMenu.value.node = data.node
|
|
21
|
+
contextMenuShow.value++
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
contextMenuShow,
|
|
26
|
+
contextMenu,
|
|
27
|
+
showContextMenu,
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { UI_I_InfoBlock } from '~/node_modules/bfg-uikit/components/ui/infoBlock/models/interfaces'
|
|
2
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
3
|
+
import type { UI_I_SnapshotsDetails } from '~/store/inventory/modules/snapshots/lib/models/interfaces'
|
|
4
|
+
|
|
5
|
+
export const constructDetails = (
|
|
6
|
+
localization: UI_I_Localization,
|
|
7
|
+
detailData: UI_I_SnapshotsDetails | null
|
|
8
|
+
): UI_I_InfoBlock[] =>
|
|
9
|
+
!detailData
|
|
10
|
+
? []
|
|
11
|
+
: [
|
|
12
|
+
{
|
|
13
|
+
label: localization.common.name,
|
|
14
|
+
value: detailData.name || '--',
|
|
15
|
+
items: [],
|
|
16
|
+
labelIcon: 'icon-snapshotTake',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: localization.common.description,
|
|
20
|
+
value: detailData.description || 'empty-description',
|
|
21
|
+
items: [],
|
|
22
|
+
labelIcon: 'file',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
label: localization.common.timestamp,
|
|
26
|
+
value: detailData.timestamp || '--',
|
|
27
|
+
items: [],
|
|
28
|
+
labelIcon: 'clock',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: localization.common.size,
|
|
32
|
+
value: detailData.size || '--',
|
|
33
|
+
items: [],
|
|
34
|
+
labelIcon: 'disk',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
label: localization.snapshots.snapshotVMMemory,
|
|
38
|
+
value: detailData.snapshot_the_virtual_machines_memory || '--',
|
|
39
|
+
items: [],
|
|
40
|
+
labelIcon: 'settings',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: localization.snapshots.quiesceGuestFileSystem,
|
|
44
|
+
value: detailData.quiesce_guest_file_system || '--',
|
|
45
|
+
items: [],
|
|
46
|
+
labelIcon: 'settings',
|
|
47
|
+
},
|
|
48
|
+
]
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="snapshot-actions grid py-0 px-6">
|
|
3
|
+
<button
|
|
4
|
+
id="take-snapshot-button"
|
|
5
|
+
v-permission="'VirtualMachines.TakeSnapshot'"
|
|
6
|
+
:disabled="isDisabled"
|
|
7
|
+
data-id="take-snapshot-button"
|
|
8
|
+
class="btn btn-primary btn-sm"
|
|
9
|
+
@click="onSelect('take')"
|
|
10
|
+
>
|
|
11
|
+
{{ localization.common.takeSnapshot }}...
|
|
12
|
+
</button>
|
|
13
|
+
<atoms-tabs
|
|
14
|
+
:items="tabs"
|
|
15
|
+
test-id="vm-snapshot-tabs"
|
|
16
|
+
size="small"
|
|
17
|
+
class="tabs"
|
|
18
|
+
@change="onSelect"
|
|
19
|
+
/>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script setup lang="ts">
|
|
24
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
25
|
+
import type { UI_I_CollapseNavItem } from '~/components/atoms/collapse/lib/models/interfaces'
|
|
26
|
+
import type { UI_T_SnapshotActionType } from '~/components/common/vm/snapshots/lib/models/types'
|
|
27
|
+
import { snapshotsTabsFunc } from '~/components/common/vm/snapshots/tools/lib/config/tabsPannel'
|
|
28
|
+
|
|
29
|
+
const props = defineProps<{
|
|
30
|
+
snapshotsCount: number
|
|
31
|
+
snapshotsLoading: boolean
|
|
32
|
+
}>()
|
|
33
|
+
|
|
34
|
+
const emits = defineEmits<{
|
|
35
|
+
(event: 'select', value: UI_T_SnapshotActionType): void
|
|
36
|
+
}>()
|
|
37
|
+
|
|
38
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
39
|
+
|
|
40
|
+
const tabs = computed<UI_I_CollapseNavItem[]>(() =>
|
|
41
|
+
snapshotsTabsFunc(localization.value, isDisabled.value, props.snapshotsCount)
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
const onSelect = (action: UI_T_SnapshotActionType): void => {
|
|
45
|
+
emits('select', action)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const isDisabled = computed<boolean>(() => props.snapshotsLoading)
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<style scoped lang="scss">
|
|
52
|
+
.snapshot-actions {
|
|
53
|
+
grid-template-columns: auto 1fr;
|
|
54
|
+
align-items: baseline;
|
|
55
|
+
}
|
|
56
|
+
</style>
|