netx/web/src/constants/queryKeys.ts
oliver 312f6f2f96 Improve managed NE filters/validation and simplify the workbench UI.
Add column filters and clearer API error mapping for NE management, tighten port validation, and slim the workbench into reusable modules with cleaner styles.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-13 00:26:58 +08:00

128 lines
5.9 KiB
TypeScript

/** React Query keys — keep stable references for invalidation. */
export const queryKeys = {
integrationsStatus: ["integrationsStatus"] as const,
umeTokenStatus: ["umeTokenStatus"] as const,
umeAlarmSubscription: ["umeAlarmSubscription"] as const,
umeKeyAlertMonitorAll: ["umeKeyAlertMonitor"] as const,
umeInventoryNeTypes: ["umeInventoryNeTypes"] as const,
umeKeyAlertMonitor: (
page: number,
pageSize: number,
keyword: string,
enabled: string,
matchType: string,
) => ["umeKeyAlertMonitor", page, pageSize, keyword, enabled, matchType] as const,
/** Prefix keys for invalidating all pages/variants of a domain. */
umeSyncStatusAll: ["umeSyncStatus"] as const,
umeNEAll: ["umeNE"] as const,
umeCurrentAlarmsAll: ["umeCurrentAlarms"] as const,
umeSyncStatus: (page: number, pageSize: number) => ["umeSyncStatus", page, pageSize] as const,
umeNE: (keyword: string, page: number, pageSize: number) => ["umeNE", keyword, page, pageSize] as const,
managedNeMeta: ["managedNeMeta"] as const,
managedNeStats: ["managedNeStats"] as const,
managedNeAll: ["managedNe"] as const,
managedNe: (columnFilters: string, page: number, pageSize: number) =>
["managedNe", columnFilters, page, pageSize] as const,
collectionEligibleNeAll: ["collectionEligibleNe"] as const,
collectionEligibleNe: (page: number, keyword: string) => ["collectionEligibleNe", page, keyword] as const,
neCollectionsAll: ["neCollections"] as const,
neCollections: (page: number, pageSize = 20, status = "", keyword = "") =>
["neCollections", page, pageSize, status, keyword] as const,
neCollectionDashboard: ["neCollectionDashboard"] as const,
neCollectionPolicy: ["neCollectionPolicy"] as const,
neCollectionDetail: (jobId: string) => ["neCollection", jobId] as const,
neCollectionRunsAll: ["neCollectionRuns"] as const,
neCollectionRuns: (jobId: string, page: number, pageSize: number, status: string, keyword: string) =>
["neCollectionRuns", jobId, page, pageSize, status, keyword] as const,
cliMeta: ["cliMeta"] as const,
cliProfiles: ["cliProfiles"] as const,
cliTargetsAll: ["cliTargets"] as const,
cliTargets: (keyword: string, page: number, pageSize: number) =>
["cliTargets", keyword, page, pageSize] as const,
umeCliOverride: (umeNeId: string) => ["umeCliOverride", umeNeId] as const,
umeCurrentAlarms: (
severity: string,
cleared: string,
hostName: string,
keyword: string,
page: number,
pageSize: number,
) => ["umeCurrentAlarms", severity, cleared, hostName, keyword, page, pageSize] as const,
topologyViews: ["topologyViews"] as const,
topologyTree: ["topologyTree"] as const,
fabricNodeInventory: (
keyword: string,
role: string,
regionFolderId: string,
unmatched: string,
linkStatus: string,
page: number,
levelMajor?: string,
pageSize = 10,
) =>
[
"fabricNodeInventory",
keyword,
role,
regionFolderId,
unmatched,
linkStatus,
page,
levelMajor || "",
pageSize,
] as const,
fabricNodeSearch: (q: string, page: number) => ["fabricNodeSearch", q, page] as const,
topologyViewGraph: (viewId: string) => ["topologyViewGraph", viewId] as const,
fabricSummary: ["fabricSummary"] as const,
/** @deprecated */
topologyMaps: ["topologyViews"] as const,
topologyGraph: (viewId: string, focusFolderId = "") =>
["topologyViewGraph", viewId, focusFolderId] as const,
lldpCollectDashboard: ["lldpCollectDashboard"] as const,
lldpCollectJobsAll: ["lldpCollectJobs"] as const,
lldpCollectJobs: (page: number, pageSize = 10, status = "", keyword = "") =>
["lldpCollectJobs", page, pageSize, status, keyword] as const,
lldpCollectJobAll: ["lldpCollectJob"] as const,
lldpCollectJob: (jobId: string, page = 1, pageSize = 20, status = "", keyword = "") =>
["lldpCollectJob", jobId, page, pageSize, status, keyword] as const,
fabricEdgesAll: ["fabricEdges"] as const,
fabricEdges: (status: string, keyword: string, page: number, pageSize = 20, source = "") =>
["fabricEdges", status, keyword, page, pageSize, source] as const,
configSyncDashboard: ["configSyncDashboard"] as const,
configSyncPolicy: ["configSyncPolicy"] as const,
configSyncCyclesAll: ["configSyncCycles"] as const,
configSyncCycles: (page: number, pageSize = 20, status = "", keyword = "") =>
["configSyncCycles", page, pageSize, status, keyword] as const,
configSyncCycleTasksAll: ["configSyncCycleTasks"] as const,
configSyncCycleTasks: (
cycleId: string,
page: number,
pageSize = 20,
status = "",
keyword = "",
) => ["configSyncCycleTasks", cycleId, page, pageSize, status, keyword] as const,
networkConfigsAll: ["networkConfigs"] as const,
networkConfigs: (page: number, keyword: string, source: string, vendor: string, pageSize = 20) =>
["networkConfigs", page, keyword, source, vendor, pageSize] as const,
networkConfigDetail: (source: string, id: string) => ["networkConfigDetail", source, id] as const,
portTrafficDashboard: ["portTrafficDashboard"] as const,
portTrafficDevicesAll: ["portTrafficDevices"] as const,
portTrafficDevices: (page: number, pageSize = 20, status = "", keyword = "") =>
["portTrafficDevices", page, pageSize, status, keyword] as const,
portTrafficTargets: (deviceId: string) => ["portTrafficTargets", deviceId] as const,
portTrafficEvents: (deviceId: string) => ["portTrafficEvents", deviceId] as const,
portTrafficBoards: ["portTrafficBoards"] as const,
portTrafficBoard: (boardId: string) => ["portTrafficBoard", boardId] as const,
portTrafficSamples: (targetId: string, rangeHours: number) =>
["portTrafficSamples", targetId, rangeHours] as const,
portTrafficCompare: (
targetId: string,
rangeHours: number,
baseline: string,
offsetHours: number,
baselineTargetId: string,
aheadHours = 0,
) =>
["portTrafficCompare", targetId, rangeHours, baseline, offsetHours, baselineTargetId, aheadHours] as const,
};