feat: add scoped user accounts, password login and garden paving materials
This commit is contained in:
1 parent
c56f1a5ba9
commit
1d67e8ceba
43 files changed
+2024
-625
No files matched your search
@@ -8,6 +8,7 @@ import { onPluginsChanged } from "./plugins/registry.ts";
|
||||
import { normalizeBuilding, type Building } from "./model.ts";
|
||||
import { setPacks, type FurniturePack } from "./packs.ts";
|
||||
import type { HomeAssistant } from "./types.ts";
|
||||
import { isSymcon } from "./entities/symcon-values.ts";
|
||||
|
||||
export type SaveState = "idle" | "saving" | "saved" | "error";
|
||||
|
||||
@@ -111,6 +112,7 @@ export class BuildingController implements ReactiveController {
|
||||
|
||||
/** A local edit: visible at once, sent after a short pause. */
|
||||
edit(building: Building): void {
|
||||
if (this.hass && isSymcon(this.hass) && !this.hass.user?.is_admin) return;
|
||||
this.building = building;
|
||||
void loadPlugins(building.settings.plugins);
|
||||
this.waiting = building;
|
||||
@@ -179,7 +181,7 @@ export class BuildingController implements ReactiveController {
|
||||
} catch (error) {
|
||||
this.saveState = "error";
|
||||
this.saveError = messageOf(error);
|
||||
storeDraft({ building, savedAt: Date.now() }); // after a restart it can be restored and saved
|
||||
if (!isSymcon(hass)) storeDraft({ building, savedAt: Date.now() }); // Symcon sessions do not leave private plans in shared browser storage.
|
||||
}
|
||||
this.host.requestUpdate();
|
||||
}
|
||||
@@ -221,7 +223,7 @@ export class BuildingController implements ReactiveController {
|
||||
this.backendVersion = fetched.version ?? null;
|
||||
this.revision = fetched.revision;
|
||||
this.error = null;
|
||||
if (this.draft === null && !this.waiting) this.draft = loadDraft();
|
||||
if (!isSymcon(this.hass) && this.draft === null && !this.waiting) this.draft = loadDraft();
|
||||
} catch (error) {
|
||||
this.error = messageOf(error);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user