Skip to content

Display audit log diffs in a git diff format #3607

Closed
@Kira-Pilot

Description

@Kira-Pilot

As a user, I would like to see audit log diffs so I understand what values have changed after certain events.

Audit RFC

Audit Mocks

Technical Considerations

This work is dependent upon the log scaffolded out in #3429. The expandable section detailed in that ticket will need to be created before it can be populated.

We can use react-diff-viewer to create the below audit diff visual:

Screen Shot 2022-08-19 at 3 55 16 PM

Only certain events should have a diff section - see below AC

AC

  • Populate the expandable section with diffs returned from /api/v2/audit

  • If a log event has no diffs (ex. a user logged in), there will be no expandable section. The top-level human-readable string would read something like “Alice Harvey logged in”. The human readable string will be returned from the back end.

  • If a log event has 1 diff (ex. a user edited the TTL on a workspace), there will be no expandable section. The top-level human-readable string would read something like ”Alice Harvey updated the TTL on ‘workspace-x’ from x to y.”

  • If a log event has multiple diffs (ex. a user edited multiple fields on a template), there will be an expandable section which can be toggled to reveal the diffs. The top level human-readable string would contain the first diff and read something like ”Alice Harvey renamed ‘template-a’ to ‘template-b”. The expandable diff section would contain additional diffs, e.g.

    [01] Updated name from template-a to template-b
    [02] Updated description from ‘foo’ to ‘bar’
  • Add tests and stories

Definition of Done

When I get diffs from the API,
then they are represented in a git diff in an expandable section.

Metadata

Metadata

Assignees

Labels

siteArea: frontend dashboard

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions