mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +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,
|
hass: HomeAssistant,
|
||||||
startDate: string,
|
startDate: string,
|
||||||
contextId?: string
|
contextId?: string
|
||||||
): Promise<LogbookEntry[]> => {
|
): Promise<LogbookEntry[]> =>
|
||||||
await hass.loadBackendTranslation("device_class");
|
getLogbookDataFromServer(hass, startDate, undefined, undefined, contextId);
|
||||||
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]!;
|
|
||||||
};
|
|
||||||
|
|
||||||
const getLogbookDataFromServer = (
|
const getLogbookDataFromServer = (
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
@ -67,7 +67,6 @@ export type TranslationCategory =
|
|||||||
| "device_automation"
|
| "device_automation"
|
||||||
| "mfa_setup"
|
| "mfa_setup"
|
||||||
| "system_health"
|
| "system_health"
|
||||||
| "device_class"
|
|
||||||
| "application_credentials"
|
| "application_credentials"
|
||||||
| "issues"
|
| "issues"
|
||||||
| "selector";
|
| "selector";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user