|
|
|
@ -20,12 +20,19 @@ import { |
|
|
|
EntityTableConfig |
|
|
|
} from '@home/models/entity/entities-table-config.models'; |
|
|
|
import { |
|
|
|
ActionStatus, |
|
|
|
actionStatusTranslations, |
|
|
|
ActionType, |
|
|
|
actionTypeTranslations, |
|
|
|
AuditLog, |
|
|
|
AuditLogMode |
|
|
|
} from '@shared/models/audit-log.models'; |
|
|
|
import { EntityTypeResource, entityTypeTranslations } from '@shared/models/entity-type.models'; |
|
|
|
import { |
|
|
|
AliasEntityType, |
|
|
|
EntityType, |
|
|
|
EntityTypeResource, |
|
|
|
entityTypeTranslations |
|
|
|
} from '@shared/models/entity-type.models'; |
|
|
|
import { AuditLogService } from '@core/http/audit-log.service'; |
|
|
|
import { TranslateService } from '@ngx-translate/core'; |
|
|
|
import { DatePipe } from '@angular/common'; |
|
|
|
@ -82,7 +89,7 @@ export class AuditLogTableConfig extends EntityTableConfig<AuditLog, TimePageLin |
|
|
|
if (this.auditLogMode !== AuditLogMode.ENTITY) { |
|
|
|
this.columns.push( |
|
|
|
new EntityTableColumn<AuditLog>('entityType', 'audit-log.entity-type', '20%', |
|
|
|
(entity) => translate.instant(entityTypeTranslations.get(entity.entityId.entityType).type)), |
|
|
|
(entity) => this.getEntityTypeTranslation(entity.entityId.entityType)), |
|
|
|
new EntityTableColumn<AuditLog>('entityName', 'audit-log.entity-name', '20%'), |
|
|
|
); |
|
|
|
} |
|
|
|
@ -95,9 +102,9 @@ export class AuditLogTableConfig extends EntityTableConfig<AuditLog, TimePageLin |
|
|
|
|
|
|
|
this.columns.push( |
|
|
|
new EntityTableColumn<AuditLog>('actionType', 'audit-log.type', '33%', |
|
|
|
(entity) => translate.instant(actionTypeTranslations.get(entity.actionType))), |
|
|
|
(entity) => this.getActionTypeTranslation(entity.actionType)), |
|
|
|
new EntityTableColumn<AuditLog>('actionStatus', 'audit-log.status', '33%', |
|
|
|
(entity) => translate.instant(actionStatusTranslations.get(entity.actionStatus))) |
|
|
|
(entity) => this.getActionStatusTranslation(entity.actionStatus)) |
|
|
|
); |
|
|
|
|
|
|
|
this.cellActionDescriptors.push( |
|
|
|
@ -105,11 +112,32 @@ export class AuditLogTableConfig extends EntityTableConfig<AuditLog, TimePageLin |
|
|
|
name: this.translate.instant('audit-log.details'), |
|
|
|
icon: 'more_horiz', |
|
|
|
isEnabled: () => true, |
|
|
|
onAction: ($event, entity) => this.showAuditLogDetails(entity) |
|
|
|
onAction: (_, entity) => this.showAuditLogDetails(entity) |
|
|
|
} |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
private getEntityTypeTranslation(entityType: EntityType | AliasEntityType): string { |
|
|
|
if (entityTypeTranslations.has(entityType) && entityTypeTranslations.get(entityType).type) { |
|
|
|
return this.translate.instant(entityTypeTranslations.get(entityType).type); |
|
|
|
} |
|
|
|
return entityType; |
|
|
|
} |
|
|
|
|
|
|
|
private getActionTypeTranslation(actionType: ActionType): string { |
|
|
|
if (actionTypeTranslations.has(actionType)) { |
|
|
|
return this.translate.instant(actionTypeTranslations.get(actionType)); |
|
|
|
} |
|
|
|
return actionType; |
|
|
|
} |
|
|
|
|
|
|
|
private getActionStatusTranslation(actionStatus: ActionStatus): string { |
|
|
|
if (actionStatusTranslations.has(actionStatus)) { |
|
|
|
return this.translate.instant(actionStatusTranslations.get(actionStatus)); |
|
|
|
} |
|
|
|
return actionStatus; |
|
|
|
} |
|
|
|
|
|
|
|
fetchAuditLogs(pageLink: TimePageLink): Observable<PageData<AuditLog>> { |
|
|
|
switch (this.auditLogMode) { |
|
|
|
case AuditLogMode.TENANT: |
|
|
|
|