rpiConfigServer: Add NetworkSettings, other cleanups
This commit is contained in:
+17
-14
@@ -153,11 +153,12 @@ function connect() {
|
||||
visionLog(msg.data);
|
||||
break;
|
||||
case 'networkSettings':
|
||||
$('#networkApproach').value = msg.networkApproach;
|
||||
$('#networkAddress').value = msg.networkAddress;
|
||||
$('#networkMask').value = msg.networkMask;
|
||||
$('#networkGateway').value = msg.networkGateway;
|
||||
$('#networkDNS').value = msg.networkDNS;
|
||||
$('#networkApproach').val(msg.networkApproach);
|
||||
$('#networkAddress').val(msg.networkAddress);
|
||||
$('#networkMask').val(msg.networkMask);
|
||||
$('#networkGateway').val(msg.networkGateway);
|
||||
$('#networkDNS').val(msg.networkDNS);
|
||||
updateNetworkSettingsView();
|
||||
break;
|
||||
case 'systemReadOnly':
|
||||
displayReadOnly();
|
||||
@@ -268,25 +269,27 @@ function visionLog(data) {
|
||||
}
|
||||
|
||||
// Show details when appropriate for network approach
|
||||
$('#networkApproach').change(function() {
|
||||
if (this.value == "dhcp") {
|
||||
function updateNetworkSettingsView() {
|
||||
if ($('#networkApproach').val() === "dhcp") {
|
||||
$('#networkIpDetails').collapse('hide');
|
||||
} else {
|
||||
$('#networkIpDetails').collapse('show');
|
||||
}
|
||||
}
|
||||
|
||||
$('#networkApproach').change(function() {
|
||||
updateNetworkSettingsView();
|
||||
});
|
||||
|
||||
// Network Save button handler
|
||||
$('#networkSave').click(function() {
|
||||
var $this = $(this);
|
||||
$this.button('loading');
|
||||
var msg = {
|
||||
type: 'networkSave',
|
||||
networkApproach: $('#networkApproach').value,
|
||||
networkAddress: $('#networkAddress').value,
|
||||
networkMask: $('#networkMask').value,
|
||||
networkGateway: $('#networkGateway').value,
|
||||
networkDNS: $('#networkDNS').value
|
||||
networkApproach: $('#networkApproach').val(),
|
||||
networkAddress: $('#networkAddress').val(),
|
||||
networkMask: $('#networkMask').val(),
|
||||
networkGateway: $('#networkGateway').val(),
|
||||
networkDNS: $('#networkDNS').val()
|
||||
};
|
||||
connection.send(JSON.stringify(msg));
|
||||
});
|
||||
|
||||
+3
-3
@@ -197,7 +197,7 @@
|
||||
<input type=text" class="form-control" id="networkDNS">
|
||||
</div>
|
||||
</div>
|
||||
<button id="networkSave" type="submit" class="btn btn-primary" data-loading-text="<i class='spin' data-feather='loader'></i> Saving" disabled>
|
||||
<button id="networkSave" type="button" class="btn btn-primary" data-loading-text="<i class='spin' data-feather='loader'></i> Saving" disabled>
|
||||
<span data-feather="save"></span>
|
||||
Save
|
||||
</button>
|
||||
@@ -405,11 +405,11 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-auto mr-auto">
|
||||
<button type="submit" class="btn btn-primary" id="visionSave">
|
||||
<button type="button" class="btn btn-primary" id="visionSave">
|
||||
<span data-feather="save"></span>
|
||||
Save
|
||||
</button>
|
||||
<button type="submit" class="btn btn-secondary" id="visionDiscard">
|
||||
<button type="button" class="btn btn-secondary" id="visionDiscard">
|
||||
<span data-feather="x"></span>
|
||||
Discard Changes
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user