put server / aws build on build header

This commit is contained in:
mbecker20
2023-02-21 23:05:49 +00:00
parent a121ae0828
commit b36f485287
5 changed files with 37 additions and 11 deletions
+1 -1
View File
@@ -166,7 +166,7 @@ impl State {
// none of these should be changed through this method
new_build.name = current_build.name.clone();
new_build.permissions = current_build.permissions.clone();
new_build.last_built_at = String::new();
new_build.last_built_at = current_build.last_built_at.clone();
new_build.created_at = current_build.created_at.clone();
new_build.updated_at = start_ts.clone();
+2 -1
View File
@@ -27,7 +27,8 @@ const Header: Component<{}> = (p) => {
const userCanUpdate = () =>
user().admin ||
build().permissions![getId(user())] === PermissionLevel.Update;
const server = () => servers.get(build().server_id);
const server = () =>
build().server_id ? servers.get(build().server_id!) : undefined;
return (
<>
<Grid
+31 -8
View File
@@ -5,7 +5,10 @@ import { useAppState } from "../../../state/StateProvider";
import { useUser } from "../../../state/UserProvider";
import { PermissionLevel } from "../../../types";
import { getId, readableMonitorTimestamp } from "../../../util/helpers";
import { ActionStateProvider, useActionStates } from "../../build/ActionStateProvider";
import {
ActionStateProvider,
useActionStates,
} from "../../build/ActionStateProvider";
import { NewBuild } from "../../New";
import ConfirmButton from "../../shared/ConfirmButton";
import Icon from "../../shared/Icon";
@@ -78,8 +81,10 @@ const Builds: Component<{}> = (p) => {
const Build: Component<{ id: string }> = (p) => {
const { user } = useUser();
const { builds } = useAppState();
const build = () => builds.get(p.id)!
const { builds, servers } = useAppState();
const build = () => builds.get(p.id)!;
const server = () =>
build().server_id ? servers.get(build().server_id!) : undefined;
const version = () => {
return `v${build().version.major}.${build().version.minor}.${
build().version.patch
@@ -101,6 +106,7 @@ const Build: Component<{ id: string }> = (p) => {
user().admin ||
build().permissions![getId(user())] === PermissionLevel.Execute ||
build().permissions![getId(user())] === PermissionLevel.Update;
const isAwsBuild = () => build().aws_config ? true : false;
return (
<A
href={`/build/${p.id}`}
@@ -110,9 +116,23 @@ const Build: Component<{ id: string }> = (p) => {
height: "fit-content",
"box-sizing": "border-box",
"justify-content": "space-between",
padding: "0.5rem",
}}
>
<h1 style={{ "font-size": "1.25rem" }}>{build().name}</h1>
<Flex alignItems="center">
<h1 style={{ "font-size": "1.25rem" }}>{build().name}</h1>
<Show when={server()}>
<A
href={`/server/${build().server_id!}`}
style={{ padding: 0, opacity: 0.7 }}
>
<div class="text-hover">{server()?.server.name}</div>
</A>
</Show>
<Show when={isAwsBuild()}>
<div style={{ opacity: 0.7 }}>aws build</div>
</Show>
</Flex>
<Flex alignItems="center">
<div>{version()}</div>
<div style={{ opacity: 0.7 }}>{lastBuiltAt()}</div>
@@ -120,10 +140,13 @@ const Build: Component<{ id: string }> = (p) => {
<Show
when={!actions.building}
fallback={
<button class="green" onClick={e => {
e.stopPropagation();
e.preventDefault();
}}>
<button
class="green"
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
}}
>
<Loading type="spinner" />
</button>
}
+2
View File
@@ -2,6 +2,8 @@
Generated by typeshare 1.0.0
*/
import { PermissionLevel, PermissionsTarget } from "../types";
export interface CreateBuildBody {
name: string;
}
+1 -1
View File
@@ -69,7 +69,7 @@ pub struct Build {
#[diff(attr(#[serde(skip_serializing_if = "option_diff_no_change")]))]
pub docker_account: Option<String>,
#[serde(default)]
#[serde(default, skip_serializing_if = "String::is_empty")]
#[diff(attr(#[serde(skip)]))]
#[builder(setter(skip))]
pub last_built_at: String,