From 6d909a4a97ee7f760619c1311bfb8d55de514916 Mon Sep 17 00:00:00 2001 From: Charles Morgan Date: Mon, 2 Nov 2020 00:14:02 -0500 Subject: [PATCH] Add admin area link to view config --- app/Transformers/Api/Client/ServerTransformer.php | 1 + resources/scripts/api/server/getServer.ts | 2 ++ resources/scripts/routers/ServerRouter.tsx | 8 ++++++++ 3 files changed, 11 insertions(+) diff --git a/app/Transformers/Api/Client/ServerTransformer.php b/app/Transformers/Api/Client/ServerTransformer.php index 92b9ea0bf..a9e0b5803 100644 --- a/app/Transformers/Api/Client/ServerTransformer.php +++ b/app/Transformers/Api/Client/ServerTransformer.php @@ -46,6 +46,7 @@ class ServerTransformer extends BaseClientTransformer return [ 'server_owner' => $this->getKey()->user_id === $server->owner_id, 'identifier' => $server->uuidShort, + 'internal_id' => $server->id, 'uuid' => $server->uuid, 'name' => $server->name, 'node' => $server->node->name, diff --git a/resources/scripts/api/server/getServer.ts b/resources/scripts/api/server/getServer.ts index 278b21e17..df1ace982 100644 --- a/resources/scripts/api/server/getServer.ts +++ b/resources/scripts/api/server/getServer.ts @@ -13,6 +13,7 @@ export interface Allocation { export interface Server { id: string; + internalId: number; uuid: string; name: string; node: string; @@ -43,6 +44,7 @@ export interface Server { export const rawDataToServerObject = ({ attributes: data }: FractalResponseData): Server => ({ id: data.identifier, + internalId: data.internal_id, uuid: data.uuid, name: data.name, node: data.node, diff --git a/resources/scripts/routers/ServerRouter.tsx b/resources/scripts/routers/ServerRouter.tsx index ec6bc20b4..68f2fbf9c 100644 --- a/resources/scripts/routers/ServerRouter.tsx +++ b/resources/scripts/routers/ServerRouter.tsx @@ -29,6 +29,8 @@ import InstallListener from '@/components/server/InstallListener'; import StartupContainer from '@/components/server/startup/StartupContainer'; import requireServerPermission from '@/hoc/requireServerPermission'; import ErrorBoundary from '@/components/elements/ErrorBoundary'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons'; const ServerRouter = ({ match, location }: RouteComponentProps<{ id: string }>) => { const rootAdmin = useStoreState(state => state.user.data!.rootAdmin); @@ -40,6 +42,7 @@ const ServerRouter = ({ match, location }: RouteComponentProps<{ id: string }>) const isInstalling = ServerContext.useStoreState(state => state.server.data?.isInstalling); const getServer = ServerContext.useStoreActions(actions => actions.server.getServer); const clearServerState = ServerContext.useStoreActions(actions => actions.clearServerState); + const serverId = ServerContext.useStoreState(state => state.server.data?.internalId); useEffect(() => () => { clearServerState(); @@ -109,6 +112,11 @@ const ServerRouter = ({ match, location }: RouteComponentProps<{ id: string }>) Settings + {rootAdmin && + + + + }