Check load state before showing results

This commit is contained in:
malbarral 2017-07-03 11:48:51 +02:00
parent 7f5637114c
commit de70260380
14 changed files with 21 additions and 19 deletions

View File

@ -15,6 +15,7 @@ app.controller('agentsController', function ($scope, $q, DataFactory, Notifier,
$scope.defaultManager = $scope.state.getDefaultManager().name;
$scope.extensions = $scope.state.getExtensions().extensions;
$scope.results = false;
$scope.loadState = "loading";
$scope.hideRing = function(items){
if($(".vis-editor-content" ).length >= items)
return true;
@ -51,11 +52,11 @@ app.controller('agentsController', function ($scope, $q, DataFactory, Notifier,
$scope.submenuNavItem = tab;
$location.search('tab', $scope.submenuNavItem);
if($scope.submenuNavItem != "preview"){
$scope.presentData($scope._agent.name).then(function (data) {$scope.results = data;});
$scope.presentData($scope._agent.name).then(function (data) {$scope.results = data;}, function() { $scope.loadState = "no-results"; });
}
}else{
$rootScope.$broadcast('fetchVisualization');
$scope.presentData($scope._agent.name).then(function (data) {$scope.results = data;});
$scope.presentData($scope._agent.name).then(function (data) {$scope.results = data;}, function() { $scope.loadState = "no-results"; });
}
};
@ -238,7 +239,7 @@ app.controller('agentsController', function ($scope, $q, DataFactory, Notifier,
//Check for present data for the selected tab
if($scope.submenuNavItem != "preview"){
$scope.presentData($scope._agent.name).then(function (data) {$scope.results = data;});
$scope.presentData($scope._agent.name).then(function (data) {$scope.results = data;}, function() { $scope.loadState = "no-results"; });
}
}
}

View File

@ -8,6 +8,7 @@ app.controller('overviewController', function ($scope, appState, $window, generi
$scope.submenuNavItem = "general";
$scope.tabView = "panels";
$scope.results = false;
$scope.loadState = "loading";
$scope.loadedBoxes = false;
$scope.hideRing = function(items){
if($(".vis-editor-content" ).length >= items)
@ -56,9 +57,9 @@ app.controller('overviewController', function ($scope, appState, $window, generi
$scope.submenuNavItem = tab;
$location.search('tab', $scope.submenuNavItem);
$scope.presentData().then(function (data) {$scope.results = data;});
$scope.presentData().then(function (data) {$scope.results = data;}, function(){ $scope.loadState = "no-results";});
}else{
$scope.presentData().then(function (data) {$scope.results = data;});
$scope.presentData().then(function (data) {$scope.results = data;}, function(){ $scope.loadState = "no-results";});
$rootScope.$broadcast('fetchVisualization');
}
};
@ -116,13 +117,13 @@ app.controller('overviewController', function ($scope, appState, $window, generi
$scope.timeLT = currentTimeFilter.time.to;
//Check for present data for the selected tab
$scope.presentData().then(function (data) {$scope.results = data;});
$scope.presentData().then(function (data) {$scope.results = data;}, function(){ $scope.loadState = "no-results";});
}
}
});
// Load
$scope.presentData().then(function (data) {$scope.results = data;});
$scope.presentData().then(function (data) {$scope.results = data;}, function(){ $scope.loadState = "no-results";});
});

View File

@ -4,7 +4,7 @@
<kbn-searchbar ng-if="tabView == 'panels'"></kbn-searchbar>
<div class='uil-ring-css' ng-if="tabView == 'panels'" ng-show='!hideRing(15)'><div></div></div>
<!-- No results message -->
<md-content flex layout="row" layout-align="start start" ng-if="!results && tabView == 'panels' && hideRing(15)">
<md-content flex layout="row" layout-align="start start" ng-if="loadState == 'no-results' && tabView == 'panels' && hideRing(15)">
<md-card flex layout="column">
<md-card-content style="text-align: center;">
No results for selected time interval

View File

@ -4,7 +4,7 @@
<kbn-searchbar ng-if="tabView == 'panels'"></kbn-searchbar>
<div class='uil-ring-css' ng-if="tabView == 'panels'" ng-show='!hideRing(8)'><div></div></div>
<!-- No results message -->
<md-content flex layout="row" layout-align="start start" ng-if="!results && tabView == 'panels' && hideRing(8)">
<md-content flex layout="row" layout-align="start start" ng-if="loadState == 'no-results' && tabView == 'panels' && hideRing(8)">
<md-card flex layout="column">
<md-card-content style="text-align: center;">
No results for selected time interval

View File

@ -4,7 +4,7 @@
<kbn-searchbar ng-if="tabView == 'panels'"></kbn-searchbar>
<div class='uil-ring-css' ng-if="tabView == 'panels'" ng-show='!hideRing(13)'><div></div></div>
<!-- No results message -->
<md-content flex layout="row" layout-align="start start" ng-if="!results && tabView == 'panels' && hideRing(13)">
<md-content flex layout="row" layout-align="start start" ng-if="loadState == 'no-results' && tabView == 'panels' && hideRing(13)">
<md-card flex layout="column">
<md-card-content style="text-align: center;">
No results for selected time interval

View File

@ -70,7 +70,7 @@
</div>
<!-- No results message -->
<md-content id="prueba" flex layout="row" layout-align="start start" ng-if="!results && tabView == 'panels' && hideRing(7)">
<md-content id="prueba" flex layout="row" layout-align="start start" ng-if="loadState == 'no-results' && tabView == 'panels' && hideRing(7)">
<md-card flex layout="column">
<md-card-content style="text-align: center;">
No results for selected time interval

View File

@ -4,7 +4,7 @@
<kbn-searchbar ng-if="tabView == 'panels'"></kbn-searchbar>
<div class='uil-ring-css' ng-if="tabView == 'panels'" ng-show='!hideRing(3)'><div></div></div>
<!-- No results message -->
<md-content flex layout="row" layout-align="start start" ng-if="!results && tabView == 'panels' && hideRing(3)">
<md-content flex layout="row" layout-align="start start" ng-if="loadState == 'no-results' && tabView == 'panels' && hideRing(3)">
<md-card flex layout="column">
<md-card-content style="text-align: center;">
No results for selected time interval

View File

@ -4,7 +4,7 @@
<kbn-searchbar ng-if="tabView == 'panels'"></kbn-searchbar>
<div class='uil-ring-css' ng-if="tabView == 'panels'" ng-show='!hideRing(4)'><div></div></div>
<!-- No results message -->
<md-content flex layout="row" layout-align="start start" ng-if="!results && tabView == 'panels' && hideRing(4)">
<md-content flex layout="row" layout-align="start start" ng-if="loadState == 'no-results' && tabView == 'panels' && hideRing(4)">
<md-card flex layout="column">
<md-card-content style="text-align: center;">
No results for selected time interval

View File

@ -4,7 +4,7 @@
<kbn-searchbar ng-if="tabView == 'panels'"></kbn-searchbar>
<div class='uil-ring-css' ng-if="tabView == 'panels'" ng-show='!hideRing(16)'><div></div></div>
<!-- No results message -->
<md-content flex layout="row" layout-align="start start" ng-if="!results && tabView == 'panels' && hideRing(16)">
<md-content flex layout="row" layout-align="start start" ng-if="loadState == 'no-results' && tabView == 'panels' && hideRing(16)">
<md-card flex layout="column">
<md-card-content style="text-align: center;">
No results for selected time interval

View File

@ -4,7 +4,7 @@
<kbn-searchbar ng-if="tabView == 'panels'"></kbn-searchbar>
<div class='uil-ring-css' ng-if="tabView == 'panels'" ng-show='!hideRing(17)'><div></div></div>
<!-- No results message -->
<md-content flex layout="row" layout-align="start start" ng-if="!results && tabView == 'panels' && hideRing(17)">
<md-content flex layout="row" layout-align="start start" ng-if="loadState == 'no-results' && tabView == 'panels' && hideRing(17)">
<md-card flex layout="column">
<md-card-content style="text-align: center;">
No results for selected time interval

View File

@ -4,7 +4,7 @@
<kbn-searchbar ng-if="tabView == 'panels'"></kbn-searchbar>
<div class='uil-ring-css' ng-if="tabView == 'panels'" ng-show='!hideRing(15)'><div></div></div>
<!-- No results message -->
<md-content flex layout="row" layout-align="start start" ng-if="!results && tabView == 'panels' && hideRing(15)">
<md-content flex layout="row" layout-align="start start" ng-if="loadState == 'no-results' && tabView == 'panels' && hideRing(15)">
<md-card flex layout="column">
<md-card-content style="text-align: center;">
No results for selected time interval

View File

@ -4,7 +4,7 @@
<kbn-searchbar ng-if="tabView == 'panels'"></kbn-searchbar>
<div class='uil-ring-css' ng-if="tabView == 'panels'" ng-show='!hideRing(14)'><div></div></div>
<!-- No results message -->
<md-content flex layout="row" layout-align="start start" ng-if="!results && tabView == 'panels' && hideRing(14)">
<md-content flex layout="row" layout-align="start start" ng-if="loadState == 'no-results' && tabView == 'panels' && hideRing(14)">
<md-card flex layout="column">
<md-card-content style="text-align: center;">
No results for selected time interval

View File

@ -4,7 +4,7 @@
<kbn-searchbar ng-if="tabView == 'panels'"></kbn-searchbar>
<div class='uil-ring-css' ng-if="tabView == 'panels'" ng-show='!hideRing(5)'><div></div></div>
<!-- No results message -->
<md-content flex layout="row" layout-align="start start" ng-if="!results && tabView == 'panels' && hideRing(5)">
<md-content flex layout="row" layout-align="start start" ng-if="loadState == 'no-results' && tabView == 'panels' && hideRing(5)">
<md-card flex layout="column">
<md-card-content style="text-align: center;">
No results for selected time interval

View File

@ -4,7 +4,7 @@
<kbn-searchbar ng-if="tabView == 'panels'"></kbn-searchbar>
<div class='uil-ring-css' ng-if="tabView == 'panels'" ng-show='!hideRing(5)'><div></div></div>
<!-- No results message -->
<md-content flex layout="row" layout-align="start start" ng-if="!results && tabView == 'panels' && hideRing(5)">
<md-content flex layout="row" layout-align="start start" ng-if="loadState == 'no-results' && tabView == 'panels' && hideRing(5)">
<md-card flex layout="column">
<md-card-content style="text-align: center;">
No results for selected time interval