Merge pull request #8716 from AllForNothing/cve-bug

fix cve-whitelist bugs
This commit is contained in:
Will Sun 2019-08-19 15:55:24 +08:00 committed by GitHub
commit 786fb429d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 13 deletions

View File

@ -27,8 +27,6 @@
width: 222px;
color: #0079bb;
overflow-y: auto;
white-space: nowrap;
li {
height: 24px;
line-height: 24px;

View File

@ -89,12 +89,12 @@
</div>
<clr-radio-container clrInline>
<clr-radio-wrapper>
<input type="radio" clrRadio name="systemWhitelistOrProjectWhitelist" required value="true"
<input [disabled]="!hasChangeConfigRole" type="radio" clrRadio name="systemWhitelistOrProjectWhitelist" required value="true"
[(ngModel)]="systemWhitelistOrProjectWhitelist"/>
<label>{{'CVE_WHITELIST.SYS_WHITELIST'|translate}}</label>
</clr-radio-wrapper>
<clr-radio-wrapper>
<input type="radio" clrRadio name="systemWhitelistOrProjectWhitelist" required value="false"
<input [disabled]="!hasChangeConfigRole" type="radio" clrRadio name="systemWhitelistOrProjectWhitelist" required value="false"
[(ngModel)]="systemWhitelistOrProjectWhitelist"/>
<label>{{'CVE_WHITELIST.PRO_WHITELIST'|translate}}</label>
</clr-radio-wrapper>
@ -102,10 +102,10 @@
<div class="clr-row width-70per">
<div class="clr-col position-relative">
<div>
<button [disabled]="isUseSystemWhitelist()"
<button [disabled]="isUseSystemWhitelist() || !hasChangeConfigRole"
(click)="showAddModal=!showAddModal"
class="btn btn-link">{{'CVE_WHITELIST.ADD'|translate}}</button>
<button [disabled]="isUseSystemWhitelist()" (click)="addSystem()"
<button [disabled]="isUseSystemWhitelist() || !hasChangeConfigRole" (click)="addSystem()"
class="btn btn-link ml-1">{{'CVE_WHITELIST.ADD_SYSTEM'|translate}}</button>
</div>
<div class="add-modal" *ngIf="showAddModal && !isUseSystemWhitelist()">
@ -144,17 +144,17 @@
<label for="expires">{{'CVE_WHITELIST.EXPIRES_AT'|translate}}</label>
<div class="underline">
<input #dateSystemInput readonly type="date" [(clrDate)]="systemExpiresDate">
<input *ngIf="!isUseSystemWhitelist()" #dateInput
<input [disabled]="!hasChangeConfigRole" *ngIf="!isUseSystemWhitelist()" #dateInput
placeholder="{{'CVE_WHITELIST.NEVER_EXPIRES'|translate}}" readonly type="date"
[(clrDate)]="expiresDate" newFormLayout="true">
<input *ngIf="isUseSystemWhitelist()"
<input [disabled]="!hasChangeConfigRole" *ngIf="isUseSystemWhitelist()"
placeholder="{{'CVE_WHITELIST.NEVER_EXPIRES'|translate}}" readonly type="text"
value="{{systemExpiresDateString}}">
</div>
</div>
<div class="form-group padding-left-80">
<clr-checkbox-wrapper>
<input [disabled]="isUseSystemWhitelist()" [checked]="neverExpires"
<input [disabled]="isUseSystemWhitelist() || !hasChangeConfigRole" [checked]="neverExpires"
[(ngModel)]="neverExpires" type="checkbox" clrCheckbox name="neverExpires"
id="neverExpires"/>
<label>
@ -168,10 +168,10 @@
</div>
</div>
<button type="button" class="btn btn-primary" (click)="save()"
[disabled]="(!isValid() || !hasChanges() || !hasChangeConfigRole) && !hasWhitelistChanged">{{'BUTTON.SAVE'
[disabled]="((!isValid() || !hasChanges()) && !hasWhitelistChanged) || !hasChangeConfigRole">{{'BUTTON.SAVE'
| translate}}</button>
<button type="button" class="btn btn-outline" (click)="cancel()"
[disabled]="(!isValid() || !hasChanges() || !hasChangeConfigRole) && !hasWhitelistChanged">{{'BUTTON.CANCEL'
[disabled]="((!isValid() || !hasChanges()) && !hasWhitelistChanged) || !hasChangeConfigRole">{{'BUTTON.CANCEL'
| translate}}</button>
<confirmation-dialog #cfgConfirmationDialog (confirmAction)="confirmCancel($event)"></confirmation-dialog>
</section>

View File

@ -17,8 +17,6 @@
width: 222px;
color: #0079bb;
overflow-y: auto;
white-space: nowrap;
li {
height: 24px;
line-height: 24px;

View File

@ -170,6 +170,9 @@ export class ProjectPolicyConfigComponent implements OnInit {
if (!response.cve_whitelist['expires_at']) {
response.cve_whitelist['expires_at'] = null;
}
if (!response.metadata.reuse_sys_cve_whitelist) {
response.metadata.reuse_sys_cve_whitelist = "true";
}
if (response && response.cve_whitelist) {
this.projectWhitelist = clone(response.cve_whitelist);
this.projectWhitelistOrigin = clone(response.cve_whitelist);