Ticket #259 (in_QA enhancement)

Opened 4 years ago

Last modified 3 years ago

Displaying alert when there is no network connectivity during ajax calls

Reported by: revvi Owned by: somebody
Priority: important Milestone: 1.1.3
Component: Javascript Version: 1.0.0 RC2
Keywords: Cc:

Description

This js modification is basically to avoid frozen browser whenever there is no network when triggering any ajaxaction. It will display an alert window (div) in the position described in post.js: 171. Perhaps the function is similar to gmail or facebook when you have network problem.

The only drawback is that any AJAX error dump will not be displayed in some cases. It will display this alert instead. It means it will be suitable for live version where there is no bug (very minimal bug in php AjaxAction? event function).

Attachments

logger.js Download (5.7 KB) - added by revvi 4 years ago.
logger.js
post.js Download (9.9 KB) - added by revvi 4 years ago.
post.js
DisplayAlert.patch Download (5.3 KB) - added by revvi 4 years ago.
post.js and logger.js revision
DisplayAlertConfiguration.patch Download (7.6 KB) - added by revvi 4 years ago.
Alternative of Display alert which includes constant in configuration.

Change History

Changed 4 years ago by revvi

logger.js

Changed 4 years ago by revvi

post.js

Changed 4 years ago by alex94040

  • status changed from new to in_QA

Very interesting, thanks for your contribution, revvi! Can you do me a favor and:

1) Resubmit your work as an SVN .patch file

2) Add functionality (if it's not there yet) to have a "production" and "development" modes (defined through a constant) for the alerts - to show a polite, non-detailed error in production, and a detailed error dump in development mode?

Changed 4 years ago by alex94040

  • component changed from Other to Javascript
  • milestone set to 1.1

Changed 4 years ago by revvi

This patch does not need that constant. It is automatic to display ajax error dump whenever there is an error. And it will display no network message whenever the connection to server is lost.

About the friendly alert for production and the developer mode for development mode, I will post it in different ticket. I wrote that before in my live site.

Changed 4 years ago by alex94040

revvi - please post that (production vs dev alerts) as a part of this same ticket, if at all possible. I'd imagine that it would go hand-in-hand with this contribution - or am I misunderstanding something?

Thanks again for your great work!

Changed 4 years ago by revvi

Alright, I will post it in here as well. Currently I'm still testing another changes of the previous patch that support development and production mode.

Changed 4 years ago by revvi

post.js and logger.js revision

Changed 4 years ago by revvi

In the latest patch revision, it follows the internal QCubed friendly error message to have "production" mode or normal dump for "development" mode.

Enable the following line 197-198 in configuration.inc.php to have friendly error.

//	define('ERROR_FRIENDLY_PAGE_PATH', __PHP_ASSETS__ . '/friendly_error_page.php');
//	define('ERROR_FRIENDLY_AJAX_MESSAGE', 'Oops!  An error has occurred.\r\n\r\nThe error was logged, and we will take a look into this right away.');

In any case of no server response/lost network, it will display no network message. If there is code error, it will still display either friendly error or QCubed error dump depends on the above configuration.

Changed 4 years ago by revvi

Alternative of Display alert which includes constant in configuration.

Changed 4 years ago by alex94040

This is very, very exciting stuff. Thanks a bunch for doing it! We'll work on including your patch into the 1.1 release.

Changed 4 years ago by alex94040

  • milestone changed from 1.1 to 2.0

We unfortunately have to delay the integration of this very useful work into the core distribution until 2.0. Significant JS changes will be made in the 2.0 branch, as a part of jQuery integration, and we should not be integrating JS-related stuff into the framework that would make this transition harder then.

Changed 3 years ago by alex94040

  • milestone changed from 2.0 to 1.1.2

We may or may not want to integrate this into 1.1.2. Considering that the future is with jQuery, should we do it? What do you folks think?

Changed 3 years ago by VexedPanda

If it's a bug in 1.1.1, I'd say we should fix it in 1.1.2.
Even if 2.0 comes out first, I think we still want bug fixes of 1.0 and 1.1 to be released.

Changed 3 years ago by alex94040

Alright. Agreed.

Changed 3 years ago by alex94040

  • milestone changed from 1.1.2 to 1.1.3
Note: See TracTickets for help on using tickets.