MCPcopy Create free account
hub / github.com/MCSManager/MCSManager / getNodeStatus

Function getNodeStatus

panel/src/app/service/exchange_service.ts:291–316  ·  view source on GitHub ↗
(params: Record<string, any>)

Source from the content-addressed store, hash-verified

289}
290
291export async function getNodeStatus(params: Record<string, any>): Promise<INodeStatusProtocol> {
292 const nodeId = toText(params.node_id) ?? "";
293 const remoteService = RemoteServiceSubsystem.getInstance(nodeId);
294 if (!remoteService?.available) {
295 throw new Error(t("TXT_CODE_bed32084"));
296 }
297 const remoteRequest = new RemoteRequest(remoteService);
298 const remoteInfo = await remoteRequest.request("info/overview");
299 remoteInfo.uuid = remoteService.uuid;
300 remoteInfo.available = remoteService.available;
301
302 remoteInfo.ip = remoteService.config?.ip;
303 remoteInfo.port = remoteService.config?.port;
304 remoteInfo.prefix = remoteService.config?.prefix;
305 remoteInfo.remarks = remoteService.config?.remarks;
306
307 return {
308 name: String(remoteInfo.remarks),
309 id: String(remoteInfo.uuid),
310 ip: String(remoteInfo.ip),
311 port: Number(remoteInfo.port),
312 available: Boolean(remoteInfo.available),
313 running: Number(remoteInfo.instance.running),
314 instances: Number(remoteInfo.instance.total)
315 };
316}

Callers 1

Calls 3

requestMethod · 0.95
toTextFunction · 0.85
getInstanceMethod · 0.45

Tested by

no test coverage detected