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

nested view plugin get list of jobs in a sub view ?

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • nested-view-plugin
    • None

      i am trying to get list of jobs in a subview of a nested view.
      I could not get it programatically, hudson.instance.getView or hudson.instance.getViews does not help in this case,

      Please advise on how to get that information, if its not already there then please add the necessary changes

          [JENKINS-23283] nested view plugin get list of jobs in a sub view ?

          Michael Payne added a comment -

          Not sure if I understand your use of subview and nested view here. Is this what you want?

          	
                  def parent = Hudson.instance.getView("Parent_View")
          	def views = parent.getViews()
          	def view = views.find {it.getDisplayName() == 'Child_View'}
                  for(item in view.getItems()) {
            		println(item.name)
          	}
          }
          

          Perhaps you can elaborate on the requirement here.

          Michael Payne added a comment - Not sure if I understand your use of subview and nested view here. Is this what you want? def parent = Hudson.instance.getView( "Parent_View" ) def views = parent.getViews() def view = views.find {it.getDisplayName() == 'Child_View' } for (item in view.getItems()) { println(item.name) } } Perhaps you can elaborate on the requirement here.

          Manoj Thakkar added a comment -

          this will work actually, i was trying to get nested views items and this will do the trick

          Manoj Thakkar added a comment - this will work actually, i was trying to get nested views items and this will do the trick

          I looked to see if this behavior of being unable to list subviews had been reported, so I'll add my cli usage here.

          No job listing using the expected input from the browser url:

          $ java -jar jenkins-cli.jar -s http://jenkins.mydomain.com/ list-jobs MainView/view/SubView
          No view or item group with the given name found
          

          Attempting to list SubView, MainView/SubView, and several other contrived variations result in the same "No job listing.." Using the cli to list MainView returns a list of all the jobs contained in all the subviews, which was unexpected and isn't the list I'm trying to fetch, but I found it interesting.

          If there is a way to list jobs in a subview using the jenkins cli, that would be great.

          Michael Shuler added a comment - I looked to see if this behavior of being unable to list subviews had been reported, so I'll add my cli usage here. No job listing using the expected input from the browser url: $ java -jar jenkins-cli.jar -s http://jenkins.mydomain.com/ list-jobs MainView/view/SubView No view or item group with the given name found Attempting to list SubView , MainView/SubView , and several other contrived variations result in the same "No job listing.." Using the cli to list MainView returns a list of all the jobs contained in all the subviews, which was unexpected and isn't the list I'm trying to fetch, but I found it interesting. If there is a way to list jobs in a subview using the jenkins cli, that would be great.

          Chris Neal added a comment -

          Hi!  

           

          I am trying to get these scripts to work.   The problem is that I have "folders" between my views.   And since I don't know what the expected output is, or where the hudson function starts, I can't get any output other than "null" as a response.

          Can somoene point me to the place where the expected output is described?

          Thanks,

          -Chris

          Chris Neal added a comment - Hi!     I am trying to get these scripts to work.   The problem is that I have "folders" between my views.   And since I don't know what the expected output is, or where the hudson function starts, I can't get any output other than "null" as a response. Can somoene point me to the place where the expected output is described? Thanks, -Chris

            Unassigned Unassigned
            mthakkar Manoj Thakkar
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: