attach id of deleted item to delete update

This commit is contained in:
mbecker20
2023-01-02 09:43:40 +00:00
parent 161ac34afa
commit d77d07cb52
7 changed files with 14 additions and 13 deletions
+1 -1
View File
@@ -123,7 +123,7 @@ impl State {
.context("failed at deleting repo")?;
self.db.builds.delete_one(build_id).await?;
let update = Update {
target: UpdateTarget::System,
target: UpdateTarget::Build(build_id.to_string()),
operation: Operation::DeleteBuild,
start_ts,
end_ts: Some(monitor_timestamp()),
+1 -1
View File
@@ -131,7 +131,7 @@ impl State {
"failed at deleting deployment at {deployment_id} from mongo"
))?;
let update = Update {
target: UpdateTarget::System,
target: UpdateTarget::Deployment(deployment_id.to_string()),
operation: Operation::DeleteDeployment,
start_ts,
end_ts: Some(monitor_timestamp()),
+1 -1
View File
@@ -79,7 +79,7 @@ impl State {
.await
.context(format!("failed at deleting group at {id} from mongo"))?;
let update = Update {
target: UpdateTarget::System,
target: UpdateTarget::Group(id.to_string()),
operation: Operation::DeleteGroup,
start_ts,
end_ts: Some(monitor_timestamp()),
+1 -1
View File
@@ -87,7 +87,7 @@ impl State {
.await
.context(format!("failed at deleting procedure at {id} from mongo"))?;
let update = Update {
target: UpdateTarget::System,
target: UpdateTarget::Procedure(id.to_string()),
operation: Operation::DeleteProcedure,
start_ts,
end_ts: Some(monitor_timestamp()),
+1 -1
View File
@@ -104,7 +104,7 @@ impl State {
let start_ts = monitor_timestamp();
self.db.servers.delete_one(&server_id).await?;
let update = Update {
target: UpdateTarget::System,
target: UpdateTarget::Server(server_id.to_string()),
operation: Operation::DeleteServer,
start_ts,
end_ts: Some(monitor_timestamp()),
+8 -7
View File
@@ -23,14 +23,15 @@ const Build: Component<{}> = (p) => {
const userCanUpdate = () =>
user().admin ||
build().permissions[getId(user())] === PermissionLevel.Update;
let unsub = () => {};
createEffect(() => {
onCleanup(
ws.subscribe([Operation.DeleteBuild], (update) => {
if (update.target.id === params.id) {
navigate("/");
}
})
);
unsub();
unsub = ws.subscribe([Operation.DeleteBuild], (update) => {
if (update.target.id === params.id) {
navigate("/");
}
});
onCleanup(unsub);
});
return (
<Show when={build()} fallback={<NotFound type="build" />}>
+1 -1
View File
@@ -43,7 +43,7 @@ function connectToWs(state: State) {
subscribe: (operations: Operation[], callback: (update: Update) => void) => {
const listener = ({ data }: { data: string }) => {
if (data === "PONG") return;
if (data = "LOGGED_IN") return;
if (data === "LOGGED_IN") return;
const update = JSON.parse(data) as Update;
if (operations.length === 0 || operations.includes(update.operation)) {
callback(update);