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

View File

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

View File

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

View File

@@ -236,7 +236,10 @@ export class ServerShowPage {
disabled: this.patch disabled: this.patch
.watch$('server-info', 'status-info') .watch$('server-info', 'status-info')
.pipe( .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.updateEos()
: this.checkForEosUpdate(), : this.checkForEosUpdate(),
detail: false, 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', title: 'Preferences',