bfg-common 1.5.653 → 1.5.654

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 (106) hide show
  1. package/CODE_STYLE.md +109 -109
  2. package/assets/img/icons/icons-sprite-dark-3.svg +227 -227
  3. package/assets/img/icons/icons-sprite-dark-5.svg +488 -488
  4. package/assets/img/icons/icons-sprite-light-3.svg +227 -227
  5. package/assets/img/icons/icons-sprite-light-5.svg +488 -488
  6. package/assets/localization/local_be.json +4 -0
  7. package/assets/localization/local_en.json +4 -0
  8. package/assets/localization/local_hy.json +4 -0
  9. package/assets/localization/local_kk.json +4 -0
  10. package/assets/localization/local_ru.json +4 -0
  11. package/assets/localization/local_zh.json +4 -0
  12. package/components/atoms/TheIcon3.vue +50 -50
  13. package/components/atoms/collapse/CollapseNav.vue +170 -170
  14. package/components/atoms/perPage/PerPage.vue +58 -58
  15. package/components/atoms/table/dataGrid/DataGrid.vue +1718 -1718
  16. package/components/atoms/table/dataGrid/DataGridPagination.vue +97 -97
  17. package/components/atoms/table/dataGrid/lib/config/settingsTable.ts +94 -94
  18. package/components/atoms/table/dataGrid/lib/utils/export.ts +16 -16
  19. package/components/common/backup/storage/actions/add/lib/utils.ts +51 -51
  20. package/components/common/browse/blocks/contents/filesNew/Skeleton.vue +18 -18
  21. package/components/common/browse/blocks/lib/models/types.ts +1 -1
  22. package/components/common/browse/lib/models/interfaces.ts +5 -5
  23. package/components/common/diagramMain/network/Contents.vue +497 -497
  24. package/components/common/layout/theHeader/TheHeaderNew.vue +310 -310
  25. package/components/common/layout/theHeader/TheHeaderOld.vue +257 -257
  26. package/components/common/layout/theHeader/helpMenu/About.vue +79 -79
  27. package/components/common/layout/theHeader/helpMenu/aboutOld/AboutOld.vue +79 -79
  28. package/components/common/layout/theHeader/userMenu/modals/changePassword/ChangePassword.vue +99 -99
  29. package/components/common/layout/theHeader/userMenu/modals/changePassword/New.vue +193 -193
  30. package/components/common/layout/theHeader/userMenu/modals/preferences/lib/models/types.ts +7 -7
  31. package/components/common/layout/theHeader/userMenu/modals/preferences/security/Old.vue +120 -118
  32. package/components/common/layout/theHeader/userMenu/modals/preferences/security/Security.vue +23 -23
  33. package/components/common/pages/backups/DetailView.vue +52 -52
  34. package/components/common/pages/backups/lib/models/interfaces.ts +36 -36
  35. package/components/common/pages/backups/modals/Modals.vue +243 -243
  36. package/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/lib/config/options.ts +6 -6
  37. package/components/common/pages/backups/modals/createBackup/lib/config/readyToCompleteOptions.ts +69 -69
  38. package/components/common/pages/backups/modals/lib/config/restore.ts +115 -115
  39. package/components/common/pages/backups/modals/lib/models/interfaces.ts +186 -186
  40. package/components/common/pages/backups/modals/restore/name/lib/models/interfaces.ts +6 -6
  41. package/components/common/pages/home/lib/models/interfaces.ts +48 -48
  42. package/components/common/pages/home/widgets/hosts/Hosts.vue +27 -27
  43. package/components/common/pages/home/widgets/hosts/lib/config/items.ts +23 -23
  44. package/components/common/pages/home/widgets/vms/VmsOld.vue +35 -35
  45. package/components/common/pages/home/widgets/vms/lib/config/items.ts +19 -19
  46. package/components/common/pages/scheduledTasks/lib/utils/utils.ts +84 -84
  47. package/components/common/readyToComplete/ReadyToComplete.vue +17 -17
  48. package/components/common/select/radio/RadioGroup.vue +137 -137
  49. package/components/common/spiceConsole/Drawer.vue +420 -420
  50. package/components/common/spiceConsole/SpiceConsole.vue +184 -184
  51. package/components/common/spiceConsole/lib/models/interfaces.ts +5 -5
  52. package/components/common/tools/Actions.vue +207 -207
  53. package/components/common/treeView/TreeView.vue +52 -52
  54. package/components/common/vm/actions/clone/lib/config/steps.ts +295 -295
  55. package/components/common/vm/actions/clone/new/New.vue +438 -438
  56. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/shares/lib/config/options.ts +28 -28
  57. package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/Memory.vue +283 -283
  58. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Order.vue +156 -156
  59. package/components/common/vm/actions/common/select/compatibility/Old.vue +107 -107
  60. package/components/common/vm/actions/common/select/createType/lib/models/interfaces.ts +5 -5
  61. package/components/common/vm/actions/common/select/options/New.vue +263 -263
  62. package/components/common/vm/actions/common/select/options/Old.vue +109 -109
  63. package/components/common/vm/actions/common/select/options/Options.vue +58 -58
  64. package/components/common/vm/actions/common/select/storage/Old.vue +125 -125
  65. package/components/common/vm/actions/common/select/storage/new/New.vue +311 -311
  66. package/components/common/vm/actions/common/select/storage/new/lib/models/interfaces.ts +5 -5
  67. package/components/common/vm/actions/common/select/storage/new/lib/utils/utils.ts +21 -21
  68. package/components/common/vm/actions/common/select/template/old/Old.vue +50 -50
  69. package/components/common/vm/actions/editSettings/new/Skeleton.vue +88 -88
  70. package/components/common/wizards/common/compatibility/Compatibility.vue +35 -35
  71. package/components/common/wizards/common/compatibility/New.vue +99 -99
  72. package/components/common/wizards/common/compatibility/Old.vue +53 -53
  73. package/components/common/wizards/common/steps/computeResource/New.vue +93 -93
  74. package/components/common/wizards/common/steps/name/Name.vue +178 -178
  75. package/components/common/wizards/common/steps/name/New.vue +221 -221
  76. package/components/common/wizards/common/steps/name/Old.vue +121 -121
  77. package/components/common/wizards/common/steps/name/lib/models/interfaces.ts +4 -4
  78. package/components/common/wizards/common/steps/name/location/New.vue +40 -40
  79. package/components/common/wizards/datastore/add/Add.vue +228 -228
  80. package/components/common/wizards/datastore/add/lib/utils.ts +85 -85
  81. package/components/common/wizards/datastore/add/steps/typeMode/lib/config/typeOptions.ts +43 -43
  82. package/components/common/wizards/network/add/Add.vue +870 -870
  83. package/composables/useAppVersion.ts +21 -21
  84. package/composables/useLocal.ts +6 -6
  85. package/composables/useLocalCommon.ts +39 -39
  86. package/lib/models/interfaces.ts +1 -0
  87. package/package.json +1 -1
  88. package/plugins/console.ts +21 -21
  89. package/plugins/mouse.ts +21 -21
  90. package/plugins/panelStates.ts +70 -70
  91. package/plugins/text.ts +59 -59
  92. package/plugins/time.ts +58 -58
  93. package/public/spice-console/application/clientgui.js +854 -854
  94. package/public/spice-console/application/packetfactory.js +211 -211
  95. package/public/spice-console/application/virtualmouse.js +147 -147
  96. package/public/spice-console/lib/images/bitmap.js +203 -203
  97. package/public/spice-console/network/spicechannel.js +440 -440
  98. package/public/spice-console/process/cursorprocess.js +128 -128
  99. package/public/spice-console/process/inputprocess.js +227 -227
  100. package/public/spice-console/process/mainprocess.js +212 -212
  101. package/public/spice-console/run.js +210 -210
  102. package/store/main/mutations.ts +7 -7
  103. package/store/main/state.ts +7 -7
  104. package/store/tasks/actions.ts +165 -165
  105. package/store/tasks/mappers/recentTasks.ts +123 -123
  106. package/store/tasks/mutations.ts +82 -82
