class PortForward: Reactor.Component { function render() { var args = handler.get_args(); var is_rdp = handler.is_rdp(); if (is_rdp) { this.pfs = [["", "", "RDP"]]; args = ["rdp"]; } else if (args.length) { this.pfs = [args]; } else { this.pfs = handler.get_port_forwards(); } var pfs = this.pfs.map(function(pf, i) { return {is_rdp ? : pf[0]} {args.length ? svg_arrow : ""} {pf[1] || "localhost"} {pf[2]} {args.length ? "" : {svg_cancel}} ; }); return
{pfs.length ?
{translate('Listening ...')}
{translate('not_close_tcp_tip')}
: ""} {args.length ? "" : } {args.length ? "" : } {pfs}
{translate('Local Port')} {translate('Remote Host')} {translate('Remote Port')}{translate('Action')}
{svg_arrow}
; } event click $(#add) () { var port = ($(#port).value || "").toInteger() || 0; var remote_host = $(#remote-host).value || ""; var remote_port = ($(#remote-port).value || "").toInteger() || 0; if (port <= 0 || remote_port <= 0) return; handler.add_port_forward(port, remote_host, remote_port); this.update(); } event click $(#new-rdp) { handler.new_rdp(); } event click $(.remove svg) (_, me) { var pf = this.pfs[me.parent.parent.index - 1]; handler.remove_port_forward(pf[0]); this.update(); } } function initializePortForward() { $(#file-transfer-wrapper).content(); $(#video-wrapper).style.set { visibility: "hidden", position: "absolute" }; $(#file-transfer-wrapper).style.set { display: "block" }; }