From 187d2fda0b2b5588fc39e51bf2b7df140d3f8124 Mon Sep 17 00:00:00 2001 From: fangxiang Date: Wed, 25 Aug 2021 17:30:02 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E6=A1=88=E6=A0=91=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/ClientConnection.ts | 209 +++++++---- src/common/GlobalData.ts | 11 + src/components/ModeDialog.vue | 4 +- src/components/ModeGroupDialog.vue | 4 +- src/components/ModeTree.vue | 7 +- src/components/PlanDialog.vue | 383 +++++++++++++++++++++ src/components/PlanGroupDialog.vue | 261 ++++++++++++++ src/components/PlanTree.vue | 294 ++++++++++++++++ src/components/SignalSourceDialog.vue | 4 +- src/components/SignalSourceGroupDialog.vue | 4 +- src/components/SignalSourceTree.vue | 7 +- src/entities/PlanEntity.ts | 45 +++ src/entities/StringKeyValueEntity.ts | 9 + src/entities/WSProtocol.ts | 262 +++++++++++++- src/i18n/zh-CN/index.ts | 18 + src/pages/Index.vue | 33 ++ src/pages/Login.vue | 5 + src/pages/RightToolBar.vue | 8 +- src/pages/TopToolBar.vue | 9 +- src/pages/WallPage.vue | 34 +- src/store/index.ts | 73 +++- 21 files changed, 1574 insertions(+), 110 deletions(-) create mode 100644 src/components/PlanDialog.vue create mode 100644 src/components/PlanGroupDialog.vue create mode 100644 src/components/PlanTree.vue create mode 100644 src/entities/PlanEntity.ts create mode 100644 src/entities/StringKeyValueEntity.ts diff --git a/src/common/ClientConnection.ts b/src/common/ClientConnection.ts index 8ec93aa..3e0bfc2 100644 --- a/src/common/ClientConnection.ts +++ b/src/common/ClientConnection.ts @@ -252,6 +252,66 @@ export default class ClientConnection { } } + public async addSignalSourceGroup(parent_uuid: string, name: string) { + try { + return await this.doRpc( + new Protocol.AddSignalSourceGroupRequestEntity(0, parent_uuid, name) + ); + } catch (e) { + console.error(e); + } + } + + public async editSignalSourceGroup(uuid: string, name: string) { + try { + return await this.doRpc( + new Protocol.EditSignalSourceGroupRequestEntity(0, uuid, name) + ); + } catch (e) { + console.error(e); + } + } + + public async deleteSignalSourceGroup(uuid: string) { + try { + return await this.doRpc( + new Protocol.DeleteSignalSourceGroupRequestEntity(0, uuid) + ); + } catch (e) { + console.error(e); + } + } + + public async addSignalSource(item: SignalSourceEntity) { + try { + return await this.doRpc( + new Protocol.AddSignalSourceRequestEntity(0, item) + ); + } catch (e) { + console.error(e); + } + } + + public async editSignalSource(item: SignalSourceEntity) { + try { + return await this.doRpc( + new Protocol.EditSignalSourceRequestEntity(0, item) + ); + } catch (e) { + console.error(e); + } + } + + public async deleteSignalSource(uuid: string) { + try { + return await this.doRpc( + new Protocol.DeleteSignalSourceRequestEntity(0, uuid) + ); + } catch (e) { + console.error(e); + } + } + public async getModes() { try { return await this.doRpc( @@ -262,6 +322,90 @@ export default class ClientConnection { } } + public async addPlanGroup(group_uuid: string, name: string) { + try { + return await this.doRpc( + new Protocol.AddPlanGroupRequestEntity(0, group_uuid, name) + ); + } catch (e) { + console.error(e); + } + } + + public async editPlanGroup(uuid: string, name: string) { + try { + return await this.doRpc( + new Protocol.EditPlanGroupRequestEntity(0, uuid, name) + ); + } catch (e) { + console.error(e); + } + } + + public async deletePlanGroup(uuid: string) { + try { + return await this.doRpc( + new Protocol.DeletePlanGroupRequestEntity(0, uuid) + ); + } catch (e) { + console.error(e); + } + } + + public async addPlan(group_uuid?: string, name?: string) { + try { + return await this.doRpc( + new Protocol.AddPlanRequestEntity(0, name, group_uuid) + ); + } catch (e) { + console.error(e); + } + } + + public async editPlan(uuid?: string, name?: string) { + try { + return await this.doRpc( + new Protocol.EditPlanRequestEntity(0, name, uuid) + ); + } catch (e) { + console.error(e); + } + } + + public async deletePlan(uuid: string) { + try { + return await this.doRpc( + new Protocol.DeletePlanRequestEntity(0, uuid) + ); + } catch (e) { + console.error(e); + } + } + + public async getCurrentRunningPlan() { + try { + return await this.doRpc( + new Protocol.GetCurrentRunningPlanRequestEntity(0) + ); + } catch (e) { + console.error(e); + } + } + + public runPlan(uuid: string) { + this.ws?.send(JSON.stringify(new Protocol.RunPlanRequestEntity(uuid))); + } + + public async getPlans() { + try { + return await this.doRpc( + new Protocol.GetPlansRequestEntity() + ); + } catch (e) { + console.error(e); + } + } + public async addModeGroup(group_uuid: string, name: string) { try { return await this.doRpc( @@ -381,66 +525,6 @@ export default class ClientConnection { ); } - public async addSignalSourceGroup(parent_uuid: string, name: string) { - try { - return await this.doRpc( - new Protocol.AddSignalSourceGroupRequestEntity(0, parent_uuid, name) - ); - } catch (e) { - console.error(e); - } - } - - public async editSignalSourceGroup(uuid: string, name: string) { - try { - return await this.doRpc( - new Protocol.EditSignalSourceGroupRequestEntity(0, uuid, name) - ); - } catch (e) { - console.error(e); - } - } - - public async deleteSignalSourceGroup(uuid: string) { - try { - return await this.doRpc( - new Protocol.DeleteSignalSourceGroupRequestEntity(0, uuid) - ); - } catch (e) { - console.error(e); - } - } - - public async addSignalSource(item: SignalSourceEntity) { - try { - return await this.doRpc( - new Protocol.AddSignalSourceRequestEntity(0, item) - ); - } catch (e) { - console.error(e); - } - } - - public async editSignalSource(item: SignalSourceEntity) { - try { - return await this.doRpc( - new Protocol.EditSignalSourceRequestEntity(0, item) - ); - } catch (e) { - console.error(e); - } - } - - public async deleteSignalSource(uuid: string) { - try { - return await this.doRpc( - new Protocol.DeleteSignalSourceRequestEntity(0, uuid) - ); - } catch (e) { - console.error(e); - } - } - public setApplicationConfig(wall_row: number, wall_col: number) { this.ws?.send( JSON.stringify( @@ -473,3 +557,8 @@ export default class ClientConnection { this.ws = null; } } + +export interface NotifyMessage { + packet: Protocol.PacketEntity; + data: string; +} diff --git a/src/common/GlobalData.ts b/src/common/GlobalData.ts index 8186c5a..1316af2 100644 --- a/src/common/GlobalData.ts +++ b/src/common/GlobalData.ts @@ -2,6 +2,7 @@ import { SessionStorage } from "quasar"; import ApplicationConfigEntity from "src/entities/ApplicationConfigEntity"; import { HttpProtocol } from "src/entities/HttpProtocol"; import { ModeEntity } from "src/entities/ModeEntity"; +import { PlanEntity } from "src/entities/PlanEntity"; import { SignalSourceEntity } from "src/entities/SignalSourceEntity"; import ClientConnection from "./ClientConnection"; import EventBus, { EventNamesDefine } from "./EventBus"; @@ -65,6 +66,16 @@ export default class GlobalData { this._modes = modes; } + _plans: PlanEntity[] = []; + + public get plans() { + return this._plans; + } + + public set plans(plans: PlanEntity[]) { + this._plans = plans; + } + constructor() { const url: string | null = SessionStorage.getItem("url"); let name: string | null = SessionStorage.getItem("name"); diff --git a/src/components/ModeDialog.vue b/src/components/ModeDialog.vue index 89204c5..af19702 100644 --- a/src/components/ModeDialog.vue +++ b/src/components/ModeDialog.vue @@ -10,9 +10,7 @@ ? $t("add mode") : type == 2 ? $t("edit mode") - : type == 3 - ? $t("delete mode") - : "add" + : $t("add mode") }} diff --git a/src/components/ModeGroupDialog.vue b/src/components/ModeGroupDialog.vue index 3c5d728..9825cf8 100644 --- a/src/components/ModeGroupDialog.vue +++ b/src/components/ModeGroupDialog.vue @@ -10,9 +10,7 @@ ? $t("add group") : type == 2 ? $t("edit group") - : type == 3 - ? $t("delete group") - : "add" + : $t("add group") }} diff --git a/src/components/ModeTree.vue b/src/components/ModeTree.vue index 935abbd..768e075 100644 --- a/src/components/ModeTree.vue +++ b/src/components/ModeTree.vue @@ -124,6 +124,7 @@ import { useI18n } from "vue-i18n"; import EventBus, { EventNamesDefine } from "src/common/EventBus"; import { Protocol } from "src/entities/WSProtocol"; import { ModeEntity } from "src/entities/ModeEntity"; +import { NotifyMessage } from "src/common/ClientConnection"; export default defineComponent({ name: "PageModeTree", @@ -149,13 +150,9 @@ export default defineComponent({ tree.value?.setExpanded("", true); }); - interface _ResponseMessage { - packet: Protocol.PacketEntity; - data: string; - } EventBus.getInstance().on( EventNamesDefine.NotifyMessage, - (response: _ResponseMessage) => { + (response: NotifyMessage) => { if (response) { switch (response.packet.command) { case Protocol.Commands.kRpcAddMode: diff --git a/src/components/PlanDialog.vue b/src/components/PlanDialog.vue new file mode 100644 index 0000000..291f674 --- /dev/null +++ b/src/components/PlanDialog.vue @@ -0,0 +1,383 @@ + + + + + diff --git a/src/components/PlanGroupDialog.vue b/src/components/PlanGroupDialog.vue new file mode 100644 index 0000000..3c196d7 --- /dev/null +++ b/src/components/PlanGroupDialog.vue @@ -0,0 +1,261 @@ + + + + + diff --git a/src/components/PlanTree.vue b/src/components/PlanTree.vue new file mode 100644 index 0000000..69a4000 --- /dev/null +++ b/src/components/PlanTree.vue @@ -0,0 +1,294 @@ + + + diff --git a/src/components/SignalSourceDialog.vue b/src/components/SignalSourceDialog.vue index 16d92e2..fed0936 100644 --- a/src/components/SignalSourceDialog.vue +++ b/src/components/SignalSourceDialog.vue @@ -10,9 +10,7 @@ ? $t("add signal source") : type == 2 ? $t("edit signal source") - : type == 3 - ? $t("delete signal source") - : "add" + : $t("add signal source") }} diff --git a/src/components/SignalSourceGroupDialog.vue b/src/components/SignalSourceGroupDialog.vue index e497613..fe4fd70 100644 --- a/src/components/SignalSourceGroupDialog.vue +++ b/src/components/SignalSourceGroupDialog.vue @@ -10,9 +10,7 @@ ? $t("add group") : type == 2 ? $t("edit group") - : type == 3 - ? $t("delete group") - : "add" + : $t("add group") }} diff --git a/src/components/SignalSourceTree.vue b/src/components/SignalSourceTree.vue index 6652a41..fc6df93 100644 --- a/src/components/SignalSourceTree.vue +++ b/src/components/SignalSourceTree.vue @@ -133,6 +133,7 @@ import { useQuasar } from "quasar"; import { useI18n } from "vue-i18n"; import EventBus, { EventNamesDefine } from "src/common/EventBus"; import { Protocol } from "src/entities/WSProtocol"; +import { NotifyMessage } from "src/common/ClientConnection"; export default defineComponent({ name: "PageSignalSourceTree", @@ -158,13 +159,9 @@ export default defineComponent({ tree.value?.setExpanded("", true); }); - interface _ResponseMessage { - packet: Protocol.PacketEntity; - data: string; - } EventBus.getInstance().on( EventNamesDefine.NotifyMessage, - (response: _ResponseMessage) => { + (response: NotifyMessage) => { if (response) { switch (response.packet.command) { case Protocol.Commands.kRpcAddSignalSource: diff --git a/src/entities/PlanEntity.ts b/src/entities/PlanEntity.ts new file mode 100644 index 0000000..b5de5d7 --- /dev/null +++ b/src/entities/PlanEntity.ts @@ -0,0 +1,45 @@ +import BaseEntity from "./BaseEntity"; +import { StringKeyValueEntity } from "./StringKeyValueEntity"; + +export class PlanEntity extends BaseEntity { + group_uuid: string = ""; + name: string = ""; + datas: StringKeyValueEntity[] = []; + + public static copy(dest: PlanEntity, src?: PlanEntity) { + if (!src) { + src = new PlanEntity(); + } + + dest.uuid = src.uuid; + dest.base_note = src.base_note; + dest.name = src.name; + dest.group_uuid = src.group_uuid; + dest.datas = src.datas; + } +} + +export class PlanTreeItemEntity { + uuid = ""; + parent = ""; + name = ""; + is_group = false; + children: PlanTreeItemEntity[] = []; + item_data: PlanEntity | null = null; + + constructor( + uuid?: string, + parent?: string, + name?: string, + is_group?: boolean, + item_data?: any, + children?: PlanTreeItemEntity[] + ) { + this.uuid = uuid ?? ""; + this.parent = parent ?? ""; + this.name = name ?? ""; + this.is_group = is_group ?? false; + this.children = children ?? (Array.isArray(children) ? children : []); + this.item_data = item_data; + } +} diff --git a/src/entities/StringKeyValueEntity.ts b/src/entities/StringKeyValueEntity.ts new file mode 100644 index 0000000..611482a --- /dev/null +++ b/src/entities/StringKeyValueEntity.ts @@ -0,0 +1,9 @@ +export class StringKeyValueEntity { + public key: string; + public value: string; + + constructor(key?: string, value?: string) { + this.key = key ?? ""; + this.value = value ?? ""; + } +} diff --git a/src/entities/WSProtocol.ts b/src/entities/WSProtocol.ts index 1f65712..38140c1 100644 --- a/src/entities/WSProtocol.ts +++ b/src/entities/WSProtocol.ts @@ -2,6 +2,7 @@ import { SignalSourceEntity } from "./SignalSourceEntity"; import ApplicationConfigEntity from "./ApplicationConfigEntity"; import { WindowOpenNotifyEntity } from "./MultimediaWindowEntity"; import { ModeEntity } from "./ModeEntity"; +import { PlanEntity } from "./PlanEntity"; export namespace Protocol { export class Commands { @@ -42,6 +43,10 @@ export namespace Protocol { return Commands.PROTOCOL_PREFIX + "RpcGetModes"; } + public static get kRpcGetPlans() { + return Commands.PROTOCOL_PREFIX + "RpcGetPlans"; + } + public static get kRpcGetApplicationConfig() { return Commands.PROTOCOL_PREFIX + "RpcGetApplicationConfig"; } @@ -114,12 +119,48 @@ export namespace Protocol { return Commands.PROTOCOL_PREFIX + "RpcDeleteMode"; } + public static get kRpcEditMode() { + return Commands.PROTOCOL_PREFIX + "RpcEditMode"; + } + public static get kCallMode() { return Commands.PROTOCOL_PREFIX + "CallMode"; } - public static get kRpcEditMode() { - return Commands.PROTOCOL_PREFIX + "RpcEditMode"; + public static get kRpcAddPlanGroup() { + return Commands.PROTOCOL_PREFIX + "RpcAddPlanGroup"; + } + + public static get kRpcDeletePlanGroup() { + return Commands.PROTOCOL_PREFIX + "RpcDeletePlanGroup"; + } + + public static get kRpcEditPlanGroup() { + return Commands.PROTOCOL_PREFIX + "RpcEditPlanGroup"; + } + + public static get kRpcAddPlan() { + return Commands.PROTOCOL_PREFIX + "RpcAddPlan"; + } + + public static get kRpcDeletePlan() { + return Commands.PROTOCOL_PREFIX + "RpcDeletePlan"; + } + + public static get kRpcEditPlan() { + return Commands.PROTOCOL_PREFIX + "RpcEditPlan"; + } + + public static get kRunPlan() { + return Commands.PROTOCOL_PREFIX + "RunPlan"; + } + + public static get kRpcGetCurrentRunningPlan() { + return Commands.PROTOCOL_PREFIX + "RpcGetCurrentRunningPlan"; + } + + public static get kPlanRunningStateChanged() { + return Commands.PROTOCOL_PREFIX + "PlanRunningStateChanged"; } public static get kSetApplicationConfig() { @@ -141,6 +182,7 @@ export namespace Protocol { Commands.kRpcGetWindows, Commands.kRpcGetSignalSources, Commands.kRpcGetModes, + Commands.kRpcGetPlans, Commands.kRpcGetApplicationConfig, Commands.kMoveWindow, Commands.kResizeWindow, @@ -159,6 +201,14 @@ export namespace Protocol { Commands.kRpcAddMode, Commands.kRpcDeleteMode, Commands.kRpcEditMode, + Commands.kRpcGetCurrentRunningPlan, + Commands.kPlanRunningStateChanged, + Commands.kRpcAddPlanGroup, + Commands.kRpcDeletePlanGroup, + Commands.kRpcEditPlanGroup, + Commands.kRpcAddPlan, + Commands.kRpcDeletePlan, + Commands.kRpcEditPlan, Commands.kSetApplicationConfig, ]); @@ -250,6 +300,26 @@ export namespace Protocol { } } + export class GetPlansRequestEntity extends PacketEntity { + timestamp = new Date().getMilliseconds(); + + constructor(rpcid?: number) { + super(); + this.rpc_id = rpcid ?? 0; + this.command = Commands.kRpcGetPlans; + } + } + + export class GetPlansResponseEntity extends PacketEntity { + plans: PlanEntity[] = []; + plan_groups: [] = []; + + constructor() { + super(); + this.command = Commands.kRpcGetPlans; + } + } + export class GetApplicationConfigRequestEntity extends PacketEntity { timestamp: number = new Date().getMilliseconds(); @@ -712,6 +782,194 @@ export namespace Protocol { mode_group: ModeGroupEntity = new ModeGroupEntity(); } + export class AddPlanGroupRequestEntity extends Protocol.PacketEntity { + parent_uuid = ""; + name = ""; + + constructor(rcp_id?: number, parent_uuid?: string, name?: string) { + super(); + this.rpc_id = rcp_id ?? 0; + this.command = Protocol.Commands.kRpcAddPlanGroup; + this.parent_uuid = parent_uuid ?? ""; + this.name = name ?? ""; + } + } + + export class AddPlanGroupResponseEntity extends Protocol.PacketEntity { + success = false; + + constructor() { + super(); + this.command = Protocol.Commands.kRpcAddPlanGroup; + } + } + + export class EditPlanGroupRequestEntity extends Protocol.PacketEntity { + uuid = ""; + name = ""; + + constructor(rcp_id?: number, uuid?: string, name?: string) { + super(); + this.rpc_id = rcp_id ?? 0; + this.command = Protocol.Commands.kRpcEditPlanGroup; + this.uuid = uuid ?? ""; + this.name = name ?? ""; + } + } + + export class EditPlanGroupResponseEntity extends Protocol.PacketEntity { + success = false; + + constructor() { + super(); + this.command = Protocol.Commands.kRpcEditPlanGroup; + } + } + + export class DeletePlanGroupRequestEntity extends Protocol.PacketEntity { + uuid = ""; + + constructor(rcp_id?: number, uuid?: string) { + super(); + this.rpc_id = rcp_id ?? 0; + this.command = Protocol.Commands.kRpcDeletePlanGroup; + this.uuid = uuid ?? ""; + } + } + + export class DeletePlanGroupResponseEntity extends Protocol.PacketEntity { + success = false; + + constructor() { + super(); + this.command = Protocol.Commands.kRpcDeletePlan; + } + } + + export class AddPlanRequestEntity extends Protocol.PacketEntity { + name: string; + group_uuid: string; + constructor(rcp_id?: number, name?: string, group_uuid?: string) { + super(); + this.rpc_id = rcp_id ?? 0; + this.command = Protocol.Commands.kRpcAddPlan; + this.name = name ?? ""; + this.group_uuid = group_uuid ?? ""; + } + } + + export class AddPlanResponseEntity extends Protocol.PacketEntity { + success = false; + + constructor() { + super(); + this.command = Protocol.Commands.kRpcAddPlan; + } + } + + export class EditPlanRequestEntity extends Protocol.PacketEntity { + name: string; + uuid: string; + constructor(rcp_id?: number, name?: string, uuid?: string) { + super(); + this.rpc_id = rcp_id ?? 0; + this.command = Protocol.Commands.kRpcEditPlan; + this.name = name ?? ""; + this.uuid = uuid ?? ""; + } + } + + export class EditPlanResponseEntity extends Protocol.PacketEntity { + success = false; + + constructor() { + super(); + this.command = Protocol.Commands.kRpcEditPlan; + } + } + + export class DeletePlanRequestEntity extends Protocol.PacketEntity { + uuid: string = ""; + constructor(rcp_id?: number, uuid?: string) { + super(); + this.rpc_id = rcp_id ?? 0; + this.command = Protocol.Commands.kRpcDeletePlan; + this.uuid = uuid ?? ""; + } + } + + export class DeletePlanResponseEntity extends Protocol.PacketEntity { + success = false; + + constructor() { + super(); + this.command = Protocol.Commands.kRpcDeletePlan; + } + } + + export class GetCurrentRunningPlanRequestEntity extends Protocol.PacketEntity { + timestamp: number = new Date().getMilliseconds(); + constructor(rcp_id?: number) { + super(); + this.rpc_id = rcp_id ?? 0; + this.command = Protocol.Commands.kRpcGetCurrentRunningPlan; + } + } + + export class GetCurrentRunningPlanResponseEntity extends Protocol.PacketEntity { + plan = PlanEntity; + running = false; + constructor() { + super(); + this.command = Protocol.Commands.kRpcGetCurrentRunningPlan; + } + } + + export class PlanGroupEntity extends Protocol.PacketEntity { + parent_uuid: string = ""; + name: string = ""; + } + + export class RunPlanRequestEntity extends Protocol.PacketEntity { + uuid: string; + + constructor(uuid: string) { + super(); + this.command = Protocol.Commands.kRunPlan; + this.flag = Protocol.PacketEntity.FLAG_REQUEST; + this.uuid = uuid; + } + } + + export class PlanAddNotifyEntity extends Protocol.PacketEntity { + plan: PlanEntity = new PlanEntity(); + } + + export class PlanDeleteNotifyEntity extends Protocol.PacketEntity { + uuid: string = ""; + } + + export class PlanEditNotifyEntity extends Protocol.PacketEntity { + plan: PlanEntity = new PlanEntity(); + } + + export class PlanGroupAddNotifyEntity extends Protocol.PacketEntity { + plan_group: PlanGroupEntity = new PlanGroupEntity(); + } + + export class PlanGroupDeleteNotifyEntity extends Protocol.PacketEntity { + uuid: string = ""; + } + + export class PlanGroupEditNotifyEntity extends Protocol.PacketEntity { + plan_group: PlanGroupEntity = new PlanGroupEntity(); + } + + export class PlanRunningStateChangeNotifyEntity extends Protocol.PacketEntity { + plan: PlanEntity = new PlanEntity(); + running = false; + } + export class SetApplicationConfigRequestEntity extends Protocol.PacketEntity { key: string = ""; value: string = ""; diff --git a/src/i18n/zh-CN/index.ts b/src/i18n/zh-CN/index.ts index 09ed74e..5f64f97 100644 --- a/src/i18n/zh-CN/index.ts +++ b/src/i18n/zh-CN/index.ts @@ -128,4 +128,22 @@ export default { "add mode": "添加模式", "mode name": "模式名称", "edit mode": "修改模式", + spa: "网页版", + pwa: "PWA版", + "add plan item": "添加预案", + "run plan directives send": "执行预案发送", + "is running": "正在运行", + "is stopping": "已经停止", + "add plan": "添加预案", + "edit plan": "修改预案", + "delete plan": "删除预案", + "plan name": "预案名称", + "please input plan name": "请输入预案名称", + "add row": "添加行", + "delete row": "删除行", + "operator value": "值", + delay: "延迟", + s: "秒", + "call mode": "模式调用", + "plan data": "预案数据", }; diff --git a/src/pages/Index.vue b/src/pages/Index.vue index 174b19d..ef8a359 100644 --- a/src/pages/Index.vue +++ b/src/pages/Index.vue @@ -10,6 +10,8 @@ import WallPage from "src/pages/WallPage.vue"; import EventBus, { EventNamesDefine } from "src/common/EventBus"; import { useQuasar } from "quasar"; import { useI18n } from "vue-i18n"; +import { NotifyMessage } from "src/common/ClientConnection"; +import { Protocol } from "src/entities/WSProtocol"; export default defineComponent({ name: "PageIndex", @@ -28,6 +30,37 @@ export default defineComponent({ EventBus.getInstance().on(EventNamesDefine.CurrentConnectConnected, () => { $q.loading.hide(); }); + + EventBus.getInstance().on( + EventNamesDefine.NotifyMessage, + (response: NotifyMessage) => { + try { + switch (response.packet.command) { + case Protocol.Commands.kPlanRunningStateChanged: + { + const temp = JSON.parse( + response.data + ) as Protocol.PlanRunningStateChangeNotifyEntity; + if (temp && temp.plan) { + $q.notify({ + color: "positive", + icon: "done", + message: + $t.t("plan") + + " '" + + temp.plan.name + + " '" + + (temp.running ? $t.t("is running") : $t.t("is stopping")), + position: "top", + timeout: 1500, + }); + } + } + break; + } + } catch {} + } + ); return {}; }, }); diff --git a/src/pages/Login.vue b/src/pages/Login.vue index 5370fba..f778467 100644 --- a/src/pages/Login.vue +++ b/src/pages/Login.vue @@ -182,6 +182,10 @@ export default defineComponent({ const $route = useRouter(); const data = reactive(new _Data()); let web_socket: ClientConnection | null = null; + let is_pwa = ["fullscreen", "standalone", "minimal-ui"].some( + (displayMode) => + window.matchMedia("(display-mode: " + displayMode + ")").matches + ); const landspace = ref(window.innerHeight < window.innerWidth); @@ -192,6 +196,7 @@ export default defineComponent({ return { data, landspace, + is_pwa, loga(a: any) { console.log(a); }, diff --git a/src/pages/RightToolBar.vue b/src/pages/RightToolBar.vue index dc21ccb..78ad5a4 100644 --- a/src/pages/RightToolBar.vue +++ b/src/pages/RightToolBar.vue @@ -20,8 +20,7 @@ -
Alarms
- Lorem ipsum dolor sit amet consectetur adipisicing elit. +
@@ -30,14 +29,15 @@