This commit is contained in:
beckerinj
2023-01-19 23:42:26 -05:00
parent a6a58a25be
commit d64c46f44d
2 changed files with 8 additions and 6 deletions

View File

@@ -5,7 +5,7 @@ use axum::{extract::Query, routing::get, Extension, Json, Router};
use helpers::handle_anyhow_error;
use mungos::{doc, to_bson, ObjectId};
use serde_json::Value;
use types::{PermissionLevel, Update, UpdateTarget};
use types::{Operation, PermissionLevel, Update, UpdateTarget};
use crate::{
auth::{RequestUser, RequestUserExtension},
@@ -95,7 +95,7 @@ impl State {
let deployment = self
.get_deployment_check_permissions(id, user, PermissionLevel::Read)
.await?;
if let Some(build_id) = &deployment.branch {
if let Some(build_id) = &deployment.build_id {
let build = self
.get_build_check_permissions(build_id, user, PermissionLevel::Read)
.await;
@@ -103,7 +103,7 @@ impl State {
Some(doc! {
"$or": [
{"target": to_bson(&target).unwrap()},
{"target": { "type": "Build", "id": build_id }, "operation": "build_build"}
{"target": { "type": "Build", "id": build_id }, "operation": Operation::BuildBuild.to_string()}
],
})
} else {

View File

@@ -1,7 +1,7 @@
import { Component, Show } from "solid-js";
import { useAppState } from "../../state/StateProvider";
import { Operation, Update as UpdateType, UpdateStatus } from "../../types";
import { combineClasses, readableMonitorTimestamp } from "../../util/helpers";
import { combineClasses, readableMonitorTimestamp, readableVersion } from "../../util/helpers";
import Icon from "../shared/Icon";
import Flex from "../shared/layout/Flex";
import Grid from "../shared/layout/Grid";
@@ -12,9 +12,11 @@ const Update: Component<{ update: UpdateType }> = (p) => {
const { usernames } = useAppState();
const operation = () => {
if (p.update.operation === Operation.BuildBuild) {
return "build";
return `build ${readableVersion(p.update.version!)}`;
}
return p.update.operation.replaceAll("_", " ");
return `${p.update.operation.replaceAll("_", " ")}${
p.update.version ? " " + readableVersion(p.update.version) : ""
}`;
};
return (
<Grid gap="0.25rem" class={combineClasses(s.Update, "shadow")}>