mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-26 18:03:39 +01:00
Api: Add a timeout for form submit
If a submit takes more than 30s, give a warning and hide the loader so the user can try to salvage their changes.
This commit is contained in:
parent
fc445836f4
commit
6ee5d69e1e
@ -1087,7 +1087,28 @@ export class etemplate2
|
||||
{
|
||||
api.loading_prompt('et2_submit_spinner', false);
|
||||
}, this, async);
|
||||
request.sendRequest();
|
||||
const request_promise = request.sendRequest();
|
||||
|
||||
// Set up timeout for 30 seconds
|
||||
let warning_message = null;
|
||||
const timeout_id = window.setTimeout(() =>
|
||||
{
|
||||
// Do not abort request, it might still come
|
||||
api.debug("warn", "Request '" + this.menuaction + "' timeout")
|
||||
warning_message = api.message(api.lang("No response from server: your data is probably NOT saved"), "warning");
|
||||
api.loading_prompt('et2_submit_spinner', false);
|
||||
}, 30000);
|
||||
|
||||
// Cancel timeout
|
||||
request_promise.then(() =>
|
||||
{
|
||||
// Responded * and response processed *
|
||||
clearTimeout(timeout_id);
|
||||
if(warning_message)
|
||||
{
|
||||
warning_message.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -951,6 +951,7 @@ no filters common en No filters
|
||||
no history for this record common en No history for this record
|
||||
no key for recipient: common en No key for recipient:
|
||||
no matches found common en No matches found.
|
||||
no response from server: your data is probably not saved common en No response from server: your data is probably NOT saved
|
||||
no results match common en No results match
|
||||
no rights to export more than %1 entries! common en No rights to export more than %1 entries!
|
||||
no row to swap with !!! common en No row to swap with!
|
||||
|
Loading…
Reference in New Issue
Block a user