bfg-common 1.6.41 → 1.6.43

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.
@@ -17,6 +17,7 @@
17
17
  { 'has-error': props.hasError },
18
18
  ]"
19
19
  :style="tooltipStyles"
20
+ :data-id="props.testId"
20
21
  >
21
22
  <slot name="content" />
22
23
  </div>
@@ -31,9 +32,11 @@ const props = withDefaults(
31
32
  defineProps<{
32
33
  hasError: boolean
33
34
  selector?: string
35
+ testId?: string
34
36
  }>(),
35
37
  {
36
38
  selector: undefined,
39
+ testId: '',
37
40
  }
38
41
  )
39
42
  const emits = defineEmits<{
@@ -1,234 +1,234 @@
1
- <template>
2
- <div class="diagram-header">
3
- <div class="diagram-header-left">
4
- <atoms-the-icon
5
- :class="[
6
- 'diagram-header__arrow-icon',
7
- {
8
- open: props.isShowDiagram,
9
- },
10
- ]"
11
- :data-id="`${props.testId}-toggle-icon`"
12
- name="angle"
13
- @click="emits('toggle-diagram')"
14
- />
15
- <a>
16
- <span>
17
- {{ localization.common.standardSwitch }}:
18
- {{ props.diagramName }}
19
- </span>
20
- </a>
21
- </div>
22
- <div v-if="props.isShowDiagram" class="diagram-header__btn-container">
23
- <span class="vertical-separator"></span>
24
- <button
25
- id="add-networking-button"
26
- v-permission="
27
- 'Networks.CreateSysx Networks.CreatePortGroup Networks.UpdateSwitch Networks.CreateSwitch'
28
- "
29
- :data-id="`${props.testId}-add-networking-button`"
30
- type="button"
31
- @click="onShowModal('add-networking', props.diagramName)"
32
- >
33
- {{ localization.common.addNetworking }}
34
- </button>
35
- <button
36
- id="switch-edit-button"
37
- v-permission="'Networks.UpdateSwitch'"
38
- :data-id="`${props.testId}-edit-button`"
39
- type="button"
40
- @click="onShowModal('switch-edit')"
41
- >
42
- {{ localization.common.edit }}
43
- </button>
44
- <button
45
- id="switch-manage-physical-adapters-button"
46
- v-permission="'Networks.UpdateSwitch'"
47
- :data-id="`${props.testId}-manage-physical-adapters-button`"
48
- type="button"
49
- @click="onShowModal('switch-manage-physical-adapters')"
50
- >
51
- {{ localization.common.managePhysicalAdapters }}
52
- </button>
53
- <div class="diagram-main-actions-dots">
54
- <atoms-collapse-nav
55
- :close-after-click="true"
56
- :items="switchMainNavigation"
57
- :test-id="`${props.testId}-actions`"
58
- popup-class="diagram-main-actions__popup"
59
- @change="onShowModal"
60
- />
61
- </div>
62
- </div>
63
- </div>
64
- <hr class="horizontal-separator" />
65
- </template>
66
-
67
- <script setup lang="ts">
68
- import type { UI_I_Localization } from '~/lib/models/interfaces'
69
- import type {
70
- UI_I_NavigationItem,
71
- UI_I_ModalsInitialData,
72
- } from '~/components/common/diagramMain/lib/models/interfaces'
73
- import type { UI_T_Project } from '~/lib/models/types'
74
- import { switchMainNavigationFunc } from '~/components/common/diagramMain/modals/lib/config'
75
-
76
- const props = withDefaults(
77
- defineProps<{
78
- isShowDiagram: boolean
79
- diagramName: string
80
- testId: string
81
- project?: UI_T_Project
82
- }>(),
83
- {
84
- project: undefined,
85
- }
86
- )
87
-
88
- const emits = defineEmits<{
89
- (event: 'toggle-diagram'): void
90
- (
91
- event: 'show-modal',
92
- modalName: string,
93
- properties?: UI_I_ModalsInitialData
94
- ): void
95
- }>()
96
-
97
- const localization = computed<UI_I_Localization>(() => useLocal())
98
-
99
- const switchMainNavigation = computed<UI_I_NavigationItem[]>(() =>
100
- switchMainNavigationFunc(localization.value, props.testId)
101
- )
102
-
103
- const onShowModal = (modalName: string, diagramName?: string) => {
104
- diagramName
105
- ? emits('show-modal', modalName, { switch_name: diagramName })
106
- : emits('show-modal', modalName)
107
- }
108
- </script>
109
-
110
- <style scoped lang="scss">
111
- :root.dark-theme {
112
- .diagram-header {
113
- &-left {
114
- a {
115
- span {
116
- color: #79c6e6;
117
-
118
- &:hover {
119
- color: #49afd9;
120
- }
121
- }
122
- }
123
- }
124
-
125
- &__btn-container {
126
- button {
127
- color: #89cbdf;
128
-
129
- &:hover {
130
- color: #57c8ea;
131
- }
132
- }
133
- }
134
- }
135
- }
136
-
137
- .diagram-header {
138
- display: flex;
139
- justify-self: flex-start;
140
- width: 100%;
141
- padding: 24px 16px 0;
142
- overflow-x: auto;
143
- overflow-y: hidden;
144
- scrollbar-width: none;
145
- -ms-overflow-style: none;
146
-
147
- &::-webkit-scrollbar {
148
- display: none;
149
- }
150
-
151
- a {
152
- color: #0072a3;
153
- cursor: pointer;
154
- font-weight: 700;
155
- user-select: none;
156
- line-height: 20px;
157
- span {
158
- font-weight: 700;
159
- white-space: nowrap;
160
- }
161
- }
162
-
163
- &-left {
164
- display: flex;
165
- flex-wrap: nowrap;
166
- color: #49afd9;
167
- }
168
-
169
- &__arrow-icon {
170
- width: 16px;
171
- min-width: 16px;
172
- height: 16px;
173
- min-height: 16px;
174
- margin-right: 4px;
175
- transform: rotate(90deg);
176
- align-self: center;
177
- fill: var(--triger-icon-color);
178
- cursor: pointer;
179
- &.open {
180
- transform: rotate(180deg);
181
- }
182
- }
183
-
184
- &__btn-container {
185
- display: flex;
186
-
187
- button {
188
- font-size: 11px;
189
- height: 24px;
190
- border: none;
191
- background: none;
192
- margin-right: 0;
193
- cursor: pointer;
194
- display: inline-block;
195
- white-space: nowrap;
196
- text-align: center;
197
- text-transform: uppercase;
198
- color: #49afd9;
199
- line-height: 20px;
200
- max-height: 16.8px;
201
- padding: 0 14px;
202
- font-weight: 500;
203
- letter-spacing: 1px;
204
-
205
- &:hover {
206
- color: #004d8a;
207
- }
208
- }
209
- }
210
- }
211
-
212
- .diagram-main-actions-dots {
213
- position: relative;
214
- transform: translate(62px, -11px);
215
- }
216
-
217
- .horizontal-separator {
218
- margin: 5px 10px 10px;
219
- border-left: 0;
220
- border-right: 0;
221
- border-color: #ddd;
222
- box-sizing: content-box;
223
- height: 0;
224
- overflow: visible;
225
- border-top: 0px solid #eee;
226
- width: 100%;
227
- }
228
-
229
- .vertical-separator {
230
- border: 1px solid #ddd;
231
- border-left: none;
232
- margin: 0 3px 0 14px;
233
- }
234
- </style>
1
+ <template>
2
+ <div class="diagram-header">
3
+ <div class="diagram-header-left">
4
+ <atoms-the-icon
5
+ :class="[
6
+ 'diagram-header__arrow-icon',
7
+ {
8
+ open: props.isShowDiagram,
9
+ },
10
+ ]"
11
+ :data-id="`${props.testId}-toggle-icon`"
12
+ name="angle"
13
+ @click="emits('toggle-diagram')"
14
+ />
15
+ <a>
16
+ <span>
17
+ {{ localization.common.standardSwitch }}:
18
+ {{ props.diagramName }}
19
+ </span>
20
+ </a>
21
+ </div>
22
+ <div v-if="props.isShowDiagram" class="diagram-header__btn-container">
23
+ <span class="vertical-separator"></span>
24
+ <button
25
+ id="add-networking-button"
26
+ v-permission="
27
+ 'Networks.CreateSysx Networks.CreatePortGroup Networks.UpdateSwitch Networks.CreateSwitch'
28
+ "
29
+ :data-id="`${props.testId}-add-networking-button`"
30
+ type="button"
31
+ @click="onShowModal('add-networking', props.diagramName)"
32
+ >
33
+ {{ localization.common.addNetworking }}
34
+ </button>
35
+ <button
36
+ id="switch-edit-button"
37
+ v-permission="'Networks.UpdateSwitch'"
38
+ :data-id="`${props.testId}-edit-button`"
39
+ type="button"
40
+ @click="onShowModal('switch-edit')"
41
+ >
42
+ {{ localization.common.edit }}
43
+ </button>
44
+ <button
45
+ id="switch-manage-physical-adapters-button"
46
+ v-permission="'Networks.UpdateSwitch'"
47
+ :data-id="`${props.testId}-manage-physical-adapters-button`"
48
+ type="button"
49
+ @click="onShowModal('switch-manage-physical-adapters')"
50
+ >
51
+ {{ localization.common.managePhysicalAdapters }}
52
+ </button>
53
+ <div class="diagram-main-actions-dots">
54
+ <atoms-collapse-nav
55
+ :close-after-click="true"
56
+ :items="switchMainNavigation"
57
+ :test-id="`${props.testId}-actions`"
58
+ popup-class="diagram-main-actions__popup"
59
+ @change="onShowModal"
60
+ />
61
+ </div>
62
+ </div>
63
+ </div>
64
+ <hr class="horizontal-separator" />
65
+ </template>
66
+
67
+ <script setup lang="ts">
68
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
69
+ import type {
70
+ UI_I_NavigationItem,
71
+ UI_I_ModalsInitialData,
72
+ } from '~/components/common/diagramMain/lib/models/interfaces'
73
+ import type { UI_T_Project } from '~/lib/models/types'
74
+ import { switchMainNavigationFunc } from '~/components/common/diagramMain/modals/lib/config'
75
+
76
+ const props = withDefaults(
77
+ defineProps<{
78
+ isShowDiagram: boolean
79
+ diagramName: string
80
+ testId: string
81
+ project?: UI_T_Project
82
+ }>(),
83
+ {
84
+ project: undefined,
85
+ }
86
+ )
87
+
88
+ const emits = defineEmits<{
89
+ (event: 'toggle-diagram'): void
90
+ (
91
+ event: 'show-modal',
92
+ modalName: string,
93
+ properties?: UI_I_ModalsInitialData
94
+ ): void
95
+ }>()
96
+
97
+ const localization = computed<UI_I_Localization>(() => useLocal())
98
+
99
+ const switchMainNavigation = computed<UI_I_NavigationItem[]>(() =>
100
+ switchMainNavigationFunc(localization.value, props.testId)
101
+ )
102
+
103
+ const onShowModal = (modalName: string, diagramName?: string) => {
104
+ diagramName
105
+ ? emits('show-modal', modalName, { switch_name: diagramName })
106
+ : emits('show-modal', modalName)
107
+ }
108
+ </script>
109
+
110
+ <style scoped lang="scss">
111
+ :root.dark-theme {
112
+ .diagram-header {
113
+ &-left {
114
+ a {
115
+ span {
116
+ color: #79c6e6;
117
+
118
+ &:hover {
119
+ color: #49afd9;
120
+ }
121
+ }
122
+ }
123
+ }
124
+
125
+ &__btn-container {
126
+ button {
127
+ color: #89cbdf;
128
+
129
+ &:hover {
130
+ color: #57c8ea;
131
+ }
132
+ }
133
+ }
134
+ }
135
+ }
136
+
137
+ .diagram-header {
138
+ display: flex;
139
+ justify-self: flex-start;
140
+ width: 100%;
141
+ padding: 24px 16px 0;
142
+ overflow-x: auto;
143
+ overflow-y: hidden;
144
+ scrollbar-width: none;
145
+ -ms-overflow-style: none;
146
+
147
+ &::-webkit-scrollbar {
148
+ display: none;
149
+ }
150
+
151
+ a {
152
+ color: #0072a3;
153
+ cursor: pointer;
154
+ font-weight: 700;
155
+ user-select: none;
156
+ line-height: 20px;
157
+ span {
158
+ font-weight: 700;
159
+ white-space: nowrap;
160
+ }
161
+ }
162
+
163
+ &-left {
164
+ display: flex;
165
+ flex-wrap: nowrap;
166
+ color: #49afd9;
167
+ }
168
+
169
+ &__arrow-icon {
170
+ width: 16px;
171
+ min-width: 16px;
172
+ height: 16px;
173
+ min-height: 16px;
174
+ margin-right: 4px;
175
+ transform: rotate(90deg);
176
+ align-self: center;
177
+ fill: var(--triger-icon-color);
178
+ cursor: pointer;
179
+ &.open {
180
+ transform: rotate(180deg);
181
+ }
182
+ }
183
+
184
+ &__btn-container {
185
+ display: flex;
186
+
187
+ button {
188
+ font-size: 11px;
189
+ height: 24px;
190
+ border: none;
191
+ background: none;
192
+ margin-right: 0;
193
+ cursor: pointer;
194
+ display: inline-block;
195
+ white-space: nowrap;
196
+ text-align: center;
197
+ text-transform: uppercase;
198
+ color: #49afd9;
199
+ line-height: 20px;
200
+ max-height: 16.8px;
201
+ padding: 0 14px;
202
+ font-weight: 500;
203
+ letter-spacing: 1px;
204
+
205
+ &:hover {
206
+ color: #004d8a;
207
+ }
208
+ }
209
+ }
210
+ }
211
+
212
+ .diagram-main-actions-dots {
213
+ position: relative;
214
+ transform: translate(62px, -11px);
215
+ }
216
+
217
+ .horizontal-separator {
218
+ margin: 5px 10px 10px;
219
+ border-left: 0;
220
+ border-right: 0;
221
+ border-color: #ddd;
222
+ box-sizing: content-box;
223
+ height: 0;
224
+ overflow: visible;
225
+ border-top: 0px solid #eee;
226
+ width: 100%;
227
+ }
228
+
229
+ .vertical-separator {
230
+ border: 1px solid #ddd;
231
+ border-left: none;
232
+ margin: 0 3px 0 14px;
233
+ }
234
+ </style>
@@ -71,10 +71,12 @@ export const vlanIdSelectDataFunc = (
71
71
  {
72
72
  text: `${localization.common.none2} (0)`,
73
73
  value: `${localization.common.none2} (0)`,
74
+ testId: 'vlan-id-start'
74
75
  },
75
76
  {
76
77
  text: `${localization.common.all} (4095)`,
77
78
  value: `${localization.common.all} (4095)`,
79
+ testId: 'vlan-id-end'
78
80
  },
79
81
  ]
