Merge pull request #2280 from jaredevantabor/session

Loading the viewport after /config response is returned from the API
This commit is contained in:
Jared Tabor 2016-06-09 10:56:30 -07:00 committed by GitHub
commit c64d0f0748
6 changed files with 14 additions and 8 deletions

View File

@ -1,5 +1,5 @@
export default
['$scope', '$state', 'CheckLicense', function($scope, $state, CheckLicense){
['$scope', '$state', 'ConfigService', function($scope, $state, ConfigService){
var processVersion = function(version){
// prettify version & calculate padding
// e,g 3.0.0-0.git201602191743/ -> 3.0.0
@ -16,10 +16,10 @@ export default
return paddedStr;
};
var init = function(){
CheckLicense.get()
.then(function(res){
$scope.subscription = res.data.license_info.subscription_name;
$scope.version = processVersion(res.data.version);
ConfigService.getConfig()
.then(function(config){
$scope.subscription = config.license_info.subscription_name;
$scope.version = processVersion(config.version);
$('#about-modal').modal('show');
});
};

View File

@ -872,6 +872,7 @@ var tower = angular.module('Tower', [
// User not authenticated, redirect to login page
$rootScope.sessionExpired = false;
$cookieStore.put('sessionExpired', false);
$rootScope.configReady = true;
$location.path('/login');
} else {
// If browser refresh, set the user_is_superuser value

View File

@ -323,6 +323,7 @@ export default
},
edit_survey: {
ngClick: 'editSurvey()',
awFeature: 'surveys',
ngShow: 'job_type.value !== "scan" && survey_exists'
},
cancel: {

View File

@ -64,6 +64,7 @@ export default ['$log', '$cookieStore', '$compile', '$window', '$rootScope',
var lastPath, lastUser, sessionExpired, loginAgain;
$rootScope.configReady = true;
loginAgain = function() {
setTimeout(function() {
$location.path('/logout');

View File

@ -6,8 +6,8 @@
export default
['GetBasePath', 'ProcessErrors', '$q', 'Rest', '$rootScope',
function (GetBasePath, ProcessErrors, $q, Rest, $rootScope) {
['GetBasePath', 'ProcessErrors', '$q', 'Rest', '$rootScope', 'Wait',
function (GetBasePath, ProcessErrors, $q, Rest, $rootScope, Wait) {
return {
get: function(){
return this.config;
@ -28,9 +28,12 @@ export default
if(_.isEmpty(config)){
var url = GetBasePath('config');
Rest.setUrl(url);
Wait('start');
var promise = Rest.get();
promise.then(function (response) {
var config = response.data;
$rootScope.configReady = true;
Wait('stop');
that.set(config);
deferred.resolve(response.data);
});

View File

@ -46,7 +46,7 @@
<div class="container-fluid" id="content-container">
<div class="row">
<div class="col-lg-12">
<div ui-view id="main-view"></div>
<div ui-view id="main-view" ng-if="configReady"></div>
</div>
</div>