fix(jira): issue view filter
This commit is contained in:
parent
9eaf37e5e0
commit
698e036354
@ -7,13 +7,13 @@
|
|||||||
|
|
||||||
var global = {};
|
var global = {};
|
||||||
global.version = "4.4.0";
|
global.version = "4.4.0";
|
||||||
global.issueTrackingUrl = "https://github.com/qoomon/Jira-Issue-Card-Printer";
|
global.issueTrackingUrl = "github.com/qoomon/Jira-Issue-Card-Printer";
|
||||||
|
|
||||||
global.isDev = document.currentScript == null;
|
global.isDev = document.currentScript == null;
|
||||||
|
|
||||||
// enforce jQuery
|
// enforce jQuery
|
||||||
if (typeof jQuery == 'undefined') {
|
if (typeof jQuery == 'undefined') {
|
||||||
alert("jQuery is required!\n\nPlease create an issue at " + global.issueTrackingUrl);
|
alert("jQuery is required!\n\nPlease create an issue at\n" + global.issueTrackingUrl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var $ = jQuery;
|
var $ = jQuery;
|
||||||
@ -51,7 +51,7 @@
|
|||||||
console.log("App: " + "YouTrack");
|
console.log("App: " + "YouTrack");
|
||||||
global.appFunctions = youTrackFunctions;
|
global.appFunctions = youTrackFunctions;
|
||||||
} else {
|
} else {
|
||||||
alert("Unsupported app. Please create an issue at " + global.issueTrackingUrl);
|
alert("Unsupported app. Please create an issue at\n" + global.issueTrackingUrl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,10 +137,23 @@
|
|||||||
return Promise.all(promises);
|
return Promise.all(promises);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function error2object(value) {
|
||||||
|
if (value instanceof Error) {
|
||||||
|
var error = {};
|
||||||
|
Object.getOwnPropertyNames(value).forEach(function (key) {
|
||||||
|
error[key] = value[key];
|
||||||
|
});
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
function handleError(error){
|
function handleError(error){
|
||||||
console.log("ERROR " + error.stack);
|
error = error2object(error);
|
||||||
|
var error = JSON.stringify(error,2,2);
|
||||||
|
console.log("ERROR " + error);
|
||||||
ga('send', 'exception', { 'exDescription': error.message,'exFatal': true });
|
ga('send', 'exception', { 'exDescription': error.message,'exFatal': true });
|
||||||
alert("Sorry something went wrong.\n\n" + error.message +"\n\nPlease create an issue at " + global.issueTrackingUrl + "\n\n" + error.stack);
|
alert("Sorry something went wrong\n\nPlease create an issue with following details at\n" + global.issueTrackingUrl + "\n\n" + error);
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveSettings(){
|
function saveSettings(){
|
||||||
@ -207,6 +220,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function renderCards(issueKeyList) {
|
function renderCards(issueKeyList) {
|
||||||
|
console.log("issueKeyList: " + JSON.stringify(issueKeyList,2,2));
|
||||||
var promises = [];
|
var promises = [];
|
||||||
|
|
||||||
var printFrameDocument = global.printFrame.document;
|
var printFrameDocument = global.printFrame.document;
|
||||||
@ -227,8 +241,9 @@
|
|||||||
card.find('.issue-id').text(issueKey);
|
card.find('.issue-id').text(issueKey);
|
||||||
$("body", printFrameDocument).append(card);
|
$("body", printFrameDocument).append(card);
|
||||||
|
|
||||||
|
console.log("issueKey: " + JSON.stringify(issueKey,2,2));
|
||||||
promises.push(global.appFunctions.getCardData(issueKey).then(function(cardData) {
|
promises.push(global.appFunctions.getCardData(issueKey).then(function(cardData) {
|
||||||
console.log("cardData: " + JSON.stringify(cardData,2,2));
|
// console.log("cardData: " + JSON.stringify(cardData,2,2));
|
||||||
ga('send', 'event', 'card', 'generate', cardData.type);
|
ga('send', 'event', 'card', 'generate', cardData.type);
|
||||||
fillCard(card, cardData);
|
fillCard(card, cardData);
|
||||||
redrawCards();
|
redrawCards();
|
||||||
@ -717,28 +732,10 @@
|
|||||||
module.getSelectedIssueKeyList = function() {
|
module.getSelectedIssueKeyList = function() {
|
||||||
|
|
||||||
//Issues
|
//Issues
|
||||||
if (/.*\/issues\/\?jql=.*/g.test(document.URL)) {
|
if (/.*\/issues\/.*/g.test(document.URL)) {
|
||||||
var jql = document.URL.replace(/.*\?jql=(.*)/, '$1');
|
return $('tr[data-issuekey]').map(function() {
|
||||||
var jqlIssues = [];
|
return $(this).attr('data-issuekey');
|
||||||
var url = '/rest/api/2/search?jql=' + jql + "&maxResults=500&fields=key";
|
|
||||||
console.log("IssueUrl: " + url);
|
|
||||||
//console.log("Issue: " + issueKey + " Loading...");
|
|
||||||
$.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: url,
|
|
||||||
data: {},
|
|
||||||
dataType: 'json',
|
|
||||||
async: false,
|
|
||||||
success: function(responseData) {
|
|
||||||
console.log("responseData: " + responseData.issues);
|
|
||||||
|
|
||||||
$.each(responseData.issues, function(key, value) {
|
|
||||||
jqlIssues.push(value.key);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
console.log("jqlIssues: " + jqlIssues);
|
|
||||||
return jqlIssues;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Browse
|
//Browse
|
||||||
@ -764,6 +761,7 @@
|
|||||||
module.getCardData = function(issueKey) {
|
module.getCardData = function(issueKey) {
|
||||||
var promises = [];
|
var promises = [];
|
||||||
var issueData = {};
|
var issueData = {};
|
||||||
|
console.log("getCardData: " + JSON.stringify(issueKey,2,2));
|
||||||
|
|
||||||
promises.push(module.getIssueData(issueKey).then(function(data) {
|
promises.push(module.getIssueData(issueKey).then(function(data) {
|
||||||
var promises = [];
|
var promises = [];
|
||||||
@ -818,12 +816,11 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
module.getIssueData = function(issueKey) {
|
module.getIssueData = function(issueKey) {
|
||||||
|
console.log("getIssueData: " + JSON.stringify(issueKey,2,2));
|
||||||
//https://docs.atlassian.com/jira/REST/latest/
|
//https://docs.atlassian.com/jira/REST/latest/
|
||||||
var url = '/rest/api/2/issue/' + issueKey + '?expand=renderedFields,names';
|
var url = '/rest/api/2/issue/' + issueKey + '?expand=renderedFields,names';
|
||||||
console.log("IssueUrl: " + url);
|
console.log("IssueUrl: " + url);
|
||||||
//console.log("Issue: " + issueKey + " Loading...");
|
//console.log("Issue: " + issueKey + " Loading...");
|
||||||
|
|
||||||
|
|
||||||
return httpGetJSON(url).then(function(responseData) {
|
return httpGetJSON(url).then(function(responseData) {
|
||||||
//console.log("Issue: " + issueKey + " Loaded!");
|
//console.log("Issue: " + issueKey + " Loaded!");
|
||||||
// add custom fields with field names
|
// add custom fields with field names
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user