bfg-common 1.5.328 → 1.5.329
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.
@@ -1,128 +1,135 @@
|
|
1
|
-
<template>
|
2
|
-
<div class="select-option">
|
3
|
-
<div
|
4
|
-
v-for="radio in options"
|
5
|
-
:key="radio.
|
6
|
-
v-permission="radio.permission"
|
7
|
-
:class="['select-option__inner radio', radio.disabled && 'disabled']"
|
8
|
-
>
|
9
|
-
<div :class="['select-option__container', radio.value]">
|
10
|
-
<div class="select-option__wrapper">
|
11
|
-
<input
|
12
|
-
:id="radio.
|
13
|
-
v-model="selectedType"
|
14
|
-
:data-id="radio.testId"
|
15
|
-
:value="radio.value"
|
16
|
-
:disabled="radio.disabled"
|
17
|
-
type="radio"
|
18
|
-
/>
|
19
|
-
<label :for="radio.
|
20
|
-
|
21
|
-
<div
|
22
|
-
v-if="'isTooltip' in radio"
|
23
|
-
:id="`${radio.value}-select-tooltip-icon`"
|
24
|
-
class="signpost-container relative"
|
25
|
-
>
|
26
|
-
<atoms-the-icon
|
27
|
-
:data-id="`${radio.testId}-tooltip-toggle-icon`"
|
28
|
-
fill="#0072a3"
|
29
|
-
width="24px"
|
30
|
-
height="24px"
|
31
|
-
name="info-circle"
|
32
|
-
@click="radio.isTooltip = !radio.isTooltip"
|
33
|
-
/>
|
34
|
-
<atoms-tooltip-signpost
|
35
|
-
v-if="radio.isTooltip"
|
36
|
-
:elem-id="`${radio.value}-select-tooltip-icon`"
|
37
|
-
:test-id="radio.testId"
|
38
|
-
@hide="radio.isTooltip = false"
|
39
|
-
>
|
40
|
-
<div class="tooltip-content-container">
|
41
|
-
<p>{{ radio.tooltipContent }}</p>
|
42
|
-
</div>
|
43
|
-
</atoms-tooltip-signpost>
|
44
|
-
</div>
|
45
|
-
</div>
|
46
|
-
|
47
|
-
<slot
|
48
|
-
v-if="$slots.beforeDescription"
|
49
|
-
name="beforeDescription"
|
50
|
-
:data="radio"
|
51
|
-
></slot>
|
52
|
-
</div>
|
53
|
-
|
54
|
-
<div v-if="radio.description" class="select-option__description">
|
55
|
-
{{ radio.description }}
|
56
|
-
</div>
|
57
|
-
|
58
|
-
<slot
|
59
|
-
v-if="$slots.afterDescription"
|
60
|
-
name="afterDescription"
|
61
|
-
:data="radio"
|
62
|
-
></slot>
|
63
|
-
</div>
|
64
|
-
</div>
|
65
|
-
</template>
|
66
|
-
|
67
|
-
<script lang="ts" setup>
|
68
|
-
import type { UI_I_RadioOption } from '~/components/common/select/radio/lib/models/interfaces'
|
69
|
-
|
70
|
-
const props = defineProps<{
|
71
|
-
modelValue: string | number
|
72
|
-
options: UI_I_RadioOption[]
|
73
|
-
}>()
|
74
|
-
const emits = defineEmits<{
|
75
|
-
(event: 'update:model-value', value: string | number): void
|
76
|
-
}>()
|
77
|
-
|
78
|
-
const options = computed<UI_I_RadioOption[]>(() =>
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
}
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
}
|
128
|
-
|
1
|
+
<template>
|
2
|
+
<div class="select-option">
|
3
|
+
<div
|
4
|
+
v-for="radio in options"
|
5
|
+
:key="radio.id"
|
6
|
+
v-permission="radio.permission"
|
7
|
+
:class="['select-option__inner radio', radio.disabled && 'disabled']"
|
8
|
+
>
|
9
|
+
<div :class="['select-option__container', radio.value]">
|
10
|
+
<div class="select-option__wrapper">
|
11
|
+
<input
|
12
|
+
:id="radio.id"
|
13
|
+
v-model="selectedType"
|
14
|
+
:data-id="radio.testId"
|
15
|
+
:value="radio.value"
|
16
|
+
:disabled="radio.disabled"
|
17
|
+
type="radio"
|
18
|
+
/>
|
19
|
+
<label :for="radio.id">{{ radio.label }}</label>
|
20
|
+
|
21
|
+
<div
|
22
|
+
v-if="'isTooltip' in radio"
|
23
|
+
:id="`${radio.value}-select-tooltip-icon`"
|
24
|
+
class="signpost-container relative"
|
25
|
+
>
|
26
|
+
<atoms-the-icon
|
27
|
+
:data-id="`${radio.testId}-tooltip-toggle-icon`"
|
28
|
+
fill="#0072a3"
|
29
|
+
width="24px"
|
30
|
+
height="24px"
|
31
|
+
name="info-circle"
|
32
|
+
@click="radio.isTooltip = !radio.isTooltip"
|
33
|
+
/>
|
34
|
+
<atoms-tooltip-signpost
|
35
|
+
v-if="radio.isTooltip"
|
36
|
+
:elem-id="`${radio.value}-select-tooltip-icon`"
|
37
|
+
:test-id="radio.testId"
|
38
|
+
@hide="radio.isTooltip = false"
|
39
|
+
>
|
40
|
+
<div class="tooltip-content-container">
|
41
|
+
<p>{{ radio.tooltipContent }}</p>
|
42
|
+
</div>
|
43
|
+
</atoms-tooltip-signpost>
|
44
|
+
</div>
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<slot
|
48
|
+
v-if="$slots.beforeDescription"
|
49
|
+
name="beforeDescription"
|
50
|
+
:data="radio"
|
51
|
+
></slot>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
<div v-if="radio.description" class="select-option__description">
|
55
|
+
{{ radio.description }}
|
56
|
+
</div>
|
57
|
+
|
58
|
+
<slot
|
59
|
+
v-if="$slots.afterDescription"
|
60
|
+
name="afterDescription"
|
61
|
+
:data="radio"
|
62
|
+
></slot>
|
63
|
+
</div>
|
64
|
+
</div>
|
65
|
+
</template>
|
66
|
+
|
67
|
+
<script lang="ts" setup>
|
68
|
+
import type { UI_I_RadioOption } from '~/components/common/select/radio/lib/models/interfaces'
|
69
|
+
|
70
|
+
const props = defineProps<{
|
71
|
+
modelValue: string | number
|
72
|
+
options: UI_I_RadioOption[]
|
73
|
+
}>()
|
74
|
+
const emits = defineEmits<{
|
75
|
+
(event: 'update:model-value', value: string | number): void
|
76
|
+
}>()
|
77
|
+
|
78
|
+
const options = computed<UI_I_RadioOption[]>(() =>
|
79
|
+
props.options.map((option) => {
|
80
|
+
return {
|
81
|
+
...option,
|
82
|
+
id: option.id || `radio-btn-${useUniqueId()}`,
|
83
|
+
}
|
84
|
+
})
|
85
|
+
)
|
86
|
+
|
87
|
+
const selectedType = computed<string | number>({
|
88
|
+
get() {
|
89
|
+
return props.modelValue
|
90
|
+
},
|
91
|
+
set(newValue) {
|
92
|
+
emits('update:model-value', newValue)
|
93
|
+
},
|
94
|
+
})
|
95
|
+
</script>
|
96
|
+
|
97
|
+
<style lang="scss" scoped>
|
98
|
+
@import 'assets/scss/common/mixins.scss';
|
99
|
+
.select-option {
|
100
|
+
&__container {
|
101
|
+
@include flex($dir: column);
|
102
|
+
}
|
103
|
+
&__wrapper {
|
104
|
+
@include flex($align: center);
|
105
|
+
gap: 10px;
|
106
|
+
.signpost-container {
|
107
|
+
display: flex;
|
108
|
+
cursor: pointer;
|
109
|
+
.tooltip-content-container {
|
110
|
+
max-width: 350px;
|
111
|
+
}
|
112
|
+
}
|
113
|
+
}
|
114
|
+
&__subtitle {
|
115
|
+
}
|
116
|
+
&__description {
|
117
|
+
margin-left: 22px;
|
118
|
+
}
|
119
|
+
}
|
120
|
+
.radio {
|
121
|
+
margin-bottom: 5px;
|
122
|
+
//&:nth-child(2) {
|
123
|
+
//margin-top: 10px; // ?
|
124
|
+
//}
|
125
|
+
&.disabled {
|
126
|
+
opacity: 0.7;
|
127
|
+
}
|
128
|
+
}
|
129
|
+
.radio {
|
130
|
+
}
|
131
|
+
input[type='radio']:focus:checked + label::before,
|
132
|
+
input[type='radio']:focus + label::before {
|
133
|
+
box-shadow: inset 0 0 0 0.25rem #0094d2;
|
134
|
+
}
|
135
|
+
</style>
|
@@ -1,43 +1,45 @@
|
|
1
|
-
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
2
|
-
import type { UI_T_Project } from '~/lib/models/types'
|
3
|
-
import type { UI_I_VmMigrateTypeOption } from '~/components/common/wizards/vm/migrate/select/type/lib/models/interfaces'
|
4
|
-
|
5
|
-
export const vmMigrateTypesFunc = (
|
6
|
-
localization: UI_I_Localization,
|
7
|
-
project: UI_T_Project
|
8
|
-
): UI_I_VmMigrateTypeOption[] => {
|
9
|
-
const options: UI_I_VmMigrateTypeOption[] = [
|
10
|
-
{
|
11
|
-
label: localization.common.changeComputeResourceOnly,
|
12
|
-
value: 'resource',
|
13
|
-
disabled: false,
|
14
|
-
description: localization.common.changeComputeResourceOnlyDesc,
|
15
|
-
permissions: ['sphere'],
|
16
|
-
permission: 'VirtualMachines.MigrateHost',
|
17
|
-
},
|
18
|
-
{
|
19
|
-
label: localization.common.changeStorageOnly,
|
20
|
-
value: 'storage',
|
21
|
-
disabled: false,
|
22
|
-
description: localization.common.changeStorageOnlyDesc,
|
23
|
-
permissions: ['sphere', 'procurator'],
|
24
|
-
permission: 'VirtualMachines.MigrateDatastore',
|
25
|
-
},
|
26
|
-
//
|
27
|
-
//
|
28
|
-
//
|
29
|
-
//
|
30
|
-
//
|
31
|
-
//
|
32
|
-
//
|
33
|
-
//
|
34
|
-
//
|
35
|
-
//
|
36
|
-
//
|
37
|
-
//
|
38
|
-
//
|
39
|
-
//
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
1
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
2
|
+
import type { UI_T_Project } from '~/lib/models/types'
|
3
|
+
import type { UI_I_VmMigrateTypeOption } from '~/components/common/wizards/vm/migrate/select/type/lib/models/interfaces'
|
4
|
+
|
5
|
+
export const vmMigrateTypesFunc = (
|
6
|
+
localization: UI_I_Localization,
|
7
|
+
project: UI_T_Project
|
8
|
+
): UI_I_VmMigrateTypeOption[] => {
|
9
|
+
const options: UI_I_VmMigrateTypeOption[] = [
|
10
|
+
{
|
11
|
+
label: localization.common.changeComputeResourceOnly,
|
12
|
+
value: 'resource',
|
13
|
+
disabled: false,
|
14
|
+
description: localization.common.changeComputeResourceOnlyDesc,
|
15
|
+
permissions: ['sphere'],
|
16
|
+
permission: 'VirtualMachines.MigrateHost',
|
17
|
+
},
|
18
|
+
{
|
19
|
+
label: localization.common.changeStorageOnly,
|
20
|
+
value: 'storage',
|
21
|
+
disabled: false,
|
22
|
+
description: localization.common.changeStorageOnlyDesc,
|
23
|
+
permissions: ['sphere', 'procurator'],
|
24
|
+
permission: 'VirtualMachines.MigrateDatastore',
|
25
|
+
},
|
26
|
+
// TODO 700
|
27
|
+
// {
|
28
|
+
// label: localization.common.changeBothComputeResourceStorage,
|
29
|
+
// value: 'resource-storage',
|
30
|
+
// disabled: true,
|
31
|
+
// description: localization.common.changeBothComputeResourceStorageDesc,
|
32
|
+
// permissions: ['sphere'],
|
33
|
+
// },
|
34
|
+
// TODO 700
|
35
|
+
// {
|
36
|
+
// label: localization.common.crossVCenterServerExport,
|
37
|
+
// value: 'server',
|
38
|
+
// disabled: true,
|
39
|
+
// description: localization.common.crossVCenterServerExportDesc,
|
40
|
+
// permissions: ['sphere'],
|
41
|
+
// },
|
42
|
+
]
|
43
|
+
|
44
|
+
return options.filter((option) => option.permissions.includes(project))
|
45
|
+
}
|