mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Remove unused device class translations (#17253)
This commit is contained in:
parent
f35b493d2e
commit
289c380a6a
@ -71,71 +71,8 @@ export const getLogbookDataForContext = async (
|
||||
hass: HomeAssistant,
|
||||
startDate: string,
|
||||
contextId?: string
|
||||
): Promise<LogbookEntry[]> => {
|
||||
await hass.loadBackendTranslation("device_class");
|
||||
return getLogbookDataFromServer(
|
||||
hass,
|
||||
startDate,
|
||||
undefined,
|
||||
undefined,
|
||||
contextId
|
||||
);
|
||||
};
|
||||
|
||||
export const getLogbookData = async (
|
||||
hass: HomeAssistant,
|
||||
startDate: string,
|
||||
endDate: string,
|
||||
entityIds?: string[],
|
||||
deviceIds?: string[]
|
||||
): Promise<LogbookEntry[]> => {
|
||||
await hass.loadBackendTranslation("device_class");
|
||||
return deviceIds?.length
|
||||
? getLogbookDataFromServer(
|
||||
hass,
|
||||
startDate,
|
||||
endDate,
|
||||
entityIds,
|
||||
undefined,
|
||||
deviceIds
|
||||
)
|
||||
: getLogbookDataCache(hass, startDate, endDate, entityIds);
|
||||
};
|
||||
|
||||
const getLogbookDataCache = async (
|
||||
hass: HomeAssistant,
|
||||
startDate: string,
|
||||
endDate: string,
|
||||
entityId?: string[]
|
||||
) => {
|
||||
const ALL_ENTITIES = "*";
|
||||
|
||||
const entityIdKey = entityId ? entityId.toString() : ALL_ENTITIES;
|
||||
const cacheKey = `${startDate}${endDate}`;
|
||||
|
||||
if (!DATA_CACHE[cacheKey]) {
|
||||
DATA_CACHE[cacheKey] = {};
|
||||
}
|
||||
|
||||
if (entityIdKey in DATA_CACHE[cacheKey]) {
|
||||
return DATA_CACHE[cacheKey][entityIdKey]!;
|
||||
}
|
||||
|
||||
if (entityId && DATA_CACHE[cacheKey][ALL_ENTITIES]) {
|
||||
const entities = await DATA_CACHE[cacheKey][ALL_ENTITIES]!;
|
||||
return entities.filter(
|
||||
(entity) => entity.entity_id && entityId.includes(entity.entity_id)
|
||||
);
|
||||
}
|
||||
|
||||
DATA_CACHE[cacheKey][entityIdKey] = getLogbookDataFromServer(
|
||||
hass,
|
||||
startDate,
|
||||
endDate,
|
||||
entityId
|
||||
);
|
||||
return DATA_CACHE[cacheKey][entityIdKey]!;
|
||||
};
|
||||
): Promise<LogbookEntry[]> =>
|
||||
getLogbookDataFromServer(hass, startDate, undefined, undefined, contextId);
|
||||
|
||||
const getLogbookDataFromServer = (
|
||||
hass: HomeAssistant,
|
||||
|
@ -67,7 +67,6 @@ export type TranslationCategory =
|
||||
| "device_automation"
|
||||
| "mfa_setup"
|
||||
| "system_health"
|
||||
| "device_class"
|
||||
| "application_credentials"
|
||||
| "issues"
|
||||
| "selector";
|
||||
|
Loading…
x
Reference in New Issue
Block a user