forked from cory/tildefriends
		
	Show potential room connections differently.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4027 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
		| @@ -39,11 +39,35 @@ class TfTabConnectionsElement extends LitElement { | ||||
| 	render_connection_summary(connection) { | ||||
| 		if (connection.address && connection.port) { | ||||
| 			return html`(<small>${connection.address}:${connection.port}</small>)`; | ||||
| 		} else if (connection.tunnel) { | ||||
| 			return html`(room peer)`; | ||||
| 		} else { | ||||
| 			return JSON.stringify(connection); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	render_room_peers(connection) { | ||||
| 		let self = this; | ||||
| 		let peers = this.broadcasts.filter(x => x.tunnel?.id == connection); | ||||
| 		if (peers.length) { | ||||
| 			return html` | ||||
| 				<ul> | ||||
| 					${peers.map(x => html`${self.render_broadcast(x)}`)} | ||||
| 				</ul> | ||||
| 			`; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	render_broadcast(connection) { | ||||
| 		return html` | ||||
| 			<li> | ||||
| 				<input type="button" @click=${() => tfrpc.rpc.connect(connection)} value="Connect"></input> | ||||
| 				<tf-user id=${connection.pubkey} .users=${this.users}></tf-user> | ||||
| 				${this.render_connection_summary(connection)} | ||||
| 			</li> | ||||
| 		` | ||||
| 	} | ||||
|  | ||||
| 	render() { | ||||
| 		let self = this; | ||||
| 		return html` | ||||
| @@ -52,13 +76,7 @@ class TfTabConnectionsElement extends LitElement { | ||||
| 			<input type="button" @click=${() => tfrpc.rpc.connect(self.renderRoot.getElementById('code').value)} value="Connect"></input> | ||||
| 			<h2>Broadcasts</h2> | ||||
| 			<ul> | ||||
| 				${this.broadcasts.map(x => html` | ||||
| 					<li> | ||||
| 						<input type="button" @click=${() => tfrpc.rpc.connect(x)} value="Connect"></input> | ||||
| 						<tf-user id=${x.pubkey} .users=${this.users}></tf-user> | ||||
| 						${self.render_connection_summary(x)} | ||||
| 					</li> | ||||
| 				`)} | ||||
| 				${this.broadcasts.filter(x => x.address).map(x => self.render_broadcast(x))} | ||||
| 			</ul> | ||||
| 			<h2>Connections</h2> | ||||
| 			<ul> | ||||
| @@ -66,6 +84,7 @@ class TfTabConnectionsElement extends LitElement { | ||||
| 					<li> | ||||
| 						<input type="button" @click=${() => tfrpc.rpc.closeConnection(x)} value="Close"></input> | ||||
| 						<tf-user id=${x} .users=${this.users}></tf-user> | ||||
| 						${self.render_room_peers(x)} | ||||
| 					</li> | ||||
| 				`)} | ||||
| 			</ul> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user