Created
August 1, 2017 16:02
-
-
Save kentfredric/50ab839757e371b04fddc1a358ce3ac1 to your computer and use it in GitHub Desktop.
Gentoo Bugzie GM hacks
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
// ==UserScript== | |
// @name Gentoo Perl Bugzilla Helpers | |
// @namespace http://gs.fox.geek.nz/1 | |
// @description Templated bugs | |
// @include https://bugs.gentoo.org/enter_bug.cgi?product=Gentoo%20Linux | |
// @require http://code.jquery.com/jquery.min.js | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
var add_button = function(row, name, callback) { | |
var button_node = document.createElement("a"); | |
$(button_node).text(name); | |
$(button_node).css({ border: "1px solid #666", padding: "2px" }); | |
$(row).append(button_node); | |
$(button_node).click(callback); | |
}; | |
var old_row = jQuery("textarea#comment").parents("tr"); | |
var new_row = document.createElement("tr"); | |
var head = document.createElement("th"); | |
var data = document.createElement("td"); | |
$(head).text("Templates:"); | |
$(data).attr({ colspan: 3 }); | |
$(new_row).append(head); | |
$(new_row).append(data); | |
$(new_row).insertBefore(old_row); | |
var trigger_node = function(node,etype) { | |
var e = new Event(etype, { "bubbles": true }); | |
/* var e = document.createEvent("HTMLEvents"); | |
e.initEvent(etype, true, true);*/ | |
jQuery(node).each(function(index, element){ | |
element[0].dispatchEvent(e); | |
}); | |
}; | |
var set_assignee = function(assignee) { | |
jQuery("#assigned_to").val(assignee); | |
}; | |
var set_component = function(component) { | |
set_assignee(""); | |
jQuery("#component").val(component); | |
trigger_node("#component", "change"); | |
}; | |
var set_summary = function(summary) { | |
jQuery("#short_desc").val(summary); | |
}; | |
var set_blockers = function(blockers) { | |
jQuery("input[name=blocked]").val(blockers); | |
}; | |
var set_keywords = function(keywords) { | |
jQuery("#keywords").val(keywords); | |
}; | |
var set_runtime_testing = function(value) { | |
jQuery("#cf_runtime_testing_required").val(value); | |
}; | |
add_button(data, "Perl @INC install failure", function() { | |
set_component("Current packages"); | |
set_assignee("[email protected]"); | |
set_summary("dev-perl/ fails install without '.' in @INC ()"); | |
set_blockers("612408, 621410"); | |
set_keywords(""); | |
}); | |
add_button(data, "Perl @INC test failure", function() { | |
set_component("Current packages"); | |
set_assignee("[email protected]"); | |
set_summary("dev-perl/ fails tests without '.' in @INC ()"); | |
set_blockers("612408"); | |
set_keywords("TESTFAILURE,"); | |
}); | |
add_button(data, "Perl 5.26 failure", function() { | |
set_component("Current packages"); | |
set_assignee("[email protected]"); | |
set_summary("dev-perl/ broken perl 5.26 ()"); | |
set_blockers("613764, 621410"); | |
set_keywords(""); | |
}); | |
add_button(data, "Perl 5.26 test failure", function() { | |
set_component("Current packages"); | |
set_assignee("[email protected]"); | |
set_summary("dev-perl/ fails tests on perl 5.26 ()"); | |
set_blockers("613764"); | |
set_keywords("TESTFAILURE,"); | |
}); | |
add_button(data, "Perl keywordreq", function() { | |
set_component("Keywording"); | |
set_assignee("[email protected]"); | |
set_summary("dev-perl/ keywording"); | |
set_blockers(""); | |
set_keywords("KEYWORDREQ,"); | |
set_runtime_testing("No"); | |
}); | |
add_button(data, "Perl stablereq", function() { | |
set_component("Stabilization"); | |
set_assignee("[email protected]"); | |
set_summary("dev-perl/ stabilization"); | |
set_blockers(""); | |
set_keywords("STABLEREQ,"); | |
set_runtime_testing("No"); | |
}); | |
add_button(data, "Perl test failure", function() { | |
set_component("Current packages"); | |
set_assignee("[email protected]"); | |
set_summary("dev-perl/ fails tests ()"); | |
set_keywords("TESTFAILURE,"); | |
}); | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment