Skip to content

refactor: Make the audit log looks like a timeline #4765

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Oct 26, 2022

Conversation

BrunoQuaresma
Copy link
Collaborator

@BrunoQuaresma BrunoQuaresma commented Oct 26, 2022

Before:
Screen Shot 2022-10-26 at 13 26 43

After:
image

@BrunoQuaresma BrunoQuaresma requested a review from a team as a code owner October 26, 2022 16:47
@BrunoQuaresma BrunoQuaresma requested review from presleyp and removed request for a team October 26, 2022 16:47
@BrunoQuaresma BrunoQuaresma self-assigned this Oct 26, 2022
const styles = useStyles()
// We only want the message related to the date since the time is displayed
// inside of the build row
const displayDate = formatRelative(date, new Date()).split("at")[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this something dayjs can't do?

Copy link
Collaborator Author

@BrunoQuaresma BrunoQuaresma Oct 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it does not 😞 . I mean, I tried to find it in their docs but I didn't find anything.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok!

@@ -37,6 +37,27 @@ const presetFilters = [
{ query: "resource_type:user action:delete", name: "Deleted users" },
]

const groupAuditLogsByDate = (auditLogs?: AuditLog[]) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you're willing to use lodash I think this would just be
_.groupBy(auditLogs, (log) => new Date(log.time).toDateString())

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think we could talk about adding lodash since we can import specific functions only instead of the entire package.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we already have it because it comes bundled with something else

@BrunoQuaresma BrunoQuaresma enabled auto-merge (squash) October 26, 2022 19:13
@BrunoQuaresma BrunoQuaresma merged commit 0049556 into main Oct 26, 2022
@BrunoQuaresma BrunoQuaresma deleted the bq/refactor-audit-log branch October 26, 2022 19:20
@github-actions github-actions bot locked and limited conversation to collaborators Oct 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants