mirror of
https://github.com/ansible/awx.git
synced 2026-04-11 21:19:22 -02:30
Merge pull request #7049 from mabashian/6227-logging
Disable log enable toggle when required fields not present
This commit is contained in:
@@ -66,7 +66,17 @@ export default [
|
|||||||
ConfigurationService.getCurrentValues()
|
ConfigurationService.getCurrentValues()
|
||||||
.then(function(data) {
|
.then(function(data) {
|
||||||
var currentKeys = _.keys(data);
|
var currentKeys = _.keys(data);
|
||||||
|
$scope.requiredLogValues = {};
|
||||||
_.each(currentKeys, function(key) {
|
_.each(currentKeys, function(key) {
|
||||||
|
|
||||||
|
if(key === "LOG_AGGREGATOR_HOST") {
|
||||||
|
$scope.requiredLogValues.LOG_AGGREGATOR_HOST = data[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(key === "LOG_AGGREGATOR_TYPE") {
|
||||||
|
$scope.requiredLogValues.LOG_AGGREGATOR_TYPE = data[key];
|
||||||
|
}
|
||||||
|
|
||||||
if (data[key] !== null && typeof data[key] === 'object') {
|
if (data[key] !== null && typeof data[key] === 'object') {
|
||||||
if (Array.isArray(data[key])) {
|
if (Array.isArray(data[key])) {
|
||||||
//handle arrays
|
//handle arrays
|
||||||
@@ -301,6 +311,11 @@ export default [
|
|||||||
ConfigurationService.patchConfiguration(payload)
|
ConfigurationService.patchConfiguration(payload)
|
||||||
.then(function() {
|
.then(function() {
|
||||||
$scope[key] = $scope.configDataResolve[key].default;
|
$scope[key] = $scope.configDataResolve[key].default;
|
||||||
|
|
||||||
|
if(key === "LOG_AGGREGATOR_HOST" || key === "LOG_AGGREGATOR_TYPE") {
|
||||||
|
$scope.requiredLogValues[key] = $scope.configDataResolve[key].default;
|
||||||
|
}
|
||||||
|
|
||||||
if($scope[key + '_field'].type === "select"){
|
if($scope[key + '_field'].type === "select"){
|
||||||
// We need to re-instantiate the Select2 element
|
// We need to re-instantiate the Select2 element
|
||||||
// after resetting the value. Example:
|
// after resetting the value. Example:
|
||||||
@@ -410,6 +425,10 @@ export default [
|
|||||||
ConfigurationService.patchConfiguration(getFormPayload())
|
ConfigurationService.patchConfiguration(getFormPayload())
|
||||||
.then(function(data) {
|
.then(function(data) {
|
||||||
loginUpdate();
|
loginUpdate();
|
||||||
|
|
||||||
|
$scope.requiredLogValues.LOG_AGGREGATOR_HOST = $scope.LOG_AGGREGATOR_HOST;
|
||||||
|
$scope.requiredLogValues.LOG_AGGREGATOR_TYPE = $scope.LOG_AGGREGATOR_TYPE;
|
||||||
|
|
||||||
saveDeferred.resolve(data);
|
saveDeferred.resolve(data);
|
||||||
$scope[formTracker.currentFormName()].$setPristine();
|
$scope[formTracker.currentFormName()].$setPristine();
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -25,6 +25,20 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div ng-show="systemVm.activeSystemForm === 'logging'">
|
<div ng-show="systemVm.activeSystemForm === 'logging'">
|
||||||
|
<div class="form-group Form-formGroup">
|
||||||
|
<label class="Form-inputLabelContainer" for="LOG_AGGREGATOR_ENABLED">
|
||||||
|
<span class="Form-inputLabel">
|
||||||
|
Enable External Logging
|
||||||
|
</span>
|
||||||
|
<a id="awp-LOG_AGGREGATOR_ENABLED" href="" aw-pop-over="Enable sending logs to external log aggregator." data-placement="top" over-title="Enable External Logging" class="help-link" tabindex="-1">
|
||||||
|
<i class="fa fa-question-circle"></i>
|
||||||
|
</a>
|
||||||
|
</label>
|
||||||
|
<div class="ScheduleToggle" ng-class="{'is-on': LOG_AGGREGATOR_ENABLED, 'ScheduleToggle--disabled': (!LOG_AGGREGATOR_ENABLED && (!requiredLogValues.LOG_AGGREGATOR_HOST || requiredLogValues.LOG_AGGREGATOR_HOST === '' || !requiredLogValues.LOG_AGGREGATOR_TYPE || requiredLogValues.LOG_AGGREGATOR_TYPE === '')) || $rootScope.user_is_system_auditor}">
|
||||||
|
<button ng-show="LOG_AGGREGATOR_ENABLED" class="ScheduleToggle-switch is-on" ng-click="toggleForm('LOG_AGGREGATOR_ENABLED')">ON</button>
|
||||||
|
<button ng-show="!LOG_AGGREGATOR_ENABLED" class="ScheduleToggle-switch" ng-click="toggleForm('LOG_AGGREGATOR_ENABLED')">OFF</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div id="system-logging-form">
|
<div id="system-logging-form">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -40,9 +40,6 @@
|
|||||||
LOG_AGGREGATOR_INDIVIDUAL_FACTS: {
|
LOG_AGGREGATOR_INDIVIDUAL_FACTS: {
|
||||||
type: 'toggleSwitch',
|
type: 'toggleSwitch',
|
||||||
},
|
},
|
||||||
LOG_AGGREGATOR_ENABLED: {
|
|
||||||
type: 'toggleSwitch',
|
|
||||||
},
|
|
||||||
LOG_AGGREGATOR_PROTOCOL: {
|
LOG_AGGREGATOR_PROTOCOL: {
|
||||||
type: 'select',
|
type: 'select',
|
||||||
reset: 'LOG_AGGREGATOR_PROTOCOL',
|
reset: 'LOG_AGGREGATOR_PROTOCOL',
|
||||||
|
|||||||
@@ -15,9 +15,9 @@
|
|||||||
|
|
||||||
&.ScheduleToggle--disabled {
|
&.ScheduleToggle--disabled {
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
border-color: @b7grey !important;
|
border-color: @default-link !important;
|
||||||
.ScheduleToggle-switch {
|
.ScheduleToggle-switch {
|
||||||
background-color: @b7grey !important;
|
background-color: @d7grey !important;
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user