Skip to content

Commit

Permalink
Fix project finding route with components and/or vulnerabilities
Browse files Browse the repository at this point in the history
Signed-off-by: mykter <[email protected]>
  • Loading branch information
mykter committed Dec 28, 2023
1 parent d08f725 commit 2c199ca
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/views/portfolio/projects/ProjectFindings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ import ProjectUploadVexModal from "./ProjectUploadVexModal";
},
beforeCreate() {
this.showSuppressedFindings = (localStorage && localStorage.getItem("ProjectFindingsShowSuppressedFindings") !== null) ? (localStorage.getItem("ProjectFindingsShowSuppressedFindings") === "true") : false;
if (this.$route.params.vulnerability) {
if (this.$route.params.affectedComponent) {
// search for the last portion of the finding's matrix ID
this.initialSearchText = this.$route.params.affectedComponent + ":" + this.$route.params.vulnerability
} else {
this.initialSearchText = this.$route.params.vulnerability
} // the route doesn't allow a component to be specified without a vulnerability
}
},
data() {
return {
Expand Down Expand Up @@ -240,7 +249,7 @@ import ProjectUploadVexModal from "./ProjectUploadVexModal";
pageSize: (localStorage && localStorage.getItem("ProjectFindingsPageSize") !== null) ? Number(localStorage.getItem("ProjectFindingsPageSize")) : 10,
sortName: (localStorage && localStorage.getItem("ProjectFindingsSortName") !== null) ? localStorage.getItem("ProjectFindingsSortName") : undefined,
sortOrder: (localStorage && localStorage.getItem("ProjectFindingsSortOrder") !== null) ? localStorage.getItem("ProjectFindingsSortOrder") : undefined,
searchText: this.$route.params.vulnerability ? ":" + this.$route.params.vulnerability : undefined,
searchText: this.initialSearchText,
icons: {
detailOpen: 'fa-fw fa-angle-right',
detailClose: 'fa-fw fa-angle-down',
Expand Down Expand Up @@ -367,8 +376,10 @@ import ProjectUploadVexModal from "./ProjectUploadVexModal";
},
tableLoaded: function(data) {
loadUserPreferencesForBootstrapTable(this, "ProjectFindings", this.$refs.table.columns);
this.$emit('total', data.total);
if (this.$route.params.vulnerability) {
this.$emit('total', data.total); // the unfiltered length
if (this.$route.params.vulnerability && this.$refs.table.getData().length === 1) {
// If there's only one visible row due to a URL that selects a single finding, show it in full
// Don't expand if there are multiple findings, as it makes it harder to notice that there is more than one result
this.$refs.table.expandRow(0);
}
},
Expand Down

0 comments on commit 2c199ca

Please sign in to comment.