blob: 8b15ef8594c1a5a1ee0dc3d4097615fda1675b90 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
var BUGZILLA_URL = 'https://bugs.gentoo.org';
$( "#bugs" ).on('textInput input', refreshBugs);
function refreshBugs(){
$("#bug-refresh-ok").hide();
$("#bug-refresh-failed").hide();
$("#bug-spinner").show();
var bugIds = $("#bugs").val();
console.log(BUGZILLA_URL + "/rest/bug?id=" + bugIds);
// validate data
var valid = true;
bugIds.split(",").forEach(function(bugID) {
if( bugIds == "" || isNaN(bugID) || !(bugID.length == 0 || bugID.length == 6 || bugID.length == 7) ){
$( "#bug-spinner" ).hide();
$( "#bug-refresh-failed" ).show();
valid = false;
}
});
if(valid){
$.getJSON( BUGZILLA_URL + "/rest/bug?id=" + bugIds, function( data ) {
if(data.bugs.length != bugIds.split(",").length){
$( "#bug-spinner" ).hide();
$( "#bug-refresh-failed" ).show();
return
}
bugReady = true;
title = "";
data.bugs.forEach(function(bug) {
title = title == "" ? bug.summary : title;
bugReady = bugReady && bug.whiteboard.includes("[glsa");
});
if(bugReady){
$(".badge-notbugready").hide();
$(".badge-bugready").show();
} else {
$(".badge-bugready").hide();
$(".badge-notbugready").show();
}
if($("#title").val() == ""){
$("#title").val(title);
}
$("#bug-spinner").hide();
$("#bug-refresh-ok").show();
});
}
}
|