1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

unpromisifying the logout() function call

and fix for other PR feedback
This commit is contained in:
Jared Tabor 2016-06-16 10:51:31 -07:00
parent c6879e5163
commit 322451853d
7 changed files with 22 additions and 30 deletions

View File

@ -1,4 +1,4 @@
<div id="bread_crumb" class="BreadCrumb" ng-class="{'is-loggedOut' : !current_user.username}">
<div id="bread_crumb" class="BreadCrumb" ng-class="{'is-loggedOut' : !current_user && !current_user.username}">
<div ng-hide="licenseMissing" ncy-breadcrumb></div>
<div class="BreadCrumb-menuLink"
id="bread_crumb_activity_stream"

View File

@ -1,3 +1,3 @@
<footer class='Footer'>
<div class="Footer-copyright" ng-class="{'is-loggedOut' : !current_user.username}">Copyright &copy 2016 <a class="Footer-link" href="http://www.redhat.com" target="_blank">Red Hat</a>, Inc.</div>
<div class="Footer-copyright" ng-class="{'is-loggedOut' : !current_user && !current_user.username}">Copyright &copy 2016 <a class="Footer-link" href="http://www.redhat.com" target="_blank">Red Hat</a>, Inc.</div>
</footer>

View File

@ -63,14 +63,13 @@ export default
// the following puts our primary scope up for garbage collection, which
// should prevent content flash from the prior user.
var x, deferred = $q.defer(),
var x,
ConfigService = $injector.get('ConfigService'),
scope = angular.element(document.getElementById('main-view')).scope();
if(scope){
scope.$destroy();
}
//$rootScope.$destroy();
if($cookieStore.get('lastPath')==='/portal'){
$cookieStore.put( 'lastPath', '/portal');
@ -113,8 +112,6 @@ export default
if ($rootScope.sessionTimer) {
$rootScope.sessionTimer.clearTimers();
}
deferred.resolve();
return deferred.promise;
},
licenseTested: function () {

View File

@ -15,11 +15,9 @@ export default {
function($rootScope, Authorization) {
$rootScope.configReady = true;
if (Authorization.isUserLoggedIn()) {
Authorization.logout().then(function(){
$(".LoginModal-dialog").remove();
});
Authorization.logout();
}
$(".LoginModal-dialog").remove();
}]
},
ncyBreadcrumb: {

View File

@ -1,9 +1,9 @@
<div id="login-modal" class="LoginModal">
<div class="LoginModal-backDrop"
ng-class="{'is-loggedOut' : !current_user.username}"></div>
ng-class="{'is-loggedOut' : !current_user && !current_user.username}"></div>
<div class="LoginModal-dialog">
<div class="LoginModal-content"
ng-class="{'is-loggedOut' : !current_user.username}">
ng-class="{'is-loggedOut' : !current_user && !current_user.username}">
<div class="LoginModal-header">
<img id="login_modal_image" class="LoginModal-logoImage"
ng-class="{'LoginModal-logoImage--notCustom': !customLogoPresent}"

View File

@ -10,11 +10,8 @@ export default {
name: 'signOut',
route: '/logout',
controller: ['Authorization', '$state', function(Authorization, $state) {
Authorization.logout().then(function(){
$state.go('signIn');
});
Authorization.logout();
$state.go('signIn');
}],
ncyBreadcrumb: {
skip: true

View File

@ -3,14 +3,14 @@
<a id="main_menu_logo"
href="/#/"
class="MainMenu-logo ng-cloak"
ng-class="{'is-loggedOut' : !current_user.username, 'MainMenu-logoImage--licenseMissing': licenseMissing}">
ng-class="{'is-loggedOut' : !current_user && !current_user.username, 'MainMenu-logoImage--licenseMissing': licenseMissing}">
<img class="MainMenu-logoImage"
ng-class="{'MainMenu-logoImage--licenseMissing': licenseMissing}"
ng-src="/static/assets/tower-logo-header.svg">
</a>
<!-- Mobile menu items -->
<span id="main_menu_mobile_items" class="MainMenu-mobileItems" ng-class="{'is-hiddenOnMobile': isHiddenOnMobile, 'is-loggedOut' : !current_user.username}">
<span id="main_menu_mobile_items" class="MainMenu-mobileItems" ng-class="{'is-hiddenOnMobile': isHiddenOnMobile, 'is-loggedOut' : !current_user && !current_user.username}">
<a class="MainMenu-item"
id="main_menu_projects_mobile_link"
href="/#/projects"
@ -90,7 +90,7 @@
id="main_menu_projects_link"
href="/#/projects"
ng-hide="licenseMissing"
ng-class="{'is-currentRoute' : isCurrentState('projects'), 'is-loggedOut' : !current_user.username}">
ng-class="{'is-currentRoute' : isCurrentState('projects'), 'is-loggedOut' : !current_user && !current_user.username}">
<span class="MainMenu-itemText">
PROJECTS
</span>
@ -99,7 +99,7 @@
id="main_menu_inventories_link"
href="/#/inventories"
ng-hide="licenseMissing"
ng-class="{'is-currentRoute' : isCurrentState('inventories'), 'is-loggedOut' : !current_user.username}">
ng-class="{'is-currentRoute' : isCurrentState('inventories'), 'is-loggedOut' : !current_user && !current_user.username}">
<span class="MainMenu-itemText">
INVENTORIES
</span>
@ -108,7 +108,7 @@
id="main_menu_job_templates_link"
href="/#/job_templates"
ng-hide="licenseMissing"
ng-class="{'is-currentRoute' : isCurrentState('jobTemplates'), 'is-loggedOut' : !current_user.username}">
ng-class="{'is-currentRoute' : isCurrentState('jobTemplates'), 'is-loggedOut' : !current_user && !current_user.username}">
<span class="MainMenu-itemText">
JOB TEMPLATES
</span>
@ -117,7 +117,7 @@
id="main_menu_jobs_link"
href="/#/jobs"
ng-hide="licenseMissing"
ng-class="{'is-currentRoute' : isCurrentState('jobs'), 'is-loggedOut' : !current_user.username}">
ng-class="{'is-currentRoute' : isCurrentState('jobs'), 'is-loggedOut' : !current_user && !current_user.username}">
<span class="MainMenu-itemText">
JOBS
</span>
@ -126,7 +126,7 @@
id="main_menu_current_user_link"
ng-href="/#/users/{{ $root.current_user.id }}"
ng-hide="licenseMissing"
ng-class="{'is-currentRoute' : isCurrentState('users.edit'), 'is-loggedOut' : !current_user.username}"
ng-class="{'is-currentRoute' : isCurrentState('users.edit'), 'is-loggedOut' : !current_user && !current_user.username}"
aw-tool-tip="{{currentUserTip}}"
aw-tip-watch="currentUserTip"
data-placement="bottom"
@ -143,7 +143,7 @@
id="main_menu_setup_link"
ng-href="/#/setup"
ng-hide="licenseMissing"
ng-class="{'is-currentRoute' : isCurrentState('setup'), 'is-loggedOut' : !current_user.username}"
ng-class="{'is-currentRoute' : isCurrentState('setup'), 'is-loggedOut' : !current_user && !current_user.username}"
aw-tool-tip="Settings"
data-placement="bottom"
data-trigger="hover"
@ -156,7 +156,7 @@
id="main_menu_portal_link"
ng-href="/#/portal"
ng-hide="licenseMissing"
ng-class="{'is-currentRoute' : isCurrentState('portalMode'), 'is-loggedOut' : !current_user.username}"
ng-class="{'is-currentRoute' : isCurrentState('portalMode'), 'is-loggedOut' : !current_user && !current_user.username}"
aw-tool-tip="My View"
data-placement="bottom"
data-trigger="hover"
@ -169,7 +169,7 @@
id="main_menu_docs_link"
ng-href="http://docs.ansible.com/ansible-tower/"
ng-hide="licenseMissing"
ng-class="{'is-loggedOut' : !current_user.username}"
ng-class="{'is-loggedOut' : !current_user && !current_user.username}"
aw-tool-tip="View Documentation"
data-placement="bottom"
data-trigger="hover"
@ -183,7 +183,7 @@
id="main_menu_logout_link"
ng-href="/#/logout"
ng-class="{'is-currentRoute' : isCurrentState('logout'),
'is-loggedOut' : !current_user.username,
'is-loggedOut' : !current_user && !current_user.username,
'MainMenu-item--licenseMissing' : licenseMissing}"
aw-tool-tip="Log Out"
data-placement="bottom"
@ -205,7 +205,7 @@
data-placement="bottom"
data-trigger="hover"
data-container="body"
ng-class="{'is-loggedOut' : !current_user.username}"
ng-class="{'is-loggedOut' : !current_user && !current_user.username}"
ng-hide="licenseMissing"
ng-if="socketStatus && socketStatus !== 'ok'">
<i class="fa MainMenu-socketImage"
@ -218,7 +218,7 @@
id="main_menu_mobile_toggle_button"
class="MainMenu-toggle"
ng-hide="licenseMissing"
ng-class="{'is-active': !isHiddenOnMobile, 'is-loggedOut' : !current_user.username}"
ng-class="{'is-active': !isHiddenOnMobile, 'is-loggedOut' : !current_user && !current_user.username}"
ng-click="toggleMenu()">
<i class="fa fa-bars MainMenu-toggleImage"></i>
</button>