mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-26 02:36:37 +00:00
Improve display of disabled config entries (#16784)
This commit is contained in:
parent
b8efc06caa
commit
47fdae764f
@ -519,21 +519,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
|
|||||||
let stateTextExtra: TemplateResult | string | undefined;
|
let stateTextExtra: TemplateResult | string | undefined;
|
||||||
let icon: string = mdiAlertCircle;
|
let icon: string = mdiAlertCircle;
|
||||||
|
|
||||||
if (item.disabled_by) {
|
if (!item.disabled_by && item.state === "not_loaded") {
|
||||||
stateText = [
|
|
||||||
"ui.panel.config.integrations.config_entry.disable.disabled_cause",
|
|
||||||
"cause",
|
|
||||||
this.hass.localize(
|
|
||||||
`ui.panel.config.integrations.config_entry.disable.disabled_by.${item.disabled_by}`
|
|
||||||
) || item.disabled_by,
|
|
||||||
];
|
|
||||||
if (item.state === "failed_unload") {
|
|
||||||
stateTextExtra = html`.
|
|
||||||
${this.hass.localize(
|
|
||||||
"ui.panel.config.integrations.config_entry.disable_restart_confirm"
|
|
||||||
)}.`;
|
|
||||||
}
|
|
||||||
} else if (item.state === "not_loaded") {
|
|
||||||
stateText = ["ui.panel.config.integrations.config_entry.not_loaded"];
|
stateText = ["ui.panel.config.integrations.config_entry.not_loaded"];
|
||||||
} else if (item.state === "setup_in_progress") {
|
} else if (item.state === "setup_in_progress") {
|
||||||
icon = mdiProgressHelper;
|
icon = mdiProgressHelper;
|
||||||
@ -569,6 +555,25 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
|
|||||||
|
|
||||||
let devicesLine: (TemplateResult | string)[] = [];
|
let devicesLine: (TemplateResult | string)[] = [];
|
||||||
|
|
||||||
|
if (item.disabled_by) {
|
||||||
|
devicesLine.push(
|
||||||
|
this.hass.localize(
|
||||||
|
"ui.panel.config.integrations.config_entry.disable.disabled_cause",
|
||||||
|
{
|
||||||
|
cause:
|
||||||
|
this.hass.localize(
|
||||||
|
`ui.panel.config.integrations.config_entry.disable.disabled_by.${item.disabled_by}`
|
||||||
|
) || item.disabled_by,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
if (item.state === "failed_unload") {
|
||||||
|
devicesLine.push(`.
|
||||||
|
${this.hass.localize(
|
||||||
|
"ui.panel.config.integrations.config_entry.disable_restart_confirm"
|
||||||
|
)}.`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
for (const [items, localizeKey] of [
|
for (const [items, localizeKey] of [
|
||||||
[devices, "devices"],
|
[devices, "devices"],
|
||||||
[services, "services"],
|
[services, "services"],
|
||||||
@ -623,6 +628,8 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
|
|||||||
devicesLine[2],
|
devicesLine[2],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return html`<ha-list-item
|
return html`<ha-list-item
|
||||||
hasMeta
|
hasMeta
|
||||||
class="config_entry ${classMap({
|
class="config_entry ${classMap({
|
||||||
@ -632,6 +639,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
|
|||||||
"state-error": ERROR_STATES.includes(item!.state),
|
"state-error": ERROR_STATES.includes(item!.state),
|
||||||
})}"
|
})}"
|
||||||
data-entry-id=${item.entry_id}
|
data-entry-id=${item.entry_id}
|
||||||
|
.disabled=${item.disabled_by}
|
||||||
.configEntry=${item}
|
.configEntry=${item}
|
||||||
twoline
|
twoline
|
||||||
noninteractive
|
noninteractive
|
||||||
@ -692,6 +700,61 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
|
|||||||
)}
|
)}
|
||||||
</ha-list-item>`
|
</ha-list-item>`
|
||||||
: ""}
|
: ""}
|
||||||
|
${item.disabled_by && devices.length
|
||||||
|
? html`<a
|
||||||
|
href=${devices.length === 1
|
||||||
|
? `/config/devices/device/${devices[0].id}`
|
||||||
|
: `/config/devices/dashboard?historyBack=1&config_entry=${item.entry_id}`}
|
||||||
|
>
|
||||||
|
<ha-list-item hasMeta graphic="icon">
|
||||||
|
<ha-svg-icon .path=${mdiDevices} slot="graphic"></ha-svg-icon>
|
||||||
|
${this.hass.localize(
|
||||||
|
`ui.panel.config.integrations.config_entry.devices`,
|
||||||
|
"count",
|
||||||
|
devices.length
|
||||||
|
)}
|
||||||
|
<ha-icon-next slot="meta"></ha-icon-next>
|
||||||
|
</ha-list-item>
|
||||||
|
</a>`
|
||||||
|
: ""}
|
||||||
|
${item.disabled_by && services.length
|
||||||
|
? html`<a
|
||||||
|
href=${services.length === 1
|
||||||
|
? `/config/devices/device/${services[0].id}`
|
||||||
|
: `/config/devices/dashboard?historyBack=1&config_entry=${item.entry_id}`}
|
||||||
|
>
|
||||||
|
<ha-list-item hasMeta graphic="icon">
|
||||||
|
<ha-svg-icon
|
||||||
|
.path=${mdiHandExtendedOutline}
|
||||||
|
slot="graphic"
|
||||||
|
></ha-svg-icon>
|
||||||
|
${this.hass.localize(
|
||||||
|
`ui.panel.config.integrations.config_entry.services`,
|
||||||
|
"count",
|
||||||
|
services.length
|
||||||
|
)}
|
||||||
|
<ha-icon-next slot="meta"></ha-icon-next>
|
||||||
|
</ha-list-item>
|
||||||
|
</a>`
|
||||||
|
: ""}
|
||||||
|
${item.disabled_by && entities.length
|
||||||
|
? html`<a
|
||||||
|
href=${`/config/entities?historyBack=1&config_entry=${item.entry_id}`}
|
||||||
|
>
|
||||||
|
<ha-list-item hasMeta graphic="icon">
|
||||||
|
<ha-svg-icon
|
||||||
|
.path=${mdiShapeOutline}
|
||||||
|
slot="graphic"
|
||||||
|
></ha-svg-icon>
|
||||||
|
${this.hass.localize(
|
||||||
|
`ui.panel.config.integrations.config_entry.entities`,
|
||||||
|
"count",
|
||||||
|
entities.length
|
||||||
|
)}
|
||||||
|
<ha-icon-next slot="meta"></ha-icon-next>
|
||||||
|
</ha-list-item>
|
||||||
|
</a>`
|
||||||
|
: ""}
|
||||||
${!item.disabled_by &&
|
${!item.disabled_by &&
|
||||||
RECOVERABLE_STATES.includes(item.state) &&
|
RECOVERABLE_STATES.includes(item.state) &&
|
||||||
item.supports_unload &&
|
item.supports_unload &&
|
||||||
@ -1282,6 +1345,9 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
|
|||||||
--mdc-list-item-meta-size: auto;
|
--mdc-list-item-meta-size: auto;
|
||||||
--mdc-list-item-meta-display: flex;
|
--mdc-list-item-meta-display: flex;
|
||||||
}
|
}
|
||||||
|
ha-button-menu ha-list-item {
|
||||||
|
--mdc-list-item-meta-size: 24px;
|
||||||
|
}
|
||||||
ha-list-item.config_entry::after {
|
ha-list-item.config_entry::after {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
@ -1305,7 +1371,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
|
|||||||
primary-color: var(--error-color);
|
primary-color: var(--error-color);
|
||||||
}
|
}
|
||||||
.warning {
|
.warning {
|
||||||
color: var(--warning-color);
|
color: var(--error-color);
|
||||||
}
|
}
|
||||||
.state-error {
|
.state-error {
|
||||||
--state-message-color: var(--error-color);
|
--state-message-color: var(--error-color);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user