This commit is contained in:
Home Assistant Version Control
2026-08-25 14:19:39 +00:00
parent 45bd102a6a
commit e8c2498cf8
17 changed files with 194 additions and 22 deletions
@@ -698,6 +698,8 @@ class TaskMatePanel extends HTMLElement {
if (act === "notif-set-streak-cutoff"){ /* handled in _onChange */ return; }
if (act === "notif-set-nav-url-global"){ /* handled in _onChange */ return; }
if (act === "notif-set-nav-url-type") { /* handled in _onChange */ return; }
if (act === "notif-set-group-global") { /* handled in _onChange */ return; }
if (act === "notif-set-group-type") { /* handled in _onChange */ return; }
if (act === "notif-add-parent") { this._notifAddParent(); return; }
if (act === "notif-delete-parent") { this._notifDeleteParent(t.dataset.parentId); return; }
if (act === "notif-add-custom") { this._notifAddCustom(); return; }
@@ -945,6 +947,14 @@ class TaskMatePanel extends HTMLElement {
this._notifSetNavUrl(t.dataset.typeId, t.value);
return;
}
if (t.dataset.act === "notif-set-group-global") {
this._notifSetGroup(null, t.value);
return;
}
if (t.dataset.act === "notif-set-group-type") {
this._notifSetGroup(t.dataset.typeId, t.value);
return;
}
if (t.dataset.act === "notif-set-escalation") {
this._notifSetEscalation(t.dataset.escField, t.value);
return;
@@ -2236,7 +2246,16 @@ class TaskMatePanel extends HTMLElement {
async _notifSetNavUrl(typeId, navUrl) {
const payload = { type: "taskmate/notifications/set_nav_url", nav_url: navUrl || "" };
if (typeId) payload.type_id = typeId;
await this._callWS(payload);
const { ok, err } = await this._callWS(payload);
if (!ok) this._showToast("err", this._t("panel.toast_save_failed", { error: err }));
await this._fetchState();
}
async _notifSetGroup(typeId, group) {
const payload = { type: "taskmate/notifications/set_group", group: group || "" };
if (typeId) payload.type_id = typeId;
const { ok, err } = await this._callWS(payload);
if (!ok) this._showToast("err", this._t("panel.toast_save_failed", { error: err }));
await this._fetchState();
}
@@ -4762,6 +4781,13 @@ class TaskMatePanel extends HTMLElement {
data-act="notif-set-nav-url-global" placeholder="/taskmate-admin">
<div class="tm-meta" style="flex-basis:100%">${this._t("panel.notif_nav_url_global_hint")}</div>
</div>
<div class="tm-meta" style="margin:4px 0 12px;display:flex;flex-wrap:wrap;align-items:center;gap:8px">
<label style="font-weight:500">${this._t("panel.notif_group_global_label")}</label>
<input type="text" class="tm-input" style="flex:1;min-width:180px" maxlength="64"
value="${this._esc((ns.settings && ns.settings.notification_group) || "")}"
data-act="notif-set-group-global" placeholder="taskmate">
<div class="tm-meta" style="flex-basis:100%">${this._t("panel.notif_group_global_hint")}</div>
</div>
<div class="tm-table-wrap">
<table class="tm-table">
<thead>
@@ -4818,7 +4844,12 @@ class TaskMatePanel extends HTMLElement {
<input type="text" class="tm-notif-time-input" style="width:150px"
value="${this._esc(c.nav_url || "")}"
data-act="notif-set-nav-url-type" data-type-id="${this._esc(t.id)}"
placeholder="${this._t("panel.notif_nav_url_row_placeholder")}">
placeholder="${this._esc(this._t("panel.notif_nav_url_row_placeholder"))}">
<input type="text" class="tm-notif-time-input" style="width:150px" maxlength="64"
value="${this._esc(c.group || "")}"
data-act="notif-set-group-type" data-type-id="${this._esc(t.id)}"
title="${this._esc(this._t("panel.notif_group_global_label"))}"
placeholder="${this._esc(this._t("panel.notif_group_row_placeholder"))}">
</div>
</div>
</div>