mirror of
https://github.com/ansible/awx.git
synced 2026-03-01 00:38:45 -03:30
Loading the viewport after /config response is returned from the API
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
export default
|
export default
|
||||||
['$scope', '$state', 'CheckLicense', function($scope, $state, CheckLicense){
|
['$scope', '$state', 'ConfigService', function($scope, $state, ConfigService){
|
||||||
var processVersion = function(version){
|
var processVersion = function(version){
|
||||||
// prettify version & calculate padding
|
// prettify version & calculate padding
|
||||||
// e,g 3.0.0-0.git201602191743/ -> 3.0.0
|
// e,g 3.0.0-0.git201602191743/ -> 3.0.0
|
||||||
@@ -16,10 +16,10 @@ export default
|
|||||||
return paddedStr;
|
return paddedStr;
|
||||||
};
|
};
|
||||||
var init = function(){
|
var init = function(){
|
||||||
CheckLicense.get()
|
ConfigService.getConfig()
|
||||||
.then(function(res){
|
.then(function(config){
|
||||||
$scope.subscription = res.data.license_info.subscription_name;
|
$scope.subscription = config.license_info.subscription_name;
|
||||||
$scope.version = processVersion(res.data.version);
|
$scope.version = processVersion(config.version);
|
||||||
$('#about-modal').modal('show');
|
$('#about-modal').modal('show');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -872,6 +872,7 @@ var tower = angular.module('Tower', [
|
|||||||
// User not authenticated, redirect to login page
|
// User not authenticated, redirect to login page
|
||||||
$rootScope.sessionExpired = false;
|
$rootScope.sessionExpired = false;
|
||||||
$cookieStore.put('sessionExpired', false);
|
$cookieStore.put('sessionExpired', false);
|
||||||
|
$rootScope.configReady = true;
|
||||||
$location.path('/login');
|
$location.path('/login');
|
||||||
} else {
|
} else {
|
||||||
// If browser refresh, set the user_is_superuser value
|
// If browser refresh, set the user_is_superuser value
|
||||||
|
|||||||
@@ -323,6 +323,7 @@ export default
|
|||||||
},
|
},
|
||||||
edit_survey: {
|
edit_survey: {
|
||||||
ngClick: 'editSurvey()',
|
ngClick: 'editSurvey()',
|
||||||
|
awFeature: 'surveys',
|
||||||
ngShow: 'job_type.value !== "scan" && survey_exists'
|
ngShow: 'job_type.value !== "scan" && survey_exists'
|
||||||
},
|
},
|
||||||
cancel: {
|
cancel: {
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ export default ['$log', '$cookieStore', '$compile', '$window', '$rootScope',
|
|||||||
|
|
||||||
var lastPath, lastUser, sessionExpired, loginAgain;
|
var lastPath, lastUser, sessionExpired, loginAgain;
|
||||||
|
|
||||||
|
$rootScope.configReady = true;
|
||||||
loginAgain = function() {
|
loginAgain = function() {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$location.path('/logout');
|
$location.path('/logout');
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
|
|
||||||
export default
|
export default
|
||||||
['GetBasePath', 'ProcessErrors', '$q', 'Rest', '$rootScope',
|
['GetBasePath', 'ProcessErrors', '$q', 'Rest', '$rootScope', 'Wait',
|
||||||
function (GetBasePath, ProcessErrors, $q, Rest, $rootScope) {
|
function (GetBasePath, ProcessErrors, $q, Rest, $rootScope, Wait) {
|
||||||
return {
|
return {
|
||||||
get: function(){
|
get: function(){
|
||||||
return this.config;
|
return this.config;
|
||||||
@@ -28,9 +28,12 @@ export default
|
|||||||
if(_.isEmpty(config)){
|
if(_.isEmpty(config)){
|
||||||
var url = GetBasePath('config');
|
var url = GetBasePath('config');
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
|
Wait('start');
|
||||||
var promise = Rest.get();
|
var promise = Rest.get();
|
||||||
promise.then(function (response) {
|
promise.then(function (response) {
|
||||||
var config = response.data;
|
var config = response.data;
|
||||||
|
$rootScope.configReady = true;
|
||||||
|
Wait('stop');
|
||||||
that.set(config);
|
that.set(config);
|
||||||
deferred.resolve(response.data);
|
deferred.resolve(response.data);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
<div class="container-fluid" id="content-container">
|
<div class="container-fluid" id="content-container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<div ui-view id="main-view"></div>
|
<div ui-view id="main-view" ng-if="configReady"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user