• Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • core

      In the CloudBees Folder plugin, RelocateAction implements TransientProjectActionFactory to add the link to various project types letting them be moved into other folders, and TransientFolderActionFactory for subfolders. Would make sense to have a generic TransientActionFactory for other Actionable subtypes (maybe only AbstractItem), which would allow miscellaneous items (especially when a TopLevelItem) to get actions like Relocate as well.

          [JENKINS-18224] TransientActionFactory

          Jesse Glick created issue -

          Making Actionable understand transient actions is actually a good idea, because transient actions in general are typically done as a hack.

          Although it probably implies calling transient action factory on every page rendering.

          Kohsuke Kawaguchi added a comment - Making Actionable understand transient actions is actually a good idea, because transient actions in general are typically done as a hack. Although it probably implies calling transient action factory on every page rendering.

          Jesse Glick added a comment -

          Unfortunately the antipattern of Actionable returning a mutable collection from getActions, coupled with questionable and inconsistent behaviors of its subtypes, has made it seemingly impossible to compatibly change how Actionable.getActions works. The same is true of nonfinal Actionable subtypes like AbstractItem which do not themselves currently override Actionable methods.

          The only compatible course is to introduce a new method which would include entries from a TransientActionFactory, though then lots of code would need to be updated to call it: basically anything which calls getActions and treats the result as read-only.

          (And User and View are not Actionable despite having comparable methods and transient factories! So they cannot use any new facility.)

          Jesse Glick added a comment - Unfortunately the antipattern of Actionable returning a mutable collection from getActions , coupled with questionable and inconsistent behaviors of its subtypes, has made it seemingly impossible to compatibly change how Actionable.getActions works. The same is true of nonfinal Actionable subtypes like AbstractItem which do not themselves currently override Actionable methods. The only compatible course is to introduce a new method which would include entries from a TransientActionFactory , though then lots of code would need to be updated to call it: basically anything which calls getActions and treats the result as read-only. (And User and View are not Actionable despite having comparable methods and transient factories! So they cannot use any new facility.)
          Jesse Glick made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Jesse Glick made changes -
          Jesse Glick made changes -
          Link New: This issue is blocking JENKINS-20990 [ JENKINS-20990 ]

          Code changed in jenkins
          User: Jesse Glick
          Path:
          core/src/main/java/hudson/matrix/DefaultMatrixExecutionStrategyImpl.java
          core/src/main/java/hudson/model/AbstractBuild.java
          core/src/main/java/hudson/model/AbstractProject.java
          core/src/main/java/hudson/model/Actionable.java
          core/src/main/java/hudson/model/Computer.java
          core/src/main/java/hudson/model/Job.java
          core/src/main/java/hudson/model/Queue.java
          core/src/main/java/hudson/model/Run.java
          core/src/main/java/hudson/model/TransientBuildActionFactory.java
          core/src/main/java/hudson/model/TransientComputerActionFactory.java
          core/src/main/java/hudson/model/TransientProjectActionFactory.java
          core/src/main/java/hudson/model/queue/WorkUnitContext.java
          core/src/main/java/jenkins/model/ModelObjectWithContextMenu.java
          core/src/main/java/jenkins/model/TransientActionFactory.java
          core/src/main/resources/hudson/matrix/MatrixProject/index.jelly
          core/src/main/resources/hudson/model/AbstractBuild/index.jelly
          core/src/main/resources/hudson/model/AbstractProject/main.jelly
          core/src/main/resources/lib/hudson/actions.jelly
          core/src/main/resources/lib/hudson/project/projectActionFloatingBox.jelly
          test/src/test/java/jenkins/model/TransientActionFactoryTest.java
          http://jenkins-ci.org/commit/jenkins/f1a751f79dfbb975e4c436fd0967323e1ae7b8c6
          Log:
          [FIXED JENKINS-18224] Introduced TransientActionFactory.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: core/src/main/java/hudson/matrix/DefaultMatrixExecutionStrategyImpl.java core/src/main/java/hudson/model/AbstractBuild.java core/src/main/java/hudson/model/AbstractProject.java core/src/main/java/hudson/model/Actionable.java core/src/main/java/hudson/model/Computer.java core/src/main/java/hudson/model/Job.java core/src/main/java/hudson/model/Queue.java core/src/main/java/hudson/model/Run.java core/src/main/java/hudson/model/TransientBuildActionFactory.java core/src/main/java/hudson/model/TransientComputerActionFactory.java core/src/main/java/hudson/model/TransientProjectActionFactory.java core/src/main/java/hudson/model/queue/WorkUnitContext.java core/src/main/java/jenkins/model/ModelObjectWithContextMenu.java core/src/main/java/jenkins/model/TransientActionFactory.java core/src/main/resources/hudson/matrix/MatrixProject/index.jelly core/src/main/resources/hudson/model/AbstractBuild/index.jelly core/src/main/resources/hudson/model/AbstractProject/main.jelly core/src/main/resources/lib/hudson/actions.jelly core/src/main/resources/lib/hudson/project/projectActionFloatingBox.jelly test/src/test/java/jenkins/model/TransientActionFactoryTest.java http://jenkins-ci.org/commit/jenkins/f1a751f79dfbb975e4c436fd0967323e1ae7b8c6 Log: [FIXED JENKINS-18224] Introduced TransientActionFactory.
          SCM/JIRA link daemon made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Progress [ 3 ] New: Resolved [ 5 ]

          Code changed in jenkins
          User: Jesse Glick
          Path:
          core/src/main/java/hudson/cli/SetBuildParameterCommand.java
          core/src/main/java/hudson/model/AbstractBuild.java
          core/src/main/java/hudson/model/AbstractProject.java
          core/src/main/java/hudson/model/Actionable.java
          core/src/main/java/hudson/model/CauseAction.java
          core/src/main/java/hudson/model/Computer.java
          core/src/main/java/hudson/model/labels/LabelAtom.java
          core/src/main/java/hudson/tasks/Fingerprinter.java
          core/src/main/java/hudson/triggers/SCMTrigger.java
          test/src/test/java/hudson/model/UserTest.java
          http://jenkins-ci.org/commit/jenkins/a22e9feaaef30b89621ae9ca3f33f862ae99f4c7
          Log:
          JENKINS-18224 Introduced Actionable.replaceAction, allowing getActions() to be deprecated except for subclasses.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: core/src/main/java/hudson/cli/SetBuildParameterCommand.java core/src/main/java/hudson/model/AbstractBuild.java core/src/main/java/hudson/model/AbstractProject.java core/src/main/java/hudson/model/Actionable.java core/src/main/java/hudson/model/CauseAction.java core/src/main/java/hudson/model/Computer.java core/src/main/java/hudson/model/labels/LabelAtom.java core/src/main/java/hudson/tasks/Fingerprinter.java core/src/main/java/hudson/triggers/SCMTrigger.java test/src/test/java/hudson/model/UserTest.java http://jenkins-ci.org/commit/jenkins/a22e9feaaef30b89621ae9ca3f33f862ae99f4c7 Log: JENKINS-18224 Introduced Actionable.replaceAction, allowing getActions() to be deprecated except for subclasses.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          changelog.html
          core/src/main/java/hudson/model/Actionable.java
          core/src/main/java/jenkins/model/TransientActionFactory.java
          http://jenkins-ci.org/commit/jenkins/6eb191964b415d7f0a025847d5444db922d6fe49
          Log:
          JENKINS-18224 Preparing to merge #1059.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: changelog.html core/src/main/java/hudson/model/Actionable.java core/src/main/java/jenkins/model/TransientActionFactory.java http://jenkins-ci.org/commit/jenkins/6eb191964b415d7f0a025847d5444db922d6fe49 Log: JENKINS-18224 Preparing to merge #1059.

            jglick Jesse Glick
            jglick Jesse Glick
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: