You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by GitBox <gi...@apache.org> on 2020/02/23 07:16:03 UTC

[GitHub] [wicket] reiern70 opened a new pull request #408: allow to abort currently executing request for an Ajax channel

reiern70 opened a new pull request #408: allow to abort currently executing request for an Ajax channel
URL: https://github.com/apache/wicket/pull/408
 
 
   Hi @martin-g ,
   
   We have the following use case: 
   
   1- Very big AJAX upload... user gets tired of waiting
   2- User wants to cancel upload
   
   Thus we would like to cancel at client side the current AJAX request for the channel used for the upload.  I had a look a channels with DROP type... and this does not seem to be useful in above use case... as scheduling a new request will wait fro current request to finish before erasing all other waiting requests (or so I understood).
   
   Disclaimer: I haven't tested the code included on PR. I just want to know if in your opinion if this a good approach and it could work without side effects... Or if there is a better approach?
   
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [wicket] martin-g commented on a change in pull request #408: allow to abort currently executing request for an Ajax channel

Posted by GitBox <gi...@apache.org>.
martin-g commented on a change in pull request #408: allow to abort currently executing request for an Ajax channel
URL: https://github.com/apache/wicket/pull/408#discussion_r383106737
 
 

 ##########
 File path: wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
 ##########
 @@ -278,6 +278,15 @@
 			}
 		},
 
+		// aborts current request is there is any running
+		abort: function () {
+			if (isUndef(this.jqXHR)) {
+				Wicket.Log.debug("There is no executing request fro channel " + this.name)
 
 Review comment:
   missing semicolon at the end

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [wicket] reiern70 commented on issue #408: allow to abort currently executing request for an Ajax channel

Posted by GitBox <gi...@apache.org>.
reiern70 commented on issue #408: allow to abort currently executing request for an Ajax channel
URL: https://github.com/apache/wicket/pull/408#issuecomment-590221003
 
 
   See...
   
   https://issues.apache.org/jira/browse/WICKET-6750
   
   Closing this PR + delete remote branch + I will create a new PR when new feature is ready for review.
   
   Thanks again!

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [wicket] martin-g commented on a change in pull request #408: allow to abort currently executing request for an Ajax channel

Posted by GitBox <gi...@apache.org>.
martin-g commented on a change in pull request #408: allow to abort currently executing request for an Ajax channel
URL: https://github.com/apache/wicket/pull/408#discussion_r383106891
 
 

 ##########
 File path: wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
 ##########
 @@ -319,6 +328,26 @@
 			return c.schedule(callback);
 		},
 
+		// register AJAX request
+		registerCurrentAjaxRequest: function(name, jqXHR) {
+			var c = this.channels[name];
+			if (isUndef(c)) {
+				Wicket.Log.error("No channel with name " + name)
+			} else {
+				c.jqXHR = jqXHR;
+			}
+		},
+
+		// aborts the current request for channel with name name
+		abortCurrentQuestForChannel(name) {
 
 Review comment:
   s/Quest/Request/ :-)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [wicket] martin-g commented on a change in pull request #408: allow to abort currently executing request for an Ajax channel

Posted by GitBox <gi...@apache.org>.
martin-g commented on a change in pull request #408: allow to abort currently executing request for an Ajax channel
URL: https://github.com/apache/wicket/pull/408#discussion_r383106539
 
 

 ##########
 File path: wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
 ##########
 @@ -278,6 +278,15 @@
 			}
 		},
 
+		// aborts current request is there is any running
+		abort: function () {
+			if (isUndef(this.jqXHR)) {
+				Wicket.Log.debug("There is no executing request fro channel " + this.name)
 
 Review comment:
   s/fro/for/

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [wicket] reiern70 closed pull request #408: allow to abort currently executing request for an Ajax channel

Posted by GitBox <gi...@apache.org>.
reiern70 closed pull request #408: allow to abort currently executing request for an Ajax channel
URL: https://github.com/apache/wicket/pull/408
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [wicket] martin-g commented on issue #408: allow to abort currently executing request for an Ajax channel

Posted by GitBox <gi...@apache.org>.
martin-g commented on issue #408: allow to abort currently executing request for an Ajax channel
URL: https://github.com/apache/wicket/pull/408#issuecomment-590192141
 
 
   And please create a ticket. This is an improvement that should appear in the changelog.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [wicket] reiern70 commented on issue #408: allow to abort currently executing request for an Ajax channel

Posted by GitBox <gi...@apache.org>.
reiern70 commented on issue #408: allow to abort currently executing request for an Ajax channel
URL: https://github.com/apache/wicket/pull/408#issuecomment-590198756
 
 
   > Hi @reiern70 !
   > 
   > Few minor comments to the changes.
   > IMO it should do the job!
   > 
   > Please add some tests to https://github.com/apache/wicket/blob/master/wicket-core/src/test/js/ajax.js
   
   Hi @martin-g,
   
   Thanks for review and comments!  Now that I have confirmation that idea might work I will work to move it  production ready state.
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [wicket] martin-g commented on a change in pull request #408: allow to abort currently executing request for an Ajax channel

Posted by GitBox <gi...@apache.org>.
martin-g commented on a change in pull request #408: allow to abort currently executing request for an Ajax channel
URL: https://github.com/apache/wicket/pull/408#discussion_r383106777
 
 

 ##########
 File path: wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
 ##########
 @@ -319,6 +328,26 @@
 			return c.schedule(callback);
 		},
 
+		// register AJAX request
+		registerCurrentAjaxRequest: function(name, jqXHR) {
+			var c = this.channels[name];
+			if (isUndef(c)) {
+				Wicket.Log.error("No channel with name " + name)
 
 Review comment:
   missing semicolon at the end

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services