Skip to content

Latest commit

 

History

History
30 lines (25 loc) · 1.05 KB

AuditTrails.md

File metadata and controls

30 lines (25 loc) · 1.05 KB

Audit trail

The Audit trail framework is built using the registration pattern. Developers from each team will need to register their resources with the AuditTrailFactory.

Registration of resources requires the following details -

  • Icon - Module icon to which the resource belongs.
  • resourceUrl - Resource redirection url (For eg. Connector details page in case of connector)

Example of a resource registration:

import AuditTrailFactory from '@audit-trail/factories/AuditTrailFactory'
import type { ResourceDTO, ResourceScopeDTO } from 'services/audit'
AuditTrailFactory.registerResourceHandler('CONNECTOR', {
  moduleIcon: {
    name: 'nav-settings',
    size: 30
  },
  resourceUrl: (resource: ResourceDTO, resourceScope: ResourceScopeDTO) => {
    const { accountIdentifier, orgIdentifier, projectIdentifier } = resourceScope
    return routes.toConnectorDetails({
      orgIdentifier,
      accountId: accountIdentifier || accountPathProps.accountId,
      connectorId: resource.identifier,
      projectIdentifier
    })
  }
})