0

I am trying to create nested tabs with a Jenkins Job DSL Groovy script. It creates them, but I can find no way to set the "Default subview" in the DSL API. It does not appear to display the tabs correctly until I do this. Once I manually, change that default, it displays correctly. Here is the code:

nestedView(viewName) {
  views {
    listView("Builds (Staging)") {
      jobs {
        name(buildJobName)
      }
      columns {
                status()
                weather()
                name()
                lastSuccess()
                lastFailure()
                lastDuration()
                buildButton()
              }
    }
    listView("Deployments (Staging)") {
      jobs {
        name(deployJobName)
      }
      columns {
                status()
                weather()
                name()
                lastSuccess()
                lastFailure()
                lastDuration()
                buildButton()
              }
    }
  }
}

Original view

Corrected view after manually changing Default subview in Edit View

P Solomon
  • 175
  • 1
  • 10

2 Answers2

3

You can use a Configure Block to any missing config XML elements.

nestedView('test') {
  views {
    listView("Builds (Staging)") {
      jobs {
        name('foo')
      }
      columns {
        status()
        weather()
        name()
      }
    }
    listView("Deployments (Staging)") {
      jobs {
        name('bar')
      }
      columns {
        status()
        weather()
        name()
      }
    }
  }
  configure { view ->
    view / defaultView('Builds (Staging)')
  }
}

Please file a ticket or open a pull request for any missing DSL methods.

daspilker
  • 8,154
  • 1
  • 35
  • 49
0

If you happen to be configuring views under a folder, you can set it there.

folder(abc)
{   
    views {
        listView('foo') {
        primaryView('foo')
    }   
}   

It looks like it's available since version 1.36

Tony Kuo
  • 126
  • 2
  • 4