I am using the following code to show table in Jira. You can notice that the text is not centered. For example, the cross and the checkmark are not centered. How can I make them centered? Here is my code below:
package SuperFeature
import com.atlassian.jira.issue.Issue
import org.apache.log4j.Logger
import com.atlassian.jira.project.version.Version
import com.atlassian.jira.bc.project.component.ProjectComponent
import com.atlassian.jira.bc.project.component.ProjectComponentManager
import com.atlassian.jira.security.JiraAuthenticationContext
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.label.LabelManager
import SuperFeature.Configuration_SuperFeature
def log = Logger.getLogger('atlassian-jira.log')
List < String > componentList = new ArrayList < String > ()
if (issue.getComponents().size() == 0) {
issue.update {
String text = "*(x){color:red} Sub issue features cannot be generated given that the super feature "+issue+" has 0 components.{color}*\n"+
"(on) *If you want to generate sub features, you should specify at least 1 component for the super feature "+issue+" and retry.* "
setCustomFieldValue('Execution Summary', text )
}
} else if (issue.getFixVersions().size() == 0) {
issue.update {
String text = "Issue does not have any fix versions\n"
setCustomFieldValue('Execution Summary', text)
}
} else {
int componentSize = issue.getComponents().size()
int generatedIssuesCounter= 0
int nonGeneratedIssuesCounter= 0
componentList.add("||COMPONENT NAME||EXECUTION INFORMATION||EXPLANATION||")
for (ProjectComponent component: issue.getComponents()) {
String componentName = component.getName()
if (!componentName.contains("-") || componentName.startsWith("-")) {
componentList.add("|*"+componentName+"*| (x) |A valid component should be under the form *PROJ-COMP* "+
"where *PROJ* is the project name and *COMP* is an existing component name within *PROJ*.|")
nonGeneratedIssuesCounter++
} else{
def shortenedComponentName = componentName.substring(componentName.indexOf("-") + 1)
def projectName = componentName.substring(0, componentName.indexOf("-"))
if(Configuration_SuperFeature.projectNames.contains(projectName)){
def newIssueproject = ComponentAccessor.projectManager.getProjectObjByKey(projectName)
List < ProjectComponent > newList = new ArrayList < > (newIssueproject.getComponents());
def found = newList.any {
it.getName().equals(shortenedComponentName)
}
if (found) {
componentList.add("|*"+componentName+"* | (/) |"+" "+"|")
generatedIssuesCounter++
} else{
componentList.add("|*"+componentName+"* | (x) | The component *" +shortenedComponentName+ "* is not present within the project *"+projectName+"*.|")
nonGeneratedIssuesCounter++
}
}
}
}
issue.update {
String text = " *The super feature* " + issue + " *will be split as follows:*\n"+
"* (/) " + generatedIssuesCounter + " sub feature(s) will be generated - 1 sub feature for each component.\n"+
"* (x) "+nonGeneratedIssuesCounter+" sub feature(s) cannot be generated.\n"+
" (on) More detailed information is displayed below: \n"
text = text + componentList.join("\n") ;
setCustomFieldValue('Execution Summary', text)
}
}
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.