mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 03:40:42 -03:30
Merge pull request #7049 from mabashian/6227-logging
Disable log enable toggle when required fields not present
This commit is contained in:
commit
e8510e2a4d
@ -66,7 +66,17 @@ export default [
|
||||
ConfigurationService.getCurrentValues()
|
||||
.then(function(data) {
|
||||
var currentKeys = _.keys(data);
|
||||
$scope.requiredLogValues = {};
|
||||
_.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 (Array.isArray(data[key])) {
|
||||
//handle arrays
|
||||
@ -301,6 +311,11 @@ export default [
|
||||
ConfigurationService.patchConfiguration(payload)
|
||||
.then(function() {
|
||||
$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"){
|
||||
// We need to re-instantiate the Select2 element
|
||||
// after resetting the value. Example:
|
||||
@ -410,6 +425,10 @@ export default [
|
||||
ConfigurationService.patchConfiguration(getFormPayload())
|
||||
.then(function(data) {
|
||||
loginUpdate();
|
||||
|
||||
$scope.requiredLogValues.LOG_AGGREGATOR_HOST = $scope.LOG_AGGREGATOR_HOST;
|
||||
$scope.requiredLogValues.LOG_AGGREGATOR_TYPE = $scope.LOG_AGGREGATOR_TYPE;
|
||||
|
||||
saveDeferred.resolve(data);
|
||||
$scope[formTracker.currentFormName()].$setPristine();
|
||||
})
|
||||
|
||||
@ -25,6 +25,20 @@
|
||||
</div>
|
||||
</div>
|
||||
<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>
|
||||
|
||||
@ -40,9 +40,6 @@
|
||||
LOG_AGGREGATOR_INDIVIDUAL_FACTS: {
|
||||
type: 'toggleSwitch',
|
||||
},
|
||||
LOG_AGGREGATOR_ENABLED: {
|
||||
type: 'toggleSwitch',
|
||||
},
|
||||
LOG_AGGREGATOR_PROTOCOL: {
|
||||
type: 'select',
|
||||
reset: 'LOG_AGGREGATOR_PROTOCOL',
|
||||
|
||||
@ -15,9 +15,9 @@
|
||||
|
||||
&.ScheduleToggle--disabled {
|
||||
cursor: not-allowed;
|
||||
border-color: @b7grey !important;
|
||||
border-color: @default-link !important;
|
||||
.ScheduleToggle-switch {
|
||||
background-color: @b7grey !important;
|
||||
background-color: @d7grey !important;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user