diff --git a/backend/src/update/mod.rs b/backend/src/update/mod.rs index 2324c40b0..3caebb8a6 100644 --- a/backend/src/update/mod.rs +++ b/backend/src/update/mod.rs @@ -135,7 +135,7 @@ async fn maybe_do_update( }; status.update_progress = Some(UpdateProgress { - size: Some(100), + size: None, downloaded: 0, }); status.save(&mut tx).await?; @@ -301,7 +301,7 @@ async fn copy_ssh_host_keys() -> Result<(), Error> { async fn sync_boot() -> Result<(), Error> { Rsync::new( "/media/embassy/next/boot/", - "/boot", + "/boot/", RsyncOptions { delete: false, force: false, diff --git a/frontend/projects/ui/src/app/app/footer/footer.component.html b/frontend/projects/ui/src/app/app/footer/footer.component.html index 2e8874613..306ceca67 100644 --- a/frontend/projects/ui/src/app/app/footer/footer.component.html +++ b/frontend/projects/ui/src/app/app/footer/footer.component.html @@ -4,13 +4,30 @@ [@heightCollapse]="animation" > - - Downloading EOS: {{ getProgress(progress) }}% - - + + + + Downloading: + {{ getProgress(progress.size, progress.downloaded) }}% + + + + + + + Calculating download size + + + diff --git a/frontend/projects/ui/src/app/app/footer/footer.component.ts b/frontend/projects/ui/src/app/app/footer/footer.component.ts index b7e18c08f..9a16f5a47 100644 --- a/frontend/projects/ui/src/app/app/footer/footer.component.ts +++ b/frontend/projects/ui/src/app/app/footer/footer.component.ts @@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, Component } from '@angular/core' import { heightCollapse } from '../../util/animations' import { PatchDB } from 'patch-db-client' import { map } from 'rxjs/operators' -import { DataModel, ServerInfo } from '../../services/patch-db/data-model' +import { DataModel } from '../../services/patch-db/data-model' @Component({ selector: 'footer[appFooter]', @@ -26,10 +26,7 @@ export class FooterComponent { constructor(private readonly patch: PatchDB) {} - getProgress({ - downloaded, - size, - }: NonNullable): number { - return Math.round((100 * (downloaded || 1)) / (size || 1)) + getProgress(size: number, downloaded: number): number { + return Math.round((100 * downloaded) / (size || 1)) } } diff --git a/frontend/projects/ui/src/app/components/toast-container/update-toast/update-toast.component.html b/frontend/projects/ui/src/app/components/toast-container/update-toast/update-toast.component.html index 4bc4c796d..cc54ff1eb 100644 --- a/frontend/projects/ui/src/app/components/toast-container/update-toast/update-toast.component.html +++ b/frontend/projects/ui/src/app/components/toast-container/update-toast/update-toast.component.html @@ -1,7 +1,7 @@ Restart your Embassy for these updates to take effect. It can take several diff --git a/frontend/projects/ui/src/app/modals/app-recover-select/to-options.pipe.ts b/frontend/projects/ui/src/app/modals/app-recover-select/to-options.pipe.ts index 8a6b0fbdd..bb620dd7c 100644 --- a/frontend/projects/ui/src/app/modals/app-recover-select/to-options.pipe.ts +++ b/frontend/projects/ui/src/app/modals/app-recover-select/to-options.pipe.ts @@ -40,7 +40,7 @@ export class ToOptionsPipe implements PipeTransform { } private compare(version: string): boolean { - // checks to see if backup was made on a newer version of EOS + // checks to see if backup was made on a newer version of eOS return this.emver.compare(version, this.config.version) === 1 } } diff --git a/frontend/projects/ui/src/app/services/api/embassy-mock-api.service.ts b/frontend/projects/ui/src/app/services/api/embassy-mock-api.service.ts index ed4f1a0bb..d2d977a1e 100644 --- a/frontend/projects/ui/src/app/services/api/embassy-mock-api.service.ts +++ b/frontend/projects/ui/src/app/services/api/embassy-mock-api.service.ts @@ -232,12 +232,12 @@ export class MockApiService extends ApiService { async updateServer(url?: string): Promise { await pauseFor(2000) const initialProgress = { - size: 10000, + size: null, downloaded: 0, } setTimeout(() => { - this.updateOSProgress(initialProgress.size) + this.updateOSProgress() }, 500) const patch = [ @@ -916,8 +916,19 @@ export class MockApiService extends ApiService { }, 1000) } - private async updateOSProgress(size: number) { + private async updateOSProgress() { + let size = 10000 let downloaded = 0 + + const patch0 = [ + { + op: PatchOp.REPLACE, + path: `/server-info/status-info/update-progress/size`, + value: size, + }, + ] + this.mockRevision(patch0) + while (downloaded < size) { await pauseFor(250) downloaded += 500 diff --git a/frontend/projects/ui/src/app/services/patch-data.service.ts b/frontend/projects/ui/src/app/services/patch-data.service.ts index 1cc6ded72..8834a8e68 100644 --- a/frontend/projects/ui/src/app/services/patch-data.service.ts +++ b/frontend/projects/ui/src/app/services/patch-data.service.ts @@ -22,7 +22,7 @@ export class PatchDataService extends Observable { switchMap(() => this.patch.watch$()), take(1), tap(({ ui }) => { - // check for updates to EOS and services + // check for updates to eOS and services this.checkForUpdates() // show eos welcome message this.showEosWelcome(ui['ack-welcome']) diff --git a/frontend/projects/ui/src/app/services/patch-db/data-model.ts b/frontend/projects/ui/src/app/services/patch-db/data-model.ts index 7da54cd10..bbd0bf7e2 100644 --- a/frontend/projects/ui/src/app/services/patch-db/data-model.ts +++ b/frontend/projects/ui/src/app/services/patch-db/data-model.ts @@ -12,7 +12,7 @@ export interface DataModel { export interface UIData { name: string | null 'pkg-order': string[] - 'ack-welcome': string // EOS emver + 'ack-welcome': string // eOS emver marketplace: UIMarketplaceData dev: DevData gaming: { diff --git a/libs/helpers/src/rsync.rs b/libs/helpers/src/rsync.rs index 9a817ecd0..e291c8754 100644 --- a/libs/helpers/src/rsync.rs +++ b/libs/helpers/src/rsync.rs @@ -98,15 +98,17 @@ impl Rsync { }) .lines(); while let Some(line) = lines.next_line().await? { - if let Some(percentage) = line - .split_ascii_whitespace() - .find_map(|col| col.strip_suffix("%")) - { - if let Err(err) = send.send(percentage.parse::()? / 100.0) { - return Err(Error::new( - eyre!("rsync progress send error: {}", err), - ErrorKind::Filesystem, - )); + if line.contains(" to-chk=0/") { + if let Some(percentage) = line + .split_ascii_whitespace() + .find_map(|col| col.strip_suffix("%")) + { + if let Err(err) = send.send(percentage.parse::()? / 100.0) { + return Err(Error::new( + eyre!("rsync progress send error: {}", err), + ErrorKind::Filesystem, + )); + } } } }