Hide AS/Dashboard button for basic licenses

#1791
This commit is contained in:
Akita Noek
2016-05-16 10:28:40 -04:00
parent 666e8fff92
commit 01e01fdb82
3 changed files with 11 additions and 3 deletions

View File

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

View File

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

View File

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