From 0bf2dd23ca55b6592eca552bb98aa9e5c6bfbd0d Mon Sep 17 00:00:00 2001 From: fangxiang Date: Sat, 12 Feb 2022 14:35:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9B=B4=E6=96=B0=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E7=AA=97=E5=8F=A3=E5=88=97=E8=A1=A8=E7=9A=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/ClientConnection.ts | 10 ++++++ src/components/ModeTree.vue | 62 +++++++++++++++++++++++++++++++++- src/entities/WSProtocol.ts | 25 ++++++++++++++ src/i18n/zh-CN/index.ts | 4 +++ 4 files changed, 100 insertions(+), 1 deletion(-) 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": "确定更新吗", };