1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-22 17:12:30 +01:00

Merge pull request #2646 from AreYouRlyScared/#2608

Add admin area link to view config
This commit is contained in:
Dane Everitt 2020-11-08 11:48:22 -08:00 committed by GitHub
commit 74b1776c00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;
@ -44,6 +45,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>