mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 09:30:45 +08:00
Paginate biz-state batch workbook and expose raw CLI logs.
Load batch summaries without metric payloads, fetch sheet rows on demand, and show collect commands with a raw-log viewer. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
a769e603b7
commit
18a0c41196
8 changed files with 835 additions and 178 deletions
|
|
@ -1841,6 +1841,49 @@ export const bizStatePurgeTask = (taskId: string) =>
|
|||
export const bizStateGetBatch = (batchId: string) =>
|
||||
apiGet<Record<string, unknown>>(`/v1/biz-state/batches/${encodeURIComponent(batchId)}`);
|
||||
|
||||
export const bizStateListBatchMetricRows = (params: {
|
||||
batchId: string;
|
||||
metricId: string;
|
||||
page?: number;
|
||||
pageSize?: number;
|
||||
kw?: string;
|
||||
column?: string;
|
||||
}) => {
|
||||
const p = new URLSearchParams();
|
||||
p.set("page", String(Math.max(1, Number(params.page || 1))));
|
||||
p.set("page_size", String(Math.max(1, Math.min(200, Number(params.pageSize || 50)))));
|
||||
if (params.kw) p.set("kw", params.kw);
|
||||
if (params.column) p.set("column", params.column);
|
||||
return apiGet<{
|
||||
batch_id: string;
|
||||
metric_id: string;
|
||||
total: number;
|
||||
page: number;
|
||||
page_size: number;
|
||||
pages: number;
|
||||
columns: Array<{ key: string; header: string; role?: string; is_key?: boolean }>;
|
||||
items: Record<string, unknown>[];
|
||||
}>(
|
||||
`/v1/biz-state/batches/${encodeURIComponent(params.batchId)}/metrics/${encodeURIComponent(params.metricId)}?${p.toString()}`,
|
||||
);
|
||||
};
|
||||
|
||||
export const bizStateGetBatchCommand = (batchId: string, commandId: string) =>
|
||||
apiGet<{
|
||||
id: string;
|
||||
batch_id: string;
|
||||
raw_command: string;
|
||||
metric_id: string;
|
||||
parse_status: string;
|
||||
row_count: number;
|
||||
message: string;
|
||||
raw_text: string;
|
||||
collected_at?: string | null;
|
||||
device?: { ne_id?: string; ne_name?: string; ne_ip?: string };
|
||||
}>(
|
||||
`/v1/biz-state/batches/${encodeURIComponent(batchId)}/commands/${encodeURIComponent(commandId)}`,
|
||||
);
|
||||
|
||||
export const bizStateDownloadExport = async (batchId: string): Promise<void> => {
|
||||
const path = `/v1/biz-state/batches/${encodeURIComponent(batchId)}/export`;
|
||||
const res = await fetch(path, { method: "GET", credentials: fetchCreds, headers: authHeaders() });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue