From 0f3d664c58cf69c3cc03967173c9c5bcb2f3910e Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Sat, 19 Jan 2019 17:31:23 +0100 Subject: [PATCH] improving folder indexing texts --- .../indexing/indexing.settings.component.ts | 65 ++++++++++--------- 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/frontend/app/settings/indexing/indexing.settings.component.ts b/frontend/app/settings/indexing/indexing.settings.component.ts index 53484bfd..6bae8fab 100644 --- a/frontend/app/settings/indexing/indexing.settings.component.ts +++ b/frontend/app/settings/indexing/indexing.settings.component.ts @@ -4,7 +4,7 @@ import {AuthenticationService} from '../../model/network/authentication.service' import {NavigationService} from '../../model/navigation.service'; import {NotificationService} from '../../model/notification.service'; import {ErrorDTO} from '../../../../common/entities/Error'; -import {Observable, interval} from 'rxjs'; +import {interval, Observable} from 'rxjs'; import {IndexingConfig, ReIndexingSensitivity} from '../../../../common/config/private/IPrivateConfig'; import {SettingsComponent} from '../_abstract/abstract.settings.component'; import {Utils} from '../../../../common/Utils'; @@ -23,15 +23,46 @@ export class IndexingSettingsComponent extends SettingsComponent = null; + + constructor(_authService: AuthenticationService, + _navigation: NavigationService, + _settingsService: IndexingSettingsService, + notification: NotificationService, + i18n: I18n) { + + super(i18n('Indexing'), + _authService, + _navigation, + _settingsService, + notification, + i18n, + s => s.Server.indexing); + + } + + get TimeLeft() { + const prg = this._settingsService.progress.value; + return (prg.time.current - prg.time.start) / prg.indexed * prg.left; + } + + get TimeElapsed() { + const prg = this._settingsService.progress.value; + return (prg.time.current - prg.time.start); + } + updateProgress = async () => { try { + const wasRunning = this._settingsService.progress.value !== null; await (this._settingsService).getProgress(); + if (wasRunning && this._settingsService.progress.value === null) { + this.notification.success(this.i18n('Folder indexed'), this.i18n('Success')); + } } catch (err) { if (this.subscription.timer != null) { this.subscription.timer.unsubscribe(); @@ -50,22 +81,6 @@ export class IndexingSettingsComponent extends SettingsComponent_settingsService, - notification, - i18n, - s => s.Server.indexing); - - } - async ngOnInit() { super.ngOnInit(); this.types = Utils @@ -105,7 +120,7 @@ export class IndexingSettingsComponent extends SettingsComponentthis._settingsService).cancel(); - this.notification.success(this.i18n('Folder indexed'), this.i18n('Success')); + this._settingsService.progress.next(null); + this.notification.info(this.i18n('Folder indexing interrupted')); this.inProgress = false; return true; } catch (err) {