decompose structure

This commit is contained in:
Первов Артем
2026-06-20 00:51:18 +03:00
parent dbda8ee613
commit 31add10e56
77 changed files with 4112 additions and 3974 deletions

View File

@@ -0,0 +1,16 @@
import { getJson } from '../../shared/api/http';
import { cloudApiUrl } from '../../shared/config/env';
import type { CurrentResponse } from './types';
/** Загружает текущие значения показателей для выбранной буровой. */
export function getCurrent(edge: string, tags?: string[]): Promise<CurrentResponse> {
return getJson<CurrentResponse>(cloudApiUrl, '/current', { edge, tags });
}
/** Формирует URL SSE-потока текущих значений. */
export function getCurrentEventsUrl(edge: string, tags?: string[]): string {
const url = new URL('/current/events', cloudApiUrl);
url.searchParams.set('edge', edge);
tags?.forEach((tag) => url.searchParams.append('tags', tag));
return url.toString();
}

View File

@@ -0,0 +1,22 @@
export type CurrentItem = {
edge: string;
tag: string;
value: number;
createdAt: string;
updatedAt: string;
time: string;
name: string | null;
tagGroup: string | null;
min: number | null;
max: number | null;
comment: string | null;
unitOfMeasurement: string | null;
precision: number | null;
};
export type CurrentResponse = {
edge: string;
items: CurrentItem[];
};
export type CurrentEvent = CurrentResponse;