Commit 5caab361 authored by Kev's avatar Kev

Remove now unused vulnerability component parts

parent cd341b33
import Vue from 'vue'; import Vue from 'vue';
import MainApp from 'ee/vulnerabilities/components/main.vue'; import MainApp from 'ee/vulnerabilities/components/main.vue';
import HeaderApp from 'ee/vulnerabilities/components/header.vue';
import DetailsApp from 'ee/vulnerabilities/components/details.vue';
import FooterApp from 'ee/vulnerabilities/components/footer.vue';
import { VULNERABILITY_STATE_OBJECTS } from 'ee/vulnerabilities/constants';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
function createHeaderApp() {
const el = document.getElementById('js-vulnerability-header');
const vulnerability = JSON.parse(el.dataset.vulnerability);
return new Vue({
el,
render: h =>
h(HeaderApp, {
props: {
initialVulnerability: vulnerability,
},
}),
});
}
function createDetailsApp() {
const el = document.getElementById('js-vulnerability-details');
const vulnerability = JSON.parse(el.dataset.vulnerability);
return new Vue({
el,
render: h => h(DetailsApp, { props: { vulnerability } }),
});
}
function createFooterApp() {
const el = document.getElementById('js-vulnerability-footer');
if (!el) {
return false;
}
const {
vulnerabilityFeedbackHelpPath,
hasMr,
discussionsUrl,
createIssueUrl,
state,
issueFeedback,
mergeRequestFeedback,
notesUrl,
project,
projectFingerprint,
remediations,
reportType,
solution,
id,
canModifyRelatedIssues,
relatedIssuesHelpPath,
} = convertObjectPropsToCamelCase(JSON.parse(el.dataset.vulnerability));
const remediation = remediations?.length ? remediations[0] : null;
const hasDownload = Boolean(
state !== VULNERABILITY_STATE_OBJECTS.resolved.state && remediation?.diff?.length && !hasMr,
);
const hasRemediation = Boolean(remediation);
const props = {
vulnerabilityId: id,
discussionsUrl,
notesUrl,
solutionInfo: {
solution,
remediation,
hasDownload,
hasMr,
hasRemediation,
vulnerabilityFeedbackHelpPath,
isStandaloneVulnerability: true,
},
issueFeedback,
mergeRequestFeedback,
canModifyRelatedIssues,
project: {
url: project.full_path,
value: project.full_name,
},
relatedIssuesHelpPath,
};
return new Vue({
el,
provide: {
reportType,
createIssueUrl,
projectFingerprint,
vulnerabilityId: id,
},
render: h =>
h(FooterApp, {
props,
}),
});
}
function createMainApp() { function createMainApp() {
const el = document.getElementById('js-vulnerability-main'); const el = document.getElementById('js-vulnerability-main');
...@@ -118,9 +17,7 @@ function createMainApp() { ...@@ -118,9 +17,7 @@ function createMainApp() {
render: h => render: h =>
h(MainApp, { h(MainApp, {
props: { props: { vulnerability },
vulnerability,
},
}), }),
}); });
} }
......
...@@ -5,8 +5,4 @@ ...@@ -5,8 +5,4 @@
- page_description @vulnerability.description - page_description @vulnerability.description
- vulnerability_init_details = { vulnerability: vulnerability_details_json(@vulnerability, @pipeline)} - vulnerability_init_details = { vulnerability: vulnerability_details_json(@vulnerability, @pipeline)}
#js-vulnerability-header{ data: vulnerability_init_details }
#js-vulnerability-details{ data: vulnerability_init_details }
#js-vulnerability-footer{ data: vulnerability_init_details }
#js-vulnerability-main{ data: vulnerability_init_details } #js-vulnerability-main{ data: vulnerability_init_details }
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