From 6d3140e05ae48df1f6bd8ef31014932f44cf3356 Mon Sep 17 00:00:00 2001 From: kubermatic-bot <41968677+kubermatic-bot@users.noreply.github.com> Date: Thu, 6 Feb 2020 09:08:03 +0100 Subject: [PATCH] [release/v2.13] Add missing checks for AddonConfig existence (#1986) * Add missing checks for AddonConfig existence * Add few more checks Co-authored-by: Marcin Maciaszczyk --- .../install-addon-dialog.component.html | 2 +- .../install-addon-dialog/install-addon-dialog.component.ts | 6 +++++- .../select-addon-dialog/select-addon-dialog.component.ts | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/app/shared/components/addon-list/install-addon-dialog/install-addon-dialog.component.html b/src/app/shared/components/addon-list/install-addon-dialog/install-addon-dialog.component.html index 0834ae0bf2..088e2da3f3 100644 --- a/src/app/shared/components/addon-list/install-addon-dialog/install-addon-dialog.component.html +++ b/src/app/shared/components/addon-list/install-addon-dialog/install-addon-dialog.component.html @@ -11,7 +11,7 @@
-
+
{{control.displayName}}{{control.required ? '*' : ''}} { group[control.internalName] = new FormControl( InstallAddonDialogComponent.getFormState(control), @@ -40,6 +40,10 @@ export class InstallAddonDialogComponent implements OnInit { this.form = new FormGroup(group); } + hasForm(): boolean { + return !!this.addonConfig && !!this.addonConfig.spec && !!this.addonConfig.spec.formSpec; + } + hasLogo(): boolean { return !!this.addonConfig && !!this.addonConfig.spec.logo && !!this.addonConfig.spec.logoFormat; } diff --git a/src/app/shared/components/addon-list/select-addon-dialog/select-addon-dialog.component.ts b/src/app/shared/components/addon-list/select-addon-dialog/select-addon-dialog.component.ts index 4c3b1203d1..0dfe52292f 100644 --- a/src/app/shared/components/addon-list/select-addon-dialog/select-addon-dialog.component.ts +++ b/src/app/shared/components/addon-list/select-addon-dialog/select-addon-dialog.component.ts @@ -21,7 +21,7 @@ export class SelectAddonDialogComponent { hasLogo(name: string): boolean { const addonConfig = this.addonConfigs.get(name); - return !!addonConfig && !!addonConfig.spec.logo && !!addonConfig.spec.logoFormat; + return !!addonConfig && !!addonConfig.spec && !!addonConfig.spec.logo && !!addonConfig.spec.logoFormat; } getAddonLogo(name: string): SafeUrl { @@ -32,7 +32,7 @@ export class SelectAddonDialogComponent { getAddonDescription(name: string): string { const addonConfig = this.addonConfigs.get(name); - return addonConfig ? addonConfig.spec.description : ''; + return addonConfig && addonConfig.spec && addonConfig.spec.description ? addonConfig.spec.description : ''; } select(name: string): void {