diff --git a/frontend/src/components/create/Deployment.tsx b/frontend/src/components/create/Deployment.tsx index 380e818e2..c6ec7cfc0 100644 --- a/frontend/src/components/create/Deployment.tsx +++ b/frontend/src/components/create/Deployment.tsx @@ -38,7 +38,6 @@ const Content: Component<{ serverID: string; close: () => void }> = (p) => { ws.send(CREATE_DEPLOYMENT, { deployment: defaultDeployment(name(), p.serverID), }); - pushNotification("ok", "creating deployment..."); p.close(); } }; diff --git a/frontend/src/components/deployment/Deployment.tsx b/frontend/src/components/deployment/Deployment.tsx index 998fc3c3c..25b8afb9e 100644 --- a/frontend/src/components/deployment/Deployment.tsx +++ b/frontend/src/components/deployment/Deployment.tsx @@ -33,7 +33,6 @@ const Deployment: Component<{ id: string }> = (p) => { { - pushNotification("ok", "deleting deployment...") ws.send(DELETE_DEPLOYMENT, { deploymentID: p.id }); }} color="red" diff --git a/frontend/src/components/topbar/topbar.module.css b/frontend/src/components/topbar/topbar.module.css index f7c9910e3..8f6d3b946 100644 --- a/frontend/src/components/topbar/topbar.module.css +++ b/frontend/src/components/topbar/topbar.module.css @@ -11,11 +11,17 @@ } .Updates { - width: 300px; + width: 340px; color: rgb(231, 225, 225); z-index: 25; } +.UpdatesContainer { + max-height: 70vh; + overflow: scroll; + padding-right: 1rem; +} + .Update { background-color: brown; padding: 0.5rem; diff --git a/frontend/src/components/topbar/updates/Update.tsx b/frontend/src/components/topbar/updates/Update.tsx index da86fece3..d62c48a8f 100644 --- a/frontend/src/components/topbar/updates/Update.tsx +++ b/frontend/src/components/topbar/updates/Update.tsx @@ -1,7 +1,7 @@ import { Update as UpdateType } from "@monitor/types"; import { Component, Show } from "solid-js"; import { useAppState } from "../../../state/StateProvider"; -import { readableTimestamp } from "../../../util/helpers"; +import { readableOperation, readableTimestamp } from "../../../util/helpers"; import Icon from "../../util/icons/Icon"; import Flex from "../../util/layout/Flex"; import Grid from "../../util/layout/Grid"; @@ -30,8 +30,10 @@ const Update: Component<{ update: UpdateType }> = (p) => { "grid-template-rows": "1fr 1fr", }} > -
{p.update.operation}
-
{readableTimestamp(p.update.timestamp)}
+
{readableOperation(p.update.operation)}
+
+ {readableTimestamp(p.update.timestamp)} +
{p.update.operator}
diff --git a/frontend/src/components/topbar/updates/Updates.tsx b/frontend/src/components/topbar/updates/Updates.tsx index 21e529bf3..025e8e1be 100644 --- a/frontend/src/components/topbar/updates/Updates.tsx +++ b/frontend/src/components/topbar/updates/Updates.tsx @@ -9,10 +9,20 @@ const Updates: Component<{}> = (p) => { return ( -
updates
- - {(update) => } - +
+ updates +
+ + + {(update) => } + +
); diff --git a/frontend/src/state/socket.ts b/frontend/src/state/socket.ts index ee037a7fc..8225e8be5 100644 --- a/frontend/src/state/socket.ts +++ b/frontend/src/state/socket.ts @@ -1,3 +1,4 @@ +import { Update } from "@monitor/types"; import { client, pushNotification, WS_URL } from ".."; import { ADD_SERVER, @@ -11,6 +12,7 @@ import { UPDATE_DEPLOYMENT, UPDATE_SERVER, } from "../state/actions"; +import { readableOperation } from "../util/helpers"; import { State } from "./StateProvider"; function socket(state: State) { @@ -84,10 +86,11 @@ function handleMessage( /* Updates */ case ADD_UPDATE: - updates.push(message.update); + const { update } = message as { update: Update }; + updates.push(update); pushNotification( - message.update.isError ? "bad" : "good", - `${message.update.operation} by ${message.update.operator}` + update.isError ? "bad" : "good", + `${readableOperation(update.operation)} by ${update.operator}` ); break; } diff --git a/frontend/src/util/helpers.ts b/frontend/src/util/helpers.ts index 6cd790ba5..4edb5d4d8 100644 --- a/frontend/src/util/helpers.ts +++ b/frontend/src/util/helpers.ts @@ -44,11 +44,14 @@ export function filterOutFromObj(obj: T, idsToFilterOut: string[]) { export function readablePermissions(permissions: number) { switch (permissions) { - case 0: return "view only" - - case 1: return "user" + case 0: + return "view only"; - case 2: return "admin" + case 1: + return "user"; + + case 2: + return "admin"; } } @@ -63,3 +66,7 @@ export function readableTimestamp(unixTimeInSecs: number) { minutes > 9 ? minutes : "0" + minutes } ${pm ? "PM" : "AM"}`; } + +export function readableOperation(operation: string) { + return operation.toLowerCase().replace("_", " "); +}