From e8455c73b54277d2e58e163d555f20ad0c6b99f9 Mon Sep 17 00:00:00 2001 From: Maksym Trofimenko Date: Fri, 12 Jan 2024 20:15:48 +0000 Subject: [PATCH] add ip, ua columns to the recent logs update translations Signed-off-by: Maksym Trofimenko --- .../left-side-nav/log/recent-log.component.html | 12 ++++++++++++ .../log/recent-log.component.spec.ts | 5 +++++ .../left-side-nav/log/recent-log.component.ts | 17 +++++++++++++++-- src/portal/src/i18n/lang/de-de-lang.json | 10 +++++----- src/portal/src/i18n/lang/en-us-lang.json | 2 +- 5 files changed, 38 insertions(+), 8 deletions(-) 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 7a101bc8d1dd..f494aaa063ad 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 722a4aa00667..33c3b2df758b 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 a65f7f4619e2..06555283008c 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 1e9926b294f9..47a5b0dd9a43 100644 --- a/src/portal/src/i18n/lang/de-de-lang.json +++ b/src/portal/src/i18n/lang/de-de-lang.json @@ -530,11 +530,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 e9dc0ae41652..03a305cae599 100644 --- a/src/portal/src/i18n/lang/en-us-lang.json +++ b/src/portal/src/i18n/lang/en-us-lang.json @@ -533,7 +533,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",