bfg-common 1.6.76 → 1.6.77

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.
Files changed (167) hide show
  1. package/assets/localization/local_be.json +4213 -4474
  2. package/assets/localization/local_en.json +4217 -4479
  3. package/assets/localization/local_hy.json +4217 -4478
  4. package/assets/localization/local_kk.json +4216 -4477
  5. package/assets/localization/local_ru.json +4216 -4477
  6. package/assets/localization/local_zh.json +4214 -4475
  7. package/assets/scss/common/global.scss +0 -11
  8. package/assets/scss/common/normalize.scss +0 -3
  9. package/assets/scss/common/theme.scss +2 -2
  10. package/components/atoms/dropdown/dropdown/Dropdown.vue +170 -170
  11. package/components/atoms/dropdown/dropdown/lib/models/interfaces.ts +10 -10
  12. package/components/atoms/stack/StackBlock.vue +1 -1
  13. package/components/atoms/table/dataGrid/DataGridColumnSwitch.vue +2 -2
  14. package/components/atoms/tooltip/TooltipError.vue +0 -3
  15. package/components/common/adapterManager/AdapterManagerNew.vue +0 -86
  16. package/components/common/adapterManager/addAdapterModal/AddAdapterModalNew.vue +1 -1
  17. package/components/common/adapterManager/addAdapterWarningModal/AddAdapterWarningModalNew.vue +1 -0
  18. package/components/common/adapterManager/ui/actions/bar/Bar.vue +0 -2
  19. package/components/common/adapterManager/ui/actions/bar/BarNew.vue +2 -3
  20. package/components/common/adapterManager/ui/table/adapters/AdaptersNew.vue +0 -1
  21. package/components/common/configure/physicalAdapters/PhysicalAdapters.vue +0 -6
  22. package/components/common/configure/physicalAdapters/PhysicalAdaptersNew.vue +192 -219
  23. package/components/common/configure/physicalAdapters/PhysicalAdaptersOld.vue +4 -6
  24. package/components/common/configure/physicalAdapters/buttons/Buttons.vue +0 -1
  25. package/components/common/configure/physicalAdapters/modals/edit/Edit.vue +1 -26
  26. package/components/common/configure/physicalAdapters/modals/edit/EditNew.vue +1 -30
  27. package/components/common/configure/physicalAdapters/modals/edit/lib/models/interfaces.ts +0 -5
  28. package/components/common/configure/physicalAdapters/tableView/TableViewNew.vue +1 -12
  29. package/components/common/configure/physicalAdapters/tableView/lib/config/physicalAdaptersTableConfigNew.ts +21 -21
  30. package/components/common/configure/physicalAdapters/tableView/lib/config/settings.ts +5 -12
  31. package/components/common/configure/physicalAdapters/tableView/lib/models/interfaces.ts +1 -4
  32. package/components/common/diagramMain/Diagram.vue +85 -169
  33. package/components/common/diagramMain/DiagramMain.vue +10 -40
  34. package/components/common/diagramMain/{header/HeaderOld.vue → Header.vue} +67 -78
  35. package/components/common/diagramMain/modals/Modals.vue +0 -4
  36. package/components/common/diagramMain/modals/editSettings/{confirmTeamingSettingsModal/ConfirmTeamingSettingsModalOld.vue → ConfirmTeamingSettingsModal.vue} +5 -2
  37. package/components/common/diagramMain/modals/editSettings/EditSettings.vue +102 -104
  38. package/components/common/diagramMain/modals/editSettings/{modal/EditSettingsModalOld.vue → EditSettingsModal.vue} +51 -12
  39. package/components/common/diagramMain/modals/editSettings/lib/models/interfaces.ts +0 -6
  40. package/components/common/diagramMain/modals/editSettings/tabs/{networkProperties/NetworkPropertiesOld.vue → NetworkProperties.vue} +113 -12
  41. package/components/common/diagramMain/modals/editSettings/tabs/{security/SecurityOld.vue → Security.vue} +48 -25
  42. package/components/common/diagramMain/modals/editSettings/tabs/SwitchProperties.vue +164 -0
  43. package/components/common/diagramMain/modals/editSettings/tabs/{teamingFailover/TeamingFailoverOld.vue → TeamingFailover.vue} +48 -11
  44. package/components/common/diagramMain/modals/editSettings/tabs/{trafficShaping/TrafficShapingOld.vue → TrafficShaping.vue} +134 -12
  45. package/components/common/diagramMain/modals/editSettings/tabs/port/{ipvFourSettings/IpvFourSettingsOld.vue → IpvFourSettings.vue} +152 -11
  46. package/components/common/diagramMain/modals/editSettings/tabs/port/{portProperties/PortPropertiesOld.vue → PortProperties.vue} +103 -12
  47. package/components/common/diagramMain/modals/lib/config/diagramConfig.ts +2 -43
  48. package/components/common/diagramMain/modals/lib/config/index.ts +1 -2
  49. package/components/common/diagramMain/modals/lib/config/vmKernelAdapter.ts +1 -1
  50. package/components/common/diagramMain/modals/lib/utils/index.ts +4 -34
  51. package/components/common/diagramMain/modals/migrateVmkernelAdapter/MigrateVmkernelAdapter.vue +2 -2
  52. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/common.ts +1 -1
  53. package/components/common/layout/theHeader/ThemeSwitch.vue +1 -1
  54. package/components/common/layout/theHeader/modals/reconnect/New.vue +30 -38
  55. package/components/common/layout/theHeader/userMenu/modals/changePassword/New.vue +9 -8
  56. package/components/common/layout/theHeader/userMenu/modals/preferences/New.vue +0 -4
  57. package/components/common/layout/theHeader/userMenu/modals/preferences/Old.vue +2 -9
  58. package/components/common/layout/theHeader/userMenu/modals/preferences/changeLanguage/ChangeLanguage.vue +7 -11
  59. package/components/common/layout/theHeader/userMenu/modals/preferences/defaultConsole/DefaultConsole.vue +1 -7
  60. package/components/common/layout/theHeader/userMenu/modals/preferences/defaultConsole/lib/config/consoleOptions.ts +5 -8
  61. package/components/common/layout/theHeader/userMenu/modals/preferences/timeFormat/TimeFormat.vue +5 -9
  62. package/components/common/layout/theHeader/userMenu/modals/preferences/timeFormat/lib/config/formatOptions.ts +1 -1
  63. package/components/common/layout/theHeader/userMenu/modals/preferences/view/Old.vue +9 -5
  64. package/components/common/layout/theHeader/userMenu/modals/preferences/view/View.vue +6 -9
  65. package/components/common/mainNavigationPanel/MainNavigationPanelNew.vue +1 -3
  66. package/components/common/modals/Rename.vue +1 -3
  67. package/components/common/noDataProvided/NoDataProvidedNew.vue +1 -1
  68. package/components/common/pages/backups/modals/createBackup/datastores/tableView/new/lib/config/table.ts +4 -4
  69. package/components/common/pages/backups/modals/createBackup/datastores/tableView/old/lib/config/table.ts +4 -4
  70. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/ChartOptionsModal.vue +253 -184
  71. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/actions/ActionsNew.vue +1 -1
  72. package/components/common/pages/scheduledTasks/table/lib/models/enums.ts +0 -9
  73. package/components/common/pages/scheduledTasks/table/new/New.vue +10 -12
  74. package/components/common/pages/tasks/Tasks.vue +1 -4
  75. package/components/common/pages/tasks/table/Table.vue +23 -25
  76. package/components/common/readyToComplete/New.vue +0 -1
  77. package/components/common/split/vertical/New.vue +8 -42
  78. package/components/common/split/vertical/Old.vue +2 -31
  79. package/components/common/split/vertical/Vertical.vue +0 -4
  80. package/components/common/tools/Actions.vue +3 -7
  81. package/components/common/tools/lib/models/interfaces.ts +0 -1
  82. package/components/common/vm/actions/add/New.vue +6 -21
  83. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/Media.vue +1 -14
  84. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/New.vue +0 -5
  85. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/Old.vue +0 -1
  86. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/New.vue +0 -1
  87. package/components/common/vm/actions/common/customizeHardware/virtualHardware/reservation/New.vue +0 -2
  88. package/components/common/vm/actions/common/select/options/New.vue +12 -14
  89. package/components/common/vm/actions/common/select/options/Old.vue +15 -16
  90. package/components/common/vm/actions/common/select/storage/new/lib/config/table.ts +15 -13
  91. package/components/common/vm/actions/confirm/Confirm.vue +0 -3
  92. package/components/common/vm/actions/rename/Old.vue +0 -1
  93. package/components/common/vm/snapshots/DetailView.vue +6 -6
  94. package/components/common/wizards/datastore/add/New.vue +0 -6
  95. package/components/common/wizards/datastore/add/lib/config/steps.ts +1 -1
  96. package/components/common/wizards/datastore/add/steps/nameAndDevice/NameAndDeviceNew.vue +1 -1
  97. package/components/common/wizards/datastore/add/steps/nameAndDevice/advancedOptions/New.vue +1 -1
  98. package/components/common/wizards/network/add/Add.vue +2 -13
  99. package/components/common/wizards/network/add/AddNew.vue +26 -22
  100. package/components/common/wizards/network/add/lib/config/initialData.ts +4 -6
  101. package/components/common/wizards/network/add/lib/config/steps.ts +1 -1
  102. package/components/common/wizards/network/add/lib/models/interfaces.ts +0 -1
  103. package/components/common/wizards/network/add/lib/utils/utils.ts +1 -1
  104. package/components/common/wizards/network/add/steps/connectionSettings/ConnectionSettingsOld.vue +1 -5
  105. package/components/common/wizards/network/add/steps/ipFourSettings/IpFourSettingsNew.vue +8 -2
  106. package/components/common/wizards/network/add/steps/ipFourSettings/IpFourSettingsOld.vue +0 -3
  107. package/components/common/wizards/network/add/steps/portProperties/PortPropertiesNew.vue +8 -2
  108. package/components/common/wizards/network/add/steps/portProperties/PortPropertiesOld.vue +2 -6
  109. package/components/common/wizards/network/add/steps/selectTargetDevice/SelectTargetDeviceNew.vue +3 -10
  110. package/components/common/wizards/network/add/steps/selectTargetDevice/SelectTargetDeviceOld.vue +0 -4
  111. package/components/common/wizards/network/add/steps/selectTargetDevice/modals/new/SelectNetwork.vue +1 -5
  112. package/components/common/wizards/network/add/validations/common.ts +1 -1
  113. package/components/common/wizards/vm/migrate/New.vue +3 -13
  114. package/components/common/wizards/vm/migrate/lib/config/constructDataReady.ts +0 -5
  115. package/components/common/wizards/vm/migrate/lib/config/steps.ts +2 -3
  116. package/components/common/wizards/vm/migrate/steps/computeResource/New.vue +1 -2
  117. package/components/common/wizards/vm/migrate/steps/computeResource/tableView/new/New.vue +21 -40
  118. package/components/common/wizards/vm/migrate/steps/computeResource/tableView/new/lib/config/hostTable.ts +14 -44
  119. package/components/common/wizards/vm/migrate/steps/computeResource/tableView/new/lib/models/enums.ts +0 -4
  120. package/components/common/wizards/vm/migrate/steps/priority/New.vue +2 -7
  121. package/components/common/wizards/vm/migrate/steps/selectStorage/New.vue +7 -22
  122. package/components/common/wizards/vm/migrate/steps/selectStorage/configure/batch/New.vue +0 -6
  123. package/components/common/wizards/vm/migrate/steps/selectStorage/configure/batch/table/new/New.vue +1 -4
  124. package/components/common/wizards/vm/migrate/steps/selectStorage/configure/batch/table/new/lib/config/datastoreTable.ts +16 -12
  125. package/components/common/wizards/vm/migrate/steps/selectStorage/configure/disk/table/new/New.vue +5 -10
  126. package/components/common/wizards/vm/migrate/steps/selectStorage/configure/disk/table/new/lib/config/diskTable.ts +11 -16
  127. package/components/common/wizards/vm/migrate/steps/selectStorage/configure/disk/table/old/lib/config/diskTable.ts +1 -7
  128. package/components/common/wizards/vm/migrate/steps/selectStorage/selectedPerDisk/New.vue +10 -17
  129. package/components/common/wizards/vm/migrate/steps/type/TypeNew.vue +0 -1
  130. package/components/common/wizards/vm/migrate/vmOrigin/New.vue +15 -35
  131. package/lib/models/store/tasks/enums.ts +0 -3
  132. package/lib/models/store/tasks/types.ts +6 -7
  133. package/package.json +1 -1
  134. package/plugins/directives.ts +5 -3
  135. package/public/spice-console/application/agent.js +17 -18
  136. package/store/tasks/actions.ts +8 -26
  137. package/store/tasks/mappers/recentTasks.ts +0 -1
  138. package/components/common/configure/physicalAdapters/modals/edit/lib/validations/validations.ts +0 -19
  139. package/components/common/diagramMain/header/Header.vue +0 -49
  140. package/components/common/diagramMain/header/HeaderNew.vue +0 -155
  141. package/components/common/diagramMain/modals/UnsavedChangesModal.vue +0 -32
  142. package/components/common/diagramMain/modals/editSettings/EditSettingsNew.vue +0 -285
  143. package/components/common/diagramMain/modals/editSettings/EditSettingsOld.vue +0 -254
  144. package/components/common/diagramMain/modals/editSettings/confirmTeamingSettingsModal/ConfirmTeamingSettingsModal.vue +0 -31
  145. package/components/common/diagramMain/modals/editSettings/confirmTeamingSettingsModal/ConfirmTeamingSettingsModalNew.vue +0 -82
  146. package/components/common/diagramMain/modals/editSettings/lib/config/config.ts +0 -15
  147. package/components/common/diagramMain/modals/editSettings/lib/utils/utils.ts +0 -177
  148. package/components/common/diagramMain/modals/editSettings/modal/EditSettingsModal.vue +0 -137
  149. package/components/common/diagramMain/modals/editSettings/modal/EditSettingsModalNew.vue +0 -91
  150. package/components/common/diagramMain/modals/editSettings/tabs/networkProperties/NetworkProperties.vue +0 -158
  151. package/components/common/diagramMain/modals/editSettings/tabs/networkProperties/NetworkPropertiesNew.vue +0 -262
  152. package/components/common/diagramMain/modals/editSettings/tabs/port/ipvFourSettings/IpvFourSettings.vue +0 -192
  153. package/components/common/diagramMain/modals/editSettings/tabs/port/ipvFourSettings/IpvFourSettingsNew.vue +0 -388
  154. package/components/common/diagramMain/modals/editSettings/tabs/port/portProperties/PortProperties.vue +0 -139
  155. package/components/common/diagramMain/modals/editSettings/tabs/port/portProperties/PortPropertiesNew.vue +0 -286
  156. package/components/common/diagramMain/modals/editSettings/tabs/security/Security.vue +0 -209
  157. package/components/common/diagramMain/modals/editSettings/tabs/security/SecurityNew.vue +0 -233
  158. package/components/common/diagramMain/modals/editSettings/tabs/switchProperties/SwitchProperties.vue +0 -128
  159. package/components/common/diagramMain/modals/editSettings/tabs/switchProperties/SwitchPropertiesNew.vue +0 -235
  160. package/components/common/diagramMain/modals/editSettings/tabs/switchProperties/SwitchPropertiesOld.vue +0 -87
  161. package/components/common/diagramMain/modals/editSettings/tabs/teamingFailover/TeamingFailover.vue +0 -99
  162. package/components/common/diagramMain/modals/editSettings/tabs/teamingFailover/TeamingFailoverNew.vue +0 -319
  163. package/components/common/diagramMain/modals/editSettings/tabs/trafficShaping/TrafficShaping.vue +0 -173
  164. package/components/common/diagramMain/modals/editSettings/tabs/trafficShaping/TrafficShapingNew.vue +0 -348
  165. package/components/common/diagramMain/skeleton/Header.vue +0 -31
  166. package/components/common/diagramMain/skeleton/Switch.vue +0 -75
  167. package/components/common/wizards/vm/migrate/steps/computeResource/tableView/new/lib/config/clusterTable.ts +0 -340
