Skip to content

Commit

Permalink
Merge branch 'rc'
Browse files Browse the repository at this point in the history
  • Loading branch information
bramkragten committed Jan 9, 2025
2 parents 9ff1ce3 + 2e2f39a commit 3ffbd43
Show file tree
Hide file tree
Showing 33 changed files with 1,563 additions and 586 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "home-assistant-frontend"
version = "20250106.0"
version = "20250109.0"
license = {text = "Apache-2.0"}
description = "The Home Assistant frontend"
readme = "README.md"
Expand Down
6 changes: 6 additions & 0 deletions src/components/chart/ha-chart-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,13 @@ export class HaChartBase extends LitElement {

public disconnectedCallback() {
super.disconnectedCallback();
window.removeEventListener("scroll", this._handleScroll, true);
this._releaseCanvas();
}

public connectedCallback() {
super.connectedCallback();
window.addEventListener("scroll", this._handleScroll, true);
if (this.hasUpdated) {
this._releaseCanvas();
this._setupChart();
Expand Down Expand Up @@ -561,6 +563,10 @@ export class HaChartBase extends LitElement {
this.chart?.resetZoom();
}

private _handleScroll = () => {
this._tooltip = undefined;
};

static get styles(): CSSResultGroup {
return css`
:host {
Expand Down
19 changes: 17 additions & 2 deletions src/components/ha-button-toggle-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ export class HaButtonToggleGroup extends LitElement {
direction: ltr;
}
mwc-button {
flex: 1;
--mdc-shape-small: 0;
--mdc-button-outline-width: 1px 0 1px 1px;
--mdc-button-outline-color: var(--primary-color);
}
ha-icon-button {
border: 1px solid var(--primary-color);
Expand All @@ -94,7 +96,7 @@ export class HaButtonToggleGroup extends LitElement {
width: 100%;
height: 100%;
position: absolute;
background-color: currentColor;
background-color: var(--primary-color);
opacity: 0;
pointer-events: none;
content: "";
Expand All @@ -104,12 +106,22 @@ export class HaButtonToggleGroup extends LitElement {
}
ha-icon-button[active]::before,
mwc-button[active]::before {
opacity: var(--mdc-icon-button-ripple-opacity, 0.12);
opacity: 1;
}
ha-icon-button[active] {
--icon-primary-color: var(--text-primary-color);
}
mwc-button[active] {
--mdc-theme-primary: var(--text-primary-color);
}
ha-icon-button:first-child,
mwc-button:first-child {
--mdc-shape-small: 4px 0 0 4px;
border-radius: 4px 0 0 4px;
--mdc-button-outline-width: 1px;
}
mwc-button:first-child::before {
border-radius: 4px 0 0 4px;
}
ha-icon-button:last-child,
mwc-button:last-child {
Expand All @@ -118,6 +130,9 @@ export class HaButtonToggleGroup extends LitElement {
--mdc-shape-small: 0 4px 4px 0;
--mdc-button-outline-width: 1px;
}
mwc-button:last-child::before {
border-radius: 0 4px 4px 0;
}
ha-icon-button:only-child,
mwc-button:only-child {
--mdc-shape-small: 4px;
Expand Down
10 changes: 10 additions & 0 deletions src/components/ha-selector/ha-selector-button-toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ export class HaButtonToggleSelector extends LitElement {
static styles = css`
:host {
position: relative;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
gap: 8px;
align-items: center;
}
@media all and (max-width: 600px) {
ha-button-toggle-group {
flex: 1;
}
}
`;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/map/ha-entity-marker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import "../ha-state-icon";
class HaEntityMarker extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;

@property({ attribute: "entity-id" }) public entityId?: string;
@property({ attribute: "entity-id", reflect: true }) public entityId?: string;

@property({ attribute: "entity-name" }) public entityName?: string;

Expand Down
41 changes: 23 additions & 18 deletions src/data/backup.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { setHours, setMinutes } from "date-fns";
import type { HassConfig } from "home-assistant-js-websocket";
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 {
formatDateTime,
formatDateTimeNumeric,
} 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 { domainToName } from "./integration";
import type { FrontendLocaleData } from "./translation";

export const enum BackupScheduleState {
NEVER = "never",
Expand Down Expand Up @@ -217,10 +217,16 @@ export const uploadBackup = async (
};

export const getPreferredAgentForDownload = (agents: string[]) => {
const localAgents = agents.filter(
(agent) => agent.split(".")[0] === "backup"
);
return localAgents[0] || agents[0];
const localAgent = agents.find(isLocalAgent);
if (localAgent) {
return localAgent;
}
const networkMountAgent = agents.find(isNetworkMountAgent);
if (networkMountAgent) {
return networkMountAgent;
}

return agents[0];
};

export const CORE_LOCAL_AGENT = "backup.local";
Expand All @@ -241,7 +247,7 @@ export const computeBackupAgentName = (
agentIds?: string[]
) => {
if (isLocalAgent(agentId)) {
return "This system";
return localize("ui.panel.config.backup.agents.local_agent");
}
const [domain, name] = agentId.split(".");

Expand Down Expand Up @@ -298,23 +304,22 @@ export const generateEmergencyKit = (
encryptionKey: string
) =>
"data:text/plain;charset=utf-8," +
encodeURIComponent(`Home Assistant Backup Emergency Kit
encodeURIComponent(`${hass.localize("ui.panel.config.backup.emergency_kit_file.title")}
This emergency kit contains your backup encryption key. You need this key
to be able to restore your Home Assistant backups.
${hass.localize("ui.panel.config.backup.emergency_kit_file.description")}
Date: ${formatDateTime(new Date(), hass.locale, hass.config)}
${hass.localize("ui.panel.config.backup.emergency_kit_file.date")} ${formatDateTime(new Date(), hass.locale, hass.config)}
Instance:
${hass.localize("ui.panel.config.backup.emergency_kit_file.instance")}
${hass.config.location_name}
URL:
${hass.localize("ui.panel.config.backup.emergency_kit_file.url")}
${hass.auth.data.hassUrl}
Encryption key:
${hass.localize("ui.panel.config.backup.emergency_kit_file.encryption_key")}
${encryptionKey}
For more information visit: https://www.home-assistant.io/more-info/backup-emergency-kit`);
${hass.localize("ui.panel.config.backup.emergency_kit_file.more_info", { link: "https://www.home-assistant.io/more-info/backup-emergency-kit" })}`);

export const geneateEmergencyKitFileName = (
hass: HomeAssistant,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,14 @@ class DialogAutomationRename extends LitElement implements HassDialog {
ha-dialog {
--dialog-content-padding: 0 24px 24px 24px;
}
@media all and (min-width: 500px) {
ha-dialog {
--mdc-dialog-min-width: min(500px, 95vw);
--mdc-dialog-max-width: min(500px, 95vw);
}
}
ha-textfield,
ha-textarea,
ha-icon-picker,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,18 @@ class HaBackupConfigAgents extends LitElement {
private _description(agentId: string) {
if (agentId === CLOUD_AGENT) {
if (this.cloudStatus.logged_in && !this.cloudStatus.active_subscription) {
return "You currently do not have an active Home Assistant Cloud subscription.";
return this.hass.localize(
"ui.panel.config.backup.agents.cloud_agent_no_subcription"
);
}
return "Note: It stores only one backup with a maximum size of 5 GB, regardless of your settings.";
return this.hass.localize(
"ui.panel.config.backup.agents.cloud_agent_description"
);
}
if (isNetworkMountAgent(agentId)) {
return "Network storage";
return this.hass.localize(
"ui.panel.config.backup.agents.network_mount_agent_description"
);
}
return "";
}
Expand Down Expand Up @@ -107,7 +113,7 @@ class HaBackupConfigAgents extends LitElement {
slot="start"
/>
`}
<div slot="headline">${name}</div>
<div slot="headline" class="name">${name}</div>
${description
? html`<div slot="supporting-text">${description}</div>`
: nothing}
Expand All @@ -124,7 +130,9 @@ class HaBackupConfigAgents extends LitElement {
})}
</ha-md-list>
`
: html`<p>No sync agents configured</p>`}
: html`<p>
${this.hass.localize("ui.panel.config.backup.agents.no_agents")}
</p>`}
`;
}

Expand Down Expand Up @@ -157,6 +165,12 @@ class HaBackupConfigAgents extends LitElement {
--md-list-item-leading-space: 0;
--md-list-item-trailing-space: 0;
}
ha-md-list-item {
--md-item-overflow: visible;
}
ha-md-list-item .name {
word-break: break-word;
}
ha-md-list-item img {
width: 48px;
}
Expand Down
Loading

0 comments on commit 3ffbd43

Please sign in to comment.