80
82
 
@@ -177,6 +177,7 @@ export interface UI_I_AddNetworkingFourthOrFifthSchemeDataSend {
177
177
  export interface UI_I_VlanIdData {
178
178
  text: string
179
179
  value: string
180
+ testId?: string
180
181
  }
181
182
 
182
183
  export interface UI_I_NetworkValidation {
@@ -18,6 +18,7 @@
18
18
  <fieldset>
19
19
  <atoms-tooltip-error
20
20
  :has-error="!!props.messagesFields.name.field"
21
+ test-id="network-label-error"
21
22
  >
22
23
  <template #elem>
23
24
  <input
@@ -72,7 +73,10 @@
72
73
  class="is-error tooltip-trigger"
73
74
  name="info"
74
75
  />
75
- <div class="tooltip-top-left tooltip-content error">
76
+ <div
77
+ class="tooltip-top-left tooltip-content error"
78
+ data-id="vlan-id-error"
79
+ >
76
80
  {{ props.messagesFields.vlan.field }}
77
81
  </div>
78
82
  </div>
@@ -53,6 +53,7 @@
53
53
  :has-error="
54
54
  !!props.messagesFields['ipv4_settings.ipv4'].field
55
55
  "
56
+ test-id="address-error"
56
57
  >
57
58
  <template #elem>
58
59
  <input
@@ -88,6 +89,7 @@
88
89
  :has-error="
89
90
  !!props.messagesFields['ipv4_settings.mask'].field
90
91
  "
92
+ test-id="mask-error"
91
93
  >
92
94
  <template #elem>
93
95
  <input
@@ -142,6 +144,7 @@
142
144
  :has-error="
143
145
  !!props.messagesFields['ipv4_settings.gateway'].field
144
146
  "
147
+ test-id="gateway-error"
145
148
  >
146
149
  <template #elem>
147
150
  <input
@@ -22,6 +22,7 @@
22
22
  <fieldset>
23
23
  <atoms-tooltip-error
24
24
  :has-error="!!props.messagesFields.network_name.field"
25
+ test-id="network-label-error"
25
26
  >
26
27
  <template #elem>
27
28
  <input
@@ -77,7 +78,7 @@
77
78
  class="is-error tooltip-trigger"
78
79
  name="info"
79
80
  />
80
- <div class="tooltip-top-left tooltip-content error">
81
+ <div class="tooltip-top-left tooltip-content error" data-id="vlan-id-error">
81
82
  {{ props.messagesFields['new_network.vlan'].field }}
82
83
  </div>
83
84
  </div>
@@ -111,6 +112,7 @@
111
112
  </div>
112
113
  <atoms-tooltip-error
113
114
  :has-error="!!props.messagesFields.mtu.field"
115
+ test-id="invalid-mtu-error"
114
116
  >
115
117
  <template #elem>
116
118
  <input
@@ -239,7 +241,9 @@ const emits = defineEmits<{
239
241
  }>()
240
242
 
241
243
  const localization = computed<UI_I_Localization>(() => useLocal())
242
- const vlanIdSelectDataLocal = computed<UI_I_Localization>(() => vlanIdSelectDataFunc(localization.value))
244
+ const vlanIdSelectDataLocal = computed<UI_I_Localization>(() =>
245
+ vlanIdSelectDataFunc(localization.value)
246
+ )
243
247
 
244
248
  const fields = computed({
245
249
  get(): UI_I_PortProperties {
@@ -34,6 +34,7 @@
34
34
  fieldsLocal.selected === '0' &&
35
35
  !!props.messagesFields.network.field
36
36
  "
37
+ test-id="existing-network-error"
37
38
  >
38
39
  <template #elem>
39
40
  <fieldset class="fieldset-block">
@@ -97,6 +98,7 @@
97
98
  fieldsLocal.selected === '1' &&
98
99
  !!props.messagesFields.switch.field
99
100
  "
101
+ test-id="existing-standard-switch-error"
100
102
  >
101
103
  <template #elem>
102
104
  <fieldset class="fieldset-block">
@@ -160,6 +162,7 @@
160
162
  fieldsLocal.selected === '2' &&
161
163
  !!props.messagesFields.switch2.field
162
164
  "
165
+ test-id="standard-switch-error"
163
166
  >
164
167
  <template #elem>
165
168
  <fieldset class="fieldset-block">
@@ -229,6 +232,7 @@
229
232
  :has-error="
230
233
  !!props.messagesFields['new_switch.mtu'].field
231
234
  "
235
+ test-id="invalid-mtu-error"
232
236
  >
233
237
  <template #elem>
234
238
  <input
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.6.41",
4
+ "version": "1.6.43",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",