new rule on file preview
This commit is contained in:
parent
0a2f8df11d
commit
382f590afb
@ -7,7 +7,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex-1 filename page-title">
|
<div class="flex-1 filename page-title">
|
||||||
{{ appStateService.activeFile.filename }}
|
<span
|
||||||
|
*ngIf="appStateService.fileNotUpToDateWithDictionary()"
|
||||||
|
class="pill"
|
||||||
|
translate="project-overview.new-rule.label"
|
||||||
|
></span
|
||||||
|
> <span>{{ appStateService.activeFile.filename }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex-1 actions-container">
|
<div class="flex-1 actions-container">
|
||||||
|
|||||||
@ -30,6 +30,8 @@ import { AnnotationDrawService } from '../service/annotation-draw.service';
|
|||||||
import { AnnotationProcessingService } from '../service/annotation-processing.service';
|
import { AnnotationProcessingService } from '../service/annotation-processing.service';
|
||||||
import { FilterModel } from '../../../common/filter/model/filter.model';
|
import { FilterModel } from '../../../common/filter/model/filter.model';
|
||||||
import { tap } from 'rxjs/operators';
|
import { tap } from 'rxjs/operators';
|
||||||
|
import { NotificationService, NotificationType } from '../../../notification/notification.service';
|
||||||
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
|
||||||
const KEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'];
|
const KEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'];
|
||||||
|
|
||||||
@ -46,6 +48,8 @@ export class FilePreviewScreenComponent implements OnInit {
|
|||||||
private readonly _activatedRoute: ActivatedRoute,
|
private readonly _activatedRoute: ActivatedRoute,
|
||||||
private readonly _dialogService: DialogService,
|
private readonly _dialogService: DialogService,
|
||||||
private readonly _router: Router,
|
private readonly _router: Router,
|
||||||
|
private readonly _notificationService: NotificationService,
|
||||||
|
private readonly _translateService: TranslateService,
|
||||||
private readonly _annotationProcessingService: AnnotationProcessingService,
|
private readonly _annotationProcessingService: AnnotationProcessingService,
|
||||||
private readonly _annotationDrawService: AnnotationDrawService,
|
private readonly _annotationDrawService: AnnotationDrawService,
|
||||||
private readonly _fileActionService: FileActionService,
|
private readonly _fileActionService: FileActionService,
|
||||||
@ -107,7 +111,9 @@ export class FilePreviewScreenComponent implements OnInit {
|
|||||||
loadingMessage: string;
|
loadingMessage: string;
|
||||||
|
|
||||||
public ngOnInit(): void {
|
public ngOnInit(): void {
|
||||||
this._loadFileData().subscribe(() => {});
|
this._loadFileData().subscribe(() => {
|
||||||
|
this._displayNewRuleToast();
|
||||||
|
});
|
||||||
this.appStateService.fileStatusChanged.subscribe((fileStatus: FileStatus) => {
|
this.appStateService.fileStatusChanged.subscribe((fileStatus: FileStatus) => {
|
||||||
if (fileStatus.fileId === this.fileId) {
|
if (fileStatus.fileId === this.fileId) {
|
||||||
this._loadFileData().subscribe(() => {
|
this._loadFileData().subscribe(() => {
|
||||||
@ -155,8 +161,8 @@ export class FilePreviewScreenComponent implements OnInit {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public reanalyseFile($event: MouseEvent) {
|
public reanalyseFile($event?: MouseEvent) {
|
||||||
$event.stopPropagation();
|
$event?.stopPropagation();
|
||||||
this.viewReady = false;
|
this.viewReady = false;
|
||||||
this.loadingMessage = 'file-preview.reanalyse-file';
|
this.loadingMessage = 'file-preview.reanalyse-file';
|
||||||
this._reanalysisControllerService
|
this._reanalysisControllerService
|
||||||
@ -510,4 +516,31 @@ export class FilePreviewScreenComponent implements OnInit {
|
|||||||
this._fileActionService.setApproved(this.appStateService.activeFile);
|
this._fileActionService.setApproved(this.appStateService.activeFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _displayNewRuleToast() {
|
||||||
|
if (this.appStateService.fileNotUpToDateWithDictionary()) {
|
||||||
|
this._notificationService.showToastNotification(
|
||||||
|
`${this._translateService.instant('project-overview.new-rule.toast.message-file')}`,
|
||||||
|
null,
|
||||||
|
NotificationType.WARNING,
|
||||||
|
{
|
||||||
|
disableTimeOut: true,
|
||||||
|
positionClass: 'toast-top-left',
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
title: this._translateService.instant(
|
||||||
|
'project-overview.new-rule.toast.actions.reanalyse-file'
|
||||||
|
),
|
||||||
|
action: () => this.reanalyseFile()
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: this._translateService.instant(
|
||||||
|
'project-overview.new-rule.toast.actions.later'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -215,7 +215,7 @@
|
|||||||
<redaction-simple-doughnut-chart
|
<redaction-simple-doughnut-chart
|
||||||
[config]="projectsChartData"
|
[config]="projectsChartData"
|
||||||
[strokeWidth]="15"
|
[strokeWidth]="15"
|
||||||
[subtitle]="'project-listing.stats.charts.projects.label'"
|
[subtitle]="'project-listing.stats.charts.projects'"
|
||||||
></redaction-simple-doughnut-chart>
|
></redaction-simple-doughnut-chart>
|
||||||
|
|
||||||
<div class="project-stats-container">
|
<div class="project-stats-container">
|
||||||
@ -240,7 +240,7 @@
|
|||||||
<redaction-simple-doughnut-chart
|
<redaction-simple-doughnut-chart
|
||||||
[config]="documentsChartData"
|
[config]="documentsChartData"
|
||||||
[strokeWidth]="15"
|
[strokeWidth]="15"
|
||||||
[subtitle]="'project-listing.stats.charts.total-documents.label'"
|
[subtitle]="'project-listing.stats.charts.total-documents'"
|
||||||
></redaction-simple-doughnut-chart>
|
></redaction-simple-doughnut-chart>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -171,7 +171,7 @@
|
|||||||
{{ fileStatus.filename }}
|
{{ fileStatus.filename }}
|
||||||
</div>
|
</div>
|
||||||
<span
|
<span
|
||||||
*ngIf="fileNotUpToDateWithDictionary(fileStatus)"
|
*ngIf="appStateService.fileNotUpToDateWithDictionary(fileStatus)"
|
||||||
class="pill"
|
class="pill"
|
||||||
translate="project-overview.new-rule.label"
|
translate="project-overview.new-rule.label"
|
||||||
></span>
|
></span>
|
||||||
@ -248,7 +248,7 @@
|
|||||||
*ngIf="
|
*ngIf="
|
||||||
userService.isManager(user) || appStateService.isActiveProjectOwner
|
userService.isManager(user) || appStateService.isActiveProjectOwner
|
||||||
"
|
"
|
||||||
[matTooltip]="'project-overview.delete.action.label' | translate"
|
[matTooltip]="'project-overview.delete.action' | translate"
|
||||||
[matTooltipPosition]="'above'"
|
[matTooltipPosition]="'above'"
|
||||||
color="accent"
|
color="accent"
|
||||||
mat-icon-button
|
mat-icon-button
|
||||||
@ -257,7 +257,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
(click)="downloadFileRedactionReport($event, fileStatus)"
|
(click)="downloadFileRedactionReport($event, fileStatus)"
|
||||||
[matTooltip]="'project-overview.report.action.label' | translate"
|
[matTooltip]="'project-overview.report.action' | translate"
|
||||||
[matTooltipPosition]="'above'"
|
[matTooltipPosition]="'above'"
|
||||||
color="accent"
|
color="accent"
|
||||||
mat-icon-button
|
mat-icon-button
|
||||||
@ -270,7 +270,7 @@
|
|||||||
appStateService.isActiveProjectMember &&
|
appStateService.isActiveProjectMember &&
|
||||||
!isApprovedOrUnderApproval(fileStatus)
|
!isApprovedOrUnderApproval(fileStatus)
|
||||||
"
|
"
|
||||||
[matTooltip]="'project-overview.assign.action.label' | translate"
|
[matTooltip]="'project-overview.assign.action' | translate"
|
||||||
[matTooltipPosition]="'above'"
|
[matTooltipPosition]="'above'"
|
||||||
color="accent"
|
color="accent"
|
||||||
mat-icon-button
|
mat-icon-button
|
||||||
@ -280,7 +280,7 @@
|
|||||||
<button
|
<button
|
||||||
(click)="reanalyseFile($event, fileStatus)"
|
(click)="reanalyseFile($event, fileStatus)"
|
||||||
*ngIf="!isApprovedOrUnderApproval(fileStatus)"
|
*ngIf="!isApprovedOrUnderApproval(fileStatus)"
|
||||||
[matTooltip]="'project-overview.reanalyse.action.label' | translate"
|
[matTooltip]="'project-overview.reanalyse.action' | translate"
|
||||||
[matTooltipPosition]="'above'"
|
[matTooltipPosition]="'above'"
|
||||||
color="accent"
|
color="accent"
|
||||||
mat-icon-button
|
mat-icon-button
|
||||||
|
|||||||
@ -107,7 +107,7 @@ export class ProjectOverviewScreenComponent implements OnInit, OnDestroy {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
if (
|
if (
|
||||||
!this.appStateService.activeProject.files.filter((file) =>
|
!this.appStateService.activeProject.files.filter((file) =>
|
||||||
this.fileNotUpToDateWithDictionary(file)
|
this.appStateService.fileNotUpToDateWithDictionary(file)
|
||||||
).length
|
).length
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
@ -115,7 +115,7 @@ export class ProjectOverviewScreenComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
this._notificationService.showToastNotification(
|
this._notificationService.showToastNotification(
|
||||||
`${this._translateService.instant(
|
`${this._translateService.instant(
|
||||||
'project-overview.new-rule.toast.message'
|
'project-overview.new-rule.toast.message-project'
|
||||||
)} <span class="pill">${this._translateService.instant(
|
)} <span class="pill">${this._translateService.instant(
|
||||||
'project-overview.new-rule.label'
|
'project-overview.new-rule.label'
|
||||||
)}</span>`,
|
)}</span>`,
|
||||||
@ -348,13 +348,6 @@ export class ProjectOverviewScreenComponent implements OnInit, OnDestroy {
|
|||||||
return filterMatched;
|
return filterMatched;
|
||||||
}
|
}
|
||||||
|
|
||||||
fileNotUpToDateWithDictionary(fileStatus: FileStatus) {
|
|
||||||
return (
|
|
||||||
(fileStatus.status === 'UNASSIGNED' || fileStatus.status === 'UNDER_REVIEW') &&
|
|
||||||
fileStatus.dictionaryVersion !== this.appStateService.dictionaryVersion
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
requestApprovalOrApproveFile($event: MouseEvent, fileStatus: FileStatus) {
|
requestApprovalOrApproveFile($event: MouseEvent, fileStatus: FileStatus) {
|
||||||
$event.stopPropagation();
|
$event.stopPropagation();
|
||||||
|
|
||||||
|
|||||||
@ -480,4 +480,14 @@ export class AppStateService {
|
|||||||
this.isActiveProjectOwnerAndManager
|
this.isActiveProjectOwnerAndManager
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fileNotUpToDateWithDictionary(fileStatus?: FileStatus) {
|
||||||
|
if (!fileStatus) {
|
||||||
|
fileStatus = this.activeFile;
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
(fileStatus.status === 'UNASSIGNED' || fileStatus.status === 'UNDER_REVIEW') &&
|
||||||
|
fileStatus.dictionaryVersion !== this.dictionaryVersion
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -169,9 +169,11 @@
|
|||||||
"new-rule": {
|
"new-rule": {
|
||||||
"label": "New Rule",
|
"label": "New Rule",
|
||||||
"toast": {
|
"toast": {
|
||||||
"message": "Some documents were not processed with the latest rule/dictionary set. They are marked with:\n\n",
|
"message-project": "Some documents were not processed with the latest rule/dictionary set. They are marked with:\n\n",
|
||||||
|
"message-file": "This documents was not processed with the latest rule/dictionary set.\n\n",
|
||||||
"actions": {
|
"actions": {
|
||||||
"reanalyse-all": "Reanalyse all",
|
"reanalyse-all": "Reanalyse all",
|
||||||
|
"reanalyse-file": "Reanalyse this file",
|
||||||
"later": "Later"
|
"later": "Later"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user