changelog v1
This commit is contained in:
parent
561c54c6c4
commit
4ffebf30b3
@ -13,6 +13,8 @@ export class AnnotationData {
|
||||
}
|
||||
|
||||
export class FileDataModel {
|
||||
hasChangeLog: boolean;
|
||||
|
||||
constructor(public file: File, public fileData: Blob, public redactionLog: RedactionLog, public viewedPages?: ViewedPages) {}
|
||||
|
||||
getAnnotations(
|
||||
@ -56,10 +58,7 @@ export class FileDataModel {
|
||||
Object.assign(redactionLogEntryWrapper, redactionLogEntry);
|
||||
redactionLogEntryWrapper.type = redactionLogEntry.type;
|
||||
|
||||
redactionLogEntryWrapper.isChangeLogEntry = this._isChangeLogEntry(redactionLogEntry);
|
||||
// redactionLogEntryWrapper.changeLogType = changeLogEntry.changeType;
|
||||
// redactionLogEntryWrapper.isChangeLogEntry = !!existingChangeLogEntry;
|
||||
redactionLogEntryWrapper.changeLogType = 'ADDED';
|
||||
this._isChangeLogEntry(redactionLogEntry, redactionLogEntryWrapper);
|
||||
|
||||
if (
|
||||
redactionLogEntryWrapper.status === 'DECLINED' &&
|
||||
@ -98,23 +97,42 @@ export class FileDataModel {
|
||||
redactionLogEntry.legalBasisList = this.redactionLog.legalBasis;
|
||||
});
|
||||
|
||||
result = result.filter(r => !r.hidden);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
get hasChangeLog() {
|
||||
// TODO DELTA VIEW
|
||||
return false;
|
||||
}
|
||||
|
||||
private _isChangeLogEntry(redactionLogEntry: RedactionLogEntry) {
|
||||
private _isChangeLogEntry(redactionLogEntry: RedactionLogEntry, wrapper: RedactionLogEntryWrapper) {
|
||||
redactionLogEntry.changes.sort((a, b) => moment(a.dateTime).date() - moment(b.dateTime).date());
|
||||
//
|
||||
// relevantChanges = redactionLogEntry.changes.filter(moment(change.dateTime).date() > );
|
||||
//
|
||||
// lastSeenState = redactionLogEntry.changes.indexOf(relevantChanges[0]-1);
|
||||
//
|
||||
//
|
||||
// if(redactionLogEntry.)
|
||||
return false;
|
||||
|
||||
const lastChange =
|
||||
redactionLogEntry.changes.length >= 1 ? redactionLogEntry.changes[redactionLogEntry.changes.length - 1] : undefined;
|
||||
const page = redactionLogEntry.positions?.[0].page;
|
||||
const viewTime = this.viewedPages.pages
|
||||
.filter(p => p.page === page)
|
||||
.map(p => moment(p.viewedTime))
|
||||
.pop();
|
||||
|
||||
// page has been seen -> let's see if it's a change
|
||||
if (viewTime) {
|
||||
// these are all unseen changes
|
||||
const relevantChanges = redactionLogEntry.changes.filter(change => moment(change.dateTime).date() > viewTime.date());
|
||||
console.log(viewTime.date(), relevantChanges, redactionLogEntry.positions[0].page);
|
||||
// at least one unseen change
|
||||
if (relevantChanges.length > 0) {
|
||||
wrapper.changeLogType = relevantChanges[relevantChanges.length - 1].type;
|
||||
wrapper.isChangeLogEntry = true;
|
||||
this.hasChangeLog = true;
|
||||
} else {
|
||||
// no relevant changes - hide removed anyway
|
||||
wrapper.isChangeLogEntry = false;
|
||||
wrapper.hidden = lastChange && lastChange.type === 'REMOVED';
|
||||
}
|
||||
} else {
|
||||
// Page doesn't have a view-time
|
||||
wrapper.isChangeLogEntry = false;
|
||||
wrapper.hidden = lastChange && lastChange.type === 'REMOVED';
|
||||
}
|
||||
// console.log(wrapper.changeLogType, wrapper.hidden, wrapper.isChangeLogEntry, wrapper.value, lastChange);
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,6 +24,7 @@ export class AnnotationsListComponent {
|
||||
@Output() readonly deselectAnnotations = new EventEmitter<AnnotationWrapper[]>();
|
||||
|
||||
annotationClicked(annotation: AnnotationWrapper, $event: MouseEvent): void {
|
||||
console.log(annotation);
|
||||
if (($event.target as IqserEventTarget).localName === 'input') {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -571,6 +571,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
this.addSubscription = timer(0, 5000).subscribe(async () => this.appStateService.reloadActiveFile());
|
||||
this.addSubscription = this.appStateService.fileReanalysed$.subscribe(async (file: File) => {
|
||||
if (file.fileId === this.fileId) {
|
||||
console.log('file', file);
|
||||
await this._loadFileData(!this._reloadFileOnReanalysis);
|
||||
this._reloadFileOnReanalysis = false;
|
||||
this._loadingService.stop();
|
||||
@ -593,6 +594,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
if (!fileData.file?.isPending && !fileData.file?.isError) {
|
||||
if (performUpdate) {
|
||||
this.fileData.redactionLog = fileData.redactionLog;
|
||||
this.fileData.viewedPages = fileData.viewedPages;
|
||||
this.fileData.file = fileData.file;
|
||||
this.rebuildFilters(true);
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user