mirror of
https://github.com/ansible/awx.git
synced 2026-05-16 05:47:38 -02:30
Merge pull request #3581 from beeankha/basic_license_feature
Update Basic License Feature Access Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
@@ -61,27 +61,6 @@ export default {
|
||||
return qs.search(path, stateParams);
|
||||
}
|
||||
],
|
||||
features: ['FeaturesService', '$state', '$rootScope',
|
||||
function(FeaturesService, $state, $rootScope) {
|
||||
var features = FeaturesService.get();
|
||||
if (features) {
|
||||
if (FeaturesService.featureEnabled('activity_streams')) {
|
||||
return features;
|
||||
} else {
|
||||
$state.go('dashboard');
|
||||
}
|
||||
}
|
||||
$rootScope.featuresConfigured.promise.then(function(features) {
|
||||
if (features) {
|
||||
if (FeaturesService.featureEnabled('activity_streams')) {
|
||||
return features;
|
||||
} else {
|
||||
$state.go('dashboard');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
],
|
||||
subTitle: ['$stateParams', 'Rest', 'ModelToBasePathKey', 'GetBasePath',
|
||||
'ProcessErrors',
|
||||
function($stateParams, rest, ModelToBasePathKey, getBasePath,
|
||||
|
||||
@@ -91,7 +91,6 @@ angular
|
||||
'templates',
|
||||
'PromptDialog',
|
||||
'AWDirectives',
|
||||
'features',
|
||||
|
||||
instanceGroups,
|
||||
atFeatures,
|
||||
@@ -166,11 +165,11 @@ angular
|
||||
'CheckLicense', '$location', 'Authorization', 'LoadBasePaths', 'Timer',
|
||||
'LoadConfig', 'Store', 'pendoService', 'Prompt', 'Rest',
|
||||
'Wait', 'ProcessErrors', '$state', 'GetBasePath', 'ConfigService',
|
||||
'FeaturesService', '$filter', 'SocketService', 'AppStrings', '$transitions',
|
||||
'$filter', 'SocketService', 'AppStrings', '$transitions',
|
||||
function($stateExtender, $q, $compile, $cookies, $rootScope, $log, $stateParams,
|
||||
CheckLicense, $location, Authorization, LoadBasePaths, Timer,
|
||||
LoadConfig, Store, pendoService, Prompt, Rest, Wait,
|
||||
ProcessErrors, $state, GetBasePath, ConfigService, FeaturesService,
|
||||
ProcessErrors, $state, GetBasePath, ConfigService,
|
||||
$filter, SocketService, AppStrings, $transitions) {
|
||||
|
||||
$rootScope.$state = $state;
|
||||
@@ -381,7 +380,6 @@ angular
|
||||
SocketService.init();
|
||||
pendoService.issuePendoIdentity();
|
||||
CheckLicense.test();
|
||||
FeaturesService.get();
|
||||
if ($location.$$path === "/home" && $state.current && $state.current.name === "") {
|
||||
$state.go('dashboard');
|
||||
} else if ($location.$$path === "/portal" && $state.current && $state.current.name === "") {
|
||||
@@ -413,9 +411,9 @@ angular
|
||||
// create a promise that will resolve state $AnsibleConfig is loaded
|
||||
$rootScope.loginConfig = $q.defer();
|
||||
}
|
||||
if (!$rootScope.featuresConfigured) {
|
||||
// create a promise that will resolve when features are loaded
|
||||
$rootScope.featuresConfigured = $q.defer();
|
||||
if (!$rootScope.basePathsLoaded) {
|
||||
// create a promise that will resolve when base paths are loaded
|
||||
$rootScope.basePathsLoaded = $q.defer();
|
||||
}
|
||||
$rootScope.licenseMissing = true;
|
||||
//the authorization controller redirects to the home page automatcially if there is no last path defined. in order to override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export default
|
||||
['templateUrl', '$state', 'FeaturesService','$rootScope', 'Store', 'Empty', '$window', 'BreadCrumbService', 'i18n', '$transitions',
|
||||
function(templateUrl, $state, FeaturesService, $rootScope, Store, Empty, $window, BreadCrumbService, i18n, $transitions) {
|
||||
['templateUrl', '$state', '$rootScope', 'Store', 'Empty', '$window', 'BreadCrumbService', 'i18n', '$transitions',
|
||||
function(templateUrl, $state, $rootScope, Store, Empty, $window, BreadCrumbService, i18n, $transitions) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: templateUrl('bread-crumb/bread-crumb'),
|
||||
@@ -28,40 +28,23 @@ export default
|
||||
streamConfig = (trans.to() && trans.to().data) ? trans.to().data : {};
|
||||
|
||||
if(streamConfig && streamConfig.activityStream) {
|
||||
|
||||
// Check to see if activity_streams is an enabled feature. $transition.onSuccess fires
|
||||
// after the resolve on the state declaration so features should be available at this
|
||||
// point. We use the get() function call here just in case the features aren't available.
|
||||
// The get() function will only fire off the server call if the features aren't already
|
||||
// attached to the $rootScope.
|
||||
var features = FeaturesService.get();
|
||||
if(features){
|
||||
scope.loadingLicense = false;
|
||||
scope.activityStreamActive = (trans.to().name === 'activityStream') ? true : false;
|
||||
scope.activityStreamTooltip = (trans.to().name === 'activityStream') ? i18n._('Hide Activity Stream') : i18n._('View Activity Stream');
|
||||
scope.showActivityStreamButton = (FeaturesService.featureEnabled('activity_streams') || trans.to().name ==='activityStream') ? true : false;
|
||||
}
|
||||
scope.loadingLicense = false;
|
||||
scope.activityStreamActive = (trans.to().name === 'activityStream') ? true : false;
|
||||
scope.activityStreamTooltip = (trans.to().name === 'activityStream') ? i18n._('Hide Activity Stream') : i18n._('View Activity Stream');
|
||||
scope.showActivityStreamButton = true;
|
||||
}
|
||||
else {
|
||||
|
||||
scope.showActivityStreamButton = false;
|
||||
|
||||
}
|
||||
|
||||
scope.showRefreshButton = (streamConfig && streamConfig.refreshButton) ? true : false;
|
||||
scope.alwaysShowRefreshButton = (streamConfig && streamConfig.alwaysShowRefreshButton) ? true: false;
|
||||
});
|
||||
|
||||
// scope.$on('featuresLoaded', function(){
|
||||
$rootScope.featuresConfigured.promise.then(function(features){
|
||||
// var features = FeaturesService.get();
|
||||
if(features){
|
||||
scope.loadingLicense = false;
|
||||
scope.activityStreamActive = ($state.current.name === 'activityStream') ? true : false;
|
||||
scope.activityStreamTooltip = ($state.current.name === 'activityStream') ? 'Hide Activity Stream' : 'View Activity Stream';
|
||||
scope.showActivityStreamButton = ((FeaturesService.featureEnabled('activity_streams') && streamConfig && streamConfig.activityStream) || $state.current.name ==='activityStream') ? true : false;
|
||||
}
|
||||
});
|
||||
scope.loadingLicense = false;
|
||||
scope.activityStreamActive = ($state.current.name === 'activityStream') ? true : false;
|
||||
scope.activityStreamTooltip = ($state.current.name === 'activityStream') ? 'Hide Activity Stream' : 'View Activity Stream';
|
||||
scope.showActivityStreamButton = ((streamConfig && streamConfig.activityStream) || $state.current.name ==='activityStream') ? true : false;
|
||||
|
||||
function onResize(){
|
||||
BreadCrumbService.truncateCrumbs();
|
||||
|
||||
@@ -107,7 +107,7 @@ export default ['i18n', function(i18n) {
|
||||
},
|
||||
save: {
|
||||
ngClick: 'vm.formSave()',
|
||||
ngDisabled: "!ldap_auth || configuration_ldap_template_form.$invalid || configuration_ldap_template_form.$pending"
|
||||
ngDisabled: "configuration_ldap_template_form.$invalid || configuration_ldap_template_form.$pending"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -107,7 +107,7 @@ export default ['i18n', function(i18n) {
|
||||
},
|
||||
save: {
|
||||
ngClick: 'vm.formSave()',
|
||||
ngDisabled: "!ldap_auth || configuration_ldap1_template_form.$invalid || configuration_ldap1_template_form.$pending"
|
||||
ngDisabled: "configuration_ldap1_template_form.$invalid || configuration_ldap1_template_form.$pending"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -107,7 +107,7 @@ export default ['i18n', function(i18n) {
|
||||
},
|
||||
save: {
|
||||
ngClick: 'vm.formSave()',
|
||||
ngDisabled: "!ldap_auth || configuration_ldap2_template_form.$invalid || configuration_ldap2_template_form.$pending"
|
||||
ngDisabled: "configuration_ldap2_template_form.$invalid || configuration_ldap2_template_form.$pending"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -39,7 +39,7 @@ export default ['i18n', function(i18n) {
|
||||
},
|
||||
save: {
|
||||
ngClick: 'vm.formSave()',
|
||||
ngDisabled: "!enterprise_auth || configuration_radius_template_form.$invalid || configuration_radius_template_form.$pending"
|
||||
ngDisabled: "configuration_radius_template_form.$invalid || configuration_radius_template_form.$pending"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -126,7 +126,7 @@ export default ['i18n', function(i18n) {
|
||||
},
|
||||
save: {
|
||||
ngClick: 'vm.formSave()',
|
||||
ngDisabled: "!enterprise_auth || configuration_saml_template_form.$invalid || configuration_saml_template_form.$pending"
|
||||
ngDisabled: "configuration_saml_template_form.$invalid || configuration_saml_template_form.$pending"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -52,7 +52,7 @@ export default ['i18n', function(i18n) {
|
||||
},
|
||||
save: {
|
||||
ngClick: 'vm.formSave()',
|
||||
ngDisabled: "!enterprise_auth || configuration_tacacs_template_form.$invalid || configuration_tacacs_template_form.$pending"
|
||||
ngDisabled: "configuration_tacacs_template_form.$invalid || configuration_tacacs_template_form.$pending"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -81,13 +81,13 @@ export default [
|
||||
$scope.configDataResolve = configDataResolve;
|
||||
$scope.formDefs = formDefs;
|
||||
|
||||
// check if it's auditor, show messageBar
|
||||
// check if it's auditor, show messageBar
|
||||
$scope.show_auditor_bar = false;
|
||||
if($rootScope.user_is_system_auditor && Store('show_auditor_bar') !== false) {
|
||||
$scope.show_auditor_bar = true;
|
||||
} else {
|
||||
$scope.show_auditor_bar = false;
|
||||
}
|
||||
}
|
||||
|
||||
var populateFromApi = function() {
|
||||
SettingsService.getCurrentValues()
|
||||
@@ -145,19 +145,6 @@ export default [
|
||||
});
|
||||
$scope.$broadcast('populated', data);
|
||||
});
|
||||
ConfigService.getConfig()
|
||||
.then(function(data) {
|
||||
$scope.ldap_auth = data.license_info.features.ldap;
|
||||
$scope.enterprise_auth = data.license_info.features.enterprise_auth;
|
||||
})
|
||||
.catch(function(data, status) {
|
||||
ProcessErrors($scope, data, status, null,
|
||||
{
|
||||
hdr: i18n._('Error'),
|
||||
msg: i18n._('There was an error getting config values: ') + status
|
||||
}
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
populateFromApi();
|
||||
|
||||
@@ -23,7 +23,7 @@ export default {
|
||||
resolve: {
|
||||
graphData: ['$q', 'jobStatusGraphData', '$rootScope',
|
||||
function($q, jobStatusGraphData, $rootScope) {
|
||||
return $rootScope.featuresConfigured.promise.then(function() {
|
||||
return $rootScope.basePathsLoaded.promise.then(function() {
|
||||
return $q.all({
|
||||
jobStatus: jobStatusGraphData.get("month", "all"),
|
||||
});
|
||||
|
||||
@@ -9,9 +9,9 @@ import {N_} from "../i18n";
|
||||
export default
|
||||
['Wait', '$state', '$scope', '$rootScope',
|
||||
'ProcessErrors', 'CheckLicense', 'moment','$window',
|
||||
'ConfigService', 'FeaturesService', 'pendoService', 'insightsEnablementService', 'i18n', 'config',
|
||||
'ConfigService', 'pendoService', 'insightsEnablementService', 'i18n', 'config',
|
||||
function(Wait, $state, $scope, $rootScope, ProcessErrors, CheckLicense, moment,
|
||||
$window, ConfigService, FeaturesService, pendoService, insightsEnablementService, i18n, config) {
|
||||
$window, ConfigService, pendoService, insightsEnablementService, i18n, config) {
|
||||
|
||||
const calcDaysRemaining = function(seconds) {
|
||||
// calculate the number of days remaining on the license
|
||||
@@ -105,8 +105,6 @@ export default
|
||||
ConfigService.delete();
|
||||
ConfigService.getConfig(licenseInfo)
|
||||
.then(function(config) {
|
||||
delete($rootScope.features);
|
||||
FeaturesService.get();
|
||||
|
||||
if ($rootScope.licenseMissing === true) {
|
||||
if ($scope.newLicense.pendo) {
|
||||
|
||||
@@ -42,10 +42,10 @@
|
||||
export default ['$log', '$cookies', '$compile', '$rootScope',
|
||||
'$location', 'Authorization', 'Alert', 'Wait', 'Timer',
|
||||
'Empty', '$scope', 'pendoService', 'ConfigService',
|
||||
'CheckLicense', 'FeaturesService', 'SocketService',
|
||||
'CheckLicense', 'SocketService',
|
||||
function ($log, $cookies, $compile, $rootScope, $location,
|
||||
Authorization, Alert, Wait, Timer, Empty,
|
||||
scope, pendoService, ConfigService, CheckLicense, FeaturesService,
|
||||
scope, pendoService, ConfigService, CheckLicense,
|
||||
SocketService) {
|
||||
var lastPath, lastUser, sessionExpired, loginAgain, preAuthUrl;
|
||||
|
||||
@@ -97,7 +97,6 @@ export default ['$log', '$cookies', '$compile', '$rootScope',
|
||||
ConfigService.getConfig().then(function(){
|
||||
CheckLicense.test();
|
||||
pendoService.issuePendoIdentity();
|
||||
FeaturesService.get();
|
||||
Wait("stop");
|
||||
if(!Empty(preAuthUrl)){
|
||||
$location.path(preAuthUrl);
|
||||
|
||||
@@ -48,9 +48,6 @@ let lists = [{
|
||||
activityStreamTarget: 'organization'
|
||||
},
|
||||
resolve: {
|
||||
features: ['FeaturesService', function(FeaturesService) {
|
||||
return FeaturesService.get();
|
||||
}],
|
||||
OrgUsersDataset: ['OrgUserList', 'QuerySet', '$stateParams', 'GetBasePath',
|
||||
function(list, qs, $stateParams, GetBasePath) {
|
||||
let path = GetBasePath(list.basePath) || list.basePath;
|
||||
@@ -98,9 +95,6 @@ let lists = [{
|
||||
label: N_("TEAMS")
|
||||
},
|
||||
resolve: {
|
||||
features: ['FeaturesService', function(FeaturesService) {
|
||||
return FeaturesService.get();
|
||||
}],
|
||||
OrgTeamList: ['TeamList', 'GetBasePath', '$stateParams', 'i18n', function(TeamList, GetBasePath, $stateParams, i18n) {
|
||||
let list = _.cloneDeep(TeamList);
|
||||
delete list.actions.add;
|
||||
@@ -144,9 +138,6 @@ let lists = [{
|
||||
label: N_("INVENTORIES")
|
||||
},
|
||||
resolve: {
|
||||
features: ['FeaturesService', function(FeaturesService) {
|
||||
return FeaturesService.get();
|
||||
}],
|
||||
OrgInventoryList: ['InventoryList', 'GetBasePath', '$stateParams', 'i18n', function(InventoryList, GetBasePath, $stateParams, i18n) {
|
||||
let list = _.cloneDeep(InventoryList);
|
||||
delete list.actions.add;
|
||||
@@ -196,9 +187,6 @@ let lists = [{
|
||||
label: N_("PROJECTS")
|
||||
},
|
||||
resolve: {
|
||||
features: ['FeaturesService', function(FeaturesService) {
|
||||
return FeaturesService.get();
|
||||
}],
|
||||
OrgProjectList: ['ProjectList', 'GetBasePath', '$stateParams', 'i18n', function(ProjectList, GetBasePath, $stateParams, i18n) {
|
||||
let list = _.cloneDeep(ProjectList);
|
||||
delete list.actions;
|
||||
@@ -258,9 +246,6 @@ let lists = [{
|
||||
label: N_("ADMINS")
|
||||
},
|
||||
resolve: {
|
||||
features: ['FeaturesService', function(FeaturesService) {
|
||||
return FeaturesService.get();
|
||||
}],
|
||||
OrgAdminsDataset: ['OrgAdminList', 'QuerySet', '$stateParams', 'GetBasePath',
|
||||
function(list, qs, $stateParams, GetBasePath) {
|
||||
let path = GetBasePath(list.basePath) || list.basePath;
|
||||
|
||||
@@ -32,7 +32,6 @@ export default [function() {
|
||||
mode: 'all', // One of: edit, select, all
|
||||
ngClick: 'addOrganization()',
|
||||
awToolTip: 'Create a new organization',
|
||||
awFeature: 'multiple_organizations',
|
||||
actionClass: 'at-Button--add',
|
||||
actionId: 'button-add'
|
||||
}
|
||||
|
||||
@@ -36,11 +36,17 @@ angular.module('ApiLoader', ['Utilities'])
|
||||
data.base = base;
|
||||
$rootScope.defaultUrls = data;
|
||||
Store('api', data);
|
||||
if($rootScope.basePathsLoaded){
|
||||
$rootScope.basePathsLoaded.resolve();
|
||||
}
|
||||
})
|
||||
.catch(({data, status}) => {
|
||||
$rootScope.defaultUrls = {
|
||||
status: 'error'
|
||||
};
|
||||
if($rootScope.basePathsLoaded){
|
||||
$rootScope.basePathsLoaded.reject();
|
||||
}
|
||||
ProcessErrors(null, data, status, null, {
|
||||
hdr: 'Error',
|
||||
msg: 'Failed to read ' + base + '. GET status: ' + status
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
/*************************************************
|
||||
* Copyright (c) 2015 Ansible, Inc.
|
||||
*
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
|
||||
export default ['$rootScope', function ($rootScope) {
|
||||
|
||||
this.isFeatureEnabled = function(feature){
|
||||
if(_.isEmpty($rootScope.features)){
|
||||
return false;
|
||||
} else{
|
||||
return $rootScope.features[feature] || false;
|
||||
}
|
||||
};
|
||||
}];
|
||||
@@ -1,41 +0,0 @@
|
||||
/*************************************************
|
||||
* Copyright (c) 2015 Ansible, Inc.
|
||||
*
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
|
||||
/**
|
||||
* @ngdoc overview
|
||||
* @name features
|
||||
* @scope
|
||||
* @description enables/disables features based on license
|
||||
*
|
||||
* @ngdoc directive
|
||||
* @name features.directive:awFeature
|
||||
* @description The aw-feature directive works by taking in a string
|
||||
* that maps to a license feature, and removes that feature from the
|
||||
* DOM if it is a feature not supported by the user's license.
|
||||
* For example, adding `aw-feature="system-tracking"` will enable or disable
|
||||
* the system tracking button based on the license configuration on the
|
||||
* /config endpoint.
|
||||
*
|
||||
*
|
||||
*/
|
||||
import featureController from './features.controller';
|
||||
|
||||
export default [ '$rootScope', function($rootScope) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
controller: featureController,
|
||||
link: function (scope, element, attrs, controller){
|
||||
if(attrs.awFeature.length > 0){
|
||||
$rootScope.featuresConfigured.promise.then(function() {
|
||||
if(!controller.isFeatureEnabled(attrs.awFeature)){
|
||||
element.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
}];
|
||||
@@ -1,35 +0,0 @@
|
||||
/*************************************************
|
||||
* Copyright (c) 2015 Ansible, Inc.
|
||||
*
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
|
||||
export default ['$rootScope', 'ConfigService',
|
||||
function ($rootScope, ConfigService) {
|
||||
return {
|
||||
get: function(){
|
||||
if (_.isEmpty($rootScope.features)) {
|
||||
var config = ConfigService.get();
|
||||
if(config){
|
||||
$rootScope.features = config.license_info.features;
|
||||
if($rootScope.featuresConfigured){
|
||||
$rootScope.featuresConfigured.resolve($rootScope.features);
|
||||
}
|
||||
return $rootScope.features;
|
||||
}
|
||||
}
|
||||
else{
|
||||
return $rootScope.features;
|
||||
}
|
||||
},
|
||||
|
||||
featureEnabled: function(feature) {
|
||||
if($rootScope.features && $rootScope.features[feature] && $rootScope.features[feature] === true) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
}];
|
||||
@@ -1,13 +0,0 @@
|
||||
/*************************************************
|
||||
* Copyright (c) 2015 Ansible, Inc.
|
||||
*
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
|
||||
import awFeatureDirective from './features.directive';
|
||||
import FeaturesService from './features.service';
|
||||
|
||||
export default
|
||||
angular.module('features', [])
|
||||
.directive('awFeature', awFeatureDirective)
|
||||
.service('FeaturesService', FeaturesService);
|
||||
@@ -718,7 +718,6 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
html += "'";
|
||||
html += (field.ngShow) ? this.attr(field, 'ngShow') : "";
|
||||
html += (field.ngHide) ? this.attr(field, 'ngHide') : "";
|
||||
html += (field.awFeature) ? "aw-feature=\"" + field.awFeature + "\" " : "";
|
||||
html += ">\n";
|
||||
|
||||
var definedInFileMessage = i18n._('This setting has been set manually in a settings file and is now disabled.');
|
||||
@@ -1511,9 +1510,6 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
if (button.ngClick) {
|
||||
html += this.attr(button, 'ngClick');
|
||||
}
|
||||
if (button.awFeature) {
|
||||
html += this.attr(button, 'awFeature');
|
||||
}
|
||||
if (button.ngDisabled) {
|
||||
ngDisabled = (button.ngDisabled===true) ? this.form.name+"_form.$invalid" : button.ngDisabled;
|
||||
if (itm !== 'reset') {
|
||||
@@ -1561,9 +1557,6 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
if(button.ngShow){
|
||||
html += this.attr(button, 'ngShow');
|
||||
}
|
||||
if (button.awFeature) {
|
||||
html += this.attr(button, 'awFeature');
|
||||
}
|
||||
if(button.awToolTip) {
|
||||
html += " aw-tool-tip='" + button.awToolTip + "' data-placement='" + button.dataPlacement + "' data-tip-watch='" + button.dataTipWatch + "'";
|
||||
}
|
||||
@@ -1728,9 +1721,6 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
if (button.ngClick) {
|
||||
html += this.attr(button, 'ngClick');
|
||||
}
|
||||
if (button.awFeature) {
|
||||
html += this.attr(button, 'awFeature');
|
||||
}
|
||||
if (button.ngDisabled) {
|
||||
ngDisabled = (button.ngDisabled===true) ? `${this.form.name}_form.$invalid || ${this.form.name}_form.$pending`: button.ngDisabled;
|
||||
if (btn !== 'reset') {
|
||||
|
||||
@@ -718,7 +718,6 @@ angular.module('GeneratorHelpers', [systemStatus.name])
|
||||
html += (options.ngClick) ? "ng-click=\"$eval(" + options.ngClick + ")\" " : "";
|
||||
html += (options.ngShow) ? "ng-show=\"" + options.ngShow + "\" " : "";
|
||||
html += (options.ngHide) ? "ng-hide=\"" + options.ngHide + "\" " : "";
|
||||
html += (options.awFeature) ? "aw-feature=\"" + options.awFeature + "\" " : "";
|
||||
html += '>';
|
||||
html += '<span translate>';
|
||||
html += (options.buttonContent) ? options.buttonContent : "";
|
||||
|
||||
@@ -21,8 +21,7 @@
|
||||
ng-disabled="{{options.ngDisabled}}"
|
||||
ng-show="{{options.ngShow}}"
|
||||
ng-click="$eval(options.ngClick)"
|
||||
toolbar="true"
|
||||
aw-feature="{{options.awFeature}}">
|
||||
toolbar="true">
|
||||
<span ng-bind-html="options.buttonContent" translate></span>
|
||||
</button>
|
||||
</span>
|
||||
@@ -49,8 +48,7 @@
|
||||
ng-disabled="{{options.ngDisabled}}"
|
||||
ng-click="$eval(options.ngClick)"
|
||||
ng-show="{{options.ngShow}}"
|
||||
toolbar="true"
|
||||
aw-feature="{{options.awFeature}}">
|
||||
toolbar="true">
|
||||
<span ng-if="options.buttonContent" ng-bind-html="options.buttonContent" translate></span>
|
||||
</button>
|
||||
</span>
|
||||
|
||||
@@ -28,7 +28,6 @@ import moment from './moment/main';
|
||||
import config from './config/main';
|
||||
import PromptDialog from './prompt-dialog';
|
||||
import directives from './directives';
|
||||
import features from './features/main';
|
||||
import orgAdminLookup from './org-admin-lookup/main';
|
||||
import limitPanels from './limit-panels/main';
|
||||
import multiSelectPreview from './multi-select-preview/main';
|
||||
@@ -60,7 +59,6 @@ angular.module('shared', [
|
||||
PromptDialog.name,
|
||||
directives.name,
|
||||
filters.name,
|
||||
features.name,
|
||||
orgAdminLookup.name,
|
||||
limitPanels.name,
|
||||
multiSelectPreview.name,
|
||||
|
||||
@@ -4,10 +4,8 @@
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
|
||||
// import awFeatureDirective from './features.directive';
|
||||
import socketService from './socket.service';
|
||||
|
||||
export default
|
||||
angular.module('socket', [])
|
||||
// .directive('awFeature', awFeatureDirective)
|
||||
.service('SocketService', socketService);
|
||||
|
||||
@@ -480,7 +480,6 @@ function(NotificationsList, i18n) {
|
||||
relatedButtons: {
|
||||
view_survey: {
|
||||
ngClick: 'editSurvey()',
|
||||
awFeature: 'surveys',
|
||||
ngShow: '($state.is(\'templates.addJobTemplate\') || $state.is(\'templates.editJobTemplate\')) && survey_exists && !(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)',
|
||||
label: i18n._('View Survey'),
|
||||
class: 'Form-primaryButton'
|
||||
@@ -488,7 +487,6 @@ function(NotificationsList, i18n) {
|
||||
add_survey: {
|
||||
ngClick: 'addSurvey()',
|
||||
ngShow: '($state.is(\'templates.addJobTemplate\') || $state.is(\'templates.editJobTemplate\')) && !survey_exists && (job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)',
|
||||
awFeature: 'surveys',
|
||||
awToolTip: '{{surveyTooltip}}',
|
||||
dataPlacement: 'top',
|
||||
label: i18n._('Add Survey'),
|
||||
@@ -496,7 +494,6 @@ function(NotificationsList, i18n) {
|
||||
},
|
||||
edit_survey: {
|
||||
ngClick: 'editSurvey()',
|
||||
awFeature: 'surveys',
|
||||
ngShow: '($state.is(\'templates.addJobTemplate\') || $state.is(\'templates.editJobTemplate\')) && survey_exists && (job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)',
|
||||
label: i18n._('Edit Survey'),
|
||||
class: 'Form-primaryButton',
|
||||
|
||||
@@ -226,7 +226,6 @@ export default ['NotificationsList', 'i18n', function(NotificationsList, i18n) {
|
||||
relatedButtons: {
|
||||
view_survey: {
|
||||
ngClick: 'editSurvey()',
|
||||
awFeature: 'surveys',
|
||||
ngShow: '($state.is(\'templates.addWorkflowJobTemplate\') || $state.is(\'templates.editWorkflowJobTemplate\') || $state.is(\'templates.editWorkflowJobTemplate.workflowMaker\')) && survey_exists && !(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddWorkflowJobTemplate)',
|
||||
label: i18n._('View Survey'),
|
||||
class: 'Form-primaryButton'
|
||||
@@ -234,7 +233,6 @@ export default ['NotificationsList', 'i18n', function(NotificationsList, i18n) {
|
||||
add_survey: {
|
||||
ngClick: 'addSurvey()',
|
||||
ngShow: '!survey_exists && ($state.is(\'templates.addWorkflowJobTemplate\') || $state.is(\'templates.editWorkflowJobTemplate\') || $state.is(\'templates.editWorkflowJobTemplate.workflowMaker\'))',
|
||||
awFeature: 'surveys',
|
||||
awToolTip: '{{surveyTooltip}}',
|
||||
dataPlacement: 'top',
|
||||
label: i18n._('Add Survey'),
|
||||
@@ -242,7 +240,6 @@ export default ['NotificationsList', 'i18n', function(NotificationsList, i18n) {
|
||||
},
|
||||
edit_survey: {
|
||||
ngClick: 'editSurvey()',
|
||||
awFeature: 'surveys',
|
||||
ngShow: 'survey_exists && ($state.is(\'templates.addWorkflowJobTemplate\') || $state.is(\'templates.editWorkflowJobTemplate\') || $state.is(\'templates.editWorkflowJobTemplate.workflowMaker\'))',
|
||||
label: i18n._('Edit Survey'),
|
||||
class: 'Form-primaryButton',
|
||||
|
||||
@@ -35,7 +35,6 @@ register(
|
||||
'custom HTML or other markup languages are not supported.'),
|
||||
category=_('UI'),
|
||||
category_slug='ui',
|
||||
feature_required='rebranding',
|
||||
)
|
||||
|
||||
register(
|
||||
@@ -50,7 +49,6 @@ register(
|
||||
placeholder='data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACwAAAAAAQABAAACAkQBADs=',
|
||||
category=_('UI'),
|
||||
category_slug='ui',
|
||||
feature_required='rebranding',
|
||||
)
|
||||
|
||||
register(
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
describe('Directive: Features enabled/disabled', () => {
|
||||
let $compile,
|
||||
$scope,
|
||||
q;
|
||||
|
||||
beforeEach(angular.mock.module('features'));
|
||||
|
||||
beforeEach(angular.mock.inject((_$compile_, _$rootScope_, $q) => {
|
||||
$compile = _$compile_;
|
||||
$scope = _$rootScope_;
|
||||
q = $q;
|
||||
|
||||
$scope.featuresConfigured = q.defer();
|
||||
}));
|
||||
|
||||
it('Removes the element if feature is disabled', () => {
|
||||
let element = $compile("<div aw-feature='system-tracking'></div")($scope);
|
||||
$scope.$digest();
|
||||
expect(element.html()).toBe('');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user