Remove back path from UI (#13936)

Remove back path from UI as it can be edited with yaml editor
This commit is contained in:
Paul Bottein 2022-09-30 22:23:55 +02:00 committed by GitHub
parent 650d579d05
commit f768c5ef7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 27 deletions

View File

@ -33,7 +33,7 @@ export class HuiViewEditor extends LitElement {
private _suggestedPath = false; private _suggestedPath = false;
private _schema = memoizeOne( private _schema = memoizeOne(
(localize: LocalizeFunc, subview: boolean, showAdvanced: boolean) => (localize: LocalizeFunc) =>
[ [
{ name: "title", selector: { text: {} } }, { name: "title", selector: { text: {} } },
{ {
@ -69,14 +69,6 @@ export class HuiViewEditor extends LitElement {
boolean: {}, boolean: {},
}, },
}, },
...(subview && showAdvanced
? [
{
name: "back_path",
selector: { navigation: {} },
},
]
: []),
] as const ] as const
); );
@ -98,11 +90,7 @@ export class HuiViewEditor extends LitElement {
return html``; return html``;
} }
const schema = this._schema( const schema = this._schema(this.hass.localize);
this.hass.localize,
this._config.subview ?? false,
this.hass.userData?.showAdvanced ?? false
);
const data = { const data = {
theme: "Backend-selected", theme: "Backend-selected",
@ -128,9 +116,6 @@ export class HuiViewEditor extends LitElement {
if (config.type === "masonry") { if (config.type === "masonry") {
delete config.type; delete config.type;
} }
if (!config.subview) {
delete config.back_path;
}
if ( if (
this.isNew && this.isNew &&
@ -155,10 +140,6 @@ export class HuiViewEditor extends LitElement {
return this.hass.localize("ui.panel.lovelace.editor.edit_view.type"); return this.hass.localize("ui.panel.lovelace.editor.edit_view.type");
case "subview": case "subview":
return this.hass.localize("ui.panel.lovelace.editor.edit_view.subview"); return this.hass.localize("ui.panel.lovelace.editor.edit_view.subview");
case "back_path":
return this.hass.localize(
"ui.panel.lovelace.editor.edit_view.back_path"
);
default: default:
return this.hass!.localize( return this.hass!.localize(
`ui.panel.lovelace.editor.card.generic.${schema.name}` `ui.panel.lovelace.editor.card.generic.${schema.name}`
@ -174,10 +155,6 @@ export class HuiViewEditor extends LitElement {
return this.hass.localize( return this.hass.localize(
"ui.panel.lovelace.editor.edit_view.subview_helper" "ui.panel.lovelace.editor.edit_view.subview_helper"
); );
case "back_path":
return this.hass.localize(
"ui.panel.lovelace.editor.edit_view.back_path_helper"
);
default: default:
return undefined; return undefined;
} }

View File

@ -3805,8 +3805,6 @@
}, },
"subview": "Subview", "subview": "Subview",
"subview_helper": "Subviews don't appear in tabs and have a back button.", "subview_helper": "Subviews don't appear in tabs and have a back button.",
"back_path": "Back path (optional)",
"back_path_helper": "Only for subviews. If empty, clicking on back button will go to the previous page.",
"edit_ui": "Edit in visual editor", "edit_ui": "Edit in visual editor",
"edit_yaml": "Edit in YAML" "edit_yaml": "Edit in YAML"
}, },