Skip to content

Implement CE security_reports Vuex store

Mark Florian requested to merge 273423-implement-ce-vuex-store into master

What does this MR do?

Create CE security_reports Vuex store

This creates a CE security_reports store that is a subset of the EE version. This subset is roughly the minimum necessary to render counts on the CE security MR widget. See this epic for more details about the overall direction.

The majority of this change is just existing code that's been moved and/or refactored. The only genuinely new piece of code is the new store's entry point: app/assets/javascripts/vue_shared/security_reports/store/index.js.

Since the CE version only supports SAST and Secret Detection, this MR also refactored the getters to generalise over an array of report types, rather than hard code them all into every getter. This means that these getters can be shared as-is between CE and EE, and behave correctly due to the reportTypes field added to the state of both stores. These getters are tested in both CE and EE, to verify the different behaviour based on the available report types.

The noBaseInAllReports getter turned out not to be used anywhere, so it was deleted.

Two existing getters, anyReportHasIssues and areAllReportsLoading didn't have tests, so tests were added for them in both CE and EE.

Since the getters now more explicitly depend on the report types installed in the store, constants were extracted to make their connection explicit, and reduce the chance that typos would lead to runtime errors.

The vulnerability severity constants were moved to a common location in CE.

The definitions of the LOADING, SUCCESS and ERROR constants were deleted from the security_reports directory, since their definitions already exist in the ~/reports/constants.js file. These constants are intended to be used with/by the ReportSection component, so it makes sense not to redefine them elsewhere.

Part of #273423 (closed).

Screenshots (strongly suggested)

n/a

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Related to #273423 (closed)

Edited by Mark Florian

Merge request reports

Loading