Add grid auto-build functionality with profile management and preview capabilities
Implemented new API endpoints and frontend components for grid auto-building based on predefined profiles. Added functionality to list grid profiles, preview generated grids, and generate grids with specified parameters. Enhanced the TemplateEndpoints and related services to support these features, improving the user experience for channel scheduling. Localization updates were made to accommodate new features in both English and Russian.
This commit is contained in:
@@ -9,6 +9,11 @@ import type {
|
||||
CopyTemplateResultDto,
|
||||
CreatedIdResponse,
|
||||
EntryTraceDto,
|
||||
GenerateGridResultDto,
|
||||
GridGenerationMode,
|
||||
GridPlanDto,
|
||||
GridProfileDto,
|
||||
GridProfileKind,
|
||||
JunctionAmountMode,
|
||||
JunctionConditions,
|
||||
JunctionElementKind,
|
||||
@@ -89,6 +94,31 @@ export function getApplyDiff(channelId: string) {
|
||||
return apiRequest<ScheduleDiffDto>(`/admin/channels/${channelId}/template/diff`)
|
||||
}
|
||||
|
||||
/** Каталог профилей автосборки: имя, на что похоже и для какой библиотеки годится. */
|
||||
export function listGridProfiles() {
|
||||
return apiRequest<GridProfileDto[]>('/admin/grid-profiles')
|
||||
}
|
||||
|
||||
/** План автосборки: что будет создано и что снесено. Считается тем же кодом, что и сама сборка. */
|
||||
export function previewGrid(channelId: string, profile: GridProfileKind, mode: GridGenerationMode) {
|
||||
const query = new URLSearchParams({ profile, mode })
|
||||
return apiRequest<GridPlanDto>(
|
||||
`/admin/channels/${channelId}/template/grid-plan?${query.toString()}`,
|
||||
)
|
||||
}
|
||||
|
||||
/** Собирает сетку по профилю. План пересчитывается на сервере — с клиента едут только опции. */
|
||||
export function generateGrid(
|
||||
channelId: string,
|
||||
profile: GridProfileKind,
|
||||
mode: GridGenerationMode,
|
||||
) {
|
||||
return apiRequest<GenerateGridResultDto>(`/admin/channels/${channelId}/template/generate`, {
|
||||
method: 'POST',
|
||||
body: { profile, mode },
|
||||
})
|
||||
}
|
||||
|
||||
/** Копия сетки на другой канал: слои, слоты, стыки и правила. Группы общие и не копируются. */
|
||||
export function copyTemplateTo(channelId: string, targetChannelId: string) {
|
||||
return apiRequest<CopyTemplateResultDto>(
|
||||
|
||||
Reference in New Issue
Block a user