bfg-common 1.5.423 → 1.5.424

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,578 +1,580 @@
1
- <template>
2
- <g>
3
- <g>
4
- <common-diagram-main-highlights
5
- data-title="port-vm"
6
- type="main-blue"
7
- width="276"
8
- :height="portRectHeight"
9
- :x="positions.blockX"
10
- :y="portRectPosition"
11
- :hide="!showHighlightPortSelectedPort"
12
- />
13
- <common-diagram-main-highlights
14
- data-title="port-vm"
15
- type="main-orange"
16
- width="276"
17
- :height="portRectHeight"
18
- :x="positions.blockX"
19
- :y="portRectPosition"
20
- :hide="!showHighlightPortSelectedAdapter"
21
- />
22
- </g>
23
-
24
- <a
25
- :id="testId"
26
- data-title="port-vm-name"
27
- :data-id="`${props.network.testId}-${props.port.testId}-select`"
28
- cursor="pointer"
29
- @click="onSelectPort(props.network.id, props.port.id)"
30
- >
31
- <foreignObject
32
- data-title="network-name-text"
33
- height="20"
34
- :width="positions.portWidth"
35
- :x="positions.portX"
36
- :y="portTitlePosition"
37
- class="diagram__values"
38
- >
39
- <!-- v-if="props.port.state?.state === 2 || props.port.state?.state === 3"-->
40
- <span
41
- :class="[
42
- 'port-state-icon-container',
43
- isNewView && 'port-state-icon-container-new',
44
- ]"
45
- :title="!isNewView && portErrorText"
46
- >
47
- <template v-if="isNewView">
48
- <Teleport to="body">
49
- <ui-tooltip-info
50
- :id="`port-tooltip-${props.port.id}`"
51
- :test-id="`port-tooltip-${props.port.id}`"
52
- :info="warningType"
53
- :title="localization.common[warningType]"
54
- :text="portErrorText"
55
- />
56
- </Teleport>
57
-
58
- <div
59
- :id="`port-tooltip-${props.port.id}`"
60
- class="popped tooltip inline-block"
61
- >
62
- <ui-icon
63
- v-if="props.port.state?.state === 2"
64
- name="warning-outline"
65
- width="14"
66
- height="14"
67
- color="#fbce28"
68
- />
69
- <ui-icon
70
- v-if="props.port.state?.state === 3"
71
- name="error-outline"
72
- width="14"
73
- height="14"
74
- color="#ea3223"
75
- />
76
- </div>
77
- </template>
78
- <template v-else>
79
- <atoms-the-icon
80
- v-if="props.port.state?.state === 2"
81
- name="warning"
82
- width="15"
83
- height="15"
84
- />
85
- <atoms-the-icon
86
- v-if="props.port.state?.state === 3"
87
- name="error-outline"
88
- width="15"
89
- height="15"
90
- />
91
- </template>
92
- </span>
93
- <span
94
- class="port-text text-ellipsis"
95
- :title="props.port.name"
96
- :id="`port_${props.port.id}`"
97
- >
98
- {{ props.port.name }}
99
- </span>
100
- </foreignObject>
101
- </a>
102
-
103
- <text
104
- v-if="isVCenter"
105
- data-title="v-center-with-mac-address-text"
106
- dy="7px"
107
- font-size="1em"
108
- font-weight="400"
109
- :x="positions.portX"
110
- class="diagram__values small"
111
- :y="macAddressPosition"
112
- >
113
- {{ localization.common.macAddress }}: 00:0c:29:a8:0f:74
114
- </text>
115
-
116
- <common-diagram-main-highlights
117
- data-title="port-vm-line"
118
- type="line-orange"
119
- :x="positions.x1"
120
- :y="portLinePosition"
121
- :x2="positions.x2"
122
- :y2="portLinePosition"
123
- :hide="!showHighlightLine"
124
- />
125
-
126
- <foreignObject
127
- v-if="(isVCenter || isVMPortsGroup) && props.port.isActive"
128
- data-title="vm-play-icon"
129
- :width="positions.playIconSize"
130
- :height="positions.playIconSize"
131
- :x="positions.playIconX"
132
- :y="positions.playIconY"
133
- >
134
- <div style="margin: 0; display: block">
135
- <ui-icon v-if="isNewView" name="diagram-vm-play" />
136
- <atoms-diagram-icon v-else name="v-center-play" />
137
- </div>
138
- </foreignObject>
139
-
140
- <foreignObject
141
- data-title="port-vm-action-icon"
142
- width="18"
143
- height="18"
144
- :x="positions.actionX"
145
- :y="positions.actionY"
146
- cursor="pointer"
147
- >
148
- <div v-if="isNewView" class="dropdown-actions-container">
149
- <button
150
- :id="`dropdown-${props.network.id}-${props.port.id}`"
151
- :class="[
152
- 'action-button',
153
- { 'action-button-selected': isShowDropdown },
154
- ]"
155
- @click="isShowDropdown = !isShowDropdown"
156
- >
157
- <ui-icon name="horizontal-dotes" width="16" height="16" />
158
- </button>
159
- <Teleport to="body">
160
- <ui-dropdown
161
- :test-id="testId"
162
- :show="isShowDropdown"
163
- :items="navigationItemsNew"
164
- :elem-id="`dropdown-${props.network.id}-${props.port.id}`"
165
- width="max-content"
166
- show-from-left
167
- :margin-between-trigger="0"
168
- @select="onShowModalWithTypeCheck"
169
- @hide="onHide"
170
- ></ui-dropdown>
171
- </Teleport>
172
- </div>
173
- <div v-else class="diagram-actions">
174
- <atoms-collapse-nav
175
- class="diagram-actions__icon"
176
- popup-class="diagram-actions__popup"
177
- :close-after-click="true"
178
- :items="navigationItems"
179
- :test-id="testId"
180
- @change="onShowModalWithTypeCheck"
181
- />
182
- </div>
183
- </foreignObject>
184
-
185
- <foreignObject
186
- data-title="port-vm-icon"
187
- :width="positions.portSecondIconSize"
188
- :height="positions.portSecondIconSize"
189
- :x="positions.portSecondIconX"
190
- :y="positions.portSecondIconY"
191
- >
192
- <div v-if="isNewView">
193
- <ui-icon
194
- v-if="
195
- isVmKernel || ((isVCenter || isVMPortsGroup) && props.port.isActive)
196
- "
197
- name="diagram-fill-port"
198
- />
199
- <ui-icon
200
- v-if="isVCenter || (isVMPortsGroup && !props.port.isActive)"
201
- :name="inactivePortIconName"
202
- />
203
- </div>
204
- <div v-else>
205
- <atoms-diagram-icon
206
- v-if="
207
- isVmKernel || ((isVCenter || isVMPortsGroup) && props.port.isActive)
208
- "
209
- name="fill-port"
210
- />
211
- <atoms-diagram-icon
212
- v-if="isVCenter || (isVMPortsGroup && !props.port.isActive)"
213
- :name="inactivePortIconName"
214
- />
215
- </div>
216
- </foreignObject>
217
- </g>
218
- </template>
219
-
220
- <script setup lang="ts">
221
- import type {
222
- UI_I_Localization,
223
- UI_I_ArbitraryObject,
224
- } from '~/lib/models/interfaces'
225
- import type {
226
- UI_I_Network,
227
- UI_I_Port,
228
- UI_I_SelectedPort,
229
- UI_I_SelectedAdapter,
230
- UI_I_ModalsInitialData,
231
- } from '~/components/common/diagramMain/lib/models/interfaces'
232
- import { UI_E_NetworkType } from '~/components/common/diagramMain/lib/models/enums'
233
- import {
234
- portPopupFieldsFunc,
235
- portPopupFieldsNewFunc,
236
- vCenterPopupFieldsFunc,
237
- vCenterPopupFieldsNewFunc,
238
- } from '~/components/common/diagramMain/modals/lib/config'
239
- import { portPositionsFunc } from '~/components/common/diagramMain/lib/config'
240
-
241
- const props = defineProps<{
242
- network: UI_I_Network
243
- port: UI_I_Port & { portPosition: number }
244
- selectedPort: UI_I_SelectedPort
245
- selectedAdapter: UI_I_SelectedAdapter
246
- isDarkMode: boolean
247
- }>()
248
-
249
- const localization = computed<UI_I_Localization>(() => useLocal())
250
-
251
- const emits = defineEmits<{
252
- (event: 'select-port', networkId: string, portId: string): void
253
- (
254
- event: 'show-modal',
255
- value: string,
256
- properties?: UI_I_ModalsInitialData
257
- ): void
258
- }>()
259
-
260
- const { $store }: any = useNuxtApp()
261
-
262
- const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
263
-
264
- const positions = computed<UI_I_ArbitraryObject<number>>(() =>
265
- portPositionsFunc(
266
- isNewView.value,
267
- navCollapsePosition.value,
268
- portStatusIconPosition.value
269
- )
270
- )
271
-
272
- const isShowDropdown = ref<boolean>(false)
273
- const onHide = (): void => {
274
- isShowDropdown.value = false
275
- }
276
-
277
- const portErrorText = computed<string>(
278
- () => props.port.state?.errors?.join('. ') || ''
279
- )
280
-
281
- const warningType = computed<string>(
282
- () =>
283
- (props.port.state?.state === 2 && 'warning') ||
284
- (props.port.state?.state === 3 && 'error')
285
- )
286
-
287
- const inactivePortIconName = computed<string>(
288
- () =>
289
- `${isNewView.value ? 'diagram-' : ''}outline-port${
290
- props.isDarkMode ? '-dark-mode' : ''
291
- }`
292
- )
293
-
294
- const portTitlePosition = computed<number>(() => props.port.portPosition - 5)
295
-
296
- const isVmKernel = computed<boolean>(
297
- () => props.network.networkType === UI_E_NetworkType.VMkernel
298
- )
299
-
300
- const isVCenter = computed<boolean>(
301
- () => props.network.networkType === UI_E_NetworkType.VCenter
302
- )
303
-
304
- const isVMPortsGroup = computed<boolean>(
305
- () => props.network.networkType === UI_E_NetworkType.VMPortsGroup
306
- )
307
-
308
- const testId = computed<string>(() =>
309
- isVmKernel.value
310
- ? `port-${props.port.id}`
311
- : isVMPortsGroup.value
312
- ? `vm-${props.port.name}`
313
- : ''
314
- )
315
-
316
- const portRectHeight = computed<number>(() => (isVCenter.value ? 29 : 18))
317
- const portRectPosition = computed<number>(() => props.port.portPosition - 1.5)
318
- const portLinePosition = computed<number>(() =>
319
- isVCenter.value
320
- ? props.port.portPosition + 12.5
321
- : props.port.portPosition + 7.5
322
- )
323
- const portStatusIconPosition = computed<number>(
324
- () => props.port.portPosition - (isVCenter.value ? -4 : 2)
325
- )
326
- const navCollapsePosition = computed<number>(() => props.port.portPosition - 2)
327
- const macAddressPosition = computed<number>(() => props.port.portPosition + 16)
328
-
329
- const navigationItems = computed(() =>
330
- !isNewView.value
331
- ? isVCenter.value || isVMPortsGroup.value
332
- ? vCenterPopupFieldsFunc(
333
- localization.value,
334
- `${props.network.testId}-${props.port.testId}`
335
- )
336
- : portPopupFieldsFunc(
337
- localization.value,
338
- `${props.network.testId}-${props.port.testId}`
339
- )
340
- : []
341
- )
342
-
343
- const navigationItemsNew = computed(() =>
344
- isNewView.value
345
- ? isVCenter.value || isVMPortsGroup.value
346
- ? vCenterPopupFieldsNewFunc(
347
- localization.value,
348
- `${props.network.testId}-${props.port.testId}`
349
- )
350
- : portPopupFieldsNewFunc(
351
- localization.value,
352
- `${props.network.testId}-${props.port.testId}`
353
- )
354
- : []
355
- )
356
-
357
- const showHighlightLine = computed<boolean>(
358
- () =>
359
- (props.selectedPort.portId === props.port.id &&
360
- props.selectedPort.networkId === props.network.id &&
361
- props.network.activeAdapters.length > 0) ||
362
- !!props.selectedAdapter.connectedPorts.find(
363
- (net) =>
364
- net.networkId === props.network.id && net.ports.includes(props.port.id)
365
- )
366
- )
367
-
368
- const showHighlightPortSelectedPort = computed<boolean>(
369
- () =>
370
- props.selectedPort.portId === props.port.id &&
371
- props.selectedPort.networkId === props.network.id
372
- )
373
-
374
- const showHighlightPortSelectedAdapter = computed<boolean>(() =>
375
- props.selectedAdapter.connectedPorts
376
- ?.find((net) => net.networkId === props.network.id)
377
- ?.ports.includes(props.port.id)
378
- )
379
-
380
- const portTitle = computed<string>(() => {
381
- if (props.port.name.length > 23) {
382
- return `${props.port.name.slice(0, 23)}...`
383
- }
384
- return props.port.name
385
- })
386
-
387
- const onShowModal = (
388
- value: string,
389
- properties?: UI_I_ModalsInitialData
390
- ): void => {
391
- emits('show-modal', value, properties)
392
- }
393
-
394
- const onShowModalWithTypeCheck = (value: string) => {
395
- if (isVCenter.value || isVMPortsGroup.value) {
396
- onShowModal(value, {
397
- macAddress: props.port.macAddress,
398
- adapter: props.port.adapter,
399
- vmTitle: props.port.name,
400
- })
401
- return
402
- }
403
-
404
- if (isVmKernel.value) {
405
- onShowModal(value, {
406
- portName: props.network.sysx?.id,
407
- networkLabel: props.network.title,
408
- vlanId: props.network.vlanId,
409
- tcpIp: props.network.sysx?.tcp_stack,
410
- mtu: props.network.sysx?.mtu,
411
- services: {
412
- vMotion: props.network.sysx?.services.VMotion,
413
- provisioning: props.network.sysx?.services.Provisioning,
414
- faultToleranceLogging:
415
- props.network.sysx?.services.FaultToleranceLogging,
416
- management: props.network.sysx?.services.Management,
417
- replication: props.network.sysx?.services.VSphereReplication,
418
- replicationNFC: props.network.sysx?.services.VSphereReplicationNFC,
419
- vSAN: props.network.sysx?.services.VSAN,
420
- backupNFC: props.network.sysx?.services.VSphereBackupNFC,
421
- nVMeOverTCP: props.network.sysx?.services.NVMeOverTCP,
422
- nVMeOverRDMA: props.network.sysx?.services.NVMeOverRDMA,
423
- },
424
- tcpConfig: {
425
- ipv4Settings: props.network.sysx?.ipv4_settings.auto ? '0' : '1',
426
- ipv4Address: props.network.sysx?.ipv4_settings.ipv4,
427
- subnetMask: props.network.sysx?.ipv4_settings.mask,
428
- defaultGateway: {
429
- checked: props.network.sysx?.ipv4_settings.gateway_override,
430
- value: props.network.sysx?.ipv4_settings.gateway,
431
- },
432
- },
433
- })
434
- return
435
- }
436
-
437
- onShowModal(value)
438
- }
439
-
440
- const onSelectPort = (networkId: string, portId: string): void => {
441
- emits('select-port', networkId, portId)
442
- }
443
- </script>
444
-
445
- <style scoped lang="scss">
446
- @import '../../../../assets/scss/common/mixins';
447
-
448
- :root.dark-theme {
449
- .selection-line {
450
- stroke: #fdd006;
451
- }
452
- .diagram__values {
453
- fill: #c1cdd4;
454
- }
455
-
456
- .text-ellipsis {
457
- color: #c1cdd4;
458
-
459
- &:hover {
460
- color: #c1cdd4;
461
- text-decoration: solid underline #c1cdd4 1px;
462
- }
463
- }
464
- }
465
-
466
- .diagram {
467
- &__values {
468
- @include text($fs: 12px, $fw: 400);
469
-
470
- fill: #565656;
471
- }
472
-
473
- &-actions {
474
- :deep(.diagram-actions__icon) {
475
- &.tabs-overflow {
476
- top: -12px;
477
- right: -13px;
478
- }
479
- .navbar-dropdown-menu {
480
- .navbar-dropdown-menu-item {
481
- background: red;
482
- }
483
- }
484
- }
485
- }
486
- }
487
- .selection-line {
488
- stroke: #f3bb00;
489
- }
490
- .highlight-stroke {
491
- stroke: #f3bb00;
492
- }
493
- .highlight {
494
- fill: #fffce8;
495
- }
496
- .selection-stroke {
497
- stroke: #0079b8;
498
- fill: #f3f6fa;
499
- }
500
- .hide-line-highlight {
501
- stroke-opacity: 0;
502
- fill: transparent;
503
- }
504
- .small {
505
- font: normal 9px Metropolis;
506
- }
507
-
508
- .text-ellipsis {
509
- display: block;
510
- text-overflow: ellipsis;
511
- overflow: hidden;
512
- white-space: nowrap;
513
- font-weight: 400;
514
- font-size: 12px;
515
-
516
- &.port-text {
517
- max-width: 206px;
518
- color: #565656;
519
-
520
- &:hover {
521
- color: #565656;
522
- text-decoration: solid underline #565656 1px;
523
- }
524
- }
525
- }
526
-
527
- .port-state-icon-container {
528
- position: absolute;
529
- top: 4px;
530
- left: 3px;
531
- }
532
-
533
- .port-text {
534
- padding-left: 20px;
535
- }
536
-
537
- :root.is-new-view {
538
- .port-text.text-ellipsis {
539
- user-select: none;
540
- -webkit-user-select: none;
541
- line-height: 25px;
542
- padding-left: 18px;
543
- color: var(--diagram-content-text);
544
- max-width: 200px;
545
-
546
- &:hover {
547
- color: var(--diagram-content-text-hover);
548
- text-decoration: unset;
549
- }
550
- }
551
-
552
- .action-button {
553
- border: none;
554
- margin: 0;
555
- padding: 0;
556
- background: transparent;
557
- cursor: pointer;
558
- color: var(--diagram-content-text);
559
-
560
- &:hover {
561
- color: var(--diagram-content-text-hover);
562
- }
563
-
564
- &.action-button-selected {
565
- color: var(--diagram-content-text-selected);
566
- }
567
- }
568
-
569
- .port-state-icon-container {
570
- position: absolute;
571
-
572
- &.port-state-icon-container-new {
573
- top: 5px;
574
- left: 0;
575
- }
576
- }
577
- }
578
- </style>
1
+ <template>
2
+ <g>
3
+ <g>
4
+ <common-diagram-main-highlights
5
+ data-title="port-vm"
6
+ type="main-blue"
7
+ width="276"
8
+ :height="portRectHeight"
9
+ :x="positions.blockX"
10
+ :y="portRectPosition"
11
+ :hide="!showHighlightPortSelectedPort"
12
+ />
13
+ <common-diagram-main-highlights
14
+ data-title="port-vm"
15
+ type="main-orange"
16
+ width="276"
17
+ :height="portRectHeight"
18
+ :x="positions.blockX"
19
+ :y="portRectPosition"
20
+ :hide="!showHighlightPortSelectedAdapter"
21
+ />
22
+ </g>
23
+
24
+ <a
25
+ :id="testId"
26
+ data-title="port-vm-name"
27
+ :data-id="`${props.network.testId}-${props.port.testId}-select`"
28
+ cursor="pointer"
29
+ @click="onSelectPort(props.network.id, props.port.id)"
30
+ >
31
+ <foreignObject
32
+ data-title="network-name-text"
33
+ height="20"
34
+ :width="positions.portWidth"
35
+ :x="positions.portX"
36
+ :y="portTitlePosition"
37
+ class="diagram__values"
38
+ >
39
+ <!-- v-if="props.port.state?.state === 2 || props.port.state?.state === 3"-->
40
+ <span
41
+ :class="[
42
+ 'port-state-icon-container',
43
+ isNewView && 'port-state-icon-container-new',
44
+ ]"
45
+ :title="!isNewView && portErrorText"
46
+ >
47
+ <template v-if="isNewView">
48
+ <Teleport to="body">
49
+ <ui-tooltip-info
50
+ :id="`port-tooltip-${props.port.id}`"
51
+ :test-id="`port-tooltip-${props.port.id}`"
52
+ :info="warningType"
53
+ :title="localization.common[warningType]"
54
+ :text="portErrorText"
55
+ />
56
+ </Teleport>
57
+
58
+ <div
59
+ :id="`port-tooltip-${props.port.id}`"
60
+ class="popped tooltip inline-block"
61
+ >
62
+ <ui-icon
63
+ v-if="props.port.state?.state === 2"
64
+ name="warning-outline"
65
+ width="14"
66
+ height="14"
67
+ color="#fbce28"
68
+ />
69
+ <ui-icon
70
+ v-if="props.port.state?.state === 3"
71
+ name="error-outline"
72
+ width="14"
73
+ height="14"
74
+ color="#ea3223"
75
+ />
76
+ </div>
77
+ </template>
78
+ <template v-else>
79
+ <atoms-the-icon
80
+ v-if="props.port.state?.state === 2"
81
+ name="warning"
82
+ width="15"
83
+ height="15"
84
+ />
85
+ <atoms-the-icon
86
+ v-if="props.port.state?.state === 3"
87
+ name="error-outline"
88
+ width="15"
89
+ height="15"
90
+ />
91
+ </template>
92
+ </span>
93
+ <span
94
+ class="port-text text-ellipsis"
95
+ :title="props.port.name"
96
+ :id="`port_${props.port.id}`"
97
+ >
98
+ {{ props.port.name }}
99
+ </span>
100
+ </foreignObject>
101
+ </a>
102
+
103
+ <text
104
+ v-if="isVCenter"
105
+ data-title="v-center-with-mac-address-text"
106
+ dy="7px"
107
+ font-size="1em"
108
+ font-weight="400"
109
+ :x="positions.portX"
110
+ class="diagram__values small"
111
+ :y="macAddressPosition"
112
+ >
113
+ {{ localization.common.macAddress }}: 00:0c:29:a8:0f:74
114
+ </text>
115
+
116
+ <common-diagram-main-highlights
117
+ data-title="port-vm-line"
118
+ type="line-orange"
119
+ :x="positions.x1"
120
+ :y="portLinePosition"
121
+ :x2="positions.x2"
122
+ :y2="portLinePosition"
123
+ :hide="!showHighlightLine"
124
+ />
125
+
126
+ <foreignObject
127
+ v-if="(isVCenter || isVMPortsGroup) && props.port.isActive"
128
+ data-title="vm-play-icon"
129
+ :width="positions.playIconSize"
130
+ :height="positions.playIconSize"
131
+ :x="positions.playIconX"
132
+ :y="positions.playIconY"
133
+ >
134
+ <div style="margin: 0; display: block">
135
+ <ui-icon v-if="isNewView" name="diagram-vm-play" />
136
+ <atoms-diagram-icon v-else name="v-center-play" />
137
+ </div>
138
+ </foreignObject>
139
+
140
+ <foreignObject
141
+ data-title="port-vm-action-icon"
142
+ width="18"
143
+ height="18"
144
+ :x="positions.actionX"
145
+ :y="positions.actionY"
146
+ cursor="pointer"
147
+ >
148
+ <div v-if="isNewView" class="dropdown-actions-container">
149
+ <button
150
+ :id="`dropdown-${props.network.id}-${props.port.id}`"
151
+ :class="[
152
+ 'action-button',
153
+ { 'action-button-selected': isShowDropdown },
154
+ ]"
155
+ @click="isShowDropdown = !isShowDropdown"
156
+ >
157
+ <ui-icon name="horizontal-dotes" width="16" height="16" />
158
+ </button>
159
+ <Teleport to="body">
160
+ <ui-dropdown
161
+ :test-id="testId"
162
+ :show="isShowDropdown"
163
+ :items="navigationItemsNew"
164
+ :elem-id="`dropdown-${props.network.id}-${props.port.id}`"
165
+ width="max-content"
166
+ show-from-left
167
+ :margin-between-trigger="0"
168
+ @select="onShowModalWithTypeCheck"
169
+ @hide="onHide"
170
+ ></ui-dropdown>
171
+ </Teleport>
172
+ </div>
173
+ <div v-else class="diagram-actions">
174
+ <atoms-collapse-nav
175
+ class="diagram-actions__icon"
176
+ popup-class="diagram-actions__popup"
177
+ :close-after-click="true"
178
+ :items="navigationItems"
179
+ :test-id="testId"
180
+ @change="onShowModalWithTypeCheck"
181
+ />
182
+ </div>
183
+ </foreignObject>
184
+
185
+ <foreignObject
186
+ data-title="port-vm-icon"
187
+ :width="positions.portSecondIconSize"
188
+ :height="positions.portSecondIconSize"
189
+ :x="positions.portSecondIconX"
190
+ :y="positions.portSecondIconY"
191
+ >
192
+ <div v-if="isNewView">
193
+ <ui-icon
194
+ v-if="
195
+ isVmKernel || ((isVCenter || isVMPortsGroup) && props.port.isActive)
196
+ "
197
+ name="diagram-fill-port"
198
+ />
199
+ <ui-icon
200
+ v-if="isVCenter || (isVMPortsGroup && !props.port.isActive)"
201
+ :name="inactivePortIconName"
202
+ />
203
+ </div>
204
+ <div v-else>
205
+ <atoms-diagram-icon
206
+ v-if="
207
+ isVmKernel || ((isVCenter || isVMPortsGroup) && props.port.isActive)
208
+ "
209
+ name="fill-port"
210
+ />
211
+ <atoms-diagram-icon
212
+ v-if="isVCenter || (isVMPortsGroup && !props.port.isActive)"
213
+ :name="inactivePortIconName"
214
+ />
215
+ </div>
216
+ </foreignObject>
217
+ </g>
218
+ </template>
219
+
220
+ <script setup lang="ts">
221
+ import type { UI_I_Dropdown } from '~/node_modules/bfg-uikit/components/ui/dropdown/models/interfaces'
222
+ import type {
223
+ UI_I_Localization,
224
+ UI_I_ArbitraryObject,
225
+ } from '~/lib/models/interfaces'
226
+ import type {
227
+ UI_I_Network,
228
+ UI_I_Port,
229
+ UI_I_SelectedPort,
230
+ UI_I_SelectedAdapter,
231
+ UI_I_ModalsInitialData,
232
+ } from '~/components/common/diagramMain/lib/models/interfaces'
233
+ import type { UI_I_CollapseNavItem } from '~/components/atoms/collapse/lib/models/interfaces'
234
+ import { UI_E_NetworkType } from '~/components/common/diagramMain/lib/models/enums'
235
+ import {
236
+ portPopupFieldsFunc,
237
+ portPopupFieldsNewFunc,
238
+ vCenterPopupFieldsFunc,
239
+ vCenterPopupFieldsNewFunc,
240
+ } from '~/components/common/diagramMain/modals/lib/config'
241
+ import { portPositionsFunc } from '~/components/common/diagramMain/lib/config'
242
+
243
+ const props = defineProps<{
244
+ network: UI_I_Network
245
+ port: UI_I_Port & { portPosition: number }
246
+ selectedPort: UI_I_SelectedPort
247
+ selectedAdapter: UI_I_SelectedAdapter
248
+ isDarkMode: boolean
249
+ }>()
250
+
251
+ const localization = computed<UI_I_Localization>(() => useLocal())
252
+
253
+ const emits = defineEmits<{
254
+ (event: 'select-port', networkId: string, portId: string): void
255
+ (
256
+ event: 'show-modal',
257
+ value: string,
258
+ properties?: UI_I_ModalsInitialData
259
+ ): void
260
+ }>()
261
+
262
+ const { $store }: any = useNuxtApp()
263
+
264
+ const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
265
+
266
+ const positions = computed<UI_I_ArbitraryObject<number>>(() =>
267
+ portPositionsFunc(
268
+ isNewView.value,
269
+ navCollapsePosition.value,
270
+ portStatusIconPosition.value
271
+ )
272
+ )
273
+
274
+ const isShowDropdown = ref<boolean>(false)
275
+ const onHide = (): void => {
276
+ isShowDropdown.value = false
277
+ }
278
+
279
+ const portErrorText = computed<string>(
280
+ () => props.port.state?.errors?.join('. ') || ''
281
+ )
282
+
283
+ const warningType = computed<string>(
284
+ () =>
285
+ (props.port.state?.state === 2 && 'warning') ||
286
+ (props.port.state?.state === 3 && 'error')
287
+ )
288
+
289
+ const inactivePortIconName = computed<string>(
290
+ () =>
291
+ `${isNewView.value ? 'diagram-' : ''}outline-port${
292
+ props.isDarkMode ? '-dark-mode' : ''
293
+ }`
294
+ )
295
+
296
+ const portTitlePosition = computed<number>(() => props.port.portPosition - 5)
297
+
298
+ const isVmKernel = computed<boolean>(
299
+ () => props.network.networkType === UI_E_NetworkType.VMkernel
300
+ )
301
+
302
+ const isVCenter = computed<boolean>(
303
+ () => props.network.networkType === UI_E_NetworkType.VCenter
304
+ )
305
+
306
+ const isVMPortsGroup = computed<boolean>(
307
+ () => props.network.networkType === UI_E_NetworkType.VMPortsGroup
308
+ )
309
+
310
+ const testId = computed<string>(() =>
311
+ isVmKernel.value
312
+ ? `port-${props.port.id}`
313
+ : isVMPortsGroup.value
314
+ ? `vm-${props.port.name}`
315
+ : ''
316
+ )
317
+
318
+ const portRectHeight = computed<number>(() => (isVCenter.value ? 29 : 18))
319
+ const portRectPosition = computed<number>(() => props.port.portPosition - 1.5)
320
+ const portLinePosition = computed<number>(() =>
321
+ isVCenter.value
322
+ ? props.port.portPosition + 12.5
323
+ : props.port.portPosition + 7.5
324
+ )
325
+ const portStatusIconPosition = computed<number>(
326
+ () => props.port.portPosition - (isVCenter.value ? -4 : 2)
327
+ )
328
+ const navCollapsePosition = computed<number>(() => props.port.portPosition - 2)
329
+ const macAddressPosition = computed<number>(() => props.port.portPosition + 16)
330
+
331
+ const navigationItems = computed<UI_I_CollapseNavItem[]>(() =>
332
+ !isNewView.value
333
+ ? isVCenter.value || isVMPortsGroup.value
334
+ ? vCenterPopupFieldsFunc(
335
+ localization.value,
336
+ `${props.network.testId}-${props.port.testId}`
337
+ )
338
+ : portPopupFieldsFunc(
339
+ localization.value,
340
+ `${props.network.testId}-${props.port.testId}`
341
+ )
342
+ : []
343
+ )
344
+
345
+ const navigationItemsNew = computed<UI_I_Dropdown[]>(() =>
346
+ isNewView.value
347
+ ? isVCenter.value || isVMPortsGroup.value
348
+ ? vCenterPopupFieldsNewFunc(
349
+ localization.value,
350
+ `${props.network.testId}-${props.port.testId}`
351
+ )
352
+ : portPopupFieldsNewFunc(
353
+ localization.value,
354
+ `${props.network.testId}-${props.port.testId}`
355
+ )
356
+ : []
357
+ )
358
+
359
+ const showHighlightLine = computed<boolean>(
360
+ () =>
361
+ (props.selectedPort.portId === props.port.id &&
362
+ props.selectedPort.networkId === props.network.id &&
363
+ props.network.activeAdapters.length > 0) ||
364
+ !!props.selectedAdapter.connectedPorts.find(
365
+ (net) =>
366
+ net.networkId === props.network.id && net.ports.includes(props.port.id)
367
+ )
368
+ )
369
+
370
+ const showHighlightPortSelectedPort = computed<boolean>(
371
+ () =>
372
+ props.selectedPort.portId === props.port.id &&
373
+ props.selectedPort.networkId === props.network.id
374
+ )
375
+
376
+ const showHighlightPortSelectedAdapter = computed<boolean>(() =>
377
+ props.selectedAdapter.connectedPorts
378
+ ?.find((net) => net.networkId === props.network.id)
379
+ ?.ports.includes(props.port.id)
380
+ )
381
+
382
+ const portTitle = computed<string>(() => {
383
+ if (props.port.name.length > 23) {
384
+ return `${props.port.name.slice(0, 23)}...`
385
+ }
386
+ return props.port.name
387
+ })
388
+
389
+ const onShowModal = (
390
+ value: string,
391
+ properties?: UI_I_ModalsInitialData
392
+ ): void => {
393
+ emits('show-modal', value, properties)
394
+ }
395
+
396
+ const onShowModalWithTypeCheck = (value: string) => {
397
+ if (isVCenter.value || isVMPortsGroup.value) {
398
+ onShowModal(value, {
399
+ macAddress: props.port.macAddress,
400
+ adapter: props.port.adapter,
401
+ vmTitle: props.port.name,
402
+ })
403
+ return
404
+ }
405
+
406
+ if (isVmKernel.value) {
407
+ onShowModal(value, {
408
+ portName: props.network.sysx?.id,
409
+ networkLabel: props.network.title,
410
+ vlanId: props.network.vlanId,
411
+ tcpIp: props.network.sysx?.tcp_stack,
412
+ mtu: props.network.sysx?.mtu,
413
+ services: {
414
+ vMotion: props.network.sysx?.services.VMotion,
415
+ provisioning: props.network.sysx?.services.Provisioning,
416
+ faultToleranceLogging:
417
+ props.network.sysx?.services.FaultToleranceLogging,
418
+ management: props.network.sysx?.services.Management,
419
+ replication: props.network.sysx?.services.VSphereReplication,
420
+ replicationNFC: props.network.sysx?.services.VSphereReplicationNFC,
421
+ vSAN: props.network.sysx?.services.VSAN,
422
+ backupNFC: props.network.sysx?.services.VSphereBackupNFC,
423
+ nVMeOverTCP: props.network.sysx?.services.NVMeOverTCP,
424
+ nVMeOverRDMA: props.network.sysx?.services.NVMeOverRDMA,
425
+ },
426
+ tcpConfig: {
427
+ ipv4Settings: props.network.sysx?.ipv4_settings.auto ? '0' : '1',
428
+ ipv4Address: props.network.sysx?.ipv4_settings.ipv4,
429
+ subnetMask: props.network.sysx?.ipv4_settings.mask,
430
+ defaultGateway: {
431
+ checked: props.network.sysx?.ipv4_settings.gateway_override,
432
+ value: props.network.sysx?.ipv4_settings.gateway,
433
+ },
434
+ },
435
+ })
436
+ return
437
+ }
438
+
439
+ onShowModal(value)
440
+ }
441
+
442
+ const onSelectPort = (networkId: string, portId: string): void => {
443
+ emits('select-port', networkId, portId)
444
+ }
445
+ </script>
446
+
447
+ <style scoped lang="scss">
448
+ @import '../../../../assets/scss/common/mixins';
449
+
450
+ :root.dark-theme {
451
+ .selection-line {
452
+ stroke: #fdd006;
453
+ }
454
+ .diagram__values {
455
+ fill: #c1cdd4;
456
+ }
457
+
458
+ .text-ellipsis {
459
+ color: #c1cdd4;
460
+
461
+ &:hover {
462
+ color: #c1cdd4;
463
+ text-decoration: solid underline #c1cdd4 1px;
464
+ }
465
+ }
466
+ }
467
+
468
+ .diagram {
469
+ &__values {
470
+ @include text($fs: 12px, $fw: 400);
471
+
472
+ fill: #565656;
473
+ }
474
+
475
+ &-actions {
476
+ :deep(.diagram-actions__icon) {
477
+ &.tabs-overflow {
478
+ top: -12px;
479
+ right: -13px;
480
+ }
481
+ .navbar-dropdown-menu {
482
+ .navbar-dropdown-menu-item {
483
+ background: red;
484
+ }
485
+ }
486
+ }
487
+ }
488
+ }
489
+ .selection-line {
490
+ stroke: #f3bb00;
491
+ }
492
+ .highlight-stroke {
493
+ stroke: #f3bb00;
494
+ }
495
+ .highlight {
496
+ fill: #fffce8;
497
+ }
498
+ .selection-stroke {
499
+ stroke: #0079b8;
500
+ fill: #f3f6fa;
501
+ }
502
+ .hide-line-highlight {
503
+ stroke-opacity: 0;
504
+ fill: transparent;
505
+ }
506
+ .small {
507
+ font: normal 9px Metropolis;
508
+ }
509
+
510
+ .text-ellipsis {
511
+ display: block;
512
+ text-overflow: ellipsis;
513
+ overflow: hidden;
514
+ white-space: nowrap;
515
+ font-weight: 400;
516
+ font-size: 12px;
517
+
518
+ &.port-text {
519
+ max-width: 206px;
520
+ color: #565656;
521
+
522
+ &:hover {
523
+ color: #565656;
524
+ text-decoration: solid underline #565656 1px;
525
+ }
526
+ }
527
+ }
528
+
529
+ .port-state-icon-container {
530
+ position: absolute;
531
+ top: 4px;
532
+ left: 3px;
533
+ }
534
+
535
+ .port-text {
536
+ padding-left: 20px;
537
+ }
538
+
539
+ :root.is-new-view {
540
+ .port-text.text-ellipsis {
541
+ user-select: none;
542
+ -webkit-user-select: none;
543
+ line-height: 25px;
544
+ padding-left: 18px;
545
+ color: var(--diagram-content-text);
546
+ max-width: 200px;
547
+
548
+ &:hover {
549
+ color: var(--diagram-content-text-hover);
550
+ text-decoration: unset;
551
+ }
552
+ }
553
+
554
+ .action-button {
555
+ border: none;
556
+ margin: 0;
557
+ padding: 0;
558
+ background: transparent;
559
+ cursor: pointer;
560
+ color: var(--diagram-content-text);
561
+
562
+ &:hover {
563
+ color: var(--diagram-content-text-hover);
564
+ }
565
+
566
+ &.action-button-selected {
567
+ color: var(--diagram-content-text-selected);
568
+ }
569
+ }
570
+
571
+ .port-state-icon-container {
572
+ position: absolute;
573
+
574
+ &.port-state-icon-container-new {
575
+ top: 5px;
576
+ left: 0;
577
+ }
578
+ }
579
+ }
580
+ </style>