-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9cf203b
commit eb55677
Showing
5 changed files
with
72 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
resources/scripts/components/servers/overview/ServerNetworkBlock.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { Dd, Dt } from '@/components/dashboard/ServerCard' | ||
import Card from '@/components/elements/Card' | ||
import Display from '@/components/elements/displays/DisplayRow' | ||
import { ServerContext } from '@/state/server' | ||
import { useMemo } from 'react' | ||
|
||
const ServerNetworkBlock = () => { | ||
const server = ServerContext.useStoreState(state => state.server.data!) | ||
|
||
const addresses = useMemo( | ||
() => [...server.limits.addresses.ipv4, ...server.limits.addresses.ipv6], | ||
[server.limits.addresses] | ||
) | ||
|
||
return ( | ||
<Card className='flex flex-col col-span-10 md:col-span-5 relative'> | ||
<h5 className='h5'>Network</h5> | ||
<div className='flex flex-col space-y-3 mt-3'> | ||
<dl> | ||
<Dt>IP Addresses</Dt> | ||
{addresses.length === 0 ? ( | ||
<Dd>There are no addresses associated with this server.</Dd> | ||
) : ( | ||
<Display.Group className='mt-3'> | ||
{addresses.map(ip => ( | ||
<Display.Row key={ip.id} className='grid-cols-1 md:grid-cols-3 text-sm'> | ||
<div> | ||
<p className='description-small !text-xs'>Address</p> | ||
<p className='font-semibold text-foreground'> | ||
{ip.address}/{ip.cidr} | ||
</p> | ||
</div> | ||
<div> | ||
<p className='description-small !text-xs'>Gateway</p> | ||
<p className='text-foreground font-semibold'>{ip.gateway}</p> | ||
</div> | ||
<div> | ||
<p className='description-small !text-xs'>Mac Address</p> | ||
<p className='text-foreground font-semibold'>{ip.macAddress || 'None'}</p> | ||
</div> | ||
</Display.Row> | ||
))} | ||
</Display.Group> | ||
)} | ||
</dl> | ||
</div> | ||
</Card> | ||
) | ||
} | ||
|
||
export default ServerNetworkBlock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters