monitoring clickhandler js

Former-commit-id: 424d53773336b155929da3a74d68808969377145
master
Ondřej Hruška 8 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 mon = {};
function updRefInfoField(ok) {
$('#hasref').html(ok ? 'OK' : 'Not set!');
}
/** Capture reference & save to flash */
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() {
// 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() {

@ -9436,4 +9436,61 @@ var page_status = (function() {
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

File diff suppressed because one or more lines are too long

@ -15,7 +15,7 @@
<tr>
<th>Actual&nbsp;distance:</th>
<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>
</td>
</tr>
@ -36,8 +36,8 @@
<tr>
<th><label for="rep-interval">Interval:</label></th>
<td>
<input type="number" id="rep-interval" style="max-width: 10em" value="%repInterval%">
seconds
<input type="number" id="rep-interval" style="max-width: 10em" value="%repInterval%"><!--
-->&nbsp;seconds
</td>
</tr>
<tr>
@ -49,21 +49,15 @@
</tr>
<tr>
<th><label for="rep-feed">Feed/Channel:</label></th>
<td>
<input type="text" name="rep-feed" id="rep-feed" value="%repFeed%">
</td>
<td><input type="text" name="rep-feed" id="rep-feed" value="%repFeed%"></td>
</tr>
<tr>
<th><label for="rep-key">API key:</label></th>
<td>
<input type="text" name="rep-key" id="rep-key" value="%repKey%">
</td>
<td><input type="text" name="rep-key" id="rep-key" value="%repKey%"></td>
</tr>
<tr>
<th>&nbsp;</th>
<td>
<input type="submit" value="Save changes">
</td>
<td><input type="submit" value="Save changes"></td>
</tr>
</table>
</form>

Loading…
Cancel
Save