mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
save
This commit is contained in:
committed by
Aiden McClelland
parent
7417bfdbfa
commit
833941b031
@@ -167,6 +167,7 @@ export class MockApiService extends ApiService {
|
||||
}
|
||||
|
||||
async patchServerConfig (attr: string, value: any): Promise<EmptyResponse> {
|
||||
console.log('huh', attr, value)
|
||||
await mockPatchServerConfig()
|
||||
this.serverModel.update({ [attr]: value })
|
||||
return { }
|
||||
@@ -409,7 +410,7 @@ const mockApiServer: () => ReqRes.GetServerRes = () => ({
|
||||
versionLatest: '0.2.9',
|
||||
status: ServerStatus.RUNNING,
|
||||
alternativeRegistryUrl: 'beta-registry.start9labs.com',
|
||||
welcomeAck: true,
|
||||
welcomeAck: false,
|
||||
autoCheckUpdates: true,
|
||||
specs: {
|
||||
'Tor Address': 'nfsnjkcnaskjnlkasnfahj7dh23fdnieqwjdnhjewbfijendiueqwbd.onion',
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { AlertController, ModalController, NavController } from '@ionic/angular'
|
||||
import { combineLatest, Observable, of } from 'rxjs'
|
||||
import { concatMap, filter, map, switchMap, take } from 'rxjs/operators'
|
||||
import { concatMap, debounceTime, distinctUntilChanged, filter, map, switchMap, take } from 'rxjs/operators'
|
||||
import { OSWelcomePage } from '../modals/os-welcome/os-welcome.page'
|
||||
import { ServerModel } from '../models/server-model'
|
||||
import { exists } from '../util/misc.util'
|
||||
import { ServerModel, ServerModelState } from '../models/server-model'
|
||||
import { exists, traceWheel } from '../util/misc.util'
|
||||
import { ApiService } from './api/api.service'
|
||||
import { ConfigService } from './config.service'
|
||||
import { LoaderService } from './loader.service'
|
||||
@@ -45,15 +45,16 @@ export class GlobalAlertsNotifier {
|
||||
private welcomeNeeded$ (): Observable<string | undefined> {
|
||||
const { welcomeAck, versionInstalled } = this.server.watch()
|
||||
|
||||
return combineLatest([ welcomeAck, versionInstalled ]).pipe(
|
||||
filter(([_, vi]) => !!vi),
|
||||
map(([wa, vi]) => !wa && vi === this.config.version ? vi : undefined),
|
||||
return combineLatest([ this.server.$modelState$, welcomeAck, versionInstalled ]).pipe(
|
||||
filter(([ms, _, vi]) => ms === ServerModelState.LIVE && !!vi),
|
||||
map(([_, wa, vi]) => !wa && vi === this.config.version ? vi : undefined),
|
||||
)
|
||||
}
|
||||
|
||||
// emits versionLatest whenever autoCheckUpdates becomes true and checkForUpdates yields a new version
|
||||
private osUpdateAlertNeeded$ (): Observable<string | undefined> {
|
||||
return this.server.watch().autoCheckUpdates.pipe(
|
||||
distinctUntilChanged(),
|
||||
filter(exists), //
|
||||
concatMap(() => this.osUpdateService.checkForUpdates$()),
|
||||
)
|
||||
@@ -90,7 +91,7 @@ export class GlobalAlertsNotifier {
|
||||
console.error(`Unable to acknowledge OS welcome`, e)
|
||||
})
|
||||
await modal.present()
|
||||
modal.onWillDismiss().then(() => resolve())
|
||||
modal.onDidDismiss().then(() => resolve())
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ export class SyncDaemon {
|
||||
|
||||
switch (serverRes.result) {
|
||||
case 'resolve': {
|
||||
this.serverModel.update(serverRes.value, now)
|
||||
this.serverModel.sync(serverRes.value, now)
|
||||
break
|
||||
}
|
||||
case 'reject': {
|
||||
|
||||
Reference in New Issue
Block a user