@@ -2,11 +2,11 @@
2
2
  <div class="wizard-content__container">
3
3
  <div class="wizard-content">
4
4
  <atoms-alert
5
- v-if="props.isShowErrorMessage"
5
+ v-if="isShowErrorMessage"
6
6
  :items="validationMessagesArray"
7
7
  status="alert-danger"
8
8
  test-id="traffic-shaping-alert"
9
- @remove="emits('hide-error-message-alert')"
9
+ @remove="onHideErrorMessageAlert"
10
10
  />
11
11
  <form id="traffic-shaping-form" action="">
12
12
  <div class="horizontal-flex-container">
@@ -249,29 +249,151 @@
249
249
  <script setup lang="ts">
250
250
  import type { UI_I_Localization } from '~/lib/models/interfaces'
251
251
  import type {
252
+ UI_I_ModalsInitialData,
252
253
  UI_I_TrafficShapingFields,
253
254
  UI_I_EditSettingsErrorMessage,
254
255
  } from '~/components/common/diagramMain/lib/models/interfaces'
256
+ import type { UI_T_TrafficShapingFieldName } from '~/components/common/diagramMain/lib/models/types'
255
257
  import { validationMessagesArrayFunc } from '~/components/common/diagramMain/modals/lib/utils'
258
+ import { trafficShapingFieldsInitialFunc } from '~/components/common/diagramMain/modals/lib/config'
256
259
 
