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

Do not hang the browser when parameter re-evaluated

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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.

        Attachments

          Activity

          Hide
          kinow 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.
          Show
          kinow 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.
          Hide
          kinow 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.

          Show
          kinow 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.
          Hide
          feoff3 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

          Show
          feoff3 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
          Hide
          scm_issue_link 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

          Show
          scm_issue_link 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
          Hide
          kinow Bruno P. Kinoshita added a comment -

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

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

          Released in 1.5.3

          Show
          kinow Bruno P. Kinoshita added a comment - Released in 1.5.3

            People

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

              Dates

              Created:
              Updated:
              Resolved: