diff --git a/src/common/ClientConnection.ts b/src/common/ClientConnection.ts index 84155aa..9637c84 100644 --- a/src/common/ClientConnection.ts +++ b/src/common/ClientConnection.ts @@ -415,6 +415,16 @@ export default class ClientConnection { } } + public async updateModeWindowList(uuid: string) { + try { + return await this.doRpc( + new Protocol.UpdateModeWindowListRequestEntity(0, uuid) + ); + } catch (e) { + console.error(e); + } + } + public async deleteModeGroup(uuid: string) { try { return await this.doRpc( diff --git a/src/components/ModeTree.vue b/src/components/ModeTree.vue index 10058ad..0cd9087 100644 --- a/src/components/ModeTree.vue +++ b/src/components/ModeTree.vue @@ -99,6 +99,21 @@ {{ $t("edit") }} + + + {{ + $t("update to current window list") + }} + + { + try { + const response = (await GlobalData.getInstance() + .getCurrentClient() + ?.updateModeWindowList( + uuid + )) as Protocol.UpdateModeWindowListResponseEntity; + + $q.notify({ + color: response && response.success ? "positive" : "negative", + icon: response && response.success ? "done" : "warning", + message: + $t.t("update to current window list") + + (response && response.success + ? $t.t("success") + : $t.t("fail")) + + "!", + position: "top", + timeout: 1500, + }); + } catch (e) { + console.log(e); + } + }); + } + }, }; }, }); diff --git a/src/entities/WSProtocol.ts b/src/entities/WSProtocol.ts index b485b4d..c069c8b 100644 --- a/src/entities/WSProtocol.ts +++ b/src/entities/WSProtocol.ts @@ -139,6 +139,10 @@ export namespace Protocol { return Commands.PROTOCOL_PREFIX + "CallMode"; } + public static get kRpcUpdateModeWindowList() { + return Commands.PROTOCOL_PREFIX + "RpcUpdateModeWindowList"; + } + public static get kRpcAddPlanGroup() { return Commands.PROTOCOL_PREFIX + "RpcAddPlanGroup"; } @@ -310,6 +314,7 @@ export namespace Protocol { Commands.kRpcAddMode, Commands.kRpcDeleteMode, Commands.kRpcEditMode, + Commands.kRpcUpdateModeWindowList, Commands.kRpcGetCurrentRunningPlan, Commands.kCurrentRunningPlanStateChanged, Commands.kRpcAddPlanGroup, @@ -832,6 +837,26 @@ export namespace Protocol { } } + export class UpdateModeWindowListRequestEntity extends Protocol.PacketEntity { + uuid = ""; + + constructor(rcp_id?: number, uuid?: string) { + super(); + this.rpc_id = rcp_id ?? 0; + this.command = Protocol.Commands.kRpcUpdateModeWindowList; + this.uuid = uuid ?? ""; + } + } + + export class UpdateModeWindowListResponseEntity extends Protocol.PacketEntity { + success = false; + + constructor() { + super(); + this.command = Protocol.Commands.kRpcUpdateModeWindowList; + } + } + export class DeleteModeGroupRequestEntity extends Protocol.PacketEntity { uuid = ""; diff --git a/src/i18n/zh-CN/index.ts b/src/i18n/zh-CN/index.ts index da60b80..df3b78a 100644 --- a/src/i18n/zh-CN/index.ts +++ b/src/i18n/zh-CN/index.ts @@ -317,4 +317,8 @@ export default { "lower window": "置底窗口", "top window": "置顶窗口", "index exised": "索引已经存在", + "update to current window list": "更新窗口列表", + "the list of previously saved window list is about to be overwritten": + "之前保存的窗口列表将被覆盖", + "are you sure about the update": "确定更新吗", };