Only show url path field in advanced mode (#5233)

This commit is contained in:
Bram Kragten 2020-03-16 20:32:13 +01:00 committed by GitHub
parent 4e19232960
commit a88321d243
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -99,7 +99,9 @@ export class DialogLovelaceDashboardDetail extends LitElement {
.label=${this.hass.localize( .label=${this.hass.localize(
"ui.panel.config.lovelace.dashboards.detail.title" "ui.panel.config.lovelace.dashboards.detail.title"
)} )}
@blur=${this._fillUrlPath} @blur=${this.hass.userData?.showAdvanced
? this._fillUrlPath
: undefined}
.invalid=${titleInvalid} .invalid=${titleInvalid}
.errorMessage=${this.hass.localize( .errorMessage=${this.hass.localize(
"ui.panel.config.lovelace.dashboards.detail.title_required" "ui.panel.config.lovelace.dashboards.detail.title_required"
@ -113,7 +115,7 @@ export class DialogLovelaceDashboardDetail extends LitElement {
"ui.panel.config.lovelace.dashboards.detail.icon" "ui.panel.config.lovelace.dashboards.detail.icon"
)} )}
></ha-icon-input> ></ha-icon-input>
${!this._params.dashboard ${!this._params.dashboard && this.hass.userData?.showAdvanced
? html` ? html`
<paper-input <paper-input
.value=${this._urlPath} .value=${this._urlPath}
@ -212,10 +214,13 @@ export class DialogLovelaceDashboardDetail extends LitElement {
private _titleChanged(ev: PolymerChangedEvent<string>) { private _titleChanged(ev: PolymerChangedEvent<string>) {
this._error = undefined; this._error = undefined;
this._title = ev.detail.value; this._title = ev.detail.value;
if (!this.hass.userData?.showAdvanced) {
this._fillUrlPath();
}
} }
private _fillUrlPath() { private _fillUrlPath() {
if (this._urlPath || !this._title) { if ((this.hass.userData?.showAdvanced && this._urlPath) || !this._title) {
return; return;
} }
const parts = this._title.toLowerCase().split(" "); const parts = this._title.toLowerCase().split(" ");