From e80b125543c427154d4d6abca2ae1465feef30b5 Mon Sep 17 00:00:00 2001
From: Charles Morgan
Date: Sun, 1 Nov 2020 02:50:35 -0500
Subject: [PATCH] Add network info
Adds network info to the server details section, Also copied to clipboard when clicked.
Closes https://github.com/pterodactyl/panel/issues/2585
---
.../scripts/components/server/ServerDetailsBlock.tsx | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/resources/scripts/components/server/ServerDetailsBlock.tsx b/resources/scripts/components/server/ServerDetailsBlock.tsx
index 17a16370c..cc33c493c 100644
--- a/resources/scripts/components/server/ServerDetailsBlock.tsx
+++ b/resources/scripts/components/server/ServerDetailsBlock.tsx
@@ -1,10 +1,11 @@
import React, { useEffect, useState } from 'react';
import tw from 'twin.macro';
-import { faCircle, faHdd, faMemory, faMicrochip, faServer } from '@fortawesome/free-solid-svg-icons';
+import { faCircle, faEthernet, faHdd, faMemory, faMicrochip, faServer } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { bytesToHuman, megabytesToHuman } from '@/helpers';
import TitledGreyBox from '@/components/elements/TitledGreyBox';
import { ServerContext } from '@/state/server';
+import CopyOnClick from '@/components/elements/CopyOnClick';
interface Stats {
memory: number;
@@ -49,6 +50,9 @@ const ServerDetailsBlock = () => {
const name = ServerContext.useStoreState(state => state.server.data!.name);
const limits = ServerContext.useStoreState(state => state.server.data!.limits);
+ const primaryAllocation = ServerContext.useStoreState(state => state.server.data!.allocations.filter(alloc => alloc.isDefault).map(
+ allocation => allocation.alias + ':' + allocation.port || allocation.ip + ':' + allocation.port
+ )).toString();
const disklimit = limits.disk ? megabytesToHuman(limits.disk) : 'Unlimited';
const memorylimit = limits.memory ? megabytesToHuman(limits.memory) : 'Unlimited';
@@ -66,6 +70,12 @@ const ServerDetailsBlock = () => {
/>
{!status ? 'Connecting...' : status}
+
+
+
+ {primaryAllocation}
+
+
{stats.cpu.toFixed(2)}%