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:
@@ -19,10 +19,11 @@ public class SyncController : ControllerBase
|
|||||||
/// <summary>Запустить синхронизацию расписания лекций из Modeus.</summary>
|
/// <summary>Запустить синхронизацию расписания лекций из Modeus.</summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Только Admin. Выполняет upsert лекций и связанных курсов на основе данных
|
/// Только Admin. Выполняет upsert лекций и связанных курсов на основе данных
|
||||||
/// из внешнего API `schedule.rdcenter.ru`. Поддерживает фильтрацию по специальности,
|
/// из внешнего API `schedule.rdcenter.ru`. Поддерживает фильтрацию по периоду,
|
||||||
/// периоду и типу занятий.
|
/// размеру выборки, аудиториям, участникам, реализациям курсов/циклов,
|
||||||
|
/// специальностям, годам набора, профилям, учебным планам и типам занятий.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="req">Параметры синхронизации: specialtyCode, timeMin/timeMax, typeId.</param>
|
/// <param name="req">Параметры поиска событий во внешнем сервисе расписания.</param>
|
||||||
/// <response code="200">Результат синхронизации: кол-во созданных, обновлённых и пропущенных записей.</response>
|
/// <response code="200">Результат синхронизации: кол-во созданных, обновлённых и пропущенных записей.</response>
|
||||||
/// <response code="401">Требуется аутентификация.</response>
|
/// <response code="401">Требуется аутентификация.</response>
|
||||||
/// <response code="403">Требуется роль Admin.</response>
|
/// <response code="403">Требуется роль Admin.</response>
|
||||||
|
|||||||
@@ -2994,9 +2994,9 @@
|
|||||||
"Sync"
|
"Sync"
|
||||||
],
|
],
|
||||||
"summary": "Запустить синхронизацию расписания лекций из Modeus.",
|
"summary": "Запустить синхронизацию расписания лекций из Modeus.",
|
||||||
"description": "Только Admin. Выполняет upsert лекций и связанных курсов на основе данных\nиз внешнего API `schedule.rdcenter.ru`. Поддерживает фильтрацию по специальности,\nпериоду и типу занятий.\n\n**Required roles:** Admin",
|
"description": "Только Admin. Выполняет upsert лекций и связанных курсов на основе данных\nиз внешнего API `schedule.rdcenter.ru`. Поддерживает фильтрацию по периоду,\nразмеру выборки, аудиториям, участникам, реализациям курсов/циклов,\nспециальностям, годам набора, профилям, учебным планам и типам занятий.\n\n**Required roles:** Admin",
|
||||||
"requestBody": {
|
"requestBody": {
|
||||||
"description": "Параметры синхронизации: specialtyCode, timeMin/timeMax, typeId.",
|
"description": "Параметры поиска событий во внешнем сервисе расписания.",
|
||||||
"content": {
|
"content": {
|
||||||
"application/json": {
|
"application/json": {
|
||||||
"schema": {
|
"schema": {
|
||||||
@@ -5725,7 +5725,10 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"specialtyCode": {
|
"specialtyCode": {
|
||||||
"type": "string",
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"nullable": true
|
"nullable": true
|
||||||
},
|
},
|
||||||
"timeMin": {
|
"timeMin": {
|
||||||
@@ -5744,6 +5747,61 @@
|
|||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"nullable": true
|
"nullable": true
|
||||||
|
},
|
||||||
|
"size": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32",
|
||||||
|
"nullable": true
|
||||||
|
},
|
||||||
|
"roomId": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"nullable": true
|
||||||
|
},
|
||||||
|
"attendeePersonId": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"nullable": true
|
||||||
|
},
|
||||||
|
"courseUnitRealizationId": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"nullable": true
|
||||||
|
},
|
||||||
|
"cycleRealizationId": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"nullable": true
|
||||||
|
},
|
||||||
|
"learningStartYear": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"nullable": true
|
||||||
|
},
|
||||||
|
"profileName": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"nullable": true
|
||||||
|
},
|
||||||
|
"curriculumId": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"nullable": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
|
|||||||
@@ -1,10 +1,18 @@
|
|||||||
namespace UniVerse.Application.DTOs.Sync;
|
namespace UniVerse.Application.DTOs.Sync;
|
||||||
|
|
||||||
public record SyncScheduleRequest(
|
public record SyncScheduleRequest(
|
||||||
string? SpecialtyCode,
|
IReadOnlyList<string>? SpecialtyCode,
|
||||||
DateTime? TimeMin,
|
DateTime? TimeMin,
|
||||||
DateTime? TimeMax,
|
DateTime? TimeMax,
|
||||||
IReadOnlyList<string>? TypeId
|
IReadOnlyList<string>? TypeId,
|
||||||
|
int? Size = null,
|
||||||
|
IReadOnlyList<string>? RoomId = null,
|
||||||
|
IReadOnlyList<string>? AttendeePersonId = null,
|
||||||
|
IReadOnlyList<string>? CourseUnitRealizationId = null,
|
||||||
|
IReadOnlyList<string>? CycleRealizationId = null,
|
||||||
|
IReadOnlyList<int>? LearningStartYear = null,
|
||||||
|
IReadOnlyList<string>? ProfileName = null,
|
||||||
|
IReadOnlyList<string>? CurriculumId = null
|
||||||
);
|
);
|
||||||
|
|
||||||
public record SyncResultDto(
|
public record SyncResultDto(
|
||||||
|
|||||||
@@ -24,29 +24,30 @@ public class ModeusApiClient : IModeusApiClient
|
|||||||
|
|
||||||
public async Task<ModeusEventsResponse> SearchEventsAsync(SyncScheduleRequest request)
|
public async Task<ModeusEventsResponse> SearchEventsAsync(SyncScheduleRequest request)
|
||||||
{
|
{
|
||||||
const int pageSize = 900;
|
var pageSize = request.Size is > 0 ? request.Size.Value : 900;
|
||||||
var specialtyCodes = string.IsNullOrWhiteSpace(request.SpecialtyCode)
|
|
||||||
? []
|
|
||||||
: request.SpecialtyCode
|
|
||||||
.Split(',', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
|
||||||
var typeIds = request.TypeId ?? [];
|
|
||||||
var body = new Dictionary<string, object?>
|
var body = new Dictionary<string, object?>
|
||||||
{
|
{
|
||||||
["size"] = pageSize,
|
["size"] = pageSize,
|
||||||
["timeMin"] = request.TimeMin,
|
["timeMin"] = request.TimeMin,
|
||||||
["timeMax"] = request.TimeMax,
|
["timeMax"] = request.TimeMax
|
||||||
["specialtyCode"] = specialtyCodes
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (typeIds.Count > 0)
|
AddNonEmpty(body, "roomId", request.RoomId);
|
||||||
body["typeId"] = typeIds;
|
AddNonEmpty(body, "attendeePersonId", request.AttendeePersonId);
|
||||||
|
AddNonEmpty(body, "courseUnitRealizationId", request.CourseUnitRealizationId);
|
||||||
|
AddNonEmpty(body, "cycleRealizationId", request.CycleRealizationId);
|
||||||
|
AddNonEmpty(body, "specialtyCode", request.SpecialtyCode);
|
||||||
|
AddNonEmpty(body, "learningStartYear", request.LearningStartYear);
|
||||||
|
AddNonEmpty(body, "profileName", request.ProfileName);
|
||||||
|
AddNonEmpty(body, "curriculumId", request.CurriculumId);
|
||||||
|
AddNonEmpty(body, "typeId", request.TypeId);
|
||||||
|
|
||||||
var response = await _http.PostAsJsonAsync("/api/proxy/events/search", body);
|
var response = await _http.PostAsJsonAsync("/api/proxy/events/search", body);
|
||||||
var requestJson = JsonSerializer.Serialize(body);
|
var requestJson = JsonSerializer.Serialize(body);
|
||||||
await EnsureSuccessAsync(response, "Modeus events search",
|
await EnsureSuccessAsync(response, "Modeus events search",
|
||||||
BuildEventsRequestSummary(pageSize, specialtyCodes, request.TimeMin, request.TimeMax, typeIds, requestJson));
|
BuildEventsRequestSummary(requestJson));
|
||||||
return await ReadJsonAsync<ModeusEventsResponse>(response, "Modeus events search",
|
return await ReadJsonAsync<ModeusEventsResponse>(response, "Modeus events search",
|
||||||
BuildEventsRequestSummary(pageSize, specialtyCodes, request.TimeMin, request.TimeMax, typeIds, requestJson))
|
BuildEventsRequestSummary(requestJson))
|
||||||
?? new ModeusEventsResponse();
|
?? new ModeusEventsResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,16 +98,15 @@ public class ModeusApiClient : IModeusApiClient
|
|||||||
response.StatusCode);
|
response.StatusCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string BuildEventsRequestSummary(
|
private static string BuildEventsRequestSummary(string requestJson) => $"Request JSON: {requestJson}";
|
||||||
int size,
|
|
||||||
IReadOnlyList<string> specialtyCodes,
|
private static void AddNonEmpty<T>(
|
||||||
DateTime? timeMin,
|
IDictionary<string, object?> body,
|
||||||
DateTime? timeMax,
|
string key,
|
||||||
IReadOnlyList<string> typeIds,
|
IReadOnlyList<T>? values)
|
||||||
string requestJson)
|
|
||||||
{
|
{
|
||||||
var typeFilter = typeIds.Count > 0 ? $"typeId=[{string.Join(", ", typeIds)}]" : "typeId=<omitted>";
|
if (values is { Count: > 0 })
|
||||||
return $"size={size}, specialtyCode=[{string.Join(", ", specialtyCodes)}], timeMin={timeMin:O}, timeMax={timeMax:O}, {typeFilter}. Request JSON: {requestJson}";
|
body[key] = values;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task<T?> ReadJsonAsync<T>(HttpResponseMessage response, string operation, string requestSummary)
|
private static async Task<T?> ReadJsonAsync<T>(HttpResponseMessage response, string operation, string requestSummary)
|
||||||
|
|||||||
@@ -104,9 +104,6 @@ public class ScheduleSyncService : IScheduleSyncService
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Schedule sync failed");
|
_logger.LogError(ex, "Schedule sync failed");
|
||||||
var specialtyCodes = string.IsNullOrWhiteSpace(request.SpecialtyCode)
|
|
||||||
? []
|
|
||||||
: request.SpecialtyCode.Split(',', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
|
||||||
var result = new SyncResultDto(created, updated, skipped, ex.Message, BuildErrorDetails(
|
var result = new SyncResultDto(created, updated, skipped, ex.Message, BuildErrorDetails(
|
||||||
ex,
|
ex,
|
||||||
stage,
|
stage,
|
||||||
@@ -114,14 +111,9 @@ public class ScheduleSyncService : IScheduleSyncService
|
|||||||
updated,
|
updated,
|
||||||
skipped,
|
skipped,
|
||||||
[
|
[
|
||||||
"size=900",
|
|
||||||
$"requestJson={BuildScheduleRequestJson(request)}",
|
$"requestJson={BuildScheduleRequestJson(request)}",
|
||||||
$"specialtyCode=[{string.Join(", ", specialtyCodes)}]",
|
|
||||||
$"timeMin={request.TimeMin:O}",
|
$"timeMin={request.TimeMin:O}",
|
||||||
$"timeMax={request.TimeMax:O}",
|
$"timeMax={request.TimeMax:O}"
|
||||||
request.TypeId is { Count: > 0 }
|
|
||||||
? $"typeId=[{string.Join(", ", request.TypeId)}]"
|
|
||||||
: "typeId=<omitted>"
|
|
||||||
]));
|
]));
|
||||||
_lastStatus = new SyncStatusDto(DateTime.UtcNow, "failed", result);
|
_lastStatus = new SyncStatusDto(DateTime.UtcNow, "failed", result);
|
||||||
return result;
|
return result;
|
||||||
@@ -498,24 +490,35 @@ public class ScheduleSyncService : IScheduleSyncService
|
|||||||
|
|
||||||
private static string BuildScheduleRequestJson(SyncScheduleRequest request)
|
private static string BuildScheduleRequestJson(SyncScheduleRequest request)
|
||||||
{
|
{
|
||||||
var specialtyCodes = string.IsNullOrWhiteSpace(request.SpecialtyCode)
|
|
||||||
? []
|
|
||||||
: request.SpecialtyCode.Split(',', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
|
||||||
|
|
||||||
var body = new Dictionary<string, object?>
|
var body = new Dictionary<string, object?>
|
||||||
{
|
{
|
||||||
["size"] = 900,
|
["size"] = request.Size is > 0 ? request.Size.Value : 900,
|
||||||
["timeMin"] = request.TimeMin,
|
["timeMin"] = request.TimeMin,
|
||||||
["timeMax"] = request.TimeMax,
|
["timeMax"] = request.TimeMax
|
||||||
["specialtyCode"] = specialtyCodes
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (request.TypeId is { Count: > 0 })
|
AddNonEmpty(body, "roomId", request.RoomId);
|
||||||
body["typeId"] = request.TypeId;
|
AddNonEmpty(body, "attendeePersonId", request.AttendeePersonId);
|
||||||
|
AddNonEmpty(body, "courseUnitRealizationId", request.CourseUnitRealizationId);
|
||||||
|
AddNonEmpty(body, "cycleRealizationId", request.CycleRealizationId);
|
||||||
|
AddNonEmpty(body, "specialtyCode", request.SpecialtyCode);
|
||||||
|
AddNonEmpty(body, "learningStartYear", request.LearningStartYear);
|
||||||
|
AddNonEmpty(body, "profileName", request.ProfileName);
|
||||||
|
AddNonEmpty(body, "curriculumId", request.CurriculumId);
|
||||||
|
AddNonEmpty(body, "typeId", request.TypeId);
|
||||||
|
|
||||||
return JsonSerializer.Serialize(body);
|
return JsonSerializer.Serialize(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void AddNonEmpty<T>(
|
||||||
|
IDictionary<string, object?> body,
|
||||||
|
string key,
|
||||||
|
IReadOnlyList<T>? values)
|
||||||
|
{
|
||||||
|
if (values is { Count: > 0 })
|
||||||
|
body[key] = values;
|
||||||
|
}
|
||||||
|
|
||||||
private static string? GetHrefId(string? href)
|
private static string? GetHrefId(string? href)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(href))
|
if (string.IsNullOrWhiteSpace(href))
|
||||||
|
|||||||
@@ -204,9 +204,17 @@ export type ApiScheduleTypeId =
|
|||||||
| 'CUR_CHECK'
|
| 'CUR_CHECK'
|
||||||
|
|
||||||
export interface SyncScheduleRequest {
|
export interface SyncScheduleRequest {
|
||||||
specialtyCode?: string | null
|
size: number
|
||||||
timeMin?: string | null
|
timeMin?: string | null
|
||||||
timeMax?: 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
|
typeId?: ApiScheduleTypeId[] | null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,19 +36,23 @@ const syncErrorDetails = ref<string[]>([])
|
|||||||
const syncStatus = ref<SyncStatusDto | null>(null)
|
const syncStatus = ref<SyncStatusDto | null>(null)
|
||||||
const syncResult = ref<SyncResultDto | null>(null)
|
const syncResult = ref<SyncResultDto | null>(null)
|
||||||
const isCreateLectureModalOpen = ref(false)
|
const isCreateLectureModalOpen = ref(false)
|
||||||
|
const showAdvancedSyncFilters = ref(false)
|
||||||
const addToast = inject('addToast') as
|
const addToast = inject('addToast') as
|
||||||
| ((message: string, type?: 'success' | 'error' | 'info') => void)
|
| ((message: string, type?: 'success' | 'error' | 'info') => void)
|
||||||
| undefined
|
| undefined
|
||||||
|
const lockedScheduleTypeIds: ApiScheduleTypeId[] = ['LECT', 'EVENT_OTHER', 'CONS']
|
||||||
|
const defaultScheduleTypeIds: ApiScheduleTypeId[] = ['LECT']
|
||||||
const scheduleTypeOptions: Array<{ id: ApiScheduleTypeId; label: string }> = [
|
const scheduleTypeOptions: Array<{ id: ApiScheduleTypeId; label: string }> = [
|
||||||
{ id: 'MID_CHECK', label: 'Аттестация' },
|
|
||||||
{ id: 'CONS', label: 'Консультация' },
|
|
||||||
{ id: 'LAB', label: 'Лабораторное занятие' },
|
|
||||||
{ id: 'LECT', label: 'Лекционное занятие' },
|
{ id: 'LECT', label: 'Лекционное занятие' },
|
||||||
{ id: 'SEMI', label: 'Практическое занятие' },
|
|
||||||
{ id: 'EVENT_OTHER', label: 'Прочее' },
|
{ id: 'EVENT_OTHER', label: 'Прочее' },
|
||||||
|
{ id: 'CONS', label: 'Консультация' },
|
||||||
|
{ id: 'MID_CHECK', label: 'Аттестация' },
|
||||||
|
{ id: 'LAB', label: 'Лабораторное занятие' },
|
||||||
|
{ id: 'SEMI', label: 'Практическое занятие' },
|
||||||
{ id: 'SELF', label: 'Самостоятельная работа' },
|
{ id: 'SELF', label: 'Самостоятельная работа' },
|
||||||
{ id: 'CUR_CHECK', label: 'Текущий контроль' },
|
{ id: 'CUR_CHECK', label: 'Текущий контроль' },
|
||||||
]
|
]
|
||||||
|
const syncSchedulePageSize = 900
|
||||||
|
|
||||||
function toInputDateTime(date: Date) {
|
function toInputDateTime(date: Date) {
|
||||||
const offsetMs = date.getTimezoneOffset() * 60000
|
const offsetMs = date.getTimezoneOffset() * 60000
|
||||||
@@ -61,9 +65,33 @@ const inTwoWeeks = new Date(todayStart)
|
|||||||
inTwoWeeks.setDate(inTwoWeeks.getDate() + 14)
|
inTwoWeeks.setDate(inTwoWeeks.getDate() + 14)
|
||||||
inTwoWeeks.setHours(23, 59, 0, 0)
|
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({
|
const syncForm = ref({
|
||||||
|
roomId: '',
|
||||||
|
attendeePersonId: '',
|
||||||
|
courseUnitRealizationId: '',
|
||||||
|
cycleRealizationId: '',
|
||||||
specialtyCode: '',
|
specialtyCode: '',
|
||||||
typeIds: [] as ApiScheduleTypeId[],
|
learningStartYear: '',
|
||||||
|
profileName: '',
|
||||||
|
curriculumId: '',
|
||||||
|
typeIds: [...defaultScheduleTypeIds],
|
||||||
timeMin: toInputDateTime(todayStart),
|
timeMin: toInputDateTime(todayStart),
|
||||||
timeMax: toInputDateTime(inTwoWeeks),
|
timeMax: toInputDateTime(inTwoWeeks),
|
||||||
})
|
})
|
||||||
@@ -78,6 +106,19 @@ const visibleSyncDetails = computed(() => {
|
|||||||
if (syncErrorDetails.value.length) return syncErrorDetails.value
|
if (syncErrorDetails.value.length) return syncErrorDetails.value
|
||||||
return visibleSyncResult.value?.details ?? []
|
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> = {
|
const tabConfig: Record<TabKey, TabConfig> = {
|
||||||
lectures: {
|
lectures: {
|
||||||
@@ -211,8 +252,18 @@ async function runScheduleSync() {
|
|||||||
syncResult.value = null
|
syncResult.value = null
|
||||||
try {
|
try {
|
||||||
syncResult.value = await syncApi.schedule({
|
syncResult.value = await syncApi.schedule({
|
||||||
specialtyCode: syncForm.value.specialtyCode.trim() || null,
|
size: syncSchedulePageSize,
|
||||||
typeId: syncForm.value.typeIds.length ? syncForm.value.typeIds : null,
|
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,
|
timeMin: syncForm.value.timeMin ? new Date(syncForm.value.timeMin).toISOString() : null,
|
||||||
timeMax: syncForm.value.timeMax ? new Date(syncForm.value.timeMax).toISOString() : null,
|
timeMax: syncForm.value.timeMax ? new Date(syncForm.value.timeMax).toISOString() : null,
|
||||||
})
|
})
|
||||||
@@ -298,6 +349,178 @@ onMounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
</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">
|
<div class="tabs">
|
||||||
<button :class="{ active: activeTab === 'lectures' }" @click="activeTab = 'lectures'">
|
<button :class="{ active: activeTab === 'lectures' }" @click="activeTab = 'lectures'">
|
||||||
Лекции
|
Лекции
|
||||||
@@ -321,69 +544,6 @@ onMounted(() => {
|
|||||||
/>
|
/>
|
||||||
<DataTable :columns="current.columns" :rows="current.rows" />
|
<DataTable :columns="current.columns" :rows="current.rows" />
|
||||||
</GlassCard>
|
</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>
|
</div>
|
||||||
|
|
||||||
<CreateLectureModal
|
<CreateLectureModal
|
||||||
@@ -438,7 +598,7 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
.grid {
|
.grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
|
grid-template-columns: 1fr;
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
}
|
}
|
||||||
.section-heading {
|
.section-heading {
|
||||||
@@ -458,46 +618,168 @@ onMounted(() => {
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: var(--color-text-secondary);
|
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 {
|
.form-actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
.type-grid {
|
.type-grid {
|
||||||
display: grid;
|
display: flex;
|
||||||
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
flex-wrap: wrap;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
}
|
}
|
||||||
.type-option {
|
.type-option {
|
||||||
min-height: 38px;
|
position: relative;
|
||||||
|
min-height: 32px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
padding: 8px 14px;
|
||||||
padding: 8px 10px;
|
border: 1px solid var(--color-slate-500-a20);
|
||||||
border: 1px solid var(--color-border-glass);
|
border-radius: 10px;
|
||||||
border-radius: var(--radius-sm);
|
background: var(--color-white-a86);
|
||||||
background: var(--color-white-a72);
|
|
||||||
color: var(--color-text);
|
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 {
|
.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 {
|
.type-option span {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
line-height: 1.2;
|
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 {
|
.sync-meta {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: var(--color-text-secondary);
|
color: var(--color-text-secondary);
|
||||||
margin-top: 4px;
|
margin-top: 4px;
|
||||||
}
|
}
|
||||||
.sync-result {
|
.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;
|
font-size: 13px;
|
||||||
color: var(--color-text-secondary);
|
color: var(--color-success-text);
|
||||||
}
|
}
|
||||||
.sync-error {
|
.sync-result.failed {
|
||||||
font-size: 13px;
|
border-color: var(--color-danger-light);
|
||||||
|
background: var(--color-danger-bg-a90);
|
||||||
color: var(--color-error);
|
color: var(--color-error);
|
||||||
}
|
}
|
||||||
.sync-details {
|
.sync-details {
|
||||||
|
|||||||
Reference in New Issue
Block a user