monitoring clickhandler js

Former-commit-id: 424d53773336b155929da3a74d68808969377145
master
Ondřej Hruška 9 years ago
parent 244fa6aa11
commit 91025a4cc7
  1. 43
      html_src/js-src/page_mon.js
  2. 57
      html_src/js/all.js
  3. 2
      html_src/js/all.js.map
  4. 18
      html_src/page_monitoring.php

@ -1,12 +1,51 @@
var page_mon = (function() { var page_mon = (function() {
var mon = {}; var mon = {};
function updRefInfoField(ok) {
$('#hasref').html(ok ? 'OK' : 'Not set!');
}
/** Capture reference & save to flash */
mon.captureRef = function() { mon.captureRef = function() {
// TODO ajax & update the field $().get(_root + '/mon/setref', function(resp, status) {
if (status != 200) {
// bad response
errorMsg('Operation failed.');
} else {
try {
// OK
var j = JSON.parse(resp);
updRefInfoField(j.success);
} catch(e) {
errorMsg(e);
updRefInfoField(false);
}
}
});
}; };
/** Capture waveform and compare with reference */
mon.compareNow = function() { mon.compareNow = function() {
// TODO ajax & show result $().get(_root + '/mon/compare', function(resp, status) {
if (status != 200) {
// bad response
errorMsg('Operation failed.');
} else {
try {
// OK
var j = JSON.parse(resp);
if (j.success) {
$('#refdist').html(numfmt(j.deviation, 2));
} else {
errorMsg('Capture failed.');
$('#refdist').html('--');
}
} catch(e) {
errorMsg(e);
$('#refdist').html('--');
}
}
});
}; };
mon.init = function() { mon.init = function() {

@ -9436,4 +9436,61 @@ var page_status = (function() {
return st; return st;
})(); })();
var page_mon = (function() {
var mon = {};
function updRefInfoField(ok) {
$('#hasref').html(ok ? 'OK' : 'Not set!');
}
/** Capture reference & save to flash */
mon.captureRef = function() {
$().get(_root + '/mon/setref', function(resp, status) {
if (status != 200) {
// bad response
errorMsg('Operation failed.');
} else {
try {
// OK
var j = JSON.parse(resp);
updRefInfoField(j.success);
} catch(e) {
errorMsg(e);
updRefInfoField(false);
}
}
});
};
/** Capture waveform and compare with reference */
mon.compareNow = function() {
$().get(_root + '/mon/compare', function(resp, status) {
if (status != 200) {
// bad response
errorMsg('Operation failed.');
} else {
try {
// OK
var j = JSON.parse(resp);
if (j.success) {
$('#refdist').html(numfmt(j.deviation, 2));
} else {
errorMsg('Capture failed.');
$('#refdist').html('--');
}
} catch(e) {
errorMsg(e);
$('#refdist').html('--');
}
}
});
};
mon.init = function() {
//
};
return mon;
})();
//# sourceMappingURL=all.js.map //# sourceMappingURL=all.js.map

File diff suppressed because one or more lines are too long

@ -15,7 +15,7 @@
<tr> <tr>
<th>Actual&nbsp;distance:</th> <th>Actual&nbsp;distance:</th>
<td> <td>
<span id="reporting" class="Valfield">N/A</span> <span id="refdist" class="Valfield">N/A</span>
<a onclick="page_mon.compareNow()" class="button btn-blue">Measure</a> <a onclick="page_mon.compareNow()" class="button btn-blue">Measure</a>
</td> </td>
</tr> </tr>
@ -36,8 +36,8 @@
<tr> <tr>
<th><label for="rep-interval">Interval:</label></th> <th><label for="rep-interval">Interval:</label></th>
<td> <td>
<input type="number" id="rep-interval" style="max-width: 10em" value="%repInterval%"> <input type="number" id="rep-interval" style="max-width: 10em" value="%repInterval%"><!--
seconds -->&nbsp;seconds
</td> </td>
</tr> </tr>
<tr> <tr>
@ -49,21 +49,15 @@
</tr> </tr>
<tr> <tr>
<th><label for="rep-feed">Feed/Channel:</label></th> <th><label for="rep-feed">Feed/Channel:</label></th>
<td> <td><input type="text" name="rep-feed" id="rep-feed" value="%repFeed%"></td>
<input type="text" name="rep-feed" id="rep-feed" value="%repFeed%">
</td>
</tr> </tr>
<tr> <tr>
<th><label for="rep-key">API key:</label></th> <th><label for="rep-key">API key:</label></th>
<td> <td><input type="text" name="rep-key" id="rep-key" value="%repKey%"></td>
<input type="text" name="rep-key" id="rep-key" value="%repKey%">
</td>
</tr> </tr>
<tr> <tr>
<th>&nbsp;</th> <th>&nbsp;</th>
<td> <td><input type="submit" value="Save changes"></td>
<input type="submit" value="Save changes">
</td>
</tr> </tr>
</table> </table>
</form> </form>

Loading…
Cancel
Save