mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 01:36:49 +00:00
Fix preferred agent for backup download (#23659)
This commit is contained in:
parent
b02d0e58b1
commit
5e7f356707
@ -1,16 +1,16 @@
|
|||||||
import { setHours, setMinutes } from "date-fns";
|
import { setHours, setMinutes } from "date-fns";
|
||||||
import type { HassConfig } from "home-assistant-js-websocket";
|
import type { HassConfig } from "home-assistant-js-websocket";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
import { formatTime } from "../common/datetime/format_time";
|
|
||||||
import type { LocalizeFunc } from "../common/translations/localize";
|
|
||||||
import type { HomeAssistant } from "../types";
|
|
||||||
import { domainToName } from "./integration";
|
|
||||||
import type { FrontendLocaleData } from "./translation";
|
|
||||||
import {
|
import {
|
||||||
formatDateTime,
|
formatDateTime,
|
||||||
formatDateTimeNumeric,
|
formatDateTimeNumeric,
|
||||||
} from "../common/datetime/format_date_time";
|
} from "../common/datetime/format_date_time";
|
||||||
|
import { formatTime } from "../common/datetime/format_time";
|
||||||
|
import type { LocalizeFunc } from "../common/translations/localize";
|
||||||
|
import type { HomeAssistant } from "../types";
|
||||||
import { fileDownload } from "../util/file_download";
|
import { fileDownload } from "../util/file_download";
|
||||||
|
import { domainToName } from "./integration";
|
||||||
|
import type { FrontendLocaleData } from "./translation";
|
||||||
|
|
||||||
export const enum BackupScheduleState {
|
export const enum BackupScheduleState {
|
||||||
NEVER = "never",
|
NEVER = "never",
|
||||||
@ -217,10 +217,16 @@ export const uploadBackup = async (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getPreferredAgentForDownload = (agents: string[]) => {
|
export const getPreferredAgentForDownload = (agents: string[]) => {
|
||||||
const localAgents = agents.filter(
|
const localAgent = agents.find(isLocalAgent);
|
||||||
(agent) => agent.split(".")[0] === "backup"
|
if (localAgent) {
|
||||||
);
|
return localAgent;
|
||||||
return localAgents[0] || agents[0];
|
}
|
||||||
|
const networkMountAgent = agents.find(isNetworkMountAgent);
|
||||||
|
if (networkMountAgent) {
|
||||||
|
return networkMountAgent;
|
||||||
|
}
|
||||||
|
|
||||||
|
return agents[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
export const CORE_LOCAL_AGENT = "backup.local";
|
export const CORE_LOCAL_AGENT = "backup.local";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user