diff options
Diffstat (limited to 'web/getstats/main.js')
| -rw-r--r-- | web/getstats/main.js | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/web/getstats/main.js b/web/getstats/main.js index 17f435b..e10c4d0 100644 --- a/web/getstats/main.js +++ b/web/getstats/main.js @@ -363,11 +363,13 @@ function fetchContexts() { context = contexts[i]; html += "<tr id=\"context_row:" + i + "\">"; html += "<td><input id=\"context1_cb:" + i + "\" " + - "name=\"context1\" type=\"checkbox\" " + - "onclick=\"clickContextCheckbox(this, 0)\"></td>"; + "name=\"context1\" type=\"radio\" " + + "onclick=\"clickContextRadioButton(this, 0)\">" + + "</td>"; html += "<td><input id=\"context2_cb:" + i + "\" " + - "name=\"context2\" type=\"checkbox\" " + - "onclick=\"clickContextCheckbox(this, 1)\"></td>"; + "name=\"context2\" type=\"radio\" " + + "onclick=\"clickContextRadioButton(this, 1)\">" + + "</td>"; html += "<td name=\"host\">" + context.host + "</td>"; @@ -471,21 +473,8 @@ function highlightContextsTable() { $("#extra_context2_row").attr("class", "context2"); } -// Handles clicking a context checkbox. Exactly one Context 1 and -// zero or one Context 2 must be selected at any time. -function clickContextCheckbox(cb, col) { - // Enforce selection invariant: - if (cb.checked) { - // Deselect all other checkboxes in this column - // (note: nth-child assumes 1-based indexes): - $("#contextsTable td:nth-child(" + (col + 1) + ") input") - .attr("checked", false); - cb.checked = true; - } else if ((col == 0)) { - // Prevent deselection by reselecting: - cb.checked = true; - } - +// Handles clicking a context radio button. +function clickContextRadioButton(cb, col) { // Check if the same host/platform/branch combination is selected for // both contexts. If so, add an extra row below the selected row to enable // selection of a different snapshot for the Context 2 |
