From 364f8cd54dc3eed6ea7d9a49ef0d222a61038749 Mon Sep 17 00:00:00 2001 From: fangxiang Date: Mon, 10 Oct 2022 16:27:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B8=85=E7=A9=BA=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E6=8C=89=E9=92=AE=EF=BC=8C=E5=A4=8D=E4=BD=8D=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E4=BB=8E=E5=85=B3=E4=BA=8E=E9=A1=B5=E9=9D=A2=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E5=88=B0=E8=AE=BE=E7=BD=AE->=E5=85=B6=E5=AE=83?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=B8=8B=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/ClientConnection.ts | 8 +++ src/components/AboutDialog.vue | 59 -------------------- src/components/SystemSettingDialog.vue | 75 ++++++++++++++++++++++++++ src/entities/WSProtocol.ts | 16 ++++++ src/i18n/en-US/index.ts | 5 ++ src/i18n/zh-CN/index.ts | 4 ++ 6 files changed, 108 insertions(+), 59 deletions(-) diff --git a/src/common/ClientConnection.ts b/src/common/ClientConnection.ts index b5cc081..d2d2432 100644 --- a/src/common/ClientConnection.ts +++ b/src/common/ClientConnection.ts @@ -553,6 +553,14 @@ export default class ClientConnection { this.ws?.send(JSON.stringify(new Protocol.CallModeRequestEntity(uuid))); } + public cleanBrowserCache() { + this.ws?.send( + JSON.stringify( + new Protocol.NormalRequestEntity(Protocol.Commands.kCleanBrowserCache) + ) + ); + } + public async getApplicationSettins() { try { return await this.doRpc( diff --git a/src/components/AboutDialog.vue b/src/components/AboutDialog.vue index 69e4044..d0802a5 100644 --- a/src/components/AboutDialog.vue +++ b/src/components/AboutDialog.vue @@ -91,20 +91,6 @@ > - - - -
- {{ product_name }} -
-
-
@@ -192,51 +178,6 @@ export default defineComponent({ } } catch {} }, - onRestore() { - $q.dialog({ - title: $t.t("restore"), - message: $t.t( - "are you sure to restore factory settings? the configuration parameters, signal source, mode, and plan will be deleted!" - ), - options: { - type: "checkbox", - model: [], - // inline: true - items: [ - { - label: $t.t("delete upload files ."), - value: "delete_upload", - color: "secondary", - }, - ], - }, - ok: { - label: $t.t("ok"), - noCaps: true, - flat: true, - }, - cancel: { - label: $t.t("cancel"), - noCaps: true, - flat: true, - }, - persistent: true, - }).onOk((data) => { - if (Array.isArray(data)) { - const delete_upload = data.length != 0; - GlobalData.getInstance() - .getCurrentClient() - ?.restoreDevice(delete_upload); - $q.notify({ - color: "positive", - icon: "done", - message: $t.t("send restore command success!"), - position: "top", - timeout: 1500, - }); - } - }); - }, }; }, }); diff --git a/src/components/SystemSettingDialog.vue b/src/components/SystemSettingDialog.vue index 8407925..b39e83e 100644 --- a/src/components/SystemSettingDialog.vue +++ b/src/components/SystemSettingDialog.vue @@ -760,6 +760,26 @@ /> + + + + + + @@ -1972,6 +1992,61 @@ export default defineComponent({ } } }, + onRestore() { + $q.dialog({ + title: $t.t("restore"), + message: $t.t( + "are you sure to restore factory settings? the configuration parameters, signal source, mode, and plan will be deleted!" + ), + options: { + type: "checkbox", + model: [], + // inline: true + items: [ + { + label: $t.t("delete upload files ."), + value: "delete_upload", + color: "secondary", + }, + ], + }, + ok: { + label: $t.t("ok"), + noCaps: true, + flat: true, + }, + cancel: { + label: $t.t("cancel"), + noCaps: true, + flat: true, + }, + persistent: true, + }).onOk((data) => { + if (Array.isArray(data)) { + const delete_upload = data.length != 0; + GlobalData.getInstance() + .getCurrentClient() + ?.restoreDevice(delete_upload); + $q.notify({ + color: "positive", + icon: "done", + message: $t.t("send restore command success!"), + position: "top", + timeout: 1500, + }); + } + }); + }, + onCleanBrowserCache() { + GlobalData.getInstance().getCurrentClient()?.cleanBrowserCache(); + $q.notify({ + color: "positive", + icon: "done", + message: $t.t("clean browser cache command send success") + " !", + position: "top", + timeout: 1000 * 2, + }); + }, }; }, }); diff --git a/src/entities/WSProtocol.ts b/src/entities/WSProtocol.ts index a328a68..4a29a64 100644 --- a/src/entities/WSProtocol.ts +++ b/src/entities/WSProtocol.ts @@ -455,6 +455,9 @@ export namespace Protocol { public static get kRpcDeleteJointActionEquipment() { return Commands.PROTOCOL_PREFIX + "RpcDeleteJointActionEquipment"; } + public static get kCleanBrowserCache() { + return Commands.PROTOCOL_PREFIX + "CleanBrowserCache"; + } static _all_commands = new Set([ Commands.kUnKnowCommand, @@ -568,6 +571,7 @@ export namespace Protocol { Commands.kRpcGetJointActionEquipment, Commands.kRpcSetJointActionEquipment, Commands.kRpcDeleteJointActionEquipment, + Commands.kCleanBrowserCache, ]); public static get AllCommands() { return this._all_commands; @@ -2952,4 +2956,16 @@ export namespace Protocol { this.delete_upload_dates = delete_upload_dates; } } + + export class NormalRequestEntity extends PacketEntity { + constructor(command: string) { + super(); + + super.command = command; + super.flag = PacketEntity.FLAG_REQUEST; + super.rpc_id = 0; + } + + timestamp = Date.now(); + } } diff --git a/src/i18n/en-US/index.ts b/src/i18n/en-US/index.ts index eae9803..b664815 100644 --- a/src/i18n/en-US/index.ts +++ b/src/i18n/en-US/index.ts @@ -368,4 +368,9 @@ export default { "The Sound Card Takes Effect Inly After It Is Restarted. Restart The System", "the time zone takes effect only after it is restarted. Restart the system": "The Time Zone Takes Effect Inly After It Is Restarted. Restart The System", + "restore setting": "Restore Setting", + "clean browser cache": "Clean Browser Cache", + system: "System", + "clean browser cache command send success": + "Clean Browser Cache Command Send Success", }; diff --git a/src/i18n/zh-CN/index.ts b/src/i18n/zh-CN/index.ts index 697c15d..21b6fc6 100644 --- a/src/i18n/zh-CN/index.ts +++ b/src/i18n/zh-CN/index.ts @@ -641,4 +641,8 @@ export default { "multimedia rotation": "媒体旋转", "please select multimedia rotation": "请选择旋转值", "mode is empty! please add mode first": "当前没有模式,请先添加模式!", + "restore setting": "恢复默认设置", + "clean browser cache": "清空浏览器缓存", + system: "系统", + "clean browser cache command send success": "清除浏览器缓存指令发送成功", };