bfg-common 1.5.708 → 1.5.710

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 (105) hide show
  1. package/assets/img/icons/icons-sprite-dark-1.svg +2 -3
  2. package/assets/img/icons/icons-sprite-light-1.svg +3 -4
  3. package/assets/localization/local_be.json +47 -3
  4. package/assets/localization/local_en.json +47 -3
  5. package/assets/localization/local_hy.json +47 -3
  6. package/assets/localization/local_kk.json +47 -3
  7. package/assets/localization/local_ru.json +49 -5
  8. package/assets/localization/local_zh.json +47 -3
  9. package/assets/scss/common/icons/icons-1.scss +1 -1
  10. package/assets/scss/common/icons/icons-2.scss +18 -0
  11. package/assets/scss/common/theme.scss +2 -0
  12. package/assets/scss/components/auth.scss +32 -5
  13. package/components/atoms/dropdown/tree/Tree.vue +2 -0
  14. package/components/atoms/switch/Switch.vue +7 -1
  15. package/components/atoms/wizard/Wizard.vue +1 -1
  16. package/components/common/certificate/Certificate.vue +27 -0
  17. package/components/common/certificate/CertificateInfo.vue +139 -0
  18. package/components/common/certificate/Tools.vue +59 -0
  19. package/components/common/certificate/lib/config/tabsPannel.ts +22 -0
  20. package/components/common/certificate/lib/models/interfaces.ts +9 -0
  21. package/components/common/certificate/lib/models/types.ts +1 -0
  22. package/components/common/certificate/modals/renew/New.vue +64 -0
  23. package/components/common/certificate/modals/renew/Old.vue +122 -0
  24. package/components/common/certificate/modals/renew/Renew.vue +67 -0
  25. package/components/common/help/navbar/left/lib/utils/constructAccordion.ts +2 -1
  26. package/components/common/help/navbar/right/Right.vue +86 -23
  27. package/components/common/layout/theHeader/modals/reconnect/ReconnectOld.vue +2 -0
  28. package/components/common/layout/theHeader/userMenu/modals/changePassword/ChangePassword.vue +12 -21
  29. package/components/common/layout/theHeader/userMenu/modals/changePassword/New.vue +36 -43
  30. package/components/common/layout/theHeader/userMenu/modals/changePassword/Old.vue +0 -2
  31. package/components/common/layout/theHeader/userMenu/modals/changePassword/lib/utils.ts +1 -1
  32. package/components/common/layout/theHeader/userMenu/modals/preferences/PreferencesNew.vue +13 -0
  33. package/components/common/layout/theHeader/userMenu/modals/preferences/changeLanguage/ChangeLanguage.vue +8 -15
  34. package/components/common/layout/theHeader/userMenu/modals/preferences/changeLanguage/{ChangeLanguageNew.vue → New.vue} +1 -2
  35. package/components/common/layout/theHeader/userMenu/modals/preferences/changeLanguage/{ChangeLanguageOld.vue → Old.vue} +0 -2
  36. package/components/common/layout/theHeader/userMenu/modals/preferences/defaultConsole/DefaultConsole.vue +8 -7
  37. package/components/common/layout/theHeader/userMenu/modals/preferences/defaultConsole/{DefaultConsoleNew.vue → New.vue} +3 -3
  38. package/components/common/layout/theHeader/userMenu/modals/preferences/defaultConsole/{DefaultConsoleOld.vue → Old.vue} +2 -2
  39. package/components/common/layout/theHeader/userMenu/modals/preferences/inventory/Inventory.vue +7 -8
  40. package/components/common/layout/theHeader/userMenu/modals/preferences/inventory/{InventoryNew.vue → New.vue} +3 -2
  41. package/components/common/layout/theHeader/userMenu/modals/preferences/inventory/{InventoryOld.vue → Old.vue} +2 -2
  42. package/components/common/layout/theHeader/userMenu/modals/preferences/security/New.vue +277 -12
  43. package/components/common/layout/theHeader/userMenu/modals/preferences/security/Old.vue +30 -56
  44. package/components/common/layout/theHeader/userMenu/modals/preferences/security/Security.vue +65 -6
  45. package/components/common/layout/theHeader/userMenu/modals/preferences/timeFormat/{TimeFormatNew.vue → New.vue} +3 -3
  46. package/components/common/layout/theHeader/userMenu/modals/preferences/timeFormat/{TimeFormatOld.vue → Old.vue} +2 -2
  47. package/components/common/layout/theHeader/userMenu/modals/preferences/timeFormat/TimeFormat.vue +8 -8
  48. package/components/common/layout/theHeader/userMenu/modals/preferences/view/{ViewNew.vue → New.vue} +12 -3
  49. package/components/common/layout/theHeader/userMenu/modals/preferences/view/{ViewOld.vue → Old.vue} +2 -2
  50. package/components/common/layout/theHeader/userMenu/modals/preferences/view/View.vue +8 -7
  51. package/components/common/monitor/advanced/graphView/GraphView.vue +8 -0
  52. package/components/common/monitor/advanced/tools/Tools.vue +5 -1
  53. package/components/common/pages/auth/TheFooter.vue +104 -0
  54. package/components/common/pages/files/lib/models/enums.ts +10 -0
  55. package/components/common/pages/hardwareHealth/historyTestimony/tools/Tools.vue +7 -2
  56. package/components/common/pages/hardwareHealth/tableView/TableView.vue +8 -0
  57. package/components/common/pages/hardwareHealth/tableView/lib/config/sensorTable.ts +13 -1
  58. package/components/common/pages/hardwareHealth/toolsPanel/lib/config/actionsPanel.ts +4 -4
  59. package/components/common/pages/tasks/table/expandDetails/ExpandDetails.vue +1 -1
  60. package/components/common/qr/Qr.vue +69 -0
  61. package/components/common/split/horizontal/New.vue +0 -2
  62. package/components/common/split/vertical/New.vue +2 -1
  63. package/components/common/vm/actions/add/New.vue +1 -1
  64. package/components/common/vm/actions/add/Old.vue +1 -1
  65. package/components/common/vm/actions/clone/old/Old.vue +1 -0
  66. package/components/common/vm/actions/common/customizeHardware/virtualHardware/New.vue +10 -34
  67. package/components/common/vm/actions/common/customizeHardware/virtualHardware/Old.vue +15 -37
  68. package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardware.vue +49 -50
  69. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/coresPerSocket/CoresPerSocket.vue +1 -1
  70. package/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces.ts +3 -1
  71. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +13 -7
  72. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/New.vue +7 -4
  73. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/NewPciDevice.vue +52 -45
  74. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/Old.vue +5 -8
  75. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/directPathIo/DirectPathIo.vue +1 -3
  76. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/directPathIo/New.vue +2 -2
  77. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/directPathIo/Old.vue +2 -2
  78. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/dynamicDirectPathIo/DynamicDirectPathIo.vue +1 -1
  79. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/dynamicDirectPathIo/New.vue +1 -2
  80. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/dynamicDirectPathIo/Old.vue +1 -2
  81. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/nvidiaGrid/New.vue +1 -1
  82. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/nvidiaGrid/NvidiaGrid.vue +1 -1
  83. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/nvidiaGrid/Old.vue +1 -1
  84. package/components/common/vm/actions/common/select/options/Old.vue +1 -2
  85. package/components/common/wizards/common/compatibility/New.vue +1 -1
  86. package/components/common/wizards/common/compatibility/Old.vue +1 -1
  87. package/components/common/wizards/datastore/add/lib/config/createDatastore.ts +1 -0
  88. package/components/common/wizards/datastore/add/lib/models/interfaces.ts +1 -0
  89. package/components/common/wizards/datastore/add/steps/nameAndDevice/NameAndDeviceNew.vue +5 -0
  90. package/components/common/wizards/datastore/add/steps/nameAndDevice/NameAndDeviceOld.vue +5 -0
  91. package/components/common/wizards/datastore/add/steps/nameAndDevice/advancedOptions/AdvancedOptions.vue +43 -0
  92. package/components/common/wizards/datastore/add/steps/nameAndDevice/advancedOptions/New.vue +114 -0
  93. package/components/common/wizards/datastore/add/steps/nameAndDevice/advancedOptions/Old.vue +114 -0
  94. package/components/common/wizards/datastore/add/steps/nameAndDevice/table/old/Old.vue +2 -3
  95. package/components/common/wizards/datastore/add/steps/readyComplete/lib/config/propertiesDetails.ts +8 -1
  96. package/components/common/wizards/vm/migrate/lib/models/enums.ts +2 -2
  97. package/components/common/wizards/vm/migrate/steps/selectStorage/SelectStorage.vue +4 -4
  98. package/components/common/wizards/vm/migrate/steps/selectStorage/configure/disk/table/new/lib/config/diskTable.ts +6 -2
  99. package/components/common/wizards/vm/migrate/steps/selectStorage/configure/disk/table/old/lib/config/diskTable.ts +18 -12
  100. package/composables/useEnvLanguage.ts +7 -8
  101. package/lib/models/interfaces.ts +1 -0
  102. package/package.json +3 -4
  103. package/plugins/date.ts +14 -37
  104. package/store/main/getters.ts +2 -2
  105. package/components/common/qrcode/Qrcode.vue +0 -56
