diff options
author | jasplin <qt-info@nokia.com> | 2010-05-11 10:28:00 +0200 |
---|---|---|
committer | jasplin <qt-info@nokia.com> | 2010-05-11 10:28:00 +0200 |
commit | 1c43dc0ff9fdea20688c0921f367b6c2e60c7491 (patch) | |
tree | a57ea0b17c14d0b3ded9df7499111433af9596e2 | |
parent | 68364229e6a0938bbb40e674d33f3ec1c2f1c8b4 (diff) |
Added cookie support to index section.
-rw-r--r-- | src/bm/bmrequest.cpp | 6 | ||||
-rw-r--r-- | src/bmclient/main.cpp | 2 | ||||
-rw-r--r-- | src/bmweb/global.js | 17 | ||||
-rw-r--r-- | src/bmweb/indexsection.js | 126 |
4 files changed, 115 insertions, 36 deletions
diff --git a/src/bm/bmrequest.cpp b/src/bm/bmrequest.cpp index fa09701..46539b8 100644 --- a/src/bm/bmrequest.cpp +++ b/src/bm/bmrequest.cpp @@ -5625,7 +5625,7 @@ void BMRequest_IndexGetValues::handleReply_HTML(const QStringList &args) const QDomNodeList sfPercNodes = dqStatsElem.elementsByTagName("stabFracPercentile"); - // .. stable fraction percentiles (all subsequence counts) ... + // .. stability fraction percentiles (all subsequence counts) ... reply += "<td style=\"border:0px\"><table>" "<tr><th></th><th>SF</th></tr>\n"; for (int i = sfPercNodes.size() - 1; i >= 0; --i) { @@ -5641,7 +5641,7 @@ void BMRequest_IndexGetValues::handleReply_HTML(const QStringList &args) const } reply += "</table></td>\n"; - // .. stable fraction percentiles (subsequence counts >= 2) ... + // .. stability fraction percentiles (subsequence counts >= 2) ... reply += "<td style=\"border:0px\"><table>" "<tr><th></th><th>SF2</th></tr>\n"; for (int i = sfPercNodes.size() - 1; i >= 0; --i) { @@ -7607,7 +7607,7 @@ void BMRequest_ASFStatsGetValues::handleReply_HTML(const QStringList &args) cons .arg(usLowFromPosCount) .arg(QString().setNum(100 * (usLowFromPosCount / qreal(unstable)), 'f', 2)); reply += QString( - "<tr><td>Stable fraction too low:</td><td>%1</td><td>%2 %</td></tr>\n") + "<tr><td>Stability fraction too low:</td><td>%1</td><td>%2 %</td></tr>\n") .arg(usLowSFCount) .arg(QString().setNum(100 * (usLowSFCount / qreal(unstable)), 'f', 2)); reply += QString( diff --git a/src/bmclient/main.cpp b/src/bmclient/main.cpp index 104f481..ca890d5 100644 --- a/src/bmclient/main.cpp +++ b/src/bmclient/main.cpp @@ -1094,7 +1094,7 @@ BMRequest * Executor::createIndexGetValuesRequest( dqStatsStabTol = values.at(0).toInt(&ok); if ((!ok) || (dqStatsStabTol < 2)) { *error = - "failed to extract stabiliity tolerance for data quality stats as an " + "failed to extract stability tolerance for data quality stats as an " "integer >= 2"; return 0; } diff --git a/src/bmweb/global.js b/src/bmweb/global.js index d8f094a..fea92ad 100644 --- a/src/bmweb/global.js +++ b/src/bmweb/global.js @@ -314,14 +314,27 @@ function sharedTimeScale() return document.getElementById("sharedTimeScale").checked ? 1 : 0; } -function getIntFromTextInput(id, defaultValue) +function getPositiveIntFromText(text, defaultValue) +{ + var value = parseInt(text); + if (isNaN(value) || (value <= 0)) + value = defaultValue; + return value; +} + +function getIntFromText(text, defaultValue) { - var value = parseInt(document.getElementById(id).value); + var value = parseInt(text); if (isNaN(value)) value = defaultValue; return value; } +function getIntFromTextInput(id, defaultValue) +{ + return getIntFromText(document.getElementById(id).value, defaultValue); +} + function maxDetailsHistory() { var mdh = parseInt(document.getElementById("maxDetailsHistory").value); diff --git a/src/bmweb/indexsection.js b/src/bmweb/indexsection.js index 6267edc..f808964 100644 --- a/src/bmweb/indexsection.js +++ b/src/bmweb/indexsection.js @@ -74,9 +74,13 @@ function updateComputeIndexLink(defaultBaseTime, defaultMedianWinSize) if (document.getElementById("ixDQStatsEnabled").checked) { // Add parameters for data quality statistics ... + + stabTol = getPositiveIntFromText(document.getElementById("ixDQStatsStabTol").value, 2); + document.getElementById("ixDQStatsStabTol").value = stabTol; + url += " -dataqualitystats" + " -dqstatsdifftol " + document.getElementById("ixDQStatsDiffTol").value - + " -dqstatsstabtol " + selectedOptions("ixDQStatsStabTol")[0]; + + " -dqstatsstabtol " + stabTol; } @@ -112,7 +116,7 @@ function updateComputeASFStatsLink(defaultMedianWinSize) url += " -fromtime " + document.getElementById("ixASFStatsFromTime").value + " -totime " + document.getElementById("ixASFStatsToTime").value + " -difftol " + document.getElementById("ixASFStatsDiffTol").value - + " -stabtol " + selectedOptions("ixASFStatsStabTol")[0] + + " -stabtol " + document.getElementById("ixASFStatsStabTol").value + " -sftol " + document.getElementById("ixASFStatsSFTol").value + " -lftol " + document.getElementById("ixASFStatsLFTol").value + " -maxldtol " + document.getElementById("ixASFStatsMaxLDTol").value; @@ -632,7 +636,7 @@ function IndexSection() input = td.appendChild(document.createElement("input")); input.setAttribute("type", "text"); input.setAttribute("id", "ixDQStatsDiffTol"); - input.setAttribute("Value", "10"); + input.setAttribute("Value", "2"); tr = table.insertRow(table.rows.length); td = tr.insertCell(0); @@ -640,14 +644,10 @@ function IndexSection() td.innerHTML = "Stability tolerance: "; td = tr.insertCell(1); td.setAttribute("style", "text-align:left"); - select = td.appendChild(document.createElement("select")); - select.setAttribute("id", "ixDQStatsStabTol"); - select.options[0] = new Option("2", "2"); - select.options[1] = new Option("3", "3"); - select.options[2] = new Option("4", "4"); - select.options[3] = new Option("5", "5"); - select.options[4] = new Option("6", "6"); - select.options[2].selected = true; + input = td.appendChild(document.createElement("input")); + input.setAttribute("type", "text"); + input.setAttribute("id", "ixDQStatsStabTol"); + input.setAttribute("Value", "3"); // ... ASF scorecard stats fieldset ... td = topRow.insertCell(topRow.cells.length); @@ -743,7 +743,7 @@ function IndexSection() input = td.appendChild(document.createElement("input")); input.setAttribute("type", "text"); input.setAttribute("id", "ixASFStatsDiffTol"); - input.setAttribute("Value", "10"); + input.setAttribute("Value", "2"); td = tr.insertCell(2); td.innerHTML = "The maximum allowed relative difference between two values for them to be " @@ -757,14 +757,10 @@ function IndexSection() td.innerHTML = "Stability tolerance: "; td = tr.insertCell(1); td.setAttribute("style", "text-align:left"); - select = td.appendChild(document.createElement("select")); - select.setAttribute("id", "ixASFStatsStabTol"); - select.options[0] = new Option("2", "2"); - select.options[1] = new Option("3", "3"); - select.options[2] = new Option("4", "4"); - select.options[3] = new Option("5", "5"); - select.options[4] = new Option("6", "6"); - select.options[2].selected = true; + input = td.appendChild(document.createElement("input")); + input.setAttribute("type", "text"); + input.setAttribute("id", "ixASFStatsStabTol"); + input.setAttribute("Value", "3"); td = tr.insertCell(2); td.innerHTML = "The minimum length a MaxESS must have for it to be considered stable."; td.setAttribute("style", "background-color:#eeeeee"); @@ -779,7 +775,7 @@ function IndexSection() input = td.appendChild(document.createElement("input")); input.setAttribute("type", "text"); input.setAttribute("id", "ixASFStatsSFTol"); - input.setAttribute("Value", "10"); + input.setAttribute("Value", "50"); td = tr.insertCell(2); td.innerHTML = "The minimum SF (stability fraction) of a result history must have for it to be " @@ -796,7 +792,7 @@ function IndexSection() input = td.appendChild(document.createElement("input")); input.setAttribute("type", "text"); input.setAttribute("id", "ixASFStatsLFTol"); - input.setAttribute("Value", "10"); + input.setAttribute("Value", "50"); td = tr.insertCell(2); td.innerHTML = "The minimum ULF (unique level fraction) a result history must have for it to be " @@ -813,7 +809,7 @@ function IndexSection() input = td.appendChild(document.createElement("input")); input.setAttribute("type", "text"); input.setAttribute("id", "ixASFStatsMaxLDTol"); - input.setAttribute("Value", "10"); + input.setAttribute("Value", "200"); td = tr.insertCell(2); td.innerHTML = "The percentage of subsequence levels that are unique."; td.innerHTML = @@ -1025,21 +1021,91 @@ function IndexSection() this.state = function() { var state_ = []; - // 2 B DONE! + // Data Quality Stats parameters ... + + // ... difference tolerance ... + state_["ixDQStatsDiffTol"] = document.getElementById("ixDQStatsDiffTol").value; + + // ... stability tolerance ... + state_["ixDQStatsStabTol"] = document.getElementById("ixDQStatsStabTol").value; + + + // ASF Scorecard Stats parameters ... + + // ... 'from' timestamp ... + state_["ixASFStatsFromTime"] = document.getElementById("ixASFStatsFromTime").value; + + // ... 'to' timestamp ... + state_["ixASFStatsToTime"] = document.getElementById("ixASFStatsToTime").value; + + // ... difference tolerance ... + state_["ixASFStatsDiffTol"] = document.getElementById("ixASFStatsDiffTol").value; + + // ... stability tolerance ... + state_["ixASFStatsStabTol"] = document.getElementById("ixASFStatsStabTol").value; -// state_["ixTestState"] = document.getElementById("ixTestState").value; + // ... stability fraction tolerance ... + state_["ixASFStatsSFTol"] = document.getElementById("ixASFStatsSFTol").value; + + // ... unique level fraction tolerance ... + state_["ixASFStatsLFTol"] = document.getElementById("ixASFStatsLFTol").value; + + // ... max level difference tolerance ... + state_["ixASFStatsMaxLDTol"] = document.getElementById("ixASFStatsMaxLDTol").value; return state_; } this.setState = function(state_, handleDone) { - // 2 B DONE! + // Data Quality Stats parameters ... + + // ... difference tolerance ... + document.getElementById("ixDQStatsDiffTol").value = + getIntFromText(state_["ixDQStatsDiffTol"], 2); + + // ... stability tolerance ... + document.getElementById("ixDQStatsStabTol").value = + getIntFromText(state_["ixDQStatsStabTol"], 3); + + + // ASF Scorecard Stats parameters ... + + // ... 'from' timestamp ... + document.getElementById("ixASFStatsFromTime").value = + getIntFromText(state_["ixASFStatsFromTime"], -1); + + // ... 'to' timestamp ... + document.getElementById("ixASFStatsToTime").value = + getIntFromText(state_["ixASFStatsToTime"], -1); + + // ... difference tolerance ... + document.getElementById("ixASFStatsDiffTol").value = + getIntFromText(state_["ixASFStatsDiffTol"], 2); + + // ... stability tolerance ... + document.getElementById("ixASFStatsStabTol").value = + getIntFromText(state_["ixASFStatsStabTol"], 3); + + // ... stability fraction tolerance ... + document.getElementById("ixASFStatsSFTol").value = + getIntFromText(state_["ixASFStatsSFTol"], 50); + + // ... unique level fraction tolerance ... + document.getElementById("ixASFStatsLFTol").value = + getIntFromText(state_["ixASFStatsLFTol"], 50); + + // ... max level level difference tolerance ... + document.getElementById("ixASFStatsMaxLDTol").value = + getIntFromText(state_["ixASFStatsMaxLDTol"], 200); + + + // complete this ... + // also convert the stab tol in the data quality stats section to a regular text input + // (rather than a select input) ... + +// 2 B DONE! - // name = "ixTestState"; - // value = parseInt(state_[name]); - // if (!isNaN(value)) - // document.getElementById(name).value = value; handleDone(); } |