fix launching UI from list page

This commit is contained in:
Matt Hill
2021-02-24 16:48:18 -07:00
committed by Aiden McClelland
parent ee1c66d0c2
commit 68eccdb63c
3 changed files with 12 additions and 10 deletions

View File

@@ -22,16 +22,16 @@
<ion-grid> <ion-grid>
<ion-row> <ion-row>
<ion-col *ngFor="let app of apps" sizeXs="4" sizeSm="3" sizeMd="2" sizeLg="2"> <ion-col *ngFor="let app of apps" sizeXs="4" sizeSm="3" sizeMd="2" sizeLg="2">
<ng-container *ngIf="{ tor: app.subject.torAddress | async, status: app.subject.status | async, ui: app.subject.ui | async, iconURL: app.subject.iconURL | async | iconParse, title: app.subject.title | async } as vars" > <ng-container *ngIf="{ status: app.subject.status | async, ui: app.subject.ui | async, iconURL: app.subject.iconURL | async | iconParse, title: app.subject.title | async, lanEnabled: app.subject.lanEnabled } as vars" >
<ion-card class="installed-card" [class.installed-card-on]="vars.status === 'RUNNING'" style="position:relative" [routerLink]="['/services', 'installed', app.id]"> <ion-card class="installed-card" [class.installed-card-on]="vars.status === 'RUNNING'" style="position:relative" [routerLink]="['/services', 'installed', app.id]">
<div class="launch-container" *ngIf="vars.ui && !isConsulate"> <div class="launch-container" *ngIf="vars.ui && !isConsulate">
<div class="launch-button-triangle" (click)="launchUiTab(vars.tor, app.id, $event)" [class.disabled]="vars.status !== AppStatus.RUNNING"> <div class="launch-button-triangle" (click)="launchUiTab(app.id, $event)" [class.disabled]="vars.status !== AppStatus.RUNNING || (!isTor && !vars.lanEnabled)">
<ion-icon class="launch-button-triangle-icon" name="globe-outline"></ion-icon> <ion-icon class="launch-button-triangle-icon" name="globe-outline"></ion-icon>
</div> </div>
</div> </div>
<img style="position: absolute" class="main-img" [src]="vars.iconURL" [alt]="app.subject.title | async" /> <img style="position: absolute" class="main-img" [src]="vars.iconURL" [alt]="vars.title" />
<img class="main-img" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="> <img class="main-img" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=">
<img class="bulb-on" *ngIf="vars.status | displayBulb: 'green'" src="assets/img/running-bulb.png"/> <img class="bulb-on" *ngIf="vars.status | displayBulb: 'green'" src="assets/img/running-bulb.png"/>
<img class="bulb-on" *ngIf="vars.status | displayBulb: 'red'" src="assets/img/issue-bulb.png"/> <img class="bulb-on" *ngIf="vars.status | displayBulb: 'red'" src="assets/img/issue-bulb.png"/>

View File

@@ -97,18 +97,22 @@ export class AppInstalledListPage extends Cleanup {
}, },
}) })
console.log(this.isTor, this.apps[2].subject.lanEnabled.getValue())
} }
async launchUiTab (torAddress: string, id: string, event: Event) { async launchUiTab (id: string, event: Event) {
event.preventDefault() event.preventDefault()
event.stopPropagation() event.stopPropagation()
const app = this.apps.find(app => app.id === id).subject
let uiAddress: string let uiAddress: string
if (this.isTor) { if (this.isTor) {
uiAddress = torAddress.startsWith('http') ? torAddress : `http://${torAddress}` uiAddress = `http://${app.torAddress.getValue()}`
} else { } else {
uiAddress = `https://${id}.${this.serverModel.peek().serverId}.local` uiAddress = `https://${app.lanAddress.getValue()}`
} }
console.log(uiAddress)
return window.open(uiAddress, '_blank') return window.open(uiAddress, '_blank')
} }

View File

@@ -167,11 +167,9 @@ export class AppInstalledShowPage extends Cleanup {
async launchUiTab () { async launchUiTab () {
let uiAddress: string let uiAddress: string
if (this.isTor) { if (this.isTor) {
const torAddress = this.app.torAddress.getValue() uiAddress = `http://${this.app.torAddress.getValue()}`
uiAddress = torAddress.startsWith('http') ? torAddress : `http://${torAddress}`
} else { } else {
const lanAddress = this.app.lanAddress.getValue() uiAddress = `https://${this.app.lanAddress.getValue()}`
uiAddress = lanAddress.startsWith('http') ? lanAddress : `http://${lanAddress}`
} }
return window.open(uiAddress, '_blank') return window.open(uiAddress, '_blank')
} }