Add a tool to find common landings between channels

This commit is contained in:
Marco Castelluccio 2017-01-17 13:23:46 +00:00
Родитель b7e5a6b542
Коммит 84a4643480
4 изменённых файлов: 91 добавлений и 0 удалений

20
common_landings.html Normal file
Просмотреть файл

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Find common landings between channels</title>
</head>
<body>
<script src="common_landings.js" type="text/javascript"></script>
<p>Insert one or more links like <code>https://hg.mozilla.org/releases/mozilla-beta/pushloghtml?fromchange=FIREFOX_51_0b13_RELEASE&tochange=FIREFOX_51_0b14_RELEASE</code></p>
<input type="text" name="pushloglink1" id="pushloglink1" size="140" placeholder="First pushlog link...">
<br>
<input type="text" name="pushloglink2" id="pushloglink2" size="140" placeholder="Second pushlog link...">
<br>
<input type="text" name="pushloglink3" id="pushloglink3" size="140" placeholder="Third pushlog link...">
<br><br>
<button id="getCommonLandings">Find common landings</button>
<br><br>
<span id="results"></span>
</body>
</html>

67
common_landings.js Normal file
Просмотреть файл

@ -0,0 +1,67 @@
let onLoad = new Promise(function(resolve, reject) {
window.onload = resolve;
});
function getCommonLandings() {
let pushlog_links = [];
for (let i = 1; i < 4; i++) {
let pushlog_link = document.getElementById('pushloglink' + i).value;
if (pushlog_link) {
pushlog_links.push(pushlog_link);
}
}
return Promise.all(
pushlog_links
.map(link =>
fetch(link)
.then(response => response.text())
.then(html => {
let bugs = [];
let result;
let re = /Bug ([0-9]+)/ig;
while ((result = re.exec(html)) !== null) {
bugs.push(result[1]);
}
return bugs;
})
)
)
.then(arrays => {
if (arrays.length === 0) {
return [];
}
return arrays[0]
.filter(elem => {
let is_everywhere = true;
for (let array of arrays.slice(1)) {
is_everywhere &= array.includes(elem);
}
return is_everywhere;
})
});
}
onLoad
.then(function() {
document.getElementById('getCommonLandings').onclick = function() {
getCommonLandings()
.then(bugs => {
if (bugs.length === 0) {
return 'None';
}
return bugs.join(', ');
})
.then(text => {
document.getElementById('results').textContent = text;
})
};
});

Двоичные данные
images/common_landings.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 61 KiB

Просмотреть файл

@ -31,8 +31,12 @@ td {
<tr>
<td><a href="buildid_changeset.html">Build ID <-> Changeset conversion</a></td>
<td><img src="images/buildid_changeset.png" alt="Build ID <-> Changeset conversion" width="192" height="16" /></td>
<td><a href="common_landings.html">Find common landings between channels</a></td>
<td><img src="images/common_landings.png" alt="Find common landings between channels" width="192" height="96" /></td>
<td><a href="addon_related_signatures.html">List of addon-related signatures</a></td>
<td><img src="images/addon_related_signatures.png" alt="List of addon-related signatures" width="192" height="96" /></td>
</tr>
<tr>
<td><a href="graphics_critical_errors.html">List of graphics critical errors</a></td>
<td><img src="images/graphics_critical_errors.png" alt="List of graphics critical errors" width="192" height="96" /></td>
</tr>