update done fix

This commit is contained in:
Drew Ansbacher
2022-02-10 16:49:56 -07:00
committed by Aiden McClelland
parent e3fd98f8c9
commit 6fbe207a8c
4 changed files with 55 additions and 30 deletions

View File

@@ -8,14 +8,13 @@ let tries = 0
providedIn: 'root',
})
export class MockApiService extends ApiService {
constructor () {
constructor() {
super()
}
// ** UNENCRYPTED **
async getStatus () {
async getStatus() {
await pauseFor(1000)
return {
'product-key': true,
@@ -23,7 +22,7 @@ export class MockApiService extends ApiService {
}
}
async getDrives () {
async getDrives() {
await pauseFor(1000)
return {
disks: [
@@ -43,22 +42,22 @@ export class MockApiService extends ApiService {
'password-hash': null,
'wrapped-key': null,
},
}
},
],
capacity: 123456789123,
guid: 'uuid-uuid-uuid-uuid',
}
},
],
reconnect: [],
}
}
async set02XDrive () {
async set02XDrive() {
await pauseFor(1000)
return
}
async getRecoveryStatus () {
async getRecoveryStatus() {
tries = Math.min(tries + 1, 4)
return {
'bytes-transferred': tries,
@@ -69,38 +68,38 @@ export class MockApiService extends ApiService {
// ** ENCRYPTED **
async verifyCifs (params: CifsRecoverySource) {
async verifyCifs(params: CifsRecoverySource) {
await pauseFor(1000)
return {
version: '0.3.0',
full: true,
'password-hash': '$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ',
'password-hash':
'$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ',
'wrapped-key': '',
}
}
async verifyProductKey () {
async verifyProductKey() {
await pauseFor(1000)
return
}
async importDrive (guid: string) {
async importDrive(guid: string) {
await pauseFor(3000)
return setupRes
}
async setupEmbassy (setupInfo: SetupEmbassyReq) {
async setupEmbassy(setupInfo: SetupEmbassyReq) {
await pauseFor(3000)
return setupRes
}
async setupComplete () {
async setupComplete() {
await pauseFor(1000)
}
}
const rootCA =
`-----BEGIN CERTIFICATE-----
const rootCA = `-----BEGIN CERTIFICATE-----
MIIDpzCCAo+gAwIBAgIRAIIuOarlQETlUQEOZJGZYdIwDQYJKoZIhvcNAQELBQAw
bTELMAkGA1UEBhMCVVMxFTATBgNVBAoMDEV4YW1wbGUgQ29ycDEOMAwGA1UECwwF
U2FsZXMxCzAJBgNVBAgMAldBMRgwFgYDVQQDDA93d3cuZXhhbXBsZS5jb20xEDAO
@@ -188,7 +187,8 @@ const disks = [
version: '0.3.6',
full: true,
// password is 'asdfasdf'
'password-hash': '$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ',
'password-hash':
'$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ',
'wrapped-key': '',
},
},

View File

@@ -298,6 +298,7 @@ export class AppComponent {
}
})
}
m
private watchUpdateProgress (): Subscription {
return this.patch

View File

@@ -63,19 +63,30 @@
</p>
<!-- "Software Update" button only -->
<p *ngIf="button.title === 'Software Update'">
<ng-container
*ngIf="eosService.updateAvailable$ | async; else check"
>
<ion-text class="inline" color="success">
<ion-icon name="rocket-outline"></ion-icon>
Update Available
<ng-container *ngIf="button.disabled | async; else enabled">
<ion-text
*ngIf="patch.data['server-info']['status-info'].updated"
class="inline"
color="warning"
>
Update Complete, Restart to apply changes
</ion-text>
</ng-container>
<ng-template #check>
<ion-text class="inline" color="dark">
<ion-icon name="refresh"></ion-icon>
Check for updates
</ion-text>
<ng-template #enabled>
<ng-container
*ngIf="eosService.updateAvailable$ | async; else check"
>
<ion-text class="inline" color="success">
<ion-icon name="rocket-outline"></ion-icon>
Update Available
</ion-text>
</ng-container>
<ng-template #check>
<ion-text class="inline" color="dark">
<ion-icon name="refresh"></ion-icon>
Check for updates
</ion-text>
</ng-template>
</ng-template>
</p>
</ion-label>

View File

@@ -236,7 +236,10 @@ export class ServerShowPage {
disabled: this.patch
.watch$('server-info', 'status-info')
.pipe(
map(status => status['backing-up'] || !!status['update-progress']),
map(
status =>
status && (status['backing-up'] || !!status['update-progress']),
),
),
},
],
@@ -250,7 +253,17 @@ export class ServerShowPage {
? this.updateEos()
: this.checkForEosUpdate(),
detail: false,
disabled: of(false),
disabled: this.patch
.watch$('server-info', 'status-info')
.pipe(
map(
status =>
status &&
(status['backing-up'] ||
!!status['update-progress'] ||
status.updated),
),
),
},
{
title: 'Preferences',