diff --git a/resources/scripts/api/admin/egg.ts b/resources/scripts/api/admin/egg.ts
index 3449eb2c7..0f43814d0 100644
--- a/resources/scripts/api/admin/egg.ts
+++ b/resources/scripts/api/admin/egg.ts
@@ -1,8 +1,9 @@
import { Model, UUID } from '@/api/admin/index';
export interface Egg extends Model {
- id: string;
+ id: number;
uuid: UUID;
+ startup: string;
relationships: {
variables?: EggVariable[];
};
diff --git a/resources/scripts/api/admin/node.ts b/resources/scripts/api/admin/node.ts
index 9bc333541..9ae6678a3 100644
--- a/resources/scripts/api/admin/node.ts
+++ b/resources/scripts/api/admin/node.ts
@@ -25,6 +25,7 @@ export interface Allocation extends Model {
node?: Node;
server?: Server | null;
};
+ getDisplayText(): string;
}
export interface Node extends Model {
diff --git a/resources/scripts/api/admin/transformers.ts b/resources/scripts/api/admin/transformers.ts
index 795a0f441..a279d1c3a 100644
--- a/resources/scripts/api/admin/transformers.ts
+++ b/resources/scripts/api/admin/transformers.ts
@@ -168,5 +168,10 @@ export class AdminTransformers {
node: transform(attributes.relationships?.node as FractalResponseData, this.toNode),
server: transform(attributes.relationships?.server as FractalResponseData, this.toServer),
},
+ getDisplayText (): string {
+ const raw = `${this.ip}:${this.port}`;
+
+ return !this.alias ? raw : `${this.alias} (${raw})`;
+ },
});
}
diff --git a/resources/scripts/components/admin/SubNavigation.tsx b/resources/scripts/components/admin/SubNavigation.tsx
index e0dfe7091..857ed3093 100644
--- a/resources/scripts/components/admin/SubNavigation.tsx
+++ b/resources/scripts/components/admin/SubNavigation.tsx
@@ -3,37 +3,31 @@ import { NavLink } from 'react-router-dom';
import tw, { styled } from 'twin.macro';
export const SubNavigation = styled.div`
- ${tw`flex flex-row items-center flex-shrink-0 h-12 mb-4 border-b border-neutral-700`};
+ ${tw`flex flex-row items-center flex-shrink-0 h-12 mb-4 border-b border-neutral-700`};
- & > div {
- ${tw`flex flex-col justify-center flex-shrink-0 h-full`};
+ & > a {
+ ${tw`flex flex-row items-center h-full px-4 border-b text-neutral-300 text-base whitespace-nowrap border-transparent`};
- & > a {
- ${tw`flex flex-row items-center h-full px-4 border-t text-neutral-300`};
- border-top-color: transparent !important;
-
- & > svg {
- ${tw`w-6 h-6 mr-2`};
- }
-
- & > span {
- ${tw`text-base whitespace-nowrap`};
- }
-
- &:active, &.active {
- ${tw`border-b text-primary-300 border-primary-300`};
- }
- }
+ & > svg {
+ ${tw`w-6 h-6 mr-2`};
}
+
+ &:active, &.active {
+ ${tw`text-primary-300 border-primary-300`};
+ }
+ }
`;
-export const SubNavigationLink = ({ to, name, children }: { to: string, name: string, children: React.ReactNode }) => {
+interface Props {
+ to: string;
+ name: string;
+ icon: React.ComponentType;
+}
+
+export const SubNavigationLink = ({ to, name, icon: IconComponent }: Props) => {
return (
-
-
- {children}
- {name}
-
-
+
+ {name}
+
);
};
diff --git a/resources/scripts/components/admin/servers/ServerDeleteButton.tsx b/resources/scripts/components/admin/servers/ServerDeleteButton.tsx
index 4cbd3295e..1d2d0db35 100644
--- a/resources/scripts/components/admin/servers/ServerDeleteButton.tsx
+++ b/resources/scripts/components/admin/servers/ServerDeleteButton.tsx
@@ -5,27 +5,29 @@ import tw from 'twin.macro';
import Button from '@/components/elements/Button';
import ConfirmationModal from '@/components/elements/ConfirmationModal';
import deleteServer from '@/api/admin/servers/deleteServer';
+import { TrashIcon } from '@heroicons/react/outline';
+import { useServerFromRoute } from '@/api/admin/server';
+import { useHistory } from 'react-router-dom';
-interface Props {
- serverId: number;
- onDeleted: () => void;
-}
-
-export default ({ serverId, onDeleted }: Props) => {
+export default () => {
+ const history = useHistory();
const [ visible, setVisible ] = useState(false);
const [ loading, setLoading ] = useState(false);
+ const { data: server } = useServerFromRoute();
- const { clearFlashes, clearAndAddHttpError } = useStoreActions((actions: Actions) => actions.flashes);
+ const {
+ clearFlashes,
+ clearAndAddHttpError,
+ } = useStoreActions((actions: Actions) => actions.flashes);
const onDelete = () => {
+ if (!server) return;
+
setLoading(true);
clearFlashes('server');
- deleteServer(serverId)
- .then(() => {
- setLoading(false);
- onDeleted();
- })
+ deleteServer(server.id)
+ .then(() => history.push('/admin/servers'))
.catch(error => {
console.error(error);
clearAndAddHttpError({ key: 'server', error });
@@ -35,6 +37,8 @@ export default ({ serverId, onDeleted }: Props) => {
});
};
+ if (!server) return null;
+
return (
<>
{
>
Are you sure you want to delete this server?
-
-