The item in CVE whiltelist should be a click-able link

Signed-off-by: AllForNothing <sshijun@vmware.com>
This commit is contained in:
AllForNothing 2019-07-18 16:17:43 +08:00
parent 04d63f887d
commit 4979c4a49c
6 changed files with 32 additions and 3 deletions

View File

@ -115,7 +115,8 @@
<ul class="whitelist-window"> <ul class="whitelist-window">
<li *ngIf="systemWhitelist?.items?.length<1" <li *ngIf="systemWhitelist?.items?.length<1"
class="none">{{'CVE_WHITELIST.NONE'|translate}}</li> class="none">{{'CVE_WHITELIST.NONE'|translate}}</li>
<li *ngFor="let item of systemWhitelist?.items;let i = index;">{{item.cve_id}} <li *ngFor="let item of systemWhitelist?.items;let i = index;">
<span class="hand" (click)="goToDetail(item.cve_id)">{{item.cve_id}}</span>
<clr-icon (click)="deleteItem(i)" class="float-lg-right margin-top-4" <clr-icon (click)="deleteItem(i)" class="float-lg-right margin-top-4"
shape="times-circle"></clr-icon> shape="times-circle"></clr-icon>
</li> </li>

View File

@ -31,6 +31,7 @@
li { li {
height: 24px; height: 24px;
line-height: 24px;
list-style-type: none; list-style-type: none;
} }
} }
@ -72,4 +73,8 @@
button { button {
float: right; float: right;
} }
}
.hand{
cursor: pointer;
margin: 0;
} }

View File

@ -28,6 +28,8 @@ const fakePass = 'aWpLOSYkIzJTTU4wMDkx';
const ONE_HOUR_MINUTES: number = 60; const ONE_HOUR_MINUTES: number = 60;
const ONE_DAY_MINUTES: number = 24 * ONE_HOUR_MINUTES; const ONE_DAY_MINUTES: number = 24 * ONE_HOUR_MINUTES;
const ONE_THOUSAND: number = 1000; const ONE_THOUSAND: number = 1000;
const CVE_DETAIL_PRE_URL = `https://nvd.nist.gov/vuln/detail/`;
const TARGET_BLANK = "_blank";
@Component({ @Component({
selector: 'system-settings', selector: 'system-settings',
@ -380,4 +382,8 @@ export class SystemSettingsComponent implements OnChanges, OnInit {
} }
return false; return false;
} }
goToDetail(cveId) {
window.open(CVE_DETAIL_PRE_URL + `${cveId}`, TARGET_BLANK);
}
} }

View File

@ -124,12 +124,15 @@
<ul class="whitelist-window" *ngIf="isUseSystemWhitelist()"> <ul class="whitelist-window" *ngIf="isUseSystemWhitelist()">
<li *ngIf="systemWhitelist?.items?.length<1" <li *ngIf="systemWhitelist?.items?.length<1"
class="none">{{'CVE_WHITELIST.NONE'|translate}}</li> class="none">{{'CVE_WHITELIST.NONE'|translate}}</li>
<li *ngFor="let item of systemWhitelist?.items">{{item.cve_id}}</li> <li *ngFor="let item of systemWhitelist?.items">
<span class="hand" (click)="goToDetail(item.cve_id)">{{item.cve_id}}</span>
</li>
</ul> </ul>
<ul class="whitelist-window" *ngIf="!isUseSystemWhitelist()"> <ul class="whitelist-window" *ngIf="!isUseSystemWhitelist()">
<li class="none" <li class="none"
*ngIf="projectWhitelist?.items?.length<1">{{'CVE_WHITELIST.NONE'|translate}}</li> *ngIf="projectWhitelist?.items?.length<1">{{'CVE_WHITELIST.NONE'|translate}}</li>
<li *ngFor="let item of projectWhitelist?.items;let i = index;">{{item.cve_id}} <li *ngFor="let item of projectWhitelist?.items;let i = index;">
<span class="hand" (click)="goToDetail(item.cve_id)">{{item.cve_id}}</span>
<clr-icon (click)="deleteItem(i)" class="float-lg-right margin-top-4" <clr-icon (click)="deleteItem(i)" class="float-lg-right margin-top-4"
shape="times-circle"></clr-icon> shape="times-circle"></clr-icon>
</li> </li>

View File

@ -5,6 +5,9 @@
.select { .select {
width: 120px; width: 120px;
} }
.margin-top-4 {
margin-top: 4px;
}
.whitelist-window { .whitelist-window {
border: 1px solid #ccc; border: 1px solid #ccc;
@ -18,6 +21,7 @@
li { li {
height: 24px; height: 24px;
line-height: 24px;
list-style-type: none; list-style-type: none;
} }
} }
@ -61,3 +65,8 @@
} }
} }
.hand{
cursor: pointer;
margin: 0;
}

View File

@ -19,6 +19,8 @@ import {USERSTATICPERMISSION} from '../service/permission-static';
const ONE_THOUSAND: number = 1000; const ONE_THOUSAND: number = 1000;
const LOW: string = 'low'; const LOW: string = 'low';
const CVE_DETAIL_PRE_URL = `https://nvd.nist.gov/vuln/detail/`;
const TARGET_BLANK = "_blank";
export class ProjectPolicy { export class ProjectPolicy {
Public: boolean; Public: boolean;
@ -367,4 +369,7 @@ export class ProjectPolicyConfigComponent implements OnInit {
} }
return false; return false;
} }
goToDetail(cveId) {
window.open(CVE_DETAIL_PRE_URL + `${cveId}`, TARGET_BLANK);
}
} }