mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Fetch ajax channel value
This commit is contained in:
parent
b6cd2e0fa1
commit
597f1b04cf
@ -112,7 +112,6 @@ function applyNetworkSettings() {
|
|||||||
arrFormData = {};
|
arrFormData = {};
|
||||||
arrFormData['generate'] = '';
|
arrFormData['generate'] = '';
|
||||||
$.post('ajax/networking/gen_int_config.php',arrFormData,function(data){
|
$.post('ajax/networking/gen_int_config.php',arrFormData,function(data){
|
||||||
console.log(data);
|
|
||||||
var jsonData = JSON.parse(data);
|
var jsonData = JSON.parse(data);
|
||||||
$('#msgNetworking').html(msgShow(jsonData['return'],jsonData['output']));
|
$('#msgNetworking').html(msgShow(jsonData['return'],jsonData['output']));
|
||||||
});
|
});
|
||||||
@ -126,7 +125,6 @@ $(document).on("click", ".js-add-dhcp-static-lease", function(e) {
|
|||||||
if (mac == "" || ip == "") {
|
if (mac == "" || ip == "") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var row = $("#js-dhcp-static-lease-row").html()
|
var row = $("#js-dhcp-static-lease-row").html()
|
||||||
.replace("{{ mac }}", mac)
|
.replace("{{ mac }}", mac)
|
||||||
.replace("{{ ip }}", ip);
|
.replace("{{ ip }}", ip);
|
||||||
@ -147,12 +145,10 @@ $(document).on("submit", ".js-dhcp-settings-form", function(e) {
|
|||||||
|
|
||||||
function setupBtns() {
|
function setupBtns() {
|
||||||
$('#btnSummaryRefresh').click(function(){getAllInterfaces();});
|
$('#btnSummaryRefresh').click(function(){getAllInterfaces();});
|
||||||
|
|
||||||
$('.intsave').click(function(){
|
$('.intsave').click(function(){
|
||||||
var int = $(this).data('int');
|
var int = $(this).data('int');
|
||||||
saveNetworkSettings(int);
|
saveNetworkSettings(int);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.intapply').click(function(){
|
$('.intapply').click(function(){
|
||||||
applyNetworkSettings();
|
applyNetworkSettings();
|
||||||
});
|
});
|
||||||
@ -173,6 +169,8 @@ function contentLoaded() {
|
|||||||
getAllInterfaces();
|
getAllInterfaces();
|
||||||
setupTabs();
|
setupTabs();
|
||||||
setupBtns();
|
setupBtns();
|
||||||
|
case "hostapd_conf":
|
||||||
|
loadChannel();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -190,6 +188,13 @@ function loadWifiStations(refresh) {
|
|||||||
|
|
||||||
$(".js-reload-wifi-stations").on("click", loadWifiStations(true));
|
$(".js-reload-wifi-stations").on("click", loadWifiStations(true));
|
||||||
|
|
||||||
|
function loadChannel() {
|
||||||
|
$.get('ajax/networking/get_channel.php',function(data){
|
||||||
|
jsonData = JSON.parse(data);
|
||||||
|
loadChannelSelect(jsonData);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Sets the wirelss channel select options based on hw_mode and country_code.
|
Sets the wirelss channel select options based on hw_mode and country_code.
|
||||||
|
|
||||||
@ -201,7 +206,7 @@ allow up to channel 11 as maximum channel on the 2.4Ghz WiFi band.
|
|||||||
Source: https://en.wikipedia.org/wiki/List_of_WLAN_channels
|
Source: https://en.wikipedia.org/wiki/List_of_WLAN_channels
|
||||||
Additional: https://git.kernel.org/pub/scm/linux/kernel/git/sforshee/wireless-regdb.git
|
Additional: https://git.kernel.org/pub/scm/linux/kernel/git/sforshee/wireless-regdb.git
|
||||||
*/
|
*/
|
||||||
function loadChannelSelect() {
|
function loadChannelSelect(selected) {
|
||||||
var hw_mode = $('#cbxhwmode').val();
|
var hw_mode = $('#cbxhwmode').val();
|
||||||
var country_code = $('#cbxcountries').val();
|
var country_code = $('#cbxcountries').val();
|
||||||
var channel_select = $('#cbxchannel');
|
var channel_select = $('#cbxchannel');
|
||||||
@ -219,10 +224,12 @@ function loadChannelSelect() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set channel select with available values
|
// Set channel select with available values
|
||||||
|
var selected = (typeof selected === 'undefined') ? selectablechannels[0] : selected;
|
||||||
channel_select.empty();
|
channel_select.empty();
|
||||||
$.each(selectablechannels, function(key,value) {
|
$.each(selectablechannels, function(key,value) {
|
||||||
channel_select.append($("<option></option>").attr("value", value).text(value));
|
channel_select.append($("<option></option>").attr("value", value).text(value));
|
||||||
});
|
});
|
||||||
|
channel_select.val(selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Static Array method
|
// Static Array method
|
||||||
@ -334,5 +341,4 @@ $(window).bind("load", function() {
|
|||||||
$(document)
|
$(document)
|
||||||
.ajaxSend(setCSRFTokenHeader)
|
.ajaxSend(setCSRFTokenHeader)
|
||||||
.ready(contentLoaded)
|
.ready(contentLoaded)
|
||||||
.ready(loadWifiStations())
|
.ready(loadWifiStations());
|
||||||
.ready(loadChannelSelect());
|
|
||||||
|
Loading…
Reference in New Issue
Block a user