Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-34487

Do not hang the browser when parameter re-evaluated

      Sometimes it takes a considerable amount of time to evaluate groovy back-end script. For instance when data is loaded from remote resource by a reactive parameter.
      As for now, the plugin hang the webpage till data is loaded. The behavior is not very user friendly when it takes more than 2 seconds to evaluate the script.

      Ideally, the page should not hang and all, and loading animation should be shown for parameter being evaluated.
      Alternatively, the plugin can show a 'loading' splash screen if the evaluation s gone for too long.

      PS I can contribute to the code if some directions are given: 1) ideas on how desired behaviour can be implemented 2) where to start searching for places in code where the desired improvement can be implemented 3) how to test and commit the resulting code.

          [JENKINS-34487] Do not hang the browser when parameter re-evaluated

          Hi Vladimir, thanks for reporting the issue, and my +1 for it.

          When I have more time, probably in the end of the next development cycle for the plug-in, I'll try to post here links to the source code where it needs to be modified, and how it could be.

          If in the meantime you'd like to explore and have a play with the code yourself; here's a few tips off the top of my head:

          • The plug-in calls a proxy object. This proxy object is part of Jenkins core. Java objects are exposed as proxies. By default it is asynchronous, but we overwrite the function in the plug-in to make it synchronous (digressing: that could probably be made asynchronous again in the future, with proper re-design of the code - though I think there was some limitation in Jenkins code?)
          • One would have to add a method just before calling the proxy, to display a loading animation somewhere
          • Jenkins has a loading page (I think). I remember seeing it before... or was it from some other plug-in? Well, I'd play with Jenkins and take a look where I see a loading animation, then just copy it or call it.

          Bruno P. Kinoshita added a comment - Hi Vladimir, thanks for reporting the issue, and my +1 for it. When I have more time, probably in the end of the next development cycle for the plug-in, I'll try to post here links to the source code where it needs to be modified, and how it could be. If in the meantime you'd like to explore and have a play with the code yourself; here's a few tips off the top of my head: The plug-in calls a proxy object. This proxy object is part of Jenkins core. Java objects are exposed as proxies. By default it is asynchronous, but we overwrite the function in the plug-in to make it synchronous (digressing: that could probably be made asynchronous again in the future, with proper re-design of the code - though I think there was some limitation in Jenkins code?) One would have to add a method just before calling the proxy, to display a loading animation somewhere Jenkins has a loading page (I think). I remember seeing it before... or was it from some other plug-in? Well, I'd play with Jenkins and take a look where I see a loading animation, then just copy it or call it.

          Oh, and not sure whether we should block the whole page, whole job page, or just a parameter... not really a good UX guy, but I'd guess that blocking the parameter, and displaying the animation somewhere not too intrusive would suffice.

          Bruno P. Kinoshita added a comment - Oh, and not sure whether we should block the whole page, whole job page, or just a parameter... not really a good UX guy, but I'd guess that blocking the parameter, and displaying the animation somewhere not too intrusive would suffice.

          Vladimir Fedorov added a comment - - edited

          Hi there,

          Thanks for reply.
          I've already managed to find a place in code where the issues was tried to be addressed (but commented out). It poped-up Jenkins Loading screen (it's available on probably every jenkins page: build param and job config pages - for sure, Jenkins Javascript code just makes the screen invisible when page finished loading. )

          I've played with the code myself a bit and came out with the following fix:
          https://github.com/biouno/uno-choice-plugin/pull/81

          It pops-up Loading screen, and then updates parms from async timer routine (it was done in sync mode previously - that lead to browser didn't redraw the window till communication with java bindings was over) making browser to show the screen meanwhile communication with java bindings are going on.
          It's not the best UX solution indeed but feels far better compared to hanging browser.
          Also it turned easy to modify loading screen css so it looks far friendlier than standard one.

          Please let me know if a) it is possible to merge the fix b) how to make the introduced behaviour optional (depending on plugin config for instance) since i'm far from being 100% sure it's compatible with all major browsers.

          Regards

          Vladimir Fedorov added a comment - - edited Hi there, Thanks for reply. I've already managed to find a place in code where the issues was tried to be addressed (but commented out). It poped-up Jenkins Loading screen (it's available on probably every jenkins page: build param and job config pages - for sure, Jenkins Javascript code just makes the screen invisible when page finished loading. ) I've played with the code myself a bit and came out with the following fix: https://github.com/biouno/uno-choice-plugin/pull/81 It pops-up Loading screen, and then updates parms from async timer routine (it was done in sync mode previously - that lead to browser didn't redraw the window till communication with java bindings was over) making browser to show the screen meanwhile communication with java bindings are going on. It's not the best UX solution indeed but feels far better compared to hanging browser. Also it turned easy to modify loading screen css so it looks far friendlier than standard one. Please let me know if a) it is possible to merge the fix b) how to make the introduced behaviour optional (depending on plugin config for instance) since i'm far from being 100% sure it's compatible with all major browsers. Regards

          Code changed in jenkins
          User: feoff
          Path:
          src/main/resources/org/biouno/unochoice/stapler/unochoice/unochoice.js
          http://jenkins-ci.org/commit/active-choices-plugin/52d95423841a22a6a4bf6c28a52778d356247f52
          Log:
          moved referenced parameter update to an async timer operation and show loading message whenever it happens , see JENKINS-34487

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: feoff Path: src/main/resources/org/biouno/unochoice/stapler/unochoice/unochoice.js http://jenkins-ci.org/commit/active-choices-plugin/52d95423841a22a6a4bf6c28a52778d356247f52 Log: moved referenced parameter update to an async timer operation and show loading message whenever it happens , see JENKINS-34487

          Pull request merged. Should be available in the update center by Friday this afternoon New Zealand time.

          Bruno P. Kinoshita added a comment - Pull request merged. Should be available in the update center by Friday this afternoon New Zealand time.

          Released in 1.5.3

          Bruno P. Kinoshita added a comment - Released in 1.5.3

            kinow Bruno P. Kinoshita
            feoff3 Vladimir Fedorov
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: