Description
As a user, I would like to see audit log diffs so I understand what values have changed after certain events.
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:
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.