mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 11:00:03 -03:30
Fixing features timing with new config work
This commit is contained in:
parent
ef935768a5
commit
4466fc80a2
@ -245,10 +245,9 @@ var tower = angular.module('Tower', [
|
||||
label: "DASHBOARD"
|
||||
},
|
||||
resolve: {
|
||||
graphData: ['$q', 'jobStatusGraphData', 'FeaturesService', function($q, jobStatusGraphData, FeaturesService) {
|
||||
graphData: ['$q', 'jobStatusGraphData', function($q, jobStatusGraphData) {
|
||||
return $q.all({
|
||||
jobStatus: jobStatusGraphData.get("month", "all"),
|
||||
// features: FeaturesService.get()
|
||||
});
|
||||
}]
|
||||
}
|
||||
@ -830,10 +829,6 @@ var tower = angular.module('Tower', [
|
||||
});
|
||||
|
||||
$rootScope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState) {
|
||||
// catch license expiration notifications immediately after user logs in, redirect
|
||||
// if (fromState.name === 'signIn'){
|
||||
// CheckLicense.notify();
|
||||
// }
|
||||
|
||||
if(fromState.name === 'license' && toParams.hasOwnProperty('licenseMissing')){
|
||||
$rootScope.licenseMissing = toParams.licenseMissing;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
export default
|
||||
['templateUrl', '$state', 'FeaturesService', 'ProcessErrors', '$rootScope',
|
||||
['templateUrl', '$state', 'FeaturesService', 'ProcessErrors','$rootScope',
|
||||
function(templateUrl, $state, FeaturesService, ProcessErrors, $rootScope) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
@ -11,7 +11,7 @@ export default
|
||||
scope.showActivityStreamButton = false;
|
||||
scope.loadingLicense = true;
|
||||
|
||||
scope.openActivityStream = function() {
|
||||
scope.toggleActivityStream = function() {
|
||||
|
||||
var stateGoParams = {};
|
||||
|
||||
@ -29,44 +29,46 @@ export default
|
||||
|
||||
scope.$on("$stateChangeStart", function updateActivityStreamButton(event, toState) {
|
||||
|
||||
streamConfig = (toState && toState.data) ? toState.data : {};
|
||||
streamConfig = (toState && toState.data) ? toState.data : {};
|
||||
|
||||
if(streamConfig && streamConfig.activityStream) {
|
||||
if(streamConfig && streamConfig.activityStream) {
|
||||
|
||||
// Check to see if activity_streams is an enabled feature. $stateChangeSuccess 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 = (toState.name === 'activityStream') ? true : false;
|
||||
scope.showActivityStreamButton = (FeaturesService.featureEnabled('activity_streams') || toState.name ==='activityStream') ? true : false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
scope.showActivityStreamButton = false;
|
||||
// Check to see if activity_streams is an enabled feature. $stateChangeSuccess 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 = (toState.name === 'activityStream') ? true : false;
|
||||
scope.showActivityStreamButton = (FeaturesService.featureEnabled('activity_streams') || toState.name ==='activityStream') ? true : false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
$rootScope.$on('featuresLoaded', function(){
|
||||
FeaturesService.get()
|
||||
.then(function() {
|
||||
scope.loadingLicense = false;
|
||||
scope.activityStreamActive = ($state.name === 'activityStream') ? true : false;
|
||||
scope.showActivityStreamButton = (FeaturesService.featureEnabled('activity_streams') || $state.name === 'activityStream') ? true : false;
|
||||
})
|
||||
.catch(function (response) {
|
||||
ProcessErrors(null, response.data, response.status, null, {
|
||||
hdr: 'Error!',
|
||||
msg: 'Failed to get feature info. GET returned status: ' +
|
||||
response.status
|
||||
});
|
||||
});
|
||||
});
|
||||
scope.showActivityStreamButton = false;
|
||||
|
||||
}
|
||||
};
|
||||
}];
|
||||
}
|
||||
});
|
||||
|
||||
$rootScope.$on('featuresLoaded', function(){
|
||||
FeaturesService.get()
|
||||
.then(function() {
|
||||
scope.loadingLicense = false;
|
||||
scope.activityStreamActive = ($state.name === 'activityStream') ? true : false;
|
||||
scope.showActivityStreamButton = (FeaturesService.featureEnabled('activity_streams') || $state.name === 'activityStream') ? true : false;
|
||||
})
|
||||
.catch(function (response) {
|
||||
ProcessErrors(null, response.data, response.status, null, {
|
||||
hdr: 'Error!',
|
||||
msg: 'Failed to get feature info. GET returned status: ' +
|
||||
response.status
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
}];
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
data-container="body"
|
||||
ng-class="{'BreadCrumb-menuLinkActive' : activityStreamActive}"
|
||||
ng-if="showActivityStreamButton"
|
||||
ng-hide= "loadingLicense || licenseMissing || licenseType == 'basic'"
|
||||
ng-hide= "loadingLicense || licenseMissing"
|
||||
ng-click="toggleActivityStream()">
|
||||
<i class="BreadCrumb-menuLinkImage icon-activity-stream"
|
||||
alt="Activity Stream">
|
||||
|
||||
@ -316,7 +316,8 @@ export default
|
||||
buttons: { //for now always generates <button> tags
|
||||
add_survey: {
|
||||
ngClick: 'addSurvey()',
|
||||
ngShow: 'job_type.value !== "scan" && !survey_exists'
|
||||
ngShow: 'job_type.value !== "scan" && !survey_exists',
|
||||
awFeature: 'surveys'
|
||||
},
|
||||
edit_survey: {
|
||||
ngClick: 'editSurvey()',
|
||||
|
||||
@ -16,7 +16,8 @@
|
||||
|
||||
export default
|
||||
angular.module('ParseHelper', ['Utilities', 'AngularCodeMirrorModule'])
|
||||
.factory('ParseTypeChange', ['Alert', 'AngularCodeMirror', function (Alert, AngularCodeMirror) {
|
||||
.factory('ParseTypeChange', ['Alert', 'AngularCodeMirror', '$rootScope',
|
||||
function (Alert, AngularCodeMirror, $rootScope) {
|
||||
return function (params) {
|
||||
|
||||
var scope = params.scope,
|
||||
@ -45,16 +46,18 @@ export default
|
||||
|
||||
function createField(onChange, onReady) {
|
||||
//hide the textarea and show a fresh CodeMirror with the current mode (json or yaml)
|
||||
scope.codeMirror = AngularCodeMirror();
|
||||
scope.codeMirror.addModes($AnsibleConfig.variable_edit_modes);
|
||||
scope.codeMirror.showTextArea({
|
||||
scope: scope,
|
||||
model: fld,
|
||||
element: field_id,
|
||||
lineNumbers: true,
|
||||
mode: scope[pfld],
|
||||
onReady: onReady,
|
||||
onChange: onChange
|
||||
$rootScope.loginConfig.promise.then(function () {
|
||||
scope.codeMirror = AngularCodeMirror();
|
||||
scope.codeMirror.addModes($AnsibleConfig.variable_edit_modes);
|
||||
scope.codeMirror.showTextArea({
|
||||
scope: scope,
|
||||
model: fld,
|
||||
element: field_id,
|
||||
lineNumbers: true,
|
||||
mode: scope[pfld],
|
||||
onReady: onReady,
|
||||
onChange: onChange
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -7,9 +7,10 @@
|
||||
export default
|
||||
['Wait', '$state', '$scope', '$rootScope', '$location', 'GetBasePath',
|
||||
'Rest', 'ProcessErrors', 'CheckLicense', 'moment','$window',
|
||||
'ConfigService',
|
||||
'ConfigService', 'FeaturesService', 'pendoService',
|
||||
function( Wait, $state, $scope, $rootScope, $location, GetBasePath, Rest,
|
||||
ProcessErrors, CheckLicense, moment, $window, ConfigService){
|
||||
ProcessErrors, CheckLicense, moment, $window, ConfigService,
|
||||
FeaturesService, pendoService){
|
||||
$scope.getKey = function(event){
|
||||
// Mimic HTML5 spec, show filename
|
||||
$scope.fileName = event.target.files[0].name;
|
||||
@ -47,15 +48,18 @@ export default
|
||||
CheckLicense.post($scope.newLicense.file, $scope.newLicense.eula)
|
||||
.success(function(){
|
||||
reset();
|
||||
init();
|
||||
ConfigService.delete();
|
||||
ConfigService.getConfig().then(function(){
|
||||
delete($rootScope.features);
|
||||
FeaturesService.get();
|
||||
pendoService.issuePendoIdentity();
|
||||
if($rootScope.licenseMissing === true){
|
||||
$state.go('dashboard', {
|
||||
$state.go('dashboard', {
|
||||
licenseMissing: false
|
||||
});
|
||||
}
|
||||
else{
|
||||
init();
|
||||
$scope.success = true;
|
||||
$rootScope.licenseMissing = false;
|
||||
// for animation purposes
|
||||
@ -65,7 +69,6 @@ export default
|
||||
}, 4000);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
};
|
||||
var calcDaysRemaining = function(seconds){
|
||||
|
||||
@ -57,9 +57,10 @@
|
||||
export default ['$log', '$cookieStore', '$compile', '$window', '$rootScope',
|
||||
'$location', 'Authorization', 'ToggleClass', 'Alert', 'Wait', 'Timer',
|
||||
'Empty', 'ClearScope', '$scope', 'pendoService', 'ConfigService',
|
||||
'CheckLicense', 'FeaturesService',
|
||||
function ($log, $cookieStore, $compile, $window, $rootScope, $location,
|
||||
Authorization, ToggleClass, Alert, Wait, Timer, Empty, ClearScope,
|
||||
scope, pendoService, ConfigService) {
|
||||
scope, pendoService, ConfigService, CheckLicense, FeaturesService) {
|
||||
|
||||
var lastPath, lastUser, sessionExpired, loginAgain;
|
||||
|
||||
@ -116,7 +117,9 @@ export default ['$log', '$cookieStore', '$compile', '$window', '$rootScope',
|
||||
// .success(function (data) {
|
||||
// Authorization.setLicense(data);
|
||||
ConfigService.getConfig().then(function(){
|
||||
CheckLicense.test();
|
||||
pendoService.issuePendoIdentity();
|
||||
FeaturesService.get();
|
||||
Wait("stop");
|
||||
if (lastPath() && lastUser()) {
|
||||
// Go back to most recent navigation path
|
||||
|
||||
@ -16,7 +16,9 @@
|
||||
return {
|
||||
response: function(config) {
|
||||
if(config.headers('auth-token-timeout') !== null){
|
||||
$AnsibleConfig.session_timeout = Number(config.headers('auth-token-timeout'));
|
||||
$rootScope.loginConfig.promise.then(function () {
|
||||
$AnsibleConfig.session_timeout = Number(config.headers('auth-token-timeout'));
|
||||
});
|
||||
}
|
||||
return config;
|
||||
},
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
|
||||
|
||||
export default
|
||||
['GetBasePath', 'ProcessErrors', '$q', 'Rest', '$rootScope', '$state',
|
||||
function (GetBasePath, ProcessErrors, $q, Rest, $rootScope, $state) {
|
||||
['GetBasePath', 'ProcessErrors', '$q', 'Rest', '$rootScope',
|
||||
function (GetBasePath, ProcessErrors, $q, Rest, $rootScope) {
|
||||
return {
|
||||
get: function(){
|
||||
return this.config;
|
||||
|
||||
@ -16,10 +16,14 @@ function ($rootScope, Rest, GetBasePath, ProcessErrors, $http, $q,
|
||||
if(config){
|
||||
license_info = config.license_info;
|
||||
$rootScope.features = config.license_info.features;
|
||||
$rootScope.$emit('featuresLoaded');
|
||||
return $rootScope.features;
|
||||
}
|
||||
return {};
|
||||
else {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
|
||||
get: function(){
|
||||
if(_.isEmpty($rootScope.features)){
|
||||
return this.getFeatures();
|
||||
|
||||
@ -1702,6 +1702,9 @@ 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 (btn !== 'reset') {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user