Show hostname, network and exitnode

main
Gerard Braad 2023-06-22 22:29:20 +08:00
parent 78b1c4535c
commit 74ab528176
1 changed files with 24 additions and 8 deletions

View File

@ -34,11 +34,6 @@ export class Application extends React.Component<ApplicationProps, ApplicationSt
render() { render() {
const columns: TableProps['cols'] = ['', 'IP', 'Hostname'];
return ( return (
<> <>
{ {
@ -47,6 +42,15 @@ export class Application extends React.Component<ApplicationProps, ApplicationSt
aria-label="Tailscale peers" aria-label="Tailscale peers"
variant='compact' borders={false}> variant='compact' borders={false}>
<Caption>Tailscale peers</Caption> <Caption>Tailscale peers</Caption>
<Thead noWrap>
<Tr>
<Th></Th>
<Th>IP</Th>
<Th>Hostname</Th>
<Th>Network</Th>
<Th>Exit node</Th>
</Tr>
</Thead>
<Tbody> <Tbody>
<Peer {...this.state.Status.Self} /> <Peer {...this.state.Status.Self} />
{ {
@ -67,15 +71,27 @@ export class Application extends React.Component<ApplicationProps, ApplicationSt
class Peer extends React.Component<TailscalePeer> { class Peer extends React.Component<TailscalePeer> {
render() { render() {
const name = this.props.DNSName.split('.');
const hostName = name[0];
const network = name[1] + '.' + 'ts.net';
return ( return (
<Tr> <Tr>
<Td> <Td>
{this.props.Online { this.props.Online
? <Icon status="success"><CheckCircleIcon /></Icon> ? <Icon status="success"><CheckCircleIcon /></Icon>
: <Icon status="danger"><ExclamationCircleIcon /></Icon> : <Icon status="danger"><ExclamationCircleIcon /></Icon>
}</Td> }</Td>
<Td>{this.props.TailscaleIPs[0]}</Td> <Td>{ this.props.TailscaleIPs[0] }</Td>
<Td>{this.props.HostName}</Td> <Td>{ hostName }</Td>
<Td>{ network }</Td>
<Td>{ this.props.ExitNode
? "Current"
: this.props.ExitNodeOption
? "Yes"
: ""
}</Td>
</Tr>); </Tr>);
} }
} }