mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 03:36:44 +00:00
Add allow changing type of empty views (#19912)
This commit is contained in:
parent
9ef07484dd
commit
8f67ddf968
@ -95,12 +95,16 @@ export class HuiViewEditor extends LitElement {
|
|||||||
: this._config.type || DEFAULT_VIEW_LAYOUT;
|
: this._config.type || DEFAULT_VIEW_LAYOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private get _isEmpty(): boolean {
|
||||||
|
return !this._config.sections?.length && !this._config.cards?.length;
|
||||||
|
}
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
if (!this.hass) {
|
if (!this.hass) {
|
||||||
return nothing;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
const schema = this._schema(this.hass.localize, this._type, this.isNew);
|
const schema = this._schema(this.hass.localize, this._type, this._isEmpty);
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
...this._config,
|
...this._config,
|
||||||
@ -165,7 +169,7 @@ export class HuiViewEditor extends LitElement {
|
|||||||
"ui.panel.lovelace.editor.edit_view.subview_helper"
|
"ui.panel.lovelace.editor.edit_view.subview_helper"
|
||||||
);
|
);
|
||||||
case "type":
|
case "type":
|
||||||
if (this.isNew) return undefined;
|
if (this._isEmpty) return undefined;
|
||||||
return this._type === "sections"
|
return this._type === "sections"
|
||||||
? this.hass.localize(
|
? this.hass.localize(
|
||||||
"ui.panel.lovelace.editor.edit_view.type_helper_others"
|
"ui.panel.lovelace.editor.edit_view.type_helper_others"
|
||||||
|
@ -5112,7 +5112,7 @@
|
|||||||
"select_users": "Select which users should see this view in the navigation"
|
"select_users": "Select which users should see this view in the navigation"
|
||||||
},
|
},
|
||||||
"type": "View type",
|
"type": "View type",
|
||||||
"type_helper_sections": "You can not change your view to use the 'sections' view type, because migration is not supported yet. Start from scratch with a new view if you want to experiment with the 'sections' view.",
|
"type_helper_sections": "You can not change your view to use the 'sections' view type because migration is not supported yet. Start from scratch with a new view if you want to experiment with the 'sections' view.",
|
||||||
"type_helper_others": "You can not change your view to an other type because migration is not supported yet. Start from scratch with a new view if you want to use another view type.",
|
"type_helper_others": "You can not change your view to an other type because migration is not supported yet. Start from scratch with a new view if you want to use another view type.",
|
||||||
|
|
||||||
"types": {
|
"types": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user