From e09358a4c082d4f2da671f0756aa37634250dbbd Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Tue, 28 Sep 2021 16:35:54 +0300 Subject: [PATCH] fix rebase --- .../file-actions/file-actions.component.html | 2 +- .../file-actions/file-actions.component.ts | 34 +++++----- .../dossier-overview-screen.component.html | 38 ++++++------ .../dossier-overview-screen.component.ts | 62 +++++++++---------- .../dossier/services/file-action.service.ts | 1 - .../page-header/page-header.component.ts | 2 +- 6 files changed, 67 insertions(+), 72 deletions(-) diff --git a/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.html b/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.html index 5cabf1c9b..8d4e6e637 100644 --- a/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.html +++ b/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.html @@ -97,7 +97,7 @@ file.fileId === this.file?.fileId)).subscribe(file => { @@ -240,30 +240,28 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnInit, OnD } private _setup() { - this.statusBarConfig = [{ color: this.fileStatus.status, length: 1 }]; + this.statusBarConfig = [{ color: this.file.status, length: 1 }]; this.tooltipPosition = this.isFilePreview ? 'below' : 'above'; - this.assignTooltip = this.fileStatus.isUnderApproval - ? _('dossier-overview.assign-approver') - : _('dossier-overview.assign-reviewer'); + this.assignTooltip = this.file.isUnderApproval ? _('dossier-overview.assign-approver') : _('dossier-overview.assign-reviewer'); this.buttonType = this.isFilePreview ? CircleButtonTypes.default : CircleButtonTypes.dark; this.toggleTooltip = this._toggleTooltip; - this.showUndoApproval = this.permissionsService.canUndoApproval(this.fileStatus) && !this.isDossierOverviewWorkflow; - this.showUnderReview = this.permissionsService.canSetUnderReview(this.fileStatus) && !this.isDossierOverviewWorkflow; - this.showUnderApproval = this.permissionsService.canSetUnderApproval(this.fileStatus) && !this.isDossierOverviewWorkflow; - this.showApprove = this.permissionsService.isReadyForApproval(this.fileStatus) && !this.isDossierOverviewWorkflow; + this.showUndoApproval = this.permissionsService.canUndoApproval(this.file) && !this.isDossierOverviewWorkflow; + this.showUnderReview = this.permissionsService.canSetUnderReview(this.file) && !this.isDossierOverviewWorkflow; + this.showUnderApproval = this.permissionsService.canSetUnderApproval(this.file) && !this.isDossierOverviewWorkflow; + this.showApprove = this.permissionsService.isReadyForApproval(this.file) && !this.isDossierOverviewWorkflow; - this.canToggleAnalysis = this.permissionsService.canToggleAnalysis(this.fileStatus); - this.showDelete = this.permissionsService.canDeleteFile(this.fileStatus); - this.showOCR = this.fileStatus.canBeOCRed; - this.canReanalyse = this.permissionsService.canReanalyseFile(this.fileStatus); + this.canToggleAnalysis = this.permissionsService.canToggleAnalysis(this.file); + this.showDelete = this.permissionsService.canDeleteFile(this.file); + this.showOCR = this.file.canBeOCRed; + this.canReanalyse = this.permissionsService.canReanalyseFile(this.file); - this.showStatusBar = this.fileStatus.isWorkable && this.isDossierOverviewList; + this.showStatusBar = this.file.isWorkable && this.isDossierOverviewList; - this.showAssignToSelf = this.permissionsService.canAssignToSelf(this.fileStatus) && this.isDossierOverview; - this.showAssign = this.permissionsService.canAssignUser(this.fileStatus) && this.isDossierOverview; + this.showAssignToSelf = this.permissionsService.canAssignToSelf(this.file) && this.isDossierOverview; + this.showAssign = this.permissionsService.canAssignUser(this.file) && this.isDossierOverview; - this.showOpenDocument = this.fileStatus.canBeOpened && this.isDossierOverviewWorkflow; + this.showOpenDocument = this.file.canBeOpened && this.isDossierOverviewWorkflow; this.showExcludePages = this.isFilePreview; this.showDocumentInfo = this.isFilePreview; diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.html b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.html index 4c90dc77e..fb56c35c2 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.html +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.html @@ -94,18 +94,18 @@
-
- {{ fileStatus.filename }} +
+ {{ file.filename }}
-
+
- - {{ fileStatus.primaryAttribute }} + + {{ file.primaryAttribute }}
- +
@@ -199,41 +199,41 @@
- +
-
- {{ fileStatus.filename }} +
+ {{ file.filename }}
- +
- +
- +
- {{ fileStatus.numberOfPages }} + {{ file.numberOfPages }}
- {{ fileStatus.excludedPagesCount }} + {{ file.excludedPagesCount }}
-
+
- {{ fileStatus.lastOCRTime | date: 'mediumDate' }} + {{ file.lastOCRTime | date: 'mediumDate' }}
diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts index 7d2da7fcf..8cc3fd391 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts @@ -10,7 +10,7 @@ import { TemplateRef, ViewChild } from '@angular/core'; -import { FileAttributeConfig, FileStatus } from '@redaction/red-ui-http'; +import { FileStatus, FileStatuses, IFileAttributeConfig } from '@redaction/red-ui-http'; import { AppStateService } from '@state/app-state.service'; import { FileDropOverlayService } from '@upload-download/services/file-drop-overlay.service'; import { FileUploadModel } from '@upload-download/model/file-upload.model'; @@ -52,11 +52,9 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { annotationFilterChecker } from '@utils/filter-utils'; import { PermissionsService } from '@services/permissions.service'; import { RouterHistoryService } from '@services/router-history.service'; -import { IFileAttributeConfig } from '@redaction/red-ui-http'; import { Dossier } from '@state/model/dossier'; import { Router } from '@angular/router'; import { FileActionService } from '../../services/file-action.service'; -import StatusEnum = FileStatus.StatusEnum; @Component({ templateUrl: './dossier-overview-screen.component.html', @@ -88,7 +86,7 @@ export class DossierOverviewScreenComponent extends ListingComponent imple @ViewChild('reviewerTemplate', { static: true }) reviewerTemplate: TemplateRef; @ViewChild('pagesTemplate', { static: true }) pagesTemplate: TemplateRef; @ViewChild('statusTemplate', { static: true }) statusTemplate: TemplateRef; - readonly workflowConfig: WorkflowConfig; + readonly workflowConfig: WorkflowConfig; @ViewChild(DossierDetailsComponent, { static: false }) private readonly _dossierDetailsComponent: DossierDetailsComponent; private _lastScrolledIndex: number; @@ -123,38 +121,38 @@ export class DossierOverviewScreenComponent extends ListingComponent imple ).fileAttributeConfigs; this.workflowConfig = { columnIdentifierFn: entity => entity.status, - itemVersionFn: (entity: FileStatusWrapper) => `${entity.lastUpdated}-${entity.numberOfAnalyses}`, + itemVersionFn: (entity: File) => `${entity.lastUpdated}-${entity.numberOfAnalyses}`, columns: [ { - label: fileStatusTranslations[StatusEnum.UNASSIGNED], - key: StatusEnum.UNASSIGNED, + label: fileStatusTranslations[FileStatuses.UNASSIGNED], + key: FileStatuses.UNASSIGNED, enterFn: this.unassignFn, - enterPredicate: (entity: FileStatusWrapper) => false, + enterPredicate: (entity: File) => false, color: '#D3D5DA' }, { - label: fileStatusTranslations[StatusEnum.UNDERREVIEW], + label: fileStatusTranslations[FileStatuses.UNDER_REVIEW], enterFn: this.underReviewFn, - enterPredicate: (file: FileStatusWrapper) => + enterPredicate: (file: File) => this.permissionsService.canSetUnderReview(file) || this.permissionsService.canAssignToSelf(file) || this.permissionsService.canAssignUser(file), - key: StatusEnum.UNDERREVIEW, + key: FileStatuses.UNDER_REVIEW, color: '#FDBD00' }, { - label: fileStatusTranslations[StatusEnum.UNDERAPPROVAL], + label: fileStatusTranslations[FileStatuses.UNDER_APPROVAL], enterFn: this.underApprovalFn, - enterPredicate: (file: FileStatusWrapper) => + enterPredicate: (file: File) => this.permissionsService.canSetUnderApproval(file) || this.permissionsService.canUndoApproval(file), - key: StatusEnum.UNDERAPPROVAL, + key: FileStatuses.UNDER_APPROVAL, color: '#374C81' }, { - label: fileStatusTranslations[StatusEnum.APPROVED], + label: fileStatusTranslations[FileStatuses.APPROVED], enterFn: this.approveFn, - enterPredicate: (file: FileStatusWrapper) => this.permissionsService.isReadyForApproval(file), - key: StatusEnum.APPROVED, + enterPredicate: (file: File) => this.permissionsService.isReadyForApproval(file), + key: FileStatuses.APPROVED, color: '#48C9F7' } ] @@ -173,47 +171,47 @@ export class DossierOverviewScreenComponent extends ListingComponent imple return this.fileAttributeConfigs.filter(config => config.displayedInFileList); } - unassignFn = async (file: FileStatusWrapper) => { + unassignFn = async (file: File) => { // TODO console.log('unassign', file); }; - underReviewFn = (file: FileStatusWrapper) => { + underReviewFn = (file: File) => { this._fileActionService.assignFile('reviewer', null, file, () => this._loadingService.loadWhile(this.reloadDossiers()), true); }; - underApprovalFn = async (file: FileStatusWrapper) => { + underApprovalFn = async (file: File) => { if (this._appStateService.activeDossier.approverIds.length > 1) { this._fileActionService.assignFile('approver', null, file, () => this._loadingService.loadWhile(this.reloadDossiers()), true); } else { this._loadingService.start(); - await this._fileActionService.setFileUnderApproval(file).toPromise(); + await this._fileActionService.setFilesUnderApproval([file]).toPromise(); await this.reloadDossiers(); this._loadingService.stop(); } }; - approveFn = async (file: FileStatusWrapper) => { + approveFn = async (file: File) => { this._loadingService.start(); - await this._fileActionService.setFileApproved(file).toPromise(); + await this._fileActionService.setFilesApproved([file]).toPromise(); await this.reloadDossiers(); this._loadingService.stop(); }; - actionPerformed(action?: string, fileStatus?: FileStatusWrapper) { - this._calculateData(); + actionPerformed(action?: string, fileStatus?: File) { + this.calculateData(); if (action === 'navigate') { this._router.navigate(this.routerLinkFn(fileStatus)); } } - routerLinkFn = (fileStatus: FileStatusWrapper) => + routerLinkFn = (fileStatus: File) => fileStatus.canBeOpened ? [`/main/dossiers/${this.currentDossier.id}/file/${fileStatus.fileId}`] : []; - disabledFn = (fileStatus: FileStatusWrapper) => fileStatus.excluded; + disabledFn = (fileStatus: File) => fileStatus.excluded; - lastOpenedFn = (fileStatus: FileStatusWrapper) => fileStatus.lastOpened; + lastOpenedFn = (fileStatus: File) => fileStatus.lastOpened; async ngOnInit(): Promise { this._configureTableColumns(); @@ -221,7 +219,7 @@ export class DossierOverviewScreenComponent extends ListingComponent imple try { this._fileDropOverlayService.initFileDropHandling(); - this._calculateData(); + this.calculateData(); this.addSubscription = timer(0, 7500).subscribe(async () => { await this._appStateService.reloadActiveDossierFilesIfNecessary(); @@ -229,7 +227,7 @@ export class DossierOverviewScreenComponent extends ListingComponent imple }); this.addSubscription = this._appStateService.fileChanged$.subscribe(() => { - this._calculateData(); + this.calculateData(); }); this.addSubscription = this._appStateService.dossierTemplateChanged$.subscribe(() => { @@ -277,10 +275,10 @@ export class DossierOverviewScreenComponent extends ListingComponent imple async reloadDossiers() { await this._appStateService.getFiles(this.currentDossier, false); - this._calculateData(); + this.calculateData(); } - _calculateData(): void { + calculateData(): void { if (!this._appStateService.activeDossierId) { return; } diff --git a/apps/red-ui/src/app/modules/dossier/services/file-action.service.ts b/apps/red-ui/src/app/modules/dossier/services/file-action.service.ts index 58bce9fc0..c32aa4e20 100644 --- a/apps/red-ui/src/app/modules/dossier/services/file-action.service.ts +++ b/apps/red-ui/src/app/modules/dossier/services/file-action.service.ts @@ -8,7 +8,6 @@ import { DossiersDialogService } from './dossiers-dialog.service'; import { ConfirmationDialogInput } from '@shared/dialogs/confirmation-dialog/confirmation-dialog.component'; import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { FilesService } from './files.service'; -import { Observable } from 'rxjs'; @Injectable() export class FileActionService { diff --git a/apps/red-ui/src/app/modules/shared/components/page-header/page-header.component.ts b/apps/red-ui/src/app/modules/shared/components/page-header/page-header.component.ts index eb5b3d109..2465429d6 100644 --- a/apps/red-ui/src/app/modules/shared/components/page-header/page-header.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/page-header/page-header.component.ts @@ -1,7 +1,7 @@ import { Component, EventEmitter, Input, Optional, Output, TemplateRef } from '@angular/core'; import { ActionConfig } from '@shared/components/page-header/models/action-config.model'; import { ButtonConfig } from '@shared/components/page-header/models/button-config.model'; -import { FilterService, IListable, SearchService } from '@iqser/common-ui'; +import { FilterService, IconButtonTypes, IListable, SearchService } from '@iqser/common-ui'; import { distinctUntilChanged, map } from 'rxjs/operators'; import { combineLatest, Observable, of } from 'rxjs'; import { SearchPosition, SearchPositions } from '@shared/components/page-header/models/search-positions.type';