@@ -1,193 +1,193 @@
1
- <template>
2
- <ui-modal
3
- :title="localization.common.changePassword"
4
- :texts="modalTexts"
5
- :subtitle="props.subtitle"
6
- width="560px"
7
- test-id="change-password-modal"
8
- show
9
- @submit="onSubmit"
10
- @hide="onHideModal"
11
- >
12
- <template #content>
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
- <p class="change-password__description">
24
- {{ description }}
25
- </p>
26
-
27
- <div class="change-password__form">
28
- <ui-input
29
- v-model="modelLocal.current_password"
30
- :label="localization.common.currentPassword"
31
- :error="passwordErrorText"
32
- :autocomplete="'new-password'"
33
- type="password"
34
- test-id="change-password-password-field"
35
- />
36
-
37
- <ui-input
38
- v-model="modelLocal.new_password"
39
- :label="localization.common.newPassword"
40
- :error="newPasswordErrorText"
41
- test-id="change-password-new-password-field"
42
- type="password"
43
- />
44
-
45
- <ui-input
46
- v-model="modelLocal.confirm_password"
47
- :label="localization.common.confirmNewPassword"
48
- :error="confirmPasswordErrorText"
49
- test-id="change-password-confirm-password-field"
50
- type="password"
51
- />
52
- </div>
53
- </ui-modal-block-standard>
54
- </template>
55
-
56
- <template #footerLeftContent><span /></template>
57
- </ui-modal>
58
- </template>
59
-
60
- <script setup lang="ts">
61
- import type { UI_I_ModalTexts } from '~/node_modules/bfg-uikit/components/ui/modal/models/interfaces'
62
- import type { UI_I_Localization } from '~/lib/models/interfaces'
63
- import type { UI_I_ChangePasswordForm } from '~/components/common/layout/theHeader/userMenu/modals/changePassword/lib/models/interfaces'
64
- import type { UI_T_Project } from '~/lib/models/types'
65
- import type { UI_I_InitialValidationFields } from '~/components/common/layout/theHeader/userMenu/modals/changePassword/lib/models/interfaces'
66
- import {
67
- validateField,
68
- getPasswordMismatchError,
69
- } from '~/components/common/layout/theHeader/userMenu/modals/changePassword/lib/utils'
70
-
71
- const props = defineProps<{
72
- project: UI_T_Project
73
- subtitle: string
74
- firstTime: boolean
75
- }>()
76
- const emits = defineEmits<{
77
- (event: 'hide'): void
78
- (event: 'change-password'): void
79
- }>()
80
- const modelLocal = defineModel<UI_I_ChangePasswordForm>({ required: true })
81
-
82
- const localization = computed<UI_I_Localization>(() => useLocal())
83
-
84
- const description = ref<string>(props.firstTime
85
- ? localization.value.common.firstTimeChangePasswordDesc
86
- : localization.value.common.changePasswordDesc)
87
-
88
- const modalTexts = computed<UI_I_ModalTexts>(() => {
89
- return {
90
- button1: localization.value.common.cancel,
91
- button2: localization.value.common.save,
92
- }
93
- })
94
-
95
- const alertErrorText = ref<string>('')
96
- const initValidationFields = ref<UI_I_InitialValidationFields>({
97
- currentPassword: false,
98
- newPassword: false,
99
- confirmPassword: false,
100
- })
101
- const initValidation = (types: string[]): boolean => {
102
- types.forEach((type) => (initValidationFields.value[type] = true))
103
-
104
- return (
105
- !!passwordErrorText.value ||
106
- !!newPasswordErrorText.value ||
107
- !!confirmPasswordErrorText.value
108
- )
109
- }
110
-
111
- const passwordErrorText = computed<string>(() => {
112
- if (!initValidationFields.value.currentPassword) return ''
113
-
114
- return !modelLocal.value.current_password
115
- ? localization.value.common.fieldRequired
116
- : ''
117
- })
118
- const newPasswordErrorText = computed<string>(() => {
119
- if (!initValidationFields.value.newPassword) return ''
120
-
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
- )
129
- })
130
- const confirmPasswordErrorText = computed<string>(() => {
131
- if (!initValidationFields.value.confirmPassword) return ''
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
- )
140
- })
141
- const onSubmit = (): void => {
142
- const isFieldValid = initValidation([
143
- 'currentPassword',
144
- 'newPassword',
145
- 'confirmPassword',
146
- ])
147
-
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')
159
- }
160
- const onHideModal = (): void => {
161
- emits('hide')
162
- }
163
- </script>
164
-
165
- <style lang="scss" scoped>
166
- @import 'assets/scss/common/mixins.scss';
167
- .modal-container-standard {
168
- padding-top: 8px;
169
- padding-bottom: 8px;
170
-
171
- .change-password {
172
- &__description {
173
- color: #9da6ad;
174
- font-size: 12px;
175
- font-weight: 400;
176
- line-height: 14.52px;
177
- margin-bottom: 20px;
178
- }
179
- &__alert {
180
- padding: 10px 12px;
181
- margin-bottom: 12px;
182
- :deep(svg) {
183
- width: 16px;
184
- height: 16px;
185
- }
186
- }
187
- &__form {
188
- @include flex($dir: column);
189
- row-gap: 16px;
190
- }
191
- }
192
- }
193
- </style>
1
+ <template>
2
+ <ui-modal
3
+ :title="localization.common.changePassword"
4
+ :texts="modalTexts"
5
+ :subtitle="props.subtitle"
6
+ width="560px"
7
+ test-id="change-password-modal"
8
+ show
9
+ @submit="onSubmit"
10
+ @hide="onHideModal"
11
+ >
12
+ <template #content>
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
+ <p class="change-password__description">
24
+ {{ description }}
25
+ </p>
26
+
27
+ <div class="change-password__form">
28
+ <ui-input
29
+ v-model="modelLocal.current_password"
30
+ :label="localization.common.currentPassword"
31
+ :error="passwordErrorText"
32
+ :autocomplete="'new-password'"
33
+ type="password"
34
+ test-id="change-password-password-field"
35
+ />
36
+
37
+ <ui-input
38
+ v-model="modelLocal.new_password"
39
+ :label="localization.common.newPassword"
40
+ :error="newPasswordErrorText"
41
+ test-id="change-password-new-password-field"
42
+ type="password"
43
+ />
44
+
45
+ <ui-input
46
+ v-model="modelLocal.confirm_password"
47
+ :label="localization.common.confirmNewPassword"
48
+ :error="confirmPasswordErrorText"
49
+ test-id="change-password-confirm-password-field"
50
+ type="password"
51
+ />
52
+ </div>
53
+ </ui-modal-block-standard>
54
+ </template>
55
+
56
+ <template #footerLeftContent><span /></template>
57
+ </ui-modal>
58
+ </template>
59
+
60
+ <script setup lang="ts">
61
+ import type { UI_I_ModalTexts } from '~/node_modules/bfg-uikit/components/ui/modal/models/interfaces'
62
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
63
+ import type { UI_I_ChangePasswordForm } from '~/components/common/layout/theHeader/userMenu/modals/changePassword/lib/models/interfaces'
64
+ import type { UI_T_Project } from '~/lib/models/types'
65
+ import type { UI_I_InitialValidationFields } from '~/components/common/layout/theHeader/userMenu/modals/changePassword/lib/models/interfaces'
66
+ import {
67
+ validateField,
68
+ getPasswordMismatchError,
69
+ } from '~/components/common/layout/theHeader/userMenu/modals/changePassword/lib/utils'
70
+
71
+ const props = defineProps<{
72
+ project: UI_T_Project
73
+ subtitle: string
74
+ firstTime: boolean
75
+ }>()
76
+ const emits = defineEmits<{
77
+ (event: 'hide'): void
78
+ (event: 'change-password'): void
79
+ }>()
80
+ const modelLocal = defineModel<UI_I_ChangePasswordForm>({ required: true })
81
+
82
+ const localization = computed<UI_I_Localization>(() => useLocal())
83
+
84
+ const description = ref<string>(props.firstTime
85
+ ? localization.value.common.firstTimeChangePasswordDesc
86
+ : localization.value.common.changePasswordDesc)
87
+
88
+ const modalTexts = computed<UI_I_ModalTexts>(() => {
89
+ return {
90
+ button1: localization.value.common.cancel,
91
+ button2: localization.value.common.save,
92
+ }
93
+ })
94
+
95
+ const alertErrorText = ref<string>('')
96
+ const initValidationFields = ref<UI_I_InitialValidationFields>({
97
+ currentPassword: false,
98
+ newPassword: false,
99
+ confirmPassword: false,
100
+ })
101
+ const initValidation = (types: string[]): boolean => {
102
+ types.forEach((type) => (initValidationFields.value[type] = true))
103
+
104
+ return (
105
+ !!passwordErrorText.value ||
106
+ !!newPasswordErrorText.value ||
107
+ !!confirmPasswordErrorText.value
108
+ )
109
+ }
110
+
111
+ const passwordErrorText = computed<string>(() => {
112
+ if (!initValidationFields.value.currentPassword) return ''
113
+
114
+ return !modelLocal.value.current_password
115
+ ? localization.value.common.fieldRequired
116
+ : ''
117
+ })
118
+ const newPasswordErrorText = computed<string>(() => {
119
+ if (!initValidationFields.value.newPassword) return ''
120
+
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
+ )
129
+ })
130
+ const confirmPasswordErrorText = computed<string>(() => {
131
+ if (!initValidationFields.value.confirmPassword) return ''
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
+ )
140
+ })
141
+ const onSubmit = (): void => {
142
+ const isFieldValid = initValidation([
143
+ 'currentPassword',
144
+ 'newPassword',
145
+ 'confirmPassword',
146
+ ])
147
+
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')
159
+ }
160
+ const onHideModal = (): void => {
161
+ emits('hide')
162
+ }
163
+ </script>
164
+
165
+ <style lang="scss" scoped>
166
+ @import 'assets/scss/common/mixins.scss';
167
+ .modal-container-standard {
168
+ padding-top: 8px;
169
+ padding-bottom: 8px;
170
+
171
+ .change-password {
172
+ &__description {
173
+ color: #9da6ad;
174
+ font-size: 12px;
175
+ font-weight: 400;
176
+ line-height: 14.52px;
177
+ margin-bottom: 20px;
178
+ }
179
+ &__alert {
180
+ padding: 10px 12px;
181
+ margin-bottom: 12px;
182
+ :deep(svg) {
183
+ width: 16px;
184
+ height: 16px;
185
+ }
186
+ }
187
+ &__form {
188
+ @include flex($dir: column);
189
+ row-gap: 16px;
190
+ }
191
+ }
192
+ }
193
+ </style>
@@ -1,7 +1,7 @@
1
- export type UI_T_UserPreferenceTab =
2
- | 'time-tab'
3
- | 'language-tab'
4
- | 'console-tab'
5
- | 'inventory-tab'
6
- | 'security-tab'
7
- | 'view-tab'
1
+ export type UI_T_UserPreferenceTab =
2
+ | 'time-tab'
3
+ | 'language-tab'
4
+ | 'console-tab'
5
+ | 'inventory-tab'
6
+ | 'security-tab'
7
+ | 'view-tab'
@@ -1,118 +1,120 @@
1
- <template>
2
- <form id="security-form" class="compact">
3
- <div class="description">Two-Factor Authentication</div>
4
-
5
- <div class="flex-align-center">
6
- <label for="security"
7
- >Add an extra layer of security to your account</label
8
- >
9
- <input id="security" v-model="security" type="checkbox" class="switch" />
10
- </div>
11
-
12
- <div v-if="props.recoveryCodes.length" class="recovery-codes">
13
- <label>Recovery codes:</label>
14
- <ul class="recovery-codes-list">
15
- <li
16
- v-for="item in props.recoveryCodes"
17
- :key="item"
18
- class="recovery-codes-list-item"
19
- >
20
- {{ item }}
21
- </li>
22
- </ul>
23
- </div>
24
- </form>
25
- </template>
26
-
27
- <script setup lang="ts">
28
- // import type { UI_I_Localization } from '~/lib/models/interfaces'
29
-
30
- const props = defineProps<{
31
- recoveryCodes: string[]
32
- }>()
33
-
34
- // const localization = computed<UI_I_Localization>(() => useLocal())
35
-
36
- const security = defineModel<boolean>('security')
37
-
38
- // const isDisabled = ref<boolean>(true)
39
- </script>
40
-
41
- <style lang="scss" scoped>
42
- .description {
43
- margin-bottom: 10px;
44
- }
45
-
46
- .recovery-codes {
47
- display: flex;
48
- margin-top: 10px;
49
-
50
- .recovery-codes-list-item {
51
- font-size: 12px;
52
- }
53
- }
54
-
55
- label {
56
- margin-right: 6px;
57
- }
58
-
59
- input[type='checkbox'] {
60
- --active: var(--checkbox-value-active-color);
61
- --active-inner: var(--checkbox-mark-color);
62
- --border: var(--checkbox-mark-color);
63
- --background: var(--checkbox-mark-background-color);
64
- -webkit-appearance: none;
65
- -moz-appearance: none;
66
- height: 20px;
67
- outline: none;
68
- display: inline-block;
69
- vertical-align: top;
70
- position: relative;
71
- margin: 0;
72
- cursor: pointer;
73
- border: 1px solid var(--bc, var(--border));
74
- background: var(--b, var(--background));
75
- transition: background 0.3s, border-color 0.3s, box-shadow 0.2s;
76
- &:after {
77
- content: '';
78
- display: block;
79
- left: 0;
80
- top: 0;
81
- position: absolute;
82
- transition: transform var(--d-t, 0.3s) var(--d-t-e, ease),
83
- opacity var(--d-o, 0.2s);
84
- }
85
- &:checked {
86
- --b: var(--active);
87
- --bc: var(--active);
88
- --d-o: 0.3s;
89
- --d-t: 0.6s;
90
- --d-t-e: cubic-bezier(0.2, 0.85, 0.32, 1.2);
91
- }
92
- }
93
- input[type='checkbox'] {
94
- &.switch {
95
- width: 35px;
96
- border-radius: 11px;
97
- &:after {
98
- left: 2px;
99
- top: 2px;
100
- bottom: 2px;
101
- border-radius: 50%;
102
- width: 14px;
103
- height: 14px;
104
- border: 1px solid var(--bc, var(--border));
105
- background: var(--ab, var(--border));
106
- transform: translateX(var(--x, 0));
107
- }
108
- &:checked {
109
- --ab: var(--active-inner);
110
- --x: 14px;
111
- }
112
- &:disabled {
113
- cursor: not-allowed;
114
- opacity: 0.5;
115
- }
116
- }
117
- }
118
- </style>
1
+ <template>
2
+ <form id="security-form" class="compact">
3
+ <div class="description">
4
+ {{ localization.myPreferences.twoFactorAuthentication }}
5
+ </div>
6
+
7
+ <div class="flex-align-center">
8
+ <label for="security">{{
9
+ localization.myPreferences.securityLabel
10
+ }}</label>
11
+ <input id="security" v-model="security" type="checkbox" class="switch" />
12
+ </div>
13
+
14
+ <div v-if="props.recoveryCodes.length" class="recovery-codes">
15
+ <!-- TODO-->
16
+ <label>Recovery codes:</label>
17
+ <ul class="recovery-codes-list">
18
+ <li
19
+ v-for="item in props.recoveryCodes"
20
+ :key="item"
21
+ class="recovery-codes-list-item"
22
+ >
23
+ {{ item }}
24
+ </li>
25
+ </ul>
26
+ </div>
27
+ </form>
28
+ </template>
29
+
30
+ <script setup lang="ts">
31
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
32
+
33
+ const props = defineProps<{
34
+ recoveryCodes: string[]
35
+ }>()
36
+
37
+ const localization = computed<UI_I_Localization>(() => useLocal())
38
+
39
+ const security = defineModel<boolean>('security')
40
+ </script>
41
+
42
+ <style lang="scss" scoped>
43
+ .description {
44
+ margin-bottom: 10px;
45
+ }
46
+
47
+ .recovery-codes {
48
+ display: flex;
49
+ margin-top: 10px;
50
+
51
+ .recovery-codes-list-item {
52
+ font-size: 12px;
53
+ }
54
+ }
55
+
56
+ label {
57
+ margin-right: 6px;
58
+ }
59
+
60
+ // TODO повторяется в ../view, необходимо вынести глобально
61
+ input[type='checkbox'] {
62
+ --active: var(--checkbox-value-active-color);
63
+ --active-inner: var(--checkbox-mark-color);
64
+ --border: var(--checkbox-mark-color);
65
+ --background: var(--checkbox-mark-background-color);
66
+ -webkit-appearance: none;
67
+ -moz-appearance: none;
68
+ height: 20px;
69
+ outline: none;
70
+ display: inline-block;
71
+ vertical-align: top;
72
+ position: relative;
73
+ margin: 0;
74
+ cursor: pointer;
75
+ border: 1px solid var(--bc, var(--border));
76
+ background: var(--b, var(--background));
77
+ transition: background 0.3s, border-color 0.3s, box-shadow 0.2s;
78
+ &:after {
79
+ content: '';
80
+ display: block;
81
+ left: 0;
82
+ top: 0;
83
+ position: absolute;
84
+ transition: transform var(--d-t, 0.3s) var(--d-t-e, ease),
85
+ opacity var(--d-o, 0.2s);
86
+ }
87
+ &:checked {
88
+ --b: var(--active);
89
+ --bc: var(--active);
90
+ --d-o: 0.3s;
91
+ --d-t: 0.6s;
92
+ --d-t-e: cubic-bezier(0.2, 0.85, 0.32, 1.2);
93
+ }
94
+ }
95
+ input[type='checkbox'] {
96
+ &.switch {
97
+ width: 35px;
98
+ border-radius: 11px;
99
+ &:after {
100
+ left: 2px;
101
+ top: 2px;
102
+ bottom: 2px;
103
+ border-radius: 50%;
104
+ width: 14px;
105
+ height: 14px;
106
+ border: 1px solid var(--bc, var(--border));
107
+ background: var(--ab, var(--border));
108
+ transform: translateX(var(--x, 0));
109
+ }
110
+ &:checked {
111
+ --ab: var(--active-inner);
112
+ --x: 14px;
113
+ }
114
+ &:disabled {
115
+ cursor: not-allowed;
116
+ opacity: 0.5;
117
+ }
118
+ }
119
+ }
120
+ </style>