blob: 5fd9cba90d2cb03bc2a1669a8484078a62d9f63f [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Apache Ignite Teamcity Bot - Muted tests</title>
<link rel="icon" href="img/leaf-icon-png-7066.png">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<link rel="stylesheet" href="css/style-1.5.css">
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="js/common-1.6.js"></script>
<script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.js"></script>
<script src="https://cdn.datatables.net/1.10.16/js/dataTables.jqueryui.js"></script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css">
<script>
function showErrInLoadStatus(jqXHR, exception) {
if (jqXHR.status === 0) {
$("#loadStatus").html('Not connect.\n Verify Network.');
} else if (jqXHR.status === 404) {
$("#loadStatus").html('Requested page not found. [404]');
} else if (jqXHR.status === 401) {
$("#loadStatus").html('Unauthorized [401]');
setTimeout(function() {
window.location.href = "/login.html" + "?backref=" + encodeURIComponent(window.location.href);
}, 1000);
} else if (jqXHR.status === 403) {
$("#loadStatus").html('Forbidden [403]');
} else if( jqXHR.status === 418) {
$("#loadStatus").html('Services are starting [418], I\'m a teapot');
} else if (jqXHR.status === 424) {
$("#loadStatus").html('Dependency problem: [424]: ' + jqXHR.responseText);
} else if (jqXHR.status === 500) {
$("#loadStatus").html('Internal Server Error [500].');
} else if (exception === 'parsererror') {
$("#loadStatus").html('Requested JSON parse failed.');
} else if (exception === 'timeout') {
$("#loadStatus").html('Time out error.');
} else if (exception === 'abort') {
$("#loadStatus").html('Ajax request aborted.');
} else {
$("#loadStatus").html('Uncaught Error.\n' + jqXHR.responseText);
}
}
$(document).ready(function() {
loadData();
$.ajax({ url: "rest/branches/version", success: showVersionInfo, error: showErrInLoadStatus });
});
function loadData() {
$.ajax({
url: "rest/tracked/mutes?serverId=apache",
success: function (result) {
showTable(result);
},
error: showErrInLoadStatus
}
);
}
function showTable(result) {
// Debug info
// if (isDefinedAndFilled(result)) {
// result.sort((a, b) => (a.id < b.id) ? -1 : ((a.id > b.id) ? 1 : 0));
// console.log(result);
// }
let mutes = separateMutedTests(result);
let table = $('#table');
let testNameMatcher = new RegExp("\\.(\\w+\\d*):.*\\.([a-z][$\\w]+\\w+\\d*)");
let testNameMatcher2 = new RegExp("(\\w+\.Test\\w+\\d*)$");
let suiteNameMatcher2 = new RegExp("(.*):");
let ticketMatcher = new RegExp("https:\\/\\/issues.apache.org\\/jira\\/browse\\/(IGNITE-\\d+)");
table.dataTable().fnDestroy();
table.DataTable({
data: mutes,
"iDisplayLength": 30, //rows to be shown by default
"order": [[ 0, 'asc' ], [ 1, 'asc' ]],
stateSave: true,
columnDefs: [
{
targets: '_all',
className: 'dt-body-center'
},
],
columns: [
{
title: "Suite",
"data": function (data, type, row, meta) {
var name = data.target.test[0].name;
var match = testNameMatcher.exec(name);
var res = "";
if (isDefinedAndFilled(match))
res = match[1];
else {
match = suiteNameMatcher2.exec(name);
if (isDefinedAndFilled(match))
res = match[1];
else
res = "Can't parse suite - report to devs";
}
return "<span title='" + name + "'>" + res + "</span>";
}
},
{
title: "Test",
"data": function (data, type, row, meta) {
var name = data.target.test[0].name;
var match = testNameMatcher.exec(name);
var res = "";
if (isDefinedAndFilled(match))
res = match[2];
else {
match = testNameMatcher2.exec(name);
if (isDefinedAndFilled(match))
res = match[1];
else
res = name;
}
return "<span title='" + name + "'>" + res + "</span>";
}
},
{
title: "Mute",
width: 60,
"data": function (data) {
if (isDefinedAndFilled(data.target.test)) {
var testId = data.target.test[0].id;
var projectId = null;
if (data.scope.project)
projectId = data.scope.project.id;
else if (isDefinedAndFilled(data.scope.buildType) && data.scope.buildType.length > 0)
projectId = data.scope.buildType[0].projectId;
if (isDefinedAndFilled(testId) && isDefinedAndFilled(projectId)) {
return "<a href='https://ci.ignite.apache.org/project.html?projectId="
+ projectId + "&testNameId=" + testId + "&tab=testDetails' target='_blank'>"
+ data.id + "</a>"
}
}
return data.id;
}
},
{
title: "Ticket",
width: 100,
"data": function (data, type, row, meta) {
var ticket = ticketMatcher.exec(data.assignment.text);
if (!isDefinedAndFilled(ticket))
return "";
return "<a href='" + ticket[0] + "' title='" + ticket[0] + "' target='_blank'>"
+ ticket[1] + "</a>";
}
},
{
title: "Status",
width: 50,
"data": function (data, type, row, meta) {
return data.ticketStatus;
}
},
{
title: "Mute Date",
"data": function (data, type, row, meta) {
return data.assignment.timestamp;
}
},
{
title: "Project",
"data": function (data, type, row, meta) {
if (data.scope.project)
return data.scope.project.name;
if (isDefinedAndFilled(data.scope.buildType) && data.scope.buildType.length > 0)
return data.scope.buildType[0].projectName;
return "";
}
}
]
});
}
function separateMutedTests(result) {
let mutes = [];
for (let mute of result) {
if (!isDefinedAndFilled(mute.target.test) || mute.target.test.length === 1) {
mutes.push(mute);
continue;
}
for (let t of mute.target.test) {
let separateTest = {
id: mute.id,
assignment: mute.assignment,
scope: mute.scope,
ticketStatus: mute.ticketStatus
};
separateTest.target = {test: [t]};
mutes.push(separateTest);
}
}
return mutes;
}
</script>
</head>
<body>
<br>
<div id="loadStatus"></div>
<br>
<table id="table" class="row-border" style="width:100%">
<thead>
<tr class="ui-widget-header ">
<th>.</th>
<th>.</th>
<th>.</th>
<th>.</th>
<th>.</th>
<th>.</th>
<th>.</th>
</tr>
</thead>
</table>
<br>
<div id="version"></div>
</body>
</html>