bfg-common 1.5.920 → 1.5.921
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 +15 -3
- package/assets/localization/local_en.json +15 -3
- package/assets/localization/local_hy.json +15 -3
- package/assets/localization/local_kk.json +15 -3
- package/assets/localization/local_ru.json +15 -3
- package/assets/localization/local_zh.json +15 -3
- package/components/common/pages/scheduledTasks/lib/models/interfaces.ts +6 -0
- package/components/common/pages/scheduledTasks/modals/common/frequency/Frequency.vue +46 -42
- package/components/common/pages/scheduledTasks/modals/common/frequency/afterStartup/AfterStartup.vue +15 -48
- package/components/common/pages/scheduledTasks/modals/common/frequency/afterStartup/New.vue +43 -0
- package/components/common/pages/scheduledTasks/modals/common/frequency/afterStartup/Old.vue +65 -0
- package/components/common/pages/scheduledTasks/modals/common/frequency/end/End.vue +15 -69
- package/components/common/pages/scheduledTasks/modals/common/frequency/end/New.vue +73 -0
- package/components/common/pages/scheduledTasks/modals/common/frequency/end/Old.vue +112 -0
- package/components/common/pages/scheduledTasks/modals/common/frequency/interval/Interval.vue +19 -53
- package/components/common/pages/scheduledTasks/modals/common/frequency/interval/New.vue +49 -0
- package/components/common/pages/scheduledTasks/modals/common/frequency/interval/Old.vue +68 -0
- package/components/common/pages/scheduledTasks/modals/common/frequency/lib/utils.ts +1 -1
- package/components/common/pages/scheduledTasks/modals/common/frequency/on/New.vue +137 -0
- package/components/common/pages/scheduledTasks/modals/common/frequency/on/Old.vue +234 -0
- package/components/common/pages/scheduledTasks/modals/common/frequency/on/On.vue +28 -168
- package/components/common/pages/scheduledTasks/modals/common/frequency/on/lib/config/options.ts +17 -0
- package/components/common/pages/scheduledTasks/modals/common/frequency/on/selectWeek/New.vue +66 -0
- package/components/common/pages/scheduledTasks/modals/common/frequency/on/selectWeek/Old.vue +44 -0
- package/components/common/pages/scheduledTasks/modals/common/frequency/on/selectWeek/SelectWeek.vue +17 -28
- package/components/common/pages/scheduledTasks/modals/common/frequency/on/selectWeek/lib/config/weekOptions.ts +20 -50
- package/components/common/pages/scheduledTasks/modals/common/frequency/startOn/New.vue +46 -0
- package/components/common/pages/scheduledTasks/modals/common/frequency/startOn/Old.vue +77 -0
- package/components/common/pages/scheduledTasks/modals/common/frequency/startOn/StartOn.vue +15 -51
- package/components/common/pages/scheduledTasks/modals/common/taskForm/New.vue +194 -0
- package/components/common/pages/scheduledTasks/modals/common/{newTaskForm/NewTaskForm.vue → taskForm/Old.vue} +12 -69
- package/components/common/pages/scheduledTasks/modals/common/taskForm/TaskForm.vue +129 -0
- package/components/common/pages/scheduledTasks/table/Table.vue +27 -81
- package/components/common/pages/scheduledTasks/table/expandDetails/ExpandDetails.vue +2 -2
- package/components/common/pages/scheduledTasks/table/expandDetails/New.vue +48 -17
- package/components/common/pages/scheduledTasks/table/expandDetails/Old.vue +1 -3
- package/components/common/pages/scheduledTasks/table/expandDetails/historyRun/HistoryRun.vue +16 -54
- package/components/common/pages/scheduledTasks/table/expandDetails/historyRun/new/New.vue +147 -0
- package/components/common/pages/scheduledTasks/table/expandDetails/historyRun/new/lib/config/historyRunsTable.ts +161 -0
- package/components/common/pages/scheduledTasks/table/expandDetails/historyRun/old/Old.vue +68 -0
- package/components/common/pages/scheduledTasks/table/expandDetails/historyRun/{lib → old/lib}/config/historyRunsTable.ts +4 -4
- package/components/common/pages/scheduledTasks/table/expandDetails/historyRun/{lib → old/lib}/config/tableKeys.ts +1 -1
- package/components/common/pages/scheduledTasks/table/expandDetails/lib/config/expandDetails.ts +7 -5
- package/components/common/pages/scheduledTasks/table/expandDetails/lib/models/interfaces.ts +8 -0
- package/components/common/pages/scheduledTasks/table/lib/models/enums.ts +4 -0
- package/components/common/pages/scheduledTasks/table/new/New.vue +320 -0
- package/components/common/pages/scheduledTasks/table/new/lib/config/scheduledTasksTable.ts +218 -0
- package/components/common/pages/scheduledTasks/table/new/lib/models/enums.ts +14 -0
- package/components/common/pages/scheduledTasks/table/old/Old.vue +93 -0
- package/components/common/pages/scheduledTasks/table/{lib → old/lib}/config/scheduledTasksTable.ts +13 -9
- package/components/common/pages/scheduledTasks/table/{lib → old/lib}/config/tableKeys.ts +1 -1
- package/package.json +1 -1
- package/components/common/pages/scheduledTasks/table/lib/config/schedulerStatus.ts +0 -4
- package/components/common/pages/scheduledTasks/table/lib/models/interfaces.ts +0 -11
- /package/components/common/pages/scheduledTasks/modals/common/{newTaskForm → taskForm}/lib/models/interfaces.ts +0 -0
- /package/components/common/pages/scheduledTasks/modals/common/{newTaskForm → taskForm}/lib/utils.ts +0 -0
- /package/components/common/pages/scheduledTasks/table/expandDetails/historyRun/{lib → old/lib}/models/types.ts +0 -0
- /package/components/common/pages/scheduledTasks/table/{lib → old/lib}/models/types.ts +0 -0
|
@@ -1,55 +1,25 @@
|
|
|
1
1
|
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
2
|
+
import { UI_I_SelectWeekDayTab } from '~/components/common/pages/scheduledTasks/modals/common/frequency/on/selectWeek/lib/models/interfaces'
|
|
3
|
+
|
|
4
|
+
const WEEK_DAYS_CONFIG = [
|
|
5
|
+
{ value: 1, newKey: 'weekMon', oldKey: 'weekM', testId: 'week-m-value' },
|
|
6
|
+
{ value: 2, newKey: 'weekTue', oldKey: 'weekT', testId: 'week-t-value' },
|
|
7
|
+
{ value: 3, newKey: 'weekWed', oldKey: 'weekW', testId: 'week-w-value' },
|
|
8
|
+
{ value: 4, newKey: 'weekThu', oldKey: 'weekTh', testId: 'week-th-value' },
|
|
9
|
+
{ value: 5, newKey: 'weekFri', oldKey: 'weekF', testId: 'week-f-value' },
|
|
10
|
+
{ value: 6, newKey: 'weekSat', oldKey: 'weekS', testId: 'week-s-value' },
|
|
11
|
+
{ value: 0, newKey: 'weekSun', oldKey: 'weekSu', testId: 'week-su-value' },
|
|
12
|
+
]
|
|
2
13
|
|
|
3
14
|
export const weekDaysFunc = (
|
|
4
15
|
localization: UI_I_Localization,
|
|
5
|
-
selectedWeeks: number[]
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
{
|
|
15
|
-
name: localization.common.weekT,
|
|
16
|
-
value: 2,
|
|
17
|
-
isActive: checkIsActiveDay(2, selectedWeeks),
|
|
18
|
-
testId: 'week-t-value',
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
name: localization.common.weekW,
|
|
22
|
-
value: 3,
|
|
23
|
-
isActive: checkIsActiveDay(3, selectedWeeks),
|
|
24
|
-
testId: 'week-w-value',
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
name: localization.common.weekTh,
|
|
28
|
-
value: 4,
|
|
29
|
-
isActive: checkIsActiveDay(4, selectedWeeks),
|
|
30
|
-
testId: 'week-th-value',
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: localization.common.weekF,
|
|
34
|
-
value: 5,
|
|
35
|
-
isActive: checkIsActiveDay(5, selectedWeeks),
|
|
36
|
-
testId: 'week-f-value',
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: localization.common.weekS,
|
|
40
|
-
value: 6,
|
|
41
|
-
isActive: checkIsActiveDay(6, selectedWeeks),
|
|
42
|
-
testId: 'week-s-value',
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
name: localization.common.weekSu,
|
|
46
|
-
value: 0,
|
|
47
|
-
isActive: checkIsActiveDay(0, selectedWeeks),
|
|
48
|
-
testId: 'week-su-value',
|
|
49
|
-
},
|
|
50
|
-
]
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const checkIsActiveDay = (value: number, weeks: number[]): boolean => {
|
|
54
|
-
return !!weeks?.includes(value)
|
|
16
|
+
selectedWeeks: number[],
|
|
17
|
+
isNewView: boolean
|
|
18
|
+
): UI_I_SelectWeekDayTab[] => {
|
|
19
|
+
return WEEK_DAYS_CONFIG.map((day) => ({
|
|
20
|
+
name: localization.common[isNewView ? day.newKey : day.oldKey],
|
|
21
|
+
value: day.value,
|
|
22
|
+
isActive: selectedWeeks.includes(day.value),
|
|
23
|
+
testId: day.testId,
|
|
24
|
+
}))
|
|
55
25
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="frequency-start-on">
|
|
3
|
+
<h2>{{ localization.common.start }}</h2>
|
|
4
|
+
<ui-input-with-datepicker
|
|
5
|
+
id="frequency-start-on-date"
|
|
6
|
+
v-model="modelFrequencyLocal.frg_start_on_time"
|
|
7
|
+
:format="datepickerFormat"
|
|
8
|
+
test-id="frequency-start-on-date-input"
|
|
9
|
+
time-format="12"
|
|
10
|
+
:error="''"
|
|
11
|
+
:error-timepicker="''"
|
|
12
|
+
/>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script lang="ts" setup>
|
|
17
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
18
|
+
import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
|
|
19
|
+
import { getUiDatepickerFormatByLanguage } from '~/lib/utils/date'
|
|
20
|
+
|
|
21
|
+
const modelFrequencyLocal = defineModel<UI_I_ScheduleNewTasksForm>({
|
|
22
|
+
required: true,
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
26
|
+
|
|
27
|
+
const datepickerFormat = computed<string>(
|
|
28
|
+
() => getUiDatepickerFormatByLanguage('en_US') // TODO из пропс должен приходить язык
|
|
29
|
+
)
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<style lang="scss" scoped>
|
|
33
|
+
.frequency-start-on {
|
|
34
|
+
grid-column: span 2;
|
|
35
|
+
border-top: 1px solid var(--horizontal-line);
|
|
36
|
+
padding-top: 16px;
|
|
37
|
+
h2 {
|
|
38
|
+
font-family: 'Inter', sans-serif;
|
|
39
|
+
color: var(--title-form-first-color);
|
|
40
|
+
font-size: 14px;
|
|
41
|
+
font-weight: 500;
|
|
42
|
+
line-height: 18px;
|
|
43
|
+
margin-bottom: 12px;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
</style>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="start-on">
|
|
3
|
+
<label class="clr-control-label clr-col-2 pl-0 start-on__label">
|
|
4
|
+
{{ localization.scheduledTasks.startOn }}
|
|
5
|
+
</label>
|
|
6
|
+
|
|
7
|
+
<label
|
|
8
|
+
:class="[
|
|
9
|
+
'tooltip tooltip-validation tooltip-xs tooltip-top-left',
|
|
10
|
+
schedulerStartOnErrorText && 'invalid',
|
|
11
|
+
]"
|
|
12
|
+
for="frequency-start-on-date"
|
|
13
|
+
>
|
|
14
|
+
<input
|
|
15
|
+
id="frequency-start-on-date"
|
|
16
|
+
v-model.lazy="modelFrequencyLocal.frg_start_on_time"
|
|
17
|
+
data-id="frequency-start-on-date-input"
|
|
18
|
+
type="datetime-local"
|
|
19
|
+
/>
|
|
20
|
+
|
|
21
|
+
<span class="tooltip-content">
|
|
22
|
+
{{ schedulerStartOnErrorText }}
|
|
23
|
+
</span>
|
|
24
|
+
</label>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script lang="ts" setup>
|
|
29
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
30
|
+
import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
|
|
31
|
+
import { validateDate } from '~/components/common/pages/scheduledTasks/modals/common/frequency/lib/utils'
|
|
32
|
+
|
|
33
|
+
const modelFrequencyLocal = defineModel<UI_I_ScheduleNewTasksForm>({
|
|
34
|
+
required: true,
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
39
|
+
// const { $formattedDate, $isDate, $getUnixByDate }: any = useNuxtApp()
|
|
40
|
+
|
|
41
|
+
const schedulerStartOnErrorText = computed<string>(() => {
|
|
42
|
+
return !modelFrequencyLocal.value.frg_start_on_time
|
|
43
|
+
? localization.value.common.fieldRequired
|
|
44
|
+
: validateDate(
|
|
45
|
+
localization.value,
|
|
46
|
+
modelFrequencyLocal.value.frg_start_on_time
|
|
47
|
+
)
|
|
48
|
+
})
|
|
49
|
+
watch(
|
|
50
|
+
schedulerStartOnErrorText,
|
|
51
|
+
(newValue: string) => {
|
|
52
|
+
modelFrequencyLocal.value.isValid = !!newValue
|
|
53
|
+
},
|
|
54
|
+
{ immediate: true }
|
|
55
|
+
)
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<style lang="scss" scoped>
|
|
59
|
+
@import 'bfg-common/assets/scss/common/mixins.scss';
|
|
60
|
+
.start-on {
|
|
61
|
+
@include flex($align: center);
|
|
62
|
+
margin-top: 10px;
|
|
63
|
+
&__select-input {
|
|
64
|
+
:deep(.select-input__label) {
|
|
65
|
+
font-weight: 400;
|
|
66
|
+
}
|
|
67
|
+
:deep(.select) {
|
|
68
|
+
max-width: 80px !important;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
.tooltip {
|
|
73
|
+
& > .tooltip-content {
|
|
74
|
+
width: 200px;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
</style>
|
|
@@ -1,28 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<label
|
|
8
|
-
:class="[
|
|
9
|
-
'tooltip tooltip-validation tooltip-xs tooltip-top-left',
|
|
10
|
-
schedulerStartOnErrorText && 'invalid',
|
|
11
|
-
]"
|
|
12
|
-
for="frequency-start-on-date"
|
|
13
|
-
>
|
|
14
|
-
<input
|
|
15
|
-
id="frequency-start-on-date"
|
|
16
|
-
v-model.lazy="modelFrequencyLocal.frg_start_on_time"
|
|
17
|
-
data-id="frequency-start-on-date-input"
|
|
18
|
-
type="datetime-local"
|
|
19
|
-
/>
|
|
20
|
-
|
|
21
|
-
<span class="tooltip-content">
|
|
22
|
-
{{ schedulerStartOnErrorText }}
|
|
23
|
-
</span>
|
|
24
|
-
</label>
|
|
25
|
-
</div>
|
|
2
|
+
<component
|
|
3
|
+
:is="currentComponent"
|
|
4
|
+
v-model="modelFrequencyLocal"
|
|
5
|
+
@vue:mounted="onSetDefaultDateTime"
|
|
6
|
+
/>
|
|
26
7
|
</template>
|
|
27
8
|
|
|
28
9
|
<script lang="ts" setup>
|
|
@@ -34,11 +15,18 @@ const modelFrequencyLocal = defineModel<UI_I_ScheduleNewTasksForm>({
|
|
|
34
15
|
required: true,
|
|
35
16
|
})
|
|
36
17
|
|
|
37
|
-
const { $formattedDatetime }: any = useNuxtApp()
|
|
38
|
-
|
|
39
18
|
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
19
|
+
const { $formattedDatetime }: any = useNuxtApp()
|
|
20
|
+
const { $store }: any = useNuxtApp()
|
|
40
21
|
// const { $formattedDate, $isDate, $getUnixByDate }: any = useNuxtApp()
|
|
41
22
|
|
|
23
|
+
const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
|
|
24
|
+
const currentComponent = computed(() =>
|
|
25
|
+
isNewView.value
|
|
26
|
+
? defineAsyncComponent(() => import('./New.vue'))
|
|
27
|
+
: defineAsyncComponent(() => import('./Old.vue'))
|
|
28
|
+
)
|
|
29
|
+
|
|
42
30
|
const schedulerStartOnErrorText = computed<string>(() => {
|
|
43
31
|
return !modelFrequencyLocal.value.frg_start_on_time
|
|
44
32
|
? localization.value.common.fieldRequired
|
|
@@ -55,10 +43,7 @@ watch(
|
|
|
55
43
|
{ immediate: true }
|
|
56
44
|
)
|
|
57
45
|
|
|
58
|
-
|
|
59
|
-
setDefaultDateTime()
|
|
60
|
-
})
|
|
61
|
-
const setDefaultDateTime = () => {
|
|
46
|
+
const onSetDefaultDateTime = () => {
|
|
62
47
|
modelFrequencyLocal.value.frg_start_on_time = $formattedDatetime(new Date(), {
|
|
63
48
|
formatDate: 'yyyy-MM-dd',
|
|
64
49
|
separator: ' ',
|
|
@@ -66,24 +51,3 @@ const setDefaultDateTime = () => {
|
|
|
66
51
|
})
|
|
67
52
|
}
|
|
68
53
|
</script>
|
|
69
|
-
|
|
70
|
-
<style lang="scss" scoped>
|
|
71
|
-
@import 'bfg-common/assets/scss/common/mixins.scss';
|
|
72
|
-
.start-on {
|
|
73
|
-
@include flex($align: center);
|
|
74
|
-
margin-top: 10px;
|
|
75
|
-
&__select-input {
|
|
76
|
-
:deep(.select-input__label) {
|
|
77
|
-
font-weight: 400;
|
|
78
|
-
}
|
|
79
|
-
:deep(.select) {
|
|
80
|
-
max-width: 80px !important;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
.tooltip {
|
|
85
|
-
& > .tooltip-content {
|
|
86
|
-
width: 200px;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
</style>
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<form class="form" @submit.prevent>
|
|
3
|
+
<section class="flex flex-direction-column row-gap-6">
|
|
4
|
+
<div class="flex justify-between column-gap-4 form__target">
|
|
5
|
+
<div class="flex items-center column-gap-2 text-ellipsis">
|
|
6
|
+
<p class="text">{{ localization.common.target }}:</p>
|
|
7
|
+
<span class="icon vsphere-icon-vm"></span>
|
|
8
|
+
<span class="text">{{ props.target }}</span>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="flex items-center column-gap-3">
|
|
11
|
+
<p class="text">{{ localization.common.active }}</p>
|
|
12
|
+
<ui-switch
|
|
13
|
+
v-model="model.toggle"
|
|
14
|
+
test-id="scheduled-task-active-switch-input"
|
|
15
|
+
/>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<ui-input
|
|
20
|
+
id="schedule-task-name-field"
|
|
21
|
+
v-model="model.task_name"
|
|
22
|
+
:label="localization.common.taskName"
|
|
23
|
+
:error="props.taskNameErrorText"
|
|
24
|
+
test-id="schedule-task-name-field"
|
|
25
|
+
class="form__user-name"
|
|
26
|
+
@input="onInitValidation(['taskName'])"
|
|
27
|
+
/>
|
|
28
|
+
|
|
29
|
+
<ui-textarea
|
|
30
|
+
id="description"
|
|
31
|
+
v-model="model.description"
|
|
32
|
+
:label="textareaLabel"
|
|
33
|
+
test-id="schedule-task-description-field"
|
|
34
|
+
height="84"
|
|
35
|
+
class="form__description"
|
|
36
|
+
/>
|
|
37
|
+
|
|
38
|
+
<div class="form__run">
|
|
39
|
+
<h2>{{ localization.common.run }}</h2>
|
|
40
|
+
|
|
41
|
+
<div
|
|
42
|
+
class="form__run-frequency"
|
|
43
|
+
:class="{
|
|
44
|
+
'grid-single-col': !model.frequency || model.frequency === 'once',
|
|
45
|
+
}"
|
|
46
|
+
>
|
|
47
|
+
<div>
|
|
48
|
+
<h2 class="frequency">
|
|
49
|
+
{{ localization.scheduledTasks.frequency }}
|
|
50
|
+
</h2>
|
|
51
|
+
<ui-select
|
|
52
|
+
v-model="model.frequency"
|
|
53
|
+
:items="frequencyMethodOptionsLocal"
|
|
54
|
+
test-id="schedule-task-frequency-select"
|
|
55
|
+
:placeholder="localization.scheduledTasks.selectFrequency"
|
|
56
|
+
size="md"
|
|
57
|
+
select-width="100%"
|
|
58
|
+
class="mt-3"
|
|
59
|
+
/>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<common-pages-scheduled-tasks-modals-common-frequency
|
|
63
|
+
v-if="model.frequency"
|
|
64
|
+
v-model="model"
|
|
65
|
+
:type="model.frequency"
|
|
66
|
+
:template-view-mode="props.templateViewMode"
|
|
67
|
+
/>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<div class="form__email">
|
|
72
|
+
<h2>{{ emailCompletionLabel }}</h2>
|
|
73
|
+
<ui-textarea
|
|
74
|
+
id="email-completion"
|
|
75
|
+
v-model="model.ntfn_target"
|
|
76
|
+
placeholder="example1@email.com,example2@email.com"
|
|
77
|
+
test-id="schedule-task-email-completion-field"
|
|
78
|
+
height="84"
|
|
79
|
+
class="form__description"
|
|
80
|
+
/>
|
|
81
|
+
</div>
|
|
82
|
+
</section>
|
|
83
|
+
</form>
|
|
84
|
+
</template>
|
|
85
|
+
|
|
86
|
+
<script lang="ts" setup>
|
|
87
|
+
import type { UI_I_Dropdown } from '~/node_modules/bfg-uikit/components/ui/dropdown/models/interfaces'
|
|
88
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
89
|
+
import type { UI_I_SelectInputItem } from '~/components/common/select/input/lib/models/interfaces'
|
|
90
|
+
import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
|
|
91
|
+
import type { UI_I_InitialValidationFields } from '~/components/common/pages/scheduledTasks/modals/common/taskForm/lib/models/interfaces'
|
|
92
|
+
|
|
93
|
+
const model = defineModel<UI_I_ScheduleNewTasksForm>({ required: true })
|
|
94
|
+
const props = defineProps<{
|
|
95
|
+
target: string
|
|
96
|
+
formValidationFields: UI_I_InitialValidationFields
|
|
97
|
+
taskNameErrorText: string
|
|
98
|
+
frequencyMethodOptions: UI_I_SelectInputItem[]
|
|
99
|
+
templateViewMode: 'horizontal' | 'vertical'
|
|
100
|
+
}>()
|
|
101
|
+
const emits = defineEmits<{
|
|
102
|
+
(event: 'init-validation', value: string[]): void
|
|
103
|
+
}>()
|
|
104
|
+
|
|
105
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
106
|
+
|
|
107
|
+
const onInitValidation = (types: string[]): void => {
|
|
108
|
+
emits('init-validation', types)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const textareaLabel = computed<string>(() => {
|
|
112
|
+
const { description, optional } = localization.value.common
|
|
113
|
+
return `${description} (${optional})`
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
const emailCompletionLabel = computed<string>(() => {
|
|
117
|
+
const { emailNotificationUponCompletion, optional } =
|
|
118
|
+
localization.value.common
|
|
119
|
+
return `${emailNotificationUponCompletion} (${optional})`
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
const frequencyMethodOptionsLocal = computed<UI_I_Dropdown[]>(() =>
|
|
123
|
+
props.frequencyMethodOptions
|
|
124
|
+
.filter((frequency: UI_I_SelectInputItem) => frequency.value !== '')
|
|
125
|
+
.map((item: UI_I_SelectInputItem) => ({
|
|
126
|
+
...item,
|
|
127
|
+
text: item.label,
|
|
128
|
+
}))
|
|
129
|
+
)
|
|
130
|
+
</script>
|
|
131
|
+
|
|
132
|
+
<style lang="scss" scoped>
|
|
133
|
+
.form {
|
|
134
|
+
&__target {
|
|
135
|
+
background-color: var(--info-block-bg);
|
|
136
|
+
border-radius: 8px;
|
|
137
|
+
padding: 12px;
|
|
138
|
+
.text {
|
|
139
|
+
font-family: 'Inter', sans-serif;
|
|
140
|
+
font-size: 13px;
|
|
141
|
+
font-weight: 400;
|
|
142
|
+
color: var(--title-form-first-color);
|
|
143
|
+
}
|
|
144
|
+
/* Target */
|
|
145
|
+
> div:first-child p.text {
|
|
146
|
+
color: #9da6ad; // for dark and light theme
|
|
147
|
+
}
|
|
148
|
+
/* Active */
|
|
149
|
+
> div:last-child p.text {
|
|
150
|
+
text-transform: Capitalize;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
span.text {
|
|
154
|
+
color: var(--title-color);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.icon {
|
|
158
|
+
min-width: 20px;
|
|
159
|
+
width: 20px;
|
|
160
|
+
height: 20px;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&__run,
|
|
165
|
+
&__email {
|
|
166
|
+
border-top: 1px solid var(--horizontal-line);
|
|
167
|
+
padding-top: 16px;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
&__run {
|
|
171
|
+
&-frequency {
|
|
172
|
+
display: grid;
|
|
173
|
+
grid-template-columns: 1fr 1fr;
|
|
174
|
+
grid-gap: 16px;
|
|
175
|
+
&.grid-single-col {
|
|
176
|
+
grid-template-columns: 1fr;
|
|
177
|
+
column-gap: 0;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
h2 {
|
|
183
|
+
font-family: 'Inter', sans-serif;
|
|
184
|
+
color: var(--title-form-first-color);
|
|
185
|
+
font-size: 16px;
|
|
186
|
+
font-weight: 500;
|
|
187
|
+
margin-bottom: 16px;
|
|
188
|
+
&.frequency {
|
|
189
|
+
font-size: 14px;
|
|
190
|
+
margin-bottom: 12px;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
</style>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<label
|
|
10
10
|
:class="[
|
|
11
11
|
'clr-control-container tooltip tooltip-validation tooltip-xs tooltip-bottom-left clr-col-md-8',
|
|
12
|
-
|
|
12
|
+
props.taskNameErrorText && 'invalid',
|
|
13
13
|
]"
|
|
14
14
|
>
|
|
15
15
|
<input
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
@blur="onInitValidation(['taskName'])"
|
|
23
23
|
/>
|
|
24
24
|
<span class="tooltip-content">
|
|
25
|
-
{{
|
|
25
|
+
{{ props.taskNameErrorText }}
|
|
26
26
|
</span>
|
|
27
27
|
</label>
|
|
28
28
|
</div>
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
<common-select-input
|
|
70
70
|
v-model="model.frequency"
|
|
71
71
|
:label="localization.common.run"
|
|
72
|
-
:data="frequencyMethodOptions"
|
|
72
|
+
:data="props.frequencyMethodOptions"
|
|
73
73
|
class="clr-form-control run"
|
|
74
74
|
>
|
|
75
75
|
<template #options="{ value }">
|
|
@@ -101,80 +101,23 @@
|
|
|
101
101
|
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
102
102
|
import type { UI_I_SelectInputItem } from '~/components/common/select/input/lib/models/interfaces'
|
|
103
103
|
import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
|
|
104
|
-
import type { UI_I_InitialValidationFields } from '~/components/common/pages/scheduledTasks/modals/common/
|
|
105
|
-
import type { UI_T_FrequencyType } from '~/components/common/pages/scheduledTasks/modals/common/frequency/lib/models/types'
|
|
106
|
-
import * as cron from '~/components/common/pages/scheduledTasks/modals/common/newTaskForm/lib/utils'
|
|
107
|
-
import { frequencyMethodFunc } from '~/components/common/pages/scheduledTasks/modals/common/frequency/lib/config/frequencyOptions'
|
|
104
|
+
import type { UI_I_InitialValidationFields } from '~/components/common/pages/scheduledTasks/modals/common/taskForm/lib/models/interfaces'
|
|
108
105
|
|
|
106
|
+
const model = defineModel<UI_I_ScheduleNewTasksForm>({ required: true })
|
|
109
107
|
const props = defineProps<{
|
|
110
108
|
target: string
|
|
109
|
+
formValidationFields: UI_I_InitialValidationFields
|
|
110
|
+
taskNameErrorText: string
|
|
111
|
+
frequencyMethodOptions: UI_I_SelectInputItem[]
|
|
112
|
+
}>()
|
|
113
|
+
const emits = defineEmits<{
|
|
114
|
+
(event: 'init-validation', value: string[]): void
|
|
111
115
|
}>()
|
|
112
|
-
const model = defineModel<UI_I_ScheduleNewTasksForm>({ required: true })
|
|
113
116
|
|
|
114
117
|
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
115
118
|
|
|
116
|
-
const initValidationFields = ref<UI_I_InitialValidationFields>({
|
|
117
|
-
taskName: false,
|
|
118
|
-
})
|
|
119
119
|
const onInitValidation = (types: string[]): void => {
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
const userNameErrorText = computed<string>(() => {
|
|
123
|
-
if (!initValidationFields.value.taskName) return ''
|
|
124
|
-
|
|
125
|
-
model.value.task_name = model.value.task_name.replace(/^\s+/, '')
|
|
126
|
-
|
|
127
|
-
return !model.value.task_name ? localization.value.common.fieldRequired : ''
|
|
128
|
-
})
|
|
129
|
-
|
|
130
|
-
const frequencyMethodOptions = computed<UI_I_SelectInputItem[]>(() =>
|
|
131
|
-
frequencyMethodFunc(localization.value)
|
|
132
|
-
)
|
|
133
|
-
|
|
134
|
-
watch(
|
|
135
|
-
model,
|
|
136
|
-
(newValue: UI_I_ScheduleNewTasksForm) => {
|
|
137
|
-
newValue.cron = generateCronExpression(newValue.frequency, newValue)
|
|
138
|
-
},
|
|
139
|
-
{ deep: true }
|
|
140
|
-
)
|
|
141
|
-
|
|
142
|
-
const generateCronExpression = (
|
|
143
|
-
runType: UI_T_FrequencyType,
|
|
144
|
-
interval: UI_I_ScheduleNewTasksForm
|
|
145
|
-
): string => {
|
|
146
|
-
let cronExpression
|
|
147
|
-
|
|
148
|
-
// Генерируем cron-выражение на основе runType
|
|
149
|
-
switch (runType) {
|
|
150
|
-
case 'once':
|
|
151
|
-
const timestamp = Math.floor(
|
|
152
|
-
new Date(interval.frg_on_time).getTime() / 1000
|
|
153
|
-
)
|
|
154
|
-
cronExpression = `* * * * * ${timestamp}:0-0-0-0:once`
|
|
155
|
-
break
|
|
156
|
-
case 'after-startup':
|
|
157
|
-
const suffixDelay =
|
|
158
|
-
interval.frg_after_startup === 0 ? '' : `-${interval.frg_after_startup}`
|
|
159
|
-
cronExpression = `* * * * * after_procurator_startup${suffixDelay}` // Выполняется после запуска procurator_startup с задержой N минут
|
|
160
|
-
break
|
|
161
|
-
case 'hour':
|
|
162
|
-
cronExpression = cron.generateHourlyCronExpression(interval)
|
|
163
|
-
break
|
|
164
|
-
case 'day':
|
|
165
|
-
cronExpression = cron.generateDailyCronExpression(interval)
|
|
166
|
-
break
|
|
167
|
-
case 'week':
|
|
168
|
-
cronExpression = cron.generateWeeklyCronExpression(interval)
|
|
169
|
-
break
|
|
170
|
-
case 'month':
|
|
171
|
-
cronExpression = cron.generateMonthlyCronExpression(interval)
|
|
172
|
-
break
|
|
173
|
-
default:
|
|
174
|
-
cronExpression = '* * * * *'
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
return cronExpression
|
|
120
|
+
emits('init-validation', types)
|
|
178
121
|
}
|
|
179
122
|
</script>
|
|
180
123
|
|