-
Notifications
You must be signed in to change notification settings - Fork 431
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat (ui): add vulnerabilities list (#3111)
- Loading branch information
Showing
9 changed files
with
169 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
ui/src/app/shared/vulnerability/list/vulnerabilities.list.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<div class="ui segment"> | ||
<div class="filter"> | ||
<div class="ui right floated mini icon input"> | ||
<input type="text" [(ngModel)]="filter" placeholder="{{'common_filter' | translate}}"> | ||
<i class="search icon"></i> | ||
</div> | ||
</div> | ||
<ul> | ||
<li *ngFor="let v of filteredVulnerabilities"> | ||
<div class="header"> | ||
<div class="dot {{v.severity}}"></div> | ||
<div class="text"> | ||
<span class="component">{{ ' ' + v.component}}</span> | ||
<span>{{ ' ' + v.version}}</span> | ||
<span class="title">{{ v.title + ' '}}<a [href]="v.link" target="_blank">{{v.cve}}<i class="external alternate icon"></i></a></span> | ||
</div> | ||
</div> | ||
<div class="resume"> | ||
<div class="description"><markdown [data]="v.description"></markdown></div> | ||
</div> | ||
</li> | ||
</ul> | ||
</div> |
73 changes: 73 additions & 0 deletions
73
ui/src/app/shared/vulnerability/list/vulnerabilities.list.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
@import '../vulnerabilities.scss'; | ||
|
||
.filter { | ||
height: 30px; | ||
} | ||
ul { | ||
list-style: none; | ||
margin-left: 0; | ||
padding: 0; | ||
|
||
li { | ||
border-bottom: 1px solid lightgrey; | ||
padding-top: 10px; | ||
padding-bottom: 10px; | ||
|
||
.dot { | ||
width: 13px; | ||
height: 13px; | ||
border-radius: 13px; | ||
display: inline-flex; | ||
margin-right: 5px; | ||
} | ||
.dot.defcon1 { | ||
background-color: $defcon_color; | ||
} | ||
.dot.critical { | ||
background-color: $critical_color; | ||
} | ||
.dot.high { | ||
background-color: $high_color; | ||
} | ||
.dot.medium { | ||
background-color: $medium_color; | ||
} | ||
.dot.low { | ||
background-color: $low_color; | ||
} | ||
.dot.negligible { | ||
background-color: $negligible_color; | ||
} | ||
.dot.unknown { | ||
background-color: $unknown_color; | ||
} | ||
|
||
.text { | ||
display: inline-flex; | ||
|
||
.component { | ||
padding-left: 10px; | ||
padding-right: 10px; | ||
font-weight: 600; | ||
} | ||
|
||
.title { | ||
padding-left: 20px; | ||
} | ||
} | ||
|
||
|
||
.resume { | ||
padding-top: 10px; | ||
} | ||
} | ||
li:first-child { | ||
padding-top: 0px; | ||
margin-top: -10px; | ||
} | ||
li:last-child { | ||
padding-bottom: 0px; | ||
border-bottom: 0px; | ||
margin-bottom: -10px; | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
ui/src/app/shared/vulnerability/list/vulnerability.list.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import {Component, Input} from '@angular/core'; | ||
import {Vulnerability} from '../../../model/application.model'; | ||
|
||
@Component({ | ||
selector: 'app-vulnerabilities-list', | ||
templateUrl: './vulnerabilities.list.html', | ||
styleUrls: ['./vulnerabilities.list.scss'] | ||
}) | ||
export class VulnerabilitiesListComponent { | ||
|
||
_filter: string; | ||
@Input('filter') | ||
set filter(data: string) { | ||
this._filter = data; | ||
this.updateVulns(); | ||
} | ||
get filter() { | ||
return this._filter; | ||
} | ||
@Input('vulnerabilities') | ||
set vulnerabilities(data: Array<Vulnerability>) { | ||
if (data) { | ||
this.allVulnerabilities = data; | ||
this.updateVulns(); | ||
} | ||
}; | ||
allVulnerabilities: Array<Vulnerability>; | ||
filteredVulnerabilities: Array<Vulnerability>; | ||
|
||
updateVulns(): void { | ||
if (this.allVulnerabilities) { | ||
if (!this.filter) { | ||
this.filteredVulnerabilities = this.allVulnerabilities; | ||
} else { | ||
this.filteredVulnerabilities = this.allVulnerabilities | ||
.filter(v => (v.component + ' ' + v.version).indexOf(this.filter) >= 0) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters