mirror of
https://github.com/ansible/awx.git
synced 2026-01-16 12:20:45 -03:30
Merge pull request #1231 from jlmitch5/licenseOnSettingsPage
add license route to settings page
This commit is contained in:
commit
3f91cd72c3
@ -2328,6 +2328,10 @@ body {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.Panel--noBottomPadding {
|
||||
padding-bottom: 0px;
|
||||
}
|
||||
|
||||
.Panel-hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@ -102,6 +102,10 @@
|
||||
flex-wrap:wrap;
|
||||
}
|
||||
|
||||
.Form-tabHolder--licenseSelected {
|
||||
margin-bottom: -20px;
|
||||
}
|
||||
|
||||
.Form-tabs {
|
||||
flex: 1 0 auto;
|
||||
display: flex;
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
*
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
import defaultStrings from '~assets/default.strings.json';
|
||||
|
||||
export default [
|
||||
'$scope', '$rootScope', '$state', '$stateParams', '$timeout', '$q', 'Alert',
|
||||
@ -55,6 +56,8 @@ export default [
|
||||
) {
|
||||
var vm = this;
|
||||
|
||||
vm.product = defaultStrings.BRAND_NAME;
|
||||
|
||||
var formDefs = {
|
||||
'azure': configurationAzureForm,
|
||||
'github': configurationGithubForm,
|
||||
@ -219,7 +222,7 @@ export default [
|
||||
};
|
||||
|
||||
function activeTabCheck(setForm) {
|
||||
if(!$scope[formTracker.currentFormName()].$dirty) {
|
||||
if(!$scope[formTracker.currentFormName()] || !$scope[formTracker.currentFormName()].$dirty) {
|
||||
active(setForm);
|
||||
} else {
|
||||
var msg = i18n._('You have unsaved changes. Would you like to proceed <strong>without</strong> saving?');
|
||||
@ -268,18 +271,30 @@ export default [
|
||||
formTracker.setCurrentSystem(formTracker.currentSystem);
|
||||
}
|
||||
}
|
||||
else {
|
||||
formTracker.setCurrent(setForm);
|
||||
}
|
||||
|
||||
vm.activeTab = setForm;
|
||||
$state.go('configuration', {
|
||||
currentTab: setForm
|
||||
}, {
|
||||
location: true,
|
||||
inherit: false,
|
||||
notify: false,
|
||||
reload: false
|
||||
});
|
||||
|
||||
if (setForm !== 'license') {
|
||||
formTracker.setCurrent(setForm);
|
||||
|
||||
$state.go('configuration', {
|
||||
currentTab: setForm
|
||||
}, {
|
||||
location: true,
|
||||
inherit: false,
|
||||
notify: false,
|
||||
reload: false
|
||||
});
|
||||
} else {
|
||||
$state.go('configuration.license', {
|
||||
currentTab: setForm
|
||||
}, {
|
||||
location: true,
|
||||
inherit: false,
|
||||
notify: false,
|
||||
reload: false
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var formCancel = function() {
|
||||
|
||||
@ -7,15 +7,16 @@
|
||||
<div class="tab-pane" id="configuration-panel">
|
||||
<div ng-cloak id="htmlTemplate" class="Panel">
|
||||
<div class="Form-header">
|
||||
<div class="Form-title" translate>CONFIGURE {{BRAND_NAME}}</div>
|
||||
<div class="Form-title Form-title--uppercase" translate>CONFIGURE {{BRAND_NAME}}</div>
|
||||
</div>
|
||||
<div class="row Form-tabRow">
|
||||
<div class="col-lg-12">
|
||||
<div class="Form-tabHolder">
|
||||
<div class="Form-tabHolder"ng-class="{'Form-tabHolder--licenseSelected': vm.activeTab === 'license'}">
|
||||
<div class="Form-tab" ng-click="vm.activeTabCheck('auth')" ng-class="{'is-selected': vm.activeTab === 'auth' }" translate>Authentication</div>
|
||||
<div class="Form-tab" ng-click="vm.activeTabCheck('jobs')" ng-class="{'is-selected': vm.activeTab === 'jobs' }" translate>Jobs</div>
|
||||
<div class="Form-tab" ng-click="vm.activeTabCheck('system')" ng-class="{'is-selected': vm.activeTab === 'system' }" translate>System</div>
|
||||
<div class="Form-tab" ng-click="vm.activeTabCheck('ui')" ng-class="{'is-selected': vm.activeTab === 'ui' }" translate>User Interface</div>
|
||||
<div class="Form-tab" ng-show="vm.product === 'Tower'" ng-click="vm.activeTabCheck('license')" ng-class="{'is-selected': vm.activeTab === 'license' }" translate>License</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -23,6 +24,7 @@
|
||||
<div ui-view="jobs" ng-show="vm.activeTab === 'jobs'"></div>
|
||||
<div ui-view="system" ng-show="vm.activeTab === 'system'"></div>
|
||||
<div ui-view="ui" ng-show="vm.activeTab === 'ui'"></div>
|
||||
<div ui-view="license" ng-show="vm.product === 'Tower' && vm.activeTab === 'license'"></div>
|
||||
<div id="FormModal-dialog"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -3,16 +3,15 @@
|
||||
*
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
|
||||
import {templateUrl} from '../shared/template-url/template-url.factory';
|
||||
import ConfigurationController from './configuration.controller';
|
||||
import { N_ } from '../i18n';
|
||||
import {templateUrl} from '../shared/template-url/template-url.factory';
|
||||
import ConfigurationController from './configuration.controller';
|
||||
import { N_ } from '../i18n';
|
||||
|
||||
// Import form controllers
|
||||
import ConfigurationAuthController from './auth-form/configuration-auth.controller';
|
||||
import ConfigurationJobsController from './jobs-form/configuration-jobs.controller';
|
||||
import ConfigurationSystemController from './system-form/configuration-system.controller';
|
||||
import ConfigurationUiController from './ui-form/configuration-ui.controller';
|
||||
import ConfigurationAuthController from './auth-form/configuration-auth.controller';
|
||||
import ConfigurationJobsController from './jobs-form/configuration-jobs.controller';
|
||||
import ConfigurationSystemController from './system-form/configuration-system.controller';
|
||||
import ConfigurationUiController from './ui-form/configuration-ui.controller';
|
||||
|
||||
export default {
|
||||
name: 'configuration',
|
||||
@ -58,6 +57,6 @@
|
||||
templateUrl: templateUrl('configuration/ui-form/configuration-ui'),
|
||||
controller: ConfigurationUiController,
|
||||
controllerAs: 'uiVm'
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
52
awx/ui/client/src/configuration/license.route.js
Normal file
52
awx/ui/client/src/configuration/license.route.js
Normal file
@ -0,0 +1,52 @@
|
||||
/*************************************************
|
||||
* Copyright (c) 2016 Ansible, Inc.
|
||||
*
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
|
||||
import {templateUrl} from '../shared/template-url/template-url.factory';
|
||||
import { N_ } from '../i18n';
|
||||
import _ from 'lodash';
|
||||
|
||||
export default {
|
||||
name: 'configuration.license',
|
||||
route: '/license',
|
||||
// templateUrl: templateUrl('license/license'),
|
||||
// controller: 'licenseController',
|
||||
data: {},
|
||||
ncyBreadcrumb: {
|
||||
label: N_('LICENSE')
|
||||
},
|
||||
onEnter: ['$state', 'ConfigService', (state, configService) => {
|
||||
return configService.getConfig()
|
||||
.then(config => {
|
||||
if (_.get(config, 'license_info.license_type') === 'open') {
|
||||
return state.go('setup');
|
||||
}
|
||||
});
|
||||
}],
|
||||
views: {
|
||||
'license@configuration': {
|
||||
templateUrl: templateUrl('license/license'),
|
||||
controller: 'licenseController'
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
features: ['CheckLicense', '$rootScope',
|
||||
function(CheckLicense, $rootScope) {
|
||||
if($rootScope.licenseMissing === undefined){
|
||||
return CheckLicense.notify();
|
||||
}
|
||||
|
||||
}],
|
||||
config: ['ConfigService', 'CheckLicense', '$rootScope',
|
||||
function(ConfigService, CheckLicense, $rootScope) {
|
||||
ConfigService.delete();
|
||||
return ConfigService.getConfig()
|
||||
.then(function(config){
|
||||
$rootScope.licenseMissing = (CheckLicense.valid(config.license_info) === false) ? true : false;
|
||||
return config;
|
||||
});
|
||||
}]
|
||||
},
|
||||
};
|
||||
@ -7,6 +7,7 @@
|
||||
import configurationService from './configuration.service';
|
||||
import ConfigurationUtils from './configurationUtils.service';
|
||||
import configurationRoute from './configuration.route';
|
||||
import licenseRoute from './license.route';
|
||||
import configurationController from './configuration.controller.js';
|
||||
|
||||
// Import forms
|
||||
@ -66,4 +67,5 @@ angular.module('configuration', [])
|
||||
.service('ConfigurationService', configurationService)
|
||||
.run(['$stateExtender', function($stateExtender) {
|
||||
$stateExtender.addState(configurationRoute);
|
||||
$stateExtender.addState(licenseRoute);
|
||||
}]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user