Add restore functionality for template management and enhance related components
Implemented a new endpoint for restoring templates to their last applied state, allowing users to revert changes made since the last application. Updated the ScheduleTemplate class to include a snapshot of the last applied state, enabling rollback capabilities. Enhanced the frontend with a restore button in the ChannelDetail component, providing users with a confirmation prompt before executing the restore action. Localization updates were made to support new UI strings in both English and Russian, improving the overall user experience in template management.
This commit is contained in:
@@ -20,6 +20,7 @@ import type {
|
||||
JunctionTemplateDto,
|
||||
LayerApplicability,
|
||||
PlanningRules,
|
||||
RestoreTemplateResultDto,
|
||||
ScheduleDiffDto,
|
||||
ScheduleEntryDto,
|
||||
SchedulePreviewDto,
|
||||
@@ -84,6 +85,16 @@ export function applyChannelTemplate(channelId: string) {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Откат правок сетки к состоянию, по которому идёт эфир: восстанавливает слои, слоты и правила
|
||||
* из снимка последнего применения. Ленту не трогает — она и так по этому состоянию.
|
||||
*/
|
||||
export function restoreChannelTemplate(channelId: string) {
|
||||
return apiRequest<RestoreTemplateResultDto>(`/admin/channels/${channelId}/template/restore`, {
|
||||
method: 'POST',
|
||||
})
|
||||
}
|
||||
|
||||
/** Проверки сетки по правилам — считаются по шаблону, без прогона генератора. */
|
||||
export function getTemplateIssues(channelId: string) {
|
||||
return apiRequest<TemplateIssueDto[]>(`/admin/channels/${channelId}/template/issues`)
|
||||
|
||||
Reference in New Issue
Block a user