feat: улучшил синхронизацию лекций
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Failing after 10m14s
Frontend CI / build-and-check (push) Failing after 16m12s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Failing after 14m7s
🚀 Create and publish a Docker image / Build & publish backend image (push) Failing after 14m59s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Failing after 14m57s
Backend CI / build-and-test (push) Failing after 13m27s
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Failing after 10m14s
Frontend CI / build-and-check (push) Failing after 16m12s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Failing after 14m7s
🚀 Create and publish a Docker image / Build & publish backend image (push) Failing after 14m59s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Failing after 14m57s
Backend CI / build-and-test (push) Failing after 13m27s
This commit is contained in:
@@ -204,9 +204,17 @@ export type ApiScheduleTypeId =
|
||||
| 'CUR_CHECK'
|
||||
|
||||
export interface SyncScheduleRequest {
|
||||
specialtyCode?: string | null
|
||||
size: number
|
||||
timeMin?: string | null
|
||||
timeMax?: string | null
|
||||
roomId?: string[] | null
|
||||
attendeePersonId?: string[] | null
|
||||
courseUnitRealizationId?: string[] | null
|
||||
cycleRealizationId?: string[] | null
|
||||
specialtyCode?: string[] | null
|
||||
learningStartYear?: number[] | null
|
||||
profileName?: string[] | null
|
||||
curriculumId?: string[] | null
|
||||
typeId?: ApiScheduleTypeId[] | null
|
||||
}
|
||||
|
||||
|
||||
@@ -36,19 +36,23 @@ const syncErrorDetails = ref<string[]>([])
|
||||
const syncStatus = ref<SyncStatusDto | null>(null)
|
||||
const syncResult = ref<SyncResultDto | null>(null)
|
||||
const isCreateLectureModalOpen = ref(false)
|
||||
const showAdvancedSyncFilters = ref(false)
|
||||
const addToast = inject('addToast') as
|
||||
| ((message: string, type?: 'success' | 'error' | 'info') => void)
|
||||
| undefined
|
||||
const lockedScheduleTypeIds: ApiScheduleTypeId[] = ['LECT', 'EVENT_OTHER', 'CONS']
|
||||
const defaultScheduleTypeIds: ApiScheduleTypeId[] = ['LECT']
|
||||
const scheduleTypeOptions: Array<{ id: ApiScheduleTypeId; label: string }> = [
|
||||
{ id: 'MID_CHECK', label: 'Аттестация' },
|
||||
{ id: 'CONS', label: 'Консультация' },
|
||||
{ id: 'LAB', label: 'Лабораторное занятие' },
|
||||
{ id: 'LECT', label: 'Лекционное занятие' },
|
||||
{ id: 'SEMI', label: 'Практическое занятие' },
|
||||
{ id: 'EVENT_OTHER', label: 'Прочее' },
|
||||
{ id: 'CONS', label: 'Консультация' },
|
||||
{ id: 'MID_CHECK', label: 'Аттестация' },
|
||||
{ id: 'LAB', label: 'Лабораторное занятие' },
|
||||
{ id: 'SEMI', label: 'Практическое занятие' },
|
||||
{ id: 'SELF', label: 'Самостоятельная работа' },
|
||||
{ id: 'CUR_CHECK', label: 'Текущий контроль' },
|
||||
]
|
||||
const syncSchedulePageSize = 900
|
||||
|
||||
function toInputDateTime(date: Date) {
|
||||
const offsetMs = date.getTimezoneOffset() * 60000
|
||||
@@ -61,9 +65,33 @@ const inTwoWeeks = new Date(todayStart)
|
||||
inTwoWeeks.setDate(inTwoWeeks.getDate() + 14)
|
||||
inTwoWeeks.setHours(23, 59, 0, 0)
|
||||
|
||||
function parseStringList(value: string) {
|
||||
return value
|
||||
.split(/[\n,]+/)
|
||||
.map((item) => item.trim())
|
||||
.filter(Boolean)
|
||||
}
|
||||
|
||||
function parseNumberList(value: string) {
|
||||
return parseStringList(value)
|
||||
.map((item) => Number(item))
|
||||
.filter((item) => Number.isInteger(item))
|
||||
}
|
||||
|
||||
function toNullableList<T>(values: T[]) {
|
||||
return values.length ? values : null
|
||||
}
|
||||
|
||||
const syncForm = ref({
|
||||
roomId: '',
|
||||
attendeePersonId: '',
|
||||
courseUnitRealizationId: '',
|
||||
cycleRealizationId: '',
|
||||
specialtyCode: '',
|
||||
typeIds: [] as ApiScheduleTypeId[],
|
||||
learningStartYear: '',
|
||||
profileName: '',
|
||||
curriculumId: '',
|
||||
typeIds: [...defaultScheduleTypeIds],
|
||||
timeMin: toInputDateTime(todayStart),
|
||||
timeMax: toInputDateTime(inTwoWeeks),
|
||||
})
|
||||
@@ -78,6 +106,19 @@ const visibleSyncDetails = computed(() => {
|
||||
if (syncErrorDetails.value.length) return syncErrorDetails.value
|
||||
return visibleSyncResult.value?.details ?? []
|
||||
})
|
||||
const activeAdvancedSyncFilters = computed(() => {
|
||||
const fields = [
|
||||
syncForm.value.roomId,
|
||||
syncForm.value.attendeePersonId,
|
||||
syncForm.value.courseUnitRealizationId,
|
||||
syncForm.value.cycleRealizationId,
|
||||
syncForm.value.specialtyCode,
|
||||
syncForm.value.profileName,
|
||||
syncForm.value.curriculumId,
|
||||
]
|
||||
const filledTextFields = fields.filter((value) => parseStringList(value).length > 0).length
|
||||
return filledTextFields + (parseNumberList(syncForm.value.learningStartYear).length ? 1 : 0)
|
||||
})
|
||||
|
||||
const tabConfig: Record<TabKey, TabConfig> = {
|
||||
lectures: {
|
||||
@@ -211,8 +252,18 @@ async function runScheduleSync() {
|
||||
syncResult.value = null
|
||||
try {
|
||||
syncResult.value = await syncApi.schedule({
|
||||
specialtyCode: syncForm.value.specialtyCode.trim() || null,
|
||||
typeId: syncForm.value.typeIds.length ? syncForm.value.typeIds : null,
|
||||
size: syncSchedulePageSize,
|
||||
roomId: toNullableList(parseStringList(syncForm.value.roomId)),
|
||||
attendeePersonId: toNullableList(parseStringList(syncForm.value.attendeePersonId)),
|
||||
courseUnitRealizationId: toNullableList(
|
||||
parseStringList(syncForm.value.courseUnitRealizationId),
|
||||
),
|
||||
cycleRealizationId: toNullableList(parseStringList(syncForm.value.cycleRealizationId)),
|
||||
specialtyCode: toNullableList(parseStringList(syncForm.value.specialtyCode)),
|
||||
learningStartYear: toNullableList(parseNumberList(syncForm.value.learningStartYear)),
|
||||
profileName: toNullableList(parseStringList(syncForm.value.profileName)),
|
||||
curriculumId: toNullableList(parseStringList(syncForm.value.curriculumId)),
|
||||
typeId: toNullableList(syncForm.value.typeIds),
|
||||
timeMin: syncForm.value.timeMin ? new Date(syncForm.value.timeMin).toISOString() : null,
|
||||
timeMax: syncForm.value.timeMax ? new Date(syncForm.value.timeMax).toISOString() : null,
|
||||
})
|
||||
@@ -298,6 +349,178 @@ onMounted(() => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<GlassCard>
|
||||
<div class="section-heading">
|
||||
<div>
|
||||
<div class="section-title">Синхронизация расписания</div>
|
||||
<div class="sync-meta">{{ syncMeta }}</div>
|
||||
</div>
|
||||
<span class="sync-status" :class="syncStatus?.status ?? 'idle'">{{
|
||||
syncStatus?.status ?? 'idle'
|
||||
}}</span>
|
||||
</div>
|
||||
|
||||
<form class="form" @submit.prevent="runScheduleSync">
|
||||
<div class="sync-fields sync-primary-fields">
|
||||
<label>
|
||||
<span>Период с</span>
|
||||
<input v-model="syncForm.timeMin" class="glass-input" type="datetime-local" required />
|
||||
</label>
|
||||
<label>
|
||||
<span>Период по</span>
|
||||
<input v-model="syncForm.timeMax" class="glass-input" type="datetime-local" required />
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="type-section">
|
||||
<div class="field-title">Типы пар</div>
|
||||
<div class="type-grid">
|
||||
<label
|
||||
v-for="type in scheduleTypeOptions"
|
||||
:key="type.id"
|
||||
class="type-option"
|
||||
:class="{ locked: lockedScheduleTypeIds.includes(type.id) }"
|
||||
>
|
||||
<input
|
||||
v-model="syncForm.typeIds"
|
||||
type="checkbox"
|
||||
:value="type.id"
|
||||
:disabled="!lockedScheduleTypeIds.includes(type.id)"
|
||||
/>
|
||||
<span>{{ type.label }}</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="advanced-sync">
|
||||
<button
|
||||
class="advanced-toggle"
|
||||
type="button"
|
||||
:aria-expanded="showAdvancedSyncFilters"
|
||||
@click="showAdvancedSyncFilters = !showAdvancedSyncFilters"
|
||||
>
|
||||
<span>
|
||||
Дополнительные фильтры
|
||||
<span v-if="activeAdvancedSyncFilters"> · {{ activeAdvancedSyncFilters }}</span>
|
||||
</span>
|
||||
<span class="advanced-toggle-icon" :class="{ open: showAdvancedSyncFilters }">⌄</span>
|
||||
</button>
|
||||
|
||||
<div v-show="showAdvancedSyncFilters" class="sync-fields sync-advanced-fields">
|
||||
<label>
|
||||
<span>ID аудиторий</span>
|
||||
<textarea
|
||||
v-model="syncForm.roomId"
|
||||
class="glass-input"
|
||||
placeholder="UUID, UUID"
|
||||
rows="2"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
<span>ID участников</span>
|
||||
<textarea
|
||||
v-model="syncForm.attendeePersonId"
|
||||
class="glass-input"
|
||||
placeholder="UUID, UUID"
|
||||
rows="2"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
<span>ID реализаций курсов</span>
|
||||
<textarea
|
||||
v-model="syncForm.courseUnitRealizationId"
|
||||
class="glass-input"
|
||||
placeholder="UUID, UUID"
|
||||
rows="2"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
<span>ID реализаций циклов</span>
|
||||
<textarea
|
||||
v-model="syncForm.cycleRealizationId"
|
||||
class="glass-input"
|
||||
placeholder="UUID, UUID"
|
||||
rows="2"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
<span>Коды специальностей</span>
|
||||
<input
|
||||
v-model="syncForm.specialtyCode"
|
||||
class="glass-input"
|
||||
placeholder="09.03.04, 01.03.02"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
<span>Годы начала обучения</span>
|
||||
<input
|
||||
v-model="syncForm.learningStartYear"
|
||||
class="glass-input"
|
||||
placeholder="2022, 2023"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
<span>Названия профилей</span>
|
||||
<textarea
|
||||
v-model="syncForm.profileName"
|
||||
class="glass-input"
|
||||
placeholder="Название профиля"
|
||||
rows="2"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
<span>ID учебных планов</span>
|
||||
<textarea
|
||||
v-model="syncForm.curriculumId"
|
||||
class="glass-input"
|
||||
placeholder="UUID, UUID"
|
||||
rows="2"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<button class="btn-primary" type="submit" :disabled="syncingSchedule">
|
||||
{{ syncingSchedule ? 'Синхронизируем...' : 'Синхронизировать лекции' }}
|
||||
</button>
|
||||
<button
|
||||
class="btn-secondary"
|
||||
type="button"
|
||||
:disabled="syncingRooms"
|
||||
@click="runRoomsSync"
|
||||
>
|
||||
{{ syncingRooms ? 'Синхронизируем...' : 'Синхронизировать аудитории' }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="visibleSyncResult"
|
||||
class="sync-result"
|
||||
:class="{ failed: Boolean(syncError || visibleSyncResult.error) }"
|
||||
>
|
||||
<template v-if="syncError || visibleSyncResult.error">
|
||||
{{ syncError || visibleSyncResult.error }}
|
||||
</template>
|
||||
<template v-else>
|
||||
Создано: {{ visibleSyncResult.created }} / обновлено:
|
||||
{{ visibleSyncResult.updated }} / пропущено: {{ visibleSyncResult.skipped }}
|
||||
</template>
|
||||
</div>
|
||||
<div v-else-if="syncError" class="sync-result failed">
|
||||
{{ syncError }}
|
||||
</div>
|
||||
<details v-if="visibleSyncDetails.length" class="sync-details">
|
||||
<summary>Подробности ошибки</summary>
|
||||
<ul>
|
||||
<li v-for="detail in visibleSyncDetails" :key="detail">
|
||||
{{ detail }}
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
</form>
|
||||
</GlassCard>
|
||||
|
||||
<div class="tabs">
|
||||
<button :class="{ active: activeTab === 'lectures' }" @click="activeTab = 'lectures'">
|
||||
Лекции
|
||||
@@ -321,69 +544,6 @@ onMounted(() => {
|
||||
/>
|
||||
<DataTable :columns="current.columns" :rows="current.rows" />
|
||||
</GlassCard>
|
||||
|
||||
<GlassCard>
|
||||
<div class="section-heading">
|
||||
<div>
|
||||
<div class="section-title">Синхронизация расписания</div>
|
||||
<div class="sync-meta">{{ syncMeta }}</div>
|
||||
</div>
|
||||
<span class="sync-status" :class="syncStatus?.status ?? 'idle'">{{
|
||||
syncStatus?.status ?? 'idle'
|
||||
}}</span>
|
||||
</div>
|
||||
|
||||
<form class="form" @submit.prevent="runScheduleSync">
|
||||
<label>Период с</label>
|
||||
<input v-model="syncForm.timeMin" class="glass-input" type="datetime-local" />
|
||||
<label>Период по</label>
|
||||
<input v-model="syncForm.timeMax" class="glass-input" type="datetime-local" />
|
||||
<label>Код специальности</label>
|
||||
<input
|
||||
v-model="syncForm.specialtyCode"
|
||||
class="glass-input"
|
||||
placeholder="Например, 09.03.04"
|
||||
/>
|
||||
<label>Типы пар</label>
|
||||
<div class="type-grid">
|
||||
<label v-for="type in scheduleTypeOptions" :key="type.id" class="type-option">
|
||||
<input v-model="syncForm.typeIds" type="checkbox" :value="type.id" />
|
||||
<span>{{ type.label }}</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div v-if="visibleSyncResult" class="sync-result">
|
||||
Создано: {{ visibleSyncResult.created }}, обновлено: {{ visibleSyncResult.updated }},
|
||||
пропущено:
|
||||
{{ visibleSyncResult.skipped }}
|
||||
</div>
|
||||
<div v-if="syncError || visibleSyncResult?.error" class="sync-error">
|
||||
{{ syncError || visibleSyncResult?.error }}
|
||||
</div>
|
||||
<details v-if="visibleSyncDetails.length" class="sync-details">
|
||||
<summary>Подробности ошибки</summary>
|
||||
<ul>
|
||||
<li v-for="detail in visibleSyncDetails" :key="detail">
|
||||
{{ detail }}
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<div class="form-actions">
|
||||
<button class="btn-primary" type="submit" :disabled="syncingSchedule">
|
||||
{{ syncingSchedule ? 'Синхронизируем...' : 'Синхронизировать лекции' }}
|
||||
</button>
|
||||
<button
|
||||
class="btn-secondary"
|
||||
type="button"
|
||||
:disabled="syncingRooms"
|
||||
@click="runRoomsSync"
|
||||
>
|
||||
{{ syncingRooms ? 'Синхронизируем...' : 'Синхронизировать аудитории' }}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</GlassCard>
|
||||
</div>
|
||||
|
||||
<CreateLectureModal
|
||||
@@ -438,7 +598,7 @@ onMounted(() => {
|
||||
}
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
|
||||
grid-template-columns: 1fr;
|
||||
gap: 16px;
|
||||
}
|
||||
.section-heading {
|
||||
@@ -458,46 +618,168 @@ onMounted(() => {
|
||||
font-weight: 600;
|
||||
color: var(--color-text-secondary);
|
||||
}
|
||||
.sync-fields {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
|
||||
gap: 10px;
|
||||
}
|
||||
.sync-primary-fields {
|
||||
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
|
||||
align-items: end;
|
||||
}
|
||||
.sync-fields label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
.sync-fields textarea {
|
||||
min-height: 68px;
|
||||
resize: vertical;
|
||||
}
|
||||
.type-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
.field-title {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: var(--color-text-secondary);
|
||||
}
|
||||
.advanced-sync {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
.advanced-toggle {
|
||||
width: 100%;
|
||||
min-height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
border: 1px solid var(--color-slate-500-a20);
|
||||
border-radius: var(--radius-sm);
|
||||
padding: 8px 12px;
|
||||
background: var(--color-white-a90);
|
||||
color: var(--color-text);
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 4px 14px var(--color-black-a04);
|
||||
}
|
||||
.advanced-toggle:hover {
|
||||
border-color: var(--color-primary-a30);
|
||||
background: var(--color-white-a96);
|
||||
}
|
||||
.advanced-toggle:focus-visible {
|
||||
outline: 2px solid var(--color-primary);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.advanced-toggle[aria-expanded='true'] {
|
||||
border-color: var(--color-primary-a30);
|
||||
background: var(--color-primary-a08);
|
||||
color: var(--color-primary-border);
|
||||
}
|
||||
.advanced-toggle-icon {
|
||||
line-height: 1;
|
||||
transition: transform 0.16s ease;
|
||||
}
|
||||
.advanced-toggle-icon.open {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
.sync-advanced-fields {
|
||||
grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
|
||||
border: 1px solid var(--color-slate-500-a20);
|
||||
border-radius: var(--radius-sm);
|
||||
padding: 12px;
|
||||
background: var(--color-white-a82);
|
||||
box-shadow: 0 8px 22px var(--color-black-a04), inset 0 1px 0 var(--color-white-a90);
|
||||
}
|
||||
.sync-advanced-fields .glass-input {
|
||||
background: var(--color-white-a96);
|
||||
border-color: var(--color-slate-500-a20);
|
||||
}
|
||||
.form-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.type-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
.type-option {
|
||||
min-height: 38px;
|
||||
position: relative;
|
||||
min-height: 32px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 8px 10px;
|
||||
border: 1px solid var(--color-border-glass);
|
||||
border-radius: var(--radius-sm);
|
||||
background: var(--color-white-a72);
|
||||
padding: 8px 14px;
|
||||
border: 1px solid var(--color-slate-500-a20);
|
||||
border-radius: 10px;
|
||||
background: var(--color-white-a86);
|
||||
color: var(--color-text);
|
||||
cursor: pointer;
|
||||
cursor: default;
|
||||
transition:
|
||||
background 0.16s ease,
|
||||
border-color 0.16s ease,
|
||||
color 0.16s ease;
|
||||
}
|
||||
.type-option input {
|
||||
flex: 0 0 auto;
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
opacity: 0;
|
||||
cursor: default;
|
||||
}
|
||||
.type-option.locked,
|
||||
.type-option.locked input {
|
||||
cursor: pointer;
|
||||
}
|
||||
.type-option span {
|
||||
font-size: 13px;
|
||||
line-height: 1.2;
|
||||
}
|
||||
.type-option:not(.locked) {
|
||||
border-color: var(--color-slate-500-a10);
|
||||
background: var(--color-white-a50);
|
||||
color: var(--color-text-secondary);
|
||||
opacity: 0.62;
|
||||
}
|
||||
.type-option:has(input:checked) {
|
||||
border-color: var(--color-primary-a30);
|
||||
background: var(--color-primary-a18);
|
||||
color: var(--color-primary-dark);
|
||||
font-weight: 600;
|
||||
}
|
||||
.type-option.locked:hover {
|
||||
border-color: var(--color-primary-a30);
|
||||
background: var(--color-primary-a18);
|
||||
}
|
||||
.type-option:not(.locked):hover {
|
||||
border-color: var(--color-slate-500-a10);
|
||||
background: var(--color-white-a50);
|
||||
}
|
||||
.type-option:has(input:checked):hover,
|
||||
.type-option:has(input:checked):active {
|
||||
background: var(--color-primary-a25);
|
||||
}
|
||||
.sync-meta {
|
||||
font-size: 12px;
|
||||
color: var(--color-text-secondary);
|
||||
margin-top: 4px;
|
||||
}
|
||||
.sync-result {
|
||||
border: 1px solid var(--color-primary-light);
|
||||
border-radius: var(--radius-sm);
|
||||
padding: 9px 12px;
|
||||
background: var(--color-success-bg-a90);
|
||||
font-size: 13px;
|
||||
color: var(--color-text-secondary);
|
||||
color: var(--color-success-text);
|
||||
}
|
||||
.sync-error {
|
||||
font-size: 13px;
|
||||
.sync-result.failed {
|
||||
border-color: var(--color-danger-light);
|
||||
background: var(--color-danger-bg-a90);
|
||||
color: var(--color-error);
|
||||
}
|
||||
.sync-details {
|
||||
|
||||
Reference in New Issue
Block a user