From b5e23fe4195d2de78473350bc0b7c61d77a8d39b Mon Sep 17 00:00:00 2001
From: Zamir Martins <zfilho@gitlab.com>
Date: Fri, 2 Feb 2024 13:23:10 +0000
Subject: [PATCH] Add severity sort for group level dependencies

EE: true
Changelog: changed
---
 ee/app/assets/javascripts/dependencies/components/app.vue | 8 ++------
 .../dependencies/store/modules/list/constants.js          | 1 +
 ee/spec/frontend/dependencies/components/app_spec.js      | 4 ++--
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/ee/app/assets/javascripts/dependencies/components/app.vue b/ee/app/assets/javascripts/dependencies/components/app.vue
index 8ec6be6831dd8..34a8cf55870e1 100644
--- a/ee/app/assets/javascripts/dependencies/components/app.vue
+++ b/ee/app/assets/javascripts/dependencies/components/app.vue
@@ -13,11 +13,7 @@ import { mapActions, mapGetters, mapState } from 'vuex';
 import { __, s__ } from '~/locale';
 import { DEPENDENCY_LIST_TYPES } from '../store/constants';
 import { NAMESPACE_PROJECT } from '../constants';
-import {
-  REPORT_STATUS,
-  SORT_FIELD_SEVERITY,
-  SORT_FIELD_PACKAGER,
-} from '../store/modules/list/constants';
+import { REPORT_STATUS, SORT_FIELD_SEVERITY } from '../store/modules/list/constants';
 import DependenciesActions from './dependencies_actions.vue';
 import DependencyListIncompleteAlert from './dependency_list_incomplete_alert.vue';
 import DependencyListJobFailedAlert from './dependency_list_job_failed_alert.vue';
@@ -124,7 +120,7 @@ export default {
   created() {
     this.setDependenciesEndpoint(this.endpoint);
     this.setExportDependenciesEndpoint(this.exportEndpoint);
-    this.setSortField(this.isProjectNamespace ? SORT_FIELD_SEVERITY : SORT_FIELD_PACKAGER);
+    this.setSortField(SORT_FIELD_SEVERITY);
   },
   methods: {
     ...mapActions([
diff --git a/ee/app/assets/javascripts/dependencies/store/modules/list/constants.js b/ee/app/assets/javascripts/dependencies/store/modules/list/constants.js
index 128c912d473da..b6ee6f20cbd09 100644
--- a/ee/app/assets/javascripts/dependencies/store/modules/list/constants.js
+++ b/ee/app/assets/javascripts/dependencies/store/modules/list/constants.js
@@ -23,6 +23,7 @@ export const SORT_FIELDS_GROUP = pick(SORT_FIELDS, [
   SORT_FIELD_NAME,
   SORT_FIELD_PACKAGER,
   SORT_FIELD_LICENSE,
+  SORT_FIELD_SEVERITY,
 ]);
 
 export const SORT_ASCENDING = 'asc';
diff --git a/ee/spec/frontend/dependencies/components/app_spec.js b/ee/spec/frontend/dependencies/components/app_spec.js
index e7a029fe56e1a..dfabcfb1f1904 100644
--- a/ee/spec/frontend/dependencies/components/app_spec.js
+++ b/ee/spec/frontend/dependencies/components/app_spec.js
@@ -174,9 +174,9 @@ describe('DependenciesApp component', () => {
         factory({ provide: { namespaceType: 'group' } });
       });
 
-      it('dispatches setSortField with packager', () => {
+      it('dispatches setSortField with severity', () => {
         expect(store.dispatch.mock.calls).toEqual(
-          expect.arrayContaining([['setSortField', 'packager']]),
+          expect.arrayContaining([['setSortField', 'severity']]),
         );
       });
     });
-- 
GitLab