Add debug export functionality for channel analysis
Implemented a new endpoint for exporting debug data related to channel scheduling, allowing users to download an archive containing channel settings, slot states, and trace information. Updated the frontend to include a button for triggering the export, along with necessary API adjustments for handling the download. Enhanced localization strings to support the new debug export feature in both English and Russian. Updated .gitignore to include debug export files while ensuring the directory structure is maintained for development.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { apiRequest } from '@/shared/api/client'
|
||||
import { apiDownload, apiRequest } from '@/shared/api/client'
|
||||
import type {
|
||||
ApplyResultDto,
|
||||
ChannelDto,
|
||||
@@ -245,3 +245,25 @@ export function getSchedule(id: string, from: Date, to: Date) {
|
||||
const query = new URLSearchParams({ from: from.toISOString(), to: to.toISOString() })
|
||||
return apiRequest<ScheduleEntryDto[]>(`/admin/channels/${id}/schedule?${query.toString()}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* Отладочный дамп канала: вход планировщика, состояние слотов, лента и сухой прогон одним архивом.
|
||||
* Тянем через fetch, а не ссылкой: эндпоинт закрыт Bearer'ом, и `<a href>` заголовок не отправит.
|
||||
*/
|
||||
export async function exportChannelDebug(channelId: string) {
|
||||
const { blob, fileName } = await apiDownload(
|
||||
`/admin/channels/${channelId}/debug-export`,
|
||||
'telewave-debug.zip',
|
||||
{ method: 'POST' },
|
||||
)
|
||||
const url = URL.createObjectURL(blob)
|
||||
try {
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = fileName
|
||||
link.click()
|
||||
} finally {
|
||||
URL.revokeObjectURL(url)
|
||||
}
|
||||
return fileName
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user