Add admin area link to view config

This commit is contained in:
Charles Morgan 2020-11-02 00:14:02 -05:00
parent 964a1436ce
commit 6d909a4a97
No known key found for this signature in database
GPG key ID: D71946CD723249BD
3 changed files with 11 additions and 0 deletions

View file

@ -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,

View file

@ -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,

View file

@ -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 }>)
<Can action={[ 'settings.*', 'file.sftp' ]} matchAny>
<NavLink to={`${match.url}/settings`}>Settings</NavLink>
</Can>
{rootAdmin &&
<a href={'/admin/servers/view/' + serverId} rel="noreferrer" target={'_blank'}>
<FontAwesomeIcon icon={faExternalLinkAlt}/>
</a>
}
</div>
</SubNavigation>
</CSSTransition>