From f446c3b454de72e57b10ef67b1981d540cd31ae8 Mon Sep 17 00:00:00 2001 From: KiruthigaManivannan <162679756+KiruthigaManivannan@users.noreply.github.com> Date: Wed, 10 Jul 2024 20:10:18 +0530 Subject: [PATCH] PM-8545 Defect Upload License Dialog should close after file upload (#9871) * PM-8545 Defect Upload License Dialog should close after file upload * Resolve the validation message issue (#10033) --------- Co-authored-by: cyprain-okeke <108260115+cyprain-okeke@users.noreply.github.com> --- .../shared/update-license-dialog.component.ts | 13 ++++++++++++- .../app/billing/shared/update-license.component.ts | 3 +++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/apps/web/src/app/billing/shared/update-license-dialog.component.ts b/apps/web/src/app/billing/shared/update-license-dialog.component.ts index 5f9a1e94be..3a690378b8 100644 --- a/apps/web/src/app/billing/shared/update-license-dialog.component.ts +++ b/apps/web/src/app/billing/shared/update-license-dialog.component.ts @@ -1,3 +1,4 @@ +import { DialogRef } from "@angular/cdk/dialog"; import { Component } from "@angular/core"; import { FormBuilder } from "@angular/forms"; @@ -18,6 +19,7 @@ export enum UpdateLicenseDialogResult { }) export class UpdateLicenseDialogComponent extends UpdateLicenseComponent { constructor( + private dialogRef: DialogRef, apiService: ApiService, i18nService: I18nService, platformUtilsService: PlatformUtilsService, @@ -27,11 +29,20 @@ export class UpdateLicenseDialogComponent extends UpdateLicenseComponent { super(apiService, i18nService, platformUtilsService, organizationApiService, formBuilder); } async submitLicense() { - await this.submit(); + const result = await this.submit(); + if (result === UpdateLicenseDialogResult.Updated) { + this.dialogRef.close(UpdateLicenseDialogResult.Updated); + } } + submitLicenseDialog = async () => { await this.submitLicense(); }; + + cancel = async () => { + await this.cancel(); + this.dialogRef.close(UpdateLicenseDialogResult.Cancelled); + }; static open(dialogService: DialogService) { return dialogService.open(UpdateLicenseDialogComponent); } diff --git a/apps/web/src/app/billing/shared/update-license.component.ts b/apps/web/src/app/billing/shared/update-license.component.ts index 30b5983090..ec0852b9e0 100644 --- a/apps/web/src/app/billing/shared/update-license.component.ts +++ b/apps/web/src/app/billing/shared/update-license.component.ts @@ -6,6 +6,8 @@ import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-conso import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { UpdateLicenseDialogResult } from "./update-license-dialog.component"; + @Component({ selector: "app-update-license", templateUrl: "update-license.component.html", @@ -69,6 +71,7 @@ export class UpdateLicenseComponent { this.i18nService.t("licenseUploadSuccess"), ); this.onUpdated.emit(); + return new Promise((resolve) => resolve(UpdateLicenseDialogResult.Updated)); }; cancel = () => {