mirror of https://github.com/goharbor/harbor.git
Fix: Audit Log Eventtype antipattern in System Settings UI (#22147)
fix: Audit Log Eventtype antipattern in System Settings * update logic from disabled to enabled * update i18n to reflect the change Signed-off-by: bupd <bupdprasanth@gmail.com>
This commit is contained in:
parent
c0a859d538
commit
0cf2d7545d
|
@ -317,7 +317,7 @@
|
|||
</clr-input-container>
|
||||
<div class="clr-form-control">
|
||||
<label for="disableAuditLogEventList" class="clr-control-label">
|
||||
{{ 'CLEARANCES.DISABLE_AUDIT_LOG_EVENT_TYPE' | translate }}
|
||||
{{ 'CLEARANCES.ENABLE_AUDIT_LOG_EVENT_TYPE' | translate }}
|
||||
<clr-tooltip>
|
||||
<clr-icon
|
||||
clrTooltipTrigger
|
||||
|
@ -328,7 +328,7 @@
|
|||
clrSize="lg"
|
||||
*clrIfOpen>
|
||||
<span>{{
|
||||
'CLEARANCES.DISABLE_AUDIT_LOG_EVENT_TYPE_TOOLTIP'
|
||||
'CLEARANCES.ENABLE_AUDIT_LOG_EVENT_TYPE_TOOLTIP'
|
||||
| translate
|
||||
}}</span>
|
||||
</clr-tooltip-content>
|
||||
|
@ -337,7 +337,7 @@
|
|||
<div *ngIf="logEventTypes.length === 0">
|
||||
{{ 'CLEARANCES.AUDIT_LOG_EVENT_TYPE_EMPTY' | translate }}
|
||||
</div>
|
||||
<div class="clr-control-container">
|
||||
<div class="clr-control-container audit-log-type">
|
||||
<div
|
||||
class="clr-checkbox-wrapper float-left"
|
||||
*ngFor="let item of logEventTypes">
|
||||
|
|
|
@ -190,6 +190,10 @@ $message-type-width: 12rem;
|
|||
margin-right: 0.25rem;
|
||||
}
|
||||
|
||||
.audit-log-type {
|
||||
max-width: 20rem;
|
||||
}
|
||||
|
||||
.duration {
|
||||
width: $input-width;
|
||||
display: flex;
|
||||
|
|
|
@ -99,7 +99,7 @@ export class SystemSettingsComponent
|
|||
HarborEvent.REFRESH_BANNER_MESSAGE,
|
||||
() => {
|
||||
this.setValueForBannerMessage();
|
||||
this.setValueForDisabledAuditLogEventTypes();
|
||||
this.setValueForEnabledAuditLogEventTypes();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ export class SystemSettingsComponent
|
|||
this.setValueForBannerMessage();
|
||||
}
|
||||
this.initLogEventTypes();
|
||||
this.setValueForDisabledAuditLogEventTypes();
|
||||
this.setValueForEnabledAuditLogEventTypes();
|
||||
}
|
||||
|
||||
ngAfterViewChecked() {
|
||||
|
@ -137,6 +137,7 @@ export class SystemSettingsComponent
|
|||
value: event.event_type,
|
||||
id: event.event_type,
|
||||
}));
|
||||
this.setValueForEnabledAuditLogEventTypes();
|
||||
},
|
||||
error => {
|
||||
this.errorHandler.error(error);
|
||||
|
@ -144,11 +145,18 @@ export class SystemSettingsComponent
|
|||
);
|
||||
}
|
||||
|
||||
setValueForDisabledAuditLogEventTypes() {
|
||||
const checkedEventTypes =
|
||||
setValueForEnabledAuditLogEventTypes() {
|
||||
const disabledEventTypes =
|
||||
this.currentConfig?.disabled_audit_log_event_types?.value;
|
||||
this.selectedLogEventTypes =
|
||||
checkedEventTypes?.split(',')?.filter(evt => evt !== '') ?? [];
|
||||
const disabledEvents =
|
||||
disabledEventTypes?.split(',')?.filter(evt => evt !== '') ?? [];
|
||||
|
||||
const allEventTypes = this.logEventTypes.map(evt => evt.value);
|
||||
|
||||
// Enabled = All - Disabled
|
||||
this.selectedLogEventTypes = allEventTypes.filter(
|
||||
evt => !disabledEvents.includes(evt)
|
||||
);
|
||||
}
|
||||
|
||||
setValueForBannerMessage() {
|
||||
|
@ -233,22 +241,27 @@ export class SystemSettingsComponent
|
|||
}
|
||||
|
||||
hasLogEventType(resourceType: string): boolean {
|
||||
return this.selectedLogEventTypes?.indexOf(resourceType) !== -1;
|
||||
return this.selectedLogEventTypes?.includes(resourceType);
|
||||
}
|
||||
|
||||
setLogEventType(resourceType: string) {
|
||||
if (this.selectedLogEventTypes.indexOf(resourceType) === -1) {
|
||||
this.selectedLogEventTypes.push(resourceType);
|
||||
} else {
|
||||
this.selectedLogEventTypes.splice(
|
||||
this.selectedLogEventTypes.findIndex(
|
||||
item => item === resourceType
|
||||
),
|
||||
1
|
||||
if (this.selectedLogEventTypes.includes(resourceType)) {
|
||||
this.selectedLogEventTypes = this.selectedLogEventTypes.filter(
|
||||
evt => evt !== resourceType
|
||||
);
|
||||
} else {
|
||||
this.selectedLogEventTypes.push(resourceType);
|
||||
}
|
||||
|
||||
const allEventTypes = this.logEventTypes.map(evt => evt.value);
|
||||
// Disabled = All - Enabled
|
||||
const disabled = allEventTypes.filter(
|
||||
evt => !this.selectedLogEventTypes.includes(evt)
|
||||
);
|
||||
|
||||
// Update backend config
|
||||
this.currentConfig.disabled_audit_log_event_types.value =
|
||||
this.selectedLogEventTypes.join(',');
|
||||
disabled.join(',');
|
||||
}
|
||||
|
||||
public getChanges() {
|
||||
|
|
|
@ -1842,8 +1842,8 @@
|
|||
"PURGE_HISTORY": "Bereinigungshistorie",
|
||||
"FORWARD_ENDPOINT": "Syslog Endpunkt für die Weiterleitung des Audit-Logs",
|
||||
"FORWARD_ENDPOINT_TOOLTIP": "Leite Audit-Logs an einen Syslog-Endpunkt, zum Beispiel: harbor-log:10514",
|
||||
"DISABLE_AUDIT_LOG_EVENT_TYPE": "Disable Audit Log Event Type",
|
||||
"DISABLE_AUDIT_LOG_EVENT_TYPE_TOOLTIP": "The comma-separated name of the audit log event to be disabled.",
|
||||
"ENABLE_AUDIT_LOG_EVENT_TYPE": "Enable Audit Log Event Type",
|
||||
"ENABLE_AUDIT_LOG_EVENT_TYPE_TOOLTIP": "The comma-separated name of the audit log event to be enabled.",
|
||||
"AUDIT_LOG_EVENT_TYPE_EMPTY": "No audit log event type exists.",
|
||||
"SKIP_DATABASE": "Datenbank für Audit-Logs übergehen",
|
||||
"SKIP_DATABASE_TOOLTIP": "Audit-Logs werden nicht in die Datenbank geschrieben. Nur verfügbar, wenn die Weiterleitung für Audit-Logs konfiguriert ist.",
|
||||
|
|
|
@ -1844,8 +1844,8 @@
|
|||
"PURGE_HISTORY": "Purge History",
|
||||
"FORWARD_ENDPOINT": "Audit Log Forward Syslog Endpoint",
|
||||
"FORWARD_ENDPOINT_TOOLTIP": "Forward audit logs to the syslog endpoint, for example: harbor-log:10514",
|
||||
"DISABLE_AUDIT_LOG_EVENT_TYPE": "Disable Audit Log Event Type",
|
||||
"DISABLE_AUDIT_LOG_EVENT_TYPE_TOOLTIP": "The comma-separated name of the audit log event to be disabled.",
|
||||
"ENABLE_AUDIT_LOG_EVENT_TYPE": "Enable Audit Log Event Type",
|
||||
"ENABLE_AUDIT_LOG_EVENT_TYPE_TOOLTIP": "The comma-separated name of the audit log event to be enabled.",
|
||||
"AUDIT_LOG_EVENT_TYPE_EMPTY": "No audit log event type exists.",
|
||||
"SKIP_DATABASE": "Skip Audit Log Database",
|
||||
"SKIP_DATABASE_TOOLTIP": "Skip to log audit log in the database, only available when audit log forward endpoint is configured",
|
||||
|
|
|
@ -1834,8 +1834,8 @@
|
|||
"PURGE_HISTORY": "Historial de purga",
|
||||
"FORWARD_ENDPOINT": "Audit Log Reenviar Syslog Endpoint",
|
||||
"FORWARD_ENDPOINT_TOOLTIP": "Reenviar audit logs al endpoint de syslog, por ejemplo: harbor-log:10514",
|
||||
"DISABLE_AUDIT_LOG_EVENT_TYPE": "Disable Audit Log Event Type",
|
||||
"DISABLE_AUDIT_LOG_EVENT_TYPE_TOOLTIP": "The comma-separated name of the audit log event to be disabled.",
|
||||
"ENABLE_AUDIT_LOG_EVENT_TYPE": "Enable Audit Log Event Type",
|
||||
"ENABLE_AUDIT_LOG_EVENT_TYPE_TOOLTIP": "The comma-separated name of the audit log event to be enabled.",
|
||||
"AUDIT_LOG_EVENT_TYPE_EMPTY": "No audit log event type exists.",
|
||||
"SKIP_DATABASE": "Omitir Base de Datos Audit Log",
|
||||
"SKIP_DATABASE_TOOLTIP": "Saltar al registro de auditoría en la base de datos, solo disponible cuando se configura el endpoint de reenvío del registro de auditoría",
|
||||
|
|
|
@ -1844,8 +1844,8 @@
|
|||
"PURGE_HISTORY": "Historique de purges",
|
||||
"FORWARD_ENDPOINT": "Endpoint Syslog de transfert de logs d'audit",
|
||||
"FORWARD_ENDPOINT_TOOLTIP": "Transfère les logs d'audit à l'endpoint Syslog, par exemple : harbor-log:10514",
|
||||
"DISABLE_AUDIT_LOG_EVENT_TYPE": "Disable Audit Log Event Type",
|
||||
"DISABLE_AUDIT_LOG_EVENT_TYPE_TOOLTIP": "The comma-separated name of the audit log event to be disabled.",
|
||||
"ENABLE_AUDIT_LOG_EVENT_TYPE": "Enable Audit Log Event Type",
|
||||
"ENABLE_AUDIT_LOG_EVENT_TYPE_TOOLTIP": "The comma-separated name of the audit log event to be enabled.",
|
||||
"AUDIT_LOG_EVENT_TYPE_EMPTY": "No audit log event type exists.",
|
||||
"SKIP_DATABASE": "Ne pas enregistrer les logs d'audit dans la base de données",
|
||||
"SKIP_DATABASE_TOOLTIP": "Ne pas enregistrer les logs d'audit dans la base de données, disponible uniquement lorsque l'endpoint de transfert de logs d'audit est configuré",
|
||||
|
|
|
@ -1833,8 +1833,8 @@
|
|||
"PURGE_HISTORY": "제거 기록",
|
||||
"FORWARD_ENDPOINT": "감사 로그를 Syslog 엔트포인트로 전달",
|
||||
"FORWARD_ENDPOINT_TOOLTIP": "감사 로그를 syslog 엔드포인트로 전달합니다(예: harbor-log:10514)",
|
||||
"DISABLE_AUDIT_LOG_EVENT_TYPE": "Disable Audit Log Event Type",
|
||||
"DISABLE_AUDIT_LOG_EVENT_TYPE_TOOLTIP": "The comma-separated name of the audit log event to be disabled.",
|
||||
"ENABLE_AUDIT_LOG_EVENT_TYPE": "Enable Audit Log Event Type",
|
||||
"ENABLE_AUDIT_LOG_EVENT_TYPE_TOOLTIP": "The comma-separated name of the audit log event to be enabled.",
|
||||
"AUDIT_LOG_EVENT_TYPE_EMPTY": "No audit log event type exists.",
|
||||
"SKIP_DATABASE": "감사 로그 데이터베이스 건너뛰기",
|
||||
"SKIP_DATABASE_TOOLTIP": "데이터베이스의 감사 로그 로그로 건너뛰기, 감사 로그 전달 엔드포인트가 구성된 경우에만 사용 가능",
|
||||
|
|
|
@ -1839,8 +1839,8 @@
|
|||
"PURGE_HISTORY": "Purge History",
|
||||
"FORWARD_ENDPOINT": "Audit Log Forward Syslog Endpoint",
|
||||
"FORWARD_ENDPOINT_TOOLTIP": "Forward audit logs to the syslog endpoint, for example: harbor-log:10514",
|
||||
"DISABLE_AUDIT_LOG_EVENT_TYPE": "Disable Audit Log Event Type",
|
||||
"DISABLE_AUDIT_LOG_EVENT_TYPE_TOOLTIP": "The comma-separated name of the audit log event to be disabled.",
|
||||
"ENABLE_AUDIT_LOG_EVENT_TYPE": "Enable Audit Log Event Type",
|
||||
"ENABLE_AUDIT_LOG_EVENT_TYPE_TOOLTIP": "The comma-separated name of the audit log event to be enabled.",
|
||||
"AUDIT_LOG_EVENT_TYPE_EMPTY": "No audit log event type exists.",
|
||||
"SKIP_DATABASE": "Skip Audit Log Database",
|
||||
"SKIP_DATABASE_TOOLTIP": "Skip to log audit log in the database, only available when audit log forward endpoint is configured",
|
||||
|
|
|
@ -1843,8 +1843,8 @@
|
|||
"PURGE_HISTORY": "Purge History",
|
||||
"FORWARD_ENDPOINT": "Audit Log Forward Syslog Endpoint",
|
||||
"FORWARD_ENDPOINT_TOOLTIP": "Forward audit logs to the syslog endpoint, for example: harbor-log:10514",
|
||||
"DISABLE_AUDIT_LOG_EVENT_TYPE": "Disable Audit Log Event Type",
|
||||
"DISABLE_AUDIT_LOG_EVENT_TYPE_TOOLTIP": "The comma-separated name of the audit log event to be disabled.",
|
||||
"ENABLE_AUDIT_LOG_EVENT_TYPE": "Enable Audit Log Event Type",
|
||||
"ENABLE_AUDIT_LOG_EVENT_TYPE_TOOLTIP": "The comma-separated name of the audit log event to be enabled.",
|
||||
"AUDIT_LOG_EVENT_TYPE_EMPTY": "No audit log event type exists.",
|
||||
"SKIP_DATABASE": "Skip Audit Log Database",
|
||||
"SKIP_DATABASE_TOOLTIP": "Skip to log audit log in the database, only available when audit log forward endpoint is configured",
|
||||
|
|
|
@ -1841,8 +1841,8 @@
|
|||
"PURGE_HISTORY": "清理历史",
|
||||
"FORWARD_ENDPOINT": "日志转发端点",
|
||||
"FORWARD_ENDPOINT_TOOLTIP": "将日志转发到指定的 syslog 端点,例如:harbor-log:10514",
|
||||
"DISABLE_AUDIT_LOG_EVENT_TYPE": "Disable Audit Log Event Type",
|
||||
"DISABLE_AUDIT_LOG_EVENT_TYPE_TOOLTIP": "The comma-separated name of the audit log event to be disabled.",
|
||||
"ENABLE_AUDIT_LOG_EVENT_TYPE": "Enable Audit Log Event Type",
|
||||
"ENABLE_AUDIT_LOG_EVENT_TYPE_TOOLTIP": "The comma-separated name of the audit log event to be enabled.",
|
||||
"AUDIT_LOG_EVENT_TYPE_EMPTY": "No audit log event type exists.",
|
||||
"SKIP_DATABASE": "跳过日志数据库",
|
||||
"SKIP_DATABASE_TOOLTIP": "开启此项将不会在数据库中记录日志,需先配置日志转发端点",
|
||||
|
|
|
@ -1839,8 +1839,8 @@
|
|||
"PURGE_HISTORY": "清除歷史",
|
||||
"FORWARD_ENDPOINT": "稽核日誌轉發 Syslog 端點",
|
||||
"FORWARD_ENDPOINT_TOOLTIP": "將稽核日誌轉發至 syslog 端點,例如: harbor-log:10514",
|
||||
"DISABLE_AUDIT_LOG_EVENT_TYPE": "Disable Audit Log Event Type",
|
||||
"DISABLE_AUDIT_LOG_EVENT_TYPE_TOOLTIP": "The comma-separated name of the audit log event to be disabled.",
|
||||
"ENABLE_AUDIT_LOG_EVENT_TYPE": "Enable Audit Log Event Type",
|
||||
"ENABLE_AUDIT_LOG_EVENT_TYPE_TOOLTIP": "The comma-separated name of the audit log event to be enabled.",
|
||||
"AUDIT_LOG_EVENT_TYPE_EMPTY": "No audit log event type exists.",
|
||||
"SKIP_DATABASE": "跳過稽核日誌資料庫",
|
||||
"SKIP_DATABASE_TOOLTIP": "跳過在資料庫中記錄稽核日誌,僅在設定稽核日誌轉發端點時可用",
|
||||
|
|
Loading…
Reference in New Issue