Now I need a selection list with search input, but I can't find the right class for it.
import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate
import com.atlassian.jira.component.ComponentAccessor;
import groovy.transform.BaseScript
import groovy.xml.MarkupBuilder
import com.atlassian.jira.config.util.JiraHome
import javax.ws.rs.core.MediaType
import javax.ws.rs.core.MultivaluedMap
import javax.ws.rs.core.Response
@BaseScript CustomEndpointDelegate delegate
static String getDialogContent(String issueKey) {
def jiraHome = ComponentAccessor.getComponent(JiraHome).home
def xmlWriter = new StringWriter()
def xml = new MarkupBuilder(xmlWriter)
xml.secion(role: 'dialog', id: 'sr-dialog', class: 'aui-layer aui-dialog2 aui-dialog2-medium', 'data-aui-remove-on-hide': 'true') {
header(class: 'aui-dialog2-header') {
h2(class: 'aui0dialog-2-header-main') { xml.mkp.yield('Edit cost units') }
button(class: 'aui-close-button', type: 'button arial-label', ' aria-label':'close')
}
div(class: "aui-dialog2-content") {
div(id: "Container", style: "width:px") {
form(class: "aui") {
// Error Message.
div(id: "errormsg", class: "aui-message aui-message-error", style: "display: none") {
p() { xml.mkp.yield 'Custom error message.' }
}
label () { xml.mkp.yield 'What would you like to do?' }
div(id: "checkbox", class: "field-group") {
div(id:"radiobtn", style: "margin-top: 5px") {
input(id: "OptionWrongRequestType", type: "radio", name: "flag", value: "option1", checked: "true")
label (for: "OptionWrongRequestType") { xml.mkp.yield 'Wrong topic / enquiry type' }
br()
input(id: "OptionWrongTeam", type: "radio", name: "flag", value: "option2")
label (for: "OptionWrongTeam") { xml.mkp.yield 'Right topic, but another team still needs to work on it.' }
br()
input(id: "OptionWrongAssignee", type: "radio", name: "flag", value: "option3")
label (for: "OptionWrongAssignee") { xml.mkp.yield 'Another member of my team has to take over.' }
}
}
label() { xml.mkp.yield 'Wrong topic / enquiry type' }
div(id:"selectionOption1", class: "field-group") {
select(id: "selectProject", class: "select", name: "select-P") {
option(value: "IT Helpdesk 1") {xml.mkp.yield("IT Helpdesk 1")}
option(value: "IT Helpdesk 2") {xml.mkp.yield("IT Helpdesk 2")}
option(value: "IT APP") {xml.mkp.yield("IT APP")}
}
select(id: "selectRequestGroup", class: "select", style: "margin-top: 8px;", name: "selectRequestGroup") {
option(value: "Request Group 1") {xml.mkp.yield("Request Group 1")}
option(value: "Request Group 2") {xml.mkp.yield("Request Group 2")}
option(value: "Request Group 3") {xml.mkp.yield("Request Group 3")}
}
select(id: "selectRequestName", class: "select", style: "margin-top: 8px;", name: "selectRequestName") {
option(value: "Request Name 1") {xml.mkp.yield("Request Name 1")}
option(value: "Request Name 2") {xml.mkp.yield("Request Name 2")}
option(value: "Request Name 3") {xml.mkp.yield("Request Name 3")}
}
}
div(id: "Commentfield", class: "field-group") {
label (for: "CommentfieldLabel") { xml.mkp.yield 'Comment' }
textarea(id: "CommentfieldInput", class: "text", name: "CommentfieldInput", rows: "4", cols:"50", resize: "none")
}
} // </form>
}
}
footer(class: "aui-dialog2-footer") {
div(class: "aui-dialog2-footer-actions") {
button(id: "submit", class: "aui-button aui-button-primary") { xml.mkp.yield('Submit') }
button(id: "dialog-close-button", class: "aui-button aui-button-link") { xml.mkp.yield('Close') }
}
}
// Javascript
/**script(type:'text/javascript') {
def scriptFile = new File("$jiraHome/scripts/Javascript/customDialog.js")
xml.mkp.yieldUnescaped( scriptFile.getText('UTF-8'))
}*/
}
return xmlWriter.toString()
}
itsmForwardFunction(httpMethod: "GET", groups: ["jira-administrators"]) { MultivaluedMap queryParams ->
def issueKey = queryParams.getFirst("issueId") as String
String dialog = getDialogContent(issueKey);
Response.ok().type(MediaType.TEXT_HTML).entity(dialog).build()
}
To create the select list im using the class: "select" as you can see:
select(id: "selectProject", class: "select", name: "select-P") {... }I tried something similar like "aui-select2" or "select2" from https://aui.atlassian.com/aui/latest/docs/auiselect2.html but nothing seems to work.
Did i miss something?
I hope you can help me.
Thx and greetings