1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 15:21:13 +03:00

AC-301,AC-316 Initialize scope keys in both list generator and form generator.

This commit is contained in:
chouseknecht 2013-07-30 02:09:21 -04:00
parent fa8a697024
commit b904dd2ae5
4 changed files with 15 additions and 11 deletions

View File

@ -30,7 +30,7 @@ function Authenticate($window, $scope, $rootScope, $location, Authorization, Tog
$scope.sessionExpired = false;
}
$rootScope.userLoggedIn = false; //hide the logout link. if you got here, your logged out.
$rootScope.userLoggedIn = false; //hide the logout link. if you got here, you're logged out.
//gets set back to true by Authorization.setToken().
$('#login-password').bind('keypress', function(e) {

View File

@ -5,9 +5,8 @@
*
*/
angular.module('AuthService', ['ngCookies', 'OrganizationFormDefinition'])
.factory('Authorization', ['$http', '$rootScope', '$location', '$cookieStore', 'OrganizationForm',
function($http, $rootScope, $location, $cookieStore, OrganizationForm) {
angular.module('AuthService', ['ngCookies'])
.factory('Authorization', ['$http', '$rootScope', '$location', '$cookieStore', function($http, $rootScope, $location, $cookieStore) {
return {
setToken: function(token) {
// set the session cookie
@ -73,13 +72,6 @@ angular.module('AuthService', ['ngCookies', 'OrganizationFormDefinition'])
scope.$destroy();
$rootScope.$destroy();
// Reset the scope for organizations. No matter what we have tried, nothing seems
// to clear the scope fast enough to prevent prior user's content from displaying
$rootScope['organizations'] = null;
for (var set in OrganizationForm.related) {
$rootScope[set] = null;
}
$cookieStore.remove('accordions');
$cookieStore.remove('token');
$cookieStore.remove('token_expire');

View File

@ -53,6 +53,14 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
// From here use 'scope' to manipulate the form, as the form is not in '$scope'
$compile(element)(this.scope);
// Reset the scope to prevent displaying old data from our last visit to this form
for (var fld in form.fields) {
this.scope[fld] = null;
}
for (var set in form.related) {
this.scope[set] = null;
}
if ( ((!options.modal) && options.related) || this.form.forceListeners ) {
this.addListeners();
}

View File

@ -79,6 +79,10 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
// From here use 'scope' to manipulate the form, as the form is not in '$scope'
$compile(element)(this.scope);
// Reset the scope to prevent displaying old data from our last visit to this list
this.scope[list.name] = null;
this.scope[list.iterator] = null;
if (options.mode == 'lookup') {
// options should include {hdr: <dialog header>, action: <function...> }
this.scope.lookupHeader = options.hdr;