Skip to content

Instantly share code, notes, and snippets.

Chuiko Aleksandr chuikoaleksandr

  • @Mail.Ru
  • Russia
View GitHub Profile
@chuikoaleksandr
chuikoaleksandr / Jira-JsIncluder-example-set fixVersion.js
Last active Jan 11, 2019
Atlasteam, Jira, plugin JsIncluder. Set fixVersion. For https://atlasteam.ru/?p=1925
View Jira-JsIncluder-example-set fixVersion.js
function setFixVersion(version) {
var val = AJS.$("#fixVersions").val();
val = val ? val : [];
val.push(version.id);
AJS.$("#fixVersions").val(val);
AJS.$("#fixVersions-textarea").val(version.name).blur();
}
var versions = [
{
View Jira-JsIncluder-example-set component.js
function setComponent(component) {
var val = AJS.$("#components").val();
val = val ? val : []
val.push(component.id)
AJS.$("#components").val(val);
AJS.$("#components-textarea").val(component.name).blur();
}
var components = [
{
View Jira-JsIncluder-example-set select value.js
//select
AJS.$('#customfield_10001').val(10002)
//multiselect
AJS.$('#customfield_10000').val([10000, 10001])
//cascade select
AJS.$('#customfield_10002').val(10004).change()
AJS.$('#customfield_10002\\:1').val('10005')
View Jira-JsIncluder-example-set assignee.js
(function ($) {
setAssignee('admin');
function setAssignee(name) {
var setValue = name;
var $field = $("#assignee");
$.get(AJS.params.baseURL + "/rest/api/latest/user", {
username: setValue
}, function (data) {
$("#assignee-single-select").remove();
View Jira-JsIncluder-example-remove resolution.js
AJS.$('#resolution > option[value=10000]').remove()
View Jira-JsIncluder-example-add required.groovy
import com.atlassian.jira.component.ComponentAccessor
import com.opensymphony.workflow.InvalidInputException
def getCustomFieldValue(issue, Long fieldId) {
issue.getCustomFieldValue(ComponentAccessor.customFieldManager.getCustomFieldObject(fieldId))
}
if (!getCustomFieldValue(issue, 10000)) {
throw new InvalidInputException("Please indicate the reason for the increased priority")
}
@chuikoaleksandr
chuikoaleksandr / Jira-JsIncluder-example-add required.js
Created Jan 11, 2019
Atlasteam, Jira, plugin JsIncluder. Add field is required. For https://atlasteam.ru/?p=1925
View Jira-JsIncluder-example-add required.js
AJS.$('#customfield_10000, label[for="customfield_10000"]').append('<span class="aui-icon icon-required"></span>');
@chuikoaleksandr
chuikoaleksandr / Jira-JsIncluder-example-hide priority.js
Created Jan 11, 2019
Atlasteam, Jira, plugin JsIncluder. Hide priority option on create. For https://atlasteam.ru/?p=1925
View Jira-JsIncluder-example-hide priority.js
AJS.$('#priority > option[value=1]').remove()
View Jira-JsIncluder-example-hide issue type.groovy
import com.opensymphony.workflow.InvalidInputException
if (issue.type.id in [10000]) {
throw new InvalidInputException("Not valid issue type")
}
@chuikoaleksandr
chuikoaleksandr / Jira-JsIncluder-example-hide issue type.js
Created Jan 11, 2019
Atlasteam, Jira, plugin JsIncluder. Hide issue type on create. For https://atlasteam.ru/?p=1925
View Jira-JsIncluder-example-hide issue type.js
function hideIssueType(issueTypeName) {
var elem = "<style type=\"text/css\">#issuetype-suggestions .aui-list-item-li-" + issueTypeName + " {display: none}</style>";
AJS.$("head").append(elem);
}
hideIssueType('application')
You can’t perform that action at this time.