@@ -0,0 +1,122 @@
1
+ <template>
2
+ <atoms-modal
3
+ :title="title"
4
+ :second-title="props.hostName"
5
+ :test-id="props.testId"
6
+ class="certificate-modal"
7
+ show
8
+ @hide="onHide"
9
+ >
10
+ <template #modalBody>
11
+ <form
12
+ id="certificate-renew-form"
13
+ data-id="certificate-renew-form"
14
+ class="pt-0"
15
+ @submit.prevent="onHide"
16
+ >
17
+ <section class="form-block flex-align-center m-0 flex">
18
+ <div class="icon-wrap">
19
+ <atoms-the-icon class="icon-warning" name="warning" />
20
+ </div>
21
+ <p>{{ description }}</p>
22
+ </section>
23
+ </form>
24
+ </template>
25
+ <template #modalFooter>
26
+ <button
27
+ id="certificate-renew-modal-close-button"
28
+ data-id="certificate-renew-modal-close-button"
29
+ class="btn btn-primary"
30
+ @click="onHide"
31
+ >
32
+ {{ localization.common.no }}
33
+ </button>
34
+ <button
35
+ id="certificate-renew-modal-apply-button"
36
+ :class="['btn btn-outline', props.loading && 'pending']"
37
+ data-id="certificate-renew-modal-apply-button"
38
+ @click="emits('submit')"
39
+ >
40
+ <atoms-loader-pre-loader
41
+ v-if="props.loading"
42
+ id="loader"
43
+ :show="props.loading"
44
+ class="absolute-center btn__loading flex"
45
+ test-id="certificate-renew-spinner"
46
+ />
47
+ <span v-else>
48
+ {{ localization.common.yes }}
49
+ </span>
50
+ </button>
51
+ </template>
52
+ </atoms-modal>
53
+ </template>
54
+
55
+ <script lang="ts" setup>
56
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
57
+ import type { UI_T_ModeModal } from '~/components/common/certificate/lib/models/types'
58
+
59
+ const props = defineProps<{
60
+ mode: UI_T_ModeModal
61
+ hostName: string
62
+ testId: string
63
+ loading: boolean
64
+ }>()
65
+
66
+ const emits = defineEmits<{
67
+ (event: 'hide'): void
68
+ (event: 'submit'): void
69
+ }>()
70
+
71
+ const localization = computed<UI_I_Localization>(() => useLocal())
72
+
73
+ const title = computed<string>(
74
+ () =>
75
+ localization.value.common[
76
+ props.mode === 'renew'
77
+ ? 'certificateRenewTitle'
78
+ : 'certificateRefreshTitle'
79
+ ]
80
+ )
81
+
82
+ const description = computed<string>(
83
+ () =>
84
+ localization.value.common[
85
+ props.mode === 'renew'
86
+ ? 'certificateRenewDescription'
87
+ : 'certificateRefreshDescription'
88
+ ]
89
+ )
90
+
91
+ const onHide = (): void => {
92
+ emits('hide')
93
+ }
94
+ </script>
95
+
96
+ <style lang="scss" scoped>
97
+ .certificate-modal {
98
+ form {
99
+ .form-block {
100
+ .icon-warning {
101
+ width: 48px;
102
+ margin-right: 20px;
103
+ }
104
+ }
105
+ }
106
+ }
107
+
108
+ .btn {
109
+ &.pending {
110
+ position: relative;
111
+ pointer-events: none;
112
+ }
113
+ &__loading {
114
+ :deep(.spinner) {
115
+ width: 25px;
116
+ height: 25px;
117
+ min-width: 25px;
118
+ min-height: 25px;
119
+ }
120
+ }
121
+ }
122
+ </style>
@@ -0,0 +1,67 @@
1
+ <template>
2
+ <component
3
+ :is="currentComponent"
4
+ :mode="props.mode"
5
+ :host-name="hostName"
6
+ :test-id="testId"
7
+ :loading="loading"
8
+ @hide="onHide"
9
+ @submit="onSubmit"
10
+ />
11
+ </template>
12
+
13
+ <script lang="ts" setup>
14
+ import type { UI_T_ModeModal } from '~/components/common/certificate/lib/models/types'
15
+
16
+ const props = defineProps<{
17
+ mode: UI_T_ModeModal
18
+ }>()
19
+
20
+ const emits = defineEmits<{
21
+ (event: 'hide'): void
22
+ (event: 'renew-certificate'): void
23
+ }>()
24
+
25
+ const { $store }: any = useNuxtApp()
26
+
27
+ const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
28
+ const currentComponent = computed(() =>
29
+ isNewView.value
30
+ ? defineAsyncComponent(() => import('./New.vue'))
31
+ : defineAsyncComponent(() => import('./Old.vue'))
32
+ )
33
+
34
+ const hostName = location.hostname
35
+
36
+ const loading = ref<boolean>(false)
37
+
38
+ const testId = computed<string>(() =>
39
+ props.mode === 'renew'
40
+ ? 'certificate-renew-modal'
41
+ : 'certificate-refresh-modal'
42
+ )
43
+
44
+ const renewCertificate = (): void => {
45
+ emits('renew-certificate')
46
+ }
47
+
48
+ const refreshCertificate = (): void => {
49
+ console.log('It will be soon')
50
+ }
51
+
52
+ const onSubmit = (): void => {
53
+ loading.value = true
54
+
55
+ props.mode === 'renew' ? renewCertificate() : refreshCertificate()
56
+
57
+ loading.value = false
58
+
59
+ onHide()
60
+ }
61
+
62
+ const onHide = (): void => {
63
+ emits('hide')
64
+ }
65
+ </script>
66
+
67
+ <style lang="scss" scoped></style>
@@ -13,7 +13,7 @@ export const constructItems = (
13
13
  !parent || (item.title !== parent.title && item._path !== parent._path)
14
14
  )
15
15
  })
16
- .map((item: UI_I_ContentNavigation): UI_I_AccordionRecursion => {
16
+ .map((item: UI_I_ContentNavigation, key: number): UI_I_AccordionRecursion => {
17
17
  const children = constructItems(item.children, item)
18
18
  return {
19
19
  children,
@@ -22,6 +22,7 @@ export const constructItems = (
22
22
  name: item.title,
23
23
  hasChild: !!children.length,
24
24
  isOpen: !parent,
25
+ testId: `nav-accordion-${key}`,
25
26
  }
26
27
  })
27
28
  }
@@ -8,7 +8,8 @@
8
8
  >
9
9
  <atoms-the-icon name="arrow" />
10
10
  </button>
11
- <div v-else class="height-100">
11
+
12
+ <div v-else class="h-full flex-direction-column">
12
13
  <div class="navbar__header">
13
14
  <p class="title">{{ props.title }}</p>
14
15
  <button
@@ -19,15 +20,17 @@
19
20
  <atoms-the-icon name="close" />
20
21
  </button>
21
22
  </div>
23
+
22
24
  <div class="navbar__content content-links">
23
25
  <a
24
26
  v-for="item in props.items"
25
27
  :key="item.text"
26
28
  :data-id="item.testId"
27
29
  :href="item.to"
28
- :class="['link-item', { active: route.hash === item.to }]"
29
- >{{ item.text }}</a
30
+ :class="['link-item', { active: activeHash === item.to }]"
30
31
  >
32
+ {{ item.text }}
33
+ </a>
31
34
  </div>
32
35
  </div>
33
36
  </div>
@@ -41,39 +44,96 @@ const props = defineProps<{
41
44
  items: UI_I_ContentNavbarItem[]
42
45
  }>()
43
46
 
44
- const route = useRoute()
45
-
46
47
  const isShow = ref<boolean>(true)
48
+ const activeHash = ref<string>('')
47
49
 
48
- const checkActiveLink = (): void => {
49
- const links = document.querySelectorAll('.content-links .link-item')
50
+ let observer: IntersectionObserver | null = null
51
+ let rootElement: Element | null = null
50
52
 
51
- if (!links.length) return
53
+ const setActiveHashFromLocation = () => {
54
+ // decodeURIComponent чтобы корректно читать хэши с кириллицей/спецсимволами
55
+ activeHash.value =
56
+ typeof window !== 'undefined'
57
+ ? decodeURIComponent(window.location.hash || '')
58
+ : ''
59
+ }
60
+
61
+ const observeLinks = (): void => {
62
+ const headingsSelector =
63
+ '.help .content-renderer h1, .help .content-renderer h2, .help .content-renderer h3, .help .content-renderer h4, .help .content-renderer h5, .help .content-renderer h6'
52
64
 
53
- links.forEach((item) => {
54
- const linkElement = item as HTMLLinkElement
65
+ const headingNodes = Array.from(
66
+ document.querySelectorAll<HTMLElement>(headingsSelector)
67
+ ).filter((h) => !!h.id)
55
68
 
56
- linkElement.classList.remove('active')
57
- const linkHref = linkElement.getAttribute('href')
58
- if (linkHref && route.hash === linkHref) linkElement.classList.add('active')
59
- else if (!route.hash) links[0].classList.add('active')
60
- })
69
+ if (headingNodes.length) {
70
+ const options: IntersectionObserverInit = {
71
+ root: rootElement || null,
72
+ rootMargin: '0px 0px -99% 0px', // активна пока верх секции у top root
73
+ threshold: 0,
74
+ }
75
+
76
+ observer = new IntersectionObserver((entries) => {
77
+ entries.forEach((entry) => {
78
+ if (!entry.isIntersecting) return
79
+ const id = entry.target.getAttribute('id')
80
+ if (!id) return
81
+ const newHash = `#${id}`
82
+
83
+ // Если уже такой hash — ничего не делаем
84
+ if (decodeURIComponent(window.location.hash || '') === newHash) {
85
+ activeHash.value = newHash
86
+ return
87
+ }
88
+
89
+ // Обновляем URL без скролла
90
+ history.replaceState(null, '', newHash)
91
+ activeHash.value = newHash
92
+ })
93
+ }, options)
94
+
95
+ headingNodes.forEach((h) => observer?.observe(h))
96
+ }
61
97
  }
62
98
 
63
- const parentCurrentScrollPosition = (): void => {
64
- const parentElement = document.querySelector('.help__content')
65
- if (!parentElement || route.hash) return
99
+ const init = (): void => {
100
+ rootElement = document.querySelector('.help__content')
101
+
102
+ setActiveHashFromLocation()
66
103
 
67
- parentElement.scrollTop = 0
104
+ if (props.items?.length) {
105
+ const first = props.items[0]?.to ?? ''
106
+ if (first) {
107
+ history.replaceState(null, '', first)
108
+ setActiveHashFromLocation()
109
+ }
110
+ }
111
+
112
+ observeLinks()
68
113
  }
69
114
 
115
+ onMounted(() => {
116
+ init()
117
+ })
118
+ let isRouteUpdated = false
70
119
  onUpdated(() => {
71
- parentCurrentScrollPosition()
72
- checkActiveLink()
120
+ if (isRouteUpdated) {
121
+ init()
122
+ isRouteUpdated = false
123
+ }
73
124
  })
74
125
 
75
- onMounted(() => {
76
- checkActiveLink()
126
+ // cleanup при unmount
127
+ onUnmounted(() => {
128
+ observer?.disconnect()
129
+ })
130
+ onBeforeRouteUpdate((to, from, next) => {
131
+ // обработка оснавной навигации, делаем cleanup
132
+ if (from.path !== to.path) {
133
+ observer?.disconnect()
134
+ isRouteUpdated = true
135
+ }
136
+ next()
77
137
  })
78
138
  </script>
79
139
 
@@ -101,6 +161,7 @@ onMounted(() => {
101
161
  cursor: pointer;
102
162
  margin: 12px 6px;
103
163
  }
164
+
104
165
  &__header {
105
166
  display: flex;
106
167
  justify-content: space-between;
@@ -128,10 +189,12 @@ onMounted(() => {
128
189
  }
129
190
  }
130
191
  }
192
+
131
193
  &__content {
132
194
  height: 100%;
133
195
  overflow: auto;
134
196
  }
197
+
135
198
  .link-item {
136
199
  display: block;
137
200
  color: var(--global-font-color);
@@ -58,6 +58,8 @@ const localization = computed<UI_I_Localization>(() => useLocal())
58
58
 
59
59
  <style lang="scss" scoped>
60
60
  .connection-timeout {
61
+ z-index: var(--z-popover);
62
+
61
63
  &__body {
62
64
  text-align: center;
63
65
  margin: 15px 0;
@@ -4,7 +4,6 @@
4
4
  v-model="form"
5
5
  :subtitle="props.hostname"
6
6
  :project="props.project"
7
- :first-time="props.firstTime"
8
7
  @change-password="onChangePassword"
9
8
  @hide="onHideModal"
10
9
  />
@@ -14,20 +13,16 @@
14
13
  import type { UI_I_Localization } from '~/lib/models/interfaces'
15
14
  import type { API_UI_I_Error } from '~/lib/models/store/interfaces'
16
15
  import type {
17
- UI_I_ChangePasswordBodyRequest, UI_I_ChangePasswordFirstTimeBodyRequest,
16
+ UI_I_ChangePasswordBodyRequest,
17
+ UI_I_ChangePasswordFirstTimeBodyRequest,
18
18
  UI_I_ChangePasswordForm,
19
19
  } from '~/components/common/layout/theHeader/userMenu/modals/changePassword/lib/models/interfaces'
20
20
  import type { UI_T_Project } from '~/lib/models/types'
21
- // import {} from '#build/components/common/layout/theHeader/userMenu/modals/changePassword/lib/models/interfaces'
22
21
 
23
- const props = withDefaults(
24
- defineProps<{
25
- hostname: string
26
- project: UI_T_Project
27
- firstTime?: boolean
28
- }>(),
29
- { firstTime: false }
30
- )
22
+ const props = defineProps<{
23
+ hostname: string
24
+ project: UI_T_Project
25
+ }>()
31
26
  const isShowModalLocal = defineModel<boolean>({ required: true })
32
27
 
33
28
  const localization = computed<UI_I_Localization>(() => useLocal())
@@ -51,25 +46,21 @@ const onChangePassword = async (): Promise<void> => {
51
46
 
52
47
  onHideModal()
53
48
 
54
- let sendData: UI_I_ChangePasswordBodyRequest | UI_I_ChangePasswordFirstTimeBodyRequest = {
49
+ let sendData:
50
+ | UI_I_ChangePasswordBodyRequest
51
+ | UI_I_ChangePasswordFirstTimeBodyRequest = {
55
52
  current_password,
56
53
  new_password,
57
54
  }
58
55
 
59
56
  let url = ''
60
57
  if (props.project === 'sphere') {
61
- const { id } = useLocalStorage('userData')
62
-
63
- url = `ui/users/${id}/passwd`
64
- } else if (props.project === 'procurator') {
65
- url = '/ui/passwd'
66
- }
67
-
68
- if (props.firstTime) {
69
58
  sendData = {
70
- password: new_password
59
+ password: new_password,
71
60
  }
72
61
  url = 'ui/users/current/change_password'
62
+ } else if (props.project === 'procurator') {
63
+ url = '/ui/passwd'
73
64
  }
74
65
 
75
66
  const { error } = await useMyFetch<never, API_UI_I_Error>(url, {
@@ -11,15 +11,6 @@
11
11
  >
12
12
  <template #content>
13
13
  <ui-modal-block-standard>
14
- <ui-alert
15
- v-if="alertErrorText"
16
- :messages="[alertErrorText]"
17
- test-id="change-password-error-alert"
18
- type="error"
19
- class="change-password__alert"
20
- hide-close-button
21
- />
22
-
23
14
  <p class="change-password__description">
24
15
  {{ description }}
25
16
  </p>
@@ -71,7 +62,6 @@ import {
71
62
  const props = defineProps<{
72
63
  project: UI_T_Project
73
64
  subtitle: string
74
- firstTime: boolean
75
65
  }>()
76
66
  const emits = defineEmits<{
77
67
  (event: 'hide'): void
@@ -81,9 +71,7 @@ const modelLocal = defineModel<UI_I_ChangePasswordForm>({ required: true })
81
71
 
82
72
  const localization = computed<UI_I_Localization>(() => useLocal())
83
73
 
84
- const description = ref<string>(props.firstTime
85
- ? localization.value.common.firstTimeChangePasswordDesc
86
- : localization.value.common.changePasswordDesc)
74
+ const description = ref<string>(localization.value.common.changePasswordDesc)
87
75
 
88
76
  const modalTexts = computed<UI_I_ModalTexts>(() => {
89
77
  return {
@@ -92,7 +80,6 @@ const modalTexts = computed<UI_I_ModalTexts>(() => {
92
80
  }
93
81
  })
94
82
 
95
- const alertErrorText = ref<string>('')
96
83
  const initValidationFields = ref<UI_I_InitialValidationFields>({
97
84
  currentPassword: false,
98
85
  newPassword: false,
@@ -111,32 +98,48 @@ const initValidation = (types: string[]): boolean => {
111
98
  const passwordErrorText = computed<string>(() => {
112
99
  if (!initValidationFields.value.currentPassword) return ''
113
100
 
114
- return !modelLocal.value.current_password
115
- ? localization.value.common.fieldRequired
116
- : ''
101
+ if (!modelLocal.value.current_password) {
102
+ return localization.value.common.fieldRequired
103
+ } else {
104
+ return ''
105
+ }
117
106
  })
118
107
  const newPasswordErrorText = computed<string>(() => {
119
108
  if (!initValidationFields.value.newPassword) return ''
120
109
 
121
- const { new_password, confirm_password } = modelLocal.value
122
- return !new_password
123
- ? localization.value.common.fieldRequired
124
- : getPasswordMismatchError(
125
- localization.value,
126
- new_password,
127
- confirm_password
128
- )
110
+ const { current_password, new_password, confirm_password } = modelLocal.value
111
+
112
+ const validateText = validateField(
113
+ localization.value,
114
+ current_password,
115
+ new_password
116
+ )
117
+ const mismatchError = getPasswordMismatchError(
118
+ localization.value,
119
+ new_password,
120
+ confirm_password
121
+ )
122
+ if (!new_password) {
123
+ return localization.value.common.fieldRequired
124
+ } else if (validateText) {
125
+ return validateText
126
+ } else if (mismatchError) {
127
+ return mismatchError
128
+ } else return ''
129
129
  })
130
130
  const confirmPasswordErrorText = computed<string>(() => {
131
131
  if (!initValidationFields.value.confirmPassword) return ''
132
132
  const { new_password, confirm_password } = modelLocal.value
133
- return !confirm_password
134
- ? localization.value.common.fieldRequired
135
- : getPasswordMismatchError(
136
- localization.value,
137
- new_password,
138
- confirm_password
139
- )
133
+
134
+ if (!confirm_password) {
135
+ return localization.value.common.fieldRequired
136
+ } else {
137
+ return getPasswordMismatchError(
138
+ localization.value,
139
+ new_password,
140
+ confirm_password
141
+ )
142
+ }
140
143
  })
141
144
  const onSubmit = (): void => {
142
145
  const isFieldValid = initValidation([
@@ -145,17 +148,7 @@ const onSubmit = (): void => {
145
148
  'confirmPassword',
146
149
  ])
147
150
 
148
- const { current_password, new_password } = modelLocal.value
149
-
150
- if (!isFieldValid) {
151
- alertErrorText.value = validateField(
152
- localization.value,
153
- current_password,
154
- new_password
155
- )
156
- }
157
-
158
- !isFieldValid && !alertErrorText.value && emits('change-password')
151
+ !isFieldValid && emits('change-password')
159
152
  }
160
153
  const onHideModal = (): void => {
161
154
  emits('hide')
@@ -10,7 +10,6 @@
10
10
  @submit="onChangePassword"
11
11
  >
12
12
  <template #modalBody>
13
- <p v-if="props.firstTime">{{ localization.common.firstTimeChangePasswordDesc }}</p>
14
13
  <form id="change-password-form" class="compact" @submit.prevent>
15
14
  <section class="form-block">
16
15
  <div class="form-group">
@@ -98,7 +97,6 @@ import { defaultFormFunc } from '~/components/common/layout/theHeader/userMenu/m
98
97
  const props = defineProps<{
99
98
  hostname: string
100
99
  project: UI_T_Project
101
- firstTime: boolean
102
100
  }>()
103
101
  const emits = defineEmits<{
104
102
  (event: 'hide'): void
@@ -1,4 +1,4 @@
1
- import type { UI_I_Localization } from '~//lib/models/interfaces'
1
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
2
2
  import { RegExp } from '~/lib/config/regExp'
3
3
 
4
4
  export const getPasswordMismatchError = (
@@ -45,6 +45,14 @@
45
45
  />
46
46
  </ui-modal-block-form-standard>
47
47
 
48
+ <ui-modal-block-form-standard v-if="isSphere">
49
+ <common-layout-the-header-user-menu-modals-preferences-security
50
+ v-model:security="security"
51
+ :recovery="props.recovery"
52
+ @confirm="emits('security-confirm', $event)"
53
+ />
54
+ </ui-modal-block-form-standard>
55
+
48
56
  <ui-modal-block-form-standard without-border-bottom>
49
57
  <common-layout-the-header-user-menu-modals-preferences-view
50
58
  :new-view="props.newView"
@@ -63,6 +71,9 @@ import type { UI_I_ModalTexts } from '~/node_modules/bfg-uikit/components/ui/mod
63
71
  import type { UI_I_Localization } from '~/lib/models/interfaces'
64
72
  import type { UI_T_LangValue, UI_T_Project } from '~/lib/models/types'
65
73
  import type { UI_T_TimeValue } from '~/components/common/layout/theHeader/userMenu/modals/preferences/timeFormat/lib/models/types'
74
+ import type { UI_I_Recovery } from '~/components/common/layout/theHeader/userMenu/modals/preferences/security/lib/models/interfaces'
75
+
76
+ const security = defineModel<boolean>('security')
66
77
 
67
78
  const props = defineProps<{
68
79
  project: UI_T_Project
@@ -73,6 +84,7 @@ const props = defineProps<{
73
84
  newViewLocal: boolean
74
85
  remoteConsole: string
75
86
  vmCluster: boolean
87
+ recovery: UI_I_Recovery | null // для Сферы
76
88
  }>()
77
89
  const emits = defineEmits<{
78
90
  (event: 'hide'): void
@@ -82,6 +94,7 @@ const emits = defineEmits<{
82
94
  (event: 'update-is-new-view', value: boolean): void
83
95
  (event: 'update-remote-console', value: string): void
84
96
  (event: 'update-vm-clusters', value: boolean): void
97
+ (event: 'security-confirm', value: boolean): void
85
98
  (event: 'submit'): void
86
99
  (event: 'reset'): void
87
100
  }>()
@@ -1,16 +1,6 @@
1
1
  <template>
2
- <common-layout-the-header-user-menu-modals-preferences-change-language-new
3
- v-if="props.newView"
4
- :selected-language="selectedLanguageLocal"
5
- :description="description"
6
- :radio-options="radioOptions"
7
- :language-mode="languageMode"
8
- :locales="locales"
9
- @update-language="onSelectLang"
10
- @update-is-browser="onUpdateIsBrowser"
11
- />
12
- <common-layout-the-header-user-menu-modals-preferences-change-language-old
13
- v-else
2
+ <component
3
+ :is="currentComponent"
14
4
  :selected-language="selectedLanguageLocal"
15
5
  :description="description"
16
6
  :radio-options="radioOptions"
@@ -47,6 +37,12 @@ const emits = defineEmits<{
47
37
  const config = useRuntimeConfig()
48
38
  const localization = computed<UI_I_Localization>(() => useLocal())
49
39
 
40
+ const currentComponent = computed(() =>
41
+ props.newView
42
+ ? defineAsyncComponent(() => import('./New.vue'))
43
+ : defineAsyncComponent(() => import('./Old.vue'))
44
+ )
45
+
50
46
  const description = computed<string>(() => {
51
47
  return localization.value.common.languageDesc.replaceAll(
52
48
  '{trademark}',
@@ -109,7 +105,4 @@ watch(
109
105
  },
110
106
  { immediate: true }
111
107
  )
112
-
113
- // TODO remove
114
- // const localsLocal = ref<any>(locales.filter((_, i) => i > 0))
115
108
  </script>