Custom issue field of type "milestone" (OD-556)
devcharly opened 4 years ago

It would be great to have a field type for "milestone".

This would allow selecting milestones in a "Affected Version" field.

  • Robin Shen commented 4 years ago

    This can be done via custom groovy script. To do it:

    1. Switch to Administration / Groovy Scripts and define a groovy script say Milestones, with below content:
    import io.onedev.server.model.Project
    
    def choices = [:]
    for (milestone in Project.get().milestones) {
      if (milestone.closed)
        choices[milestone.name] = "green"
      else 
        choices[milestone.name] = "yellow"
    }
    return choices
    
    1. Now define your custom issue field Affected Version, specify Available Choices as Evaluate script to get choices, and select script Milestones created above
  • Robin Shen commented 4 years ago

    A minor error in the script. Please use color code instead of name like below:

    import io.onedev.server.model.Project
    
    def choices = [:]
    for (milestone in Project.get().milestones) {
     if (milestone.closed)
      choices[milestone.name] = "#00ff00"
     else 
      choices[milestone.name] = "#ffff00"
    }
    return choices
    
  • Robin Shen commented 4 years ago

    A built-in issue field type will also be added in next minor release

  • OneDev changed state to 'Closed' 4 years ago
    Previous Value Current Value
    Open
    Closed
  • OneDev commented 4 years ago

    State changed as code fixing the issue is committed

  • OneDev changed state to 'Released' 4 years ago
    Previous Value Current Value
    Closed
    Released
  • OneDev commented 4 years ago

    State changed as build #2278 is successful

  • devcharly commented 4 years ago

    This can be done via custom groovy script.

    That's interesting. Did not know that. Thanks for the tip. And many thanks for the new field type in 6.3.3 😀

issue 1/1
Type
New Feature
Priority
Normal
Assignee
Issue Votes (0)
Watchers (3)
Reference
OD-556
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover