mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
Fix/app show hidden (#1948)
* fix bug with blank app show and dont double update from patchDB
This commit is contained in:
committed by
Aiden McClelland
parent
18ee1e2685
commit
43bae7fb01
@@ -4,14 +4,13 @@ import { PatchDB } from 'patch-db-client'
|
||||
import {
|
||||
DataModel,
|
||||
PackageDataEntry,
|
||||
PackageMainStatus,
|
||||
PackageState,
|
||||
} from 'src/app/services/patch-db/data-model'
|
||||
import {
|
||||
PackageStatus,
|
||||
PrimaryStatus,
|
||||
} from 'src/app/services/pkg-status-rendering.service'
|
||||
import { filter, tap } from 'rxjs/operators'
|
||||
import { tap } from 'rxjs/operators'
|
||||
import { ActivatedRoute } from '@angular/router'
|
||||
import { getPkgId } from '@start9labs/shared'
|
||||
|
||||
@@ -32,19 +31,8 @@ export class AppShowPage {
|
||||
readonly pkg$ = this.patch.watch$('package-data', this.pkgId).pipe(
|
||||
tap(pkg => {
|
||||
// if package disappears, navigate to list page
|
||||
if (!pkg) {
|
||||
this.navCtrl.navigateRoot('/services')
|
||||
}
|
||||
if (!pkg) this.navCtrl.navigateRoot('/services')
|
||||
}),
|
||||
filter(
|
||||
(p?: PackageDataEntry) =>
|
||||
// will be undefined when sideloading
|
||||
!!p &&
|
||||
!(
|
||||
p.installed?.status.main.status === PackageMainStatus.Starting &&
|
||||
p.installed?.status.main.restarting
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -160,28 +160,6 @@ export class AppShowStatusComponent {
|
||||
}
|
||||
}
|
||||
|
||||
async presentAlertRestart(): Promise<void> {
|
||||
const alert = await this.alertCtrl.create({
|
||||
header: 'Confirm',
|
||||
message: 'Are you sure you want to restart this service?',
|
||||
buttons: [
|
||||
{
|
||||
text: 'Cancel',
|
||||
role: 'cancel',
|
||||
},
|
||||
{
|
||||
text: 'Restart',
|
||||
handler: () => {
|
||||
this.restart()
|
||||
},
|
||||
cssClass: 'enter-click',
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
await alert.present()
|
||||
}
|
||||
|
||||
private get id(): string {
|
||||
return this.pkg.manifest.id
|
||||
}
|
||||
|
||||
@@ -739,13 +739,33 @@ export class MockApiService extends ApiService {
|
||||
await pauseFor(2000)
|
||||
const path = `/package-data/${params.id}/installed/status/main`
|
||||
|
||||
setTimeout(() => {
|
||||
const patch2 = [
|
||||
setTimeout(async () => {
|
||||
const patch2: Operation<any>[] = [
|
||||
{
|
||||
op: PatchOp.REPLACE,
|
||||
path: path + '/status',
|
||||
value: PackageMainStatus.Starting,
|
||||
},
|
||||
{
|
||||
op: PatchOp.ADD,
|
||||
path: path + '/restarting',
|
||||
value: true,
|
||||
},
|
||||
]
|
||||
this.mockRevision(patch2)
|
||||
|
||||
await pauseFor(2000)
|
||||
|
||||
const patch3: Operation<any>[] = [
|
||||
{
|
||||
op: PatchOp.REPLACE,
|
||||
path: path + '/status',
|
||||
value: PackageMainStatus.Running,
|
||||
},
|
||||
{
|
||||
op: PatchOp.REMOVE,
|
||||
path: path + '/restarting',
|
||||
},
|
||||
{
|
||||
op: PatchOp.REPLACE,
|
||||
path: path + '/health',
|
||||
@@ -770,7 +790,7 @@ export class MockApiService extends ApiService {
|
||||
},
|
||||
} as any,
|
||||
]
|
||||
this.mockRevision(patch2)
|
||||
this.mockRevision(patch3)
|
||||
}, this.revertTime)
|
||||
|
||||
const patch = [
|
||||
|
||||
2
patch-db
2
patch-db
Submodule patch-db updated: 994b75af45...c54a1f037c
Reference in New Issue
Block a user