Frontend handle auditlog disabled
This commit is contained in:
@@ -285,14 +285,16 @@
|
||||
</li>
|
||||
}
|
||||
|
||||
<li *pngxIfPermissions="{ action: PermissionAction.View, type: PermissionType.AuditLogEntry }" [ngbNavItem]="DocumentDetailNavIDs.History">
|
||||
<a ngbNavLink i18n>History</a>
|
||||
<ng-template ngbNavContent>
|
||||
<div class="mb-3">
|
||||
<pngx-audit-log [documentId]="documentId"></pngx-audit-log>
|
||||
</div>
|
||||
</ng-template>
|
||||
</li>
|
||||
@if (auditlogEnabled) {
|
||||
<li [ngbNavItem]="DocumentDetailNavIDs.History">
|
||||
<a ngbNavLink i18n>History</a>
|
||||
<ng-template ngbNavContent>
|
||||
<div class="mb-3">
|
||||
<pngx-audit-log [documentId]="documentId"></pngx-audit-log>
|
||||
</div>
|
||||
</ng-template>
|
||||
</li>
|
||||
}
|
||||
|
||||
@if (showPermissions) {
|
||||
<li [ngbNavItem]="DocumentDetailNavIDs.Permissions">
|
||||
|
||||
@@ -903,6 +903,16 @@ export class DocumentDetailComponent
|
||||
)
|
||||
}
|
||||
|
||||
get auditlogEnabled(): boolean {
|
||||
return (
|
||||
this.settings.get(SETTINGS_KEYS.AUDITLOG_ENABLED) &&
|
||||
this.permissionsService.currentUserCan(
|
||||
PermissionAction.View,
|
||||
PermissionType.AuditLogEntry
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
notesUpdated(notes: DocumentNote[]) {
|
||||
this.document.notes = notes
|
||||
this.openDocumentService.refreshDocument(this.documentId)
|
||||
|
||||
@@ -37,6 +37,7 @@ export const SETTINGS_KEYS = {
|
||||
NOTIFICATIONS_CONSUMER_SUPPRESS_ON_DASHBOARD:
|
||||
'general-settings:notifications:consumer-suppress-on-dashboard',
|
||||
NOTES_ENABLED: 'general-settings:notes-enabled',
|
||||
AUDITLOG_ENABLED: 'general-settings:auditlog-enabled',
|
||||
SLIM_SIDEBAR: 'general-settings:slim-sidebar',
|
||||
UPDATE_CHECKING_ENABLED: 'general-settings:update-checking:enabled',
|
||||
UPDATE_CHECKING_BACKEND_SETTING:
|
||||
@@ -143,6 +144,11 @@ export const SETTINGS: UiSetting[] = [
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
key: SETTINGS_KEYS.AUDITLOG_ENABLED,
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
key: SETTINGS_KEYS.UPDATE_CHECKING_ENABLED,
|
||||
type: 'boolean',
|
||||
|
||||
@@ -47,6 +47,7 @@ describe('SettingsService', () => {
|
||||
update_checking: { enabled: false, backend_setting: 'default' },
|
||||
saved_views: { warn_on_unsaved_change: true },
|
||||
notes_enabled: true,
|
||||
auditlog_enabled: true,
|
||||
tour_complete: false,
|
||||
permissions: {
|
||||
default_owner: null,
|
||||
|
||||
Reference in New Issue
Block a user