删除资源时添加对话框确认

This commit is contained in:
fangxiang 2022-07-29 16:17:52 +08:00
parent cf98b9ba08
commit f645d98b02
6 changed files with 254 additions and 112 deletions

View File

@ -217,28 +217,8 @@ export default defineComponent({
loga(a: any) { loga(a: any) {
console.log(a); console.log(a);
}, },
async deleteItem( deleteItem(evt: PointerEvent | null, is_group: boolean, uuid: string) {
evt: PointerEvent | null, const show_tooltip = (success: boolean) => {
is_group: boolean,
uuid: string
) {
let success = false;
if (is_group) {
let response = await GlobalData.getInstance()
.getCurrentClient()
?.deleteModeGroup(uuid);
if (response) {
success = response.success;
}
} else {
let response = await GlobalData.getInstance()
.getCurrentClient()
?.deleteMode(uuid);
if (response) {
success = response.success;
}
}
$q.notify({ $q.notify({
color: success ? "positive" : "negative", color: success ? "positive" : "negative",
icon: success ? "done" : "warning", icon: success ? "done" : "warning",
@ -247,6 +227,59 @@ export default defineComponent({
position: "top", position: "top",
timeout: 1500, timeout: 1500,
}); });
};
let success = false;
if (is_group) {
$q.dialog({
title: $t.t("Confirm"),
message: $t.t(
"delete group should be delete all child! do you want to delete this group?"
),
ok: {
label: $t.t("ok"),
noCaps: true,
flat: true,
},
cancel: {
label: $t.t("cancel"),
noCaps: true,
flat: true,
},
persistent: true,
}).onOk(async () => {
let response = await GlobalData.getInstance()
.getCurrentClient()
?.deleteModeGroup(uuid);
if (response) {
success = response.success;
}
show_tooltip(success);
});
} else {
$q.dialog({
title: $t.t("Confirm"),
message: $t.t("do you want to delete the item") + "?",
ok: {
label: $t.t("ok"),
noCaps: true,
flat: true,
},
cancel: {
label: $t.t("cancel"),
noCaps: true,
flat: true,
},
persistent: true,
}).onOk(async () => {
let response = await GlobalData.getInstance()
.getCurrentClient()
?.deleteMode(uuid);
if (response) {
success = response.success;
}
show_tooltip(success);
});
}
}, },
callMode(item: ModeEntity) { callMode(item: ModeEntity) {
GlobalData.getInstance().getCurrentClient()?.callMode(item.uuid); GlobalData.getInstance().getCurrentClient()?.callMode(item.uuid);

View File

@ -224,28 +224,8 @@ export default defineComponent({
loga(a: any) { loga(a: any) {
console.log(a); console.log(a);
}, },
async deleteItem( deleteItem(evt: MouseEvent | null, is_group: boolean, uuid: string) {
evt: MouseEvent | null, const show_tooltip = (success: boolean) => {
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({ $q.notify({
color: success ? "positive" : "negative", color: success ? "positive" : "negative",
icon: success ? "done" : "warning", icon: success ? "done" : "warning",
@ -254,6 +234,60 @@ export default defineComponent({
position: "top", position: "top",
timeout: 1500, timeout: 1500,
}); });
};
if (is_group) {
$q.dialog({
title: $t.t("Confirm"),
message: $t.t(
"delete group should be delete all child! do you want to delete this group?"
),
ok: {
label: $t.t("ok"),
noCaps: true,
flat: true,
},
cancel: {
label: $t.t("cancel"),
noCaps: true,
flat: true,
},
persistent: true,
}).onOk(async () => {
let success = false;
let response = await GlobalData.getInstance()
.getCurrentClient()
?.deletePlanGroup(uuid);
if (response) {
success = response.success;
}
show_tooltip(success);
});
} else {
$q.dialog({
title: $t.t("Confirm"),
message: $t.t("do you want to delete the item") + "?",
ok: {
label: $t.t("ok"),
noCaps: true,
flat: true,
},
cancel: {
label: $t.t("cancel"),
noCaps: true,
flat: true,
},
persistent: true,
}).onOk(async () => {
let success = false;
let response = await GlobalData.getInstance()
.getCurrentClient()
?.deletePlan(uuid);
if (response) {
success = response.success;
}
show_tooltip(success);
});
}
}, },
runPlan(item: PlanEntity) { runPlan(item: PlanEntity) {
if (!$store.state.power_state) { if (!$store.state.power_state) {

View File

@ -177,27 +177,8 @@ export default defineComponent({
loga(a: any) { loga(a: any) {
console.log(a); console.log(a);
}, },
async deleteItem( deleteItem(evt: PointerEvent | null, is_group: boolean, uuid: string) {
evt: PointerEvent | null, const show_tooltip = (success: boolean) => {
is_group: boolean,
uuid: string
) {
let success = false;
if (is_group) {
let response = await GlobalData.getInstance()
.getCurrentClient()
?.deletePollingGroup(uuid);
if (response) {
success = response.success;
}
} else {
let response = await GlobalData.getInstance()
.getCurrentClient()
?.deletePolling(uuid);
if (response) {
success = response.success;
}
}
$q.notify({ $q.notify({
color: success ? "positive" : "negative", color: success ? "positive" : "negative",
icon: success ? "done" : "warning", icon: success ? "done" : "warning",
@ -206,6 +187,62 @@ export default defineComponent({
position: "top", position: "top",
timeout: 1500, timeout: 1500,
}); });
};
if (is_group) {
$q.dialog({
title: $t.t("Confirm"),
message: $t.t(
"delete group should be delete all child! do you want to delete this group?"
),
ok: {
label: $t.t("ok"),
noCaps: true,
flat: true,
},
cancel: {
label: $t.t("cancel"),
noCaps: true,
flat: true,
},
persistent: true,
}).onOk(async () => {
let success = false;
let response = await GlobalData.getInstance()
.getCurrentClient()
?.deletePollingGroup(uuid);
if (response) {
success = response.success;
}
show_tooltip(success);
});
} else {
$q.dialog({
title: $t.t("Confirm"),
message: $t.t("do you want to delete the item") + "?",
ok: {
label: $t.t("ok"),
noCaps: true,
flat: true,
},
cancel: {
label: $t.t("cancel"),
noCaps: true,
flat: true,
},
persistent: true,
}).onOk(async () => {
let success = false;
let response = await GlobalData.getInstance()
.getCurrentClient()
?.deletePolling(uuid);
if (response) {
success = response.success;
}
show_tooltip(success);
});
}
}, },
onDragStart(e: DragEvent, node: PollingTreeItemEntity) { onDragStart(e: DragEvent, node: PollingTreeItemEntity) {
e.dataTransfer?.setData("uuid", node.uuid); e.dataTransfer?.setData("uuid", node.uuid);

View File

@ -318,28 +318,8 @@ export default defineComponent({
getItemIcon(item_type: string) { getItemIcon(item_type: string) {
return Common.getSignalSourceIcon(item_type); return Common.getSignalSourceIcon(item_type);
}, },
async deleteItem( deleteItem(evt: PointerEvent | null, is_group: boolean, uuid: string) {
evt: PointerEvent | null, const show_tooltip = (success: boolean) => {
is_group: boolean,
uuid: string
) {
let success = false;
if (is_group) {
let response = await GlobalData.getInstance()
.getCurrentClient()
?.deleteSignalSourceGroup(uuid);
if (response) {
success = response.success;
}
} else {
let response = await GlobalData.getInstance()
.getCurrentClient()
?.deleteSignalSource(uuid);
if (response) {
success = response.success;
}
}
$q.notify({ $q.notify({
color: success ? "positive" : "negative", color: success ? "positive" : "negative",
icon: success ? "done" : "warning", icon: success ? "done" : "warning",
@ -348,12 +328,64 @@ export default defineComponent({
position: "top", position: "top",
timeout: 1500, timeout: 1500,
}); });
};
if (is_group) {
$q.dialog({
title: $t.t("Confirm"),
message: $t.t(
"delete group should be delete all child! do you want to delete this group?"
),
ok: {
label: $t.t("ok"),
noCaps: true,
flat: true,
}, },
updateContextMenu() { cancel: {
lossy_pic.value = label: $t.t("cancel"),
(GlobalData.getInstance().applicationConfig?.hdmi_in_decode_type_1 ?? noCaps: true,
"NV12") == "NV12"; flat: true,
}, },
persistent: true,
}).onOk(async () => {
let success = false;
let response = await GlobalData.getInstance()
.getCurrentClient()
?.deleteSignalSourceGroup(uuid);
if (response) {
success = response.success;
}
show_tooltip(success);
});
} else {
$q.dialog({
title: $t.t("Confirm"),
message: $t.t("do you want to delete the item") + "?",
ok: {
label: $t.t("ok"),
noCaps: true,
flat: true,
},
cancel: {
label: $t.t("cancel"),
noCaps: true,
flat: true,
},
persistent: true,
}).onOk(async () => {
let success = false;
let response = await GlobalData.getInstance()
.getCurrentClient()
?.deleteSignalSource(uuid);
if (response) {
success = response.success;
}
show_tooltip(success);
});
}
},
updateContextMenu() {},
async setHdmiInDecodeType(index: number, type: string) { async setHdmiInDecodeType(index: number, type: string) {
let success = false; let success = false;

View File

@ -332,4 +332,7 @@ export default {
"send power off command": "Send Power Off Command", "send power off command": "Send Power Off Command",
"set subtitle success": "Set OSD Success", "set subtitle success": "Set OSD Success",
"stop polling": "Stop Signal Loop", "stop polling": "Stop Signal Loop",
"delete group should be delete all child! do you want to delete this group?":
"Delete Group Should Be Delete All Child! Do You Want To Delete This Group?",
"do you want to delete the item": "Do You Want To Delete The Item",
}; };

View File

@ -609,4 +609,7 @@ export default {
real: "实际", real: "实际",
"current real": "当前实际", "current real": "当前实际",
"the port number must be between 0 and 65535": "端口号只能在0~65535之间", "the port number must be between 0 and 65535": "端口号只能在0~65535之间",
"delete group should be delete all child! do you want to delete this group?":
"删除组会删除组里面所有的子项目! 确定要删除该组吗?",
"do you want to delete the item": "确定删除该项目吗",
}; };