Rename profiles to automations across backend and frontend
Rename the "profiles" entity to "automations" throughout the entire codebase for clarity. Updates Python models, storage, API routes/schemas, engine, frontend JS modules, HTML templates, CSS classes, i18n keys (en/ru/zh), dashboard, tutorials, and command palette. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -60,22 +60,22 @@ class DeviceBrightnessSnapshot:
|
||||
|
||||
|
||||
@dataclass
|
||||
class ProfileSnapshot:
|
||||
"""Snapshot of a profile's enabled state."""
|
||||
class AutomationSnapshot:
|
||||
"""Snapshot of an automation's enabled state."""
|
||||
|
||||
profile_id: str
|
||||
automation_id: str
|
||||
enabled: bool = True
|
||||
|
||||
def to_dict(self) -> dict:
|
||||
return {
|
||||
"profile_id": self.profile_id,
|
||||
"automation_id": self.automation_id,
|
||||
"enabled": self.enabled,
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, data: dict) -> "ProfileSnapshot":
|
||||
def from_dict(cls, data: dict) -> "AutomationSnapshot":
|
||||
return cls(
|
||||
profile_id=data["profile_id"],
|
||||
automation_id=data.get("automation_id", data.get("profile_id", "")),
|
||||
enabled=data.get("enabled", True),
|
||||
)
|
||||
|
||||
@@ -90,7 +90,7 @@ class ScenePreset:
|
||||
color: str = "#4fc3f7" # accent color for the card
|
||||
targets: List[TargetSnapshot] = field(default_factory=list)
|
||||
devices: List[DeviceBrightnessSnapshot] = field(default_factory=list)
|
||||
profiles: List[ProfileSnapshot] = field(default_factory=list)
|
||||
automations: List[AutomationSnapshot] = field(default_factory=list)
|
||||
order: int = 0
|
||||
created_at: datetime = field(default_factory=datetime.utcnow)
|
||||
updated_at: datetime = field(default_factory=datetime.utcnow)
|
||||
@@ -103,7 +103,7 @@ class ScenePreset:
|
||||
"color": self.color,
|
||||
"targets": [t.to_dict() for t in self.targets],
|
||||
"devices": [d.to_dict() for d in self.devices],
|
||||
"profiles": [p.to_dict() for p in self.profiles],
|
||||
"automations": [a.to_dict() for a in self.automations],
|
||||
"order": self.order,
|
||||
"created_at": self.created_at.isoformat(),
|
||||
"updated_at": self.updated_at.isoformat(),
|
||||
@@ -118,7 +118,7 @@ class ScenePreset:
|
||||
color=data.get("color", "#4fc3f7"),
|
||||
targets=[TargetSnapshot.from_dict(t) for t in data.get("targets", [])],
|
||||
devices=[DeviceBrightnessSnapshot.from_dict(d) for d in data.get("devices", [])],
|
||||
profiles=[ProfileSnapshot.from_dict(p) for p in data.get("profiles", [])],
|
||||
automations=[AutomationSnapshot.from_dict(a) for a in data.get("automations", data.get("profiles", []))],
|
||||
order=data.get("order", 0),
|
||||
created_at=datetime.fromisoformat(data.get("created_at", datetime.utcnow().isoformat())),
|
||||
updated_at=datetime.fromisoformat(data.get("updated_at", datetime.utcnow().isoformat())),
|
||||
|
||||
Reference in New Issue
Block a user