FlowNotFound says whether a published flow or any flow is missing; read_all stamps its cache with the revision from before its scan; dashboard discard and delete commits name the key; a RedisState ttl expires counters and the names set too; bench_startup publishes the version after its saves, and only when there is a draft
This commit is contained in:
@@ -961,21 +961,23 @@ class DashboardStore:
|
||||
self._dump(shown.model_copy(update={"version": top + 1}))
|
||||
)
|
||||
draft.unlink()
|
||||
self.flows._commit(f"Discard draft of dashboard '{name}'")
|
||||
return self.read(name)
|
||||
shown = self.read(name)
|
||||
self.flows._commit(f"Discard draft of dashboard {named(shown.name, name)}")
|
||||
return shown
|
||||
|
||||
def delete(self, name: str) -> None:
|
||||
if not self.exists(name):
|
||||
raise DashboardNotFound(name)
|
||||
path = self._file(name)
|
||||
with self.flows._write_lock:
|
||||
key = next((k for k, i in self.key_index().items() if i == name), name)
|
||||
path.unlink(missing_ok=True)
|
||||
self._draft_file(name).unlink(missing_ok=True)
|
||||
try:
|
||||
path.parent.rmdir()
|
||||
except OSError:
|
||||
pass
|
||||
self.flows._commit(f"Delete dashboard '{name}'")
|
||||
self.flows._commit(f"Delete dashboard {named(key, name)}")
|
||||
|
||||
def duplicate(self, name: str) -> DashboardDef:
|
||||
"""Copy the working copy into a new dashboard, as a draft only.
|
||||
|
||||
Reference in New Issue
Block a user