mirror of
https://github.com/ansible/awx.git
synced 2026-05-23 16:47:45 -02:30
update configure tower in tower test ui for log aggregator form
This commit is contained in:
committed by
Christian Adams
parent
c0af3c537b
commit
88ca4b63e6
@@ -92,6 +92,7 @@ export default [
|
||||
var populateFromApi = function() {
|
||||
SettingsService.getCurrentValues()
|
||||
.then(function(data) {
|
||||
$scope.logAggregatorEnabled = data.LOG_AGGREGATOR_ENABLED;
|
||||
// these two values need to be unnested from the
|
||||
// OAUTH2_PROVIDER key
|
||||
data.ACCESS_TOKEN_EXPIRE_SECONDS = data
|
||||
@@ -538,8 +539,11 @@ export default [
|
||||
var payload = {};
|
||||
payload[key] = $scope[key];
|
||||
SettingsService.patchConfiguration(payload)
|
||||
.then(function() {
|
||||
.then(function(data) {
|
||||
//TODO consider updating form values with returned data here
|
||||
if (key === 'LOG_AGGREGATOR_ENABLED') {
|
||||
$scope.logAggregatorEnabled = data.LOG_AGGREGATOR_ENABLED;
|
||||
}
|
||||
})
|
||||
.catch(function(data) {
|
||||
//Change back on unsuccessful update
|
||||
|
||||
@@ -193,14 +193,25 @@ export default [
|
||||
}
|
||||
}
|
||||
|
||||
$scope.$watchGroup(['configuration_logging_template_form.$pending', 'configuration_logging_template_form.$dirty', '!logAggregatorEnabled'], (vals) => {
|
||||
if (vals.some(val => val === true)) {
|
||||
$scope.$parent.vm.disableTestButton = true;
|
||||
$scope.$parent.vm.testTooltip = i18n._('Save and enable log aggregation before testing the log aggregator.');
|
||||
} else {
|
||||
$scope.$parent.vm.disableTestButton = false;
|
||||
$scope.$parent.vm.testTooltip = i18n._('Send a test response to the configured log aggregator.');
|
||||
}
|
||||
});
|
||||
|
||||
$scope.$parent.vm.testLogging = function () {
|
||||
if (!$scope.$parent.vm.disableTestButton) {
|
||||
Rest.setUrl("/api/v2/settings/logging/test/");
|
||||
Rest.post($scope.$parent.vm.getFormPayload())
|
||||
Rest.post({})
|
||||
.then(() => {
|
||||
ngToast.success({
|
||||
content: `<i class="fa fa-check-circle
|
||||
Toast-successIcon"></i>` +
|
||||
i18n._('Log aggregator test successful.')
|
||||
i18n._('Log aggregator test sent successfully.')
|
||||
});
|
||||
})
|
||||
.catch(({ data, status }) => {
|
||||
@@ -220,6 +231,7 @@ export default [
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
angular.extend(systemVm, {
|
||||
|
||||
@@ -75,10 +75,13 @@
|
||||
class: 'Form-resetAll'
|
||||
},
|
||||
testLogging: {
|
||||
ngClass: "{'Form-button--disabled': vm.disableTestButton}",
|
||||
ngClick: 'vm.testLogging()',
|
||||
label: i18n._('Test'),
|
||||
class: 'btn-primary',
|
||||
ngDisabled: 'configuration_logging_template_form.$pending'
|
||||
class: 'Form-primaryButton',
|
||||
awToolTip: '{{vm.testTooltip}}',
|
||||
dataTipWatch: 'vm.testTooltip',
|
||||
dataPlacement: 'top',
|
||||
},
|
||||
cancel: {
|
||||
ngClick: 'vm.formCancel()',
|
||||
|
||||
@@ -1690,6 +1690,9 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
if (button.ngClick) {
|
||||
html += this.attr(button, 'ngClick');
|
||||
}
|
||||
if (button.ngClass) {
|
||||
html += this.attr(button, 'ngClass');
|
||||
}
|
||||
if (button.ngDisabled) {
|
||||
ngDisabled = (button.ngDisabled===true) ? `${this.form.name}_form.$invalid || ${this.form.name}_form.$pending`: button.ngDisabled;
|
||||
if (btn !== 'reset') {
|
||||
|
||||
Reference in New Issue
Block a user