bfg-common 1.3.467 → 1.3.468

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 (109) hide show
  1. package/assets/scss/common/normalize.scss +340 -340
  2. package/components/atoms/TheIcon2.vue +1353 -1353
  3. package/components/atoms/loader/Loader.vue +30 -30
  4. package/components/atoms/loader/PreLoader.vue +38 -38
  5. package/components/atoms/switch/Switch.vue +111 -111
  6. package/components/atoms/table/compact/Compact.vue +526 -526
  7. package/components/common/adapterManager/ui/table/Header.vue +93 -93
  8. package/components/common/adapterManager/ui/table/Table.vue +162 -162
  9. package/components/common/context/Context.vue +99 -99
  10. package/components/common/layout/theHeader/LanguageSwitch.vue +102 -0
  11. package/components/common/layout/theHeader/TheHeader.vue +91 -0
  12. package/components/common/layout/theHeader/TheHeaderNew.vue +229 -0
  13. package/components/common/layout/theHeader/TheHeaderOld.vue +241 -0
  14. package/components/common/layout/theHeader/feedback/Feedback.vue +104 -0
  15. package/components/common/layout/theHeader/feedback/FeedbackNew.vue +63 -0
  16. package/components/common/layout/theHeader/feedback/FeedbackOld.vue +73 -0
  17. package/components/common/layout/theHeader/helpMenu/About.vue +110 -0
  18. package/components/common/layout/theHeader/helpMenu/HelpMenu.vue +45 -0
  19. package/components/common/layout/theHeader/helpMenu/helpMenuNew/HelpMenuNew.vue +112 -0
  20. package/components/common/layout/theHeader/helpMenu/helpMenuNew/lib/config/dropMenu.ts +25 -0
  21. package/components/common/layout/theHeader/helpMenu/helpMenuOld/HelpMenuOld.vue +69 -0
  22. package/components/common/layout/theHeader/helpMenu/helpMenuOld/lib/config/dropMenu.ts +22 -0
  23. package/components/common/layout/theHeader/helpMenu/helpMenuOld/lib/models/types.ts +1 -0
  24. package/components/common/layout/theHeader/lib/models/types.ts +5 -0
  25. package/components/common/layout/theHeader/modals/Reconnect.vue +98 -0
  26. package/components/common/layout/theHeader/modals/RedirectLogin.vue +60 -0
  27. package/components/common/layout/theHeader/userMenu/UserMenu.vue +95 -0
  28. package/components/common/layout/theHeader/userMenu/lib/models/interfaces.ts +32 -0
  29. package/components/common/layout/theHeader/userMenu/modals/changePassword/ChangePassword.vue +210 -0
  30. package/components/common/layout/theHeader/userMenu/modals/changePassword/lib/config/form.ts +31 -0
  31. package/components/common/layout/theHeader/userMenu/modals/changePassword/lib/models/interfaces.ts +12 -0
  32. package/components/common/layout/theHeader/userMenu/modals/preferences/Inventory.vue +43 -0
  33. package/components/common/layout/theHeader/userMenu/modals/preferences/Preferences.vue +119 -0
  34. package/components/common/layout/theHeader/userMenu/modals/preferences/View.vue +113 -0
  35. package/components/common/layout/theHeader/userMenu/modals/preferences/changeLanguage/ChangeLanguage.vue +148 -0
  36. package/components/common/layout/theHeader/userMenu/modals/preferences/changeLanguage/lib/config/lang.ts +10 -0
  37. package/components/common/layout/theHeader/userMenu/modals/preferences/changeLanguage/lib/config/radioOptions.ts +22 -0
  38. package/components/common/layout/theHeader/userMenu/modals/preferences/changeLanguage/lib/models/enums.ts +9 -0
  39. package/components/common/layout/theHeader/userMenu/modals/preferences/changeLanguage/lib/models/interfaces.ts +11 -0
  40. package/components/common/layout/theHeader/userMenu/modals/preferences/changeLanguage/lib/models/types.ts +1 -0
  41. package/components/common/layout/theHeader/userMenu/modals/preferences/defaultConsole/DefaultConsole.vue +66 -0
  42. package/components/common/layout/theHeader/userMenu/modals/preferences/defaultConsole/lib/config/consoleOptions.ts +30 -0
  43. package/components/common/layout/theHeader/userMenu/modals/preferences/defaultConsole/lib/models/interfaces.ts +5 -0
  44. package/components/common/layout/theHeader/userMenu/modals/preferences/lib/config/preferencesTabs.ts +68 -0
  45. package/components/common/layout/theHeader/userMenu/modals/preferences/lib/models/types.ts +1 -0
  46. package/components/common/layout/theHeader/userMenu/modals/preferences/timeFormat/TimeFormat.vue +67 -0
  47. package/components/common/layout/theHeader/userMenu/modals/preferences/timeFormat/lib/config/formatOptions.ts +27 -0
  48. package/components/common/layout/theHeader/userMenu/modals/preferences/timeFormat/lib/models/types.ts +1 -0
  49. package/components/common/layout/theHeader/userMenu/userMenuNew/UserMenuNew.vue +114 -0
  50. package/components/common/layout/theHeader/userMenu/userMenuNew/lib/config/dropMenu.ts +28 -0
  51. package/components/common/layout/theHeader/userMenu/userMenuOld/UserMenuOld.vue +36 -0
  52. package/components/common/layout/theHeader/userMenu/userMenuOld/lib/config/dropMenu.ts +36 -0
  53. package/components/common/layout/theHeader/userMenu/userMenuOld/lib/models/types.ts +5 -0
  54. package/components/common/lib/config/states.ts +160 -160
  55. package/components/common/mainNavigationPanel/MainNavigationPanel.vue +142 -142
  56. package/components/common/mainNavigationPanel/MainNavigationPanelNew.vue +248 -248
  57. package/components/common/mainNavigationPanel/MainNavigationPanelOld.vue +288 -288
  58. package/components/common/readyToComplete/ReadyToComplete.vue +15 -15
  59. package/components/common/resource/progressBlock/ProgressBlock.vue +142 -142
  60. package/components/common/split/horizontal/Horizontal.vue +70 -70
  61. package/components/common/vm/actions/clone/Clone.vue +511 -511
  62. package/components/common/vm/actions/common/customizeHardware/CustomizeHardware.vue +273 -273
  63. package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardware.vue +697 -697
  64. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Cpu.vue +400 -400
  65. package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/Memory.vue +329 -329
  66. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +305 -305
  67. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/NewPciDevice.vue +168 -168
  68. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newUsbController/NewUsbController.vue +82 -82
  69. package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/Other.vue +32 -32
  70. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCard.vue +182 -182
  71. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/BootOptions.vue +114 -114
  72. package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptions.vue +192 -192
  73. package/components/common/vm/actions/common/customizeHardware/vmoptions/tools/Tools.vue +72 -72
  74. package/components/common/vm/actions/common/select/computeResource/ComputeResource.vue +164 -164
  75. package/components/common/vm/actions/common/select/name/Name.vue +235 -235
  76. package/components/common/vm/actions/common/select/storage/Storage.vue +198 -198
  77. package/components/common/vm/actions/editSettings/EditSettings.vue +316 -316
  78. package/components/common/weekSelect/lib/config/options.ts +10 -10
  79. package/components/common/wizards/datastore/add/Add.vue +436 -436
  80. package/components/common/wizards/datastore/add/lib/config/stepItems.ts +191 -191
  81. package/components/common/wizards/datastore/add/lib/models/interfaces.ts +38 -38
  82. package/components/common/wizards/datastore/add/lib/utils.ts +70 -70
  83. package/components/common/wizards/datastore/add/local/createName/CreateName.vue +160 -160
  84. package/components/common/wizards/datastore/add/nfs/Nfs.vue +112 -112
  85. package/components/common/wizards/datastore/add/nfs/accessibility/Accessibility.vue +104 -104
  86. package/components/common/wizards/datastore/add/nfs/accessibility/tablesView/lib/config/compatibleTable.ts +62 -62
  87. package/components/common/wizards/datastore/add/nfs/accessibility/tablesView/lib/config/hostsTableItems.ts +53 -53
  88. package/components/common/wizards/datastore/add/readyComplete/ReadyComplete.vue +86 -86
  89. package/components/common/wizards/datastore/add/readyComplete/lib/config/propertiesDetails.ts +184 -184
  90. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/DeviceSelection.vue +459 -459
  91. package/components/common/wizards/datastore/add/types/Types.vue +80 -80
  92. package/components/common/wizards/datastore/add/types/lib/config/typeOptions.ts +49 -49
  93. package/composables/useAppVersion.ts +22 -22
  94. package/composables/useEnvLanguage.ts +20 -20
  95. package/lib/utils/sendTask.ts +73 -73
  96. package/minify.js +146 -146
  97. package/package.json +2 -1
  98. package/plugins/spice-console/spice.console.ts +147 -147
  99. package/public/spice-console/application/codec.js +263 -263
  100. package/public/spice-console/lib/rasterEngine.js +907 -907
  101. package/public/spice-console/network/spicechannel.js +375 -375
  102. package/store/main/lib/interfaces.ts +9 -9
  103. package/store/tasks/actions.ts +133 -133
  104. package/store/tasks/getters.ts +25 -25
  105. package/store/tasks/lib/models/interfaces.ts +18 -18
  106. package/store/tasks/mutations.ts +58 -58
  107. package/store/tasks/state.ts +16 -16
  108. /package/components/{layout → common/layout}/theHeader/lib/models/enums.ts +0 -0
  109. /package/components/{layout → common/layout}/theHeader/lib/utils/localization.ts +0 -0
