Commit 537d84fb authored by Alexander Turinske's avatar Alexander Turinske Committed by Michał Zając

Refactor vulnerability page for new data model

- the data model passed to the vulnerability page has been
  updated
- I updated the vulnerability page to account for this new
  data model
parent c8a4b1ac
...@@ -12,22 +12,22 @@ function createFooterApp() { ...@@ -12,22 +12,22 @@ function createFooterApp() {
const { vulnerabilityFeedbackHelpPath, hasMr } = el.dataset; const { vulnerabilityFeedbackHelpPath, hasMr } = el.dataset;
const vulnerability = JSON.parse(el.dataset.vulnerabilityJson); const vulnerability = JSON.parse(el.dataset.vulnerabilityJson);
const finding = JSON.parse(el.dataset.findingJson); const finding = JSON.parse(el.dataset.findingJson);
const remediation = finding.solution; const { issue_feedback: feedback, remediation, solution } = finding;
const hasDownload = Boolean( const hasDownload = Boolean(
vulnerability.state !== 'resolved' && remediation?.diff?.length && !hasMr, vulnerability.state !== 'resolved' && remediation?.diff?.length && !hasMr,
); );
const props = { const props = {
solutionInfo: { solutionInfo: {
solution: finding.solution, solution,
remediation: finding.solution, remediation,
hasDownload, hasDownload,
hasMr, hasMr,
hasRemediation: Boolean(remediation), hasRemediation: Boolean(remediation),
vulnerabilityFeedbackHelpPath, vulnerabilityFeedbackHelpPath,
isStandaloneVulnerability: true, isStandaloneVulnerability: true,
}, },
feedback: finding.feedback, feedback,
project: { project: {
url: finding.project.full_path, url: finding.project.full_path,
value: finding.project.full_name, value: finding.project.full_name,
......
...@@ -35,8 +35,9 @@ module VulnerabilitiesHelper ...@@ -35,8 +35,9 @@ module VulnerabilitiesHelper
links: occurrence[:links], links: occurrence[:links],
location: occurrence[:location], location: occurrence[:location],
name: occurrence[:name], name: occurrence[:name],
solution: remediation ? remediation['summary'] : occurrence[:solution], solution: occurrence[:solution],
feedback: occurrence[:issue_feedback], remediation: remediation,
issue_feedback: occurrence[:issue_feedback],
project: occurrence[:project] project: occurrence[:project]
} }
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment