-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration name information to repairs (#22006)
* Add integration name to repairs * Improve dialog-repairs-issue aria and translations * Fix type in dialog-repairs-issue * Remove unused slots in dialog-repairs-issue * Fix ha-config-repairs avoid nested css * Fix ha-config-repairs to use ha-md-list * Add subtitle slot to ha-dialog-header * Move close icon to left in dialog-data-entry-flow * Move severity and reportedBy to dialog subtitle in repair-dialog * Add md buttons to dialog-repairs-issue * Revert dialog-repairs-issue to use normal ha-buttons * Revert dialog-entry-flow close icon position * Improve buttons for dialog-repairs-issue * Add subtitle to all show-dialog-repair-flow headers * Fix integration names for repair dialogs * Fix subtitle title repair dialogs --------- Co-authored-by: Bram Kragten <[email protected]>
- Loading branch information
1 parent
cd631e8
commit 254ee85
Showing
8 changed files
with
263 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
src/panels/config/repairs/dialog-repairs-issue-subtitle.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { css, html, LitElement } from "lit"; | ||
import { customElement, property } from "lit/decorators"; | ||
import type { HomeAssistant } from "../../../types"; | ||
import { domainToName } from "../../../data/integration"; | ||
import type { RepairsIssue } from "../../../data/repairs"; | ||
|
||
@customElement("dialog-repairs-issue-subtitle") | ||
class DialogRepairsIssueSubtitle extends LitElement { | ||
@property({ attribute: false }) public hass!: HomeAssistant; | ||
|
||
@property({ type: Object }) public issue!: RepairsIssue; | ||
|
||
protected firstUpdated() { | ||
if (this.scrollWidth > this.offsetWidth) { | ||
this.title = | ||
(this.shadowRoot?.firstElementChild as HTMLElement)?.innerText || ""; | ||
} | ||
} | ||
|
||
protected render() { | ||
const domainName = domainToName(this.hass.localize, this.issue.domain); | ||
const reportedBy = domainName | ||
? this.hass.localize("ui.panel.config.repairs.reported_by", { | ||
integration: domainName, | ||
}) | ||
: ""; | ||
|
||
const severity = this.hass.localize( | ||
`ui.panel.config.repairs.${this.issue.severity}` | ||
); | ||
|
||
return html` | ||
<span> | ||
<span class=${this.issue.severity}> ${severity} </span> | ||
${reportedBy} | ||
</span> | ||
`; | ||
} | ||
|
||
static styles = css` | ||
:host { | ||
display: block; | ||
font-size: 14px; | ||
margin-bottom: 8px; | ||
color: var(--secondary-text-color); | ||
text-overflow: ellipsis; | ||
overflow: hidden; | ||
} | ||
.error, | ||
.critical { | ||
color: var(--error-color); | ||
} | ||
.warning { | ||
color: var(--warning-color); | ||
} | ||
`; | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
"dialog-repairs-issue-subtitle": DialogRepairsIssueSubtitle; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.