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>
This commit is contained in:
KiruthigaManivannan 2024-07-10 20:10:18 +05:30 committed by GitHub
parent 3d5c0a9b97
commit f446c3b454
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 1 deletions

View File

@ -1,3 +1,4 @@
import { DialogRef } from "@angular/cdk/dialog";
import { Component } from "@angular/core"; import { Component } from "@angular/core";
import { FormBuilder } from "@angular/forms"; import { FormBuilder } from "@angular/forms";
@ -18,6 +19,7 @@ export enum UpdateLicenseDialogResult {
}) })
export class UpdateLicenseDialogComponent extends UpdateLicenseComponent { export class UpdateLicenseDialogComponent extends UpdateLicenseComponent {
constructor( constructor(
private dialogRef: DialogRef,
apiService: ApiService, apiService: ApiService,
i18nService: I18nService, i18nService: I18nService,
platformUtilsService: PlatformUtilsService, platformUtilsService: PlatformUtilsService,
@ -27,11 +29,20 @@ export class UpdateLicenseDialogComponent extends UpdateLicenseComponent {
super(apiService, i18nService, platformUtilsService, organizationApiService, formBuilder); super(apiService, i18nService, platformUtilsService, organizationApiService, formBuilder);
} }
async submitLicense() { async submitLicense() {
await this.submit(); const result = await this.submit();
if (result === UpdateLicenseDialogResult.Updated) {
this.dialogRef.close(UpdateLicenseDialogResult.Updated);
}
} }
submitLicenseDialog = async () => { submitLicenseDialog = async () => {
await this.submitLicense(); await this.submitLicense();
}; };
cancel = async () => {
await this.cancel();
this.dialogRef.close(UpdateLicenseDialogResult.Cancelled);
};
static open(dialogService: DialogService) { static open(dialogService: DialogService) {
return dialogService.open<UpdateLicenseDialogResult>(UpdateLicenseDialogComponent); return dialogService.open<UpdateLicenseDialogResult>(UpdateLicenseDialogComponent);
} }

View File

@ -6,6 +6,8 @@ import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-conso
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { UpdateLicenseDialogResult } from "./update-license-dialog.component";
@Component({ @Component({
selector: "app-update-license", selector: "app-update-license",
templateUrl: "update-license.component.html", templateUrl: "update-license.component.html",
@ -69,6 +71,7 @@ export class UpdateLicenseComponent {
this.i18nService.t("licenseUploadSuccess"), this.i18nService.t("licenseUploadSuccess"),
); );
this.onUpdated.emit(); this.onUpdated.emit();
return new Promise((resolve) => resolve(UpdateLicenseDialogResult.Updated));
}; };
cancel = () => { cancel = () => {