bfg-common 1.4.315 → 1.4.316
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.
- package/assets/localization/local_be.json +5 -1
- package/assets/localization/local_en.json +5 -1
- package/assets/localization/local_hy.json +5 -1
- package/assets/localization/local_kk.json +5 -1
- package/assets/localization/local_ru.json +5 -1
- package/assets/localization/local_zh.json +5 -1
- package/components/common/layout/theHeader/userMenu/UserMenu.vue +5 -4
- package/components/common/layout/theHeader/userMenu/modals/changePassword/ChangePassword.vue +27 -151
- package/components/common/layout/theHeader/userMenu/modals/changePassword/ChangePasswordNew.vue +134 -0
- package/components/common/layout/theHeader/userMenu/modals/changePassword/ChangePasswordOld.vue +209 -0
- package/components/common/monitor/advanced/tools/chartOptionsModal/metrics/lib/config/optionsMetrics.ts +5 -5
- package/components/common/pages/scheduledTasks/modals/common/frequency/end/End.vue +0 -2
- package/components/common/pages/scheduledTasks/modals/common/frequency/lib/utils.ts +2 -7
- package/components/common/pages/scheduledTasks/modals/common/frequency/on/On.vue +7 -10
- package/components/common/pages/scheduledTasks/modals/common/frequency/on/lib/config/options.ts +12 -12
- package/components/common/pages/scheduledTasks/modals/common/newTaskForm/NewTaskForm.vue +74 -11
- package/components/common/pages/scheduledTasks/modals/lib/config/createScheduledTask.ts +4 -5
- package/components/common/pages/scheduledTasks/modals/lib/models/interfaces.ts +3 -4
- package/package.json +1 -1
- package/components/common/pages/scheduledTasks/modals/common/newTaskForm/lib/utils.ts +0 -67
|
@@ -2216,7 +2216,11 @@
|
|
|
2216
2216
|
"or": "або",
|
|
2217
2217
|
"hrs": "гадз",
|
|
2218
2218
|
"mins": "мін",
|
|
2219
|
-
"secs": "сек"
|
|
2219
|
+
"secs": "сек",
|
|
2220
|
+
"thePasswordsDoNotMatch": "Паролі не супадаюць",
|
|
2221
|
+
"changePasswordDesc": "Каб захаваць ваш уліковы запіс у бяспецы, упэўніцеся, што ваш новы пароль адрозніваецца ад любога з вашых папярэдніх пароляў.",
|
|
2222
|
+
"changePasswordPreviouslyUsed": "Ваш новы пароль выкарыстоўваўся раней. ",
|
|
2223
|
+
"currentPasswordIncorrect": "Бягучы пароль няправільны. "
|
|
2220
2224
|
},
|
|
2221
2225
|
"auth": {
|
|
2222
2226
|
"welcomeTo": "Сардэчна запрашаем у",
|
|
@@ -2220,7 +2220,11 @@
|
|
|
2220
2220
|
"or": "Or",
|
|
2221
2221
|
"hrs": "hrs",
|
|
2222
2222
|
"mins": "mins",
|
|
2223
|
-
"secs": "secs"
|
|
2223
|
+
"secs": "secs",
|
|
2224
|
+
"thePasswordsDoNotMatch": "The passwords do not match",
|
|
2225
|
+
"changePasswordDesc": "To keep your account secure, please make sure that your new password is different from any of your previous passwords.",
|
|
2226
|
+
"changePasswordPreviouslyUsed": "Your new password has been previously used. Please choose a different one.",
|
|
2227
|
+
"currentPasswordIncorrect": "Current password is incorrect. Please try again."
|
|
2224
2228
|
},
|
|
2225
2229
|
"auth": {
|
|
2226
2230
|
"welcomeTo": "Welcome to",
|
|
@@ -2220,7 +2220,11 @@
|
|
|
2220
2220
|
"or": "կամ",
|
|
2221
2221
|
"hrs": "ժ",
|
|
2222
2222
|
"mins": "րոպե",
|
|
2223
|
-
"secs": "վրկ"
|
|
2223
|
+
"secs": "վրկ",
|
|
2224
|
+
"thePasswordsDoNotMatch": "Գաղտնաբառերը չեն համընկնում",
|
|
2225
|
+
"changePasswordDesc": "Ձեր հաշիվն ապահով պահելու համար համոզվեք, որ ձեր նոր գաղտնաբառը տարբերվում է ձեր նախկին գաղտնաբառերից:",
|
|
2226
|
+
"changePasswordPreviouslyUsed": "Ձեր նոր գաղտնաբառը նախկինում օգտագործվել է: ",
|
|
2227
|
+
"currentPasswordIncorrect": "Ընթացիկ գաղտնաբառը սխալ է: "
|
|
2224
2228
|
},
|
|
2225
2229
|
"auth": {
|
|
2226
2230
|
"welcomeTo": "Բարի գալուստ",
|
|
@@ -2219,7 +2219,11 @@
|
|
|
2219
2219
|
"or": "немесе",
|
|
2220
2220
|
"hrs": "сағ",
|
|
2221
2221
|
"mins": "мин",
|
|
2222
|
-
"secs": "сек"
|
|
2222
|
+
"secs": "сек",
|
|
2223
|
+
"thePasswordsDoNotMatch": "Құпия сөздер сәйкес келмейді",
|
|
2224
|
+
"changePasswordDesc": "Тіркелгіңізді қауіпсіз сақтау үшін жаңа құпия сөзіңіздің бұрынғы құпия сөздеріңізден басқаша екеніне көз жеткізіңіз.",
|
|
2225
|
+
"changePasswordPreviouslyUsed": "Жаңа құпия сөзіңіз бұрын қолданылған. ",
|
|
2226
|
+
"currentPasswordIncorrect": "Ағымдағы құпия сөз дұрыс емес. "
|
|
2223
2227
|
},
|
|
2224
2228
|
"auth": {
|
|
2225
2229
|
"welcomeTo": "Қош келдіңіз",
|
|
@@ -2222,7 +2222,11 @@
|
|
|
2222
2222
|
"or": "или",
|
|
2223
2223
|
"hrs": "час",
|
|
2224
2224
|
"mins": "мин",
|
|
2225
|
-
"secs": "сек"
|
|
2225
|
+
"secs": "сек",
|
|
2226
|
+
"thePasswordsDoNotMatch": "Пароли не совпадают",
|
|
2227
|
+
"changePasswordDesc": "Чтобы обеспечить безопасность вашей учетной записи, убедитесь, что ваш новый пароль отличается от любого из ваших предыдущих паролей.",
|
|
2228
|
+
"changePasswordPreviouslyUsed": "Ваш новый пароль уже использовался ранее. ",
|
|
2229
|
+
"currentPasswordIncorrect": "Текущий пароль неверен. "
|
|
2226
2230
|
},
|
|
2227
2231
|
"auth": {
|
|
2228
2232
|
"welcomeTo": "Добро пожаловать в",
|
|
@@ -2218,7 +2218,11 @@
|
|
|
2218
2218
|
"or": "或者",
|
|
2219
2219
|
"hrs": "小时",
|
|
2220
2220
|
"mins": "分钟",
|
|
2221
|
-
"secs": "秒"
|
|
2221
|
+
"secs": "秒",
|
|
2222
|
+
"thePasswordsDoNotMatch": "密码不匹配",
|
|
2223
|
+
"changePasswordDesc": "为了确保您的帐户安全,请确保您的新密码与之前的密码不同。",
|
|
2224
|
+
"changePasswordPreviouslyUsed": "您的新密码之前已被使用过。",
|
|
2225
|
+
"currentPasswordIncorrect": "当前密码不正确。"
|
|
2222
2226
|
},
|
|
2223
2227
|
"auth": {
|
|
2224
2228
|
"welcomeTo": "欢迎来到",
|
|
@@ -12,10 +12,11 @@
|
|
|
12
12
|
|
|
13
13
|
<Teleport to="body">
|
|
14
14
|
<common-layout-the-header-user-menu-modals-change-password
|
|
15
|
-
|
|
15
|
+
v-if="isShowChangePasswordModal"
|
|
16
|
+
v-model="isShowChangePasswordModal"
|
|
17
|
+
:new-view="props.newView"
|
|
16
18
|
:hostname="props.hostname"
|
|
17
19
|
:project="props.project"
|
|
18
|
-
@hide="isChangePassword = false"
|
|
19
20
|
/>
|
|
20
21
|
|
|
21
22
|
<common-layout-the-header-user-menu-modals-preferences
|
|
@@ -74,7 +75,7 @@ const emits = defineEmits<{
|
|
|
74
75
|
|
|
75
76
|
const { $store }: any = useNuxtApp()
|
|
76
77
|
|
|
77
|
-
const
|
|
78
|
+
const isShowChangePasswordModal = ref<boolean>(false)
|
|
78
79
|
|
|
79
80
|
const onLogout = async (): Promise<void> => {
|
|
80
81
|
await $store.dispatch('auth/A_LOGOUT', null)
|
|
@@ -83,7 +84,7 @@ const onLogout = async (): Promise<void> => {
|
|
|
83
84
|
const onSelectDropdown = (value: string): void => {
|
|
84
85
|
switch (value) {
|
|
85
86
|
case 'changePassword':
|
|
86
|
-
|
|
87
|
+
isShowChangePasswordModal.value = true
|
|
87
88
|
break
|
|
88
89
|
case 'preferences':
|
|
89
90
|
emits('show-preference')
|
package/components/common/layout/theHeader/userMenu/modals/changePassword/ChangePassword.vue
CHANGED
|
@@ -1,88 +1,21 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
:
|
|
6
|
-
:
|
|
7
|
-
:second-title="props.hostname"
|
|
8
|
-
:disabled-submit="buttonDisabled"
|
|
2
|
+
<common-layout-the-header-user-menu-modals-change-password-new
|
|
3
|
+
v-if="newView"
|
|
4
|
+
v-model="form"
|
|
5
|
+
:subtitle="props.hostname"
|
|
6
|
+
:project="props.project"
|
|
9
7
|
@hide="onHideModal"
|
|
10
|
-
@
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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.common.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.common.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>
|
|
8
|
+
@change-password="onChangePassword"
|
|
9
|
+
/>
|
|
10
|
+
|
|
11
|
+
<common-layout-the-header-user-menu-modals-change-password-old
|
|
12
|
+
v-else
|
|
13
|
+
v-model="form"
|
|
14
|
+
:hostname="props.hostname"
|
|
15
|
+
:project="props.project"
|
|
16
|
+
@hide="onHideModal"
|
|
17
|
+
@apply="onChangePassword"
|
|
18
|
+
/>
|
|
86
19
|
</template>
|
|
87
20
|
|
|
88
21
|
<script setup lang="ts">
|
|
@@ -93,60 +26,30 @@ import type {
|
|
|
93
26
|
UI_I_FormChangePassword,
|
|
94
27
|
} from '~/components/common/layout/theHeader/userMenu/modals/changePassword/lib/models/interfaces'
|
|
95
28
|
import type { UI_T_Project } from '~/lib/models/types'
|
|
96
|
-
import { defaultFormFunc } from '~/components/common/layout/theHeader/userMenu/modals/changePassword/lib/config/form'
|
|
97
29
|
|
|
98
30
|
const props = defineProps<{
|
|
99
|
-
|
|
31
|
+
newView: boolean
|
|
100
32
|
hostname: string
|
|
101
33
|
project: UI_T_Project
|
|
102
34
|
}>()
|
|
103
|
-
const
|
|
104
|
-
(event: 'hide'): void
|
|
105
|
-
}>()
|
|
35
|
+
const isShowModalLocal = defineModel<boolean>({ required: true })
|
|
106
36
|
|
|
107
37
|
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
108
|
-
const { $store
|
|
109
|
-
const validation = $validation.call({})
|
|
38
|
+
const { $store }: any = useNuxtApp()
|
|
110
39
|
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
-
)
|
|
40
|
+
const form = ref<UI_I_FormChangePassword>({
|
|
41
|
+
password: '',
|
|
42
|
+
new_password: '',
|
|
43
|
+
confirm_password: '',
|
|
130
44
|
})
|
|
131
|
-
|
|
132
45
|
const onChangePassword = async (): Promise<void> => {
|
|
133
|
-
const
|
|
134
|
-
const { newPassword, password } = form.value
|
|
135
|
-
|
|
136
|
-
if (newPassword.value === password.value) {
|
|
137
|
-
showValidationErrors(localization.value.common.newPasswordMustDifferentOld)
|
|
138
|
-
return
|
|
139
|
-
}
|
|
140
|
-
if (!valid.isValid) {
|
|
141
|
-
showValidationErrors(valid.errors.confirmPassword[0])
|
|
142
|
-
return
|
|
143
|
-
}
|
|
46
|
+
const { new_password, password } = form.value
|
|
144
47
|
|
|
145
48
|
onHideModal()
|
|
146
49
|
|
|
147
50
|
const sendData: UI_I_ChangePasswordBodyRequest = {
|
|
148
|
-
current_password: password
|
|
149
|
-
new_password:
|
|
51
|
+
current_password: password,
|
|
52
|
+
new_password: new_password,
|
|
150
53
|
}
|
|
151
54
|
|
|
152
55
|
let url = ''
|
|
@@ -177,34 +80,7 @@ const onChangePassword = async (): Promise<void> => {
|
|
|
177
80
|
})
|
|
178
81
|
}
|
|
179
82
|
}
|
|
180
|
-
|
|
181
|
-
const showValidationErrors = (text: string): void => {
|
|
182
|
-
isValid.value = true
|
|
183
|
-
errorText.value = text
|
|
184
|
-
}
|
|
185
|
-
|
|
186
83
|
const onHideModal = (): void => {
|
|
187
|
-
|
|
188
|
-
setForm()
|
|
189
|
-
isValid.value = false
|
|
84
|
+
isShowModalLocal.value = false
|
|
190
85
|
}
|
|
191
86
|
</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>
|
package/components/common/layout/theHeader/userMenu/modals/changePassword/ChangePasswordNew.vue
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ui-modal
|
|
3
|
+
test-id="change-password-modal"
|
|
4
|
+
width="560px"
|
|
5
|
+
:title="localization.common.changePassword"
|
|
6
|
+
:subtitle="props.subtitle"
|
|
7
|
+
class="change-password"
|
|
8
|
+
@submit="onSubmit"
|
|
9
|
+
>
|
|
10
|
+
<template #content>
|
|
11
|
+
<ui-modal-block-standard>
|
|
12
|
+
<ui-alert
|
|
13
|
+
v-if="errorText"
|
|
14
|
+
test-id="change-password-error-alert"
|
|
15
|
+
type="error"
|
|
16
|
+
hide-close-button
|
|
17
|
+
:messages="[errorText]"
|
|
18
|
+
class="change-password__alert"
|
|
19
|
+
/>
|
|
20
|
+
|
|
21
|
+
<p class="change-password__description">
|
|
22
|
+
To keep your account secure, please make sure that your new password
|
|
23
|
+
is different from any of your previous passwords.
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
<div class="change-password__form">
|
|
27
|
+
<ui-input
|
|
28
|
+
v-model="modelLocal.current_password"
|
|
29
|
+
test-id="change-password-password-field"
|
|
30
|
+
:label="localization.auth.password"
|
|
31
|
+
:error="passwordErrorText"
|
|
32
|
+
type="password"
|
|
33
|
+
></ui-input>
|
|
34
|
+
|
|
35
|
+
<ui-input
|
|
36
|
+
v-model="modelLocal.new_password"
|
|
37
|
+
test-id="change-password-new-password-field"
|
|
38
|
+
:label="localization.common.newPassword"
|
|
39
|
+
:error="newPasswordErrorText"
|
|
40
|
+
type="password"
|
|
41
|
+
></ui-input>
|
|
42
|
+
|
|
43
|
+
<ui-input
|
|
44
|
+
v-model="modelLocal.confirm_password"
|
|
45
|
+
test-id="change-password-confirm-password-field"
|
|
46
|
+
:label="localization.common.confirmPassword"
|
|
47
|
+
:error="confirmPasswordErrorText"
|
|
48
|
+
type="password"
|
|
49
|
+
></ui-input>
|
|
50
|
+
</div>
|
|
51
|
+
</ui-modal-block-standard>
|
|
52
|
+
</template>
|
|
53
|
+
|
|
54
|
+
<template #footerLeftContent><span /></template>
|
|
55
|
+
</ui-modal>
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<script setup lang="ts">
|
|
59
|
+
import type { UI_I_Localization } from '~//lib/models/interfaces'
|
|
60
|
+
import type { UI_I_FormChangePassword } from '~/components/common/layout/theHeader/userMenu/modals/changePassword/lib/models/interfaces'
|
|
61
|
+
import type { UI_T_Project } from '~/lib/models/types'
|
|
62
|
+
|
|
63
|
+
const props = defineProps<{
|
|
64
|
+
project: UI_T_Project
|
|
65
|
+
subtitle: string
|
|
66
|
+
}>()
|
|
67
|
+
const emits = defineEmits<{
|
|
68
|
+
(event: 'hide'): void
|
|
69
|
+
(event: 'change-password'): void
|
|
70
|
+
}>()
|
|
71
|
+
const modelLocal = defineModel<UI_I_FormChangePassword>({ required: true })
|
|
72
|
+
|
|
73
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
74
|
+
|
|
75
|
+
// const isValid = ref<boolean>(false)
|
|
76
|
+
const errorText = ref<string>('')
|
|
77
|
+
|
|
78
|
+
const passwordErrorText = computed<string>(() => {
|
|
79
|
+
return ''
|
|
80
|
+
})
|
|
81
|
+
const newPasswordErrorText = computed<string>(() => {
|
|
82
|
+
return ''
|
|
83
|
+
})
|
|
84
|
+
const confirmPasswordErrorText = computed<string>(() => {
|
|
85
|
+
return ''
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
// const showValidationErrors = (text: string): void => {
|
|
89
|
+
// isValid.value = true
|
|
90
|
+
// errorText.value = text
|
|
91
|
+
// }
|
|
92
|
+
|
|
93
|
+
// const onHideModal = (): void => {
|
|
94
|
+
// emits('hide')
|
|
95
|
+
// setForm()
|
|
96
|
+
// isValid.value = false
|
|
97
|
+
// }
|
|
98
|
+
|
|
99
|
+
const onSubmit = (): void => {
|
|
100
|
+
// const { } = modelLocal.value
|
|
101
|
+
errorText.value = 'asdaldjlkdjkadj'
|
|
102
|
+
|
|
103
|
+
const notReady = true
|
|
104
|
+
if (notReady) {
|
|
105
|
+
return
|
|
106
|
+
}
|
|
107
|
+
emits('change-password')
|
|
108
|
+
}
|
|
109
|
+
</script>
|
|
110
|
+
|
|
111
|
+
<style lang="scss" scoped>
|
|
112
|
+
@import 'assets/scss/common/mixins.scss';
|
|
113
|
+
.change-password {
|
|
114
|
+
&__description {
|
|
115
|
+
color: #9da6ad;
|
|
116
|
+
font-size: 12px;
|
|
117
|
+
font-weight: 400;
|
|
118
|
+
line-height: 14.52px;
|
|
119
|
+
margin-bottom: 20px;
|
|
120
|
+
}
|
|
121
|
+
&__alert {
|
|
122
|
+
padding: 10px 12px;
|
|
123
|
+
margin-bottom: 12px;
|
|
124
|
+
:deep(svg) {
|
|
125
|
+
width: 16px;
|
|
126
|
+
height: 16px;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
&__form {
|
|
130
|
+
@include flex($dir: column);
|
|
131
|
+
row-gap: 18px;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
</style>
|
package/components/common/layout/theHeader/userMenu/modals/changePassword/ChangePasswordOld.vue
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<atoms-modal
|
|
3
|
+
width="580px"
|
|
4
|
+
test-id="change-password"
|
|
5
|
+
show
|
|
6
|
+
:title="localization.common.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.common.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.common.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.common.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
|
+
hostname: string
|
|
100
|
+
project: UI_T_Project
|
|
101
|
+
}>()
|
|
102
|
+
const emits = defineEmits<{
|
|
103
|
+
(event: 'hide'): void
|
|
104
|
+
}>()
|
|
105
|
+
|
|
106
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
107
|
+
const { $store, $validation }: any = useNuxtApp()
|
|
108
|
+
const validation = $validation.call({})
|
|
109
|
+
|
|
110
|
+
const isValid = ref<boolean>(false)
|
|
111
|
+
const errorText = ref<string>('')
|
|
112
|
+
const form = ref<UI_I_FormChangePassword>(
|
|
113
|
+
useDeepCopy(defaultFormFunc(localization.value))
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
const setForm = (): void => {
|
|
117
|
+
form.value = useDeepCopy(defaultFormFunc(localization.value))
|
|
118
|
+
validation.setForm(form)
|
|
119
|
+
}
|
|
120
|
+
setForm()
|
|
121
|
+
|
|
122
|
+
const buttonDisabled = computed<boolean>(() => {
|
|
123
|
+
const { password, confirmPassword, newPassword } = form.value
|
|
124
|
+
return (
|
|
125
|
+
password.value &&
|
|
126
|
+
confirmPassword.value &&
|
|
127
|
+
newPassword.value !== confirmPassword.value
|
|
128
|
+
)
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
const onChangePassword = async (): Promise<void> => {
|
|
132
|
+
const valid = validation.touch()
|
|
133
|
+
const { newPassword, password } = form.value
|
|
134
|
+
|
|
135
|
+
if (newPassword.value === password.value) {
|
|
136
|
+
showValidationErrors(localization.value.common.newPasswordMustDifferentOld)
|
|
137
|
+
return
|
|
138
|
+
}
|
|
139
|
+
if (!valid.isValid) {
|
|
140
|
+
showValidationErrors(valid.errors.confirmPassword[0])
|
|
141
|
+
return
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
onHideModal()
|
|
145
|
+
|
|
146
|
+
const sendData: UI_I_ChangePasswordBodyRequest = {
|
|
147
|
+
current_password: password.value,
|
|
148
|
+
new_password: newPassword.value,
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
let url = ''
|
|
152
|
+
if (props.project === 'sphere') {
|
|
153
|
+
const { id } = useLocalStorage('userData')
|
|
154
|
+
|
|
155
|
+
url = `ui/users/${id}/passwd`
|
|
156
|
+
} else if (props.project === 'procurator') {
|
|
157
|
+
url = '/ui/passwd'
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const { error } = await useMyFetch<never, API_UI_I_Error>(url, {
|
|
161
|
+
method: 'POST',
|
|
162
|
+
body: sendData,
|
|
163
|
+
key: Date.now().toString(),
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
if (error.value?.data && error.value.data.error_code !== 0) {
|
|
167
|
+
$store.dispatch('main/A_SHOW_NOTIFICATION', {
|
|
168
|
+
status: 'error',
|
|
169
|
+
headline: localization.value.common.operationFailed,
|
|
170
|
+
messages: [
|
|
171
|
+
{
|
|
172
|
+
title: 'Error',
|
|
173
|
+
descriptions: [error.value.data.error_message],
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
})
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const showValidationErrors = (text: string): void => {
|
|
181
|
+
isValid.value = true
|
|
182
|
+
errorText.value = text
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const onHideModal = (): void => {
|
|
186
|
+
emits('hide')
|
|
187
|
+
setForm()
|
|
188
|
+
isValid.value = false
|
|
189
|
+
}
|
|
190
|
+
</script>
|
|
191
|
+
|
|
192
|
+
<style lang="scss" scoped>
|
|
193
|
+
.form-block {
|
|
194
|
+
.form-group {
|
|
195
|
+
&:not(:first-child) input {
|
|
196
|
+
width: 100%;
|
|
197
|
+
}
|
|
198
|
+
&__input {
|
|
199
|
+
display: flex;
|
|
200
|
+
width: 100%;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
svg {
|
|
205
|
+
width: 24px;
|
|
206
|
+
height: 24px;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
</style>
|
|
@@ -152,11 +152,11 @@ export const metricsFunc = (
|
|
|
152
152
|
value: 'memory',
|
|
153
153
|
testId: 'metric-item-memory-button',
|
|
154
154
|
},
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
155
|
+
{
|
|
156
|
+
text: localization.common.datastore,
|
|
157
|
+
value: 'datastore',
|
|
158
|
+
testId: 'metric-item-datastore-button',
|
|
159
|
+
},
|
|
160
160
|
// {
|
|
161
161
|
// text: localization.common.power,
|
|
162
162
|
// value: 'power',
|
|
@@ -62,8 +62,7 @@ const getCorrectRuForm = (value: number | string, type: string): string => {
|
|
|
62
62
|
export const validateField = (
|
|
63
63
|
localization: UI_I_Localization,
|
|
64
64
|
value: string,
|
|
65
|
-
checkZero: boolean = false
|
|
66
|
-
checkDayRange: boolean = false // параметр для проверки диапазона дней
|
|
65
|
+
checkZero: boolean = false
|
|
67
66
|
): string => {
|
|
68
67
|
// Если поле пустое
|
|
69
68
|
if (!value) {
|
|
@@ -75,7 +74,7 @@ export const validateField = (
|
|
|
75
74
|
return localization.common.theValueTooSmall
|
|
76
75
|
}
|
|
77
76
|
|
|
78
|
-
if (value.length > 3
|
|
77
|
+
if (value.length > 3) {
|
|
79
78
|
return localization.common.theValueTooLarge
|
|
80
79
|
}
|
|
81
80
|
// Если значение не является цифрой
|
|
@@ -83,10 +82,6 @@ export const validateField = (
|
|
|
83
82
|
return localization.common.inputContainsInvalidCharacters
|
|
84
83
|
}
|
|
85
84
|
|
|
86
|
-
if (checkDayRange && !/^([1-9]|[1-2][0-9]|3[0-1])$/.test(value)) {
|
|
87
|
-
return localization.common.theValueTooLarge
|
|
88
|
-
}
|
|
89
|
-
|
|
90
85
|
return ''
|
|
91
86
|
}
|
|
92
87
|
export const validateDate = (
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
v-model="model"
|
|
10
10
|
/>
|
|
11
11
|
|
|
12
|
-
<div v-if="props.type === 'month'">
|
|
12
|
+
<div v-if="props.type === 'month'" class="">
|
|
13
13
|
<div class="on-time__radio radio">
|
|
14
14
|
<input
|
|
15
15
|
id="on-time-monthly-by-day"
|
|
16
|
-
v-model="
|
|
16
|
+
v-model="selectedTimeMode"
|
|
17
17
|
data-id="on-time-monthly-by-day"
|
|
18
18
|
type="radio"
|
|
19
19
|
value="day"
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
<div class="on-time__radio radio">
|
|
50
50
|
<input
|
|
51
51
|
id="on-time-monthly-by-week"
|
|
52
|
-
v-model="
|
|
52
|
+
v-model="selectedTimeMode"
|
|
53
53
|
data-id="on-time-monthly-by-week"
|
|
54
54
|
type="radio"
|
|
55
55
|
value="week"
|
|
@@ -115,6 +115,8 @@ const model = defineModel<UI_I_ScheduleNewTasksForm>({ required: true })
|
|
|
115
115
|
|
|
116
116
|
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
117
117
|
|
|
118
|
+
const selectedTimeMode = ref<'day' | 'week'>('day')
|
|
119
|
+
|
|
118
120
|
const frequencyOnWeeksDays = computed<UI_I_SelectInputItem[]>(() => {
|
|
119
121
|
return frequencyOnWeeksDaysFunc(localization.value)
|
|
120
122
|
})
|
|
@@ -123,7 +125,7 @@ const frequencyOnOrdinalNumber = computed<UI_I_SelectInputItem[]>(() => {
|
|
|
123
125
|
})
|
|
124
126
|
|
|
125
127
|
const isDisabledMonthlyDayField = computed<boolean>(
|
|
126
|
-
() =>
|
|
128
|
+
() => selectedTimeMode.value === 'week'
|
|
127
129
|
)
|
|
128
130
|
|
|
129
131
|
const isInitTimeIntervalValidation = ref<boolean>(false)
|
|
@@ -134,12 +136,7 @@ const schedulerOnDayErrorText = computed<string>(() => {
|
|
|
134
136
|
if (!isInitTimeIntervalValidation.value || isDisabledMonthlyDayField.value)
|
|
135
137
|
return ''
|
|
136
138
|
|
|
137
|
-
return validateField(
|
|
138
|
-
localization.value,
|
|
139
|
-
model.value.frg_monthly_day,
|
|
140
|
-
true,
|
|
141
|
-
true
|
|
142
|
-
)
|
|
139
|
+
return validateField(localization.value, model.value.frg_monthly_day, true)
|
|
143
140
|
})
|
|
144
141
|
watch(
|
|
145
142
|
schedulerOnDayErrorText,
|
package/components/common/pages/scheduledTasks/modals/common/frequency/on/lib/config/options.ts
CHANGED
|
@@ -7,31 +7,31 @@ export const frequencyOnWeeksDaysFunc = (
|
|
|
7
7
|
return [
|
|
8
8
|
{
|
|
9
9
|
label: localization.common.sunday,
|
|
10
|
-
value:
|
|
10
|
+
value: 'sunday',
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
13
|
label: localization.common.monday,
|
|
14
|
-
value:
|
|
14
|
+
value: 'monday',
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
label: localization.common.tuesday,
|
|
18
|
-
value:
|
|
18
|
+
value: 'tuesday',
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
label: localization.common.wednesday,
|
|
22
|
-
value:
|
|
22
|
+
value: 'wednesday',
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
label: localization.common.thursday,
|
|
26
|
-
value:
|
|
26
|
+
value: 'thursday',
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
label: localization.common.friday,
|
|
30
|
-
value:
|
|
30
|
+
value: 'friday',
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
label: localization.common.saturday,
|
|
34
|
-
value:
|
|
34
|
+
value: 'saturday',
|
|
35
35
|
},
|
|
36
36
|
]
|
|
37
37
|
}
|
|
@@ -42,23 +42,23 @@ export const frequencyOnOrdinalNumberFunc = (
|
|
|
42
42
|
return [
|
|
43
43
|
{
|
|
44
44
|
label: localization.scheduledTasks.first,
|
|
45
|
-
value:
|
|
45
|
+
value: '',
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
48
|
label: localization.scheduledTasks.second,
|
|
49
|
-
value:
|
|
49
|
+
value: 'once',
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
52
|
label: localization.scheduledTasks.third,
|
|
53
|
-
value:
|
|
53
|
+
value: 'after-startup',
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
56
|
label: localization.scheduledTasks.fourth,
|
|
57
|
-
value:
|
|
57
|
+
value: 'hour',
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
label: localization.common.last,
|
|
61
|
-
value:
|
|
61
|
+
value: 'day',
|
|
62
62
|
},
|
|
63
63
|
]
|
|
64
64
|
}
|
|
@@ -101,7 +101,6 @@ import type { UI_I_SelectInputItem } from '~/components/common/select/input/lib/
|
|
|
101
101
|
import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
|
|
102
102
|
import type { UI_I_InitialValidationFields } from '~/components/common/pages/scheduledTasks/modals/common/newTaskForm/lib/models/interfaces'
|
|
103
103
|
import type { UI_T_FrequencyType } from '~/components/common/pages/scheduledTasks/modals/common/frequency/lib/models/types'
|
|
104
|
-
import * as cron from '~/components/common/pages/scheduledTasks/modals/common/newTaskForm/lib/utils'
|
|
105
104
|
import { frequencyMethodFunc } from '~/components/common/pages/scheduledTasks/modals/common/frequency/lib/config/frequencyOptions'
|
|
106
105
|
|
|
107
106
|
const props = defineProps<{
|
|
@@ -134,6 +133,57 @@ watch(
|
|
|
134
133
|
},
|
|
135
134
|
{ deep: true }
|
|
136
135
|
)
|
|
136
|
+
/* TODO рефакторинг все методы надо рефакторить */
|
|
137
|
+
const generateOnceCronExpression = (date: Date): any => {
|
|
138
|
+
if (!date) return
|
|
139
|
+
|
|
140
|
+
const minutes = date.getMinutes()
|
|
141
|
+
const hours = date.getHours()
|
|
142
|
+
const day = date.getDate()
|
|
143
|
+
const month = date.getMonth() + 1 // В cron месяцы начинаются с 1 (январь = 1)
|
|
144
|
+
const dayOfWeek = '*' // Для одноразовой задачи день недели неважен
|
|
145
|
+
|
|
146
|
+
// Генерируем cron-выражение
|
|
147
|
+
return `${minutes} ${hours} ${day} ${month} ${dayOfWeek} once`
|
|
148
|
+
}
|
|
149
|
+
const generateHourlyCronExpression = (delay: string, date: Date): any => {
|
|
150
|
+
if (!date) return
|
|
151
|
+
|
|
152
|
+
const minutes = date.getMinutes()
|
|
153
|
+
const hours = date.getHours()
|
|
154
|
+
|
|
155
|
+
// Генерируем cron-выражение
|
|
156
|
+
return `${minutes} ${hours}/${delay} * * *`
|
|
157
|
+
}
|
|
158
|
+
const generateDaylyCronExpression = (delay: string, date: Date): string => {
|
|
159
|
+
if (!date) return
|
|
160
|
+
|
|
161
|
+
const minutes = date.getMinutes()
|
|
162
|
+
const hours = date.getHours()
|
|
163
|
+
const day = date.getDate()
|
|
164
|
+
|
|
165
|
+
// Генерируем cron-выражение
|
|
166
|
+
return `${minutes} ${hours} ${day}/${delay} * *`
|
|
167
|
+
}
|
|
168
|
+
const generateWeeklyCronExpression = (
|
|
169
|
+
data: UI_I_ScheduleNewTasksForm
|
|
170
|
+
): string => {
|
|
171
|
+
const { frg_on_week_days } = data
|
|
172
|
+
|
|
173
|
+
// Генерируем cron-выражение
|
|
174
|
+
return `* * * * ${frg_on_week_days.join(',')}`
|
|
175
|
+
}
|
|
176
|
+
const generateMonthlyCronExpression = (delay: string, date: Date): string => {
|
|
177
|
+
if (!date) return
|
|
178
|
+
|
|
179
|
+
const minutes = date.getMinutes()
|
|
180
|
+
const hours = date.getHours()
|
|
181
|
+
const day = date.getDate()
|
|
182
|
+
const month = date.getMonth() + 1
|
|
183
|
+
|
|
184
|
+
// Генерируем cron-выражение
|
|
185
|
+
return `${minutes} ${hours} ${day} ${month}/${delay} *`
|
|
186
|
+
}
|
|
137
187
|
|
|
138
188
|
const generateCronExpression = (
|
|
139
189
|
runType: UI_T_FrequencyType,
|
|
@@ -144,27 +194,40 @@ const generateCronExpression = (
|
|
|
144
194
|
// Генерируем cron-выражение на основе runType
|
|
145
195
|
switch (runType) {
|
|
146
196
|
case 'once':
|
|
147
|
-
|
|
148
|
-
new Date(interval.frg_on_time)
|
|
197
|
+
cronExpression = generateOnceCronExpression(
|
|
198
|
+
new Date(interval.frg_on_time)
|
|
149
199
|
)
|
|
150
|
-
cronExpression = `* * * * * ${timestamp}:0-0-0-0:once`
|
|
151
200
|
break
|
|
152
201
|
case 'after-startup':
|
|
153
|
-
const
|
|
154
|
-
interval.frg_after_startup === 0
|
|
155
|
-
|
|
202
|
+
const delay =
|
|
203
|
+
interval.frg_after_startup === 0
|
|
204
|
+
? '*'
|
|
205
|
+
: `*/${interval.frg_after_startup}`
|
|
206
|
+
cronExpression = `${delay} * * * * after_procurator_startup` // Выполняется каждые N минут после запуска procurator_startup
|
|
156
207
|
break
|
|
157
208
|
case 'hour':
|
|
158
|
-
|
|
209
|
+
const hourlyDelay = interval.frg_interval
|
|
210
|
+
cronExpression = generateHourlyCronExpression(
|
|
211
|
+
hourlyDelay,
|
|
212
|
+
new Date(interval.frg_start_on_time)
|
|
213
|
+
)
|
|
159
214
|
break
|
|
160
215
|
case 'day':
|
|
161
|
-
|
|
216
|
+
const dayDelay = interval.frg_interval
|
|
217
|
+
cronExpression = generateDaylyCronExpression(
|
|
218
|
+
dayDelay,
|
|
219
|
+
new Date(interval.frg_start_on_time)
|
|
220
|
+
)
|
|
162
221
|
break
|
|
163
222
|
case 'week':
|
|
164
|
-
cronExpression =
|
|
223
|
+
cronExpression = generateWeeklyCronExpression(interval)
|
|
165
224
|
break
|
|
166
225
|
case 'month':
|
|
167
|
-
|
|
226
|
+
const monthDelay = interval.frg_interval
|
|
227
|
+
cronExpression = generateMonthlyCronExpression(
|
|
228
|
+
monthDelay,
|
|
229
|
+
new Date(interval.frg_start_on_time)
|
|
230
|
+
)
|
|
168
231
|
break
|
|
169
232
|
default:
|
|
170
233
|
cronExpression = '* * * * *'
|
|
@@ -11,13 +11,12 @@ export const scheduledTaskDefaultFormFunc = (): UI_I_ScheduleNewTasksForm => {
|
|
|
11
11
|
frequency: '',
|
|
12
12
|
frg_after_startup: 0,
|
|
13
13
|
frg_interval: 1,
|
|
14
|
-
frg_end_time:
|
|
15
|
-
frg_start_on_time:
|
|
16
|
-
|
|
17
|
-
frg_monthly_day: 1,
|
|
14
|
+
frg_end_time: null,
|
|
15
|
+
frg_start_on_time: null,
|
|
16
|
+
frg_monthly_day: 0,
|
|
18
17
|
frq_week_day: '',
|
|
19
18
|
frq_ordinal_number: '',
|
|
20
|
-
frg_on_time:
|
|
19
|
+
frg_on_time: null,
|
|
21
20
|
frg_on_week_days: [],
|
|
22
21
|
}
|
|
23
22
|
}
|
|
@@ -9,13 +9,12 @@ export interface UI_I_ScheduleNewTasksForm {
|
|
|
9
9
|
toggle: boolean
|
|
10
10
|
frg_after_startup: number
|
|
11
11
|
frg_interval: number
|
|
12
|
-
frg_end_time:
|
|
13
|
-
frg_start_on_time:
|
|
14
|
-
frg_monthly_mode: 'day' | 'week'
|
|
12
|
+
frg_end_time: number | null
|
|
13
|
+
frg_start_on_time: number | null
|
|
15
14
|
frg_monthly_day: number
|
|
16
15
|
frq_ordinal_number: string
|
|
17
16
|
frq_week_day: UI_T_FrequencyWeeksDays
|
|
18
|
-
frg_on_time:
|
|
17
|
+
frg_on_time: number | null
|
|
19
18
|
frg_on_week_days: number[]
|
|
20
19
|
cron: string
|
|
21
20
|
}
|
package/package.json
CHANGED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
|
|
2
|
-
|
|
3
|
-
export const generateHourlyCronExpression = (
|
|
4
|
-
data: UI_I_ScheduleNewTasksForm
|
|
5
|
-
): string => {
|
|
6
|
-
const startTimestamp = Math.floor(
|
|
7
|
-
new Date(data.frg_start_on_time).getTime() / 1000
|
|
8
|
-
)
|
|
9
|
-
const endTimestamp = Math.floor(new Date(data.frg_end_time).getTime() / 1000)
|
|
10
|
-
|
|
11
|
-
// Генерируем cron-выражение
|
|
12
|
-
return endTimestamp
|
|
13
|
-
? `* * * * * ${startTimestamp}-${endTimestamp}:${data.frg_interval}-0-0-0`
|
|
14
|
-
: `* * * * * ${startTimestamp}:${data.frg_interval}-0-0-0`
|
|
15
|
-
}
|
|
16
|
-
export const generateWeeklyCronExpression = (
|
|
17
|
-
data: UI_I_ScheduleNewTasksForm
|
|
18
|
-
): string => {
|
|
19
|
-
const { frg_on_week_days } = data
|
|
20
|
-
|
|
21
|
-
const startTimestamp = Math.floor(
|
|
22
|
-
new Date(data.frg_start_on_time).getTime() / 1000
|
|
23
|
-
)
|
|
24
|
-
const endTimestamp = Math.floor(new Date(data.frg_end_time).getTime() / 1000)
|
|
25
|
-
const daysOfWeek = frg_on_week_days.join(',')
|
|
26
|
-
|
|
27
|
-
return endTimestamp
|
|
28
|
-
? `* * * * ${daysOfWeek} ${startTimestamp}-${endTimestamp}:0-0-0-${data.frg_interval}`
|
|
29
|
-
: `* * * * ${daysOfWeek} ${startTimestamp}:0-0-0-${data.frg_interval}`
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export const generateDailyCronExpression = (
|
|
33
|
-
data: UI_I_ScheduleNewTasksForm
|
|
34
|
-
): string => {
|
|
35
|
-
const startTimestamp = Math.floor(
|
|
36
|
-
new Date(data.frg_start_on_time).getTime() / 1000
|
|
37
|
-
)
|
|
38
|
-
const endTimestamp = Math.floor(new Date(data.frg_end_time).getTime() / 1000)
|
|
39
|
-
|
|
40
|
-
// Генерируем cron-выражение
|
|
41
|
-
return endTimestamp
|
|
42
|
-
? `* * * * * ${startTimestamp}-${endTimestamp}:0-${data.frg_interval}-0-0`
|
|
43
|
-
: `* * * * * ${startTimestamp}:0-${data.frg_interval}-0-0`
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export const generateMonthlyCronExpression = (
|
|
47
|
-
data: UI_I_ScheduleNewTasksForm
|
|
48
|
-
): string => {
|
|
49
|
-
const { frg_interval, frg_monthly_day, frq_week_day, frq_ordinal_number } =
|
|
50
|
-
data
|
|
51
|
-
|
|
52
|
-
const startTimestamp = Math.floor(
|
|
53
|
-
new Date(data.frg_start_on_time).getTime() / 1000
|
|
54
|
-
)
|
|
55
|
-
const endTimestamp = Math.floor(new Date(data.frg_end_time).getTime() / 1000)
|
|
56
|
-
|
|
57
|
-
const daysOfWeek = `${frq_week_day}#${frq_ordinal_number}`
|
|
58
|
-
|
|
59
|
-
const timestamp = endTimestamp
|
|
60
|
-
? `${startTimestamp}-${endTimestamp}`
|
|
61
|
-
: startTimestamp
|
|
62
|
-
|
|
63
|
-
// Генерируем cron-выражение
|
|
64
|
-
return data.frg_monthly_mode === 'week'
|
|
65
|
-
? `* * * * * ${timestamp}:0-0-${frg_interval}-${daysOfWeek}`
|
|
66
|
-
: `* * ${frg_monthly_day} */${frg_interval} * ${timestamp}:0-0-0-0`
|
|
67
|
-
}
|