Added custom info, fixed logout bug

This commit is contained in:
Ken Hoes 2016-12-01 11:56:07 -05:00
parent 805d4d1ed6
commit dc4217944d
4 changed files with 38 additions and 18 deletions

View File

@ -232,6 +232,29 @@ export default [
}
};
function loginUpdate() {
// Updates the logo and app config so that logos and info are properly shown
// on logout after modifying.
if($scope.CUSTOM_LOGO) {
$rootScope.custom_logo = $scope.CUSTOM_LOGO;
global.$AnsibleConfig.custom_logo = true;
} else {
$rootScope.custom_logo = '';
global.$AnsibleConfig.custom_logo = false;
}
if($scope.CUSTOM_LOGIN_INFO) {
$rootScope.custom_login_info = $scope.CUSTOM_LOGIN_INFO;
global.$AnsibleConfig.custom_login_info = $scope.CUSTOM_LOGIN_INFO;
} else {
$rootScope.custom_login_info = '';
global.$AnsibleConfig.custom_login_info = false;
}
Store('AnsibleConfig', global.$AnsibleConfig);
$scope.$broadcast('loginUpdated');
}
$scope.resetValue = function(key) {
Wait('start');
@ -275,21 +298,6 @@ export default [
}
}
function loginUpdate() {
// Updates the logo and app config so that logos are properly shown
// on logout after modifying.
if($scope.CUSTOM_LOGO) {
$rootScope.custom_logo = $scope.$parent.CUSTOM_LOGO;
global.$AnsibleConfig.custom_logo = true;
Store('AnsibleConfig', global.$AnsibleConfig);
} else {
$rootScope.custom_logo = '';
global.$AnsibleConfig.custom_logo = false;
Store('AnsibleConfig', global.$AnsibleConfig);
}
$scope.$broadcast('loginUpdated');
}
// Some dropdowns are listed as "list" type in the API even though they're a dropdown:
var multiselectDropdowns = ['AD_HOC_COMMANDS'];
var formSave = function() {

View File

@ -22,6 +22,11 @@ export default function() {
reset: 'CUSTOM_LOGO',
control: `<image-upload key="CUSTOM_LOGO"></image-upload>`
},
CUSTOM_LOGIN_INFO: {
type: 'textarea',
reset: 'CUSTOM_LOGIN_INFO',
rows: 6
}
},
buttons: {

View File

@ -85,11 +85,19 @@ angular.module('LoadConfigHelper', ['Utilities'])
if(response.custom_logo) {
configSettings.custom_logo = true;
$rootScope.custom_logo = response.custom_logo;
configInit();
} else {
configSettings.custom_logo = false;
configInit();
}
if(response.custom_login_info) {
configSettings.custom_login_info = response.custom_login_info;
$rootScope.custom_login_info = response.custom_login_info;
} else {
configSettings.custom_login_info = false;
}
configInit();
}).error(function(error) {
console.log(error);
});

View File

@ -99,7 +99,6 @@ export default ['$log', '$cookieStore', '$compile', '$window', '$rootScope',
scope.customLogo = "tower-logo-login.svg";
scope.customLogoPresent = false;
}
scope.customLoginInfo = $AnsibleConfig.custom_login_info;
scope.customLoginInfoPresent = (scope.customLoginInfo) ? true : false;
});