Refactor: 重构实例更新请求参数

This commit is contained in:
Suwings 2022-07-17 13:03:36 +08:00
parent fbd3543b87
commit 9e97e9a550

View File

@ -353,16 +353,19 @@ router.put(
// 可选参数 // 可选参数
const crlf = Number(config?.crlf); const crlf = Number(config?.crlf);
const oe = String(config?.oe || ""); const oe = config?.oe ? String(config?.oe) : null;
const ie = String(config?.ie || ""); const ie = config?.ie ? String(config?.ie) : null;
const remoteService = RemoteServiceSubsystem.getInstance(serviceUuid); const remoteService = RemoteServiceSubsystem.getInstance(serviceUuid);
// 松散性参数传递,每个配置都可以传递或不传递
// 其子对象配置一定要完整或者一个都没有
const result = await new RemoteRequest(remoteService).request("instance/update", { const result = await new RemoteRequest(remoteService).request("instance/update", {
instanceUuid, instanceUuid,
config: { config: {
pingConfig: pingConfig.ip != null ? pingConfig : null, pingConfig: config.pingConfig?.ip != null ? pingConfig : null,
eventTask: eventTask.autoStart != null ? eventTask : null, eventTask: config.eventTask?.autoStart != null ? eventTask : null,
terminalOption, terminalOption: config.terminalOption?.pty != null ? terminalOption : null,
crlf, crlf,
oe, oe,
ie ie