添加轮询列表,调整系统设置选项

This commit is contained in:
fangxiang 2022-02-24 20:11:20 +08:00
parent 41d3ca271b
commit cd968f9cbe
16 changed files with 719 additions and 73 deletions

View File

@ -1,6 +1,6 @@
{
"name": "media_player_client",
"version": "1.2.3",
"version": "1.2.5",
"description": "A Quasar Framework app",
"productName": "MediaPlayerClient",
"author": "fangxiang <fangxiang@cloudview.work>",

View File

@ -533,6 +533,10 @@ export default class ClientConnection {
this.ws?.send(JSON.stringify(data));
}
public openPolling(data: Protocol.OpenPollingRequestEntity) {
this.ws?.send(JSON.stringify(data));
}
public focusIn(window_id: number) {
this.ws?.send(
JSON.stringify(
@ -755,6 +759,16 @@ export default class ClientConnection {
}
}
public async getPollings() {
try {
return await this.doRpc<Protocol.GetPollingsResponseEntity>(
new Protocol.GetPollingsRequestEntity()
);
} catch (e) {
console.error(e);
}
}
public destory() {
if (this.ws) {
this.ws.onclose = null;

View File

@ -1,3 +1,4 @@
import { PollingEntity } from "./../entities/PollingEntity";
import { SessionStorage } from "quasar";
import ApplicationConfigEntity from "src/entities/ApplicationConfigEntity";
import { HttpProtocol } from "src/entities/HttpProtocol";
@ -76,6 +77,16 @@ export default class GlobalData {
this._plans = plans;
}
_pollings: PollingEntity[] = [];
public get pollings() {
return this._pollings;
}
public set pollings(pollings: PollingEntity[]) {
this._pollings = pollings;
}
constructor() {
const url: string | null = SessionStorage.getItem("url");
let name: string | null = SessionStorage.getItem("name");

View File

@ -31,6 +31,13 @@ export default class Initializer {
?.getPlans()) as Protocol.GetPlansResponseEntity;
}
private async getPollings() {
const global_data = GlobalData.getInstance();
return (await global_data
.getCurrentClient()
?.getPollings()) as Protocol.GetPollingsResponseEntity;
}
private async initSignalSourceTree() {
const options = this.options;
const $store = options?.$store;
@ -80,6 +87,22 @@ export default class Initializer {
}
}
private async initPollingTree() {
const options = this.options;
const $store = options.$store;
if ($store) {
try {
let response = await this.getPollings();
if (response) {
$store.commit("buildPollingTree", { options, response });
GlobalData.getInstance().pollings = response.pollings;
}
} catch (e) {
console.error(e);
}
}
}
private async getApplicationConfig() {
const global_data = GlobalData.getInstance();
global_data.applicationConfig = (
@ -136,6 +159,7 @@ export default class Initializer {
this.initSignalSourceTree();
this.initModeTree();
this.initPlanTree();
this.initPollingTree();
this.getCurrentRunningPlan();
this.getWindows();
}

View File

@ -288,6 +288,100 @@ export default class RemoteDataExangeProcesser {
}
break;
case Protocol.Commands.kRpcAddPollingGroup:
{
const temp = JSON.parse(
notify.data
) as Protocol.PollingAddNotifyEntity;
if (temp) {
GlobalData.getInstance().pollings.push(temp.polling);
$store.commit("addPollingTreeItem", {
parent: temp.polling.group_uuid,
is_group: false,
item_data: temp.polling,
});
}
}
break;
case Protocol.Commands.kRpcDeletePolling:
{
const temp = JSON.parse(
notify.data
) as Protocol.PollingDeleteNotifyEntity;
if (temp) {
let pos = GlobalData.getInstance().pollings.findIndex(
(element) => element && element.uuid == temp.uuid
);
if (pos != -1) {
GlobalData.getInstance().pollings.splice(pos, 1);
}
$store.commit("deletePollingTreeItem", {
is_group: false,
uuid: temp.uuid,
});
}
}
break;
case Protocol.Commands.kRpcEditPolling:
{
const temp = JSON.parse(
notify.data
) as Protocol.PollingEditNotifyEntity;
if (temp) {
let pos = GlobalData.getInstance().pollings.findIndex(
(element) => element && element.uuid == temp.polling.uuid
);
if (pos != -1) {
GlobalData.getInstance().pollings[pos] = temp.polling;
}
$store.commit("setPollingTreeItem", {
is_group: false,
item_data: temp.polling,
});
}
}
break;
case Protocol.Commands.kRpcAddPollingGroup:
{
const temp = JSON.parse(
notify.data
) as Protocol.PollingGroupAddNotifyEntity;
if (temp) {
$store.commit("addPollingTreeItem", {
parent: temp.polling_group.parent_uuid,
is_group: true,
item_data: temp.polling_group,
});
}
}
break;
case Protocol.Commands.kRpcDeletePollingGroup:
{
const temp = JSON.parse(
notify.data
) as Protocol.PollingGroupDeleteNotifyEntity;
if (temp) {
$store.commit("deletePollingTreeItem", {
is_group: true,
uuid: temp.uuid,
});
}
}
break;
case Protocol.Commands.kRpcEditPollingGroup:
{
const temp = JSON.parse(
notify.data
) as Protocol.PollingGroupEditNotifyEntity;
if (temp) {
$store.commit("setPollingTreeItem", {
is_group: true,
item_data: temp.polling_group,
});
}
}
break;
case Protocol.Commands.kRpcAddSignalSource:
{
const temp = JSON.parse(

View File

@ -0,0 +1,215 @@
<template>
<div>
<q-scroll-area
:style="{ height: content_height + 'px' }"
style="width: 20vw"
>
<q-tree ref="tree" :nodes="tree_nodes" node-key="uuid" labelKey="name">
<template v-slot:default-header="prop">
<q-item
class="full-width"
clickable
:draggable="!prop.node.is_group"
@dragstart="(evt) => onDragStart(evt, prop.node)"
@dblclick="
(evt) =>
false && !prop.node.is_group && runPlan(prop.node.item_data)
"
>
<q-item-section avatar>
<q-icon
:name="
prop.node.is_group
? 'img:source_icon/group.png'
: 'img:source_icon/hdmi.png'
"
color="orange"
size="28px"
class="q-mr-sm"
/>
</q-item-section>
<q-item-section>
<div class="text-weight-bold text-primary">
{{ prop.node.name }}
</div>
</q-item-section>
<q-popup-proxy context-menu>
<q-popup-proxy context-menu />
<q-list>
<q-item
v-if="
prop.node.name == $t('root') ||
(prop.node.is_group && prop.node.item_data)
"
clickable
v-close-popup
v-ripple
@click="
$refs.polling_dialog.showDialog({
type: 1,
data: { uuid: prop.node.uuid },
})
"
>
<q-item-section avatar><q-icon name="add" /></q-item-section>
<q-item-section>{{ $t("add polling item") }}</q-item-section>
</q-item>
<q-item
clickable
v-close-popup
v-if="
prop.node.name == $t('root') ||
(prop.node.is_group && prop.node.item_data)
"
v-ripple
@click="
() =>
$refs.group_dialog.showDialog({
type: 1,
data: prop.node,
})
"
>
<q-item-section avatar
><q-icon name="create_new_folder"
/></q-item-section>
<q-item-section>{{ $t("add group") }}</q-item-section>
</q-item>
<q-item
clickable
v-ripple
v-close-popup
v-if="prop.node.item_data"
@click="
() =>
(prop.node.is_group
? $refs.group_dialog
: $refs.polling_dialog
).showDialog({
type: 2,
data: prop.node,
})
"
>
<q-item-section avatar><q-icon name="edit" /></q-item-section>
<q-item-section>{{ $t("edit") }}</q-item-section>
</q-item>
<q-item
clickable
v-ripple
v-close-popup
v-if="prop.node.item_data"
@click="
(evt) => deleteItem(evt, prop.node.is_group, prop.node.uuid)
"
>
<q-item-section avatar
><q-icon color="red" name="delete"
/></q-item-section>
<q-item-section>{{ $t("delete") }} &nbsp;</q-item-section>
</q-item>
</q-list>
</q-popup-proxy>
</q-item>
</template>
</q-tree>
</q-scroll-area>
</div>
</template>
<script lang="ts">
import { defineComponent, computed, onMounted, ref, nextTick } from "vue";
import { useStore } from "src/store";
import { Common } from "src/common/Common";
import GlobalData from "src/common/GlobalData";
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";
import { PollingTreeItemEntity } from "src/entities/PollingEntity";
export default defineComponent({
name: "ComponentPollingTree",
setup() {
const $store = useStore();
const $q = useQuasar();
const $t = useI18n();
const tree_nodes = computed({
get: () => $store.state.polling_tree,
set: (val) => {},
});
const content_height = ref(0);
const refresh_content_height = () => {
content_height.value = window.innerHeight - 135;
};
refresh_content_height();
EventBus.getInstance().on(EventNamesDefine.WindowResize, () => {
refresh_content_height();
});
const tree: any | null = ref(null);
onMounted(async () => {
while (!tree.value.nodes.length) {
await Common.waitFor(100);
}
tree.value?.setExpanded("", true);
});
return {
tree,
tree_nodes,
content_height,
loga(a: any) {
console.log(a);
},
async deleteItem(
evt: PointerEvent | null,
is_group: boolean,
uuid: string
) {
// let success = false;
// if (is_group) {
// let response = await GlobalData.getInstance()
// .getCurrentClient()
// ?.deletePlanGroup(uuid);
// if (response) {
// success = response.success;
// }
// } else {
// let response = await GlobalData.getInstance()
// .getCurrentClient()
// ?.deletePlan(uuid);
// if (response) {
// success = response.success;
// }
// }
// $q.notify({
// color: success ? "positive" : "negative",
// icon: success ? "done" : "warning",
// message:
// $t.t("delete") + (success ? $t.t("success") : $t.t("fail")) + "!",
// position: "top",
// timeout: 1500,
// });
},
onDragStart(e: DragEvent, node: PollingTreeItemEntity) {
e.dataTransfer?.setData("uuid", node.uuid);
e.dataTransfer?.setData("type", "polling");
e.dataTransfer?.setData("node_object", JSON.stringify(node));
if (e.dataTransfer) {
e.dataTransfer.dropEffect = "move";
}
},
};
},
});
</script>

View File

@ -193,6 +193,7 @@ export default defineComponent({
},
onDragStart(e: DragEvent, node: SignalSourceTreeItemEntity) {
e.dataTransfer?.setData("uuid", node.uuid);
e.dataTransfer?.setData("type", "signal_source");
e.dataTransfer?.setData("node_object", JSON.stringify(node));
if (e.dataTransfer) {
e.dataTransfer.dropEffect = "move";

View File

@ -192,7 +192,7 @@
<q-card-section>
<q-form ref="graphics_form" @submit="applyGraphics">
<q-list>
<q-item>
<q-item v-if="false">
<q-item-section avatar class="width_5_2">{{
$t("brightness") + ":"
}}</q-item-section>
@ -213,7 +213,7 @@
/>
</q-item-section>
</q-item>
<q-item>
<q-item v-if="false">
<q-item-section avatar class="width_5_2">{{
$t("contrast") + ":"
}}</q-item-section>
@ -234,7 +234,7 @@
/>
</q-item-section>
</q-item>
<q-item>
<q-item v-if="false">
<q-item-section avatar class="width_5_2">{{
$t("hue") + ":"
}}</q-item-section>
@ -283,19 +283,6 @@
/>
</q-item-section>
</q-item>
<q-item>
<q-item-section avatar class="width_5_2_2">{{
$t("output board resolution") + ":"
}}</q-item-section>
<q-item-section>
<q-select
v-model="output_board_resolution"
:loading="loading"
:disable="loading"
:options="output_board_resolution_options"
/>
</q-item-section>
</q-item>
</q-list>
</q-form>
</q-card-section>
@ -614,6 +601,19 @@
/>
</q-item-section>
</q-item>
<q-item>
<q-item-section avatar class="width_5_4">{{
$t("output board resolution") + ":"
}}</q-item-section>
<q-item-section>
<q-select
v-model="output_board_resolution"
:loading="loading"
:disable="loading"
:options="output_board_resolution_options"
/>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-btn
@ -854,16 +854,6 @@ export default defineComponent({
.getCurrentClient()
?.getSupportResolutions();
if (support_resolutions) {
output_board_resolution_options.value = [];
for (const item of Object.keys(
support_resolutions.output_board_support_resolutions
).sort()) {
output_board_resolution_options.value.push(
(support_resolutions.output_board_support_resolutions as any)[
item
]
);
}
device_resolution_options.value = [];
for (const item of Object.keys(
support_resolutions.device_support_resolutions
@ -871,16 +861,6 @@ export default defineComponent({
device_resolution_options.value.push(item);
}
{
const val = output_board_resolution_options.value.find(
(element) =>
element &&
element == support_resolutions.current_output_board_resolution
);
output_board_resolution.value =
val ?? output_board_resolution_options.value[0];
}
{
let val = device_resolution_options.value.find(
(element) =>
@ -959,6 +939,24 @@ export default defineComponent({
output_board_rotate.value = settings.rotate;
output_board_volume.value = settings.volume;
output_board_mute.value = settings.mute ? $t.t("on") : $t.t("off");
{
output_board_resolution_options.value = [];
for (const item of Object.keys(
settings.output_board_support_resolutions
).sort()) {
output_board_resolution_options.value.push(
(settings.output_board_support_resolutions as any)[item]
);
}
const val = output_board_resolution_options.value.find(
(element) =>
element && element == settings.current_output_board_resolution
);
output_board_resolution.value =
val ?? output_board_resolution_options.value[0];
}
}
};
@ -1027,7 +1025,6 @@ export default defineComponent({
request.brightness = parseInt(brightness.value.toString());
request.contrast = parseInt(contrast.value.toString());
request.hue = parseInt(hue.value.toString());
request.output_board_resolution = output_board_resolution.value;
request.device_resolution = device_resolution.value;
request.rotate = parseInt(device_rotate.value.toString());
@ -1171,6 +1168,7 @@ export default defineComponent({
request.rotate = parseInt(output_board_rotate.value.toString());
request.volume = parseInt(output_board_volume.value.toString());
request.mute = output_board_mute.value == $t.t("on");
request.output_board_resolution = output_board_resolution.value;
let success = false;
try {

View File

@ -15,7 +15,7 @@ export class MultimediaWindowEntity extends BaseEntity {
playing: boolean = false;
play_speed: number = 1;
polling: boolean = false;
polling_signal_sources: StringKeyValueEntity[] = [];
polling_uuid: string = "";
}
export class WindowOpenNotifyEntity extends MultimediaWindowEntity {

View File

@ -0,0 +1,52 @@
import BaseEntity from "./BaseEntity";
import { StringKeyValueEntity } from "./StringKeyValueEntity";
export class PollingEntity extends BaseEntity {
name: string = "";
group_uuid = "";
polling_signal_sources: StringKeyValueEntity[] = [];
note: string = "";
public static copy(dest: PollingEntity, src?: PollingEntity) {
if (!src) {
src = new PollingEntity();
}
dest.uuid = src.uuid;
dest.base_note = src.base_note;
dest.name = src.name;
dest.polling_signal_sources = src.polling_signal_sources;
dest.group_uuid = src.group_uuid;
dest.note = src.note;
}
}
export class PollingGroupEntity extends BaseEntity {
parent_uuid: string = "";
name: string = "";
}
export class PollingTreeItemEntity {
uuid = "";
parent = "";
name = "";
is_group = false;
children: PollingTreeItemEntity[] = [];
item_data: PollingEntity | null = null;
constructor(
uuid?: string,
parent?: string,
name?: string,
is_group?: boolean,
item_data?: any,
children?: PollingTreeItemEntity[]
) {
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;
}
}

View File

@ -9,6 +9,8 @@ export class SignalSourceEntity extends BaseEntity {
ext_data: string = "";
group_uuid = "";
system_default: boolean = false;
local_file_flag: boolean = false;
note: string = "";
public static copy(dest: SignalSourceEntity, src?: SignalSourceEntity) {
if (!src) {
@ -25,6 +27,8 @@ export class SignalSourceEntity extends BaseEntity {
dest.ext_data = src.ext_data;
dest.group_uuid = src.group_uuid;
dest.system_default = src.system_default;
dest.local_file_flag = src.local_file_flag;
dest.note = src.note;
}
}

View File

@ -4,6 +4,7 @@ import ApplicationConfigEntity from "./ApplicationConfigEntity";
import { ModeEntity } from "./ModeEntity";
import { PlanEntity } from "./PlanEntity";
import SubtitleEntity from "./SubtitleEntity";
import { PollingEntity, PollingGroupEntity } from "./PollingEntity";
export namespace Protocol {
export class Commands {
@ -48,6 +49,10 @@ export namespace Protocol {
return Commands.PROTOCOL_PREFIX + "RpcGetPlans";
}
public static get kRpcGetPollings() {
return Commands.PROTOCOL_PREFIX + "RpcGetPollings";
}
public static get kRpcGetApplicationConfig() {
return Commands.PROTOCOL_PREFIX + "RpcGetApplicationConfig";
}
@ -63,10 +68,15 @@ export namespace Protocol {
public static get kSetWindowGeometry() {
return Commands.PROTOCOL_PREFIX + "SetWindowGeometry";
}
public static get kOpenWindow() {
return Commands.PROTOCOL_PREFIX + "OpenWindow";
}
public static get kOpenPolling() {
return Commands.PROTOCOL_PREFIX + "OpenPolling";
}
public static get kCloseWindow() {
return Commands.PROTOCOL_PREFIX + "CloseWindow";
}
@ -167,6 +177,30 @@ export namespace Protocol {
return Commands.PROTOCOL_PREFIX + "RpcEditPlan";
}
public static get kRpcAddPollingGroup() {
return Commands.PROTOCOL_PREFIX + "RpcAddPollingGroup";
}
public static get kRpcDeletePollingGroup() {
return Commands.PROTOCOL_PREFIX + "RpcDeletePollingGroup";
}
public static get kRpcEditPollingGroup() {
return Commands.PROTOCOL_PREFIX + "RpcEditPollingGroup";
}
public static get kRpcAddPolling() {
return Commands.PROTOCOL_PREFIX + "RpcAddPolling";
}
public static get kRpcEditPolling() {
return Commands.PROTOCOL_PREFIX + "RpcEditPolling";
}
public static get kRpcDeletePolling() {
return Commands.PROTOCOL_PREFIX + "RpcDeletePolling";
}
public static get kRunPlan() {
return Commands.PROTOCOL_PREFIX + "RunPlan";
}
@ -309,11 +343,13 @@ export namespace Protocol {
Commands.kRpcGetSignalSources,
Commands.kRpcGetModes,
Commands.kRpcGetPlans,
Commands.kRpcGetPollings,
Commands.kRpcGetApplicationConfig,
Commands.kMoveWindow,
Commands.kResizeWindow,
Commands.kSetWindowGeometry,
Commands.kOpenWindow,
Commands.kOpenPolling,
Commands.kCloseWindow,
Commands.kTopWindow,
Commands.kLowerWindow,
@ -339,6 +375,12 @@ export namespace Protocol {
Commands.kRpcAddPlan,
Commands.kRpcDeletePlan,
Commands.kRpcEditPlan,
Commands.kRpcAddPollingGroup,
Commands.kRpcDeletePollingGroup,
Commands.kRpcEditPollingGroup,
Commands.kRpcAddPolling,
Commands.kRpcEditPolling,
Commands.kRpcDeletePolling,
Commands.kSetApplicationConfig,
Commands.kRpcGetSubtitle,
Commands.kRpcSetSubtitle,
@ -610,6 +652,34 @@ export namespace Protocol {
}
}
export class OpenPollingRequestEntity extends PacketEntity {
polling_uuid: string = "";
x: number = 0;
y: number = 0;
width: number = 0;
height: number = 0;
volume: number = 80;
muted: boolean = true;
paused: boolean = false;
play_speed: number = 1;
constructor(
polling_uuid: string,
x: number,
y: number,
width: number,
height: number
) {
super();
this.command = Commands.kOpenPolling;
this.polling_uuid = polling_uuid ?? "";
this.x = x ?? 0;
this.y = y ?? 0;
this.width = width ?? 0;
this.height = height ?? 0;
}
}
export class WindowCloseNotifyEntity extends PacketEntity {
window_id: number = 0;
constructor() {
@ -1340,7 +1410,6 @@ export namespace Protocol {
hue: number = 100;
rotate: number = 0;
device_resolution: string = "3840x2160@60";
output_board_resolution: string = "1920x1080";
constructor(rcp_id?: number) {
super();
@ -1395,8 +1464,6 @@ export namespace Protocol {
}
export class GetSupportResolutionsResponseEntity extends Protocol.PacketEntity {
output_board_support_resolutions: Object = {};
current_output_board_resolution: string = "";
device_support_resolutions: Object = {};
current_device_resolution: string = "";
@ -1425,6 +1492,8 @@ export namespace Protocol {
rotate: number = 0;
volume: number = 0;
mute: boolean = false;
output_board_support_resolutions: Object = {};
current_output_board_resolution: string = "";
constructor() {
super();
@ -1440,6 +1509,7 @@ export namespace Protocol {
rotate: number = 0;
volume: number = 0;
mute: boolean = false;
output_board_resolution: string = "1920x1080";
constructor(rcp_id?: number) {
super();
@ -1729,4 +1799,48 @@ export namespace Protocol {
this.command = Commands.kRpcGetUsbDevices;
}
}
export class GetPollingsRequestEntity extends PacketEntity {
timestamp = new Date().getMilliseconds();
constructor(rpcid?: number) {
super();
this.rpc_id = rpcid ?? 0;
this.command = Commands.kRpcGetPollings;
}
}
export class GetPollingsResponseEntity extends PacketEntity {
pollings: PollingEntity[] = [];
polling_groups: [] = [];
constructor() {
super();
this.command = Commands.kRpcGetPollings;
}
}
export class PollingAddNotifyEntity extends Protocol.PacketEntity {
polling: PollingEntity = new PollingEntity();
}
export class PollingDeleteNotifyEntity extends Protocol.PacketEntity {
uuid: string = "";
}
export class PollingEditNotifyEntity extends Protocol.PacketEntity {
polling: PollingEntity = new PollingEntity();
}
export class PollingGroupAddNotifyEntity extends Protocol.PacketEntity {
polling_group: PollingGroupEntity = new PollingGroupEntity();
}
export class PollingGroupDeleteNotifyEntity extends Protocol.PacketEntity {
uuid: string = "";
}
export class PollingGroupEditNotifyEntity extends Protocol.PacketEntity {
polling_group: PollingGroupEntity = new PollingGroupEntity();
}
}

View File

@ -339,4 +339,5 @@ export default {
usb6: "USB6",
usb7: "USB7",
usb8: "USB8",
polling: "轮询",
};

View File

@ -11,7 +11,7 @@
style="color: red"
>
<q-tab name="signal_source" :label="$t('signal source')" />
<q-tab name="" icon="" disable />
<q-tab name="polling" :label="$t('polling')" />
</q-tabs>
<q-separator />
@ -19,6 +19,9 @@
<q-tab-panel name="signal_source">
<signal-source-tree />
</q-tab-panel>
<q-tab-panel name="polling">
<polling-tree />
</q-tab-panel>
</q-tab-panels>
</div>
<slot />
@ -27,11 +30,12 @@
<script lang="ts">
import { defineComponent, ref } from "vue";
import SignalSourceTree from "src/components/SignalSourceTree.vue";
import PollingTree from "src/components/PollingTree.vue";
export default defineComponent({
name: "PageLeftToolBar",
components: { SignalSourceTree },
components: { SignalSourceTree, PollingTree },
setup() {
const tab_value = ref("signal_source");

View File

@ -656,36 +656,58 @@ export default defineComponent({
target.classList.remove("drag-enter");
}
let uuid = e.dataTransfer?.getData("uuid");
if (uuid) {
let signal_sources = GlobalData.getInstance().signal_source.filter(
const type = e.dataTransfer?.getData("type");
const uuid = e.dataTransfer?.getData("uuid");
if (uuid && uuid.length > 0 && type && type.length > 0) {
const signal_sources = GlobalData.getInstance().signal_source.filter(
(item) => (item as any)?.uuid == uuid
);
if (signal_sources.length) {
let signal_source = signal_sources[0];
const signal_source = signal_sources[0];
if (signal_source) {
let dom: HTMLElement | null = e.target as HTMLElement;
const dom: HTMLElement | null = e.target as HTMLElement;
if (wall.value && dom) {
if (dom.classList.contains("wall_item_flag")) {
//
GlobalData.getInstance()
.getCurrentClient()
?.openWindow(
new Protocol.OpenWindowRequestEntity(
signal_source.uuid,
dom.offsetLeft / wall.value.clientWidth,
dom.offsetTop / wall.value.clientHeight,
dom.offsetWidth / wall.value.clientWidth,
dom.offsetHeight / wall.value.clientHeight
)
);
const x = dom.offsetLeft / wall.value.clientWidth;
const y = dom.offsetTop / wall.value.clientHeight;
const width = dom.offsetWidth / wall.value.clientWidth;
const height = dom.offsetHeight / wall.value.clientHeight;
switch (type) {
case "polling":
GlobalData.getInstance()
.getCurrentClient()
?.openPolling(
new Protocol.OpenPollingRequestEntity(
uuid,
x,
y,
width,
height
)
);
break;
case "signal_source" /**OpenPollingRequestEntity */:
GlobalData.getInstance()
.getCurrentClient()
?.openWindow(
new Protocol.OpenWindowRequestEntity(
signal_source.uuid,
x,
y,
width,
height
)
);
break;
}
} else if (dom.classList.contains("window_flag")) {
//
let uuid = dom.getAttribute("uuid");
if (uuid) {
const rep_uuid = dom.getAttribute("uuid");
if (rep_uuid) {
let window = $store.state.windows.find(
(item) => item.uuid == uuid
(item) => item.uuid == rep_uuid
);
if (window) {
let client = GlobalData.getInstance().getCurrentClient();
@ -697,15 +719,32 @@ export default defineComponent({
client.closeWindow(window.window_id);
setTimeout(() => {
client?.openWindow(
new Protocol.OpenWindowRequestEntity(
signal_source.uuid,
x,
y,
width,
height
)
);
switch (type) {
case "polling":
GlobalData.getInstance()
.getCurrentClient()
?.openPolling(
new Protocol.OpenPollingRequestEntity(
uuid,
x,
y,
width,
height
)
);
break;
case "signal_source":
client?.openWindow(
new Protocol.OpenWindowRequestEntity(
signal_source.uuid,
x,
y,
width,
height
)
);
break;
}
}, 100);
}
}
@ -836,8 +875,11 @@ export default defineComponent({
});
return;
}
const polling = GlobalData.getInstance()._pollings.find(
(element) => element && element.uuid == window.polling_uuid
);
const datas = await polling_setting_dialog.value.showDialogAsync(
window.polling_signal_sources
polling ? polling.polling_signal_sources : []
);
if (datas) {
try {

View File

@ -1,3 +1,7 @@
import {
PollingEntity,
PollingTreeItemEntity,
} from "./../entities/PollingEntity";
import { store } from "quasar/wrappers";
import { ModeEntity, ModeTreeItemEntity } from "src/entities/ModeEntity";
import { WindowOpenNotifyEntity } from "src/entities/MultimediaWindowEntity";
@ -31,6 +35,7 @@ export interface StateInterface {
// Declared as unknown to avoid linting issue. Best to strongly type as per the line above.
initialized: boolean;
signal_source_tree: SignalSourceTreeItemEntity[];
polling_tree: PollingTreeItemEntity[];
mode_tree: ModeTreeItemEntity[];
plan_tree: PlanTreeItemEntity[];
wall_row: number;
@ -268,6 +273,7 @@ export default store(function (/* { ssrContext } */) {
// state
initialized: false,
signal_source_tree: [],
polling_tree: [],
mode_tree: [],
plan_tree: [],
wall_col: 1,
@ -722,6 +728,72 @@ export default store(function (/* { ssrContext } */) {
playload
);
},
// polling tree
setPollingTree(
state: StateInterface,
playload?: PollingTreeItemEntity[]
) {
if (playload) {
state.polling_tree = playload;
}
},
clearPollingTree(state: StateInterface, playload?: any) {
state.polling_tree = [];
},
pushPollingTreeItem(
state: StateInterface,
playload?: PollingTreeItemEntity
) {
if (playload) {
state.polling_tree.push(playload);
}
},
addPollingTreeItem(state: StateInterface, playload?: any) {
_TreeHelper.addTreeItem(
state.polling_tree,
() => new PollingEntity(),
(uuid: string, parent: string, name: string, is_group: boolean) =>
new PollingTreeItemEntity(uuid, parent, name, is_group),
playload
);
},
setPollingTreeItem(state: StateInterface, playload?: any) {
_TreeHelper.setTreeItem(
state.polling_tree,
() => new PollingEntity(),
(left: any, right: any) => PollingEntity.copy(left, right),
playload
);
},
deletePollingTreeItem(state: StateInterface, playload?: any) {
_TreeHelper.deleteTreeItem(state.polling_tree, playload);
},
buildPollingTree(state: StateInterface, playload?: any) {
_TreeHelper.buildTree(
state.polling_tree,
"polling_groups",
"pollings",
(
uuid?: string,
parent?: string,
name?: string,
is_group?: boolean,
item_data?: any,
children?: PollingTreeItemEntity[]
) =>
new PollingTreeItemEntity(
uuid,
parent,
name,
is_group,
item_data,
children
),
playload
);
console.log(state.polling_tree);
},
// polling tree end
setDeviceIpAddress(state: StateInterface, playload?: any) {
if (playload) state.device_ip_address = playload;
},