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>
<button
[disabled]="!hasPermission || !canClickExport"
[clrLoading]="checkingPermission"
clrDropdownItem
(click)="exportCVE()">
<clr-icon shape="export" size="16"></clr-icon>&nbsp;

View File

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

View File

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

View File

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