Skip to content

Commit a7b8519

Browse files
committed
[DURACOM-317] fix/improve audit view
1 parent c6745bd commit a7b8519

4 files changed

Lines changed: 21 additions & 38 deletions

File tree

src/app/audit-page/audit-table/audit-table.component.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
<th>{{ 'audit.overview.table.eperson' | translate }}</th>
1515
<th>{{ 'audit.overview.table.timestamp' | translate }}</th>
1616
@if (isOverviewPage) {
17-
<th>{{ 'audit.overview.table.objectUUID' | translate }}</th>
18-
<th>{{ 'audit.overview.table.objectType' | translate }}</th>
1917
<th>{{ 'audit.overview.table.subjectUUID' | translate }}</th>
2018
<th>{{ 'audit.overview.table.subjectType' | translate }}</th>
19+
<th>{{ 'audit.overview.table.objectUUID' | translate }}</th>
20+
<th>{{ 'audit.overview.table.objectType' | translate }}</th>
2121
} @else {
2222
<th>{{ 'audit.overview.table.other' | translate }}</th>
2323
}
@@ -55,7 +55,11 @@
5555
}
5656
</td>
5757
<td>{{ audit.objectType }}</td>
58-
<td>{{ audit.subjectUUID }}</td>
58+
<td>
59+
@if (audit.subjectUUID) {
60+
<a [routerLink]="['/auditlogs/object/', audit.subjectUUID]">{{audit.subjectUUID}}</a>
61+
}
62+
</td>
5963
<td>{{ audit.subjectType }}</td>
6064
} @else {
6165
<td>

src/app/audit-page/object-audit-overview/object-audit-overview.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
<h1 class="flex-grow-1">{{'audit.object.overview.title' | translate}}</h1>
44
</div>
55

6-
@if (object) {
7-
<h2 class="h4 mt-4 mb-4">{{ object.name }} (<em>{{object.type}}</em>)</h2>
6+
@if (objectId) {
7+
<!--<h2 class="h4 mt-4 mb-4">{{ object.name }} (<em>{{object.type}}</em>)</h2>-->
88
@if ((auditsRD$ | async)?.payload; as audits) {
99
<ds-audit-table
1010
[audits]="audits"
1111
[pageConfig]="pageConfig"
1212
[object]="object"
1313
></ds-audit-table>
1414
}
15-
<a class="btn btn-light mt-3" [routerLink]="['/items', object.id]"><i class="fas fa-arrow-left"></i>{{ 'audit.object.back' | translate }}</a>
15+
<a class="btn btn-light mt-3" [routerLink]="['/items', objectId]"><i class="fas fa-arrow-left"></i>{{ 'audit.object.back' | translate }}</a>
1616
@if ((auditsRD$ | async)?.statusCode === 404) {
1717
<h2 class="h4 mt-4 mb-4">{{'audit.object.overview.disabled.message' | translate}}</h2>
1818
}

src/app/audit-page/object-audit-overview/object-audit-overview.component.ts

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
filter,
2222
map,
2323
mergeMap,
24-
switchMap,
24+
switchMap, tap,
2525
} from 'rxjs/operators';
2626

2727
import { COLLECTION_PAGE_LINKS_TO_FOLLOW } from '../../collection-page/collection-page.resolver';
@@ -92,7 +92,7 @@ export class ObjectAuditOverviewComponent implements OnInit, OnDestroy {
9292
*/
9393
dateFormat = 'yyyy-MM-dd HH:mm:ss';
9494

95-
owningCollection$: Observable<Collection>;
95+
objectId: string;
9696

9797
dataNotAvailable = AUDIT_PERSON_NOT_AVAILABLE;
9898

@@ -108,19 +108,9 @@ export class ObjectAuditOverviewComponent implements OnInit, OnDestroy {
108108

109109
ngOnInit(): void {
110110
this.sub = this.route.paramMap.pipe(
111-
switchMap((paramMap: ParamMap) => this.itemService.findById(paramMap.get('objectId'))),
112-
getFirstCompletedRemoteData(),
113-
).subscribe((rd) => {
114-
this.object = rd.payload;
115-
this.owningCollection$ = this.collectionDataService.findOwningCollectionFor(
116-
this.object,
117-
true,
118-
false,
119-
...COLLECTION_PAGE_LINKS_TO_FOLLOW,
120-
).pipe(
121-
getFirstCompletedRemoteData(),
122-
map(data => data?.payload),
123-
);
111+
map((paramMap: ParamMap) => paramMap.get('objectId')),
112+
).subscribe((id) => {
113+
this.objectId = id;
124114
this.setAudits();
125115
});
126116
}
@@ -136,15 +126,11 @@ export class ObjectAuditOverviewComponent implements OnInit, OnDestroy {
136126
*/
137127
setAudits() {
138128
const config$ = this.paginationService.getFindListOptions(this.pageConfig.id, this.config);
139-
const parentCommunity$ = this.owningCollection$.pipe(
140-
switchMap(collection => collection.parentCommunity),
141-
getFirstCompletedRemoteData(),
142-
map(data => data?.payload),
143-
);
144129

145-
this.auditsRD$ = combineLatest([ config$, this.owningCollection$, parentCommunity$]).pipe(
146-
switchMap(([config, owningCollection, parentCommunity]) =>
147-
this.auditService.findByObject(this.object.id, config, owningCollection.id, parentCommunity.id).pipe(
130+
this.auditsRD$ = config$.pipe(
131+
tap(console.log),
132+
switchMap((config) =>
133+
this.auditService.findByObject(this.objectId, config).pipe(
148134
getFirstCompletedRemoteData(),
149135
),
150136
),
@@ -160,7 +146,7 @@ export class ObjectAuditOverviewComponent implements OnInit, OnDestroy {
160146
const updatedAudits$ = auditsRD.payload.page.map(audit => {
161147
return forkJoin({
162148
epersonName: this.auditService.getEpersonName(audit),
163-
otherAuditObject: this.auditService.getOtherObject(audit, this.object.id),
149+
otherAuditObject: this.auditService.getOtherObject(audit, this.objectId),
164150
}).pipe(
165151
map(({ epersonName, otherAuditObject }) =>
166152
Object.assign(new Audit(), audit, { epersonName, otherAuditObject }),

src/app/core/audit/audit-data.service.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,10 @@ export class AuditDataService extends IdentifiableDataService<Audit>{
6666
* @param commUuid The Uuid of the community
6767
* @return Observable<RemoteData<PaginatedList<Audit>>>
6868
*/
69-
findByObject(objectId: string, options: FindListOptions = {}, collUuid?: string, commUuid?: string): Observable<RemoteData<PaginatedList<Audit>>> {
69+
findByObject(objectId: string, options: FindListOptions = {}): Observable<RemoteData<PaginatedList<Audit>>> {
7070
const searchMethod = AUDIT_FIND_BY_OBJECT_SEARCH_METHOD;
7171
const searchParams = [new RequestParam('object', objectId)];
7272

73-
if (hasValue(commUuid)) {
74-
searchParams.push(new RequestParam('commUuid', commUuid));
75-
}
76-
77-
if (hasValue(collUuid)) {
78-
searchParams.push(new RequestParam('collUuid', collUuid));
79-
}
8073
const optionsWithObject = Object.assign(new FindListOptions(), options, {
8174
searchParams,
8275
});

0 commit comments

Comments
 (0)