Include new sort
This commit is contained in:
@ -1,7 +1,13 @@
|
||||
var _apiUrl = null;
|
||||
|
||||
function compareFunction(a, b) {
|
||||
return b.PollValue.split('-')[0] - a.PollValue.split('-')[0] || a.Priority[0] - b.Priority[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
||||
if (a.RiskReductionMinusOpportunityEnablement === null || b.RiskReductionMinusOpportunityEnablement === null) {
|
||||
var aPollValue = a.PollValue.split('-');
|
||||
var bPollValue = b.PollValue.split('-');
|
||||
return bPollValue[0].trim() - aPollValue[0].trim() || b.State[0] - a.State[0] || bPollValue[bPollValue.length - 1].trim()[0] - aPollValue[aPollValue.length - 1].trim()[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
||||
} else {
|
||||
return b.RiskReductionMinusOpportunityEnablement - a.RiskReductionMinusOpportunityEnablement || b.State[0] - a.State[0] || b.ParentId - a.ParentId || a.Id - b.Id;
|
||||
}
|
||||
}
|
||||
|
||||
function showOne(rowData) {
|
||||
@ -151,12 +157,13 @@ function sendValue(element, page, id) {
|
||||
});
|
||||
}
|
||||
|
||||
function setWorkItems(workItems, page, description) {
|
||||
function setWorkItems(workItems, page, description, th) {
|
||||
var record;
|
||||
var html = "<tr><th>Parent Id</th><th>Parent Title</th><th>Id</th><th>Requester</th><th>Title</th><th>Assigned To</th><th>System(s)</th><th>State</th><th>Poll Value</th><th>Value</th><th>Up</th><th>Down</th></tr>";
|
||||
var html = "<tr><th>Parent Id</th><th>Parent Title</th><th>Id</th><th>Requester</th><th>Title</th><th>Assigned To</th><th>System(s)</th><th>State</th><th>Value</th><th>Up</th><th>Down</th><th>Poll Value</th><th>" + th + "</th></tr>";
|
||||
const element = document.getElementById("HeaderGrid");
|
||||
for (var i = 0; i < workItems.length; i++) {
|
||||
record = workItems[i];
|
||||
var length = record.RiskReductionMinusOpportunityEnablement === null ? "" : record.RiskReductionMinusOpportunityEnablement.toString().length;
|
||||
html += "<tr><td>" + '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + record.ParentId + '">' + record.ParentId + "</a>" +
|
||||
"</td><td>" + record.ParentTitle +
|
||||
"</td><td>" + '<a target="_blank" href="https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/' + record.Id + '">' + record.Id + "</a>" +
|
||||
@ -165,15 +172,18 @@ function setWorkItems(workItems, page, description) {
|
||||
"</td><td>" + record.AssignedTo +
|
||||
"</td><td>" + record.Tags +
|
||||
"</td><td>" + record.State +
|
||||
"</td><td>" + record.PollValue +
|
||||
"</td><td>" +
|
||||
'<select onchange="sendValue(this, \'' + page + '\', ' + record.Id + ')">' +
|
||||
'<option value="9">Unknown</option>' +
|
||||
'<option value="1">High (Most ' + description + ')</option>' +
|
||||
'<option value="2">Medium</option>' +
|
||||
'<option value="3">Low</option>' +
|
||||
'</select>' +
|
||||
"</td><td><a href='#' class='up'>Up</a></td><td><a href='#' class='down'>Down</a></td></tr>";
|
||||
"</select>" +
|
||||
"</td><td><a href='#' class='up'>Up</a>" +
|
||||
"</td><td><a href='#' class='down'>Down</a>" +
|
||||
"</td><td>" + record.PollValue +
|
||||
"</td><td>" + length + " - " + record.RiskReductionMinusOpportunityEnablement +
|
||||
"</td></tr>";
|
||||
}
|
||||
element.innerHTML = html.replaceAll(">null<", "> <");
|
||||
}
|
||||
@ -193,7 +203,7 @@ function updateSite() {
|
||||
}
|
||||
}
|
||||
|
||||
function initIndex(url, apiUrl, page, description, urlB) {
|
||||
function initIndex(url, apiUrl, page, description, th, urlB) {
|
||||
_apiUrl = apiUrl;
|
||||
updateSite();
|
||||
$.getJSON(urlB, { _: new Date().getTime() }, function (dataB) {
|
||||
@ -202,7 +212,7 @@ function initIndex(url, apiUrl, page, description, urlB) {
|
||||
console.log(data.length);
|
||||
if (data.length > 0)
|
||||
console.log(data[0]);
|
||||
setWorkItems(workItems, page, description);
|
||||
setWorkItems(workItems, page, description, th);
|
||||
$(".up,.down").click(function () {
|
||||
var row = $(this).parents("tr:first");
|
||||
if ($(this).is(".up")) {
|
||||
|
Reference in New Issue
Block a user