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