diff --git a/src/portal/src/app/base/left-side-nav/log/recent-log.component.html b/src/portal/src/app/base/left-side-nav/log/recent-log.component.html index 7a101bc8d..f494aaa06 100644 --- a/src/portal/src/app/base/left-side-nav/log/recent-log.component.html +++ b/src/portal/src/app/base/left-side-nav/log/recent-log.component.html @@ -56,6 +56,12 @@ {{ 'AUDIT_LOG.OPERATION' | translate }} + {{ + 'AUDIT_LOG.IP_ADDRESS' | translate + }} + {{ + 'AUDIT_LOG.USER_AGENT' | translate + }} {{ 'AUDIT_LOG.TIMESTAMP' | translate }} @@ -67,6 +73,12 @@ {{ l.resource }} {{ l.resource_type }} {{ l.operation }} + {{ + l.client_ip + }} + {{ + l.user_agent + }} {{ l.op_time | harborDatetime : 'short' }} diff --git a/src/portal/src/app/base/left-side-nav/log/recent-log.component.spec.ts b/src/portal/src/app/base/left-side-nav/log/recent-log.component.spec.ts index 722a4aa00..33c3b2df7 100644 --- a/src/portal/src/app/base/left-side-nav/log/recent-log.component.spec.ts +++ b/src/portal/src/app/base/left-side-nav/log/recent-log.component.spec.ts @@ -10,6 +10,7 @@ import { AuditlogService } from '../../../../../ng-swagger-gen/services/auditlog import { HttpHeaders, HttpResponse } from '@angular/common/http'; import { delay } from 'rxjs/operators'; import { SharedTestingModule } from '../../../shared/shared.module'; +import { AppConfigService } from '../../../services/app-config.service'; describe('RecentLogComponent (inline template)', () => { let component: RecentLogComponent; @@ -20,6 +21,9 @@ describe('RecentLogComponent (inline template)', () => { return undefined; }, }; + let fakeAppConfigService = { + handleError: () => {}, + }; const mockedAuditLogs: AuditLog[] = []; for (let i = 0; i < 18; i++) { let item: AuditLog = { @@ -83,6 +87,7 @@ describe('RecentLogComponent (inline template)', () => { providers: [ { provide: ErrorHandler, useValue: fakedErrorHandler }, { provide: AuditlogService, useValue: fakedAuditlogService }, + { provide: AppConfigService, useValue: fakeAppConfigService }, ], }).compileComponents(); }); diff --git a/src/portal/src/app/base/left-side-nav/log/recent-log.component.ts b/src/portal/src/app/base/left-side-nav/log/recent-log.component.ts index a65f7f461..065552830 100644 --- a/src/portal/src/app/base/left-side-nav/log/recent-log.component.ts +++ b/src/portal/src/app/base/left-side-nav/log/recent-log.component.ts @@ -17,6 +17,7 @@ import { finalize } from 'rxjs/operators'; import { AuditlogService } from '../../../../../ng-swagger-gen/services/auditlog.service'; import { AuditLog } from '../../../../../ng-swagger-gen/models/audit-log'; import { ClrDatagridStateInterface } from '@clr/angular'; +import { AppConfigService } from '../../../services/app-config.service'; import { getPageSizeFromLocalStorage, PageSizeMapKeys, @@ -43,7 +44,8 @@ export class RecentLogComponent { constructor( private logService: AuditlogService, - private errorHandler: ErrorHandler + private errorHandler: ErrorHandler, + private appConfigService: AppConfigService ) {} public get inProgress(): boolean { @@ -74,7 +76,18 @@ export class RecentLogComponent { this.defaultFilter = $event['target'].value; this.doFilter(this.currentTerm); } - + isIPTracked(): boolean { + if (this.appConfigService?.configurations?.audit_log_track_ip_address) { + return true; + } + return false; + } + isUATracked(): boolean { + if (this.appConfigService?.configurations?.audit_log_track_user_agent) { + return true; + } + return false; + } load(state?: ClrDatagridStateInterface) { if (state && state.page) { this.pageSize = state.page.size; diff --git a/src/portal/src/i18n/lang/de-de-lang.json b/src/portal/src/i18n/lang/de-de-lang.json index 6ee34ea88..a141d482f 100644 --- a/src/portal/src/i18n/lang/de-de-lang.json +++ b/src/portal/src/i18n/lang/de-de-lang.json @@ -533,11 +533,11 @@ "OF": "von", "NOT_FOUND": "Es konnten keine Logdaten gefunden werden!", "RESOURCE": "Ressource", - "RESOURCE_TYPE": "Ressourcen-Typ", - "TRACK_IP": "IP-Address in Audit Log", - "TRACK_IP_TOOLTIP": "Capture the client's IP addresses on each request and store them in the audit log.", - "TRACK_UA": "User-Agent in Audit Log", - "TRACK_UA_TOOLTIP": "Capture the client's User-Agent on each request and store it in the audit log." + "RESOURCE_TYPE": "Ressourcen Typ", + "TRACK_IP": "IP-Adresse im Audit-Log", + "TRACK_IP_TOOLTIP": "Die IP-Adresse des Clients wird bei jeder Anfrage erfasst und im Audit-Protokoll gespeichert.", + "TRACK_UA": "Benutzer-Agent im Audit-Log", + "TRACK_UA_TOOLTIP": "Der Benutzer-Agent des Clients wird bei jeder Anfrage erfasst und im Audit-Protokoll gespeichert." }, "REPLICATION": { "PUSH_BASED_ONLY": "Only for the push-based replication", diff --git a/src/portal/src/i18n/lang/en-us-lang.json b/src/portal/src/i18n/lang/en-us-lang.json index 283697b00..32f366eaf 100644 --- a/src/portal/src/i18n/lang/en-us-lang.json +++ b/src/portal/src/i18n/lang/en-us-lang.json @@ -536,7 +536,7 @@ "RESOURCE": "Resource", "RESOURCE_TYPE": "Resource Type", "IP_ADDRESS": "IP Address", - "USER_AGENT": "User Agent", + "USER_AGENT": "User-Agent", "TRACK_IP": "IP-Address in Audit Log", "TRACK_IP_TOOLTIP": "Capture the client's IP addresses on each request and store them in the audit log.", "TRACK_UA": "User-Agent in Audit Log",