Add sorting to security dashboard columns: All columns (except Severity & Identifier)
See Design Issue and parent Epics for details.
Additional information
The severity column sorting is part of the scope of #230383 (closed). The complete requirements outlined in #222448 (closed) support sorting by ALL columns. This issue represents the addition of sorting functionality to columns other than the Severity column & the Identifier column (which have been split into separate issues).
Implementation Plan
-
backend Add scopes to sorting (https://gitlab.com/gitlab-org/gitlab/blob/4f3c356688c04f1456e5beee4dad073023111a25/ee/app/models/vulnerability.rb#L82): -
order_detected_at_asc
/order_detected_at_desc
(usecreated_at
column to sort) -
order_state_asc
/order_state_desc
(usestate
column to sort, will require special logic to return it in preferred order:Detected
>Confirmed
>Resolved
>Dismissed
) -
order_title_asc
/order_title_desc
(usetitle
column to sort) -
order_identifier_asc
/order_identifier_desc
(will require additional work and query to specify the main identifier to use in sorting, also this is a field from another table that will be joined withvulnerabilities
), -
order_report_type_asc
/order_report_desc
(usereport_type
column to sort, will require special logic to do it alphabetically)
-
-
backend Extend Vulnerability.order_by
method to support new order options: https://gitlab.com/gitlab-org/gitlab/blob/4f3c356688c04f1456e5beee4dad073023111a25/ee/app/models/vulnerability.rb#L134 -
backend Extend Types::VulnerabilitySortEnum
enum to support new order options: https://gitlab.com/gitlab-org/gitlab/blob/546da4714a09a35f67b4150d6ecf2e78f3c297c7/ee/app/graphql/types/vulnerability_sort_enum.rb#L8 -
frontend add sortable: this.isSortable
to the fields we'd like to be sortable
Additional context
The app/assets/javascripts/alert_management/components/alert_management_table.vue
file has an example implementation on how to sort a column. Fortunately the gl-table
has support for sorting so we just need to implement the sorting function.
Edited by Alan (Maciej) Paruszewski