fixed bugs

This commit is contained in:
Timo Bejan 2020-11-17 17:28:06 +02:00
parent 699253406b
commit 936b0df638
9 changed files with 22 additions and 35 deletions

View File

@ -22,7 +22,7 @@
<div class="breakdown-container">
<div>
<div *ngFor="let val of parsedConfig" [class.active]="val.checked" [class.filter-disabled]="!filter" (click)="toggleFilter.emit(val.label)">
<div *ngFor="let val of parsedConfig" [class.active]="val.checked" [class.filter-disabled]="!filter" (click)="toggleFilter.emit(val.key)">
<redaction-status-bar
[small]="true"
[config]="[

View File

@ -6,6 +6,7 @@ export class DoughnutChartConfig {
value: number;
color: Color;
label: string;
key?: string;
active?: boolean;
}
@ -78,7 +79,7 @@ export class SimpleDoughnutChartComponent implements OnChanges {
.filter((el) => el.value)
.map((el) => ({
...el,
checked: this.filter?.find((f) => f.key === el.label)?.checked
checked: this.filter?.find((f) => f.key === el.key)?.checked
}));
}
}

View File

@ -1,4 +1,5 @@
<redaction-annotation-icon *ngIf="filter.key === 'redaction'" type="square" label="R" color="#283241"></redaction-annotation-icon>
<redaction-annotation-icon *ngIf="filter.key === 'analysis'" type="square" label="A" [color]="dictionaryColor"></redaction-annotation-icon>
<redaction-annotation-icon *ngIf="filter.key === 'hint'" type="round" label="H" color="#9398a0"></redaction-annotation-icon>
<redaction-annotation-icon *ngIf="filter.key === 'manual'" type="square" label="M" [color]="dictionaryColor"></redaction-annotation-icon>
@ -7,6 +8,7 @@
<redaction-annotation-icon
*ngIf="
filter.key === 'suggestion-remove' ||
filter.key === 'suggestion' ||
filter.key === 'suggestion-add' ||
filter.key === 'suggestion-remove-dictionary' ||
filter.key === 'suggestion-add-dictionary'

View File

