fix: retain Symcon webhook registration and show configured view title

This commit is contained in:
jhartworks committed 2026-11-10 12:39:30 +01:00
1 parent 8845efdc23
commit 510aece983
14 files changed
+145 -44

No files matched your search

@@ -3370,10 +3370,17 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
white-space: nowrap;
}
.nf-mark {
flex: none;
width: 26px;
height: 28px;
color: var(--nf-accent);
}
.nf-view-title {
min-width: 0;
max-width: min(340px, 45vw);
overflow: hidden;
text-overflow: ellipsis;
}
.nf-notices {
display: grid;
gap: 6px;
@@ -3858,15 +3865,15 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
<button aria-pressed=${e.readable} title=${this.t("readable_hint")} @click=${()=>this.setPref("readable",!e.readable)}>Aa ${this.t("readable")}</button>
<button aria-pressed=${e.stats} title=${this.t("fps_title")} @click=${()=>this.setPref("stats",!e.stats)}>${this.t("fps")}</button>
</div>
</div>`}async reloadVariables(){if(!(this._variablesLoading||!this.hass.symconRefresh)){this._variablesLoading=!0,this._variablesNotice="",this._variablesError=!1;try{await this.hass.symconRefresh(),this._variablesNotice=this.t("symcon_variables_loaded")}catch(e){this._variablesError=!0,this._variablesNotice=this.t("symcon_variables_error",{error:e instanceof Error?e.message:String(e)})}finally{this._variablesLoading=!1}}}renderHeader(e){let t=this.data.saveState,n=(i,s,a="")=>p`<button role="tab" class=${a} aria-pressed=${this._mode===i} @click=${()=>this.setMode(i)}>${s}</button>`,o=t==="saving"?"saving":t==="saved"?"saved":"save_error";return p`<header class="nf-header">
</div>`}async reloadVariables(){if(!(this._variablesLoading||!this.hass.symconRefresh)){this._variablesLoading=!0,this._variablesNotice="",this._variablesError=!1;try{await this.hass.symconRefresh(),this._variablesNotice=this.t("symcon_variables_loaded")}catch(e){this._variablesError=!0,this._variablesNotice=this.t("symcon_variables_error",{error:e instanceof Error?e.message:String(e)})}finally{this._variablesLoading=!1}}}renderHeader(e){let t=this.hass?.symconTitle?.trim()||"NextFloor",n=this.data.saveState,o=(s,a,l="")=>p`<button role="tab" class=${l} aria-pressed=${this._mode===s} @click=${()=>this.setMode(s)}>${a}</button>`,i=n==="saving"?"saving":n==="saved"?"saved":"save_error";return p`<header class="nf-header">
<ha-menu-button .hass=${this.hass} .narrow=${this.narrow}></ha-menu-button>
<h1>${qc}NextFloor</h1>
${this.isAdmin?p`<div class="nf-seg" role="tablist">${n("view",this.t("view"))}${n("editor",this.t("editor"))}${n("extensions",`\u2726 ${this.t("ext_tab")}`,"nf-tab-ext")}</div>`:f}
<h1 title=${t}>${qc}<span class="nf-view-title">${t}</span></h1>
${this.isAdmin?p`<div class="nf-seg" role="tablist">${o("view",this.t("view"))}${o("editor",this.t("editor"))}${o("extensions",`\u2726 ${this.t("ext_tab")}`,"nf-tab-ext")}</div>`:f}
<span class="nf-grow"></span>
${this._mode==="view"&&e?.floors.some(i=>i.rooms.length)?p`<button class="nf-chip nf-room-names-toggle" aria-pressed=${this._prefs.roomNames} title=${this.t("room_names_toggle_hint")} @click=${()=>this.setPref("roomNames",!this._prefs.roomNames)}>${this.t("room_names_short")}</button>`:f}
${this._mode==="view"&&e?.floors.some(s=>s.rooms.length)?p`<button class="nf-chip nf-room-names-toggle" aria-pressed=${this._prefs.roomNames} title=${this.t("room_names_toggle_hint")} @click=${()=>this.setPref("roomNames",!this._prefs.roomNames)}>${this.t("room_names_short")}</button>`:f}
${this.isAdmin&&this.hass.symconRefresh?p`<button class="nf-btn nf-reload-variables" ?disabled=${this._variablesLoading} aria-busy=${this._variablesLoading} @click=${()=>{this.reloadVariables()}}>↻ ${this.t(this._variablesLoading?"symcon_variables_loading":"symcon_variables_reload")}</button>`:f}
${this._mode==="view"&&e?.floors.some(i=>i.rooms.length)?this.renderViewOptions():f}
${this._mode==="editor"&&t!=="idle"?p`<span class="nf-save nf-save-${t}">${this.t(o)}</span>`:f}
${this._mode==="view"&&e?.floors.some(s=>s.rooms.length)?this.renderViewOptions():f}
${this._mode==="editor"&&n!=="idle"?p`<span class="nf-save nf-save-${n}">${this.t(i)}</span>`:f}
<span class="nf-version" title=${this.t("version_hint",{backend:this.data.backendVersion??"?"})}>v${this.data.frontendVersion}</span>
</header>`}renderNotices(){let e=this.data,t=[];if(this._variablesNotice&&t.push(p`<div class="nf-notice ${this._variablesError?"nf-notice-error":""}" role=${this._variablesError?"alert":"status"}>${this._variablesNotice}</div>`),e.needsRestart&&t.push(e.versionGap==="frontend"?p`<div class="nf-notice nf-notice-warn">
${this.t("needs_reload",{frontend:e.frontendVersion,backend:e.backendVersion??"?"})}