bfg-common 1.5.327 → 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.value"
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.label"
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.label">{{ 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[]>(() => props.options)
79
-
80
- const selectedType = computed<string | number>({
81
- get() {
82
- return props.modelValue
83
- },
84
- set(newValue) {
85
- emits('update:model-value', newValue)
86
- },
87
- })
88
- </script>
89
-
90
- <style lang="scss" scoped>
91
- @import 'assets/scss/common/mixins.scss';
92
- .select-option {
93
- &__container {
94
- @include flex($dir: column);
95
- }
96
- &__wrapper {
97
- @include flex($align: center);
98
- gap: 10px;
99
- .signpost-container {
100
- display: flex;
101
- cursor: pointer;
102
- .tooltip-content-container {
103
- max-width: 350px;
104
- }
105
- }
106
- }
107
- &__subtitle {
108
- }
109
- &__description {
110
- margin-left: 22px;
111
- }
112
- }
113
- .radio {
114
- margin-bottom: 5px;
115
- //&:nth-child(2) {
116
- //margin-top: 10px; // ?
117
- //}
118
- &.disabled {
119
- opacity: 0.7;
120
- }
121
- }
122
- .radio {
123
- }
124
- input[type='radio']:focus:checked + label::before,
125
- input[type='radio']:focus + label::before {
126
- box-shadow: inset 0 0 0 0.25rem #0094d2;
127
- }
128
- </style>
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,6 +1,7 @@
1
1
  export interface UI_I_RadioOption {
2
2
  label: string
3
3
  value: string | number
4
+ id?: string
4
5
  disabled?: boolean
5
6
  isTooltip?: boolean
6
7
  description?: string
@@ -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
- label: localization.common.changeBothComputeResourceStorage,
28
- value: 'resource-storage',
29
- disabled: true,
30
- description: localization.common.changeBothComputeResourceStorageDesc,
31
- permissions: ['sphere'],
32
- },
33
- {
34
- label: localization.common.crossVCenterServerExport,
35
- value: 'server',
36
- disabled: true,
37
- description: localization.common.crossVCenterServerExportDesc,
38
- permissions: ['sphere'],
39
- },
40
- ]
41
-
42
- return options.filter((option) => option.permissions.includes(project))
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
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.5.327",
4
+ "version": "1.5.329",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",