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

Remove custom stapler proxy as we can now use assync requests

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Thanks to the new spinning loader, introduced in 1.5.3, I believe we can now drop the custom hack in the plug-in to have synchronous requests.

      Initial tests locally showed that it worked with no problems. Will ask Ioannis Moutsatsos to test it too before releasing 1.5.4.

        Attachments

          Activity

          Hide
          kinow Bruno P. Kinoshita added a comment -

          Ioannis, all requests from the plug-in are synchronous. (warning, this is one of those long comments, come back with coffee when you have time / patience to read it with calm )

          Jenkins supports automagically creating a proxy to Java objects. In the UI, JavaScript code can call Java methods. It is not a standard way. In Java, we annotate classes with @ JavaScriptMethod. These methods are then exposed by Stapler (Jenkins' web framework) to the UI.

          This annotation is used to create proxy objects. The UI JavaScript code talks to this proxy, and in our case, when you change something in one field, the plug-in JavaScript code retrieves the referenced parameter values, then calls the proxy method "doUpdate" to update the list of values reactively.

          Now, this all used to happen asynchronously in uno-choice-0.something. We changed it after realising that it could take a while to retrieve values and render the UI. During that big refactor we did together some time ago, I added a *hack*. Right now, juuuust before calling the doUpdate method of the proxy, we "replace" the proxy by a custom proxy, that is synchronous.

          This is bad for the UI. As we lock the main thread (you see some warnings in Firefox console some times).

          Now that we have a "Loading..." message in 1.5.3 (to be released), I believe we can use Jenkins' default JavaScript proxy. Which is good for a number of reasons. And then simply call asynchronously the doUpdate method, display the loading overlay, that will disappear once the proxy is done.

          Show
          kinow Bruno P. Kinoshita added a comment - Ioannis, all requests from the plug-in are synchronous. (warning, this is one of those long comments, come back with coffee when you have time / patience to read it with calm ) Jenkins supports automagically creating a proxy to Java objects. In the UI, JavaScript code can call Java methods. It is not a standard way. In Java, we annotate classes with @ JavaScriptMethod. These methods are then exposed by Stapler (Jenkins' web framework) to the UI. This annotation is used to create proxy objects. The UI JavaScript code talks to this proxy, and in our case, when you change something in one field, the plug-in JavaScript code retrieves the referenced parameter values, then calls the proxy method "doUpdate" to update the list of values reactively. Now, this all used to happen asynchronously in uno-choice-0.something. We changed it after realising that it could take a while to retrieve values and render the UI. During that big refactor we did together some time ago, I added a * hack *. Right now, juuuust before calling the doUpdate method of the proxy, we "replace" the proxy by a custom proxy, that is synchronous. This is bad for the UI. As we lock the main thread (you see some warnings in Firefox console some times). Now that we have a "Loading..." message in 1.5.3 (to be released), I believe we can use Jenkins' default JavaScript proxy. Which is good for a number of reasons. And then simply call asynchronously the doUpdate method, display the loading overlay, that will disappear once the proxy is done.
          Hide
          kinow Bruno P. Kinoshita added a comment -

          Local tests worked fine. Pushed to a branch in git, and will merge it once 1.5.3 is released.

          Show
          kinow Bruno P. Kinoshita added a comment - Local tests worked fine. Pushed to a branch in git, and will merge it once 1.5.3 is released.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Bruno P. Kinoshita
          Path:
          src/main/resources/org/biouno/unochoice/CascadeChoiceParameter/index.jelly
          src/main/resources/org/biouno/unochoice/DynamicReferenceParameter/index.jelly
          src/main/resources/org/biouno/unochoice/stapler/unochoice/unochoice.js
          http://jenkins-ci.org/commit/active-choices-plugin/8ccd7fcdec84e3cb6272115662632fa2542ce945
          Log:
          JENKINS-42685 Remove stapler proxy as we can now use assync requests

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Bruno P. Kinoshita Path: src/main/resources/org/biouno/unochoice/CascadeChoiceParameter/index.jelly src/main/resources/org/biouno/unochoice/DynamicReferenceParameter/index.jelly src/main/resources/org/biouno/unochoice/stapler/unochoice/unochoice.js http://jenkins-ci.org/commit/active-choices-plugin/8ccd7fcdec84e3cb6272115662632fa2542ce945 Log: JENKINS-42685 Remove stapler proxy as we can now use assync requests
          Hide
          kinow Bruno P. Kinoshita added a comment -

          Branch merged. Will be released with 1.5.4

          Show
          kinow Bruno P. Kinoshita added a comment - Branch merged. Will be released with 1.5.4
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Bruno P. Kinoshita
          Path:
          src/main/resources/org/biouno/unochoice/CascadeChoiceParameter/index.jelly
          src/main/resources/org/biouno/unochoice/DynamicReferenceParameter/index.jelly
          src/main/resources/org/biouno/unochoice/stapler/unochoice/unochoice.js
          http://jenkins-ci.org/commit/active-choices-plugin/24a60d664ec37c9de3d64de5de5c330d98c230e4
          Log:
          [FIXED JENKINS-47908]: Revert "JENKINS-42685 Remove stapler proxy as we can now use assync requests"

          This reverts commit 8ccd7fcdec84e3cb6272115662632fa2542ce945.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Bruno P. Kinoshita Path: src/main/resources/org/biouno/unochoice/CascadeChoiceParameter/index.jelly src/main/resources/org/biouno/unochoice/DynamicReferenceParameter/index.jelly src/main/resources/org/biouno/unochoice/stapler/unochoice/unochoice.js http://jenkins-ci.org/commit/active-choices-plugin/24a60d664ec37c9de3d64de5de5c330d98c230e4 Log: [FIXED JENKINS-47908] : Revert " JENKINS-42685 Remove stapler proxy as we can now use assync requests" This reverts commit 8ccd7fcdec84e3cb6272115662632fa2542ce945.
          Hide
          kinow Bruno P. Kinoshita added a comment -

          Reverting as it caused a regression reported in 2.0, see JENKINS-47908 for more.

          Show
          kinow Bruno P. Kinoshita added a comment - Reverting as it caused a regression reported in 2.0, see JENKINS-47908 for more.

            People

            Assignee:
            kinow Bruno P. Kinoshita
            Reporter:
            kinow Bruno P. Kinoshita
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: