From 899690e180b06f589da26600b161a0dfc04ec43d Mon Sep 17 00:00:00 2001 From: fangxiang Date: Tue, 15 Feb 2022 19:08:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=82=B9=E5=87=BB=E5=B0=B1?= =?UTF-8?q?=E7=BD=AE=E9=A1=B6=E7=AA=97=E5=8F=A3=E7=9A=84=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=20=E6=B7=BB=E5=8A=A0=E6=9F=A5=E7=9C=8B=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E4=BF=A1=E6=81=AF=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/common/ClientConnection.ts | 5 +++ src/common/RemoteDataExangeProcesser.ts | 3 -- src/components/Window.vue | 11 +++++ src/entities/WSProtocol.ts | 28 +++++++++++++ src/i18n/zh-CN/index.ts | 6 +++ src/pages/TopToolBar.vue | 53 ++++++++++++++++++++----- src/pages/WallPage.vue | 16 ++++---- 8 files changed, 101 insertions(+), 23 deletions(-) diff --git a/package.json b/package.json index 83eb44f..c376d76 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "media_player_client", - "version": "1.2.2", + "version": "1.2.3", "description": "A Quasar Framework app", "productName": "MediaPlayerClient", "author": "fangxiang ", diff --git a/src/common/ClientConnection.ts b/src/common/ClientConnection.ts index 9637c84..eeca3ec 100644 --- a/src/common/ClientConnection.ts +++ b/src/common/ClientConnection.ts @@ -734,6 +734,11 @@ export default class ClientConnection { ); } + public async getSystemTimes() { + return await this.doRpc( + new Protocol.GetSystemTimesRequestEntity(0) + ); + } public restartDevice(delay_ms?: number) { this.ws?.send( JSON.stringify(new Protocol.RestartDeviceRequestEntity(delay_ms)) diff --git a/src/common/RemoteDataExangeProcesser.ts b/src/common/RemoteDataExangeProcesser.ts index 7d44923..6a5593e 100644 --- a/src/common/RemoteDataExangeProcesser.ts +++ b/src/common/RemoteDataExangeProcesser.ts @@ -402,9 +402,6 @@ export default class RemoteDataExangeProcesser { } } break; - default: - console.log(notify.data); - break; } } catch {} } diff --git a/src/components/Window.vue b/src/components/Window.vue index 81ae826..23a74e9 100644 --- a/src/components/Window.vue +++ b/src/components/Window.vue @@ -290,6 +290,12 @@ export default defineComponent({ return signal_source.value.window_type == "EwindowType::Clock"; }); + watch( + () => props.window, + (n, o) => { + reload_signal_source(); + } + ); reload_signal_source(); const flags = new _Flags(); @@ -317,6 +323,11 @@ export default defineComponent({ } if (!props.mouse_area_flag) { evt.stopPropagation(); + if (props.window.uuid != $store.state.selected_window) { + GlobalData.getInstance() + .getCurrentClient() + ?.focusIn(props.window.window_id); + } $store.commit("setSelectedWindow", props.window.uuid); } }, diff --git a/src/entities/WSProtocol.ts b/src/entities/WSProtocol.ts index e321c89..5f335c3 100644 --- a/src/entities/WSProtocol.ts +++ b/src/entities/WSProtocol.ts @@ -289,6 +289,10 @@ export namespace Protocol { return Commands.PROTOCOL_PREFIX + "DesktopDisconnectNotify"; } + public static get kRpcGetSystemTimes() { + return Commands.PROTOCOL_PREFIX + "RpcGetSystemTimes"; + } + static _all_commands = new Set([ Commands.kUnKnowCommand, Commands.kSearchDevice, @@ -359,6 +363,7 @@ export namespace Protocol { Commands.kPollingStateChanged, Commands.kDesktopResolutionChangedNotify, Commands.kDesktopDisconnectNotify, + Commands.kRpcGetSystemTimes, ]); public static get AllCommands() { @@ -1677,4 +1682,27 @@ export namespace Protocol { this.command = Commands.kDesktopDisconnectNotify; } } + + export class GetSystemTimesRequestEntity extends PacketEntity { + timestamp = new Date().getMilliseconds(); + + constructor(rpcid?: number) { + super(); + this.rpc_id = rpcid ?? 0; + this.command = Commands.kRpcGetSystemTimes; + } + } + + export class GetSystemTimesResponseEntity extends PacketEntity { + system_run_time: number = 0; + system_idle_time: number = 0; + current_system_time: number = 0; + server_run_time: number = 0; + server_all_run_time: number = 0; + + constructor() { + super(); + this.command = Commands.kRpcGetSystemTimes; + } + } } diff --git a/src/i18n/zh-CN/index.ts b/src/i18n/zh-CN/index.ts index dd57db4..603c200 100644 --- a/src/i18n/zh-CN/index.ts +++ b/src/i18n/zh-CN/index.ts @@ -323,4 +323,10 @@ export default { "are you sure about the update": "确定更新吗", "device info": "设备信息", resolution: "分辨率", + "system run time": "系统运行时间", + "system idle time": "系统空闲时间", + "system idle rate": "系统空闲率", + "server run time": "服务运行时间", + "current server system time": "当前服务系统时间", + "server all run time": "服务总运行时间", }; diff --git a/src/pages/TopToolBar.vue b/src/pages/TopToolBar.vue index 399816b..f870758 100644 --- a/src/pages/TopToolBar.vue +++ b/src/pages/TopToolBar.vue @@ -256,7 +256,7 @@ import { Protocol } from "src/entities/WSProtocol"; import GlobalData from "src/common/GlobalData"; import { api } from "boot/axios"; import { HttpProtocol } from "src/entities/HttpProtocol"; -import { SessionStorage, openURL, useQuasar } from "quasar"; +import { SessionStorage, openURL, useQuasar, date as $date } from "quasar"; import { useI18n } from "vue-i18n"; import { NotifyMessage } from "src/common/ClientConnection"; @@ -281,6 +281,12 @@ export default defineComponent({ let show_advanced_menu = ref(true); + let system_run_time = 0; + let system_idle_time = 0; + let current_system_time = 0; + let server_run_time = 0; + let server_all_run_time = 0; + const plan_running = computed( () => $store.state.current_running_plan.trim() != "" ); @@ -363,17 +369,42 @@ export default defineComponent({ SessionStorage.clear(); window.location.reload(); }, - showDeviceInfo() { + async showDeviceInfo() { + try { + const response = await GlobalData.getInstance() + .getCurrentClient() + ?.getSystemTimes(); + if (response) { + system_run_time = response.system_run_time; + system_idle_time = response.system_idle_time; + current_system_time = response.current_system_time; + server_run_time = response.server_run_time; + server_all_run_time = response.server_all_run_time; + } + } catch (e) { + console.log(e); + } $q.dialog({ - title: $t.t("device info"), - message: - $t.t("resolution") + - ": " + - $store.state.device_screen_width + - "X" + - $store.state.device_screen_height + - "@" + - $store.state.device_screen_refresh_rate, + html: true, + title: "
" + $t.t("device info") + "
", + message: `
+ ${$t.t("device resolution")} : ${$store.state.device_screen_width}X${ + $store.state.device_screen_height + }@${$store.state.device_screen_refresh_rate}
+ ${$t.t("system run time")} : ${system_run_time} ${$t.t("s")}
+ ${$t.t("system idle rate")} : ${( + system_idle_time / + (system_run_time * 4) + ).toFixed(2)} %
+ ${$t.t("current server system time")} : ${$date.formatDate( + new Date(current_system_time), + "YYYY-MM-DD HH:mm:ss" + )}
+ ${$t.t("server run time")} : ${server_run_time} ${$t.t("s")}
+ ${$t.t("server all run time")} : ${server_all_run_time} ${$t.t( + "s" + )}
+
`, }); }, }; diff --git a/src/pages/WallPage.vue b/src/pages/WallPage.vue index 3292e6c..09e22f4 100644 --- a/src/pages/WallPage.vue +++ b/src/pages/WallPage.vue @@ -10,17 +10,17 @@ >