remove not needed subs

This commit is contained in:
Drew Ansbacher
2021-07-08 10:54:49 -06:00
committed by Aiden McClelland
parent 804786b80b
commit 20cdb47cb0
23 changed files with 65 additions and 215 deletions

View File

@@ -8,7 +8,7 @@
</ion-header>
<ion-content class="ion-padding-top">
<ng-container *ngIf="installed">
<ng-container *ngIf="patch.data['server-info'][pkgId]?.installed as installed">
<ion-item-group>
<ion-item button *ngFor="let action of installed.manifest.actions | keyvalue: asIsOrder" (click)="handleAction(installed, action)" >
<ion-label class="ion-text-wrap">

View File

@@ -16,11 +16,11 @@ import { Subscription } from 'rxjs'
styleUrls: ['./app-actions.page.scss'],
})
export class AppActionsPage {
installed: InstalledPackageDataEntry
subs: Subscription[] = []
@ViewChild(IonContent) content: IonContent
pkgId: string
constructor (
private readonly route: ActivatedRoute,
private readonly apiService: ApiService,
@@ -29,18 +29,11 @@ export class AppActionsPage {
private readonly loaderService: LoaderService,
private readonly wizardBaker: WizardBaker,
private readonly navCtrl: NavController,
private readonly patch: PatchDbModel,
public readonly patch: PatchDbModel,
) { }
ngOnInit () {
const pkgId = this.route.snapshot.paramMap.get('pkgId')
this.subs = [
this.patch.watch$('package-data', pkgId, 'installed')
.subscribe(installed => {
this.installed = installed
}),
]
this.pkgId = this.route.snapshot.paramMap.get('pkgId')
}
ngAfterViewInit () {

View File

@@ -8,7 +8,7 @@
</ion-header>
<ion-content>
<ion-grid *ngIf="pkg">
<ion-grid *ngIf="patch.data['package-data'][pkgId] as pkg">
<ion-row>
<ion-col *ngFor="let interface of pkg.installed.manifest.interfaces | keyvalue: asIsOrder" sizeSm="12" sizeMd="6">
<ion-card>

View File

@@ -16,30 +16,23 @@ export class AppInterfacesPage {
pkg: PackageDataEntry
@ViewChild(IonContent) content: IonContent
subs: Subscription[] = []
pkgId: string
constructor (
private readonly route: ActivatedRoute,
private readonly toastCtrl: ToastController,
private readonly config: ConfigService,
private readonly patch: PatchDbModel,
public readonly patch: PatchDbModel,
) { }
ngOnInit () {
const pkgId = this.route.snapshot.paramMap.get('pkgId')
this.subs = [
this.patch.watch$('package-data', pkgId).subscribe(pkg => this.pkg = pkg),
]
this.pkgId = this.route.snapshot.paramMap.get('pkgId')
}
ngAfterViewInit () {
this.content.scrollToPoint(undefined, 1)
}
ngOnDestroy () {
this.subs.forEach(sub => sub.unsubscribe())
}
async copy (address: string): Promise<void> {
let message = ''
await copyToClipboard(address || '')

View File

@@ -8,43 +8,44 @@
</ion-header>
<ion-content style="position: relative">
<div *ngIf="pkgs | empty; else list" class="ion-text-center ion-padding">
<div style="display: flex; flex-direction: column; justify-content: center; height: 40vh">
<h2>Welcome to your <span style="font-style: italic; color: var(--ion-color-danger)">Embassy</span></h2>
<p class="ion-text-wrap">Get started by installing your first service.</p>
<div *ngIf="patch.data['package-data'] as pkgs">
<div *ngIf="pkgs | empty; else list" class="ion-text-center ion-padding">
<div style="display: flex; flex-direction: column; justify-content: center; height: 40vh">
<h2>Welcome to your <span style="font-style: italic; color: var(--ion-color-danger)">Embassy</span></h2>
<p class="ion-text-wrap">Get started by installing your first service.</p>
</div>
<ion-button [routerLink]="['/marketplace']" style="width: 50%;" fill="outline">
<ion-icon slot="start" name="storefront-outline"></ion-icon>
Marketplace
</ion-button>
</div>
<ion-button [routerLink]="['/marketplace']" style="width: 50%;" fill="outline">
<ion-icon slot="start" name="storefront-outline"></ion-icon>
Marketplace
</ion-button>
</div>
<ng-template #list>
<ion-grid>
<ion-row>
<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 | manifest).id]">
<div class="launch-container" *ngIf="pkg.value | hasUi">
<div class="launch-button-triangle" (click)="launchUi(pkg.value, $event)" [class.launch-disabled]="!(pkg.value | isLaunchable)">
<ion-icon name="rocket-outline"></ion-icon>
<ng-template #list>
<ion-grid>
<ion-row>
<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 | manifest).id]">
<div class="launch-container" *ngIf="pkg.value | hasUi">
<div class="launch-button-triangle" (click)="launchUi(pkg.value, $event)" [class.launch-disabled]="!(pkg.value | isLaunchable)">
<ion-icon name="rocket-outline"></ion-icon>
</div>
</div>
</div>
<img style="position: absolute" class="main-img" [src]="pkg.value['static-files'].icon" alt="icon" />
<img class="main-img" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=">
<img class="bulb-on" *ngIf="(pkg.key | displayBulb : 'green' : connected) | async" src="assets/img/running-bulb.png"/>
<img class="bulb-on" *ngIf="(pkg.key | displayBulb : 'red' : connected) | async" src="assets/img/issue-bulb.png"/>
<img class="bulb-on" *ngIf="(pkg.key | displayBulb : 'yellow' : connected) | async" src="assets/img/warning-bulb.png"/>
<img class="bulb-off" *ngIf="(pkg.key | displayBulb : 'off' : connected) | async" src="assets/img/off-bulb.png"/>
<img style="position: absolute" class="main-img" [src]="pkg.value['static-files'].icon" alt="icon" />
<img class="main-img" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=">
<img class="bulb-on" *ngIf="(pkg.key | displayBulb : 'green' : connected) | async" src="assets/img/running-bulb.png"/>
<img class="bulb-on" *ngIf="(pkg.key | displayBulb : 'red' : connected) | async" src="assets/img/issue-bulb.png"/>
<img class="bulb-on" *ngIf="(pkg.key | displayBulb : 'yellow' : connected) | async" src="assets/img/warning-bulb.png"/>
<img class="bulb-off" *ngIf="(pkg.key | displayBulb : 'off' : connected) | async" src="assets/img/off-bulb.png"/>
<ion-card-header>
<status *ngIf="connected" [pkgId]="pkg.key" size="calc(8px + .4vw)" weight="bold"></status>
<ion-card-title>{{ (pkg.value | manifest).title }}</ion-card-title>
</ion-card-header>
</ion-card>
</ion-col>
</ion-row>
</ion-grid>
</ng-template>
<ion-card-header>
<status *ngIf="connected" [pkgId]="pkg.key" size="calc(8px + .4vw)" weight="bold"></status>
<ion-card-title>{{ (pkg.value | manifest).title }}</ion-card-title>
</ion-card-header>
</ion-card>
</ion-col>
</ion-row>
</ion-grid>
</ng-template>
</div>
</ion-content>

View File

@@ -11,7 +11,6 @@ import { Subscription } from 'rxjs'
styleUrls: ['./app-list.page.scss'],
})
export class AppListPage {
pkgs: { [id: string]: PackageDataEntry } = { }
connected: boolean
subs: Subscription[] = []
@@ -23,9 +22,6 @@ export class AppListPage {
ngOnInit () {
this.subs = [
this.patch.watch$('package-data').subscribe(pkgs => {
this.pkgs = pkgs
}),
this.patch.connected$().subscribe(c => this.connected = c),
]
}

View File

@@ -2,7 +2,7 @@ import { Component, ViewChild } from '@angular/core'
import { IonContent, LoadingController, ModalController } from '@ionic/angular'
import { ApiService } from 'src/app/services/api/api.service'
import { BackupConfirmationComponent } from 'src/app/modals/backup-confirmation/backup-confirmation.component'
import { DiskInfo, PartitionInfoEntry } from 'src/app/services/api/api-types'
import { DiskInfo } from 'src/app/services/api/api-types'
import { ActivatedRoute } from '@angular/router'
import { PatchDbModel } from 'src/app/services/patch-db/patch-db.service'
import { Subscription } from 'rxjs'
@@ -33,13 +33,7 @@ export class AppRestorePage {
ngOnInit () {
this.pkgId = this.route.snapshot.paramMap.get('pkgId')
this.subs = [
this.patch.watch$('package-data', this.pkgId, 'installed', 'manifest', 'title')
.subscribe(title => {
this.title = title
}),
]
this.title = this.patch.data['package-data'][this.pkgId].installed.manifest.title
this.getExternalDisks()
}
@@ -48,10 +42,6 @@ export class AppRestorePage {
this.content.scrollToPoint(undefined, 1)
}
ngOnDestroy () {
this.subs.forEach(sub => sub.unsubscribe())
}
async refresh () {
this.loading = true
await this.getExternalDisks()