mirror of
https://github.com/moghtech/komodo.git
synced 2026-09-09 00:01:02 +00:00
attach id of deleted item to delete update
This commit is contained in:
@@ -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()),
|
||||
|
||||
@@ -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()),
|
||||
|
||||
@@ -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()),
|
||||
|
||||
@@ -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()),
|
||||
|
||||
@@ -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()),
|
||||
|
||||
@@ -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" />}>
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user