Feature: close content detail workspace when complete (#17498)

* make sure to close the modal when submit was completed

* rename to _closeModal

* remove comments
This commit is contained in:
Niels Lyngsø
2024-11-13 14:58:47 +01:00
committed by GitHub
parent e328249d31
commit 16d825a502
3 changed files with 14 additions and 6 deletions

View File

@@ -573,6 +573,8 @@ export abstract class UmbContentDetailWorkspaceContextBase<
});
eventContext.dispatchEvent(event);
this.setIsNew(false);
this._closeModal();
}
async #update(variantIds: Array<UmbVariantId>, saveData: DetailModelType) {
@@ -604,6 +606,7 @@ export abstract class UmbContentDetailWorkspaceContextBase<
});
eventContext.dispatchEvent(event);
this._closeModal();
}
abstract getContentTypeUnique(): string | undefined;

View File

@@ -124,12 +124,6 @@ export abstract class UmbSubmittableWorkspaceContextBase<WorkspaceDataModelType>
this.#submitPromise = undefined;
this.#submitResolve = undefined;
this.#submitReject = undefined;
// If we do not want to close a modal when saving something with errors, then move this part down to #completeSubmit method. [NL]
if (this.modalContext) {
this.modalContext?.setValue(this.getData());
this.modalContext?.submit();
}
};
#completeSubmit = () => {
@@ -138,8 +132,17 @@ export abstract class UmbSubmittableWorkspaceContextBase<WorkspaceDataModelType>
// Calling reset on the validation context here. [NL]
// TODO: Capture the validation messages on open, and then reset to that.
//this.validation.reset();
this._closeModal();
};
protected _closeModal() {
if (this.modalContext) {
this.modalContext?.setValue(this.getData());
this.modalContext?.submit();
}
}
//abstract getIsDirty(): Promise<boolean>;
abstract getUnique(): string | null | undefined;
abstract getEntityType(): string;

View File

@@ -334,6 +334,8 @@ export class UmbDocumentWorkspaceContext
});
eventContext.dispatchEvent(event);
this._closeModal();
}
}