mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 15:26:36 +00:00
Add attention required for config flows in progress (#6808)
This commit is contained in:
parent
c73330a466
commit
979b7ae651
@ -13,6 +13,8 @@ export const DISCOVERY_SOURCES = [
|
||||
"discovery",
|
||||
];
|
||||
|
||||
export const ATTENTION_SOURCES = ["reauth"];
|
||||
|
||||
export const createConfigFlow = (hass: HomeAssistant, handler: string) =>
|
||||
hass.callApi<DataEntryFlowStep>("POST", "config/config_entries/flow", {
|
||||
handler,
|
||||
|
@ -10,12 +10,13 @@ import {
|
||||
CSSResult,
|
||||
customElement,
|
||||
html,
|
||||
internalProperty,
|
||||
LitElement,
|
||||
property,
|
||||
internalProperty,
|
||||
PropertyValues,
|
||||
TemplateResult,
|
||||
} from "lit-element";
|
||||
import { classMap } from "lit-html/directives/class-map";
|
||||
import memoizeOne from "memoize-one";
|
||||
import { HASSDomEvent } from "../../../common/dom/fire_event";
|
||||
import "../../../common/search/search-input";
|
||||
@ -32,6 +33,7 @@ import {
|
||||
getConfigEntries,
|
||||
} from "../../../data/config_entries";
|
||||
import {
|
||||
ATTENTION_SOURCES,
|
||||
DISCOVERY_SOURCES,
|
||||
getConfigFlowInProgressCollection,
|
||||
ignoreConfigFlow,
|
||||
@ -355,11 +357,23 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) {
|
||||
: ""}
|
||||
${configEntriesInProgress.length
|
||||
? configEntriesInProgress.map(
|
||||
(flow: DataEntryFlowProgressExtended) => html`
|
||||
<ha-card outlined class="discovered">
|
||||
(flow: DataEntryFlowProgressExtended) => {
|
||||
const attention = ATTENTION_SOURCES.includes(
|
||||
flow.context.source
|
||||
);
|
||||
return html`
|
||||
<ha-card
|
||||
outlined
|
||||
class=${classMap({
|
||||
discovered: !attention,
|
||||
attention: attention,
|
||||
})}
|
||||
>
|
||||
<div class="header">
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.integrations.discovered"
|
||||
`ui.panel.config.integrations.${
|
||||
attention ? "attention" : "discovered"
|
||||
}`
|
||||
)}
|
||||
</div>
|
||||
<div class="card-content">
|
||||
@ -381,7 +395,9 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) {
|
||||
.flowId=${flow.flow_id}
|
||||
>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.integrations.configure"
|
||||
`ui.panel.config.integrations.${
|
||||
attention ? "reconfigure" : "configure"
|
||||
}`
|
||||
)}
|
||||
</mwc-button>
|
||||
${DISCOVERY_SOURCES.includes(flow.context.source) &&
|
||||
@ -400,7 +416,8 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) {
|
||||
</div>
|
||||
</div>
|
||||
</ha-card>
|
||||
`
|
||||
`;
|
||||
}
|
||||
)
|
||||
: ""}
|
||||
${groupedConfigEntries.size
|
||||
@ -639,6 +656,18 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) {
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.attention {
|
||||
--ha-card-border-color: var(--error-color);
|
||||
}
|
||||
.attention .header {
|
||||
background: var(--error-color);
|
||||
color: var(--text-primary-color);
|
||||
padding: 8px;
|
||||
text-align: center;
|
||||
}
|
||||
.attention mwc-button {
|
||||
--mdc-theme-primary: var(--error-color);
|
||||
}
|
||||
.discovered {
|
||||
--ha-card-border-color: var(--primary-color);
|
||||
}
|
||||
|
@ -1610,6 +1610,7 @@
|
||||
"description": "Manage integrations",
|
||||
"integration": "integration",
|
||||
"discovered": "Discovered",
|
||||
"attention": "Attention required",
|
||||
"configured": "Configured",
|
||||
"new": "Set up a new integration",
|
||||
"add_integration": "Add integration",
|
||||
@ -1618,6 +1619,7 @@
|
||||
"note_about_website_reference": "More are available on the ",
|
||||
"home_assistant_website": "Home Assistant website",
|
||||
"configure": "Configure",
|
||||
"reconfigure": "Reconfigure",
|
||||
"none": "Nothing configured yet",
|
||||
"none_found": "No integrations found",
|
||||
"none_found_detail": "Adjust your search criteria.",
|
||||
|
Loading…
x
Reference in New Issue
Block a user