Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Focus on components in dependency graph and hide other nodes #336

Merged
3 changes: 3 additions & 0 deletions src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,9 @@
"component_firmware": "Firmware",
"component_file": "File",
"dates": "Dates",
"show_in_dependency_graph": "Show in dependency graph",
"show_complete_graph": "Show complete graph",
"not_found_in_dependency_graph": "Dependency could not be found in dependency graph",
"reindex": "Rebuild index(es)"
},
"admin": {
Expand Down
13 changes: 13 additions & 0 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,19 @@ function configRoutes() {
sectionPath: '/projects'
}
},
{
path: 'projects/:uuid/dependencyGraph/:componentUuid',
name: 'Dependency Graph Component Lookup',
props: (route) => ( {
uuid: route.params.uuid,
componentUuid: route.params.componentUuid
} ),
component: Project,
meta: {
i18n: 'message.projects',
sectionPath: '/projects'
}
},
{
path: 'components',
name: 'Component Lookup',
Expand Down
6 changes: 5 additions & 1 deletion src/views/portfolio/projects/Component.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<b-col>
<i class="fa fa-cube bg-primary p-3 font-2xl mr-3 float-left"></i>
<div class="h5 mb-0 mt-2">{{ componentLabel }}</div>
<i class="fa fa-sitemap" style="cursor: pointer;" aria-hidden="true" @click="this.redirectToDependencyGraph" v-b-tooltip.hover.bottom :title="$t('message.show_in_dependency_graph')"></i>
</b-col>
<b-col>
<b-row class="d-none d-md-flex float-right">
Expand Down Expand Up @@ -164,7 +165,10 @@
syncComponentFields: function(component) {
this.component = component;
EventBus.$emit('addCrumb', this.componentLabel);
}
},
redirectToDependencyGraph: function (){
this.$router.push({path: "/projects/" + this.component.project.uuid + "/dependencyGraph/" + this.component.uuid})
nscuro marked this conversation as resolved.
Show resolved Hide resolved
},
},
beforeMount() {
this.uuid = this.$route.params.uuid;
Expand Down
13 changes: 11 additions & 2 deletions src/views/portfolio/projects/Project.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
<template v-slot:title><i class="fa fa-exchange"></i> {{ $t('message.services') }} <b-badge variant="tab-total">{{ totalServices }}</b-badge></template>
<project-services :key="this.uuid" :uuid="this.uuid" v-on:total="totalServices = $event" />
</b-tab>
<b-tab>
<b-tab ref="tabDependencyGraph">
<template v-slot:title><i class="fa fa-sitemap"></i> {{ $t('message.dependency_graph') }} <b-badge variant="tab-total">{{ totalDependencyGraphs }}</b-badge></template>
<project-dependency-graph :key="this.uuid" :uuid="this.uuid" :project="this.project" v-on:total="totalDependencyGraphs = $event" />
</b-tab>
Expand Down Expand Up @@ -204,7 +204,8 @@
totalDependencyGraphs: 0,
totalFindings: 0,
totalEpss: 0,
totalViolations: 0
totalViolations: 0,
tabIndex: 0
}
},
methods: {
Expand Down Expand Up @@ -249,10 +250,18 @@
this.uuid = this.$route.params.uuid;
this.initialize();
},
mounted() {
if (this.$route.params.componentUuid){
this.$refs.tabDependencyGraph.active = true
}
},
watch:{
$route (to, from){
this.uuid = this.$route.params.uuid;
this.initialize();
if (this.$route.params.componentUuid){
this.$refs.tabDependencyGraph.activate()
}
}
},
destroyed() {
Expand Down
13 changes: 8 additions & 5 deletions src/views/portfolio/projects/ProjectComponents.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@
title: this.$t('message.component'),
field: "name",
sortable: true,
formatter(value, row, index) {
let url = xssFilters.uriInUnQuotedAttr("../components/" + row.uuid);
return `<a href="${url}">${xssFilters.inHTMLData(value)}</a>`;
formatter: (value, row, index) => {
let url = xssFilters.uriInUnQuotedAttr("../../../components/" + row.uuid);
let dependencyGraphUrl = xssFilters.uriInUnQuotedAttr("../../../projects/" + this.uuid + "/dependencyGraph/" + row.uuid)
return `<a href="${dependencyGraphUrl}"<i class="fa fa-sitemap" aria-hidden="true" style="float:right; padding-top: 4px; cursor:pointer" data-toggle="tooltip" data-placement="bottom" title="Show in dependency graph"></i></a> ` + `<a href="${url}">${xssFilters.inHTMLData(value)}</a>`;
}
},
{
Expand Down Expand Up @@ -126,7 +127,7 @@
sortable: false,
formatter(value, row, index) {
if (Object.prototype.hasOwnProperty.call(row, "resolvedLicense")) {
let licenseurl = "../licenses/" + row.resolvedLicense.licenseId;
let licenseurl = "../../../licenses/" + row.resolvedLicense.licenseId;
return "<a href=\"" + licenseurl + "\">" + xssFilters.inHTMLData(row.resolvedLicense.licenseId) + "</a>";
} else {
return xssFilters.inHTMLData(common.valueWithDefault(value, ""));
Expand Down Expand Up @@ -190,7 +191,9 @@
},
methods: {
initializeTooltips: function () {
$('[data-toggle="tooltip"]').tooltip();
$('[data-toggle="tooltip"]').tooltip({
trigger: "hover"
});
},
removeDependencies: function () {
let selections = this.$refs.table.getSelections();
Expand Down
Loading