@ -86,6 +86,10 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy {
set redactedView(value: boolean) {
this._activeViewer = value ? 'REDACTED' : 'ANNOTATED';
this._updateCanPerformActions();
}
private _updateCanPerformActions() {
this.canPerformAnnotationActions = this.permissionsService.canPerformAnnotationActions() && this._activeViewer === 'ANNOTATED';
}
@ -114,14 +118,14 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy {
)
.subscribe();
this._loadFileData().subscribe(() => {
this.canPerformAnnotationActions = this.permissionsService.canPerformAnnotationActions(this.fileData.fileStatus);
this._updateCanPerformActions();
});
this.appStateService.fileReanalysed.subscribe((fileStatus: FileStatusWrapper) => {
if (fileStatus.fileId === this.fileId) {
this._loadFileData(true).subscribe(() => {
this.viewReady = true;
this.loadingMessage = null;
this.canPerformAnnotationActions = this.permissionsService.canPerformAnnotationActions(this.fileData.fileStatus);
this._updateCanPerformActions();
this._cleanupAndRedrawManualAnnotations();
this._fileDownloadService.loadRedactedView(this.fileData);
});
@ -444,7 +448,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy {
}
await this._loadFileData().toPromise();
this.canPerformAnnotationActions = this.permissionsService.canPerformAnnotationActions();
this._updateCanPerformActions();
await this.appStateService.reloadActiveProjectFiles();
}
@ -454,13 +458,13 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy {
public assignReviewer() {
this._fileActionService.assignProjectReviewer(this.fileData.fileStatus, async () => {
this.canPerformAnnotationActions = this.permissionsService.canPerformAnnotationActions();
this._updateCanPerformActions();
});
}
public async assignToMe() {
await this._fileActionService.assignToMe(this.fileData.fileStatus, async () => {
this.canPerformAnnotationActions = this.permissionsService.canPerformAnnotationActions();
this._updateCanPerformActions();
});
}
}

View File

@ -27,7 +27,9 @@ export class PageIndicatorComponent implements OnChanges, OnInit {
) {}
ngOnInit(): void {
this.canMarkPagesAsViewed = this._permissionService.canMarkPagesAsViewed();
this._appStateService.fileChanged.subscribe(() => {
this.canMarkPagesAsViewed = this._permissionService.canMarkPagesAsViewed();
});
}
ngOnChanges(changes: SimpleChanges): void {

View File

@ -16,13 +16,6 @@
[icon]="'red:user'"
(filtersChanged)="filtersChanged()"
></redaction-filter>
<redaction-filter
[filters]="dueDateFilters"
[filterLabel]="'filters.due-date'"
[hasArrow]="false"
[icon]="'red:lightning'"
(filtersChanged)="filtersChanged()"
></redaction-filter>
<redaction-filter
(filtersChanged)="filtersChanged()"
[filterLabel]="'filters.needs-work'"

View File

@ -9,7 +9,6 @@ import { FilterModel } from '../../common/filter/model/filter.model';
import * as moment from 'moment';
import {
annotationFilterChecker,
dueDateChecker,
getFilteredEntities,
processFilters,
projectMemberChecker,
@ -35,7 +34,6 @@ export class ProjectListingScreenComponent implements OnInit, OnDestroy {
public documentsChartData: DoughnutChartConfig[] = [];
public statusFilters: FilterModel[];
public dueDateFilters: FilterModel[];
public peopleFilters: FilterModel[];
public needsWorkFilters: FilterModel[];
@ -91,7 +89,8 @@ export class ProjectListingScreenComponent implements OnInit, OnDestroy {
this.documentsChartData.push({
value: groups[key].length,
color: key,
label: key
label: key,
key: key
});
}
}
@ -175,15 +174,10 @@ export class ProjectListingScreenComponent implements OnInit, OnDestroy {
private _computeAllFilters() {
const allDistinctFileStatus = new Set<string>();
const allDistinctPeople = new Set<string>();
const allDistinctDueDates = new Set<string>();
const allDistinctNeedsWork = new Set<string>();
this.appStateService.allProjects.forEach((entry) => {
// all people
entry.project.memberIds.forEach((memberId) => allDistinctPeople.add(memberId));
// due date
if (entry.dueDate) {
allDistinctDueDates.add(moment(entry.dueDate).format('DD/MM/YYYY'));
}
// file statuses
entry.files.forEach((file) => {
allDistinctFileStatus.add(file.status);
@ -218,15 +212,6 @@ export class ProjectListingScreenComponent implements OnInit, OnDestroy {
});
this.peopleFilters = processFilters(this.peopleFilters, peopleFilters);
const dueDateFilters = [];
allDistinctDueDates.forEach((date) => {
dueDateFilters.push({
key: date,
label: date
});
});
this.dueDateFilters = processFilters(this.dueDateFilters, dueDateFilters);
const needsWorkFilters = [];
allDistinctNeedsWork.forEach((type) => {
needsWorkFilters.push({
@ -254,7 +239,6 @@ export class ProjectListingScreenComponent implements OnInit, OnDestroy {
const filters = [
{ values: this.statusFilters, checker: projectStatusChecker },
{ values: this.peopleFilters, checker: projectMemberChecker },
{ values: this.dueDateFilters, checker: dueDateChecker },
{ values: this.needsWorkFilters, checker: annotationFilterChecker, matchAll: true, checkerArgs: this.permissionsService }
];
this.detailsContainerFilters = {

View File

@ -70,7 +70,7 @@ export class ProjectDetailsComponent implements OnInit {
const groups = groupBy(this.appStateService.activeProject?.files, 'status');
this.documentsChartData = [];
for (const key of Object.keys(groups)) {
this.documentsChartData.push({ value: groups[key].length, color: key, label: key });
this.documentsChartData.push({ value: groups[key].length, color: key, label: key, key: key });
}
this._changeDetectorRef.detectChanges();
}
@ -81,6 +81,7 @@ export class ProjectDetailsComponent implements OnInit {
}
public toggleFilter(filterType: 'needsWorkFilters' | 'statusFilters', key: string): void {
console.log(this.filters, filterType, this.filters[filterType], key);
const filter = this.filters[filterType].find((f) => f.key === key);
filter.checked = !filter.checked;
this.filtersChanged.emit(this.filters);

View File

@ -152,7 +152,7 @@
"new-rule": {
"label": "Outdated",
"toast": {
"message-project": "Renalysis required: ",
"message-project": "Reanalysis required: ",
"actions": {
"reanalyse-all": "Reanalyze all",
"reanalyse-file": "Reanalyze this file",