Filter for shared-to/shareenode

main
Gerard Braad 2023-06-23 02:13:36 +08:00
parent 23530dcb05
commit 7df29cbce3
2 changed files with 31 additions and 24 deletions

View File

@ -35,6 +35,10 @@ export class Application extends React.Component<ApplicationProps, ApplicationSt
render() { render() {
function isNotSharee(peer:TailscalePeer): peer is TailscalePeer {
return peer.DNSName !== ""; // ShareeNode doesn't work?
}
return ( return (
<> <>
{ {
@ -43,7 +47,7 @@ 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> <Thead>
<Tr> <Tr>
<Th></Th> <Th></Th>
<Th>IP</Th> <Th>IP</Th>
@ -59,8 +63,10 @@ export class Application extends React.Component<ApplicationProps, ApplicationSt
<Tbody> <Tbody>
<Peer {...this.state.Status.Self} /> <Peer {...this.state.Status.Self} />
{ {
Object.entries(this.state.Status.Peer).map(peer => { Object.values(this.state.Status.Peer)
return <Peer {...peer[1]} /> .filter(isNotSharee)
.map(peer => {
return <Peer {...peer} />
} }
) )
} }
@ -82,26 +88,26 @@ class Peer extends React.Component<TailscalePeer> {
const network = name[1] + '.' + 'ts.net'; const network = name[1] + '.' + 'ts.net';
var tags = "-" var tags = "-"
if(this.props.Tags) { if (this.props.Tags) {
const mapped_items = this.props.Tags?.map(t => { return t}) const mapped_items = this.props.Tags?.map(t => { return t })
tags = mapped_items.join(', ') tags = mapped_items.join(', ')
} }
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>{ hostName }</Td> <Td>{hostName}</Td>
<Td>{ network }</Td> <Td>{network}</Td>
<Td>{ <Td>{
tags tags
} }
</Td> </Td>
<Td>{ this.props.Active <Td>{this.props.Active
? this.props.CurAddr != "" ? this.props.CurAddr != ""
? "Direct" ? "Direct"
: "Relay: " + this.props.Relay : "Relay: " + this.props.Relay
@ -109,14 +115,14 @@ class Peer extends React.Component<TailscalePeer> {
? "Idle" ? "Idle"
: "-" : "-"
}</Td> }</Td>
<Td>{ this.props.ExitNode <Td>{this.props.ExitNode
? "Current" ? "Current"
: this.props.ExitNodeOption : this.props.ExitNodeOption
? "Yes" ? "Yes"
: "-" : "-"
}</Td> }</Td>
<Td>{ this.props.OS }</Td> <Td>{this.props.OS}</Td>
<Td>{ this.props.TxBytes } / { this.props.RxBytes }</Td> <Td>{this.props.TxBytes} / {this.props.RxBytes}</Td>
</Tr>); </Tr>);
} }
} }

View File

@ -40,6 +40,7 @@ export type TailscalePeer = {
ExitNodeOption: boolean; ExitNodeOption: boolean;
Active: boolean; Active: boolean;
CurAddr: string; CurAddr: string;
ShareeNode?: boolean; // funnel-ingress-node, device-of-shared-to-user
} }
export interface TailscaleExitNodeStatus { export interface TailscaleExitNodeStatus {