feat(ui): перевести фронт с pcp-ui-service на источники, снять gateway catch-all
Запросы tguApi.ts (platforms/plans/decision/dismiss/restore/confirm-layin) и flight-line переведены с прокси /api/tgu-planning через умирающий pcp-ui-service на прямые вызовы pcp-tgu-service (/api/pcp-tgu, decision и confirm-layin — на тест-контроллер /test/tgu/*) и pcp-ballistics-service. flight-line перенесён в ballisticsApi.ts. editorApi.ts modes переведён с /api/current-plans на /api/pcp-mission. UX-перевод ошибок решения уже жил во фронте (errorMessage в tguApi.ts), серверная обвязка ui-service дублировала. Из config-repo/pcp-gateway-service.yaml снят маршрут ui-catch-all: не-матчнутый /api/** теперь отдаёт 404 на gateway, а не уходит в pcp-ui-service. Шаг 8 (вывод сервиса из эксплуатации: compose/helm/CI/реестр + удаление кода) отложен до проверки репойнта на живом стенде; сервис пока задеплоен без маршрутов. См. docs/план-перевода-с-pcp-ui-service.md и задачу #40 бэклога.
This commit is contained in:
@@ -4,6 +4,64 @@ import { apiFetch } from './apiFetch'
|
||||
|
||||
const BASE = '/api/pcp-ballistics'
|
||||
|
||||
export type FlightLinePoint = {
|
||||
time: string
|
||||
revolution: number
|
||||
lat: number
|
||||
long: number
|
||||
latLeft: number
|
||||
longLeft: number
|
||||
latInnerLeft: number
|
||||
longInnerLeft: number
|
||||
latInnerRight: number
|
||||
longInnerRight: number
|
||||
latRight: number
|
||||
longRight: number
|
||||
revSign: 'ASC' | 'DESC'
|
||||
}
|
||||
|
||||
/**
|
||||
* Трасса полёта КА (flight-line) на интервале для отрисовки на карте/таймлайне из
|
||||
* pcp-ballistics-service (GET /api/satellites/{norad}/flight-line). Шаг трассы 60 с.
|
||||
* @param noradId NORAD-идентификатор КА.
|
||||
* @param fromMs Начало интервала, мс от эпохи.
|
||||
* @param toMs Конец интервала, мс от эпохи.
|
||||
*
|
||||
* @returns Точки трассы полёта на интервале.
|
||||
*/
|
||||
export async function fetchFlightLine(
|
||||
noradId: string,
|
||||
fromMs: number,
|
||||
toMs: number,
|
||||
): Promise<FlightLinePoint[]> {
|
||||
const params = new URLSearchParams({
|
||||
time_start: toLocalDateTime(fromMs),
|
||||
time_stop: toLocalDateTime(toMs),
|
||||
})
|
||||
const url = `${BASE}/api/satellites/${encodeURIComponent(noradId)}/flight-line?${params.toString()}`
|
||||
|
||||
let response: Response
|
||||
try {
|
||||
response = await apiFetch(url, { headers: { Accept: 'application/json' } })
|
||||
} catch {
|
||||
throw new TguApiError('Не удалось подключиться к сервису баллистики.', 'network')
|
||||
}
|
||||
|
||||
const text = await response.text()
|
||||
if (!response.ok) {
|
||||
throw new TguApiError(
|
||||
extractErrorText(text) || 'Ошибка сервиса баллистики.',
|
||||
'http',
|
||||
response.status,
|
||||
)
|
||||
}
|
||||
if (!text.trim()) {
|
||||
return []
|
||||
}
|
||||
|
||||
return JSON.parse(text) as FlightLinePoint[]
|
||||
}
|
||||
|
||||
export type PointVisibilityParam = {
|
||||
/** NORAD-идентификатор КА. */
|
||||
noradId: number
|
||||
|
||||
Reference in New Issue
Block a user