From c349122a6e57cc614b9c6a753a15fade5dcb95bb Mon Sep 17 00:00:00 2001 From: Timo Bejan Date: Tue, 17 Nov 2020 13:19:33 +0200 Subject: [PATCH] reanalyse btn changes --- apps/red-ui/src/app/dialogs/dialog.service.ts | 5 +-- .../file-preview-screen.component.ts | 4 +-- .../file/service/file-action.service.ts | 24 ++++++++----- .../project-overview-screen.component.html | 10 +++++- .../project-overview-screen.component.scss | 8 +++++ .../project-overview-screen.component.ts | 34 +++++-------------- apps/red-ui/src/assets/i18n/de.json | 2 +- apps/red-ui/src/assets/i18n/en.json | 4 +-- apps/red-ui/src/assets/styles/red-grid.scss | 8 +++++ apps/red-ui/src/index.html | 2 +- 10 files changed, 56 insertions(+), 45 deletions(-) diff --git a/apps/red-ui/src/app/dialogs/dialog.service.ts b/apps/red-ui/src/app/dialogs/dialog.service.ts index 95e8ca62a..2e7a2f9e4 100644 --- a/apps/red-ui/src/app/dialogs/dialog.service.ts +++ b/apps/red-ui/src/app/dialogs/dialog.service.ts @@ -178,14 +178,11 @@ export class DialogService { return ref; } - public openAssignFileToMeDialog(file: FileStatus, cb?: Function): MatDialogRef { + public openAssignFileToMeDialog(file: FileStatus, cb?: Function) { const ref = this._dialog.open(ConfirmationDialogComponent, dialogConfig); - ref.afterClosed().subscribe((result) => { if (result && cb) cb(result); }); - - return ref; } public openBulkAssignFileReviewerDialog(fileIds: string[], cb?: Function): MatDialogRef { diff --git a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts index 2f8a00f16..3cc8ee549 100644 --- a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts @@ -458,8 +458,8 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy { }); } - public assignToMe() { - this._fileActionService.assignToMe(this.fileData.fileStatus, async () => { + public async assignToMe() { + await this._fileActionService.assignToMe(this.fileData.fileStatus, async () => { this.canPerformAnnotationActions = this.permissionsService.canPerformAnnotationActions(); }); } diff --git a/apps/red-ui/src/app/screens/file/service/file-action.service.ts b/apps/red-ui/src/app/screens/file/service/file-action.service.ts index 4183a16fd..b716d8849 100644 --- a/apps/red-ui/src/app/screens/file/service/file-action.service.ts +++ b/apps/red-ui/src/app/screens/file/service/file-action.service.ts @@ -36,14 +36,22 @@ export class FileActionService { }); } - public assignToMe(file?: FileStatus, callback?: Function) { - this._dialogService.openAssignFileToMeDialog(file ? file : this._appStateService.activeFile, async () => { - await this._statusControllerService.assignProjectOwner(this._appStateService.activeProjectId, file.fileId, this._userService.userId).toPromise(); - await this._appStateService.reloadActiveProjectFiles(); - if (callback) { - await callback(); - } - }); + public async assignToMe(file?: FileStatus, callback?: Function) { + if (file.currentReviewer) { + await this._assignReviewerToCurrentUser(file, callback); + } else { + this._dialogService.openAssignFileToMeDialog(file ? file : this._appStateService.activeFile, async () => { + await this._assignReviewerToCurrentUser(file, callback); + }); + } + } + + private async _assignReviewerToCurrentUser(file?: FileStatus, callback?: Function) { + await this._statusControllerService.assignProjectOwner(this._appStateService.activeProjectId, file.fileId, this._userService.userId).toPromise(); + await this._appStateService.reloadActiveProjectFiles(); + if (callback) { + await callback(); + } } setFileUnderApproval(fileStatus: FileStatusWrapper) { diff --git a/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.html b/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.html index 0f57e0fc2..a1ab70a3e 100644 --- a/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.html +++ b/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.html @@ -47,7 +47,7 @@
-
+
+
+ + + {{ 'project-overview.new-rule.toast.message-project' | translate }} + + {{ 'project-overview.new-rule.toast.actions.reanalyse-all' | translate }} + +
diff --git a/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.scss b/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.scss index 5e980717a..b0b59132b 100644 --- a/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.scss +++ b/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.scss @@ -57,3 +57,11 @@ overflow-y: scroll; @include no-scroll-bar(); } + +.reanalyse-link { + color: $accent; + text-decoration: underline; + &:hover { + color: lighten($accent, 10%); + } +} diff --git a/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.ts b/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.ts index fc8eacd47..933e1630d 100644 --- a/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.ts +++ b/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.ts @@ -81,7 +81,6 @@ export class ProjectOverviewScreenComponent implements OnInit, OnDestroy { .subscribe(); this._fileDropOverlayService.initFileDropHandling(); this.calculateData(); - this._displayOutdatedToast(); } ngOnDestroy(): void { @@ -89,32 +88,15 @@ export class ProjectOverviewScreenComponent implements OnInit, OnDestroy { this.filesAutoUpdateTimer.unsubscribe(); } - private _displayOutdatedToast() { - if (this.permissionsService.isManagerAndOwner()) { - // @ts-ignore - if (!this.appStateService.activeProject.files.filter((file) => this.permissionsService.fileRequiresReanalysis(file)).length) { - return; - } + get displayReanalyseBtn() { + return !!( + this.permissionsService.isManagerAndOwner() && + this.appStateService.activeProject.files.filter((file) => this.permissionsService.fileRequiresReanalysis(file)).length + ); + } - this._notificationService.showToastNotification( - `${this._translateService.instant('project-overview.new-rule.toast.message-project')}`, - null, - NotificationType.WARNING, - { - disableTimeOut: true, - positionClass: 'toast-top-left', - actions: [ - { - title: this._translateService.instant('project-overview.new-rule.toast.actions.reanalyse-all'), - action: () => this.appStateService.reanalyzeProject().then(() => this.reloadProjects()) - }, - { - title: this._translateService.instant('project-overview.new-rule.toast.actions.later') - } - ] - } - ); - } + public reanalyseProject() { + return this.appStateService.reanalyzeProject().then(() => this.reloadProjects()); } public isPending(fileStatusWrapper: FileStatusWrapper) { diff --git a/apps/red-ui/src/assets/i18n/de.json b/apps/red-ui/src/assets/i18n/de.json index 1a8abe29e..0710ae79c 100644 --- a/apps/red-ui/src/assets/i18n/de.json +++ b/apps/red-ui/src/assets/i18n/de.json @@ -6,7 +6,7 @@ "heading-with-link": "Ihr Benutzer verfügt nicht über die erforderlichen RED- * -Rollen, um auf diese Anwendung zuzugreifen. Bitte kontaktieren Sie Ihren Administrator für den Zugriff!", "logout": "Ausloggen" }, - "app-name": "Redacto", + "app-name": "DDA-R", "upload-status": { "dialog": { "title": "Datei-Upload", "actions": { "re-upload": "Wiederholen Sie den Upload", "cancel": "Upload abbrechen" } } }, "pdf-viewer": { "text-popup": { "actions": { "search": "Suche nach Auswahl" } } }, "common": { diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index b7de23994..8a9e2e75e 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -6,7 +6,7 @@ "heading-with-link": "Your user doesn't have the required RED-* roles to access this application. Please contact your admin for access!", "logout": "Logout" }, - "app-name": "Redacto", + "app-name": "DDA-R", "upload-status": { "dialog": { "title": "File Upload", @@ -152,7 +152,7 @@ "new-rule": { "label": "Outdated", "toast": { - "message-project": "Documents need to be re-analyzed.", + "message-project": "Renalysis required: ", "actions": { "reanalyse-all": "Reanalyze all", "reanalyse-file": "Reanalyze this file", diff --git a/apps/red-ui/src/assets/styles/red-grid.scss b/apps/red-ui/src/assets/styles/red-grid.scss index 9a4241798..0f2dc749c 100644 --- a/apps/red-ui/src/assets/styles/red-grid.scss +++ b/apps/red-ui/src/assets/styles/red-grid.scss @@ -17,10 +17,18 @@ gap: 25px; } + &.span-3 { + grid-column-end: span 3; + } + &.span-7 { grid-column-end: span 7; } &.span-4 { grid-column-end: span 4; } + + &.justify-end { + justify-content: flex-end; + } } diff --git a/apps/red-ui/src/index.html b/apps/red-ui/src/index.html index 1c594d43b..9eba2cedc 100644 --- a/apps/red-ui/src/index.html +++ b/apps/red-ui/src/index.html @@ -2,7 +2,7 @@ - Redacto + DDA-R