mirror of
https://github.com/ansible/awx.git
synced 2026-01-24 16:01:20 -03:30
awLicenseFeature with show/hide changed file locations changing file location adjusting controller logic to only return list of features leveraging $rootScope instead of local storage adding awFeature directive for lists/forms for activity stream button Adding route resolvers and service for getting license In order to get the license info from the API and not from local storage, the UI needs to hit hte API before loading any pages, therefore I've added route resolvers that will ensure that we have the appropriate data (license features) before navigating to a new page. I've also added the awFeature directive to the organizations list -> add-button and the ldap checkbox on the user form page. adjusting alignment fixing jshint errors commting file for testings adding tests for features service and features controller adding features controller unit test
31 lines
1.2 KiB
JavaScript
31 lines
1.2 KiB
JavaScript
export default ['$rootScope', 'Rest', 'GetBasePath', 'ProcessErrors', '$http', '$q',
|
|
function ($rootScope, Rest, GetBasePath, ProcessErrors, $http, $q) {
|
|
return {
|
|
getFeatures: function(){
|
|
var promise;
|
|
Rest.setUrl(GetBasePath('config'));
|
|
promise = Rest.get();
|
|
return promise.then(function (data) {
|
|
$rootScope.features = data.data.license_info.features;
|
|
return $rootScope.features;
|
|
}).catch(function (response) {
|
|
ProcessErrors($rootScope, response.data, response.status, null, {
|
|
hdr: 'Error!',
|
|
msg: 'Failed to get license info. GET returned status: ' +
|
|
response.status
|
|
});
|
|
});
|
|
|
|
},
|
|
get: function(){
|
|
if(_.isEmpty($rootScope.features)){
|
|
return this.getFeatures();
|
|
} else {
|
|
// $q.when will ensure that the result is returned
|
|
// as a resovled promise.
|
|
return $q.when($rootScope.features);
|
|
}
|
|
}
|
|
};
|
|
}];
|