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:
@@ -620,6 +620,8 @@ export type ScheduleTemplateDto = {
|
||||
appliedRevision: number
|
||||
/** Есть ли правки правил, не применённые к эфиру. */
|
||||
hasPendingChanges: boolean
|
||||
/** Есть ли к чему откатываться — снимок появляется при первом применении. */
|
||||
canRestore: boolean
|
||||
utcOffsetMinutes: number
|
||||
dayStartTime: string
|
||||
layers: GridLayerDto[]
|
||||
@@ -738,6 +740,9 @@ export type GridPlanDto = {
|
||||
|
||||
export type GenerateGridResultDto = { created: number; removed: number }
|
||||
|
||||
/** Итог отката сетки: сколько слотов осталось и сколько ссылок восстановить не удалось. */
|
||||
export type RestoreTemplateResultDto = { slots: number; droppedRefs: number }
|
||||
|
||||
/** Проверки сетки по правилам, до генерации (см. 5.1). */
|
||||
type TemplateIssueKind =
|
||||
| 'GroupEmpty'
|
||||
|
||||
@@ -628,6 +628,12 @@ export const en = {
|
||||
pickBumperTemplate: 'pick a block',
|
||||
minutesShort: ' min',
|
||||
pendingChanges: 'Rules changed — the air still follows the old ones.',
|
||||
restore: 'Discard changes',
|
||||
restoreConfirm:
|
||||
'Roll the grid back to what is on air? Everything changed since the last apply will be lost.',
|
||||
restored: 'The grid is back to the on-air state: {{count}} slots.',
|
||||
restoreDropped:
|
||||
'References not restored: {{count}} — the group or junction was deleted after the apply.',
|
||||
apply: 'Apply',
|
||||
applied: 'Air rebuilt, entries: {{count}}',
|
||||
weekdays: {
|
||||
|
||||
@@ -633,6 +633,12 @@ export const ru = {
|
||||
pickBumperTemplate: 'выберите блок',
|
||||
minutesShort: ' мин',
|
||||
pendingChanges: 'Правила изменены — эфир идёт по старым.',
|
||||
restore: 'Сбросить изменения',
|
||||
restoreConfirm:
|
||||
'Вернуть сетку к тому состоянию, по которому идёт эфир? Всё, что изменено после последнего применения, будет потеряно.',
|
||||
restored: 'Сетка возвращена к эфирной: слотов — {{count}}.',
|
||||
restoreDropped:
|
||||
'Ссылок не восстановлено: {{count}} — группа или стык были удалены после применения.',
|
||||
apply: 'Применить',
|
||||
applied: 'Эфир пересобран, записей: {{count}}',
|
||||
weekdays: {
|
||||
|
||||
Reference in New Issue
Block a user