@@ -0,0 +1,210 @@
1
+ <template>
2
+ <atoms-modal
3
+ width="580px"
4
+ test-id="change-password"
5
+ :show="props.show"
6
+ :title="localization.changePassword"
7
+ :second-title="props.hostname"
8
+ :disabled-submit="buttonDisabled"
9
+ @hide="onHideModal"
10
+ @submit="onChangePassword"
11
+ >
12
+ <template #modalBody>
13
+ <form id="change-password-form" class="compact" @submit.prevent>
14
+ <section class="form-block">
15
+ <div class="form-group">
16
+ <label for="current-password-field"
17
+ >{{ localization.currentPassword }}:</label
18
+ >
19
+ <input
20
+ id="current-password-field"
21
+ v-model="form.password.value"
22
+ data-id="change-password-input"
23
+ type="password"
24
+ />
25
+ </div>
26
+
27
+ <div class="form-group">
28
+ <label for="new-password-field"
29
+ >{{ localization.newPassword }}:</label
30
+ >
31
+
32
+ <div class="form-group__input">
33
+ <atoms-tooltip-error
34
+ :has-error="isValid"
35
+ selector="#new-password-field"
36
+ >
37
+ <template #elem>
38
+ <input
39
+ id="new-password-field"
40
+ v-model="form.newPassword.value"
41
+ data-id="new-password-input"
42
+ type="password"
43
+ />
44
+ </template>
45
+ <template #content>{{ errorText }}</template>
46
+ </atoms-tooltip-error>
47
+ <atoms-the-icon
48
+ v-show="isValid"
49
+ class="is-error tooltip-trigger"
50
+ name="info"
51
+ />
52
+ </div>
53
+ </div>
54
+
55
+ <div class="form-group">
56
+ <label for="confirm-password-field"
57
+ >{{ localization.confirmPassword }}:</label
58
+ >
59
+
60
+ <div class="form-group__input">
61
+ <atoms-tooltip-error
62
+ :has-error="isValid"
63
+ selector="#confirm-password-field"
64
+ >
65
+ <template #elem>
66
+ <input
67
+ id="confirm-password-field"
68
+ v-model="form.confirmPassword.value"
69
+ data-id="confirm-password-input"
70
+ type="password"
71
+ />
72
+ </template>
73
+ <template #content>{{ errorText }}</template>
74
+ </atoms-tooltip-error>
75
+ <atoms-the-icon
76
+ v-show="isValid"
77
+ class="is-error tooltip-trigger"
78
+ name="info"
79
+ />
80
+ </div>
81
+ </div>
82
+ </section>
83
+ </form>
84
+ </template>
85
+ </atoms-modal>
86
+ </template>
87
+
88
+ <script setup lang="ts">
89
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
90
+ import type { API_UI_I_Error } from '~/lib/models/store/interfaces'
91
+ import type {
92
+ UI_I_ChangePasswordBodyRequest,
93
+ UI_I_FormChangePassword,
94
+ } from '~/components/common/layout/theHeader/userMenu/modals/changePassword/lib/models/interfaces'
95
+ import type { UI_T_Project } from '~/lib/models/types'
96
+ import { defaultFormFunc } from '~/components/common/layout/theHeader/userMenu/modals/changePassword/lib/config/form'
97
+
98
+ const props = defineProps<{
99
+ show: boolean
100
+ hostname: string
101
+ project: UI_T_Project
102
+ }>()
103
+ const emits = defineEmits<{
104
+ (event: 'hide'): void
105
+ }>()
106
+
107
+ const localization = computed<UI_I_Localization>(() => useLocal())
108
+ const { $store, $validation }: any = useNuxtApp()
109
+ const validation = $validation.call({})
110
+
111
+ const isValid = ref<boolean>(false)
112
+ const errorText = ref<string>('')
113
+ const form = ref<UI_I_FormChangePassword>(
114
+ useDeepCopy(defaultFormFunc(localization.value))
115
+ )
116
+
117
+ const setForm = (): void => {
118
+ form.value = useDeepCopy(defaultFormFunc(localization.value))
119
+ validation.setForm(form)
120
+ }
121
+ setForm()
122
+
123
+ const buttonDisabled = computed<boolean>(() => {
124
+ const { password, confirmPassword, newPassword } = form.value
125
+ return (
126
+ password.value &&
127
+ confirmPassword.value &&
128
+ newPassword.value !== confirmPassword.value
129
+ )
130
+ })
131
+
132
+ const onChangePassword = async (): Promise<void> => {
133
+ const valid = validation.touch()
134
+ const { newPassword, password } = form.value
135
+
136
+ if (newPassword.value === password.value) {
137
+ showValidationErrors(localization.value.newPasswordMustDifferentOld)
138
+ return
139
+ }
140
+ if (!valid.isValid) {
141
+ showValidationErrors(valid.errors.confirmPassword[0])
142
+ return
143
+ }
144
+
145
+ onHideModal()
146
+
147
+ const sendData: UI_I_ChangePasswordBodyRequest = {
148
+ current_password: password.value,
149
+ new_password: newPassword.value,
150
+ }
151
+
152
+ let url = ''
153
+ if (props.project === 'sphere') {
154
+ const { id } = useLocalStorage('userData')
155
+
156
+ url = `ui/users/${id}/passwd`
157
+ } else if (props.project === 'procurator') {
158
+ url = '/ui/passwd'
159
+ }
160
+
161
+ const { error } = await useMyFetch<never, API_UI_I_Error>(url, {
162
+ method: 'POST',
163
+ body: sendData,
164
+ key: Date.now().toString(),
165
+ })
166
+
167
+ if (error.value?.data && error.value.data.error_code !== 0) {
168
+ $store.dispatch('main/A_SHOW_NOTIFICATION', {
169
+ status: 'error',
170
+ headline: localization.value.operationFailed,
171
+ messages: [
172
+ {
173
+ title: 'Error',
174
+ descriptions: [error.value.data.error_message],
175
+ },
176
+ ],
177
+ })
178
+ }
179
+ }
180
+
181
+ const showValidationErrors = (text: string): void => {
182
+ isValid.value = true
183
+ errorText.value = text
184
+ }
185
+
186
+ const onHideModal = (): void => {
187
+ emits('hide')
188
+ setForm()
189
+ isValid.value = false
190
+ }
191
+ </script>
192
+
193
+ <style lang="scss" scoped>
194
+ .form-block {
195
+ .form-group {
196
+ &:not(:first-child) input {
197
+ width: 100%;
198
+ }
199
+ &__input {
200
+ display: flex;
201
+ width: 100%;
202
+ }
203
+ }
204
+
205
+ svg {
206
+ width: 24px;
207
+ height: 24px;
208
+ }
209
+ }
210
+ </style>
@@ -0,0 +1,31 @@
1
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
2
+ import type { UI_I_FormChangePassword } from '~/components/common/layout/theHeader/userMenu/modals/changePassword/lib/models/interfaces'
3
+
4
+ export const defaultFormFunc = (
5
+ localization: UI_I_Localization
6
+ ): UI_I_FormChangePassword => {
7
+ return {
8
+ password: {
9
+ value: '',
10
+ validations: [],
11
+ },
12
+ newPassword: {
13
+ value: '',
14
+ validations: [
15
+ {
16
+ value: 'password',
17
+ errorText: localization.changePasswordError,
18
+ },
19
+ ],
20
+ },
21
+ confirmPassword: {
22
+ value: '',
23
+ validations: [
24
+ {
25
+ value: 'password',
26
+ errorText: localization.changePasswordError,
27
+ },
28
+ ],
29
+ },
30
+ }
31
+ }
@@ -0,0 +1,12 @@
1
+ import type { UI_I_Validation } from '~/lib/models/plugins/validation/interfaces'
2
+
3
+ export interface UI_I_FormChangePassword {
4
+ password: UI_I_Validation
5
+ newPassword: UI_I_Validation
6
+ confirmPassword: UI_I_Validation
7
+ }
8
+
9
+ export interface UI_I_ChangePasswordBodyRequest {
10
+ current_password: string
11
+ new_password: string
12
+ }
@@ -0,0 +1,43 @@
1
+ <template>
2
+ <form id="inventor-form">
3
+ <div class="description">
4
+ {{ localization.inventoryDesc }}
5
+ </div>
6
+
7
+ <div class="clr-checkbox-wrapper">
8
+ <input
9
+ id="show-vms-in-hosts-and-clusters"
10
+ v-model="vmInHostsClusters"
11
+ data-id="user-preferences-inventory-show-vms-checkbox"
12
+ type="checkbox"
13
+ name="showVmsInHostsAndClusters"
14
+ @change="onHandlerChange"
15
+ />
16
+
17
+ <label for="show-vms-in-hosts-and-clusters" tabindex="-1">{{
18
+ localization.virtualMachinesLabel
19
+ }}</label>
20
+ </div>
21
+ </form>
22
+ </template>
23
+
24
+ <script setup lang="ts">
25
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
26
+
27
+ const props = defineProps<{
28
+ vmCluster: boolean
29
+ }>()
30
+ const { $store }: any = useNuxtApp()
31
+
32
+ const localization = computed<UI_I_Localization>(() => useLocal())
33
+
34
+ const vmInHostsClusters = ref<boolean>(props.vmCluster)
35
+
36
+ const onHandlerChange = (): void => {
37
+ $store.dispatch('profile/A_PREFERENCES_FOR_CHANGING', {
38
+ vm_in_hosts_clusters: vmInHostsClusters.value,
39
+ })
40
+ }
41
+ </script>
42
+
43
+ <style lang="scss" scoped></style>
@@ -0,0 +1,119 @@
1
+ <template>
2
+ <atoms-modal
3
+ show
4
+ test-id="user-preferences-modal"
5
+ width="580px"
6
+ height="345px"
7
+ :title="localization.preferences"
8
+ @hide="onHide"
9
+ >
10
+ <template #modalBody>
11
+ <atoms-nav-bar
12
+ v-model="selectedTab"
13
+ test-id="user-preferences-nav-bar"
14
+ :items="tabsItems"
15
+ />
16
+
17
+ <common-layout-the-header-user-menu-modals-preferences-time-format
18
+ v-if="selectedTab === 'time-tab'"
19
+ :time-format="props.timeFormat"
20
+ @update="emits('update-time-format', $event)"
21
+ />
22
+
23
+ <common-layout-the-header-user-menu-modals-preferences-change-language
24
+ v-if="selectedTab === 'language-tab'"
25
+ :selected-type="props.selectedLanguageType"
26
+ :selected-language="props.selectedLanguage"
27
+ :project="props.project"
28
+ @update-language-type="emits('update-language-type', $event)"
29
+ @update="emits('update-language', $event)"
30
+ @update-is-browser="emits('update-is-browser', $event)"
31
+ />
32
+
33
+ <common-layout-the-header-user-menu-modals-preferences-inventory
34
+ v-if="selectedTab === 'inventory-tab' && isSphere"
35
+ :vm-cluster="props.user.ui_options.vm_in_hosts_clusters"
36
+ />
37
+
38
+ <common-layout-the-header-user-menu-modals-preferences-default-console
39
+ v-if="selectedTab === 'console-tab' && isSphere"
40
+ :remote-console="props.user.ui_options.remote_console"
41
+ :project="props.project"
42
+ />
43
+
44
+ <common-layout-the-header-user-menu-modals-preferences-view
45
+ v-if="selectedTab === 'view-tab'"
46
+ :project="props.project"
47
+ :is-new-view="props.newView"
48
+ @update="emits('update-is-new-view', $event)"
49
+ />
50
+ </template>
51
+
52
+ <template #modalFooter>
53
+ <button
54
+ id="user-preferences-cancel-button"
55
+ data-id="user-preferences-cancel-button"
56
+ class="btn btn-outline"
57
+ @click="onHide"
58
+ >
59
+ {{ localization.cancel }}
60
+ </button>
61
+ <button
62
+ id="user-preferences-apply-button"
63
+ data-id="user-preferences-apply-button"
64
+ class="btn btn-primary"
65
+ @click="emits('submit')"
66
+ >
67
+ {{ localization.save }}
68
+ </button>
69
+ </template>
70
+ </atoms-modal>
71
+ </template>
72
+
73
+ <script setup lang="ts">
74
+ import type { UI_I_CollapseNavItem } from '~/components/atoms/collapse/lib/models/interfaces'
75
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
76
+ import type { UI_T_LangValue, UI_T_Project } from '~/lib/models/types'
77
+ import type { UI_T_UserPreferenceTab } from '~/components/common/layout/theHeader/userMenu/modals/preferences/lib/models/types'
78
+ import type { UI_I_User } from '~/components/common/layout/theHeader/userMenu/lib/models/interfaces'
79
+ import type { UI_T_TimeValue } from '~/components/common/layout/theHeader/userMenu/modals/preferences/timeFormat/lib/models/types'
80
+ import { preferencesTabs } from '~/components/common/layout/theHeader/userMenu/modals/preferences/lib/config/preferencesTabs'
81
+
82
+ const props = defineProps<{
83
+ project: UI_T_Project
84
+ timeFormat: UI_T_TimeValue
85
+ selectedLanguage: UI_T_LangValue
86
+ selectedLanguageType: UI_T_LangValue
87
+ newView: boolean
88
+ user?: UI_I_User
89
+ }>()
90
+ const emits = defineEmits<{
91
+ (event: 'hide'): void
92
+ (event: 'update-time-format', value: UI_T_TimeValue): void
93
+ (event: 'update-language-type', value: string): void
94
+ (event: 'update-language', value: string): void
95
+ (event: 'update-is-browser', value: string): void
96
+ (event: 'update-is-new-view', value: boolean): void
97
+ (event: 'submit'): void
98
+ }>()
99
+
100
+ const { $store }: any = useNuxtApp()
101
+
102
+ const localization = computed<UI_I_Localization>(() => useLocal())
103
+
104
+ const isSphere = ref<boolean>(props.project === 'sphere')
105
+ const selectedTab = ref<UI_T_UserPreferenceTab>('time-tab')
106
+
107
+ const tabsItems = computed<UI_I_CollapseNavItem[]>(() =>
108
+ preferencesTabs(localization.value, props.project)
109
+ )
110
+
111
+ const onHide = (): void => {
112
+ emits('hide')
113
+
114
+ if (props.project === 'sphere') {
115
+ selectedTab.value = 'time-tab'
116
+ $store.dispatch('profile/A_PREFERENCES_FOR_CHANGING', { clear: true })
117
+ }
118
+ }
119
+ </script>
@@ -0,0 +1,113 @@
1
+ <template>
2
+ <form id="view-form" class="compact">
3
+ <div class="description">
4
+ {{ description }}
5
+ </div>
6
+
7
+ <div class="flex-align-center">
8
+ <label for="view">{{ localization.newView }}</label>
9
+ <input
10
+ id="view"
11
+ v-model="isNewViewLocal"
12
+ type="checkbox"
13
+ class="switch"
14
+ @change="onChange"
15
+ />
16
+ </div>
17
+ </form>
18
+ </template>
19
+
20
+ <script setup lang="ts">
21
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
22
+
23
+ const props = defineProps<{
24
+ isNewView: boolean
25
+ }>()
26
+
27
+ const isNewViewLocal = ref<boolean>(props.isNewView)
28
+
29
+ const emits = defineEmits<{
30
+ (event: 'update', value: boolean): void
31
+ }>()
32
+
33
+ const config = useRuntimeConfig()
34
+
35
+ const localization = computed<UI_I_Localization>(() => useLocal())
36
+
37
+ const description = computed<string>(() => {
38
+ return localization.value.viewDesc.replaceAll(
39
+ '{trademark}',
40
+ String(config.public[`TRADEMARK_${useEnvLanguage()}`])
41
+ )
42
+ })
43
+
44
+ const onChange = (): void => {
45
+ emits('update', isNewViewLocal.value)
46
+ }
47
+ </script>
48
+
49
+ <style lang="scss" scoped>
50
+ .description {
51
+ margin-bottom: 10px;
52
+ }
53
+
54
+ label {
55
+ margin-right: 6px;
56
+ }
57
+
58
+ input[type='checkbox'] {
59
+ --active: var(--checkbox-value-active-color);
60
+ --active-inner: var(--checkbox-mark-color);
61
+ --border: var(--checkbox-mark-color);
62
+ --background: var(--checkbox-mark-background-color);
63
+ -webkit-appearance: none;
64
+ -moz-appearance: none;
65
+ height: 20px;
66
+ outline: none;
67
+ display: inline-block;
68
+ vertical-align: top;
69
+ position: relative;
70
+ margin: 0;
71
+ cursor: pointer;
72
+ border: 1px solid var(--bc, var(--border));
73
+ background: var(--b, var(--background));
74
+ transition: background 0.3s, border-color 0.3s, box-shadow 0.2s;
75
+ &:after {
76
+ content: '';
77
+ display: block;
78
+ left: 0;
79
+ top: 0;
80
+ position: absolute;
81
+ transition: transform var(--d-t, 0.3s) var(--d-t-e, ease),
82
+ opacity var(--d-o, 0.2s);
83
+ }
84
+ &:checked {
85
+ --b: var(--active);
86
+ --bc: var(--active);
87
+ --d-o: 0.3s;
88
+ --d-t: 0.6s;
89
+ --d-t-e: cubic-bezier(0.2, 0.85, 0.32, 1.2);
90
+ }
91
+ }
92
+ input[type='checkbox'] {
93
+ &.switch {
94
+ width: 35px;
95
+ border-radius: 11px;
96
+ &:after {
97
+ left: 2px;
98
+ top: 2px;
99
+ bottom: 2px;
100
+ border-radius: 50%;
101
+ width: 14px;
102
+ height: 14px;
103
+ border: 1px solid var(--bc, var(--border));
104
+ background: var(--ab, var(--border));
105
+ transform: translateX(var(--x, 0));
106
+ }
107
+ &:checked {
108
+ --ab: var(--active-inner);
109
+ --x: 14px;
110
+ }
111
+ }
112
+ }
113
+ </style>
@@ -0,0 +1,148 @@
1
+ <template>
2
+ <form
3
+ id="change-language-form"
4
+ class="compact change-default-console ng-valid ng-dirty ng-touched"
5
+ >
6
+ <div class="description">
7
+ {{ description }}
8
+ </div>
9
+
10
+ <div v-for="(item, key) in radioOptions" :key="key" class="radio">
11
+ <input
12
+ :id="item.label"
13
+ v-model="languageMode"
14
+ :data-id="item.testId"
15
+ type="radio"
16
+ :value="item.value"
17
+ @change="onChange"
18
+ />
19
+ <label :for="item.label"> {{ item.label }} </label>
20
+
21
+ <span v-if="item.selectLang" class="select select-lang">
22
+ <select
23
+ id="language-select"
24
+ v-model="selectedLanguageLocal"
25
+ :disabled="languageMode !== item.value"
26
+ data-id="language-select"
27
+ class="ng-touched ng-dirty ng-valid"
28
+ @change="onSelectLang"
29
+ >
30
+ <option
31
+ v-for="(item2, key2) in langOptions"
32
+ :key="key2"
33
+ :value="item2.value"
34
+ >
35
+ {{ item2.text }}
36
+ </option>
37
+ </select>
38
+ </span>
39
+ </div>
40
+ </form>
41
+ </template>
42
+
43
+ <script setup lang="ts">
44
+ import type { UI_T_LangValue, UI_T_Project } from '~/lib/models/types'
45
+ import type { UI_T_SelectedRadio } from '~/components/common/layout/theHeader/userMenu/modals/preferences/changeLanguage/lib/models/types'
46
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
47
+ import type {
48
+ UI_I_LanguageItem,
49
+ UI_I_RadioItemLang,
50
+ } from '~/components/common/layout/theHeader/userMenu/modals/preferences/changeLanguage/lib/models/interfaces'
51
+ import { UI_E_DetectSelectedRadio } from '~/components/common/layout/theHeader/userMenu/modals/preferences/changeLanguage/lib/models/enums'
52
+ import { langConfig } from '~/components/common/layout/theHeader/userMenu/modals/preferences/changeLanguage/lib/config/lang'
53
+ import { radioOptionsFunc } from '~/components/common/layout/theHeader/userMenu/modals/preferences/changeLanguage/lib/config/radioOptions'
54
+ import { defineBrowserLangFunc } from '~/components/common/layout/theHeader/lib/utils/localization'
55
+
56
+ const props = defineProps<{
57
+ selectedType: UI_T_LangValue
58
+ selectedLanguage: UI_T_LangValue
59
+ project: UI_T_Project
60
+ }>()
61
+
62
+ const emits = defineEmits<{
63
+ (event: 'update', value: string): void
64
+ (event: 'update-language-type', value: UI_T_SelectedRadio): void
65
+ (event: 'update-is-browser', value: string): void
66
+ }>()
67
+
68
+ const config = useRuntimeConfig()
69
+ const localization = computed<UI_I_Localization>(() => useLocal())
70
+
71
+ const description = computed<string>(() => {
72
+ return localization.value.languageDesc.replaceAll(
73
+ '{trademark}',
74
+ String(config.public[`TRADEMARK_${useEnvLanguage()}`])
75
+ )
76
+ })
77
+
78
+ const languageMode = ref<UI_T_SelectedRadio>(
79
+ UI_E_DetectSelectedRadio[props.selectedType]
80
+ )
81
+ const radioOptions = readonly<UI_I_RadioItemLang[]>(
82
+ radioOptionsFunc(localization.value)
83
+ )
84
+
85
+ const langOptions = ref<UI_I_LanguageItem[]>(langConfig)
86
+
87
+ const selectedLanguageLocal = ref<string>(props.selectedLanguage)
88
+
89
+ const setPreferenceLang = (language: string): void => {
90
+ let browserLang = language
91
+
92
+ language === 'BROWSER' && (browserLang = defineBrowserLangFunc())
93
+
94
+ if (props.project === 'sphere') {
95
+ const { $store }: any = useNuxtApp()
96
+
97
+ $store.dispatch('profile/A_PREFERENCES_FOR_CHANGING', {
98
+ language: browserLang,
99
+ })
100
+ } else if (props.project === 'procurator') {
101
+ emits('update', browserLang)
102
+ }
103
+ }
104
+
105
+ const onSelectLang = (): void => {
106
+ selectedLanguageLocal.value && setPreferenceLang(selectedLanguageLocal.value)
107
+ }
108
+
109
+ const onChange = (): void => {
110
+ const lang =
111
+ languageMode.value === 'LANG'
112
+ ? selectedLanguageLocal.value
113
+ : languageMode.value
114
+
115
+ lang && setPreferenceLang(lang)
116
+
117
+ props.project === 'sphere' &&
118
+ emits('update-language-type', languageMode.value)
119
+ }
120
+
121
+ const updateIsBrowser = (value: string): void => {
122
+ emits('update-is-browser', value)
123
+ }
124
+
125
+ watch(
126
+ languageMode,
127
+ (newValue) => {
128
+ newValue && updateIsBrowser(newValue)
129
+ },
130
+ { immediate: true }
131
+ )
132
+ </script>
133
+
134
+ <style lang="scss" scoped>
135
+ .radio {
136
+ margin-bottom: 5px;
137
+ &:nth-child(2) {
138
+ margin-top: 10px;
139
+ }
140
+ }
141
+ .select-lang {
142
+ margin-left: 3px;
143
+ height: 24px;
144
+ & > select {
145
+ height: 100%;
146
+ }
147
+ }
148
+ </style>
@@ -0,0 +1,10 @@
1
+ import type { UI_I_LanguageItem } from '~/components/common/layout/theHeader/userMenu/modals/preferences/changeLanguage/lib/models/interfaces'
2
+
3
+ export const langConfig: UI_I_LanguageItem[] = [
4
+ { text: 'Русский', value: 'ru_RU', lang: 'ru_RU' },
5
+ { text: 'English', value: 'en_US', lang: 'en_US' },
6
+ { text: 'Հայերեն', value: 'hy_AM', lang: 'hy_AM' },
7
+ { text: '简体中文', value: 'zh_CHS', lang: 'zh_CHS' },
8
+ { text: 'Қазақ', value: 'kk_KZ', lang: 'kk_KZ' },
9
+ { text: 'Беларускі', value: 'be_BY', lang: 'be_BY' },
10
+ ]