mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
cleaning up
This commit is contained in:
committed by
Aiden McClelland
parent
eb03d1ed04
commit
7aaeefc180
@@ -1,6 +1,6 @@
|
||||
import { Component, Input, ViewChild } from '@angular/core'
|
||||
import { ActivatedRoute } from '@angular/router'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
import { AlertController, IonContent, LoadingController, ModalController, NavController } from '@ionic/angular'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { Action, Manifest, PackageDataEntry, PackageMainStatus } from 'src/app/services/patch-db/data-model'
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Component, ViewChild } from '@angular/core'
|
||||
import { ActivatedRoute } from '@angular/router'
|
||||
import { IonContent } from '@ionic/angular'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
|
||||
@Component({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component, ViewChild } from '@angular/core'
|
||||
import { ActivatedRoute } from '@angular/router'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
import { IonContent } from '@ionic/angular'
|
||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ActivatedRoute } from '@angular/router'
|
||||
import { IonContent } from '@ionic/angular'
|
||||
import { Subscription } from 'rxjs'
|
||||
import { Metric } from 'src/app/services/api/api.types'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
import { MainStatus } from 'src/app/services/patch-db/data-model'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component, ViewChild } from '@angular/core'
|
||||
import { ActivatedRoute } from '@angular/router'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
import { Subscription } from 'rxjs'
|
||||
import { copyToClipboard } from 'src/app/util/web.util'
|
||||
import { AlertController, IonContent, NavController, PopoverController, ToastController } from '@ionic/angular'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component, ViewChild } from '@angular/core'
|
||||
import { AlertController, NavController, ModalController, IonContent, LoadingController } from '@ionic/angular'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
import { ActivatedRoute, NavigationExtras } from '@angular/router'
|
||||
import { isEmptyObject, Recommendation } from 'src/app/util/misc.util'
|
||||
import { combineLatest, Subscription } from 'rxjs'
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { LoadingController } from '@ionic/angular'
|
||||
import { Subscription } from 'rxjs'
|
||||
import { AuthService } from 'src/app/services/auth.service'
|
||||
import { PatchConnection, PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
|
||||
@Component({
|
||||
selector: 'login',
|
||||
@@ -12,17 +14,26 @@ export class LoginPage {
|
||||
unmasked = false
|
||||
error = ''
|
||||
loader: HTMLIonLoadingElement
|
||||
patchConnectionSub: Subscription
|
||||
|
||||
constructor (
|
||||
private readonly authService: AuthService,
|
||||
private readonly loadingCtrl: LoadingController,
|
||||
private readonly patch: PatchDbService,
|
||||
) { }
|
||||
|
||||
ngOnInit () {
|
||||
|
||||
}
|
||||
|
||||
ngOnDestroy () {
|
||||
if (this.loader) {
|
||||
this.loader.dismiss()
|
||||
this.loader = undefined
|
||||
}
|
||||
if (this.patchConnectionSub) {
|
||||
this.patchConnectionSub.unsubscribe()
|
||||
}
|
||||
}
|
||||
|
||||
toggleMask () {
|
||||
@@ -43,6 +54,12 @@ export class LoginPage {
|
||||
await this.authService.login(this.password)
|
||||
this.loader.message = 'Loading Embassy Data'
|
||||
this.password = ''
|
||||
this.patchConnectionSub = this.patch.watchPatchConnection$().subscribe(status => {
|
||||
if (status === PatchConnection.Disconnected) {
|
||||
this.error = 'Connection failed'
|
||||
this.loader.dismiss()
|
||||
}
|
||||
})
|
||||
} catch (e) {
|
||||
this.error = e.message
|
||||
this.loader.dismiss()
|
||||
|
||||
@@ -7,7 +7,7 @@ import { PackageDataEntry, PackageState } from 'src/app/services/patch-db/data-m
|
||||
import { Subscription } from 'rxjs'
|
||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
import { MarketplaceService } from '../marketplace.service'
|
||||
import { MarketplaceApiService } from 'src/app/services/api/marketplace/marketplace-api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
|
||||
@Component({
|
||||
@@ -39,7 +39,7 @@ export class MarketplaceListPage {
|
||||
|
||||
constructor (
|
||||
private readonly marketplaceService: MarketplaceService,
|
||||
private readonly marketplaceApi: MarketplaceApiService,
|
||||
private readonly api: ApiService,
|
||||
private readonly modalCtrl: ModalController,
|
||||
private readonly errToast: ErrorToastService,
|
||||
private readonly wizardBaker: WizardBaker,
|
||||
@@ -55,8 +55,8 @@ export class MarketplaceListPage {
|
||||
|
||||
try {
|
||||
const [data, eos] = await Promise.all([
|
||||
this.marketplaceApi.getMarketplaceData({ }),
|
||||
this.marketplaceApi.getEos({ }),
|
||||
this.api.getMarketplaceData({ }),
|
||||
this.api.getEos({ }),
|
||||
this.getPkgs(),
|
||||
])
|
||||
this.eos = eos
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { MarketplacePkg } from 'src/app/services/api/api.types'
|
||||
import { MarketplaceApiService } from 'src/app/services/api/marketplace/marketplace-api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
import { Emver } from 'src/app/services/emver.service'
|
||||
import { PackageDataEntry } from 'src/app/services/patch-db/data-model'
|
||||
|
||||
@@ -15,13 +15,13 @@ export class MarketplaceService {
|
||||
} } = { }
|
||||
|
||||
constructor (
|
||||
private readonly marketplaceApi: MarketplaceApiService,
|
||||
private readonly api: ApiService,
|
||||
private readonly emver: Emver,
|
||||
) { }
|
||||
|
||||
async getUpdates (localPkgs: { [id: string]: PackageDataEntry }) : Promise<void> {
|
||||
const idAndCurrentVersions = Object.keys(localPkgs).map(key => ({ id: key, version: localPkgs[key].manifest.version }))
|
||||
const latestPkgs = (await this.marketplaceApi.getMarketplacePkgs({
|
||||
const latestPkgs = (await this.api.getMarketplacePkgs({
|
||||
ids: idAndCurrentVersions,
|
||||
}))
|
||||
|
||||
@@ -35,7 +35,7 @@ export class MarketplaceService {
|
||||
}
|
||||
|
||||
async getPkgs (category: string, query: string, page: number, perPage: number) : Promise<MarketplacePkg[]> {
|
||||
const pkgs = await this.marketplaceApi.getMarketplacePkgs({
|
||||
const pkgs = await this.api.getMarketplacePkgs({
|
||||
category: category !== 'all' ? category : undefined,
|
||||
query,
|
||||
page: String(page),
|
||||
@@ -49,7 +49,7 @@ export class MarketplaceService {
|
||||
}
|
||||
|
||||
async getPkg (id: string, version?: string): Promise<void> {
|
||||
const pkgs = await this.marketplaceApi.getMarketplacePkgs({
|
||||
const pkgs = await this.api.getMarketplacePkgs({
|
||||
ids: [{ id, version: version || '*' }],
|
||||
})
|
||||
const pkg = pkgs[0]
|
||||
@@ -61,7 +61,7 @@ export class MarketplaceService {
|
||||
}
|
||||
|
||||
async getReleaseNotes (id: string): Promise<void> {
|
||||
this.releaseNotes[id] = await this.marketplaceApi.getReleaseNotes({ id })
|
||||
this.releaseNotes[id] = await this.api.getReleaseNotes({ id })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
import { ServerNotification, ServerNotifications } from 'src/app/services/api/api.types'
|
||||
import { AlertController, LoadingController } from '@ionic/angular'
|
||||
import { ActivatedRoute } from '@angular/router'
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Component } from '@angular/core'
|
||||
import { isPlatform, LoadingController, ToastController } from '@ionic/angular'
|
||||
import { copyToClipboard } from 'src/app/util/web.util'
|
||||
import { ConfigService } from 'src/app/services/config.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { Subscription } from 'rxjs'
|
||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
|
||||
@@ -23,8 +23,11 @@
|
||||
</ion-item>
|
||||
|
||||
<ion-item-divider>Other Sessions</ion-item-divider>
|
||||
<div *ngFor="let session of sessionInfo.sessions | keyvalue : asIsOrder">
|
||||
<ion-item *ngIf="session.key !== sessionInfo.current">
|
||||
<div *ngFor="let session of sessionInfo.sessions | keyvalue : asIsOrder;">
|
||||
<ion-item
|
||||
[id]="session.key"
|
||||
*ngIf="session.key !== sessionInfo.current"
|
||||
>
|
||||
<ion-icon slot="start" [name]="getPlatformIcon(session.value.metadata.platforms)"></ion-icon>
|
||||
<ion-label class="ion-text-wrap">
|
||||
<h1>{{ getPlatformName(session.value.metadata.platforms) }}</h1>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
.hide {
|
||||
max-height: 0px !important;
|
||||
transition: max-height .5s ease-out;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { AlertController, LoadingController } from '@ionic/angular'
|
||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
import { PlatformType, RR } from 'src/app/services/api/api.types'
|
||||
|
||||
@Component({
|
||||
@@ -30,7 +30,7 @@ export class SessionsPage {
|
||||
}
|
||||
}
|
||||
|
||||
async presentAlertKill (hash: string) {
|
||||
async presentAlertKill (id: string) {
|
||||
const alert = await this.alertCtrl.create({
|
||||
backdropDismiss: false,
|
||||
header: 'Caution',
|
||||
@@ -43,7 +43,7 @@ export class SessionsPage {
|
||||
{
|
||||
text: 'Kill',
|
||||
handler: () => {
|
||||
this.kill(hash)
|
||||
this.kill(id)
|
||||
},
|
||||
},
|
||||
],
|
||||
@@ -51,7 +51,7 @@ export class SessionsPage {
|
||||
await alert.present()
|
||||
}
|
||||
|
||||
async kill (hash: string): Promise<void> {
|
||||
async kill (id: string): Promise<void> {
|
||||
const loader = await this.loadingCtrl.create({
|
||||
spinner: 'lines',
|
||||
message: 'Killing session...',
|
||||
@@ -60,8 +60,8 @@ export class SessionsPage {
|
||||
await loader.present()
|
||||
|
||||
try {
|
||||
await this.embassyApi.killSessions({ hashes: [hash] })
|
||||
delete this.sessionInfo.sessions[hash]
|
||||
await this.embassyApi.killSessions({ ids: [id] })
|
||||
delete this.sessionInfo.sessions[id]
|
||||
} catch (e) {
|
||||
this.errToast.present(e)
|
||||
} finally {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { BehaviorSubject } from 'rxjs'
|
||||
import { SSHKeys } from 'src/app/services/api/api.types'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { LoadingController, ModalController } from '@ionic/angular'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
import { BackupConfirmationComponent } from 'src/app/modals/backup-confirmation/backup-confirmation.component'
|
||||
import { DiskInfo } from 'src/app/services/api/api.types'
|
||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, ViewChild } from '@angular/core'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
import { IonContent } from '@ionic/angular'
|
||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Component, ViewChild } from '@angular/core'
|
||||
import { IonContent } from '@ionic/angular'
|
||||
import { Metrics } from 'src/app/services/api/api.types'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
import { pauseFor } from 'src/app/util/misc.util'
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { AlertController, LoadingController, NavController } from '@ionic/angular'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
import { ActivatedRoute } from '@angular/router'
|
||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { LoadingController, NavController } from '@ionic/angular'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
import { WifiService } from '../wifi.service'
|
||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { ActionSheetController, LoadingController } from '@ionic/angular'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
import { ActionSheetButton } from '@ionic/core'
|
||||
import { WifiService } from './wifi.service'
|
||||
import { WiFiInfo } from 'src/app/services/patch-db/data-model'
|
||||
|
||||
Reference in New Issue
Block a user