mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
bring back startup alerts
This commit is contained in:
committed by
Aiden McClelland
parent
48632271d5
commit
301a19d644
@@ -14,6 +14,7 @@
|
||||
},
|
||||
"mocks": {
|
||||
"enabled": true,
|
||||
"marketplace": true,
|
||||
"connection": "ws",
|
||||
"rpcPort": "5959",
|
||||
"wsPort": "5960",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { Storage } from '@ionic/storage'
|
||||
import { AuthService, AuthState } from './services/auth.service'
|
||||
import { ApiService } from './services/api/api.service'
|
||||
import { ApiService } from './services/api/embassy/embassy-api.service'
|
||||
import { Router, RoutesRecognized } from '@angular/router'
|
||||
import { debounceTime, distinctUntilChanged, filter, finalize, takeWhile } from 'rxjs/operators'
|
||||
import { AlertController, IonicSafeString, ToastController } from '@ionic/angular'
|
||||
@@ -9,10 +9,11 @@ import { LoaderService } from './services/loader.service'
|
||||
import { Emver } from './services/emver.service'
|
||||
import { SplitPaneTracker } from './services/split-pane.service'
|
||||
import { LoadingOptions, ToastButton } from '@ionic/core'
|
||||
import { PatchDbModel } from './services/patch-db/patch-db.service'
|
||||
import { PatchDbService } from './services/patch-db/patch-db.service'
|
||||
import { HttpService } from './services/http.service'
|
||||
import { ServerStatus } from './services/patch-db/data-model'
|
||||
import { ConnectionFailure, ConnectionService } from './services/connection.service'
|
||||
import { StartupAlertsService } from './services/startup-alerts.service'
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
@@ -59,8 +60,9 @@ export class AppComponent {
|
||||
private readonly loader: LoaderService,
|
||||
private readonly emver: Emver,
|
||||
private readonly connectionService: ConnectionService,
|
||||
private readonly startupAlertsService: StartupAlertsService,
|
||||
private readonly toastCtrl: ToastController,
|
||||
private readonly patch: PatchDbModel,
|
||||
private readonly patch: PatchDbService,
|
||||
readonly splitPane: SplitPaneTracker,
|
||||
) {
|
||||
// set dark theme
|
||||
@@ -93,6 +95,8 @@ export class AppComponent {
|
||||
this.watchStatus(auth)
|
||||
// watch unread notification count to display toast
|
||||
this.watchNotifications(auth)
|
||||
// run startup alerts
|
||||
this.startupAlertsService.runChecks()
|
||||
// UNVERIFIED
|
||||
} else if (auth === AuthState.UNVERIFIED) {
|
||||
this.http.authReqEnabled = false
|
||||
|
||||
@@ -7,20 +7,20 @@ import { IonicStorageModule } from '@ionic/storage-angular'
|
||||
import { HttpClientModule } from '@angular/common/http'
|
||||
import { AppComponent } from './app.component'
|
||||
import { AppRoutingModule } from './app-routing.module'
|
||||
import { ApiService } from './services/api/api.service'
|
||||
import { ApiService } from './services/api/embassy/embassy-api.service'
|
||||
import { ApiServiceFactory, MarketplaceApiServiceFactory } from './services/api/api.service.factory'
|
||||
import { PatchDbModelFactory } from './services/patch-db/patch-db.factory'
|
||||
import { PatchDbServiceFactory } from './services/patch-db/patch-db.factory'
|
||||
import { HttpService } from './services/http.service'
|
||||
import { ConfigService } from './services/config.service'
|
||||
import { QRCodeModule } from 'angularx-qrcode'
|
||||
import { appConfigComponents } from './modals/app-config-injectable'
|
||||
import { OSWelcomePageModule } from './modals/os-welcome/os-welcome.module'
|
||||
import { MarkdownPageModule } from './modals/markdown/markdown.module'
|
||||
import { PatchDbModel } from './services/patch-db/patch-db.service'
|
||||
import { PatchDbService } from './services/patch-db/patch-db.service'
|
||||
import { LocalStorageBootstrap } from './services/patch-db/local-storage-bootstrap'
|
||||
import { SharingModule } from './modules/sharing.module'
|
||||
import { APP_CONFIG_COMPONENT_MAPPING } from './services/tracking-modal-controller.service'
|
||||
import { MarketplaceApiService } from './services/api/marketplace-api.service'
|
||||
import { MarketplaceApiService } from './services/api/marketplace/marketplace-api.service'
|
||||
|
||||
@NgModule({
|
||||
declarations: [AppComponent],
|
||||
@@ -45,8 +45,8 @@ import { MarketplaceApiService } from './services/api/marketplace-api.service'
|
||||
Storage,
|
||||
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
|
||||
{ provide: ApiService , useFactory: ApiServiceFactory, deps: [ConfigService, HttpService] }, { provide: ApiService , useFactory: ApiServiceFactory, deps: [ConfigService, HttpService] },
|
||||
{ provide: MarketplaceApiService , useFactory: MarketplaceApiServiceFactory, deps: [ConfigService, HttpService, PatchDbModel] },
|
||||
{ provide: PatchDbModel, useFactory: PatchDbModelFactory, deps: [ConfigService, LocalStorageBootstrap, ApiService] },
|
||||
{ provide: MarketplaceApiService , useFactory: MarketplaceApiServiceFactory, deps: [ConfigService, HttpService, PatchDbService] },
|
||||
{ provide: PatchDbService, useFactory: PatchDbServiceFactory, deps: [ConfigService, LocalStorageBootstrap, ApiService] },
|
||||
{ provide: APP_CONFIG_COMPONENT_MAPPING, useValue: appConfigComponents },
|
||||
],
|
||||
bootstrap: [AppComponent],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { SplitPaneTracker } from 'src/app/services/split-pane.service'
|
||||
import { PatchDbModel } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { combineLatest, Subscription } from 'rxjs'
|
||||
|
||||
@Component({
|
||||
@@ -17,7 +17,7 @@ export class BadgeMenuComponent {
|
||||
|
||||
constructor (
|
||||
private readonly splitPane: SplitPaneTracker,
|
||||
private readonly patch: PatchDbModel,
|
||||
private readonly patch: PatchDbService,
|
||||
) { }
|
||||
|
||||
ngOnInit () {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Component, Input, OnInit } from '@angular/core'
|
||||
import { BehaviorSubject, from, Subject } from 'rxjs'
|
||||
import { takeUntil, tap } from 'rxjs/operators'
|
||||
import { Breakages } from 'src/app/services/api/api-types'
|
||||
import { Breakages } from 'src/app/services/api/api.types'
|
||||
import { markAsLoadingDuring$ } from 'src/app/services/loader.service'
|
||||
import { capitalizeFirstLetter, isEmptyObject } from 'src/app/util/misc.util'
|
||||
import { Loadable } from '../loadable'
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<div class="slide-content">
|
||||
<div style="margin-top: 25px;">
|
||||
<div style="margin: 15px; display: flex; justify-content: center; align-items: center;">
|
||||
<ion-label [color]="params.titleColor" style="font-size: xx-large; font-weight: bold;">
|
||||
{{ params.title }}
|
||||
<ion-label [color]="params.titleColor">
|
||||
<h1>{{ params.title }}</h1>
|
||||
<h2>{{ params.headline }}</h2>
|
||||
</ion-label>
|
||||
</div>
|
||||
<div *ngFor="let note of params.notes | keyvalue : asIsOrder">
|
||||
|
||||
@@ -12,6 +12,7 @@ export class NotesComponent implements OnInit, Loadable {
|
||||
notes: { [version: string]: string }
|
||||
title: string
|
||||
titleColor: string
|
||||
headline: string
|
||||
}
|
||||
|
||||
loading$ = new BehaviorSubject(false)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { PackageDataEntry } from 'src/app/services/patch-db/data-model'
|
||||
import { Breakages } from 'src/app/services/api/api-types'
|
||||
import { Breakages } from 'src/app/services/api/api.types'
|
||||
import { exists } from 'src/app/util/misc.util'
|
||||
import { ApiService } from '../../services/api/api.service'
|
||||
import { ApiService } from '../../services/api/embassy/embassy-api.service'
|
||||
import { InstallWizardComponent, SlideDefinition, TopbarParams } from './install-wizard.component'
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
@@ -12,7 +12,10 @@ export class WizardBaker {
|
||||
) { }
|
||||
|
||||
install (values: {
|
||||
id: string, title: string, version: string, installAlert?: string
|
||||
id: string
|
||||
title: string
|
||||
version: string
|
||||
installAlert?: string
|
||||
}): InstallWizardComponent['params'] {
|
||||
const { id, title, version, installAlert } = values
|
||||
|
||||
@@ -53,7 +56,10 @@ export class WizardBaker {
|
||||
}
|
||||
|
||||
update (values: {
|
||||
id: string, title: string, version: string, installAlert?: string
|
||||
id: string
|
||||
title: string
|
||||
version: string
|
||||
installAlert?: string
|
||||
}): InstallWizardComponent['params'] {
|
||||
const { id, title, version, installAlert } = values
|
||||
|
||||
@@ -111,9 +117,11 @@ export class WizardBaker {
|
||||
}
|
||||
|
||||
updateOS (values: {
|
||||
version: string, releaseNotes: { [version: string]: string }
|
||||
version: string
|
||||
releaseNotes: { [version: string]: string }
|
||||
headline: string
|
||||
}): InstallWizardComponent['params'] {
|
||||
const { version, releaseNotes } = values
|
||||
const { version, releaseNotes, headline } = values
|
||||
|
||||
const action = 'update'
|
||||
const title = 'EmbassyOS'
|
||||
@@ -127,6 +135,7 @@ export class WizardBaker {
|
||||
notes: releaseNotes,
|
||||
title: 'Release Notes',
|
||||
titleColor: 'dark',
|
||||
headline,
|
||||
},
|
||||
},
|
||||
bottomBar: {
|
||||
@@ -153,7 +162,10 @@ export class WizardBaker {
|
||||
}
|
||||
|
||||
downgrade (values: {
|
||||
id: string, title: string, version: string, installAlert?: string
|
||||
id: string
|
||||
title: string
|
||||
version: string
|
||||
installAlert?: string
|
||||
}): InstallWizardComponent['params'] {
|
||||
const { id, title, version, installAlert } = values
|
||||
|
||||
@@ -205,7 +217,10 @@ export class WizardBaker {
|
||||
}
|
||||
|
||||
uninstall (values: {
|
||||
id: string, title: string, version: string, uninstallAlert?: string
|
||||
id: string
|
||||
title: string
|
||||
version: string
|
||||
uninstallAlert?: string
|
||||
}): InstallWizardComponent['params'] {
|
||||
const { id, title, version, uninstallAlert } = values
|
||||
|
||||
@@ -253,7 +268,10 @@ export class WizardBaker {
|
||||
}
|
||||
|
||||
stop (values: {
|
||||
breakages: Breakages, id: string, title: string, version: string
|
||||
id: string
|
||||
title: string
|
||||
version: string
|
||||
breakages: Breakages
|
||||
}): InstallWizardComponent['params'] {
|
||||
const { breakages, title, version } = values
|
||||
|
||||
@@ -277,7 +295,10 @@ export class WizardBaker {
|
||||
return { toolbar, slideDefinitions }
|
||||
}
|
||||
|
||||
configure (values: { breakages: Breakages, pkg: PackageDataEntry }): InstallWizardComponent['params'] {
|
||||
configure (values: {
|
||||
pkg: PackageDataEntry
|
||||
breakages: Breakages
|
||||
}): InstallWizardComponent['params'] {
|
||||
const { breakages, pkg } = values
|
||||
const { title, version } = pkg.manifest
|
||||
const action = 'configure'
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'
|
||||
import { CanActivate, Router, CanActivateChild } from '@angular/router'
|
||||
import { tap } from 'rxjs/operators'
|
||||
import { ServerStatus } from '../services/patch-db/data-model'
|
||||
import { PatchDbModel } from '../services/patch-db/patch-db.service'
|
||||
import { PatchDbService } from '../services/patch-db/patch-db.service'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
@@ -10,7 +10,7 @@ import { PatchDbModel } from '../services/patch-db/patch-db.service'
|
||||
export class MaintenanceGuard implements CanActivate, CanActivateChild {
|
||||
constructor (
|
||||
private readonly router: Router,
|
||||
private readonly patch: PatchDbModel,
|
||||
private readonly patch: PatchDbService,
|
||||
) { }
|
||||
|
||||
canActivate (): boolean {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'
|
||||
import { CanActivate, Router } from '@angular/router'
|
||||
import { tap } from 'rxjs/operators'
|
||||
import { ServerStatus } from '../services/patch-db/data-model'
|
||||
import { PatchDbModel } from '../services/patch-db/patch-db.service'
|
||||
import { PatchDbService } from '../services/patch-db/patch-db.service'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
@@ -12,7 +12,7 @@ export class UnmaintenanceGuard implements CanActivate {
|
||||
|
||||
constructor (
|
||||
private readonly router: Router,
|
||||
private readonly patch: PatchDbModel,
|
||||
private readonly patch: PatchDbService,
|
||||
) {
|
||||
this.patch.sequence$.subscribe(_ => {
|
||||
this.serverStatus = this.patch.data['server-info'].status
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component, Input } from '@angular/core'
|
||||
import { ModalController } from '@ionic/angular'
|
||||
import { ApiService } from 'src/app/services/api/api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
|
||||
@Component({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component, Input } from '@angular/core'
|
||||
import { ModalController } from '@ionic/angular'
|
||||
import { ApiService } from 'src/app/services/api/api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { ConfigService } from 'src/app/services/config.service'
|
||||
|
||||
@Component({
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Component, ViewChild } from '@angular/core'
|
||||
import { ActivatedRoute } from '@angular/router'
|
||||
import { ApiService } from 'src/app/services/api/api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { AlertController, IonContent, ModalController, NavController } from '@ionic/angular'
|
||||
import { LoaderService } from 'src/app/services/loader.service'
|
||||
import { HttpErrorResponse } from '@angular/common/http'
|
||||
import { PatchDbModel } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { Action, Manifest, PackageDataEntry, PackageMainStatus } from 'src/app/services/patch-db/data-model'
|
||||
import { wizardModal } from 'src/app/components/install-wizard/install-wizard.component'
|
||||
import { WizardBaker } from 'src/app/components/install-wizard/prebaked-wizards'
|
||||
@@ -32,7 +32,7 @@ export class AppActionsPage {
|
||||
private readonly loaderService: LoaderService,
|
||||
private readonly wizardBaker: WizardBaker,
|
||||
private readonly navCtrl: NavController,
|
||||
public readonly patch: PatchDbModel,
|
||||
public readonly patch: PatchDbService,
|
||||
) { }
|
||||
|
||||
ngOnInit () {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Component, ViewChild } from '@angular/core'
|
||||
import { NavController, AlertController, ModalController, IonContent } from '@ionic/angular'
|
||||
import { ActivatedRoute } from '@angular/router'
|
||||
import { ApiService } from 'src/app/services/api/api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { isEmptyObject, Recommendation } from 'src/app/util/misc.util'
|
||||
import { LoaderService } from 'src/app/services/loader.service'
|
||||
import { TrackingModalController } from 'src/app/services/tracking-modal-controller.service'
|
||||
@@ -12,7 +12,7 @@ import { WizardBaker } from 'src/app/components/install-wizard/prebaked-wizards'
|
||||
import { ConfigSpec } from 'src/app/pkg-config/config-types'
|
||||
import { ConfigCursor } from 'src/app/pkg-config/config-cursor'
|
||||
import { PackageDataEntry, PackageState } from 'src/app/services/patch-db/data-model'
|
||||
import { PatchDbModel } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
|
||||
@Component({
|
||||
selector: 'app-config',
|
||||
@@ -55,7 +55,7 @@ export class AppConfigPage {
|
||||
private readonly alertCtrl: AlertController,
|
||||
private readonly modalController: ModalController,
|
||||
private readonly trackingModalCtrl: TrackingModalController,
|
||||
private readonly patch: PatchDbModel,
|
||||
private readonly patch: PatchDbService,
|
||||
) { }
|
||||
|
||||
async ngOnInit () {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Component, ViewChild } from '@angular/core'
|
||||
import { ActivatedRoute } from '@angular/router'
|
||||
import { IonContent } from '@ionic/angular'
|
||||
import { PatchDbModel } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { ApiService } from 'src/app/services/api/api.service'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
|
||||
@Component({
|
||||
@@ -20,7 +20,7 @@ export class AppInstructionsPage {
|
||||
private readonly route: ActivatedRoute,
|
||||
private readonly errToast: ErrorToastService,
|
||||
private readonly apiService: ApiService,
|
||||
private readonly patch: PatchDbModel,
|
||||
private readonly patch: PatchDbService,
|
||||
) { }
|
||||
|
||||
async ngOnInit () {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ActivatedRoute } from '@angular/router'
|
||||
import { IonContent, ToastController } from '@ionic/angular'
|
||||
import { Subscription } from 'rxjs'
|
||||
import { InstalledPackageDataEntry, PackageDataEntry } from 'src/app/services/patch-db/data-model'
|
||||
import { PatchDbModel } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { ConfigService } from 'src/app/services/config.service'
|
||||
import { copyToClipboard } from 'src/app/util/web.util'
|
||||
|
||||
@@ -22,7 +22,7 @@ export class AppInterfacesPage {
|
||||
private readonly route: ActivatedRoute,
|
||||
private readonly toastCtrl: ToastController,
|
||||
private readonly config: ConfigService,
|
||||
public readonly patch: PatchDbModel,
|
||||
public readonly patch: PatchDbService,
|
||||
) { }
|
||||
|
||||
ngOnInit () {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { ConfigService } from 'src/app/services/config.service'
|
||||
import { ConnectionService } from 'src/app/services/connection.service'
|
||||
import { PatchDbModel } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { PackageDataEntry } from 'src/app/services/patch-db/data-model'
|
||||
import { combineLatest, Subscription } from 'rxjs'
|
||||
import { PkgStatusRendering, renderPkgStatus } from 'src/app/services/pkg-status-rendering.service'
|
||||
@@ -25,7 +25,7 @@ export class AppListPage {
|
||||
constructor (
|
||||
private readonly config: ConfigService,
|
||||
public readonly connectionService: ConnectionService,
|
||||
public readonly patch: PatchDbModel,
|
||||
public readonly patch: PatchDbService,
|
||||
) { }
|
||||
|
||||
ngOnInit () {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component, ViewChild } from '@angular/core'
|
||||
import { ActivatedRoute } from '@angular/router'
|
||||
import { ApiService } from 'src/app/services/api/api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { IonContent } from '@ionic/angular'
|
||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Component, ViewChild } from '@angular/core'
|
||||
import { ActivatedRoute } from '@angular/router'
|
||||
import { Subscription } from 'rxjs'
|
||||
import { PackageDataEntry } from 'src/app/services/patch-db/data-model'
|
||||
import { PatchDbModel } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { getManifest } from 'src/app/services/config.service'
|
||||
import * as JsonPointer from 'json-pointer'
|
||||
import { IonContent } from '@ionic/angular'
|
||||
@@ -23,7 +23,7 @@ export class AppManifestPage {
|
||||
|
||||
constructor (
|
||||
private readonly route: ActivatedRoute,
|
||||
private readonly patch: PatchDbModel,
|
||||
private readonly patch: PatchDbService,
|
||||
) { }
|
||||
|
||||
ngOnInit () {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Component, ViewChild } from '@angular/core'
|
||||
import { ActivatedRoute } from '@angular/router'
|
||||
import { IonContent } from '@ionic/angular'
|
||||
import { Metric } from 'src/app/services/api/api-types'
|
||||
import { ApiService } from 'src/app/services/api/api.service'
|
||||
import { Metric } from 'src/app/services/api/api.types'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
import { PackageDataEntry } from 'src/app/services/patch-db/data-model'
|
||||
import { PatchDbModel } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { pauseFor } from 'src/app/util/misc.util'
|
||||
|
||||
@Component({
|
||||
@@ -25,7 +25,7 @@ export class AppMetricsPage {
|
||||
constructor (
|
||||
private readonly route: ActivatedRoute,
|
||||
private readonly errToast: ErrorToastService,
|
||||
private readonly patch: PatchDbModel,
|
||||
private readonly patch: PatchDbService,
|
||||
private readonly apiService: ApiService,
|
||||
) { }
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { Component, ViewChild } from '@angular/core'
|
||||
import { ActivatedRoute } from '@angular/router'
|
||||
import { ApiService } from 'src/app/services/api/api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { Subscription } from 'rxjs'
|
||||
import { copyToClipboard } from 'src/app/util/web.util'
|
||||
import { AlertController, IonContent, NavController, PopoverController, ToastController } from '@ionic/angular'
|
||||
import { PackageProperties } from 'src/app/util/properties.util'
|
||||
import { QRComponent } from 'src/app/components/qr/qr.component'
|
||||
import { PatchDbModel } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { PackageMainStatus } from 'src/app/services/patch-db/data-model'
|
||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
import * as JsonPointer from 'json-pointer'
|
||||
@@ -36,7 +36,7 @@ export class AppPropertiesPage {
|
||||
private readonly toastCtrl: ToastController,
|
||||
private readonly popoverCtrl: PopoverController,
|
||||
private readonly navCtrl: NavController,
|
||||
private readonly patch: PatchDbModel,
|
||||
private readonly patch: PatchDbService,
|
||||
) { }
|
||||
|
||||
async ngOnInit () {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Component, ViewChild } from '@angular/core'
|
||||
import { IonContent, LoadingController, ModalController } from '@ionic/angular'
|
||||
import { ApiService } from 'src/app/services/api/api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { BackupConfirmationComponent } from 'src/app/modals/backup-confirmation/backup-confirmation.component'
|
||||
import { DiskInfo } 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 { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { Subscription } from 'rxjs'
|
||||
|
||||
@Component({
|
||||
@@ -28,7 +28,7 @@ export class AppRestorePage {
|
||||
private readonly modalCtrl: ModalController,
|
||||
private readonly apiService: ApiService,
|
||||
private readonly loadingCtrl: LoadingController,
|
||||
private readonly patch: PatchDbModel,
|
||||
private readonly patch: PatchDbService,
|
||||
) { }
|
||||
|
||||
ngOnInit () {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component, ViewChild } from '@angular/core'
|
||||
import { AlertController, NavController, ModalController, IonContent } from '@ionic/angular'
|
||||
import { ApiService } from 'src/app/services/api/api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { ActivatedRoute, NavigationExtras } from '@angular/router'
|
||||
import { chill, isEmptyObject, Recommendation } from 'src/app/util/misc.util'
|
||||
import { LoaderService } from 'src/app/services/loader.service'
|
||||
@@ -8,7 +8,7 @@ import { combineLatest, Observable, of, Subscription } from 'rxjs'
|
||||
import { wizardModal } from 'src/app/components/install-wizard/install-wizard.component'
|
||||
import { WizardBaker } from 'src/app/components/install-wizard/prebaked-wizards'
|
||||
import { ConfigService } from 'src/app/services/config.service'
|
||||
import { PatchDbModel } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { DependencyErrorConfigUnsatisfied, DependencyErrorNotInstalled, DependencyErrorType, PackageDataEntry, PackageState } from 'src/app/services/patch-db/data-model'
|
||||
import { FEStatus, PkgStatusRendering, renderPkgStatus } from 'src/app/services/pkg-status-rendering.service'
|
||||
import { ConnectionService } from 'src/app/services/connection.service'
|
||||
@@ -43,7 +43,7 @@ export class AppShowPage {
|
||||
private readonly apiService: ApiService,
|
||||
private readonly wizardBaker: WizardBaker,
|
||||
private readonly config: ConfigService,
|
||||
public readonly patch: PatchDbModel,
|
||||
public readonly patch: PatchDbService,
|
||||
public readonly connectionService: ConnectionService,
|
||||
) { }
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { ServerStatus } from 'src/app/services/patch-db/data-model'
|
||||
import { PatchDbModel } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
|
||||
@Component({
|
||||
selector: 'Maintenance',
|
||||
@@ -11,7 +11,7 @@ export class MaintenancePage {
|
||||
ServerStatus = ServerStatus
|
||||
|
||||
constructor (
|
||||
public readonly patch: PatchDbModel,
|
||||
public readonly patch: PatchDbService,
|
||||
) { }
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { Component, ViewChild } from '@angular/core'
|
||||
import { MarketplaceData, MarketplaceEOS, MarketplacePkg } from 'src/app/services/api/api-types'
|
||||
import { MarketplaceData, MarketplaceEOS, MarketplacePkg } from 'src/app/services/api/api.types'
|
||||
import { wizardModal } from 'src/app/components/install-wizard/install-wizard.component'
|
||||
import { IonContent, ModalController } from '@ionic/angular'
|
||||
import { WizardBaker } from 'src/app/components/install-wizard/prebaked-wizards'
|
||||
import { PatchDbModel } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { PackageState } from 'src/app/services/patch-db/data-model'
|
||||
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-api.service'
|
||||
import { MarketplaceApiService } from 'src/app/services/api/marketplace/marketplace-api.service'
|
||||
|
||||
@Component({
|
||||
selector: 'marketplace-list',
|
||||
@@ -41,7 +41,7 @@ export class MarketplaceListPage {
|
||||
private readonly modalCtrl: ModalController,
|
||||
private readonly errToast: ErrorToastService,
|
||||
private readonly wizardBaker: WizardBaker,
|
||||
public readonly patch: PatchDbModel,
|
||||
public readonly patch: PatchDbService,
|
||||
) { }
|
||||
|
||||
async ngOnInit () {
|
||||
@@ -91,6 +91,7 @@ export class MarketplaceListPage {
|
||||
this.modalCtrl,
|
||||
this.wizardBaker.updateOS({
|
||||
version: this.eos.version,
|
||||
headline: this.eos.headline,
|
||||
releaseNotes: this.eos['release-notes'],
|
||||
}),
|
||||
)
|
||||
|
||||
@@ -6,7 +6,7 @@ import { WizardBaker } from 'src/app/components/install-wizard/prebaked-wizards'
|
||||
import { Emver } from 'src/app/services/emver.service'
|
||||
import { displayEmver } from 'src/app/pipes/emver.pipe'
|
||||
import { pauseFor, Recommendation } from 'src/app/util/misc.util'
|
||||
import { PatchDbModel } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
import { PackageDataEntry, PackageState } from 'src/app/services/patch-db/data-model'
|
||||
import { MarketplaceService } from '../marketplace.service'
|
||||
@@ -37,7 +37,7 @@ export class MarketplaceShowPage {
|
||||
private readonly wizardBaker: WizardBaker,
|
||||
private readonly navCtrl: NavController,
|
||||
private readonly emver: Emver,
|
||||
private readonly patch: PatchDbModel,
|
||||
private readonly patch: PatchDbService,
|
||||
private readonly marketplaceService: MarketplaceService,
|
||||
) { }
|
||||
|
||||
|
||||
@@ -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-api.service'
|
||||
import { MarketplacePkg } from 'src/app/services/api/api.types'
|
||||
import { MarketplaceApiService } from 'src/app/services/api/marketplace/marketplace-api.service'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { ApiService } from 'src/app/services/api/api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { LoaderService } from 'src/app/services/loader.service'
|
||||
import { ServerNotification, ServerNotifications } from 'src/app/services/api/api-types'
|
||||
import { ServerNotification, ServerNotifications } from 'src/app/services/api/api.types'
|
||||
import { AlertController } from '@ionic/angular'
|
||||
import { ActivatedRoute } from '@angular/router'
|
||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { ServerConfigService } from 'src/app/services/server-config.service'
|
||||
import { PatchDbModel } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
|
||||
@Component({
|
||||
selector: 'dev-options',
|
||||
@@ -11,7 +11,7 @@ export class DevOptionsPage {
|
||||
|
||||
constructor (
|
||||
private readonly serverConfigService: ServerConfigService,
|
||||
public readonly patch: PatchDbModel,
|
||||
public readonly patch: PatchDbService,
|
||||
) { }
|
||||
|
||||
async presentModalValueEdit (key: string, current?: any): Promise<void> {
|
||||
|
||||
@@ -4,7 +4,7 @@ import { AlertController } from '@ionic/angular'
|
||||
import { LoaderService } from 'src/app/services/loader.service'
|
||||
import { SSHService } from './ssh.service'
|
||||
import { Subscription } from 'rxjs'
|
||||
import { SSHKeys } from 'src/app/services/api/api-types'
|
||||
import { SSHKeys } from 'src/app/services/api/api.types'
|
||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
|
||||
@Component({
|
||||
|
||||
@@ -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/api.service'
|
||||
import { SSHKeys } from 'src/app/services/api/api.types'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
|
||||
@@ -3,8 +3,8 @@ import { isPlatform, ToastController } from '@ionic/angular'
|
||||
import { copyToClipboard } from 'src/app/util/web.util'
|
||||
import { ConfigService } from 'src/app/services/config.service'
|
||||
import { LoaderService } from 'src/app/services/loader.service'
|
||||
import { ApiService } from 'src/app/services/api/api.service'
|
||||
import { PatchDbModel } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { Subscription } from 'rxjs'
|
||||
|
||||
@Component({
|
||||
@@ -27,7 +27,7 @@ export class LANPage {
|
||||
private readonly config: ConfigService,
|
||||
private readonly loader: LoaderService,
|
||||
private readonly apiService: ApiService,
|
||||
private readonly patch: PatchDbModel,
|
||||
private readonly patch: PatchDbService,
|
||||
) { }
|
||||
|
||||
ngOnInit () {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { ServerConfigService } from 'src/app/services/server-config.service'
|
||||
import { PatchDbModel } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { Subscription } from 'rxjs'
|
||||
import { ConfigService } from 'src/app/services/config.service'
|
||||
|
||||
@@ -15,7 +15,7 @@ export class PrivacyPage {
|
||||
constructor (
|
||||
private readonly serverConfigService: ServerConfigService,
|
||||
public readonly config: ConfigService,
|
||||
public readonly patch: PatchDbModel,
|
||||
public readonly patch: PatchDbService,
|
||||
) { }
|
||||
|
||||
async presentModalValueEdit (key: string, current?: string): Promise<void> {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { LoadingController, ModalController } from '@ionic/angular'
|
||||
import { ApiService } from 'src/app/services/api/api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { BackupConfirmationComponent } from 'src/app/modals/backup-confirmation/backup-confirmation.component'
|
||||
import { DiskInfo } from 'src/app/services/api/api-types'
|
||||
import { DiskInfo } from 'src/app/services/api/api.types'
|
||||
|
||||
@Component({
|
||||
selector: 'server-backup',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, ViewChild } from '@angular/core'
|
||||
import { ApiService } from 'src/app/services/api/api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { IonContent } from '@ionic/angular'
|
||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { Metrics } from 'src/app/services/api/api-types'
|
||||
import { ApiService } from 'src/app/services/api/api.service'
|
||||
import { Metrics } from 'src/app/services/api/api.types'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
import { pauseFor } from 'src/app/util/misc.util'
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { LoadingOptions } from '@ionic/core'
|
||||
import { AlertController, NavController } from '@ionic/angular'
|
||||
import { ApiService } from 'src/app/services/api/api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { LoaderService } from 'src/app/services/loader.service'
|
||||
import { ActivatedRoute } from '@angular/router'
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { ToastController } from '@ionic/angular'
|
||||
import { copyToClipboard } from 'src/app/util/web.util'
|
||||
import { PatchDbModel } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { Subscription } from 'rxjs'
|
||||
|
||||
@Component({
|
||||
@@ -14,7 +14,7 @@ export class ServerSpecsPage {
|
||||
|
||||
constructor (
|
||||
private readonly toastCtrl: ToastController,
|
||||
public readonly patch: PatchDbModel,
|
||||
public readonly patch: PatchDbService,
|
||||
) { }
|
||||
|
||||
async copy (address: string) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { NavController } from '@ionic/angular'
|
||||
import { ApiService } from 'src/app/services/api/api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { WifiService } from '../wifi.service'
|
||||
import { LoaderService } from 'src/app/services/loader.service'
|
||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { ActionSheetController } from '@ionic/angular'
|
||||
import { ApiService } from 'src/app/services/api/api.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
import { ActionSheetButton } from '@ionic/core'
|
||||
import { WifiService } from './wifi.service'
|
||||
import { LoaderService } from 'src/app/services/loader.service'
|
||||
import { WiFiInfo } from 'src/app/services/patch-db/data-model'
|
||||
import { PatchDbModel } from 'src/app/services/patch-db/patch-db.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,7 +23,7 @@ export class WifiListPage {
|
||||
private readonly errToast: ErrorToastService,
|
||||
private readonly actionCtrl: ActionSheetController,
|
||||
private readonly wifiService: WifiService,
|
||||
public readonly patch: PatchDbModel,
|
||||
public readonly patch: PatchDbService,
|
||||
) { }
|
||||
|
||||
async presentAction (ssid: string, wifi: WiFiInfo) {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'
|
||||
import { AlertController, ToastController } from '@ionic/angular'
|
||||
import { merge, Observable, timer } from 'rxjs'
|
||||
import { filter, map, take, tap } from 'rxjs/operators'
|
||||
import { PatchDbModel } from 'src/app/services/patch-db/patch-db.service'
|
||||
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
@@ -12,7 +12,7 @@ export class WifiService {
|
||||
constructor (
|
||||
private readonly toastCtrl: ToastController,
|
||||
private readonly alertCtrl: AlertController,
|
||||
private readonly patch: PatchDbModel,
|
||||
private readonly patch: PatchDbService,
|
||||
) { }
|
||||
|
||||
confirmWifi (ssid: string): Observable<boolean> {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core'
|
||||
import { NotificationLevel, ServerNotification } from '../services/api/api-types'
|
||||
import { NotificationLevel, ServerNotification } from '../services/api/api.types'
|
||||
|
||||
@Pipe({
|
||||
name: 'notificationColor',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core'
|
||||
import { combineLatest, Observable } from 'rxjs'
|
||||
import { map } from 'rxjs/operators'
|
||||
import { PatchDbModel } from '../services/patch-db/patch-db.service'
|
||||
import { PatchDbService } from '../services/patch-db/patch-db.service'
|
||||
import { FEStatus, renderPkgStatus } from '../services/pkg-status-rendering.service'
|
||||
|
||||
@Pipe({
|
||||
@@ -10,7 +10,7 @@ import { FEStatus, renderPkgStatus } from '../services/pkg-status-rendering.serv
|
||||
export class StatusPipe implements PipeTransform {
|
||||
|
||||
constructor (
|
||||
private readonly patch: PatchDbModel,
|
||||
private readonly patch: PatchDbService,
|
||||
) { }
|
||||
|
||||
transform (pkgId: string): Observable<FEStatus> {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { DependencyErrorType, DockerIoFormat, Manifest, PackageDataEntry, PackageMainStatus, PackageState, ServerStatus } from 'src/app/services/patch-db/data-model'
|
||||
import { MarketplacePkg, Metric, NotificationLevel, RR, ServerNotification, ServerNotifications } from './api-types'
|
||||
import { MarketplacePkg, Metric, NotificationLevel, RR, ServerNotification, ServerNotifications } from './api.types'
|
||||
|
||||
export module Mock {
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import { HttpService } from '../http.service'
|
||||
import { MockApiService } from './mock-api.service'
|
||||
import { LiveApiService } from './live-api.service'
|
||||
import { MockApiService } from './embassy/embassy-mock-api.service'
|
||||
import { LiveApiService } from './embassy/embassy-live-api.service'
|
||||
import { ConfigService } from '../config.service'
|
||||
import { PatchDbModel } from '../patch-db/patch-db.service'
|
||||
import { MarketplaceLiveApiService } from './marketplace-live-api.service'
|
||||
import { MarketplaceMockApiService } from './marketplace-mock-api.service'
|
||||
import { PatchDbService } from '../patch-db/patch-db.service'
|
||||
import { MarketplaceLiveApiService } from './marketplace/marketplace-live-api.service'
|
||||
import { MarketplaceMockApiService } from './marketplace/marketplace-mock-api.service'
|
||||
|
||||
export function ApiServiceFactory (config: ConfigService, http: HttpService) {
|
||||
if (config.mocks.enabled) {
|
||||
return new MockApiService(config, http)
|
||||
return new MockApiService(http, config)
|
||||
} else {
|
||||
return new LiveApiService(config, http)
|
||||
return new LiveApiService(http, config)
|
||||
}
|
||||
}
|
||||
|
||||
export function MarketplaceApiServiceFactory (config: ConfigService, http: HttpService, patch: PatchDbModel) {
|
||||
export function MarketplaceApiServiceFactory (config: ConfigService, http: HttpService, patch: PatchDbService) {
|
||||
if (config.mocks.enabled) {
|
||||
return new MarketplaceMockApiService(http, patch)
|
||||
return new MarketplaceMockApiService(http, config, patch)
|
||||
} else {
|
||||
return new MarketplaceLiveApiService(http, patch)
|
||||
return new MarketplaceLiveApiService(http, config, patch)
|
||||
}
|
||||
}
|
||||
@@ -167,7 +167,17 @@ export module RR {
|
||||
export type GetMarketplaceEOSReq = { }
|
||||
export type GetMarketplaceEOSRes = MarketplaceEOS
|
||||
|
||||
export type GetMarketplacePackagesReq = { id?: string, version?: string, category?: string, query?: string, page?: string, 'per-page'?: string }
|
||||
export type GetMarketplacePackagesReq = {
|
||||
ids?: string[]
|
||||
id?: string
|
||||
// iff id
|
||||
version?: string
|
||||
// iff !id
|
||||
category?: string
|
||||
query?: string
|
||||
page?: string
|
||||
'per-page'?: string
|
||||
}
|
||||
export type GetMarketplacePackagesRes = MarketplacePkg[]
|
||||
|
||||
export type GetReleaseNotesReq = { id: string }
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Subject, Observable } from 'rxjs'
|
||||
import { Http, Update, Operation, Revision, Source, Store } from 'patch-db-client'
|
||||
import { RR } from './api-types'
|
||||
import { RR } from '../api.types'
|
||||
import { DataModel } from 'src/app/services/patch-db/data-model'
|
||||
|
||||
export abstract class ApiService implements Source<DataModel>, Http<DataModel> {
|
||||
@@ -1,16 +1,16 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { HttpService, Method } from '../http.service'
|
||||
import { ApiService } from './api.service'
|
||||
import { RR } from './api-types'
|
||||
import { HttpService, Method } from '../../http.service'
|
||||
import { ApiService } from './embassy-api.service'
|
||||
import { RR } from '../api.types'
|
||||
import { parsePropertiesPermissive } from 'src/app/util/properties.util'
|
||||
import { ConfigService } from '../config.service'
|
||||
import { ConfigService } from '../../config.service'
|
||||
|
||||
@Injectable()
|
||||
export class LiveApiService extends ApiService {
|
||||
|
||||
constructor (
|
||||
private readonly config: ConfigService,
|
||||
private readonly http: HttpService,
|
||||
private readonly config: ConfigService,
|
||||
) { super() }
|
||||
|
||||
async getStatic (url: string): Promise<string> {
|
||||
@@ -1,22 +1,22 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { pauseFor } from '../../util/misc.util'
|
||||
import { ApiService } from './api.service'
|
||||
import { pauseFor } from '../../../util/misc.util'
|
||||
import { ApiService } from './embassy-api.service'
|
||||
import { PatchOp } from 'patch-db-client'
|
||||
import { PackageDataEntry, PackageMainStatus, PackageState, ServerStatus } from 'src/app/services/patch-db/data-model'
|
||||
import { RR, WithRevision } from './api-types'
|
||||
import { RR, WithRevision } from '../api.types'
|
||||
import { parsePropertiesPermissive } from 'src/app/util/properties.util'
|
||||
import { Mock } from './mock-app-fixures'
|
||||
import { HttpService } from '../http.service'
|
||||
import { Mock } from '../api.fixures'
|
||||
import { HttpService } from '../../http.service'
|
||||
import markdown from 'raw-loader!src/assets/markdown/md-sample.md'
|
||||
import { ConfigService } from '../config.service'
|
||||
import { ConfigService } from '../../config.service'
|
||||
|
||||
@Injectable()
|
||||
export class MockApiService extends ApiService {
|
||||
welcomeAck = false
|
||||
|
||||
constructor (
|
||||
private readonly config: ConfigService,
|
||||
private readonly http: HttpService,
|
||||
private readonly config: ConfigService,
|
||||
) { super() }
|
||||
|
||||
async getStatic (url: string): Promise<string> {
|
||||
@@ -1,24 +0,0 @@
|
||||
import { RR } from './api-types'
|
||||
// import { DataModel } from 'src/app/services/patch-db/data-model'
|
||||
import { DataModel } from '../../../../src/app/services/patch-db/data-model'
|
||||
|
||||
export abstract class MarketplaceApiService {
|
||||
abstract getMarketplaceData (params: RR.GetMarketplaceDataReq): Promise<RR.GetMarketplaceDataRes>
|
||||
|
||||
abstract getEos (params: RR.GetMarketplaceEOSReq): Promise<RR.GetMarketplaceEOSRes>
|
||||
|
||||
abstract getMarketplacePkgs (params: RR.GetMarketplacePackagesReq): Promise<RR.GetMarketplacePackagesRes>
|
||||
|
||||
abstract getReleaseNotes (params: RR.GetReleaseNotesReq): Promise<RR.GetReleaseNotesRes>
|
||||
|
||||
}
|
||||
|
||||
export function getMarketURL (eosOrPackage: 'eos' | 'package', data: DataModel): string {
|
||||
const eosMarketplace = data['server-info']['eos-marketplace']
|
||||
if (eosOrPackage === 'eos') {
|
||||
return eosMarketplace
|
||||
} else {
|
||||
const packageMarketplace = data['server-info']['package-marketplace']
|
||||
return packageMarketplace || eosMarketplace
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { HttpService } from '../http.service'
|
||||
import { getMarketURL } from './marketplace-api.service'
|
||||
import { RR } from './api-types'
|
||||
import { MarketplaceApiService } from './marketplace-api.service'
|
||||
import { PatchDbModel } from '../patch-db/patch-db.service'
|
||||
|
||||
@Injectable()
|
||||
export class MarketplaceLiveApiService extends MarketplaceApiService {
|
||||
|
||||
constructor (
|
||||
private readonly http: HttpService,
|
||||
private readonly patch: PatchDbModel,
|
||||
) { super() }
|
||||
|
||||
async getMarketplaceData (params: RR.GetMarketplaceDataReq): Promise<RR.GetMarketplaceDataRes> {
|
||||
return this.http.simpleGet<RR.GetMarketplaceDataRes>(getMarketURL('package', this.patch.data), params)
|
||||
}
|
||||
|
||||
async getEos (params: RR.GetMarketplaceEOSReq): Promise<RR.GetMarketplaceEOSRes> {
|
||||
return this.http.simpleGet<RR.GetMarketplaceEOSRes>(getMarketURL('eos', this.patch.data), params)
|
||||
}
|
||||
|
||||
async getMarketplacePkgs (params: RR.GetMarketplacePackagesReq): Promise<RR.GetMarketplacePackagesRes> {
|
||||
return this.http.simpleGet<RR.GetMarketplacePackagesRes>(getMarketURL('package', this.patch.data), params)
|
||||
}
|
||||
|
||||
async getReleaseNotes (params: RR.GetReleaseNotesReq): Promise<RR.GetReleaseNotesRes> {
|
||||
return this.http.simpleGet<RR.GetReleaseNotesRes>(getMarketURL('package', this.patch.data), params)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import { RR } from '../api.types'
|
||||
import { ConfigService } from '../../config.service'
|
||||
import { PatchDbService } from '../../patch-db/patch-db.service'
|
||||
|
||||
export abstract class MarketplaceApiService {
|
||||
|
||||
constructor (
|
||||
readonly config: ConfigService,
|
||||
readonly patch: PatchDbService,
|
||||
) { }
|
||||
|
||||
abstract getEos (params: RR.GetMarketplaceEOSReq): Promise<RR.GetMarketplaceEOSRes>
|
||||
|
||||
abstract getMarketplaceData (params: RR.GetMarketplaceDataReq): Promise<RR.GetMarketplaceDataRes>
|
||||
|
||||
abstract getMarketplacePkgs (params: RR.GetMarketplacePackagesReq): Promise<RR.GetMarketplacePackagesRes>
|
||||
|
||||
abstract getReleaseNotes (params: RR.GetReleaseNotesReq): Promise<RR.GetReleaseNotesRes>
|
||||
|
||||
getMarketplaceURL (type: 'eos' | 'package'): string {
|
||||
const eosMarketplace = this.patch.data['server-info']['eos-marketplace'] || this.config.start9Marketplace.clearnet
|
||||
if (type === 'eos') {
|
||||
return eosMarketplace
|
||||
} else {
|
||||
const packageMarketplace = this.patch.data['server-info']['package-marketplace']
|
||||
return packageMarketplace || eosMarketplace
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { HttpService } from '../../http.service'
|
||||
import { RR } from '../api.types'
|
||||
import { MarketplaceApiService } from './marketplace-api.service'
|
||||
import { PatchDbService } from '../../patch-db/patch-db.service'
|
||||
import { ConfigService } from '../../config.service'
|
||||
|
||||
@Injectable()
|
||||
export class MarketplaceLiveApiService extends MarketplaceApiService {
|
||||
|
||||
constructor (
|
||||
private readonly http: HttpService,
|
||||
config: ConfigService,
|
||||
patch: PatchDbService,
|
||||
) {
|
||||
super(config, patch)
|
||||
}
|
||||
|
||||
async getEos (params: RR.GetMarketplaceEOSReq): Promise<RR.GetMarketplaceEOSRes> {
|
||||
return this.http.simpleGet<RR.GetMarketplaceEOSRes>(this.getMarketplaceURL('eos'), params)
|
||||
}
|
||||
|
||||
async getMarketplaceData (params: RR.GetMarketplaceDataReq): Promise<RR.GetMarketplaceDataRes> {
|
||||
return this.http.simpleGet<RR.GetMarketplaceDataRes>(this.getMarketplaceURL('package'), params)
|
||||
}
|
||||
|
||||
async getMarketplacePkgs (params: RR.GetMarketplacePackagesReq): Promise<RR.GetMarketplacePackagesRes> {
|
||||
return this.http.simpleGet<RR.GetMarketplacePackagesRes>(this.getMarketplaceURL('package'), params)
|
||||
}
|
||||
|
||||
async getReleaseNotes (params: RR.GetReleaseNotesReq): Promise<RR.GetReleaseNotesRes> {
|
||||
return this.http.simpleGet<RR.GetReleaseNotesRes>(this.getMarketplaceURL('package'), params)
|
||||
}
|
||||
}
|
||||
@@ -1,62 +1,68 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { pauseFor } from '../../util/misc.util'
|
||||
import { RR } from './api-types'
|
||||
import { Mock } from './mock-app-fixures'
|
||||
import { HttpService } from '../http.service'
|
||||
import { pauseFor } from '../../../util/misc.util'
|
||||
import { RR } from '../api.types'
|
||||
import { Mock } from '../api.fixures'
|
||||
import { HttpService } from '../../http.service'
|
||||
import { MarketplaceApiService } from './marketplace-api.service'
|
||||
import { getMarketURL } from './marketplace-api.service'
|
||||
import { PatchDbModel } from '../patch-db/patch-db.service'
|
||||
import { PatchDbService } from '../../patch-db/patch-db.service'
|
||||
import { ConfigService } from '../../config.service'
|
||||
|
||||
@Injectable()
|
||||
export class MarketplaceMockApiService extends MarketplaceApiService {
|
||||
welcomeAck = false
|
||||
|
||||
constructor (
|
||||
private readonly http: HttpService,
|
||||
private readonly patch: PatchDbModel,
|
||||
) { super() }
|
||||
config: ConfigService,
|
||||
patch: PatchDbService,
|
||||
) {
|
||||
super(config, patch)
|
||||
}
|
||||
|
||||
// marketplace
|
||||
|
||||
async getEos (params: RR.GetMarketplaceEOSReq): Promise<RR.GetMarketplaceEOSRes> {
|
||||
let url = this.getMarketplaceURL('eos')
|
||||
if (this.useLocal(url)) {
|
||||
await pauseFor(2000)
|
||||
return Mock.MarketplaceEos
|
||||
}
|
||||
url = `${url}/sys/version/eos`
|
||||
return this.http.simpleGet<RR.GetMarketplaceEOSRes>(url)
|
||||
}
|
||||
|
||||
async getMarketplaceData (params: RR.GetMarketplaceDataReq): Promise<RR.GetMarketplaceDataRes> {
|
||||
const registryURL = getMarketURL('package', this.patch.data)
|
||||
if (!registryURL) {
|
||||
let url = this.getMarketplaceURL('package')
|
||||
if (this.useLocal(url)) {
|
||||
await pauseFor(2000)
|
||||
return {
|
||||
categories: ['featured', 'bitcoin', 'lightning', 'data', 'messaging', 'social', 'alt coin'],
|
||||
}
|
||||
}
|
||||
const url = `${registryURL}/marketplace/data`
|
||||
url = `${url}/marketplace/data`
|
||||
return this.http.simpleGet<RR.GetMarketplaceDataRes>(url)
|
||||
}
|
||||
|
||||
async getEos (params: RR.GetMarketplaceEOSReq): Promise<RR.GetMarketplaceEOSRes> {
|
||||
const registryURL = getMarketURL('eos', this.patch.data)
|
||||
if (!registryURL) {
|
||||
await pauseFor(2000)
|
||||
return Mock.MarketplaceEos
|
||||
}
|
||||
const url = `${registryURL}/sys/version/eos`
|
||||
return this.http.simpleGet<RR.GetMarketplaceEOSRes>(url)
|
||||
}
|
||||
|
||||
async getMarketplacePkgs (params: RR.GetMarketplacePackagesReq): Promise<RR.GetMarketplacePackagesRes> {
|
||||
const registryURL = getMarketURL('package', this.patch.data)
|
||||
if (!registryURL) {
|
||||
let url = this.getMarketplaceURL('package')
|
||||
if (this.useLocal(url)) {
|
||||
await pauseFor(2000)
|
||||
return Mock.AvailableList
|
||||
}
|
||||
const url = `${registryURL}/marketplace/packages`
|
||||
url = `${url}/marketplace/packages`
|
||||
return this.http.simpleGet<RR.GetMarketplacePackagesRes>(url, params)
|
||||
}
|
||||
|
||||
async getReleaseNotes (params: RR.GetReleaseNotesReq): Promise<RR.GetReleaseNotesRes> {
|
||||
const registryURL = getMarketURL('package', this.patch.data)
|
||||
if (!registryURL) {
|
||||
let url = this.getMarketplaceURL('package')
|
||||
if (this.useLocal(url)) {
|
||||
await pauseFor(2000)
|
||||
return Mock.ReleaseNotes
|
||||
}
|
||||
const url = `${registryURL}/marketplace/release-notes`
|
||||
url = `${url}/marketplace/release-notes`
|
||||
return this.http.simpleGet<RR.GetReleaseNotesRes>(url)
|
||||
}
|
||||
|
||||
private useLocal (url: string): boolean {
|
||||
return !url || this.config.mocks.marketplace
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { BehaviorSubject, Observable } from 'rxjs'
|
||||
import { distinctUntilChanged } from 'rxjs/operators'
|
||||
import { ApiService } from './api/api.service'
|
||||
import { ApiService } from './api/embassy/embassy-api.service'
|
||||
import { Storage } from '@ionic/storage'
|
||||
|
||||
export enum AuthState {
|
||||
|
||||
@@ -19,6 +19,7 @@ type UiConfig = {
|
||||
}
|
||||
mocks: {
|
||||
enabled: boolean
|
||||
marketplace: boolean
|
||||
connection: 'ws' | 'poll'
|
||||
rpcPort: number
|
||||
wsPort: number
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { BehaviorSubject, combineLatest, fromEvent, merge, Subscription } from 'rxjs'
|
||||
import { ConnectionStatus, PatchDbModel } from './patch-db/patch-db.service'
|
||||
import { ConnectionStatus, PatchDbService } from './patch-db/patch-db.service'
|
||||
import { HttpService, Method } from './http.service'
|
||||
import { distinctUntilChanged } from 'rxjs/operators'
|
||||
import { ConfigService } from './config.service'
|
||||
@@ -16,7 +16,7 @@ export class ConnectionService {
|
||||
constructor (
|
||||
private readonly httpService: HttpService,
|
||||
private readonly configService: ConfigService,
|
||||
private readonly patch: PatchDbModel,
|
||||
private readonly patch: PatchDbService,
|
||||
) { }
|
||||
|
||||
watchFailure$ () {
|
||||
|
||||
@@ -2,14 +2,14 @@ import { PollSource, Source, WebsocketSource } from 'patch-db-client'
|
||||
import { ConfigService } from 'src/app/services/config.service'
|
||||
import { DataModel } from './data-model'
|
||||
import { LocalStorageBootstrap } from './local-storage-bootstrap'
|
||||
import { PatchDbModel } from './patch-db.service'
|
||||
import { ApiService } from 'src/app/services/api/api.service'
|
||||
import { PatchDbService } from './patch-db.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy/embassy-api.service'
|
||||
|
||||
export function PatchDbModelFactory (
|
||||
export function PatchDbServiceFactory (
|
||||
config: ConfigService,
|
||||
bootstrapper: LocalStorageBootstrap,
|
||||
apiService: ApiService,
|
||||
): PatchDbModel {
|
||||
): PatchDbService {
|
||||
|
||||
const { mocks, patchDb: { poll }, isConsulate } = config
|
||||
|
||||
@@ -31,5 +31,5 @@ export function PatchDbModelFactory (
|
||||
}
|
||||
}
|
||||
|
||||
return new PatchDbModel(source, apiService, bootstrapper)
|
||||
return new PatchDbService(source, apiService, bootstrapper)
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import { Inject, Injectable, InjectionToken } from '@angular/core'
|
||||
import { Bootstrapper, PatchDB, Source, Store } from 'patch-db-client'
|
||||
import { BehaviorSubject, Observable, of, Subscription } from 'rxjs'
|
||||
import { catchError, debounceTime, finalize, map, tap } from 'rxjs/operators'
|
||||
import { ApiService } from '../api/api.service'
|
||||
import { ApiService } from '../api/embassy/embassy-api.service'
|
||||
import { DataModel } from './data-model'
|
||||
|
||||
export const PATCH_HTTP = new InjectionToken<Source<DataModel>>('app.config')
|
||||
@@ -18,7 +18,7 @@ export enum ConnectionStatus {
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class PatchDbModel {
|
||||
export class PatchDbService {
|
||||
connectionStatus$ = new BehaviorSubject(ConnectionStatus.Initializing)
|
||||
sequence$: Observable<number>
|
||||
data: DataModel
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { AppConfigValuePage } from '../modals/app-config-value/app-config-value.page'
|
||||
import { ApiService } from './api/api.service'
|
||||
import { ApiService } from './api/embassy/embassy-api.service'
|
||||
import { ConfigSpec } from '../pkg-config/config-types'
|
||||
import { ConfigCursor } from '../pkg-config/config-cursor'
|
||||
import { SSHService } from '../pages/server-routes/developer-routes/dev-ssh-keys/ssh.service'
|
||||
|
||||
@@ -4,60 +4,65 @@ import { wizardModal } from '../components/install-wizard/install-wizard.compone
|
||||
import { WizardBaker } from '../components/install-wizard/prebaked-wizards'
|
||||
import { OSWelcomePage } from '../modals/os-welcome/os-welcome.page'
|
||||
import { displayEmver } from '../pipes/emver.pipe'
|
||||
import { ApiService } from './api/api.service'
|
||||
import { RR } from './api/api.types'
|
||||
import { MarketplaceApiService } from './api/marketplace/marketplace-api.service'
|
||||
import { PatchDbService } from './patch-db/patch-db.service'
|
||||
import { ConfigService } from './config.service'
|
||||
import { Emver } from './emver.service'
|
||||
import { OsUpdateService } from './os-update.service'
|
||||
|
||||
@Injectable({providedIn: 'root' })
|
||||
export class StartupAlertsNotifier {
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class StartupAlertsService {
|
||||
private checks: Check<any>[]
|
||||
|
||||
constructor (
|
||||
private readonly alertCtrl: AlertController,
|
||||
private readonly navCtrl: NavController,
|
||||
private readonly config: ConfigService,
|
||||
private readonly modalCtrl: ModalController,
|
||||
private readonly apiService: ApiService,
|
||||
private readonly marketplaceApi: MarketplaceApiService,
|
||||
private readonly emver: Emver,
|
||||
private readonly osUpdateService: OsUpdateService,
|
||||
private readonly wizardBaker: WizardBaker,
|
||||
private readonly patch: PatchDbService,
|
||||
) {
|
||||
const welcome: Check<S9Server> = {
|
||||
const welcome: Check<boolean> = {
|
||||
name: 'welcome',
|
||||
shouldRun: s => this.shouldRunOsWelcome(s),
|
||||
check: async s => s,
|
||||
display: s => this.displayOsWelcome(s),
|
||||
shouldRun: () => this.shouldRunOsWelcome(),
|
||||
check: async () => true,
|
||||
display: () => this.displayOsWelcome(),
|
||||
hasRun: this.config.skipStartupAlerts,
|
||||
}
|
||||
const osUpdate: Check<ReqRes.GetVersionLatestRes | undefined> = {
|
||||
const osUpdate: Check<RR.GetMarketplaceEOSRes | undefined> = {
|
||||
name: 'osUpdate',
|
||||
shouldRun: s => this.shouldRunOsUpdateCheck(s),
|
||||
check: s => this.osUpdateCheck(s),
|
||||
display: vl => this.displayOsUpdateCheck(vl),
|
||||
shouldRun: () => this.shouldRunOsUpdateCheck(),
|
||||
check: () => this.osUpdateCheck(),
|
||||
display: pkg => this.displayOsUpdateCheck(pkg),
|
||||
hasRun: this.config.skipStartupAlerts,
|
||||
}
|
||||
const apps: Check<boolean> = {
|
||||
name: 'apps',
|
||||
shouldRun: s => this.shouldRunAppsCheck(s),
|
||||
shouldRun: () => this.shouldRunAppsCheck(),
|
||||
check: () => this.appsCheck(),
|
||||
display: () => this.displayAppsCheck(),
|
||||
hasRun: this.config.skipStartupAlerts,
|
||||
}
|
||||
this.checks = [welcome, osUpdate, v1StatusUpdate, apps]
|
||||
this.checks = [welcome, osUpdate, apps]
|
||||
}
|
||||
|
||||
// This takes our three checks and filters down to those that should run.
|
||||
// Then, the reduce fires, quickly iterating through yielding a promise (previousDisplay) to the next element
|
||||
// Each promise fires more or less concurrently, so each c.check(server) is run concurrently
|
||||
// Then, since we await previoudDisplay before c.display(res), each promise executing gets hung awaiting the display of the previous run
|
||||
async runChecks (server: Readonly<S9Server>): Promise<void> {
|
||||
// Then, since we await previousDisplay before c.display(res), each promise executing gets hung awaiting the display of the previous run
|
||||
async runChecks (): Promise<void> {
|
||||
await this.checks
|
||||
.filter(c => !c.hasRun && c.shouldRun(server))
|
||||
.filter(c => !c.hasRun && c.shouldRun())
|
||||
// returning true in the below block means to continue to next modal
|
||||
// returning false means to skip all subsequent modals
|
||||
.reduce(async (previousDisplay, c) => {
|
||||
let checkRes: any
|
||||
try {
|
||||
checkRes = await c.check(server)
|
||||
checkRes = await c.check()
|
||||
} catch (e) {
|
||||
console.error(`Exception in ${c.name} check:`, e)
|
||||
return true
|
||||
@@ -70,44 +75,49 @@ export class StartupAlertsNotifier {
|
||||
}, Promise.resolve(true))
|
||||
}
|
||||
|
||||
checks: Check<any>[]
|
||||
|
||||
private shouldRunOsWelcome (s: S9Server): boolean {
|
||||
return !s.welcomeAck && s.versionInstalled === this.config.version
|
||||
private shouldRunOsWelcome (): boolean {
|
||||
const data = this.patch.data
|
||||
return !data.ui['welcome-ack'] && data['server-info'].version === this.config.version
|
||||
}
|
||||
|
||||
private shouldRunAppsCheck (server: S9Server): boolean {
|
||||
return server.autoCheckUpdates
|
||||
private shouldRunOsUpdateCheck (): boolean {
|
||||
return this.patch.data.ui['auto-check-updates']
|
||||
}
|
||||
|
||||
private shouldRunOsUpdateCheck (server: S9Server): boolean {
|
||||
return server.autoCheckUpdates
|
||||
private shouldRunAppsCheck (): boolean {
|
||||
return this.patch.data.ui['auto-check-updates']
|
||||
}
|
||||
|
||||
private async v1StatusCheck (): Promise<V1Status> {
|
||||
return this.apiService.checkV1Status()
|
||||
}
|
||||
private async osUpdateCheck (): Promise<RR.GetMarketplaceEOSRes | undefined> {
|
||||
const res = await this.marketplaceApi.getEos({ })
|
||||
|
||||
private async osUpdateCheck (s: Readonly<S9Server>): Promise<ReqRes.GetVersionLatestRes | undefined> {
|
||||
const res = await this.apiService.getVersionLatest()
|
||||
return this.osUpdateService.updateIsAvailable(s.versionInstalled, res) ? res : undefined
|
||||
if (this.emver.compare(this.patch.data['server-info'].version, res.version) === -1) {
|
||||
return res
|
||||
} else {
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
private async appsCheck (): Promise<boolean> {
|
||||
const availableApps = await this.apiService.getAvailableApps()
|
||||
return !!availableApps.find(
|
||||
app => app.versionInstalled && this.emver.compare(app.versionInstalled, app.versionLatest) === -1,
|
||||
)
|
||||
const pkgs = await this.marketplaceApi.getMarketplacePkgs({
|
||||
ids: Object.keys(this.patch.data['package-data']).filter(id => {
|
||||
return !!this.patch.data['package-data'][id].installed
|
||||
}),
|
||||
})
|
||||
return !!pkgs.find(pkg => {
|
||||
const versionInstalled = this.patch.data['package-data'][pkg.manifest.id].manifest.version
|
||||
return this.emver.compare(versionInstalled, pkg.manifest.version) === -1
|
||||
})
|
||||
}
|
||||
|
||||
private async displayOsWelcome (s: Readonly<S9Server>): Promise<boolean> {
|
||||
private async displayOsWelcome (): Promise<boolean> {
|
||||
return new Promise(async resolve => {
|
||||
const modal = await this.modalCtrl.create({
|
||||
backdropDismiss: false,
|
||||
component: OSWelcomePage,
|
||||
presentingElement: await this.modalCtrl.getTop(),
|
||||
componentProps: {
|
||||
version: s.versionInstalled,
|
||||
version: this.patch.data['server-info'].version,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -118,14 +128,15 @@ export class StartupAlertsNotifier {
|
||||
})
|
||||
}
|
||||
|
||||
private async displayOsUpdateCheck (res: ReqRes.GetVersionLatestRes): Promise<boolean> {
|
||||
const { update } = await this.presentAlertNewOS(res.versionLatest)
|
||||
private async displayOsUpdateCheck (eos: RR.GetMarketplaceEOSRes): Promise<boolean> {
|
||||
const { update } = await this.presentAlertNewOS(eos.version)
|
||||
if (update) {
|
||||
const { cancelled } = await wizardModal(
|
||||
this.modalCtrl,
|
||||
this.wizardBaker.updateOS({
|
||||
version: res.versionLatest,
|
||||
releaseNotes: res.releaseNotes,
|
||||
version: eos.version,
|
||||
headline: eos.headline,
|
||||
releaseNotes: eos['release-notes'],
|
||||
}),
|
||||
)
|
||||
if (cancelled) return true
|
||||
@@ -134,33 +145,6 @@ export class StartupAlertsNotifier {
|
||||
return true
|
||||
}
|
||||
|
||||
private async displayV1Check (s: V1Status): Promise<boolean> {
|
||||
return new Promise(async resolve => {
|
||||
if (s.status !== 'available') return resolve(true)
|
||||
const alert = await this.alertCtrl.create({
|
||||
backdropDismiss: true,
|
||||
header: `EmbassyOS ${s.version} Now Available!`,
|
||||
message: `Version ${s.version} introduces SSD support and a whole lot more.`,
|
||||
buttons: [
|
||||
{
|
||||
text: 'Cancel',
|
||||
role: 'cancel',
|
||||
handler: () => resolve(true),
|
||||
},
|
||||
{
|
||||
text: 'View Instructions',
|
||||
handler: () => {
|
||||
window.open(`https://start9.com/eos-${s.version}`, '_blank')
|
||||
resolve(false)
|
||||
},
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
await alert.present()
|
||||
})
|
||||
}
|
||||
|
||||
private async displayAppsCheck (): Promise<boolean> {
|
||||
return new Promise(async resolve => {
|
||||
const alert = await this.alertCtrl.create({
|
||||
@@ -223,9 +207,9 @@ export class StartupAlertsNotifier {
|
||||
|
||||
type Check<T> = {
|
||||
// validates whether a check should run based on server properties
|
||||
shouldRun: (s: S9Server) => boolean
|
||||
shouldRun: () => boolean
|
||||
// executes a check, often requiring api call. It should return a false-y value if there should be no display.
|
||||
check: (s: S9Server) => Promise<T>
|
||||
check: () => Promise<T>
|
||||
// display an alert based on the result of the check.
|
||||
// return false if subsequent modals should not be displayed
|
||||
display: (a: T) => Promise<boolean>
|
||||
Reference in New Issue
Block a user