bfg-common 1.5.735 → 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/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/lib/models/interfaces.ts +8 -8
- package/components/common/vm/snapshots/lib/models/types.ts +3 -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/package.json +1 -1
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<atoms-stack-block
|
|
3
|
-
:has-children="false"
|
|
4
|
-
test-id="backup-window-stack-block"
|
|
5
|
-
>
|
|
6
|
-
<template #stackBlockKey>
|
|
7
|
-
<span>{{ localization.common.backupWindow }}</span>
|
|
8
|
-
</template>
|
|
9
|
-
<template #stackBlockContent>
|
|
10
|
-
<input
|
|
11
|
-
v-model="model.start_window_min"
|
|
12
|
-
data-id="hours-input"
|
|
13
|
-
type="number"
|
|
14
|
-
class="hrs"
|
|
15
|
-
/>
|
|
16
|
-
</template>
|
|
17
|
-
</atoms-stack-block>
|
|
18
|
-
</template>
|
|
19
|
-
|
|
20
|
-
<script lang="ts" setup>
|
|
21
|
-
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
22
|
-
import type { UI_I_CreateBackupForm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
|
|
23
|
-
|
|
24
|
-
const model = defineModel<UI_I_CreateBackupForm>({ required: true })
|
|
25
|
-
|
|
26
|
-
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
27
|
-
</script>
|
|
28
|
-
|
|
29
|
-
<style lang="scss" scoped></style>
|
|
1
|
+
<template>
|
|
2
|
+
<atoms-stack-block
|
|
3
|
+
:has-children="false"
|
|
4
|
+
test-id="backup-window-stack-block"
|
|
5
|
+
>
|
|
6
|
+
<template #stackBlockKey>
|
|
7
|
+
<span>{{ localization.common.backupWindow }}</span>
|
|
8
|
+
</template>
|
|
9
|
+
<template #stackBlockContent>
|
|
10
|
+
<input
|
|
11
|
+
v-model="model.start_window_min"
|
|
12
|
+
data-id="hours-input"
|
|
13
|
+
type="number"
|
|
14
|
+
class="hrs"
|
|
15
|
+
/>
|
|
16
|
+
</template>
|
|
17
|
+
</atoms-stack-block>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script lang="ts" setup>
|
|
21
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
22
|
+
import type { UI_I_CreateBackupForm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
|
|
23
|
+
|
|
24
|
+
const model = defineModel<UI_I_CreateBackupForm>({ required: true })
|
|
25
|
+
|
|
26
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<style lang="scss" scoped></style>
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<atoms-stack-block
|
|
3
|
-
:has-children="false"
|
|
4
|
-
test-id="backup-max-bandwidth-stack-block"
|
|
5
|
-
>
|
|
6
|
-
<template #stackBlockKey>
|
|
7
|
-
<span>{{ localization.common.maxBandwidth }}</span>
|
|
8
|
-
</template>
|
|
9
|
-
<template #stackBlockContent>
|
|
10
|
-
<div class="flex-align-center">
|
|
11
|
-
<input
|
|
12
|
-
v-model="maxBindwidthLocal"
|
|
13
|
-
data-id="mbps-input"
|
|
14
|
-
type="number"
|
|
15
|
-
class="mbps"
|
|
16
|
-
/>
|
|
17
|
-
|
|
18
|
-
<common-select-input
|
|
19
|
-
v-model="selectedType"
|
|
20
|
-
:data="maxBandwidthOptionsLocal"
|
|
21
|
-
test-id="backup-max-bandwidth-type"
|
|
22
|
-
class="ml-1"
|
|
23
|
-
/>
|
|
24
|
-
</div>
|
|
25
|
-
</template>
|
|
26
|
-
</atoms-stack-block>
|
|
27
|
-
</template>
|
|
28
|
-
|
|
29
|
-
<script lang="ts" setup>
|
|
30
|
-
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
31
|
-
import type { UI_I_CreateBackupForm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
|
|
32
|
-
import type { UI_T_BandwidthOption } from '~/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/lib/models/types'
|
|
33
|
-
import type { UI_I_SelectInputItem } from '~/components/common/select/input/lib/models/interfaces'
|
|
34
|
-
import { maxBandwidthOptions } from '~/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/lib/config/options'
|
|
35
|
-
|
|
36
|
-
const model = defineModel<UI_I_CreateBackupForm>({ required: true })
|
|
37
|
-
|
|
38
|
-
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
39
|
-
const { $binary }: any = useNuxtApp()
|
|
40
|
-
|
|
41
|
-
const maxBandwidthOptionsLocal =
|
|
42
|
-
ref<UI_I_SelectInputItem[]>(maxBandwidthOptions)
|
|
43
|
-
|
|
44
|
-
const maxBindwidthLocal = computed<number>({
|
|
45
|
-
get() {
|
|
46
|
-
return selectedType.value === 1
|
|
47
|
-
? $binary.bToGb(model.value.bandwidth_limit)
|
|
48
|
-
: $binary.bToMb(model.value.bandwidth_limit)
|
|
49
|
-
},
|
|
50
|
-
set(newValue: number) {
|
|
51
|
-
model.value.bandwidth_limit =
|
|
52
|
-
selectedType.value === 1
|
|
53
|
-
? $binary.gbToB(newValue)
|
|
54
|
-
: $binary.mbToB(newValue)
|
|
55
|
-
},
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
const selectedType = ref<UI_T_BandwidthOption>(0)
|
|
59
|
-
watch(selectedType, (newValue) => {
|
|
60
|
-
if (newValue === 1) model.value.bandwidth_limit *= 1_024
|
|
61
|
-
else model.value.bandwidth_limit /= 1_024
|
|
62
|
-
})
|
|
63
|
-
</script>
|
|
64
|
-
|
|
65
|
-
<style lang="scss" scoped>
|
|
66
|
-
#backup-transaction-logs {
|
|
67
|
-
margin: 4px 4px 0 0;
|
|
68
|
-
}
|
|
69
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<atoms-stack-block
|
|
3
|
+
:has-children="false"
|
|
4
|
+
test-id="backup-max-bandwidth-stack-block"
|
|
5
|
+
>
|
|
6
|
+
<template #stackBlockKey>
|
|
7
|
+
<span>{{ localization.common.maxBandwidth }}</span>
|
|
8
|
+
</template>
|
|
9
|
+
<template #stackBlockContent>
|
|
10
|
+
<div class="flex-align-center">
|
|
11
|
+
<input
|
|
12
|
+
v-model="maxBindwidthLocal"
|
|
13
|
+
data-id="mbps-input"
|
|
14
|
+
type="number"
|
|
15
|
+
class="mbps"
|
|
16
|
+
/>
|
|
17
|
+
|
|
18
|
+
<common-select-input
|
|
19
|
+
v-model="selectedType"
|
|
20
|
+
:data="maxBandwidthOptionsLocal"
|
|
21
|
+
test-id="backup-max-bandwidth-type"
|
|
22
|
+
class="ml-1"
|
|
23
|
+
/>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
</atoms-stack-block>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script lang="ts" setup>
|
|
30
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
31
|
+
import type { UI_I_CreateBackupForm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
|
|
32
|
+
import type { UI_T_BandwidthOption } from '~/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/lib/models/types'
|
|
33
|
+
import type { UI_I_SelectInputItem } from '~/components/common/select/input/lib/models/interfaces'
|
|
34
|
+
import { maxBandwidthOptions } from '~/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/lib/config/options'
|
|
35
|
+
|
|
36
|
+
const model = defineModel<UI_I_CreateBackupForm>({ required: true })
|
|
37
|
+
|
|
38
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
39
|
+
const { $binary }: any = useNuxtApp()
|
|
40
|
+
|
|
41
|
+
const maxBandwidthOptionsLocal =
|
|
42
|
+
ref<UI_I_SelectInputItem[]>(maxBandwidthOptions)
|
|
43
|
+
|
|
44
|
+
const maxBindwidthLocal = computed<number>({
|
|
45
|
+
get() {
|
|
46
|
+
return selectedType.value === 1
|
|
47
|
+
? $binary.bToGb(model.value.bandwidth_limit)
|
|
48
|
+
: $binary.bToMb(model.value.bandwidth_limit)
|
|
49
|
+
},
|
|
50
|
+
set(newValue: number) {
|
|
51
|
+
model.value.bandwidth_limit =
|
|
52
|
+
selectedType.value === 1
|
|
53
|
+
? $binary.gbToB(newValue)
|
|
54
|
+
: $binary.mbToB(newValue)
|
|
55
|
+
},
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
const selectedType = ref<UI_T_BandwidthOption>(0)
|
|
59
|
+
watch(selectedType, (newValue) => {
|
|
60
|
+
if (newValue === 1) model.value.bandwidth_limit *= 1_024
|
|
61
|
+
else model.value.bandwidth_limit /= 1_024
|
|
62
|
+
})
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<style lang="scss" scoped>
|
|
66
|
+
#backup-transaction-logs {
|
|
67
|
+
margin: 4px 4px 0 0;
|
|
68
|
+
}
|
|
69
|
+
</style>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {UI_I_SelectInputItem} from "~/components/common/select/input/lib/models/interfaces";
|
|
2
|
-
|
|
3
|
-
export const maxBandwidthOptions: UI_I_SelectInputItem[] = [
|
|
4
|
-
{ label: 'Mbps', value: 0 },
|
|
5
|
-
{ label: 'Gbps', value: 1 },
|
|
6
|
-
]
|
|
1
|
+
import type {UI_I_SelectInputItem} from "~/components/common/select/input/lib/models/interfaces";
|
|
2
|
+
|
|
3
|
+
export const maxBandwidthOptions: UI_I_SelectInputItem[] = [
|
|
4
|
+
{ label: 'Mbps', value: 0 },
|
|
5
|
+
{ label: 'Gbps', value: 1 },
|
|
6
|
+
]
|
package/components/common/pages/backups/modals/createBackup/configuration/strategy/Strategy.vue
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<atoms-stack-block
|
|
3
|
-
:has-children="false"
|
|
4
|
-
test-id="backup-strategy-stack-block"
|
|
5
|
-
>
|
|
6
|
-
<template #stackBlockKey>
|
|
7
|
-
<span>{{ localization.common.strategy }}</span>
|
|
8
|
-
</template>
|
|
9
|
-
<template #stackBlockContent>
|
|
10
|
-
<common-select-input
|
|
11
|
-
v-model="model.strategy"
|
|
12
|
-
:data="strategyOptions"
|
|
13
|
-
test-id="backup-strategy"
|
|
14
|
-
/>
|
|
15
|
-
</template>
|
|
16
|
-
</atoms-stack-block>
|
|
17
|
-
</template>
|
|
18
|
-
|
|
19
|
-
<script lang="ts" setup>
|
|
20
|
-
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
21
|
-
import type { UI_I_CreateBackupForm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
|
|
22
|
-
import type { UI_I_SelectInputItem } from '~/components/common/select/input/lib/models/interfaces'
|
|
23
|
-
import { strategyOptionsFunc } from '~/components/common/pages/backups/modals/createBackup/lib/config/strategyOptions'
|
|
24
|
-
|
|
25
|
-
const model = defineModel<UI_I_CreateBackupForm>({ required: true })
|
|
26
|
-
|
|
27
|
-
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
28
|
-
|
|
29
|
-
const strategyOptions = ref<UI_I_SelectInputItem[]>(
|
|
30
|
-
strategyOptionsFunc(localization.value)
|
|
31
|
-
)
|
|
32
|
-
</script>
|
|
33
|
-
|
|
34
|
-
<style lang="scss" scoped>
|
|
35
|
-
#backup-transaction-logs {
|
|
36
|
-
margin: 4px 4px 0 0;
|
|
37
|
-
}
|
|
38
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<atoms-stack-block
|
|
3
|
+
:has-children="false"
|
|
4
|
+
test-id="backup-strategy-stack-block"
|
|
5
|
+
>
|
|
6
|
+
<template #stackBlockKey>
|
|
7
|
+
<span>{{ localization.common.strategy }}</span>
|
|
8
|
+
</template>
|
|
9
|
+
<template #stackBlockContent>
|
|
10
|
+
<common-select-input
|
|
11
|
+
v-model="model.strategy"
|
|
12
|
+
:data="strategyOptions"
|
|
13
|
+
test-id="backup-strategy"
|
|
14
|
+
/>
|
|
15
|
+
</template>
|
|
16
|
+
</atoms-stack-block>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script lang="ts" setup>
|
|
20
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
21
|
+
import type { UI_I_CreateBackupForm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
|
|
22
|
+
import type { UI_I_SelectInputItem } from '~/components/common/select/input/lib/models/interfaces'
|
|
23
|
+
import { strategyOptionsFunc } from '~/components/common/pages/backups/modals/createBackup/lib/config/strategyOptions'
|
|
24
|
+
|
|
25
|
+
const model = defineModel<UI_I_CreateBackupForm>({ required: true })
|
|
26
|
+
|
|
27
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
28
|
+
|
|
29
|
+
const strategyOptions = ref<UI_I_SelectInputItem[]>(
|
|
30
|
+
strategyOptionsFunc(localization.value)
|
|
31
|
+
)
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<style lang="scss" scoped>
|
|
35
|
+
#backup-transaction-logs {
|
|
36
|
+
margin: 4px 4px 0 0;
|
|
37
|
+
}
|
|
38
|
+
</style>
|
|
@@ -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
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export enum UI_E_TitleConfirmModal {
|
|
2
|
+
'take' = '',
|
|
3
|
+
'edit' = 'edit',
|
|
4
|
+
'revert' = 'revert',
|
|
5
|
+
'delete' = 'delete',
|
|
6
|
+
'delete_all' = 'deleteAll',
|
|
7
|
+
'group_delete_all' = 'deleteAll',
|
|
8
|
+
'group_take' = '',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export enum UI_E_TitleModal {
|
|
12
|
+
'take' = '',
|
|
13
|
+
'edit' = '',
|
|
14
|
+
'revert' = 'revertToSnapshotConfirmation',
|
|
15
|
+
'delete' = 'deleteSnapshotConfirmation',
|
|
16
|
+
'delete_all' = 'deleteAllSnapshots',
|
|
17
|
+
'group_delete_all' = 'deleteAllSnapshots',
|
|
18
|
+
'group_take' = '',
|
|
19
|
+
}
|