mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 11:46:42 +00:00
Fix sidebar when user is slow to load (#2993)
This commit is contained in:
parent
ef18f9eac9
commit
20ee3452dc
@ -26,19 +26,13 @@ const computePanels = (hass: HomeAssistant) => {
|
||||
if (!panels) {
|
||||
return [];
|
||||
}
|
||||
const isAdmin = hass.user.is_admin;
|
||||
|
||||
const sortValue = {
|
||||
map: 1,
|
||||
logbook: 2,
|
||||
history: 3,
|
||||
};
|
||||
const result: Panel[] = [];
|
||||
|
||||
Object.values(panels).forEach((panel) => {
|
||||
if (panel.title && (panel.component_name !== "config" || isAdmin)) {
|
||||
result.push(panel);
|
||||
}
|
||||
});
|
||||
const result: Panel[] = Object.values(panels).filter((panel) => panel.title);
|
||||
|
||||
result.sort((a, b) => {
|
||||
const aBuiltIn = a.component_name in sortValue;
|
||||
@ -133,9 +127,8 @@ class HaSidebar extends LitElement {
|
||||
: html``}
|
||||
</paper-listbox>
|
||||
|
||||
${!hass.user.is_admin
|
||||
? ""
|
||||
: html`
|
||||
${hass.user && hass.user.is_admin
|
||||
? html`
|
||||
<div>
|
||||
<div class="divider"></div>
|
||||
|
||||
@ -192,7 +185,8 @@ class HaSidebar extends LitElement {
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
`}
|
||||
`
|
||||
: ""}
|
||||
`;
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ export interface HomeAssistant {
|
||||
|
||||
dockedSidebar: boolean;
|
||||
moreInfoEntityId: string;
|
||||
user: CurrentUser;
|
||||
user?: CurrentUser;
|
||||
callService: (
|
||||
domain: string,
|
||||
service: string,
|
||||
|
Loading…
x
Reference in New Issue
Block a user