Skip to content

Refactor group audit events to use the audit events shared template

What does this MR do?

This MR updates the Group audit events page to use the new audit events shared template. This adds the improved filtering options to this page and also adds specific filters for users so they are limited to the group only.

Screenshots

Before After
image image

Database timings

How the query would be called without adjustments

Query:

SELECT
    "audit_events".*
FROM
    "audit_events"
WHERE
    "audit_events"."entity_type" = 'Group'
    AND "audit_events"."entity_id" = 9970
    AND "audit_events"."entity_type" = 'User'
    AND "audit_events"."entity_id" = 1
ORDER BY
    "audit_events"."id" DESC
LIMIT 26 OFFSET 0

Plan with execution:

 Limit  (cost=0.57..25.37 rows=1 width=224) (actual time=0.003..0.003 rows=0 loops=1)
   ->  Result  (cost=0.57..25.37 rows=1 width=224) (actual time=0.001..0.001 rows=0 loops=1)
         ->  Index Scan using index_audit_events_on_entity_id_and_entity_type_and_id_desc on public.audit_events  (cost=0.57..25.37 rows=1 width=224) (actual time=0.000..0.000 rows=0 loops=0)
               Index Cond: ((audit_events.entity_id = 9970) AND ((audit_events.entity_type)::text = 'Group'::text))

Summary

Time: 0.258 ms
  - planning: 0.216 ms
  - execution: 0.042 ms
    - I/O read: 0.000 ms
    - I/O write: 0.000 ms

Shared buffers:
  - hits: 0 from the buffer pool
  - reads: 0 from the OS file cache, including disk I/O
  - dirtied: 0
  - writes: 0

How the query is called with author adjustments

Query:

SELECT
    "audit_events".*
FROM
    "audit_events"
WHERE
    "audit_events"."entity_type" = 'Group'
    AND "audit_events"."entity_id" = 9970
    AND "audit_events"."author_id" = 1
ORDER BY
    "audit_events"."id" DESC
LIMIT 26 OFFSET 0

Plan with execution:

 Limit  (cost=0.57..25.41 rows=1 width=224) (actual time=3878.064..3989.995 rows=15 loops=1)
   Buffers: shared hit=111 read=2009 dirtied=6
   I/O Timings: read=3954.111
   ->  Index Scan using index_audit_events_on_entity_id_and_entity_type_and_id_desc on public.audit_events  (cost=0.57..25.41 rows=1 width=224) (actual time=3878.062..3989.976 rows=15 loops=1)
         Index Cond: ((audit_events.entity_id = 9970) AND ((audit_events.entity_type)::text = 'Group'::text))
         Filter: (audit_events.author_id = 1)
         Rows Removed by Filter: 2169
         Buffers: shared hit=111 read=2009 dirtied=6
         I/O Timings: read=3954.111

Summary

Time: 3.990 s
  - planning: 0.159 ms
  - execution: 3.990 s
    - I/O read: 3.954 s
    - I/O write: 0.000 ms

Shared buffers:
  - hits: 111 (~888.00 KiB) from the buffer pool
  - reads: 2009 (~15.70 MiB) from the OS file cache, including disk I/O
  - dirtied: 6 (~48.00 KiB)
  - writes: 0

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

  1. Open a group audit events page
  2. Confirm that you see the audit events listed with the new filtering and table layout
  3. Change filters and confirm they filter the list of audit events
  4. Confirm that the projects search list is limited to only projects within the group you are in
  5. Confirm that the users search list is limited to only users within the group you are in

Related #217781 (closed)

Edited by Robert Hunt

Merge request reports