Restore the connections tab.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4452 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
e8ac5b759d
commit
2d82dad806
@ -42,11 +42,8 @@ class TfTabConnectionsElement extends LitElement {
|
|||||||
let self = this;
|
let self = this;
|
||||||
let peers = this.broadcasts.filter(x => x.tunnel?.id == connection);
|
let peers = this.broadcasts.filter(x => x.tunnel?.id == connection);
|
||||||
if (peers.length) {
|
if (peers.length) {
|
||||||
return html`
|
let connections = this.connections.map(x => x.id);
|
||||||
<ul>
|
return html`${peers.filter(x => connections.indexOf(x.pubkey) == -1).map(x => html`${self.render_room_peer(x)}`)}`;
|
||||||
${peers.map(x => html`${self.render_room_peer(x)}`)}
|
|
||||||
</ul>
|
|
||||||
`;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +56,7 @@ class TfTabConnectionsElement extends LitElement {
|
|||||||
return html`
|
return html`
|
||||||
<li>
|
<li>
|
||||||
<input type="button" @click=${() => self._tunnel(connection.tunnel.id, connection.pubkey)} value="Connect"></input>
|
<input type="button" @click=${() => self._tunnel(connection.tunnel.id, connection.pubkey)} value="Connect"></input>
|
||||||
<tf-user id=${connection.pubkey} .users=${this.users}></tf-user>
|
<tf-user id=${connection.pubkey} .users=${this.users}></tf-user> 📡
|
||||||
</li>
|
</li>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
@ -79,6 +76,18 @@ class TfTabConnectionsElement extends LitElement {
|
|||||||
this.stored_connections = (await tfrpc.rpc.getStoredConnections()) || [];
|
this.stored_connections = (await tfrpc.rpc.getStoredConnections()) || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
render_connection(connection) {
|
||||||
|
return html`
|
||||||
|
<input type="button" @click=${() => tfrpc.rpc.closeConnection(connection.id)} value="Close"></input>
|
||||||
|
<tf-user id=${connection.id} .users=${this.users}></tf-user>
|
||||||
|
${connection.tunnel !== undefined ? '🚇' : html`(${connection.host}:${connection.port})`}
|
||||||
|
<ul>
|
||||||
|
${this.connections.filter(x => x.tunnel === this.connections.indexOf(connection)).map(x => html`<li>${this.render_connection(x)}</li>`)}
|
||||||
|
${this.render_room_peers(connection.id)}
|
||||||
|
</ul>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let self = this;
|
let self = this;
|
||||||
return html`
|
return html`
|
||||||
@ -93,12 +102,8 @@ class TfTabConnectionsElement extends LitElement {
|
|||||||
</ul>
|
</ul>
|
||||||
<h2>Connections</h2>
|
<h2>Connections</h2>
|
||||||
<ul>
|
<ul>
|
||||||
${this.connections.map(x => html`
|
${this.connections.filter(x => x.tunnel === undefined).map(x => html`
|
||||||
<li>
|
<li>${this.render_connection(x)}</li>
|
||||||
<input type="button" @click=${() => tfrpc.rpc.closeConnection(x)} value="Close"></input>
|
|
||||||
<tf-user id=${x} .users=${this.users}></tf-user> ${this.render_connection_summary(x)}
|
|
||||||
${self.render_room_peers(x)}
|
|
||||||
</li>
|
|
||||||
`)}
|
`)}
|
||||||
</ul>
|
</ul>
|
||||||
<h2>Stored Connections (WIP)</h2>
|
<h2>Stored Connections (WIP)</h2>
|
||||||
|
Loading…
Reference in New Issue
Block a user