diff options
author | jasplin <qt-info@nokia.com> | 2010-05-07 15:05:10 +0200 |
---|---|---|
committer | jasplin <qt-info@nokia.com> | 2010-05-07 15:05:10 +0200 |
commit | c0c856290e3232dc0d6dd6e9a5a1c22e45d128e2 (patch) | |
tree | d5766a9e7b3d9d509677a0304e4b5f363f723b65 | |
parent | dc8c7e984827f9092e45471dde8663355ba306db (diff) |
Prepared 'ASF score card stats' feature.
-rw-r--r-- | src/bmweb/indexsection.js | 129 |
1 files changed, 107 insertions, 22 deletions
diff --git a/src/bmweb/indexsection.js b/src/bmweb/indexsection.js index 1947979..f07c635 100644 --- a/src/bmweb/indexsection.js +++ b/src/bmweb/indexsection.js @@ -21,6 +21,25 @@ ** ****************************************************************************/ +function getCheckedFilterValues(tableId) { + table = document.getElementById(tableId); + values = []; + rows = table.rows; + for (i = 0; i < rows.length; ++i) { + input = document.getElementById(tableId + ":" + i); + if (input.checked) + values[values.length] = rows[i].cells[1].innerHTML; + } + return values; +} + +function createFilterOptionsString(option, values) { + s = ""; + for (i = 0; i < values.length; ++i) + s += " " + option + " " + values[i]; + return s; +} + function updateComputeIndexLink(defaultBaseTime, defaultMedianWinSize) { // Initialize URL ... @@ -46,23 +65,6 @@ function updateComputeIndexLink(defaultBaseTime, defaultMedianWinSize) // Add filters ... - function getCheckedFilterValues(tableId) { - table = document.getElementById(tableId); - values = []; - rows = table.rows; - for (i = 0; i < rows.length; ++i) { - input = document.getElementById(tableId + ":" + i); - if (input.checked) - values[values.length] = rows[i].cells[1].innerHTML; - } - return values; - } - function createFilterOptionsString(option, values) { - s = ""; - for (i = 0; i < values.length; ++i) - s += " " + option + " " + values[i]; - return s; - } url += createFilterOptionsString("-testcase", getCheckedFilterValues("ixTestCaseFilter")); url += createFilterOptionsString("-metric", getCheckedFilterValues("ixMetricFilter")); url += createFilterOptionsString("-platform", getCheckedFilterValues("ixPlatformFilter")); @@ -80,7 +82,40 @@ function updateComputeIndexLink(defaultBaseTime, defaultMedianWinSize) // Update link ... link = document.getElementById("ixComputeIndexLink"); - link.setAttribute("href", url); + link.setAttribute("href", url) + + link.setAttribute("target", "_blank"); // prevent page from opening in same window +} + +function updateComputeASFStatsLink(defaultMedianWinSize) +{ + // Initialize URL ... + url = "http://" + location.host + "/cgi-bin/bmclientwrapper"; + url += "?command="; + url += "-server " + server(); + url += " asfstats get detailspage"; + url += " -stylesheet " + document.styleSheets[0].href; + + + // Add median window size ... + medianWinSize = getIntFromTextInput("ixMedianWinSize", defaultMedianWinSize); + document.getElementById("ixMedianWinSize").value = medianWinSize; + + url += " -medianwinsize " + medianWinSize; + + + // Add filters ... + url += createFilterOptionsString("-testcase", getCheckedFilterValues("ixTestCaseFilter")); + url += createFilterOptionsString("-metric", getCheckedFilterValues("ixMetricFilter")); + url += createFilterOptionsString("-platform", getCheckedFilterValues("ixPlatformFilter")); + url += createFilterOptionsString("-host", getCheckedFilterValues("ixHostFilter")); + url += createFilterOptionsString("-branch", getCheckedFilterValues("ixBranchFilter")); + + + // Update link ... + link = document.getElementById("ixComputeASFStatsLink"); +// link.setAttribute("href", url); + link.setAttribute("href", "http://www.klokka.no"); // 4 NOW! link.setAttribute("target", "_blank"); // prevent page from opening in same window } @@ -542,13 +577,13 @@ function IndexSection() section.appendChild(document.createElement("br")); - // Create 'links' section ... + // Create 'top row' section ... table = section.appendChild(document.createElement("table")); table.setAttribute("style", "border:0px; padding:0px"); - tr = table.insertRow(0); + topRow = table.insertRow(0); // ... 'compute index' link ... - td = tr.insertCell(tr.cells.length); + td = topRow.insertCell(topRow.cells.length); td.setAttribute("style", "border:0px; padding:2px"); link = td.appendChild(document.createElement("a")); link.id = "ixComputeIndexLink"; @@ -564,7 +599,7 @@ function IndexSection() ); // ... data quality stats fieldset ... - td = tr.insertCell(tr.cells.length); + td = topRow.insertCell(topRow.cells.length); td.setAttribute("style", "border:0px; padding:0px"); fieldset = td.appendChild(document.createElement("fieldset")); legend = fieldset.appendChild(document.createElement("legend")); @@ -610,6 +645,56 @@ function IndexSection() select.options[4] = new Option("6", "6"); select.options[2].selected = true; + // ... ASF scorecard stats fieldset ... + td = topRow.insertCell(topRow.cells.length); + td.setAttribute("style", "border:0px; padding:0px"); + fieldset = td.appendChild(document.createElement("fieldset")); + legend = fieldset.appendChild(document.createElement("legend")); + legend.appendChild(document.createTextNode("Data Quality Statistics")); + legend.innerHTML = "ASF Scorecard Statistics"; + legend.setAttribute("style", "font-size:12"); + table = fieldset.appendChild(document.createElement("table")); + table.setAttribute("style", "border:0px; padding:0px"); + + // ... 'compute ASF stats' link ... + tr = table.insertRow(table.rows.length); + td = tr.insertCell(0); + td.setAttribute("style", "border:0px; padding:2px"); + link = td.appendChild(document.createElement("a")); + link.id = "ixComputeASFStatsLink"; + link.appendChild(document.createTextNode("Compute")); + link.setAttribute("class", "ixLink_index"); + link.setAttribute("href", "dummy"); // for correct initial rendering + link.setAttribute( + "onmouseover", + "updateComputeASFStatsLink(" + + defaultMedianWinSize + + ")" + ); + + // ... 'from time' ... + tr = table.insertRow(table.rows.length); + td = tr.insertCell(0); + td.innerHTML = "From timestamp (secs since 1970): "; + td.setAttribute("style", "text-align:right"); + td = tr.insertCell(1); + input = td.appendChild(document.createElement("input")); + input.setAttribute("type", "text"); + input.setAttribute("id", "ixASFFromTime"); + input.setAttribute("value", "-1"); + + // ... 'to time' ... + tr = table.insertRow(table.rows.length); + td = tr.insertCell(0); + td.innerHTML = "To timestamp (secs since 1970): "; + td.setAttribute("style", "text-align:right"); + td = tr.insertCell(1); + input = td.appendChild(document.createElement("input")); + input.setAttribute("type", "text"); + input.setAttribute("id", "ixASFToTime"); + input.setAttribute("value", "-1"); + + // Create 'Configuration' section ... section.appendChild(document.createElement("br")); section.appendChild(document.createElement("br")); |