#556  Custom issue field of type "milestone"
Released
devcharly opened 2 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 2 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 2 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 2 years ago

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

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

State changed as code fixing the issue is committed

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

State changed as build #2278 is successful

devcharly commented 2 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 of 1
Type
New Feature
Priority
Normal
Assignee
Issue Votes (0)
Watchers (3)
Reference
onedev/server#556
Please wait...
Page is in error, reload to recover