mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 16:51:11 +03:00
add test log aggregator button to ui
This commit is contained in:
parent
607680a22b
commit
0731b658c8
@ -352,11 +352,11 @@ export default [
|
|||||||
|
|
||||||
// Some dropdowns are listed as "list" type in the API even though they're a dropdown:
|
// Some dropdowns are listed as "list" type in the API even though they're a dropdown:
|
||||||
var multiselectDropdowns = ['AD_HOC_COMMANDS'];
|
var multiselectDropdowns = ['AD_HOC_COMMANDS'];
|
||||||
var formSave = function() {
|
|
||||||
var saveDeferred = $q.defer();
|
var getFormPayload = function() {
|
||||||
var keys = _.keys(formDefs[formTracker.getCurrent()].fields);
|
var keys = _.keys(formDefs[formTracker.getCurrent()].fields);
|
||||||
var payload = {};
|
var payload = {};
|
||||||
clearApiErrors();
|
|
||||||
_.each(keys, function(key) {
|
_.each(keys, function(key) {
|
||||||
if($scope.configDataResolve[key].type === 'choice' || multiselectDropdowns.indexOf(key) !== -1) {
|
if($scope.configDataResolve[key].type === 'choice' || multiselectDropdowns.indexOf(key) !== -1) {
|
||||||
//Parse dropdowns and dropdowns labeled as lists
|
//Parse dropdowns and dropdowns labeled as lists
|
||||||
@ -396,8 +396,14 @@ export default [
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return payload;
|
||||||
|
};
|
||||||
|
|
||||||
|
var formSave = function() {
|
||||||
|
var saveDeferred = $q.defer();
|
||||||
|
clearApiErrors();
|
||||||
Wait('start');
|
Wait('start');
|
||||||
ConfigurationService.patchConfiguration(payload)
|
ConfigurationService.patchConfiguration(getFormPayload())
|
||||||
.then(function(data) {
|
.then(function(data) {
|
||||||
loginUpdate();
|
loginUpdate();
|
||||||
saveDeferred.resolve(data);
|
saveDeferred.resolve(data);
|
||||||
@ -560,6 +566,7 @@ export default [
|
|||||||
formCancel: formCancel,
|
formCancel: formCancel,
|
||||||
formTracker: formTracker,
|
formTracker: formTracker,
|
||||||
formSave: formSave,
|
formSave: formSave,
|
||||||
|
getFormPayload: getFormPayload,
|
||||||
populateFromApi: populateFromApi,
|
populateFromApi: populateFromApi,
|
||||||
resetAllConfirm: resetAllConfirm,
|
resetAllConfirm: resetAllConfirm,
|
||||||
show_auditor_bar: show_auditor_bar,
|
show_auditor_bar: show_auditor_bar,
|
||||||
|
@ -15,6 +15,9 @@ export default [
|
|||||||
'CreateSelect2',
|
'CreateSelect2',
|
||||||
'GenerateForm',
|
'GenerateForm',
|
||||||
'i18n',
|
'i18n',
|
||||||
|
'Rest',
|
||||||
|
'ProcessErrors',
|
||||||
|
'ngToast',
|
||||||
function(
|
function(
|
||||||
$rootScope, $scope, $state, $stateParams, $timeout,
|
$rootScope, $scope, $state, $stateParams, $timeout,
|
||||||
AngularCodeMirror,
|
AngularCodeMirror,
|
||||||
@ -25,7 +28,10 @@ export default [
|
|||||||
ConfigurationUtils,
|
ConfigurationUtils,
|
||||||
CreateSelect2,
|
CreateSelect2,
|
||||||
GenerateForm,
|
GenerateForm,
|
||||||
i18n
|
i18n,
|
||||||
|
Rest,
|
||||||
|
ProcessErrors,
|
||||||
|
ngToast
|
||||||
) {
|
) {
|
||||||
var systemVm = this;
|
var systemVm = this;
|
||||||
|
|
||||||
@ -186,6 +192,36 @@ export default [
|
|||||||
$scope.$parent.configuration_logging_template_form.$setPristine();
|
$scope.$parent.configuration_logging_template_form.$setPristine();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
|
$scope.$parent.vm.testLogging = function() {
|
||||||
|
Rest.setUrl("/api/v2/settings/logging/test/");
|
||||||
|
Rest.post($scope.$parent.vm.getFormPayload())
|
||||||
|
.then(() => {
|
||||||
|
ngToast.success({
|
||||||
|
content: `<i class="fa fa-check-circle
|
||||||
|
Toast-successIcon"></i>` +
|
||||||
|
i18n._('Log aggregator test successful.')
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(({data, status}) => {
|
||||||
|
if (status === 500) {
|
||||||
|
ngToast.danger({
|
||||||
|
content: `<i class="fa fa-exclamation-triangle
|
||||||
|
Toast-successIcon"></i>` +
|
||||||
|
i18n._('Log aggregator test failed.<br />Detail: ') +
|
||||||
|
data.error
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
ProcessErrors($scope, data, status, null,
|
||||||
|
{
|
||||||
|
hdr: i18n._('Error!'),
|
||||||
|
msg: i18n._('There was an error testing the ' +
|
||||||
|
'log aggregator. Returned status: ') +
|
||||||
|
status
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
angular.extend(systemVm, {
|
angular.extend(systemVm, {
|
||||||
activeForm: activeForm,
|
activeForm: activeForm,
|
||||||
activeSystemForm: activeSystemForm,
|
activeSystemForm: activeSystemForm,
|
||||||
|
@ -51,6 +51,12 @@
|
|||||||
label: i18n._('Revert all to default'),
|
label: i18n._('Revert all to default'),
|
||||||
class: 'Form-resetAll'
|
class: 'Form-resetAll'
|
||||||
},
|
},
|
||||||
|
testLogging: {
|
||||||
|
ngClick: 'vm.testLogging()',
|
||||||
|
label: i18n._('Test'),
|
||||||
|
class: 'btn-primary',
|
||||||
|
ngDisabled: 'configuration_logging_template_form.$invalid'
|
||||||
|
},
|
||||||
cancel: {
|
cancel: {
|
||||||
ngClick: 'vm.formCancel()',
|
ngClick: 'vm.formCancel()',
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user