mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 14:57:39 -02:30
Use existing config service for license_type checks
This commit is contained in:
@@ -11,12 +11,17 @@ function getTruncatedVersion () {
|
|||||||
|
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isOpen () {
|
||||||
|
return this.get('license_info.license_type') === 'open';
|
||||||
|
}
|
||||||
|
|
||||||
function ConfigModel (method, resource, graft) {
|
function ConfigModel (method, resource, graft) {
|
||||||
BaseModel.call(this, 'config', { cache: true });
|
BaseModel.call(this, 'config', { cache: true });
|
||||||
|
|
||||||
this.Constructor = ConfigModel;
|
this.Constructor = ConfigModel;
|
||||||
this.getTruncatedVersion = getTruncatedVersion;
|
this.getTruncatedVersion = getTruncatedVersion;
|
||||||
|
this.isOpen = isOpen;
|
||||||
|
|
||||||
return this.create(method, resource, graft);
|
return this.create(method, resource, graft);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
import {templateUrl} from '../shared/template-url/template-url.factory';
|
import {templateUrl} from '../shared/template-url/template-url.factory';
|
||||||
import { N_ } from '../i18n';
|
import { N_ } from '../i18n';
|
||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'license',
|
name: 'license',
|
||||||
@@ -17,6 +18,12 @@ export default {
|
|||||||
parent: 'setup',
|
parent: 'setup',
|
||||||
label: N_('LICENSE')
|
label: N_('LICENSE')
|
||||||
},
|
},
|
||||||
|
onEnter: ['$state', 'ConfigService', (state, configService) => {
|
||||||
|
return configService.getConfig()
|
||||||
|
.then(config => {
|
||||||
|
return _.get(config, 'license_info.license_type') === 'open' && state.go('setup');
|
||||||
|
});
|
||||||
|
}],
|
||||||
resolve: {
|
resolve: {
|
||||||
features: ['CheckLicense', '$rootScope',
|
features: ['CheckLicense', '$rootScope',
|
||||||
function(CheckLicense, $rootScope) {
|
function(CheckLicense, $rootScope) {
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
View information about this version of Ansible {{BRAND_NAME}}.
|
View information about this version of Ansible {{BRAND_NAME}}.
|
||||||
</p>
|
</p>
|
||||||
</a>
|
</a>
|
||||||
<a ui-sref="license" class="SetupItem">
|
<a ui-sref="license" class="SetupItem" ng-if="!isOpen">
|
||||||
<h4 class="SetupItem-title" translate>View Your License</h4>
|
<h4 class="SetupItem-title" translate>View Your License</h4>
|
||||||
<p class="SetupItem-description" translate>
|
<p class="SetupItem-description" translate>
|
||||||
View and edit your license information.
|
View and edit your license information.
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import {templateUrl} from '../shared/template-url/template-url.factory';
|
import {templateUrl} from '../shared/template-url/template-url.factory';
|
||||||
import { N_ } from '../i18n';
|
import { N_ } from '../i18n';
|
||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'setup',
|
name: 'setup',
|
||||||
@@ -8,10 +9,12 @@ export default {
|
|||||||
label: N_("SETTINGS")
|
label: N_("SETTINGS")
|
||||||
},
|
},
|
||||||
templateUrl: templateUrl('setup-menu/setup-menu'),
|
templateUrl: templateUrl('setup-menu/setup-menu'),
|
||||||
controller: function(orgAdmin, $scope){
|
controller: function(config, orgAdmin, $scope){
|
||||||
|
$scope.isOpen = _.get(config, 'license_info.license_type') === 'open';
|
||||||
$scope.orgAdmin = orgAdmin;
|
$scope.orgAdmin = orgAdmin;
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
|
config: ['ConfigService', config => config.getConfig()],
|
||||||
orgAdmin:
|
orgAdmin:
|
||||||
['$rootScope', 'ProcessErrors', 'Rest', 'GetBasePath',
|
['$rootScope', 'ProcessErrors', 'Rest', 'GetBasePath',
|
||||||
function($rootScope, ProcessErrors, Rest, GetBasePath){
|
function($rootScope, ProcessErrors, Rest, GetBasePath){
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ export default function($stateProvider) {
|
|||||||
controllerAs: state.controllerAs,
|
controllerAs: state.controllerAs,
|
||||||
views: state.views,
|
views: state.views,
|
||||||
parent: state.parent,
|
parent: state.parent,
|
||||||
|
redirectTo: state.redirectTo,
|
||||||
// new in uiRouter 1.0
|
// new in uiRouter 1.0
|
||||||
lazyLoad: state.lazyLoad,
|
lazyLoad: state.lazyLoad,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user