From 5b488a41eca70e3b11e6106d5c378e1e50aaad7f Mon Sep 17 00:00:00 2001 From: Michael Abashian Date: Thu, 13 Jul 2017 09:59:14 -0400 Subject: [PATCH 1/2] Moved enable logging toggle out of form and disabled toggle when required fields aren't provided. --- .../configuration/configuration.controller.js | 21 ++++++++++++++++++- .../configuration-system.partial.html | 14 +++++++++++++ .../sub-forms/system-logging.form.js | 3 --- .../src/scheduler/scheduleToggle.block.less | 4 ++-- 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/awx/ui/client/src/configuration/configuration.controller.js b/awx/ui/client/src/configuration/configuration.controller.js index 33056ec486..6dc1f0f70e 100644 --- a/awx/ui/client/src/configuration/configuration.controller.js +++ b/awx/ui/client/src/configuration/configuration.controller.js @@ -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 @@ -296,11 +306,16 @@ export default [ $scope.resetValue = function(key) { Wait('start'); var payload = {}; - payload[key] = $scope.configDataResolve[key].default; + payload[key] = $scope.configDataResolve[key].default ? $scope.configDataResolve[key].default : null; 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(); }) diff --git a/awx/ui/client/src/configuration/system-form/configuration-system.partial.html b/awx/ui/client/src/configuration/system-form/configuration-system.partial.html index 0b039e761b..0e45b5cd1e 100644 --- a/awx/ui/client/src/configuration/system-form/configuration-system.partial.html +++ b/awx/ui/client/src/configuration/system-form/configuration-system.partial.html @@ -25,6 +25,20 @@
+
+ +
+ + +
+
diff --git a/awx/ui/client/src/configuration/system-form/sub-forms/system-logging.form.js b/awx/ui/client/src/configuration/system-form/sub-forms/system-logging.form.js index 386c8f708d..98cfe247b8 100644 --- a/awx/ui/client/src/configuration/system-form/sub-forms/system-logging.form.js +++ b/awx/ui/client/src/configuration/system-form/sub-forms/system-logging.form.js @@ -40,9 +40,6 @@ LOG_AGGREGATOR_INDIVIDUAL_FACTS: { type: 'toggleSwitch', }, - LOG_AGGREGATOR_ENABLED: { - type: 'toggleSwitch', - }, LOG_AGGREGATOR_PROTOCOL: { type: 'select', reset: 'LOG_AGGREGATOR_PROTOCOL', diff --git a/awx/ui/client/src/scheduler/scheduleToggle.block.less b/awx/ui/client/src/scheduler/scheduleToggle.block.less index 597594429a..5ce3944f60 100644 --- a/awx/ui/client/src/scheduler/scheduleToggle.block.less +++ b/awx/ui/client/src/scheduler/scheduleToggle.block.less @@ -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; } } From 48bc16fb1abe6f03a91d7aa04276d8ffac897551 Mon Sep 17 00:00:00 2001 From: Michael Abashian Date: Thu, 13 Jul 2017 10:12:57 -0400 Subject: [PATCH 2/2] Roll back resetValue changes. There's a separate issue for this. --- awx/ui/client/src/configuration/configuration.controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/ui/client/src/configuration/configuration.controller.js b/awx/ui/client/src/configuration/configuration.controller.js index 6dc1f0f70e..66f08942a9 100644 --- a/awx/ui/client/src/configuration/configuration.controller.js +++ b/awx/ui/client/src/configuration/configuration.controller.js @@ -306,7 +306,7 @@ export default [ $scope.resetValue = function(key) { Wait('start'); var payload = {}; - payload[key] = $scope.configDataResolve[key].default ? $scope.configDataResolve[key].default : null; + payload[key] = $scope.configDataResolve[key].default; ConfigurationService.patchConfiguration(payload) .then(function() {