misc changes

This commit is contained in:
Drew Ansbacher
2021-08-30 14:04:01 -06:00
committed by Aiden McClelland
parent 9d52149a0d
commit 7ec2d26fe7
11 changed files with 172 additions and 152 deletions

View File

@@ -26,7 +26,6 @@ export class CompleteComponent implements OnInit, Loadable {
error: (e: Error) => void error: (e: Error) => void
} }
loading$ = new BehaviorSubject(false) loading$ = new BehaviorSubject(false)
color$ = new BehaviorSubject('medium') color$ = new BehaviorSubject('medium')
cancel$ = new Subject<void>() cancel$ = new Subject<void>()

View File

@@ -43,11 +43,9 @@ export class AppConfigPage {
async ngOnInit () { async ngOnInit () {
const rec = history.state?.configRecommendation as Recommendation const rec = history.state?.configRecommendation as Recommendation
try { try {
this.loadingText = 'Loading Config' this.loadingText = 'Loading Config'
const { spec, config } = await this.embassyApi.getPackageConfig({ id: this.pkgId }) const { spec, config } = await this.embassyApi.getPackageConfig({ id: this.pkgId })
let depConfig: object let depConfig: object
if (rec) { if (rec) {
this.loadingText = `Setting properties to accommodate ${rec.dependentTitle}...` this.loadingText = `Setting properties to accommodate ${rec.dependentTitle}...`

View File

@@ -1,6 +1,7 @@
import { Component, Input } from '@angular/core' import { Component, Input } from '@angular/core'
import { IonicSafeString, LoadingController, ModalController } from '@ionic/angular' import { IonicSafeString, LoadingController, ModalController } from '@ionic/angular'
import { getErrorMessage } from 'src/app/services/error-toast.service' import { ApiService } from 'src/app/services/api/embassy-api.service'
import { ErrorToastService, getErrorMessage } from 'src/app/services/error-toast.service'
@Component({ @Component({
selector: 'backup-confirmation', selector: 'backup-confirmation',

View File

@@ -25,7 +25,7 @@
<ion-col *ngFor="let pkg of pkgs | keyvalue : asIsOrder" sizeXs="4" sizeSm="3" sizeLg="3" sizeXl="2"> <ion-col *ngFor="let pkg of pkgs | keyvalue : asIsOrder" sizeXs="4" sizeSm="3" sizeLg="3" sizeXl="2">
<ion-card class="installed-card" [routerLink]="['/services', pkg.value.entry.manifest.id]"> <ion-card class="installed-card" [routerLink]="['/services', pkg.value.entry.manifest.id]">
<div class="launch-container" *ngIf="pkg.value.entry.manifest.interfaces | hasUi"> <div class="launch-container" *ngIf="pkg.value.entry.manifest.interfaces | hasUi">
<div class="launch-button-triangle" (click)="launchUi(pkg.value.entry, $event)" [class.launch-disabled]="!(pkg.value.entry.state | isLaunchable : pkg.value.entry.installed.status.main.status : pkg.value.entry.manifest.interfaces)"> <div class="launch-button-triangle" (click)="launchUi(pkg.value.entry, $event)" [class.launch-disabled]="!(pkg.value.entry.state | isLaunchable : pkg.value.entry.installed?.status.main.status : pkg.value.entry.manifest.interfaces)">
<ion-icon name="open-outline"></ion-icon> <ion-icon name="open-outline"></ion-icon>
</div> </div>
</div> </div>

View File

@@ -122,6 +122,7 @@ export class AppPropertiesPage {
this.properties = await this.embassyApi.getPackageProperties({ id: this.pkgId }) this.properties = await this.embassyApi.getPackageProperties({ id: this.pkgId })
this.node = JsonPointer.get(this.properties, this.pointer || '') this.node = JsonPointer.get(this.properties, this.pointer || '')
} catch (e) { } catch (e) {
console.log('catching')
this.errToast.present(e) this.errToast.present(e)
} finally { } finally {
this.loading = false this.loading = false

View File

@@ -1,3 +1,4 @@
<ng-container *ngIf="!!pkg">
<ion-header> <ion-header>
<ion-toolbar> <ion-toolbar>
<ion-buttons slot="start"> <ion-buttons slot="start">
@@ -30,7 +31,7 @@
Open UI Open UI
</ion-button> </ion-button>
<ng-container *ngIf="!connectionFailure"> <ng-container *ngIf="!connectionFailure">
<ion-button slot="end" class="action-button" *ngIf="rendering.feStatus === FeStatus.NeedsConfig" [routerLink]="['config']"> <ion-button slot="end" class="action-button" *ngIf="rendering.feStatus === FeStatus.NeedsConfig" (click)="presentModalConfig()">
Configure Configure
</ion-button> </ion-button>
<ion-button slot="end" class="action-button" *ngIf="[FeStatus.Running, FeStatus.StartingUp, FeStatus.NeedsAttention] | includes : rendering.feStatus" color="danger" (click)="stop()"> <ion-button slot="end" class="action-button" *ngIf="[FeStatus.Running, FeStatus.StartingUp, FeStatus.NeedsAttention] | includes : rendering.feStatus" color="danger" (click)="stop()">
@@ -154,3 +155,4 @@
></ion-progress-bar> ></ion-progress-bar>
</div> </div>
</ion-content> </ion-content>
</ng-container>

View File

@@ -32,6 +32,7 @@ export class AppShowPage {
mainStatus: MainStatus mainStatus: MainStatus
PackageMainStatus = PackageMainStatus PackageMainStatus = PackageMainStatus
connectionFailure: boolean connectionFailure: boolean
loading = true
@ViewChild(IonContent) content: IonContent @ViewChild(IonContent) content: IonContent
subs: Subscription[] = [] subs: Subscription[] = []

View File

@@ -8,7 +8,7 @@
</ion-header> </ion-header>
<ion-content> <ion-content>
<text-spinner *ngIf="!marketplaceService.releaseNotes[pkgId]; else loaded" text="Loading Release Notes"></text-spinner> <text-spinner *ngIf="loading; else loaded" text="Loading Release Notes"></text-spinner>
<ng-template #loaded> <ng-template #loaded>
<div style="margin: 0px;" *ngFor="let note of marketplaceService.releaseNotes[pkgId] | keyvalue : asIsOrder"> <div style="margin: 0px;" *ngFor="let note of marketplaceService.releaseNotes[pkgId] | keyvalue : asIsOrder">

View File

@@ -1,6 +1,7 @@
import { Component, ViewChild } from '@angular/core' import { Component, ViewChild } from '@angular/core'
import { ActivatedRoute } from '@angular/router' import { ActivatedRoute } from '@angular/router'
import { IonContent } from '@ionic/angular' import { IonContent } from '@ionic/angular'
import { ErrorToastService } from 'src/app/services/error-toast.service'
import { MarketplaceService } from '../marketplace.service' import { MarketplaceService } from '../marketplace.service'
@Component({ @Component({
@@ -12,17 +13,26 @@ export class AppReleaseNotes {
@ViewChild(IonContent) content: IonContent @ViewChild(IonContent) content: IonContent
selected: string selected: string
pkgId: string pkgId: string
loading = true
constructor ( constructor (
private readonly route: ActivatedRoute, private readonly route: ActivatedRoute,
public marketplaceService: MarketplaceService, public marketplaceService: MarketplaceService,
public errToast: ErrorToastService,
) { } ) { }
ngOnInit () { async ngOnInit () {
this.pkgId = this.route.snapshot.paramMap.get('pkgId') this.pkgId = this.route.snapshot.paramMap.get('pkgId')
try {
if (!this.marketplaceService.releaseNotes[this.pkgId]) { if (!this.marketplaceService.releaseNotes[this.pkgId]) {
this.marketplaceService.getReleaseNotes(this.pkgId) await this.marketplaceService.getReleaseNotes(this.pkgId)
} }
} catch (e) {
this.errToast.present(e)
} finally {
this.loading = false
}
} }
ngAfterViewInit () { ngAfterViewInit () {

View File

@@ -46,7 +46,7 @@ export class SSHKeysPage {
title: name, title: name,
message: description, message: description,
label: name, label: name,
submitFn: this.add, submitFn: async (pk: string) => await this.add(pk),
}, },
cssClass: 'alertlike-modal', cssClass: 'alertlike-modal',
}) })

View File

@@ -50,6 +50,14 @@ export class ConfigService {
} }
isLaunchable (state: PackageState, status: PackageMainStatus, interfaces: { [id: string]: InterfaceDef }): boolean { isLaunchable (state: PackageState, status: PackageMainStatus, interfaces: { [id: string]: InterfaceDef }): boolean {
console.log('is launchable', this.isLaunchable)
console.log('state', state)
console.log('status', status)
console.log('ret val', status === PackageMainStatus.Running &&
(
(hasTorUi(interfaces) && this.isTor()) ||
(hasLanUi(interfaces) && !this.isTor())
))
if (this.isConsulate || state !== PackageState.Installed) { if (this.isConsulate || state !== PackageState.Installed) {
return false return false
} }