diff --git a/frontend/src/components/builds/Actions.tsx b/frontend/src/components/builds/Actions.tsx
index 09e0221b5..fcc2e1c10 100644
--- a/frontend/src/components/builds/Actions.tsx
+++ b/frontend/src/components/builds/Actions.tsx
@@ -15,7 +15,7 @@ const Actions: Component<{}> = (p) => {
const build = () => builds.get(selected.id())!;
const actions = useActionStates();
return (
- = 2 || build().owners.includes(username()!))}>
+ 1 || build().owners.includes(username()!)}>
actions
diff --git a/frontend/src/components/builds/Build.tsx b/frontend/src/components/builds/Build.tsx
index b1ad03de0..1f20ac71e 100644
--- a/frontend/src/components/builds/Build.tsx
+++ b/frontend/src/components/builds/Build.tsx
@@ -8,9 +8,9 @@ import BuildTabs from "./tabs/Tabs";
import Updates from "./Updates";
const Build: Component<{}> = (p) => {
- const { builds, selected } = useAppState();
+ const { builds, selected } = useAppState();
const build = () => builds.get(selected.id())!;
- return (
+ return (
@@ -26,6 +26,6 @@ const Build: Component<{}> = (p) => {
);
-}
+};
-export default Build;
\ No newline at end of file
+export default Build;
diff --git a/frontend/src/components/builds/Header.tsx b/frontend/src/components/builds/Header.tsx
index d5cb55eb6..4baa4a7af 100644
--- a/frontend/src/components/builds/Header.tsx
+++ b/frontend/src/components/builds/Header.tsx
@@ -2,6 +2,7 @@ import { Build } from "@monitor/types";
import { Component, Show } from "solid-js";
import { DELETE_BUILD } from "../../state/actions";
import { useAppState } from "../../state/StateProvider";
+import { useUser } from "../../state/UserProvider";
import ConfirmButton from "../util/ConfirmButton";
import Icon from "../util/Icon";
import Flex from "../util/layout/Flex";
@@ -12,6 +13,7 @@ const Header: Component<{}> = (p) => {
const { builds, selected, ws } = useAppState();
const build = () => builds.get(selected.id())!;
const actions = useActionStates();
+ const { permissions, username } = useUser();
return (
= (p) => {
{build().name}
{getSub(build())}
-
-
-
- }
- >
- {
- ws.send(DELETE_BUILD, { buildID: selected.id() });
- }}
- color="red"
+ = 2 || build().owners.includes(username()!)}>
+
+
+
+ }
>
-
-
+ {
+ ws.send(DELETE_BUILD, { buildID: selected.id() });
+ }}
+ color="red"
+ >
+
+
+
);
diff --git a/frontend/src/components/deployment/Header.tsx b/frontend/src/components/deployment/Header.tsx
index ee1186574..cbc64ffaa 100644
--- a/frontend/src/components/deployment/Header.tsx
+++ b/frontend/src/components/deployment/Header.tsx
@@ -2,6 +2,7 @@ import { ContainerStatus } from "@monitor/types";
import { Component, Show } from "solid-js";
import { DELETE_DEPLOYMENT } from "../../state/actions";
import { useAppState } from "../../state/StateProvider";
+import { useUser } from "../../state/UserProvider";
import { deploymentStatusClass } from "../../util/helpers";
import ConfirmButton from "../util/ConfirmButton";
import Icon from "../util/Icon";
@@ -12,9 +13,9 @@ import HoverMenu from "../util/menu/HoverMenu";
import { useActionStates } from "./ActionStateProvider";
const Header: Component<{}> = (p) => {
- const { servers, deployments, ws, selected } = useAppState();
- const deployment = () => deployments.get(selected.id());
- const server = () => deployment() && servers.get(deployment()?.serverID!);
+ const { deployments, ws, selected } = useAppState();
+ const deployment = () => deployments.get(selected.id())!;
+ const { permissions, username } = useUser();
const state = () =>
deployment()!.status === "not deployed"
? "not deployed"
@@ -29,37 +30,43 @@ const Header: Component<{}> = (p) => {
{deployment()!.name}
-
-
- }
+ when={permissions() >= 2 || deployment().owners.includes(username()!)}
>
-
-
-
- }
- >
- {
- ws.send(DELETE_DEPLOYMENT, { deploymentID: selected.id() });
- }}
- color="red"
- >
-
-
-
+
+
+
}
- content="delete deployment"
- position="bottom center"
- padding="0.5rem"
- />
+ >
+
+
+
+ }
+ >
+ {
+ ws.send(DELETE_DEPLOYMENT, {
+ deploymentID: selected.id(),
+ });
+ }}
+ color="red"
+ >
+
+
+
+ }
+ content="delete deployment"
+ position="bottom center"
+ padding="0.5rem"
+ />
+
diff --git a/frontend/src/components/server/Header.tsx b/frontend/src/components/server/Header.tsx
index 022b7cb6f..658b7a84a 100644
--- a/frontend/src/components/server/Header.tsx
+++ b/frontend/src/components/server/Header.tsx
@@ -2,6 +2,7 @@ import { Server } from "@monitor/types";
import { Component, Show } from "solid-js";
import { REMOVE_SERVER } from "../../state/actions";
import { useAppState } from "../../state/StateProvider";
+import { useUser } from "../../state/UserProvider";
import { serverStatusClass } from "../../util/helpers";
import ConfirmButton from "../util/ConfirmButton";
import Icon from "../util/Icon";
@@ -17,6 +18,7 @@ const Header: Component<{}> = (p) => {
? "OK"
: "NOT OK"
: "DISABLED";
+ const { permissions, username } = useUser();
return (
= (p) => {
{status()}
- {
- ws.send(REMOVE_SERVER, { serverID: selected.id() });
- }}
- color="red"
- >
-
-
+ 1 || server().owners.includes(username())}>
+ {
+ ws.send(REMOVE_SERVER, { serverID: selected.id() });
+ }}
+ color="red"
+ >
+
+
+