Add admin area link to view config
This commit is contained in:
parent
964a1436ce
commit
6d909a4a97
3 changed files with 11 additions and 0 deletions
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue