mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Add support for re-auth flows in repairs (#19587)
This commit is contained in:
parent
f4859320eb
commit
ed888200f9
@ -32,6 +32,13 @@ export const fetchRepairsIssues = (conn: Connection) =>
|
||||
type: "repairs/list_issues",
|
||||
});
|
||||
|
||||
export const fetchRepairsIssueData = (conn: Connection, domain, issue_id) =>
|
||||
conn.sendMessagePromise<{ issue_data: { string: any } }>({
|
||||
type: "repairs/get_issue_data",
|
||||
domain,
|
||||
issue_id,
|
||||
});
|
||||
|
||||
export const ignoreRepairsIssue = async (
|
||||
hass: HomeAssistant,
|
||||
issue: RepairsIssue,
|
||||
|
@ -8,11 +8,15 @@ import "../../../components/ha-card";
|
||||
import "../../../components/ha-list-item";
|
||||
import "../../../components/ha-svg-icon";
|
||||
import { domainToName } from "../../../data/integration";
|
||||
import type { RepairsIssue } from "../../../data/repairs";
|
||||
import {
|
||||
fetchRepairsIssueData,
|
||||
type RepairsIssue,
|
||||
} from "../../../data/repairs";
|
||||
import type { HomeAssistant } from "../../../types";
|
||||
import { brandsUrl } from "../../../util/brands-url";
|
||||
import { showRepairsFlowDialog } from "./show-dialog-repair-flow";
|
||||
import { showRepairsIssueDialog } from "./show-repair-issue-dialog";
|
||||
import { showConfigFlowDialog } from "../../../dialogs/config-flow/show-dialog-config-flow";
|
||||
|
||||
@customElement("ha-config-repairs")
|
||||
class HaConfigRepairs extends LitElement {
|
||||
@ -107,10 +111,24 @@ class HaConfigRepairs extends LitElement {
|
||||
`;
|
||||
}
|
||||
|
||||
private _openShowMoreDialog(ev): void {
|
||||
private async _openShowMoreDialog(ev): Promise<void> {
|
||||
const issue = ev.currentTarget.issue as RepairsIssue;
|
||||
if (issue.is_fixable) {
|
||||
showRepairsFlowDialog(this, issue);
|
||||
} else if (
|
||||
issue.domain === "homeassistant" &&
|
||||
issue.translation_key === "config_entry_reauth"
|
||||
) {
|
||||
const data = await fetchRepairsIssueData(
|
||||
this.hass.connection,
|
||||
issue.domain,
|
||||
issue.issue_id
|
||||
);
|
||||
if ("flow_id" in data.issue_data) {
|
||||
showConfigFlowDialog(this, {
|
||||
continueFlowId: data.issue_data.flow_id as string,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
showRepairsIssueDialog(this, {
|
||||
issue,
|
||||
|
Loading…
x
Reference in New Issue
Block a user