Skip to content

Commit

Permalink
Show disabled reason (#378)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus authored Feb 7, 2021
1 parent 162cce0 commit ae0aae1
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 6 deletions.
6 changes: 2 additions & 4 deletions src/components/hacs-section-navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ class HacsSectionNavigation extends LitElement {
class="${page.class || ""}"
></ha-svg-icon>
<paper-item-body two-line>
${page.name}
<div secondary>
${page.info ? page.info : ""}
</div>
${page.name} ${page.secondary ? ` (${page.secondary})` : ""}
<div secondary>${page.info ? page.info : ""}</div>
</paper-item-body>
${!this.noNext ? html`<ha-icon-next></ha-icon-next>` : ""}
</paper-icon-item>
Expand Down
3 changes: 3 additions & 0 deletions src/data/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { PageNavigation } from "../../homeassistant-frontend/src/layouts/hass-ta
export interface HacsPageNavigation extends PageNavigation {
class?: string;
categories?: string[];
secondary?: string;
dialog?: string;
integration?: string;
repository?: Repository;
Expand Down Expand Up @@ -36,6 +37,7 @@ export interface Configuration {
export interface Status {
background_task: boolean;
disabled: boolean;
disabled_reason?: string;
lovelace_mode: "storage" | "yaml" | "auto-gen";
stage?: "startup" | "waiting" | "running" | "setup";
reloading_data: boolean;
Expand All @@ -60,6 +62,7 @@ export interface LovelaceResourcesMutableParams {
export interface Message {
name: string;
info: string;
secondary?: string;
severity: "information" | "warning" | "error" | "critical";
path?: string;
dialog?: string;
Expand Down
25 changes: 24 additions & 1 deletion src/localize/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,30 @@
},
"disabled": {
"title": "HACS is disabled",
"content": "Check your log file for more details"
"rate_limit": {
"title": "Ratelimited",
"description": "GitHub API calls are ratelimited, this will clear in less than 1 hour."
},
"removed": {
"title": "Removed",
"description": "HACS is removed, restart Home Assistant."
},
"invalid_token": {
"title": "Invalid token",
"description": "Reconfigure HACS and restart Home Assistant."
},
"constrains": {
"title": "Constraints",
"description": "Your environment is not compatible to run HACS, check your logfile for more details."
},
"load_hacs": {
"title": "HACS could not load",
"description": "Check your log file for more details"
},
"restore": {
"title": "Restore of HACS failed",
"description": "Check your log file for more details"
}
},
"wrong_frontend_loaded": {
"title": "Unexpected frontend version",
Expand Down
1 change: 1 addition & 0 deletions src/panels/hacs-entry-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export class HacsEntryPanel extends LitElement {
iconPath: mdiAlertCircle,
name: message.name,
info: message.info,
secondary: message.secondary,
path: message.path || "",
class: message.severity,
dialog: message.dialog,
Expand Down
3 changes: 2 additions & 1 deletion src/tools/get-messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ export const getMessages = memoizeOne((hacs: Hacs, repositories: Repository[]) =
if (hacs.status?.disabled) {
messages.push({
name: hacs.localize("entry.messages.disabled.title"),
info: hacs.localize("entry.messages.disabled.content"),
secondary: hacs.localize(`entry.messages.disabled.${hacs.status?.disabled_reason}.title`),
info: hacs.localize(`entry.messages.disabled.${hacs.status?.disabled_reason}.description`),
severity: "error",
});
}
Expand Down

0 comments on commit ae0aae1

Please sign in to comment.