Fix null pointer issue for creating reolication rule (#17274)

Signed-off-by: AllForNothing <sshijun@vmware.com>
This commit is contained in:
Shijun Sun 2022-07-30 17:17:10 +08:00 committed by GitHub
parent 0fe5eed55d
commit 455ebf51fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 12 deletions

View File

@ -26,7 +26,6 @@
<clr-dropdown-menu *clrIfOpen> <clr-dropdown-menu *clrIfOpen>
<button <button
[disabled]="!hasPermission || !canClickExport" [disabled]="!hasPermission || !canClickExport"
[clrLoading]="checkingPermission"
clrDropdownItem clrDropdownItem
(click)="exportCVE()"> (click)="exportCVE()">
<clr-icon shape="export" size="16"></clr-icon>&nbsp; <clr-icon shape="export" size="16"></clr-icon>&nbsp;

View File

@ -91,7 +91,6 @@ export class ListProjectComponent implements OnDestroy {
@ViewChild(ExportCveComponent) @ViewChild(ExportCveComponent)
exportCveComponent: ExportCveComponent; exportCveComponent: ExportCveComponent;
hasPermission: boolean = false; hasPermission: boolean = false;
checkingPermission: boolean = false;
canClickExport: boolean = true; canClickExport: boolean = true;
constructor( constructor(
private session: SessionService, private session: SessionService,
@ -409,14 +408,11 @@ export class ListProjectComponent implements OnDestroy {
) )
); );
}); });
this.checkingPermission = true; forkJoin(obs).subscribe(res => {
forkJoin(obs) if (res?.length) {
.pipe(finalize(() => (this.checkingPermission = false))) this.hasPermission = res.every(item => item);
.subscribe(res => { }
if (res?.length) { });
this.hasPermission = res.every(item => item);
}
});
} }
} }
triggerExportSuccess() { triggerExportSuccess() {

View File

@ -294,7 +294,7 @@
let-m="index"> let-m="index">
<hbr-label-piece <hbr-label-piece
class="label-piece" class="label-piece"
*ngIf="m < 1" *ngIf="m < 1 && label"
[hasIcon]="false" [hasIcon]="false"
[label]=" [label]="
getLabel(label) getLabel(label)

View File

@ -639,10 +639,10 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy {
setFilterAndTrigger(adapter) { setFilterAndTrigger(adapter) {
this.supportedFilters = adapter.supported_resource_filters; this.supportedFilters = adapter.supported_resource_filters;
this.filters.clear(); // clear before init
this.supportedFilters.forEach(element => { this.supportedFilters.forEach(element => {
this.filters.push(this.initFilter(element.type)); this.filters.push(this.initFilter(element.type));
}); });
this.supportedTriggers = adapter.supported_triggers; this.supportedTriggers = adapter.supported_triggers;
this.ruleForm this.ruleForm
.get('trigger') .get('trigger')