mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 11:16:35 +00:00
Filter out unavailable calendars in calendar panel (#14584)
This commit is contained in:
parent
076a6c4459
commit
b06db26540
@ -2,6 +2,7 @@ import { getColorByIndex } from "../common/color/colors";
|
|||||||
import { computeDomain } from "../common/entity/compute_domain";
|
import { computeDomain } from "../common/entity/compute_domain";
|
||||||
import { computeStateName } from "../common/entity/compute_state_name";
|
import { computeStateName } from "../common/entity/compute_state_name";
|
||||||
import type { HomeAssistant } from "../types";
|
import type { HomeAssistant } from "../types";
|
||||||
|
import { UNAVAILABLE_STATES } from "./entity";
|
||||||
|
|
||||||
export interface Calendar {
|
export interface Calendar {
|
||||||
entity_id: string;
|
entity_id: string;
|
||||||
@ -134,7 +135,11 @@ const getCalendarDate = (dateObj: any): string | undefined => {
|
|||||||
|
|
||||||
export const getCalendars = (hass: HomeAssistant): Calendar[] =>
|
export const getCalendars = (hass: HomeAssistant): Calendar[] =>
|
||||||
Object.keys(hass.states)
|
Object.keys(hass.states)
|
||||||
.filter((eid) => computeDomain(eid) === "calendar")
|
.filter(
|
||||||
|
(eid) =>
|
||||||
|
computeDomain(eid) === "calendar" &&
|
||||||
|
!UNAVAILABLE_STATES.includes(hass.states[eid].state)
|
||||||
|
)
|
||||||
.sort()
|
.sort()
|
||||||
.map((eid, idx) => ({
|
.map((eid, idx) => ({
|
||||||
entity_id: eid,
|
entity_id: eid,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user