mirror of
https://github.com/home-assistant/frontend.git
synced 2026-07-24 20:54:40 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 34dba7ea5a | |||
| e76e7d1064 | |||
| b6675159ae | |||
| 9d96d0b4aa | |||
| d900cc70c5 | |||
| 837baff26c |
@@ -52,23 +52,6 @@ gulp.task("fetch-nightly-translations", async function () {
|
||||
currentArtifact = null;
|
||||
}
|
||||
|
||||
try {
|
||||
await fetchTranslations(currentArtifact);
|
||||
} catch (err) {
|
||||
// Local builds should work offline or without valid GitHub credentials,
|
||||
// so fall back to English only. CI must fail instead of silently
|
||||
// building without translations.
|
||||
if (process.env.CI) {
|
||||
throw err;
|
||||
}
|
||||
console.warn(
|
||||
"Failed to fetch nightly translations, continuing with English only:",
|
||||
err.message
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
async function fetchTranslations(currentArtifact) {
|
||||
// To store file writing promises
|
||||
const createExtractDir = mkdir(EXTRACT_DIR, { recursive: true });
|
||||
const writings = [];
|
||||
@@ -147,6 +130,11 @@ async function fetchTranslations(currentArtifact) {
|
||||
if (!latestArtifact) {
|
||||
throw Error("Latest nightly workflow run has no translations artifact");
|
||||
}
|
||||
writings.push(
|
||||
createExtractDir.then(
|
||||
writeFile(ARTIFACT_FILE, JSON.stringify(latestArtifact, null, 2))
|
||||
)
|
||||
);
|
||||
|
||||
// Remove the current translations
|
||||
const deleteCurrent = Promise.all(writings).then(
|
||||
@@ -172,12 +160,7 @@ async function fetchTranslations(currentArtifact) {
|
||||
await new Promise((resolve, reject) => {
|
||||
extractStream.on("close", resolve).on("error", reject);
|
||||
});
|
||||
|
||||
// Record the artifact only after successful extraction, so a failed fetch
|
||||
// is retried by the next build instead of being considered current.
|
||||
await createExtractDir;
|
||||
await writeFile(ARTIFACT_FILE, JSON.stringify(latestArtifact, null, 2));
|
||||
}
|
||||
});
|
||||
|
||||
gulp.task(
|
||||
"setup-and-fetch-nightly-translations",
|
||||
|
||||
@@ -41,25 +41,30 @@ class CastDemoRow extends LitElement implements LovelaceRow {
|
||||
protected firstUpdated(changedProps: PropertyValues<this>) {
|
||||
super.firstUpdated(changedProps);
|
||||
import("../../../src/cast/cast_manager").then(({ getCastManager }) =>
|
||||
getCastManager().then((mgr) => {
|
||||
this._castManager = mgr;
|
||||
mgr.addEventListener("state-changed", () => {
|
||||
this.requestUpdate();
|
||||
});
|
||||
mgr.castContext.addEventListener(
|
||||
cast.framework.CastContextEventType.SESSION_STATE_CHANGED,
|
||||
(ev) => {
|
||||
// On Android, opening a new session always results in SESSION_RESUMED.
|
||||
// So treat both as the same.
|
||||
if (
|
||||
ev.sessionState === "SESSION_STARTED" ||
|
||||
ev.sessionState === "SESSION_RESUMED"
|
||||
) {
|
||||
castSendShowDemo(mgr);
|
||||
getCastManager().then(
|
||||
(mgr) => {
|
||||
this._castManager = mgr;
|
||||
mgr.addEventListener("state-changed", () => {
|
||||
this.requestUpdate();
|
||||
});
|
||||
mgr.castContext.addEventListener(
|
||||
cast.framework.CastContextEventType.SESSION_STATE_CHANGED,
|
||||
(ev) => {
|
||||
// On Android, opening a new session always results in SESSION_RESUMED.
|
||||
// So treat both as the same.
|
||||
if (
|
||||
ev.sessionState === "SESSION_STARTED" ||
|
||||
ev.sessionState === "SESSION_RESUMED"
|
||||
) {
|
||||
castSendShowDemo(mgr);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
},
|
||||
() => {
|
||||
this._castManager = null;
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+10
-2
@@ -29,6 +29,7 @@ import { mockSystemLog } from "./stubs/system_log";
|
||||
import { mockTemplate } from "./stubs/template";
|
||||
import { mockTodo } from "./stubs/todo";
|
||||
import { mockTranslations } from "./stubs/translations";
|
||||
import { mockUsagePrediction } from "./stubs/usage_prediction";
|
||||
import "./cloud/cloud-demo-controls";
|
||||
|
||||
// WS command / REST path prefixes whose mocks live in the lazily imported
|
||||
@@ -74,11 +75,17 @@ export class HaDemo extends HomeAssistantAppEl {
|
||||
|
||||
// The cloud account page only fetches backup config and the webhook count
|
||||
// when those integrations are loaded. Enable them here (demo only) so the
|
||||
// mocked backup/config/info and webhook/list are queried.
|
||||
// mocked backup/config/info and webhook/list are queried. usage_prediction
|
||||
// is needed for common-controls sections in strategy dashboards.
|
||||
hass.updateHass({
|
||||
config: {
|
||||
...hass.config,
|
||||
components: [...(hass.config?.components ?? []), "backup", "webhook"],
|
||||
components: [
|
||||
...(hass.config?.components ?? []),
|
||||
"backup",
|
||||
"webhook",
|
||||
"usage_prediction",
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
@@ -122,6 +129,7 @@ export class HaDemo extends HomeAssistantAppEl {
|
||||
mockDeviceRegistry(hass, demoDevices);
|
||||
mockFloorRegistry(hass);
|
||||
mockLabelRegistry(hass);
|
||||
mockUsagePrediction(hass);
|
||||
mockEntityRegistry(hass, [
|
||||
{
|
||||
config_entry_id: "co2signal",
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import type { CommonControlsResult } from "../../../src/data/usage_prediction";
|
||||
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||
|
||||
export const mockUsagePrediction = (hass: MockHomeAssistant) => {
|
||||
// Entities that don't exist in the currently loaded demo config are
|
||||
// filtered out by the common-controls section strategy.
|
||||
hass.mockWS("usage_prediction/common_control", (): CommonControlsResult => ({
|
||||
entities: [
|
||||
"light.living_room_floor_lamp",
|
||||
"climate.living_room",
|
||||
"cover.living_room_blinds",
|
||||
"media_player.living_room_speaker",
|
||||
"light.kitchen_spotlights",
|
||||
"switch.coffee_machine",
|
||||
"light.bedside_lamp",
|
||||
"alarm_control_panel.home_alarm",
|
||||
],
|
||||
}));
|
||||
};
|
||||
+2
-3
@@ -152,7 +152,7 @@
|
||||
"@octokit/rest": "22.0.1",
|
||||
"@playwright/test": "1.61.1",
|
||||
"@rsdoctor/rspack-plugin": "1.6.1",
|
||||
"@rspack/core": "2.1.4",
|
||||
"@rspack/core": "2.1.5",
|
||||
"@rspack/dev-server": "2.1.0",
|
||||
"@types/babel__plugin-transform-runtime": "7.9.5",
|
||||
"@types/chromecast-caf-receiver": "6.0.26",
|
||||
@@ -226,8 +226,7 @@
|
||||
"@fullcalendar/daygrid": "6.1.21",
|
||||
"globals": "17.7.0",
|
||||
"tslib": "2.8.1",
|
||||
"@material/mwc-list@^0.27.0": "patch:@material/mwc-list@npm%3A0.27.0#~/.yarn/patches/@material-mwc-list-npm-0.27.0-5344fc9de4.patch",
|
||||
"glob@^10.2.2": "^10.5.0"
|
||||
"@material/mwc-list@^0.27.0": "patch:@material/mwc-list@npm%3A0.27.0#~/.yarn/patches/@material-mwc-list-npm-0.27.0-5344fc9de4.patch"
|
||||
},
|
||||
"packageManager": "yarn@4.17.1",
|
||||
"volta": {
|
||||
|
||||
+11
-10
@@ -9,16 +9,17 @@ export const castApiAvailable = () => {
|
||||
|
||||
loadedPromise = new Promise((resolve) => {
|
||||
(window as any).__onGCastApiAvailable = resolve;
|
||||
});
|
||||
// Any element with a specific ID will get set as a JS variable on window
|
||||
// This will override the cast SDK if the iconset is loaded afterwards.
|
||||
// Conflicting IDs will no longer mess with window, so we'll just append one.
|
||||
const el = document.createElement("div");
|
||||
el.id = "cast";
|
||||
document.body.append(el);
|
||||
|
||||
loadJS(
|
||||
"https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1"
|
||||
);
|
||||
// Any element with a specific ID will get set as a JS variable on window
|
||||
// This will override the cast SDK if the iconset is loaded afterwards.
|
||||
// Conflicting IDs will no longer mess with window, so we'll just append one.
|
||||
const el = document.createElement("div");
|
||||
el.id = "cast";
|
||||
document.body.append(el);
|
||||
|
||||
loadJS(
|
||||
"https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1"
|
||||
).catch(() => resolve(false));
|
||||
});
|
||||
return loadedPromise;
|
||||
};
|
||||
|
||||
@@ -145,6 +145,10 @@ class HaConfigBackupBackups extends SubscribeMixin(LitElement) {
|
||||
|
||||
public connectedCallback() {
|
||||
super.connectedCallback();
|
||||
// Re-apply the type filter from the URL when the page is (re)displayed,
|
||||
// e.g. when navigating back to a cached instance of this page with a
|
||||
// different `type` query param.
|
||||
this._setFiltersFromUrl();
|
||||
window.addEventListener("location-changed", this._locationChanged);
|
||||
window.addEventListener("popstate", this._popState);
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ class HuiNumberEntityRow extends LitElement implements LovelaceRow {
|
||||
.step=${Number(stateObj.attributes.step)}
|
||||
.min=${Number(stateObj.attributes.min)}
|
||||
.max=${Number(stateObj.attributes.max)}
|
||||
.value=${stateObj.state}
|
||||
.value=${Number(stateObj.state).toString()}
|
||||
type="number"
|
||||
@change=${this._selectedValueChanged}
|
||||
>
|
||||
|
||||
@@ -4755,65 +4755,65 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@rspack/binding-darwin-arm64@npm:2.1.4":
|
||||
version: 2.1.4
|
||||
resolution: "@rspack/binding-darwin-arm64@npm:2.1.4"
|
||||
"@rspack/binding-darwin-arm64@npm:2.1.5":
|
||||
version: 2.1.5
|
||||
resolution: "@rspack/binding-darwin-arm64@npm:2.1.5"
|
||||
conditions: os=darwin & cpu=arm64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@rspack/binding-darwin-x64@npm:2.1.4":
|
||||
version: 2.1.4
|
||||
resolution: "@rspack/binding-darwin-x64@npm:2.1.4"
|
||||
"@rspack/binding-darwin-x64@npm:2.1.5":
|
||||
version: 2.1.5
|
||||
resolution: "@rspack/binding-darwin-x64@npm:2.1.5"
|
||||
conditions: os=darwin & cpu=x64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@rspack/binding-linux-arm64-gnu@npm:2.1.4":
|
||||
version: 2.1.4
|
||||
resolution: "@rspack/binding-linux-arm64-gnu@npm:2.1.4"
|
||||
"@rspack/binding-linux-arm64-gnu@npm:2.1.5":
|
||||
version: 2.1.5
|
||||
resolution: "@rspack/binding-linux-arm64-gnu@npm:2.1.5"
|
||||
conditions: os=linux & cpu=arm64 & libc=glibc
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@rspack/binding-linux-arm64-musl@npm:2.1.4":
|
||||
version: 2.1.4
|
||||
resolution: "@rspack/binding-linux-arm64-musl@npm:2.1.4"
|
||||
"@rspack/binding-linux-arm64-musl@npm:2.1.5":
|
||||
version: 2.1.5
|
||||
resolution: "@rspack/binding-linux-arm64-musl@npm:2.1.5"
|
||||
conditions: os=linux & cpu=arm64 & libc=musl
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@rspack/binding-linux-riscv64-gnu@npm:2.1.4":
|
||||
version: 2.1.4
|
||||
resolution: "@rspack/binding-linux-riscv64-gnu@npm:2.1.4"
|
||||
"@rspack/binding-linux-riscv64-gnu@npm:2.1.5":
|
||||
version: 2.1.5
|
||||
resolution: "@rspack/binding-linux-riscv64-gnu@npm:2.1.5"
|
||||
conditions: os=linux & cpu=riscv64 & libc=glibc
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@rspack/binding-linux-riscv64-musl@npm:2.1.4":
|
||||
version: 2.1.4
|
||||
resolution: "@rspack/binding-linux-riscv64-musl@npm:2.1.4"
|
||||
"@rspack/binding-linux-riscv64-musl@npm:2.1.5":
|
||||
version: 2.1.5
|
||||
resolution: "@rspack/binding-linux-riscv64-musl@npm:2.1.5"
|
||||
conditions: os=linux & cpu=riscv64 & libc=musl
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@rspack/binding-linux-x64-gnu@npm:2.1.4":
|
||||
version: 2.1.4
|
||||
resolution: "@rspack/binding-linux-x64-gnu@npm:2.1.4"
|
||||
"@rspack/binding-linux-x64-gnu@npm:2.1.5":
|
||||
version: 2.1.5
|
||||
resolution: "@rspack/binding-linux-x64-gnu@npm:2.1.5"
|
||||
conditions: os=linux & cpu=x64 & libc=glibc
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@rspack/binding-linux-x64-musl@npm:2.1.4":
|
||||
version: 2.1.4
|
||||
resolution: "@rspack/binding-linux-x64-musl@npm:2.1.4"
|
||||
"@rspack/binding-linux-x64-musl@npm:2.1.5":
|
||||
version: 2.1.5
|
||||
resolution: "@rspack/binding-linux-x64-musl@npm:2.1.5"
|
||||
conditions: os=linux & cpu=x64 & libc=musl
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@rspack/binding-wasm32-wasi@npm:2.1.4":
|
||||
version: 2.1.4
|
||||
resolution: "@rspack/binding-wasm32-wasi@npm:2.1.4"
|
||||
"@rspack/binding-wasm32-wasi@npm:2.1.5":
|
||||
version: 2.1.5
|
||||
resolution: "@rspack/binding-wasm32-wasi@npm:2.1.5"
|
||||
dependencies:
|
||||
"@emnapi/core": "npm:1.11.2"
|
||||
"@emnapi/runtime": "npm:1.11.2"
|
||||
@@ -4822,43 +4822,43 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@rspack/binding-win32-arm64-msvc@npm:2.1.4":
|
||||
version: 2.1.4
|
||||
resolution: "@rspack/binding-win32-arm64-msvc@npm:2.1.4"
|
||||
"@rspack/binding-win32-arm64-msvc@npm:2.1.5":
|
||||
version: 2.1.5
|
||||
resolution: "@rspack/binding-win32-arm64-msvc@npm:2.1.5"
|
||||
conditions: os=win32 & cpu=arm64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@rspack/binding-win32-ia32-msvc@npm:2.1.4":
|
||||
version: 2.1.4
|
||||
resolution: "@rspack/binding-win32-ia32-msvc@npm:2.1.4"
|
||||
"@rspack/binding-win32-ia32-msvc@npm:2.1.5":
|
||||
version: 2.1.5
|
||||
resolution: "@rspack/binding-win32-ia32-msvc@npm:2.1.5"
|
||||
conditions: os=win32 & cpu=ia32
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@rspack/binding-win32-x64-msvc@npm:2.1.4":
|
||||
version: 2.1.4
|
||||
resolution: "@rspack/binding-win32-x64-msvc@npm:2.1.4"
|
||||
"@rspack/binding-win32-x64-msvc@npm:2.1.5":
|
||||
version: 2.1.5
|
||||
resolution: "@rspack/binding-win32-x64-msvc@npm:2.1.5"
|
||||
conditions: os=win32 & cpu=x64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@rspack/binding@npm:2.1.4":
|
||||
version: 2.1.4
|
||||
resolution: "@rspack/binding@npm:2.1.4"
|
||||
"@rspack/binding@npm:2.1.5":
|
||||
version: 2.1.5
|
||||
resolution: "@rspack/binding@npm:2.1.5"
|
||||
dependencies:
|
||||
"@rspack/binding-darwin-arm64": "npm:2.1.4"
|
||||
"@rspack/binding-darwin-x64": "npm:2.1.4"
|
||||
"@rspack/binding-linux-arm64-gnu": "npm:2.1.4"
|
||||
"@rspack/binding-linux-arm64-musl": "npm:2.1.4"
|
||||
"@rspack/binding-linux-riscv64-gnu": "npm:2.1.4"
|
||||
"@rspack/binding-linux-riscv64-musl": "npm:2.1.4"
|
||||
"@rspack/binding-linux-x64-gnu": "npm:2.1.4"
|
||||
"@rspack/binding-linux-x64-musl": "npm:2.1.4"
|
||||
"@rspack/binding-wasm32-wasi": "npm:2.1.4"
|
||||
"@rspack/binding-win32-arm64-msvc": "npm:2.1.4"
|
||||
"@rspack/binding-win32-ia32-msvc": "npm:2.1.4"
|
||||
"@rspack/binding-win32-x64-msvc": "npm:2.1.4"
|
||||
"@rspack/binding-darwin-arm64": "npm:2.1.5"
|
||||
"@rspack/binding-darwin-x64": "npm:2.1.5"
|
||||
"@rspack/binding-linux-arm64-gnu": "npm:2.1.5"
|
||||
"@rspack/binding-linux-arm64-musl": "npm:2.1.5"
|
||||
"@rspack/binding-linux-riscv64-gnu": "npm:2.1.5"
|
||||
"@rspack/binding-linux-riscv64-musl": "npm:2.1.5"
|
||||
"@rspack/binding-linux-x64-gnu": "npm:2.1.5"
|
||||
"@rspack/binding-linux-x64-musl": "npm:2.1.5"
|
||||
"@rspack/binding-wasm32-wasi": "npm:2.1.5"
|
||||
"@rspack/binding-win32-arm64-msvc": "npm:2.1.5"
|
||||
"@rspack/binding-win32-ia32-msvc": "npm:2.1.5"
|
||||
"@rspack/binding-win32-x64-msvc": "npm:2.1.5"
|
||||
dependenciesMeta:
|
||||
"@rspack/binding-darwin-arm64":
|
||||
optional: true
|
||||
@@ -4884,15 +4884,15 @@ __metadata:
|
||||
optional: true
|
||||
"@rspack/binding-win32-x64-msvc":
|
||||
optional: true
|
||||
checksum: 10/425bf152dba708992ce16114ce6bc8dfa424071694e85201317518dce1899eeae873a2adbd23b214bb8d223f7290e000fd78ad9bf262c633e12d3d4ff73bbdcd
|
||||
checksum: 10/d1054348d3ba734485f977d574c6311311707adfcc5e53f03c8dbbbdc5778cff9b815e1d675992e2832241606d4cce7678acc3999b259139120b4ec30751f1e1
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@rspack/core@npm:2.1.4":
|
||||
version: 2.1.4
|
||||
resolution: "@rspack/core@npm:2.1.4"
|
||||
"@rspack/core@npm:2.1.5":
|
||||
version: 2.1.5
|
||||
resolution: "@rspack/core@npm:2.1.5"
|
||||
dependencies:
|
||||
"@rspack/binding": "npm:2.1.4"
|
||||
"@rspack/binding": "npm:2.1.5"
|
||||
peerDependencies:
|
||||
"@module-federation/runtime-tools": ^0.24.1 || ^2.0.0
|
||||
"@swc/helpers": ^0.5.23
|
||||
@@ -4901,7 +4901,7 @@ __metadata:
|
||||
optional: true
|
||||
"@swc/helpers":
|
||||
optional: true
|
||||
checksum: 10/3c7aa9e8dbe8b132b51fc017a6c2c76ddf346cf663cad2a8912ba61469d80468acd045503d405bf962bb5ec44f44036512dd6d6233ea6d1419979e5c17e1dbd8
|
||||
checksum: 10/714064de701211724f7d859bc269d357fa2ad2f7ea0ac34d1e4e48b534981cf3961bd723c0659b9c093330f04e01e16a0c5587d6a18301727e27d717f764ded7
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -9955,7 +9955,7 @@ __metadata:
|
||||
"@playwright/test": "npm:1.61.1"
|
||||
"@replit/codemirror-indentation-markers": "npm:6.5.3"
|
||||
"@rsdoctor/rspack-plugin": "npm:1.6.1"
|
||||
"@rspack/core": "npm:2.1.4"
|
||||
"@rspack/core": "npm:2.1.5"
|
||||
"@rspack/dev-server": "npm:2.1.0"
|
||||
"@swc/helpers": "npm:0.5.23"
|
||||
"@thomasloven/round-slider": "npm:0.6.0"
|
||||
|
||||
Reference in New Issue
Block a user