Skip to content

Commit

Permalink
Corrected a bug that caused host names to not load in when when dnsma…
Browse files Browse the repository at this point in the history
…sq as not used.
  • Loading branch information
vortex-5 committed May 17, 2020
1 parent 226498a commit 91f2c64
Showing 1 changed file with 40 additions and 11 deletions.
51 changes: 40 additions & 11 deletions bwmon/www/bwmon.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,20 +377,49 @@ bwmon.controller('MainController', ['$scope', '$interval', '$http', '$location',
}

function oldService() {
$http.get($scope.nonServiceDnsLeases, config).then(function(responseLeases) {
$scope.macNames = {};
let dnsmasqLeasesData = '';
let dnsmasqConfData = '';

function fetchDNSLeases() {
let dnsmasqLeasesFetched = false;
let dnsmasqConfFetched = false;

$http.get($scope.nonServiceDnsLeases, config).then(function(responseLeases) {
dnsmasqLeasesData = responseLeases.data;
dnsmasqLeasesFetched = true;
notifyFetchCompleted()
}, function(error) {
dnsmasqLeasesFetched = true;
notifyFetchCompleted()
});

$http.get($scope.nonServiceDnsConf, config).then(function(responseConf) {
$scope.macNames = {};
dnsmasqConfData = responseConf.data;
dnsmasqConfFetched = true;
notifyFetchCompleted();
}, function(error) {
dnsmasqConfFetched = true;
notifyFetchCompleted();
});

let dnsmasqLeasesData = responseLeases.data;
let dnsmasqConfData = responseConf.data;
function notifyFetchCompleted() {
if (dnsmasqLeasesFetched && dnsmasqConfFetched) {
macNameUpdate(dnsmasqLeasesData, dnsmasqConfData);
}
}
}
fetchDNSLeases();

function macNameUpdate(dnsmasqLeasesData, dnsmasqConfData) {
$scope.updateDnsLeases(dnsmasqLeasesData);
$scope.updateDnsConf(dnsmasqConfData);

$scope.updateMissingEntries($scope.macNames);
$scope.macNamesOverride();
$scope.updateDisplayUsage();
}

$scope.updateDnsLeases(dnsmasqLeasesData);
$scope.updateDnsConf(dnsmasqConfData);
$scope.updateMissingEntries($scope.macNames);
$scope.macNamesOverride();
$scope.updateDisplayUsage();
});
});
$http.get('usage_stats.js', config).then(function(response) {
$scope.usageData = {};
$scope.updateUsageData(response.data);
Expand Down

0 comments on commit 91f2c64

Please sign in to comment.