Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Form: make withBusyHandling public #1367

Open
wants to merge 1 commit into
base: releases/24.2
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions eclipse-scout-core/src/form/Form.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2024 BSI Business Systems Integration AG
* Copyright (c) 2010, 2025 BSI Business Systems Integration AG
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -385,16 +385,19 @@ export class Form extends Widget implements FormModel, DisplayParent {
return $.resolvedPromise();
}
try {
return this._withBusyHandling(() => this.lifecycle.load())
.catch(error => {
return this._handleLoadErrorInternal(error);
});
return this.withBusyHandling(() => this.lifecycle.load())
.catch(error => this._handleLoadErrorInternal(error));
} catch (error) {
return this._handleLoadErrorInternal(error);
}
}

protected _withBusyHandling<T>(action: () => JQuery.Promise<T>): JQuery.Promise<T> {
/**
* Enables the {@link BusyIndicator} while the given action runs.
*
* @see setBusy
*/
withBusyHandling<T>(action: () => JQuery.Promise<T>): JQuery.Promise<T> {
this.setBusy(true);
try {
return action()
Expand All @@ -405,6 +408,13 @@ export class Form extends Widget implements FormModel, DisplayParent {
}
}

/**
* @deprecated use {@link withBusyHandling}.
*/
protected _withBusyHandling<T>(action: () => JQuery.Promise<T>): JQuery.Promise<T> {
return this.withBusyHandling(action);
}

/**
* @returns promise which is resolved when the form is loaded, respectively when the 'load' event is triggered.
*/
Expand Down Expand Up @@ -555,7 +565,7 @@ export class Form extends Widget implements FormModel, DisplayParent {

protected _onLifecycleSave(): JQuery.Promise<void> {
try {
return this._withBusyHandling(() => {
return this.withBusyHandling(() => {
let data = this.exportData();
return this._save(data)
.then(() => {
Expand Down