257
- const props = defineProps<{
258
- isShowErrorMessage: boolean
259
- errorMessages: UI_I_EditSettingsErrorMessage
260
- isSwitch: boolean
261
- }>()
260
+ // Props from up
261
+ const props = withDefaults(
262
+ defineProps<{
263
+ isShowErrorMessageAlert: boolean
264
+ errorMessages: UI_I_EditSettingsErrorMessage
265
+ isSwitch: boolean
266
+ initialData?: UI_I_ModalsInitialData
267
+ hasErrorMessages?: boolean
268
+ }>(),
269
+ {
270
+ initialData: () => ({}),
271
+ isSwitch: false,
272
+ hasErrorMessages: undefined,
273
+ }
274
+ )
262
275
 
276
+ // Validation
263
277
  const emits = defineEmits<{
278
+ (
279
+ event: 'change-error-messages',
280
+ errorMessage: string,
281
+ fieldName: keyof UI_I_EditSettingsErrorMessage
282
+ ): void
264
283
  (event: 'hide-error-message-alert'): void
284
+ (
285
+ event: 'change-edit-traffic-shaping-data',
286
+ trafficShapingData: UI_I_TrafficShapingFields
287
+ ): void
265
288
  }>()
266
289
 
267
- const localization = computed<UI_I_Localization>(() => useLocal())
268
-
269
- const fieldsValues = defineModel<UI_I_TrafficShapingFields>()
270
-
271
- const validationMessagesArray = computed<string[]>(() =>
290
+ const validationMessagesArray = computed(() =>
272
291
  validationMessagesArrayFunc(
273
292
  ['average', 'peak', 'burstSize'],
274
293
  props.errorMessages
275
294
  )
276
295
  )
296
+
297
+ // UI_I_Localization
298
+ const localization = computed<UI_I_Localization>(() => useLocal())
299
+
300
+ // For showing component validation errors on the top of modal
301
+ const isShowErrorMessage = computed<boolean>(
302
+ () => props.isShowErrorMessageAlert && props.hasErrorMessages
303
+ )
304
+
305
+ const fieldsValues = ref<UI_I_TrafficShapingFields>(
306
+ trafficShapingFieldsInitialFunc(props.isSwitch, props.initialData)
307
+ )
308
+
309
+ const onHideErrorMessageAlert = (): void => emits('hide-error-message-alert')
310
+
311
+ const onChangeData = (data: UI_I_TrafficShapingFields) =>
312
+ emits('change-edit-traffic-shaping-data', data)
313
+
314
+ const messageTexts = (local: UI_I_Localization) => ({
315
+ average: local.common.averageInvalidError,
316
+ peak: local.common.peakInvalidError,
317
+ burstSize: local.common.burstSizeInvalidError,
318
+ averageBig: local.common.averageBigInvalidError,
319
+ peakBig: local.common.peakBigInvalidError,
320
+ burstSizeBig: local.common.burstSizeBigInvalidError,
321
+ })
322
+
323
+ const changeErrorMessage = (
324
+ errorMessage: string,
325
+ fieldName: keyof UI_I_EditSettingsErrorMessage
326
+ ) => emits('change-error-messages', errorMessage, fieldName)
327
+
328
+ const MAX_BANDWIDTH = 9_007_199_254_740_991
329
+ const setMessageOnChangedField = (
330
+ values: number[],
331
+ index: number,
332
+ name: UI_T_TrafficShapingFieldName,
333
+ text1: string,
334
+ text2: string
335
+ ): void => {
336
+ if (
337
+ !fieldsValues.value.status.checked ||
338
+ fieldsValues.value.status.selected === 0
339
+ ) {
340
+ changeErrorMessage('', 'average')
341
+ changeErrorMessage('', 'peak')
342
+ changeErrorMessage('', 'burstSize')
343
+ return
344
+ }
345
+
346
+ if (values[index] >= 1 && values[index] <= MAX_BANDWIDTH) {
347
+ changeErrorMessage('', name)
348
+ } else if (values[index] < 1) {
349
+ changeErrorMessage(text1, name)
350
+ } else if (values[index] > MAX_BANDWIDTH) {
351
+ changeErrorMessage(text2, name)
352
+ }
353
+ }
354
+
355
+ watch(
356
+ fieldsValues,
357
+ (newFieldsValues: UI_I_TrafficShapingFields): void => {
358
+ const { average, peak, burstSize } = newFieldsValues
359
+ const arrayValues = [average, peak, burstSize]
360
+
361
+ setMessageOnChangedField(
362
+ arrayValues,
363
+ 0,
364
+ 'average',
365
+ messageTexts(localization.value).average,
366
+ messageTexts(localization.value).averageBig
367
+ )
368
+ setMessageOnChangedField(
369
+ arrayValues,
370
+ 1,
371
+ 'peak',
372
+ messageTexts(localization.value).peak,
373
+ messageTexts(localization.value).peakBig
374
+ )
375
+ setMessageOnChangedField(
376
+ arrayValues,
377
+ 2,
378
+ 'burstSize',
379
+ messageTexts(localization.value).burstSize,
380
+ messageTexts(localization.value).burstSizeBig
381
+ )
382
+
383
+ onChangeData(newFieldsValues)
384
+ !props.hasErrorMessages && onHideErrorMessageAlert()
385
+ },
386
+ {
387
+ deep: true,
388
+ }
389
+ )
390
+
391
+ onMounted(() => {
392
+ onChangeData(fieldsValues.value)
393
+ })
394
+ onUnmounted((): void => {
395
+ onHideErrorMessageAlert()
396
+ })
277
397
  </script>
398
+
399
+ <style scoped lang="scss"></style>
@@ -2,11 +2,11 @@
2
2
  <div class="wizard-content__container">
3
3
  <div class="wizard-content wizard-content-port">
4
4
  <atoms-alert
5
- v-if="props.isShowErrorMessage"
5
+ v-if="isShowErrorMessage"
6
6
  :items="validationMessagesArray"
7
7
  status="alert-danger"
8
8
  test-id="ipv-four-settings-alert"
9
- @remove="emits('hide-error-message-alert')"
9
+ @remove="onHideErrorMessageAlert"
10
10
  />
11
11
  <form>
12
12
  <div class="radio">
@@ -185,26 +185,167 @@ import type { UI_I_Localization } from '~/lib/models/interfaces'
185
185
  import type {
186
186
  UI_I_EditSettingsErrorMessage,
187
187
  UI_I_IpvFourSettingsFields,
188
+ UI_I_ModalsInitialData,
188
189
  } from '~/components/common/diagramMain/lib/models/interfaces'
190
+ import type { UI_T_IpFourSettingsFieldName } from '~/components/common/wizards/network/add/lib/models/types'
189
191
  import { validationMessagesArrayFunc } from '~/components/common/diagramMain/modals/lib/utils'
190
192
 
191
- const props = defineProps<{
192
- isShowErrorMessage: boolean
193
- errorMessages: UI_I_EditSettingsErrorMessage
194
- }>()
193
+ const props = withDefaults(
194
+ defineProps<{
195
+ isShowErrorMessageAlert: boolean
196
+ errorMessages: UI_I_EditSettingsErrorMessage
197
+ initialData?: UI_I_ModalsInitialData
198
+ hasErrorMessages?: boolean
199
+ }>(),
200
+ {
201
+ initialData: () => ({}),
202
+ hasErrorMessages: undefined,
203
+ }
204
+ )
195
205
 
206
+ // Validation
196
207
  const emits = defineEmits<{
208
+ (
209
+ event: 'change-error-messages',
210
+ errorMessage: string,
211
+ fieldName: keyof UI_I_EditSettingsErrorMessage
212
+ ): void
197
213
  (event: 'hide-error-message-alert'): void
214
+ (
215
+ event: 'change-port-ipv-four-data',
216
+ newPortEditIpvFourData: UI_I_IpvFourSettingsFields
217
+ ): void
198
218
  }>()
199
219
 
200
- const localization = computed<UI_I_Localization>(() => useLocal())
201
-
202
- const fieldsValues = defineModel<UI_I_IpvFourSettingsFields>()
203
-
204
- const validationMessagesArray = computed<string[]>(() =>
220
+ const validationMessagesArray = computed(() =>
205
221
  validationMessagesArrayFunc(
206
222
  ['ipFourAddress', 'subnetMask', 'defaultGateway'],
207
223
  props.errorMessages
208
224
  )
209
225
  )
226
+
227
+ // UI_I_Localization
228
+ const localization = computed<UI_I_Localization>(() => useLocal())
229
+
230
+ // For showing component validation errors on the top of modal
231
+ const isShowErrorMessage = computed<boolean>(
232
+ () => props.isShowErrorMessageAlert && props.hasErrorMessages
233
+ )
234
+
235
+ const fieldsValues = ref<UI_I_IpvFourSettingsFields>(
236
+ useDeepCopy(props.initialData.tcpConfig)
237
+ )
238
+
239
+ const onHideErrorMessageAlert = (): void => emits('hide-error-message-alert')
240
+
241
+ const onChangeData = (data: UI_I_IpvFourSettingsFields) =>
242
+ emits('change-port-ipv-four-data', data)
243
+
244
+ const changeErrorMessage = (
245
+ errorMessage: string,
246
+ fieldName: keyof UI_I_EditSettingsErrorMessage
247
+ ) => emits('change-error-messages', errorMessage, fieldName)
248
+
249
+ const checkIfValidIP = (str: string) => {
250
+ const regexExp =
251
+ /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/gi
252
+
253
+ return regexExp.test(str)
254
+ }
255
+
256
+ const messageTexts = (local: UI_I_Localization) => ({
257
+ ipFourAddressEmpty: local.common.ipFourAddressEmpty,
258
+ subnetMaskEmpty: local.common.subnetMaskEmpty,
259
+ defaultGatewayEmpty: local.common.defaultGatewayEmpty,
260
+ ipFourAddressInvalid: local.common.ipFourAddressInvalid,
261
+ subnetMaskInvalid: local.common.subnetMaskInvalid,
262
+ defaultGatewayInvalid: local.common.defaultGatewayInvalid,
263
+ })
264
+
265
+ const setMessageOnChangedField = (
266
+ values: string,
267
+ name: UI_T_IpFourSettingsFieldName,
268
+ ipSettings: string,
269
+ override?: boolean
270
+ ) => {
271
+ if (ipSettings === '0') {
272
+ changeErrorMessage('', name)
273
+ return
274
+ }
275
+
276
+ if (name === 'ipFourAddress') {
277
+ if (!values) {
278
+ changeErrorMessage(messageTexts(localization.value)[`${name}Empty`], name)
279
+ return
280
+ }
281
+ if (!checkIfValidIP(values)) {
282
+ changeErrorMessage(
283
+ messageTexts(localization.value)[`${name}Invalid`],
284
+ name
285
+ )
286
+ return
287
+ }
288
+ }
289
+ if (name === 'subnetMask') {
290
+ if (!values) {
291
+ changeErrorMessage(messageTexts(localization.value)[`${name}Empty`], name)
292
+ return
293
+ }
294
+ if (!checkIfValidIP(values)) {
295
+ changeErrorMessage(
296
+ messageTexts(localization.value)[`${name}Invalid`],
297
+ name
298
+ )
299
+ return
300
+ }
301
+ }
302
+ if (name === 'defaultGateway' && override) {
303
+ if (!values) {
304
+ changeErrorMessage(messageTexts(localization.value)[`${name}Empty`], name)
305
+ return
306
+ }
307
+ if (!checkIfValidIP(values)) {
308
+ changeErrorMessage(
309
+ messageTexts(localization.value)[`${name}Invalid`],
310
+ name
311
+ )
312
+ return
313
+ }
314
+ }
315
+ changeErrorMessage('', name)
316
+ }
317
+
318
+ // Changing data and validate they
319
+ watch(
320
+ fieldsValues,
321
+ (newValues: UI_I_IpvFourSettingsFields) => {
322
+ setMessageOnChangedField(
323
+ newValues.ipv4Address,
324
+ 'ipFourAddress',
325
+ newValues.ipv4Settings
326
+ )
327
+ setMessageOnChangedField(
328
+ newValues.subnetMask,
329
+ 'subnetMask',
330
+ newValues.ipv4Settings
331
+ )
332
+ setMessageOnChangedField(
333
+ newValues.defaultGateway.value,
334
+ 'defaultGateway',
335
+ newValues.ipv4Settings,
336
+ newValues.defaultGateway.checked
337
+ )
338
+ onChangeData(newValues)
339
+ !props.hasErrorMessages && onHideErrorMessageAlert()
340
+ },
341
+ { deep: true }
342
+ )
343
+
344
+ onMounted(() => {
345
+ onChangeData(fieldsValues.value)
346
+ })
347
+
348
+ onUnmounted(() => {
349
+ onHideErrorMessageAlert()
350
+ })
210
351
  </script>
@@ -2,11 +2,11 @@
2
2
  <div class="wizard-content__container">
3
3
  <div class="wizard-content wizard-content-port">
4
4
  <atoms-alert
5
- v-if="props.isShowErrorMessage"
5
+ v-if="isShowErrorMessage"
6
6
  :items="validationMessagesArray"
7
7
  status="alert-danger"
8
8
  test-id="port-properties-alert"
9
- @remove="emits('hide-error-message-alert')"
9
+ @remove="onHideErrorMessageAlert"
10
10
  />
11
11
  <form id="port-properties-form">
12
12
  <b class="property-label-group">
@@ -58,7 +58,7 @@
58
58
  {{ localization.common.availableServices }}
59
59
  </b>
60
60
  <template
61
- v-for="(enabledService, key) in props.portPropertiesEnabledServices"
61
+ v-for="(enabledService, key) in portPropertiesEnabledServices"
62
62
  :key="enabledService.modelValue"
63
63
  >
64
64
  <div class="horizontal-flex-container">
@@ -90,26 +90,117 @@
90
90
  import type { UI_I_Localization } from '~/lib/models/interfaces'
91
91
  import type {
92
92
  UI_I_PortPropertiesFields,
93
+ UI_I_ModalsInitialData,
93
94
  UI_I_EditSettingsErrorMessage,
94
95
  } from '~/components/common/diagramMain/lib/models/interfaces'
96
+ import type { UI_T_PortPropertiesFieldName } from '~/components/common/diagramMain/lib/models/types'
97
+ import { portPropertiesEnabledServicesFunc } from '~/components/common/diagramMain/modals/lib/config'
95
98
  import { validationMessagesArrayFunc } from '~/components/common/diagramMain/modals/lib/utils'
96
99
 
97
- const props = defineProps<{
98
- isShowErrorMessage: boolean
99
- errorMessages: UI_I_EditSettingsErrorMessage
100
- validationMessagesArray: string[]
101
- portPropertiesEnabledServices: any
102
- }>()
100
+ // Props from up
101
+ const props = withDefaults(
102
+ defineProps<{
103
+ isShowErrorMessageAlert: boolean
104
+ errorMessages: UI_I_EditSettingsErrorMessage
105
+ initialData?: UI_I_ModalsInitialData
106
+ hasErrorMessages?: boolean
107
+ }>(),
108
+ {
109
+ initialData: () => ({}),
110
+ hasErrorMessages: undefined,
111
+ }
112
+ )
103
113
 
114
+ // Validation
104
115
  const emits = defineEmits<{
116
+ (
117
+ event: 'change-error-messages',
118
+ errorMessage: string,
119
+ fieldName: keyof UI_I_EditSettingsErrorMessage
120
+ ): void
105
121
  (event: 'hide-error-message-alert'): void
122
+ (
123
+ event: 'change-port-edit-properties-data',
124
+ newPortEditPropertiesData: UI_I_PortPropertiesFields
125
+ ): void
106
126
  }>()
107
127
 
128
+ const validationMessagesArray = computed(() =>
129
+ validationMessagesArrayFunc(['mtu'], props.errorMessages)
130
+ )
131
+
132
+ // UI_I_Localization
108
133
  const localization = computed<UI_I_Localization>(() => useLocal())
109
134
 
110
- const fieldsValues = defineModel<UI_I_PortPropertiesFields>()
135
+ // Enabled services data with localization
136
+ const portPropertiesEnabledServices = computed(() =>
137
+ portPropertiesEnabledServicesFunc(localization.value)
138
+ )
111
139
 
112
- const validationMessagesArray = computed(() =>
113
- validationMessagesArrayFunc(['mtu'], props.errorMessages)
140
+ // For showing component validation errors on the top of modal
141
+ const isShowErrorMessage = computed<boolean>(
142
+ () => props.isShowErrorMessageAlert && props.hasErrorMessages
114
143
  )
144
+
145
+ const fieldsValues = ref<UI_I_PortPropertiesFields>(
146
+ useDeepCopy({
147
+ tcpIp: props.initialData.tcpIp,
148
+ mtu: props.initialData.mtu,
149
+ services: props.initialData.services,
150
+ }) as UI_I_PortPropertiesFields
151
+ )
152
+
153
+ const onHideErrorMessageAlert = (): void => emits('hide-error-message-alert')
154
+
155
+ const onChangeData = (data: UI_I_PortPropertiesFields): void =>
156
+ emits('change-port-edit-properties-data', data)
157
+
158
+ const changeErrorMessage = (
159
+ errorMessage: string,
160
+ fieldName: keyof UI_I_EditSettingsErrorMessage
161
+ ) => emits('change-error-messages', errorMessage, fieldName)
162
+
163
+ const messageTexts = (local: UI_I_Localization) => ({
164
+ mtu: local.common.mtuInvalidError,
165
+ })
166
+
167
+ const setMessageOnChangedField = (
168
+ values: number[],
169
+ index: number,
170
+ name: UI_T_PortPropertiesFieldName,
171
+ text: string
172
+ ) => {
173
+ if (values[index] >= 1280 && values[index] <= 65535) {
174
+ changeErrorMessage('', name)
175
+ } else {
176
+ changeErrorMessage(text, name)
177
+ }
178
+ }
179
+
180
+ watch(
181
+ fieldsValues,
182
+ (newValues: UI_I_PortPropertiesFields): void => {
183
+ setMessageOnChangedField(
184
+ [newValues.mtu],
185
+ 0,
186
+ 'mtu',
187
+ messageTexts(localization.value).mtu
188
+ )
189
+ onChangeData(newValues)
190
+ !props.hasErrorMessages && onHideErrorMessageAlert()
191
+ },
192
+ {
193
+ deep: true,
194
+ }
195
+ )
196
+
197
+ onMounted(() => {
198
+ onChangeData(fieldsValues.value)
199
+ })
200
+
201
+ onUnmounted((): void => {
202
+ onHideErrorMessageAlert()
203
+ })
115
204
  </script>
205
+
206
+ <style scoped lang="scss"></style>
@@ -1,4 +1,3 @@
1
- import type { UI_I_Button } from '~/node_modules/bfg-common/components/common/tools/lib/models/interfaces'
2
1
  import type { UI_I_Localization } from '~/lib/models/interfaces'
3
2
  import type { UI_I_NavigationItem } from '~/components/common/diagramMain/lib/models/interfaces'
4
3
 
@@ -10,7 +9,7 @@ export const switchMainNavigationFunc = (
10
9
  text: localization.common.migrateVmKernelAdapter,
11
10
  value: 'migrate-vmkernel-adapter',
12
11
  testId: `${testId}-migrate-vm-kernel-adapter`,
13
- development: true,
12
+ development: true
14
13
  },
15
14
  {
16
15
  text: localization.common.viewSettings,
@@ -21,46 +20,6 @@ export const switchMainNavigationFunc = (
21
20
  text: localization.common.remove,
22
21
  value: 'switch-remove',
23
22
  testId: `${testId}-remove`,
24
- permission: 'Networks.RemoveSwitch',
25
- },
26
- ]
27
-
28
- export const switchMainNavigationNewFunc = (
29
- localization: UI_I_Localization,
30
- testId: string
31
- ): UI_I_Button[] => [
32
- {
33
- text: localization.common.addNetworking,
34
- value: 'add-networking',
35
- iconName: 'network',
36
- testId: `${testId}-add-networking-button`,
37
- permission:
38
- 'Networks.CreateSysx Networks.CreatePortGroup Networks.UpdateSwitch Networks.CreateSwitch',
39
- },
40
- {
41
- text: localization.common.edit,
42
- value: 'switch-edit',
43
- iconName: 'edit',
44
- testId: `${testId}-edit-button`,
45
- permission: 'Networks.UpdateSwitch',
46
- },
47
- {
48
- text: localization.common.managePhysicalAdapters,
49
- value: 'switch-manage-physical-adapters',
50
- iconName: 'settings',
51
- testId: `${testId}-manage-physical-adapters-button`,
52
- permission: 'Networks.UpdateSwitch',
53
- },
54
- // {
55
- // text: localization.common.migrateVmKernelAdapter,
56
- // value: 'migrate-vmkernel-adapter',
57
- // testId: `${testId}-migrate-vm-kernel-adapter`,
58
- // development: true,
59
- // },
60
- {
61
- text: localization.common.viewSettings,
62
- value: 'switch-view-settings',
63
- iconName: 'password-hide',
64
- testId: `${testId}-view-settings`,
23
+ permission: 'Networks.RemoveSwitch'
65
24
  },
66
25
  ]
@@ -52,5 +52,4 @@ export const {
52
52
  vmKernelAdapterViewSettingsFunc,
53
53
  } = vmKernelAdapterData
54
54
  // export const { managePhysicalAdapterTableData } = temporaryData
55
- export const { switchMainNavigationFunc, switchMainNavigationNewFunc } =
56
- diagramConfig
55
+ export const { switchMainNavigationFunc } = diagramConfig
@@ -18,7 +18,7 @@ export const vmKernelAdapterViewSettingsFunc = (
18
18
  type: 0,
19
19
  rows: [
20
20
  { name: localization.common.networkLabel, value: '' },
21
- { name: localization.common.vlanId, value: `${localization.common.none2} (0)` },
21
+ { name: localization.common.vlanId, value: `${localization.common.none} (0)` },
22
22
  { name: localization.common.tcpIpStack, value: 'Default' },
23
23
  { name: localization.common.enabledServices },
24
24
  ],
@@ -2,42 +2,12 @@ import type { UI_I_Localization } from '~/lib/models/interfaces'
2
2
  import type { UI_I_EditSettingsErrorMessage } from '~/components/common/diagramMain/lib/models/interfaces'
3
3
 
4
4
  export const validationMessagesArrayFunc = (
5
- keyArray: (keyof UI_I_EditSettingsErrorMessage)[],
5
+ arr: (keyof UI_I_EditSettingsErrorMessage)[],
6
6
  errorMessages: UI_I_EditSettingsErrorMessage
7
7
  ) =>
8
- keyArray
9
- .map(
10
- (key: keyof UI_I_EditSettingsErrorMessage): string | undefined =>
11
- errorMessages[key]
12
- )
13
- .filter((message: string | undefined): boolean => message !== '')
14
-
15
- export const validationMessagesArrayNewFunc = (
16
- keyArray: (keyof UI_I_EditSettingsErrorMessage)[],
17
- errorMessages: UI_I_EditSettingsErrorMessage
18
- ) =>
19
- keyArray
20
- .map(
21
- (
22
- key: keyof UI_I_EditSettingsErrorMessage
23
- ):
24
- | {
25
- key: keyof UI_I_EditSettingsErrorMessage
26
- message: string | undefined
27
- }
28
- | undefined =>
29
- errorMessages[key] ? { key, message: errorMessages[key] } : undefined
30
- )
31
- .filter(
32
- (
33
- messageObject:
34
- | {
35
- key: keyof UI_I_EditSettingsErrorMessage
36
- message: string | undefined
37
- }
38
- | undefined
39
- ): boolean => !!messageObject
40
- )
8
+ arr
9
+ .map((ar: keyof UI_I_EditSettingsErrorMessage) => errorMessages[ar])
10
+ .filter((err) => err !== '')
41
11
 
42
12
  export const getNicSpeed = (
43
13
  speedInitial: number = 0,
@@ -112,7 +112,7 @@ const title = computed<string>(
112
112
 
113
113
  const connectionSettings = ref<UI_I_ConnectionSettings>({
114
114
  networkLabel: 'VM Network',
115
- vlanId: `${localization.value.common.none2} (0)`,
115
+ vlanId: `${localization.value.common.none} (0)`,
116
116
  })
117
117
 
118
118
  const vmkernelAdapter = ref<UI_I_SelectVmkernelAdapter>({
@@ -262,7 +262,7 @@ const reset = (): void => {
262
262
  wizard.reset()
263
263
  connectionSettings.value = {
264
264
  networkLabel: 'VM Network',
265
- vlanId: `${localization.value.common.none2} (0)`,
265
+ vlanId: `${localization.value.common.none} (0)`,
266
266
  }
267
267
  vmkernelAdapter.value = {
268
268
  vm: '',
@@ -14,6 +14,6 @@ export const checkVlanId = (
14
14
  vlanId: string,
15
15
  localization: UI_I_Localization
16
16
  ): boolean =>
17
- vlanId !== `${localization.common.none2} (0)` &&
17
+ vlanId !== `${localization.common.none} (0)` &&
18
18
  vlanId !== `${localization.common.all} (4095)` &&
19
19
  (isIntegerNumberInRange(vlanId, 0, 4095) || vlanId === '')
@@ -2,7 +2,7 @@
2
2
  <ui-tooltip
3
3
  id="tooltip-theme-mode-toggle-button"
4
4
  test-id="tooltip-theme-mode-toggle-button"
5
- size="md"
5
+ size="sm"
6
6
  position="bottom"
7
7
  position-by-tooltip="center"
8
8
  >