-
-
Save myalcin81/aaca0820c8fdcc7cf7cf336ac82ad3ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
const copyToClipboard = str => { | |
const el = document.createElement('textarea'); | |
el.value = str; | |
el.setAttribute('readonly', ''); | |
el.style.position = 'absolute'; | |
el.style.left = '-9999px'; | |
document.body.appendChild(el); | |
el.select(); | |
document.execCommand('copy'); | |
document.body.removeChild(el); | |
}; | |
var mapTypes = { | |
'Security Research' : 'Research', | |
'Pentest' : 'Pentest', | |
'Security Feature Test' : 'Feature Test', | |
'Refactoring' : 'Refactoring', | |
'Epic' : 'Epic', | |
'Story' : 'Story', | |
'Bug' : 'Bug', | |
'Task' : 'Task', | |
'Security Task' : 'Security Task', | |
}; | |
String.prototype.findType = function(){ | |
var bMapped=false; | |
var item=this.toString(); | |
Object.keys(mapTypes).forEach(function(key){if(item==key){item=mapTypes[key];bMapped=true;}else{}}); | |
return (bMapped)?item:item+'/notmapped'; | |
} | |
var sprintIndex=0; | |
var report = ''; | |
var sprintMain = $('.ghx-sprint-group .ghx-backlog-container:eq('+sprintIndex+')'); | |
var sprintNo = sprintMain.find('.ghx-name').text().replace(/[^0-9]+|\s+/gmi, ""); | |
console.log("getting sprint sprintIndex:"+sprintIndex); | |
console.log("if there is more than 1 sprint, this index will help to identify right one.If it's not right, pls change to right index"); | |
console.log("getting sprint no:"+sprintNo); | |
var tasks = sprintMain.find('.ghx-issues').first().find('.js-issue'); | |
var rows = []; | |
tasks.each(function(i, o) { | |
var task = $(o); | |
var key = task.attr('data-issue-key'); | |
var keyId = key.split("-")[1]; | |
//console.log(keyId); | |
var type = task.find('.ghx-type').attr('title').toString().findType(); | |
var summary = task.find('.ghx-summary > .ghx-inner').text(); | |
var points = task.find('span[title="Story Points"]').text().replace(",","."); | |
var assignee = task.find('.ghx-avatar-img').attr('alt').replace('Assignee: ', ''); | |
var storyLink = `=HYPERLINK("https://invicti.atlassian.net/browse/${key}", "${key}")`; | |
rows[keyId] = sprintNo + '\t' + summary + '\t' + type + '\t' + storyLink + '\t' + assignee + '\t' + points + '\n'; | |
//report += row; | |
}); | |
rows=rows.filter(n => n); | |
console.log(rows.length+" issue fetched."); | |
for (let i=0; i<rows.length; i++) { | |
report += rows[i]; | |
} | |
summary="",type="",storyLink="",assignee="",points=""; | |
var emptyRow = sprintNo + '\t' + summary + '\t' + type + '\t' + storyLink + '\t' + assignee + '\t' + points + '\n'; | |
report += emptyRow; | |
copyToClipboard(report); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment