2007-07-27 15:33:09 -07:00
|
|
|
var updateFunction;
|
2007-07-27 16:21:32 -07:00
|
|
|
var handleCancel;
|
|
|
|
var sTestrunsWrapper; // an array of things that are kind of like testruns, but w/o important fields.
|
2007-07-27 15:33:09 -07:00
|
|
|
//returned by "test_runs_by_branch_product_name="
|
2007-07-27 16:21:32 -07:00
|
|
|
|
2007-07-27 15:33:09 -07:00
|
|
|
var sTestrun; // actual testrun
|
2007-07-27 16:21:32 -07:00
|
|
|
var sTestgroup;
|
2007-07-27 15:33:09 -07:00
|
|
|
function handleLoad() {
|
2007-07-27 16:21:32 -07:00
|
|
|
|
|
|
|
if (window.arguments.length > 0) {
|
2007-07-27 15:33:09 -07:00
|
|
|
updateFunction = window.arguments[0]; // parent window passes in a function to update itself with data
|
2007-07-27 16:21:32 -07:00
|
|
|
handleCancel = window.arguments[1]; // parent window passes in a function to restore state if dialog canceled
|
|
|
|
}
|
2007-07-27 15:33:09 -07:00
|
|
|
litmus.getTestruns(populateTestRuns);
|
|
|
|
}
|
2007-07-27 16:21:32 -07:00
|
|
|
|
2007-07-27 15:33:09 -07:00
|
|
|
function handleRunSelect() {
|
|
|
|
var id = document.getElementById("qa-st-testrun").selectedItem.getAttribute("value");
|
|
|
|
litmus.getTestrun(id, populateTestGroups);
|
|
|
|
}
|
2007-07-27 16:21:32 -07:00
|
|
|
|
2007-07-27 15:33:09 -07:00
|
|
|
function handleTestgroupSelect() {
|
|
|
|
var id = document.getElementById("qa-st-testgroup").selectedItem.value;
|
|
|
|
litmus.getTestgroup(id, populateSubgroups);
|
|
|
|
}
|
2007-07-27 16:21:32 -07:00
|
|
|
|
2007-07-27 15:33:09 -07:00
|
|
|
function handleSubgroupSelect() {
|
|
|
|
var id = document.getElementById("qa-st-subgroup").selectedItem.value;
|
2007-07-27 16:21:32 -07:00
|
|
|
updateCaller(sTestrun.name, sTestgroup.name, id, 0);
|
2007-07-27 15:33:09 -07:00
|
|
|
}
|
2007-07-27 16:21:32 -07:00
|
|
|
|
2007-07-27 15:33:09 -07:00
|
|
|
function populateTestRuns(testrunsWrapper) {
|
|
|
|
var menu = document.getElementById("qa-st-testrun");
|
|
|
|
testrunsWrapper = qaTools.arrayify(testrunsWrapper);
|
|
|
|
sTestrunsWrapper = testrunsWrapper;
|
2007-07-27 16:21:32 -07:00
|
|
|
|
2007-07-27 15:33:09 -07:00
|
|
|
while (menu.firstChild) { // clear menu
|
|
|
|
menu.removeChild(menu.firstChild);
|
|
|
|
}
|
2007-07-27 16:21:32 -07:00
|
|
|
|
2007-07-27 15:33:09 -07:00
|
|
|
for (var i = 0; i < testrunsWrapper.length; i++) {
|
|
|
|
if (testrunsWrapper[i].enabled == 0) continue;
|
|
|
|
var item = menu.appendItem(testrunsWrapper[i].name, testrunsWrapper[i].test_run_id);
|
|
|
|
}
|
|
|
|
menu.selectedIndex = 0;
|
|
|
|
handleRunSelect();
|
|
|
|
}
|
2007-07-27 16:21:32 -07:00
|
|
|
|
2007-07-27 15:33:09 -07:00
|
|
|
function populateTestGroups(testrun) {
|
2007-07-27 16:21:32 -07:00
|
|
|
sTestrun = testrun;
|
2007-07-27 15:33:09 -07:00
|
|
|
var menu = document.getElementById("qa-st-testgroup");
|
|
|
|
while (menu.firstChild) { // clear menu
|
|
|
|
menu.removeChild(menu.firstChild);
|
|
|
|
}
|
2007-07-27 16:21:32 -07:00
|
|
|
|
2007-07-27 15:33:09 -07:00
|
|
|
var testgroups = qaTools.arrayify(testrun.testgroups);
|
|
|
|
for (var i = 0; i < testgroups.length; i++) {
|
|
|
|
if (testgroups[i].enabled == 0) continue;
|
|
|
|
menu.appendItem(testgroups[i].name, testgroups[i].testgroup_id);
|
|
|
|
}
|
|
|
|
menu.selectedIndex = 0;
|
|
|
|
}
|
2007-07-27 16:21:32 -07:00
|
|
|
|
2007-07-27 15:33:09 -07:00
|
|
|
function populateSubgroups(testgroup) {
|
2007-07-27 16:21:32 -07:00
|
|
|
sTestgroup = testgroup;
|
2007-07-27 15:33:09 -07:00
|
|
|
var menu = document.getElementById("qa-st-subgroup");
|
|
|
|
while (menu.firstChild) { // clear menu
|
|
|
|
menu.removeChild(menu.firstChild);
|
|
|
|
}
|
|
|
|
var subgroups = qaTools.arrayify(testgroup.subgroups);
|
2007-07-27 16:21:32 -07:00
|
|
|
|
2007-07-27 15:33:09 -07:00
|
|
|
for (var i = 0; i < subgroups.length; i++) {
|
|
|
|
if (subgroups[i].enabled == 0) continue;
|
|
|
|
menu.appendItem(subgroups[i].name, subgroups[i].subgroup_id);
|
|
|
|
}
|
|
|
|
menu.selectedIndex = 0;
|
|
|
|
}
|
2007-07-27 16:21:32 -07:00
|
|
|
|
2007-07-27 15:33:09 -07:00
|
|
|
function OK() {
|
|
|
|
return true;
|
|
|
|
}
|
2007-07-27 16:21:32 -07:00
|
|
|
|
|
|
|
function updateCaller(testrunSummary, testgroupSummary, subgroupID, index) {
|
|
|
|
litmus.writeStateToPref(testrunSummary, testgroupSummary, subgroupID, index);
|
2007-07-27 15:33:09 -07:00
|
|
|
updateFunction();
|
|
|
|
}
|
2007-07-27 16:21:32 -07:00
|
|
|
|
2007-07-27 15:33:09 -07:00
|
|
|
function Cancel() {
|
2007-07-27 16:21:32 -07:00
|
|
|
handleCancel();
|
2007-07-27 15:33:09 -07:00
|
|
|
return true;
|
|
|
|
}
|