1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 09:51:09 +03:00

Merge pull request #1923 from anoek/1791

Hide AS/Dashboard button for basic licenses
This commit is contained in:
Akita Noek 2016-05-16 14:54:58 -04:00
commit f1e92719e7
3 changed files with 11 additions and 3 deletions

View File

@ -8,6 +8,7 @@ export default
var streamConfig = {};
scope.showActivityStreamButton = false;
scope.loadingLicense = true;
scope.openActivityStream = function() {
@ -39,12 +40,14 @@ export default
FeaturesService.get()
.then(function() {
scope.loadingLicense = false;
if(FeaturesService.featureEnabled('activity_streams')) {
scope.showActivityStreamButton = true;
}
else {
scope.showActivityStreamButton = false;
}
scope.licenseType = FeaturesService.getLicenseInfo()['license_type'];
})
.catch(function (response) {
ProcessErrors(null, response.data, response.status, null, {

View File

@ -8,7 +8,7 @@
data-container="body"
ng-class="{'BreadCrumb-menuLinkActive' : activityStreamActive}"
ng-if="showActivityStreamButton"
ng-hide= "licenseMissing"
ng-hide= "loadingLicense || licenseMissing || licenseType == 'basic'"
ng-click="openActivityStream()">
<i class="BreadCrumb-menuLinkImage icon-activity-stream"
alt="Activity Stream">
@ -21,7 +21,7 @@
data-placement="left"
data-trigger="hover"
data-container="body"
ng-hide="licenseMissing"
ng-hide="loadingLicense || licenseMissing || licenseType == 'basic'"
ng-if="!showActivityStreamButton">
<i class="BreadCrumb-menuLinkImage fa fa-tachometer"
alt="Dashboard">

View File

@ -6,12 +6,15 @@
export default ['$rootScope', 'Rest', 'GetBasePath', 'ProcessErrors', '$http', '$q',
function ($rootScope, Rest, GetBasePath, ProcessErrors, $http, $q) {
var license_info;
return {
getFeatures: function(){
var promise;
Rest.setUrl(GetBasePath('config'));
promise = Rest.get();
return promise.then(function (data) {
license_info = data.data.license_info;
$rootScope.features = data.data.license_info.features;
return $rootScope.features;
}).catch(function (response) {
@ -21,7 +24,6 @@ function ($rootScope, Rest, GetBasePath, ProcessErrors, $http, $q) {
response.status
});
});
},
get: function(){
if(_.isEmpty($rootScope.features)){
@ -39,6 +41,9 @@ function ($rootScope, Rest, GetBasePath, ProcessErrors, $http, $q) {
else {
return false;
}
},
getLicenseInfo: function() {
return license_info;
}
};
}];