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

Unable to move/reorder steps within a job

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Component/s: core
    • Environment:
      OS: MacOS Mojave (10.14.6)
      JDK: 11.0.2
      JRE: 11.0.2+9-LTS
      Jenkins: 2.225
      Browsers: Chrome,Firefox,Safari
    • Similar Issues:
    • Released As:
      2.226

      Description

      Recently noticed, whilst trying to diagnose another issue, that we are now unable to move/reorder items within a job.  

      Attempting to move/reorder items in the build or post-build  section results in the browser scrolling upwards with no ability to move item.  Tried on multiple browsers and computers.

      Steps to reproduce:

      1. Create a freestyle project
      2. Add multiple build steps
      3. Apply changes
      4. Reload the page (it only affects steps that were present when the page was loaded)
      5. Try to drag/drop build steps with the handle in the top left to change their order

      Expected result: It works

      Actual result: It doesn't

      Notes: The "placeholder" rectangle appears further up the page.

        Attachments

          Issue Links

            Activity

            Hide
            danielbeck Daniel Beck added a comment -

            I confirmed system config and view config are unaffected (and they use the pre-2.0 config page style).

            Show
            danielbeck Daniel Beck added a comment - I confirmed system config and view config are unaffected (and they use the pre-2.0 config page style).
            Hide
            danielbeck Daniel Beck added a comment -

            Folders are affected too, and they use the 2.0 config page style, just like freestyle jobs.

            Show
            danielbeck Daniel Beck added a comment - Folders are affected too, and they use the 2.0 config page style, just like freestyle jobs.
            Hide
            danielbeck Daniel Beck added a comment -

            A workaround would be to delete build steps and recreate them, as newly created steps can be reordered. That's only really feasible with simple build steps like shell/batch though, as they're basically one big textarea can can be copied easily into a new step.

            Show
            danielbeck Daniel Beck added a comment - A workaround would be to delete build steps and recreate them, as newly created steps can be reordered. That's only really feasible with simple build steps like shell/batch though, as they're basically one big textarea can can be copied easily into a new step.
            Hide
            fqueiruga Félix Queiruga Balado added a comment -

            I created a PR that fixes it. I'm doing some comprehensive manual testing to ensure everything is alright.

            Show
            fqueiruga Félix Queiruga Balado added a comment - I created a PR that fixes it. I'm doing some comprehensive manual testing to ensure everything is alright.
            Hide
            fqueiruga Félix Queiruga Balado added a comment -

            I have a better idea of what caused this regression. I’ll try to explain it.

            The war/src/main/js/config-scrollspy.js JS entry point contains some fixes for drag & drop behaviour for the job and folders form forms. Fixes are applied on a proxied Behaviour.specify call on the tabbar.js file it imports. These fixes are initialized by a function wrapped within a $() jquery block .(https://github.com/jenkinsci/jenkins/blob/23ab517cb4de3edd80e07b77d332d47eb9049276/war/src/main/js/config-scrollspy.js#L29).

            Before 2.217, the code would run in the following order:

            1. config-scrollspy.js loads and it’s executed.
            2. The initialization code runs immediatly and the Behaviour.specify call registers the fixes (https://github.com/jenkinsci/jenkins/blob/1ca9f6e8d649be88adb364da5dc2533706a8bfa5/war/src/main/js/widgets/config/tabbar.js#L13)
            3. The window.onload event handler is triggered, and runs all pieces of code set up via Behaviour.specify

            On 2.217+:

            1. config-scrollspy.js loads and it’s script-level code is executed, but the initialization code does not run.
            2. The window.onload event handler is triggered, and runs all pieces of code set up via Behaviour.specify. Because the intialization code was not yet run on the config-scrollspy.js file, drag & drop widgets existing on the page are not initialized.
            3. The initialization code for the drag & drop fixes is run. Because it came after the _window.onload _event, it will only apply to draggable widgets added after this point (i.e. recently added and unsaved steps).

            Basically, jQuery will wait until window.onload event to run the subscription code on 2.217+. The fix consists on moving the Behaviour.specify call on the tabbar.js file to be run when the script loads, so that it happens before the window.onload event.

            I don’t think it will negatively impact any other part of the app / plugin.

            Show
            fqueiruga Félix Queiruga Balado added a comment - I have a better idea of what caused this regression. I’ll try to explain it. The war/src/main/js/config-scrollspy.js JS entry point contains some fixes for drag & drop behaviour for the job and folders form forms. Fixes are applied on a proxied Behaviour.specify call on the tabbar.js file it imports. These fixes are initialized by a function wrapped within a $() jquery block .( https://github.com/jenkinsci/jenkins/blob/23ab517cb4de3edd80e07b77d332d47eb9049276/war/src/main/js/config-scrollspy.js#L29 ). Before 2.217, the code would run in the following order: config-scrollspy.js loads and it’s executed. The initialization code runs immediatly and the Behaviour.specify call registers the fixes ( https://github.com/jenkinsci/jenkins/blob/1ca9f6e8d649be88adb364da5dc2533706a8bfa5/war/src/main/js/widgets/config/tabbar.js#L13 ) The window.onload event handler is triggered, and runs all pieces of code set up via Behaviour.specify On 2.217+: config-scrollspy.js loads and it’s script-level code is executed, but the initialization code does not run. The window.onload event handler is triggered, and runs all pieces of code set up via Behaviour.specify . Because the intialization code was not yet run on the config-scrollspy.js file, drag & drop widgets existing on the page are not initialized. The initialization code for the drag & drop fixes is run. Because it came after the _window.onload _event, it will only apply to draggable widgets added after this point (i.e. recently added and unsaved steps). Basically, jQuery will wait until window.onload event to run the subscription code on 2.217+. The fix consists on moving the Behaviour.specify call on the tabbar.js file to be run when the script loads, so that it happens before the window.onload event. I don’t think it will negatively impact any other part of the app / plugin.

              People

              Assignee:
              fqueiruga Félix Queiruga Balado
              Reporter:
              andyh200 Andy H
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: