bfg-common 1.5.215 → 1.5.217

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,274 +1,246 @@
1
- <template>
2
- <div :class="['select-name', { 'pb-6': props.project === 'sphere' }]">
3
- <Teleport to="#name-alert-wrapper">
4
- <ui-alert
5
- v-show="props.errors.length"
6
- :messages="props.errors"
7
- status="alert-danger"
8
- test-id="name-alert"
9
- class="errors-alert"
10
- size="md"
11
- @remove="emits('remove-validation-errors')"
12
- />
13
- </Teleport>
14
-
15
- <div class="name-field">
16
- <div class="flex-1 flex-align-center">
17
- <label for="virtual-machine-name" class="name-label">{{
18
- localization.common.name
19
- }}</label>
20
- <ui-icon
21
- id="virtual-machine-name-icon"
22
- :class="{ active: isShowHelp }"
23
- width="16"
24
- height="16"
25
- name="info"
26
- data-id="virtual-machine-name-icon"
27
- @click.stop="isShowHelp = !isShowHelp"
28
- />
29
- </div>
30
- <Teleport to="body">
31
- <ui-dropdown
32
- :show="isShowHelp"
33
- :items="[]"
34
- elem-id="virtual-machine-name-icon"
35
- test-id="virtual-machine-name"
36
- width="320px"
37
- left
38
- @hide="isShowHelp = false"
39
- >
40
- <template #content>
41
- <div class="vm-name-help-content">
42
- <div class="headline">
43
- <ui-icon name="info-2" width="16" height="16" />
44
- <h3 class="vm-name-help-title">
45
- {{ localization.vmWizard.vmNameRules }}
46
- </h3>
47
- <ui-icon
48
- name="close"
49
- width="16"
50
- height="16"
51
- class="hide-icon pointer"
52
- @click="isShowHelp = false"
53
- />
54
- </div>
55
-
56
- <p class="vm-name-help-text">
57
- {{ localization.common.vmNameValidationDescription }}
58
- </p>
59
- </div>
60
- </template>
61
- </ui-dropdown>
62
- </Teleport>
63
-
64
- <div class="flex-2">
65
- <ui-input
66
- v-model="vmName"
67
- :placeholder="`${localization.common.name} (${localization.common.optional})`"
68
- type="text"
69
- maxlength="54"
70
- test-id="virtual-machine-name"
71
- />
72
- </div>
73
- </div>
74
-
75
- <template v-if="props.project === 'sphere'">
76
- <div class="location">
77
- <span class="location-label">{{ localization.common.location }}</span>
78
-
79
- <div v-if="selectedLocation" class="selected-location">
80
- <span :class="['node-icon', selectedLocation.iconClassName]" />
81
- <span :class="['text', isShowAlert && 'error']">
82
- {{ selectedLocation.name }}
83
- </span>
84
- </div>
85
- <ui-skeleton-item v-else width="160px" height="20px" />
86
- </div>
87
- <div class="tree-view-wrap">
88
- <common-vm-actions-add-folder-tree-view
89
- :data-center="props.dataCenter"
90
- @select-node="onSelectNode"
91
- />
92
- </div>
93
- </template>
94
- </div>
95
- </template>
96
-
97
- <script setup lang="ts">
98
- // import { API_UI_I_Error } from '~/lib/models/store/interfaces'
99
- import type { UI_I_Localization } from '~/lib/models/interfaces'
100
- import type { UI_T_Project } from '~/lib/models/types'
101
- import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
102
-
103
- const vmName = defineModel<string>('vmName', { required: true })
104
- const isShowHelp = defineModel<boolean>('isShowHelp', { required: true })
105
-
106
- const props = defineProps<{
107
- project: UI_T_Project
108
- errors: string[]
109
- dataCenter?: UI_I_TreeNode // для сферы
110
- }>()
111
- const emits = defineEmits<{
112
- (event: 'remove-validation-errors'): void
113
- (event: 'select-node', value: UI_I_TreeNode): void
114
- }>()
115
-
116
- const localization = computed<UI_I_Localization>(() => useLocal())
117
-
118
- const isShowAlert = computed<boolean>(() =>
119
- props.errors.includes(
120
- localization.value.common.enterValidLocationVirtualMachine
121
- )
122
- )
123
- const selectedLocation = ref<UI_I_TreeNode | null>(null)
124
- const onSelectNode = (node: UI_I_TreeNode) => {
125
- selectedLocation.value = node
126
- emits('select-node', node)
127
- }
128
- </script>
129
-
130
- <style>
131
- :root {
132
- --select-name-text-color: #4d5d69;
133
- --select-name-help-icon-hover-color: #4d5d69;
134
- --select-name-help-icon-active-color: #008fd6;
135
- --select-name-help-hide-icon-color: #213444;
136
- --select-name-border-color: #e9ebeda3;
137
- --select-name-location-node-color: #182531;
138
- --select-name-location-bg-color: #ffffff;
139
- }
140
- :root.dark-theme {
141
- --select-name-text-color: #e9eaec;
142
- --select-name-help-icon-hover-color: #e9eaec;
143
- --select-name-help-icon-active-color: #2ba2de;
144
- --select-name-help-hide-icon-color: #e9eaec;
145
- --select-name-border-color: #e9ebed1f;
146
- --select-name-location-node-color: #e9eaec;
147
- --select-name-location-bg-color: #1b2a371f;
148
- }
149
- </style>
150
- <style scoped lang="scss">
151
- .select-name {
152
- height: 100%;
153
- display: flex;
154
- flex-direction: column;
155
- padding-top: 16px;
156
-
157
- .name-field {
158
- display: flex;
159
- align-items: center;
160
- column-gap: 16px;
161
-
162
- .name-label {
163
- font-size: 13px;
164
- color: var(--select-name-text-color);
165
- margin-right: 8px;
166
- overflow: hidden;
167
- text-overflow: ellipsis;
168
- white-space: nowrap;
169
- max-width: 204px;
170
- }
171
- #virtual-machine-name-icon {
172
- color: #9da6ad; // equal in dark and white modes
173
- cursor: pointer;
174
-
175
- &:hover {
176
- color: var(--select-name-help-icon-hover-color);
177
- }
178
- &.active {
179
- color: var(--select-name-help-icon-active-color);
180
- }
181
- }
182
- }
183
-
184
- .location {
185
- display: grid;
186
- grid-template-columns: 1fr 2fr;
187
- margin-top: 16px;
188
- padding: 16px 0;
189
- border-top: 1px solid var(--select-name-border-color);
190
- column-gap: 16px;
191
-
192
- .location-label {
193
- font-size: 13px;
194
- color: var(--select-name-text-color);
195
- overflow: hidden;
196
- text-overflow: ellipsis;
197
- white-space: nowrap;
198
- max-width: 204px;
199
- }
200
-
201
- .selected-location {
202
- display: flex;
203
- align-items: center;
204
- gap: 8px;
205
-
206
- .node-icon {
207
- width: 20px;
208
- height: 20px;
209
- }
210
- .text {
211
- font-size: 13px;
212
- color: var(--select-name-location-node-color);
213
-
214
- &.error {
215
- color: #ea3223; // equal in dark and white modes
216
- }
217
- }
218
- }
219
- }
220
- .tree-view-wrap {
221
- flex: 1;
222
- border-radius: 8px;
223
- border: 1px solid var(--select-name-border-color);
224
- padding: 8px;
225
- background-color: var(--select-name-location-bg-color);
226
- max-height: 240px;
227
- overflow: auto;
228
-
229
- :deep(.tree-content) {
230
- padding: 0 !important;
231
-
232
- .node-wrapper {
233
- border-radius: 4px;
234
-
235
- .node-name {
236
- font-size: 12px;
237
- margin-left: 8px;
238
- overflow: hidden;
239
- text-overflow: ellipsis;
240
- white-space: nowrap;
241
- }
242
- }
243
- }
244
- }
245
- }
246
-
247
- .vm-name-help-content {
248
- padding: 16px;
249
-
250
- .headline {
251
- display: flex;
252
- align-items: center;
253
- gap: 8px;
254
- margin-bottom: 12px;
255
-
256
- .vm-name-help-title {
257
- flex: 1;
258
- font-size: 14px;
259
- font-weight: 500;
260
- line-height: 16.94px;
261
- color: var(--select-name-text-color);
262
- }
263
- .hide-icon {
264
- color: var(--select-name-help-hide-icon-color);
265
- }
266
- }
267
-
268
- .vm-name-help-text {
269
- font-size: 13px;
270
- line-height: 15.73px;
271
- color: var(--select-name-text-color);
272
- }
273
- }
274
- </style>
1
+ <template>
2
+ <div class="select-name">
3
+ <Teleport to="#name-alert-wrapper">
4
+ <ui-alert
5
+ v-show="props.errors.length"
6
+ :messages="props.errors"
7
+ status="alert-danger"
8
+ test-id="name-alert"
9
+ class="errors-alert"
10
+ @remove="emits('remove-validation-errors')"
11
+ />
12
+ </Teleport>
13
+
14
+ <div class="name-field">
15
+ <div class="flex-1 flex-align-center">
16
+ <label for="virtual-machine-name" class="name-label">{{
17
+ localization.common.name
18
+ }}</label>
19
+ <ui-icon
20
+ id="virtual-machine-name-icon"
21
+ :class="{ active: isShowHelp }"
22
+ width="16"
23
+ height="16"
24
+ name="info"
25
+ data-id="virtual-machine-name-icon"
26
+ @click.stop="isShowHelp = !isShowHelp"
27
+ />
28
+ </div>
29
+ <Teleport to="body">
30
+ <ui-dropdown
31
+ :show="isShowHelp"
32
+ :items="[]"
33
+ elem-id="virtual-machine-name-icon"
34
+ test-id=""
35
+ width="320px"
36
+ top
37
+ left
38
+ @hide="isShowHelp = false"
39
+ >
40
+ <template #content>
41
+ <div class="vm-name-help-content">
42
+ <div class="headline">
43
+ <ui-icon name="info-2" width="16" height="16" />
44
+ <h3 class="vm-name-help-title">
45
+ {{ localization.vmWizard.vmNameRules }}
46
+ </h3>
47
+ <ui-icon
48
+ name="close"
49
+ width="16"
50
+ height="16"
51
+ class="hide-icon pointer"
52
+ @click="isShowHelp = false"
53
+ />
54
+ </div>
55
+
56
+ <p class="vm-name-help-text">
57
+ {{ localization.common.vmNameValidationDescription }}
58
+ </p>
59
+ </div>
60
+ </template>
61
+ </ui-dropdown>
62
+ </Teleport>
63
+
64
+ <div class="flex-2">
65
+ <ui-input
66
+ v-model="vmName"
67
+ :placeholder="localization.common.name"
68
+ type="text"
69
+ maxlength="54"
70
+ test-id="virtual-machine-name"
71
+ />
72
+ </div>
73
+ </div>
74
+
75
+ <template v-if="props.project === 'sphere'">
76
+ <div class="location">
77
+ <span class="location-label">{{ localization.common.location }}</span>
78
+
79
+ <div v-if="selectedLocation" class="selected-location">
80
+ <span :class="['node-icon', selectedLocation.iconClassName]" />
81
+ <span :class="['text', isShowAlert && 'error']">
82
+ {{ selectedLocation.name }}
83
+ </span>
84
+ </div>
85
+ <ui-skeleton-item v-else width="160px" height="20px" />
86
+ </div>
87
+ <div class="tree-view-wrap">
88
+ <common-vm-actions-add-folder-tree-view
89
+ :data-center="props.dataCenter"
90
+ @select-node="onSelectNode"
91
+ />
92
+ </div>
93
+ </template>
94
+ </div>
95
+ </template>
96
+
97
+ <script setup lang="ts">
98
+ // import { API_UI_I_Error } from '~/lib/models/store/interfaces'
99
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
100
+ import type { UI_T_Project } from '~/lib/models/types'
101
+ import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
102
+
103
+ const vmName = defineModel<string>('vmName', { required: true })
104
+ const isShowHelp = defineModel<boolean>('isShowHelp', { required: true })
105
+
106
+ const props = defineProps<{
107
+ project: UI_T_Project
108
+ errors: string[]
109
+ dataCenter?: UI_I_TreeNode // для сферы
110
+ }>()
111
+ const emits = defineEmits<{
112
+ (event: 'remove-validation-errors'): void
113
+ (event: 'select-node', value: UI_I_TreeNode): void
114
+ }>()
115
+
116
+ const localization = computed<UI_I_Localization>(() => useLocal())
117
+
118
+ const isShowAlert = computed<boolean>(() =>
119
+ props.errors.includes(
120
+ localization.value.common.enterValidLocationVirtualMachine
121
+ )
122
+ )
123
+ const selectedLocation = ref<UI_I_TreeNode | null>(null)
124
+ const onSelectNode = (node: UI_I_TreeNode) => {
125
+ selectedLocation.value = node
126
+ emits('select-node', node)
127
+ }
128
+ </script>
129
+
130
+ <style>
131
+ :root {
132
+ --select-name-text-color: #4d5d69;
133
+ --select-name-help-icon-hover-color: #4d5d69;
134
+ --select-name-help-icon-active-color: #008fd6;
135
+ --select-name-help-hide-icon-color: #213444;
136
+ --select-name-border-color: #e9ebed;
137
+ --select-name-location-node-color: #182531;
138
+ --select-name-location-bg-color: #ffffff;
139
+ }
140
+ :root.dark-theme {
141
+ --select-name-text-color: #e9eaec;
142
+ --select-name-help-icon-hover-color: #e9eaec;
143
+ --select-name-help-icon-active-color: #2ba2de;
144
+ --select-name-help-hide-icon-color: #e9eaec;
145
+ --select-name-border-color: #e9ebed1f;
146
+ --select-name-location-node-color: #e9eaec;
147
+ --select-name-location-bg-color: transparent;
148
+ }
149
+ </style>
150
+ <style scoped lang="scss">
151
+ .select-name {
152
+ height: 100%;
153
+ display: flex;
154
+ flex-direction: column;
155
+ padding-top: 16px;
156
+
157
+ .name-field {
158
+ display: flex;
159
+ align-items: center;
160
+
161
+ .name-label {
162
+ font-size: 13px;
163
+ color: var(--select-name-text-color);
164
+ margin-right: 8px;
165
+ }
166
+ #virtual-machine-name-icon {
167
+ color: #9da6ad; // equal in dark and white modes
168
+ cursor: pointer;
169
+
170
+ &:hover {
171
+ color: var(--select-name-help-icon-hover-color);
172
+ }
173
+ &.active {
174
+ color: var(--select-name-help-icon-active-color);
175
+ }
176
+ }
177
+ }
178
+
179
+ .location {
180
+ display: grid;
181
+ grid-template-columns: 1fr 2fr;
182
+ margin-top: 16px;
183
+ padding: 16px 0;
184
+ border-top: 1px solid var(--select-name-border-color);
185
+
186
+ .location-label {
187
+ font-size: 13px;
188
+ color: var(--select-name-text-color);
189
+ }
190
+
191
+ .selected-location {
192
+ display: flex;
193
+ align-items: center;
194
+ gap: 8px;
195
+
196
+ .text {
197
+ font-size: 13px;
198
+ color: var(--select-name-location-node-color);
199
+
200
+ &.error {
201
+ color: #ea3223; // equal in dark and white modes
202
+ }
203
+ }
204
+ }
205
+ }
206
+ .tree-view-wrap {
207
+ flex: 1;
208
+ border-radius: 8px;
209
+ border: 1px solid var(--select-name-border-color);
210
+ padding: 12px;
211
+ background-color: var(--select-name-location-bg-color);
212
+
213
+ :deep(.tree-content) {
214
+ padding: 0 !important;
215
+ }
216
+ }
217
+ }
218
+
219
+ .vm-name-help-content {
220
+ padding: 16px;
221
+
222
+ .headline {
223
+ display: flex;
224
+ align-items: center;
225
+ gap: 8px;
226
+ margin-bottom: 12px;
227
+
228
+ .vm-name-help-title {
229
+ flex: 1;
230
+ font-size: 14px;
231
+ font-weight: 500;
232
+ line-height: 16.94px;
233
+ color: var(--select-name-text-color);
234
+ }
235
+ .hide-icon {
236
+ color: var(--select-name-help-hide-icon-color);
237
+ }
238
+ }
239
+
240
+ .vm-name-help-text {
241
+ font-size: 13px;
242
+ line-height: 15.73px;
243
+ color: var(--select-name-text-color);
244
+ }
245
+ }
246
+ </style>