From 38a7d62745f51264159b80ce65de37e6efeb318d Mon Sep 17 00:00:00 2001 From: mabashian Date: Fri, 30 Aug 2019 10:08:13 -0400 Subject: [PATCH] Add support for custom error messaging on license page --- .../client/src/license/checkLicense.factory.js | 4 ++-- awx/ui/client/src/license/license.block.less | 3 +-- awx/ui/client/src/license/license.controller.js | 9 ++++++--- awx/ui/client/src/license/license.partial.html | 16 ++++++++++------ 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/awx/ui/client/src/license/checkLicense.factory.js b/awx/ui/client/src/license/checkLicense.factory.js index d5cbc0ed44..e76f1ea0b7 100644 --- a/awx/ui/client/src/license/checkLicense.factory.js +++ b/awx/ui/client/src/license/checkLicense.factory.js @@ -25,8 +25,8 @@ export default .then((response) =>{ return response.data; }) - .catch(() => { - return $q.reject(); + .catch(({data}) => { + return $q.reject(data); }); }, diff --git a/awx/ui/client/src/license/license.block.less b/awx/ui/client/src/license/license.block.less index b0091d71ee..415c8a1fab 100644 --- a/awx/ui/client/src/license/license.block.less +++ b/awx/ui/client/src/license/license.block.less @@ -124,8 +124,7 @@ } } -.License-submit--success, .License-submit--failure{ - line-height: 33px; +.License-submit--success, .License-submit--failure { margin: 0; } .License-file--container { diff --git a/awx/ui/client/src/license/license.controller.js b/awx/ui/client/src/license/license.controller.js index eaa0cbf3d1..40eeeff071 100644 --- a/awx/ui/client/src/license/license.controller.js +++ b/awx/ui/client/src/license/license.controller.js @@ -33,7 +33,10 @@ export default const reset = function() { document.getElementById('License-form').reset(); - $scope.rhCreds = {}; + $scope.newLicense.eula = undefined; + if (!$scope.licenseError) { + $scope.rhCreds = {}; + } }; const initVars = (config) => { @@ -176,10 +179,10 @@ export default }, 4000); } }); - }).catch(() => { + }).catch((data) => { Wait('stop'); reset(); - $scope.licenseError = true; + $scope.licenseError = data.error; }); }; }]; diff --git a/awx/ui/client/src/license/license.partial.html b/awx/ui/client/src/license/license.partial.html index cdcdacb6a2..4a6ae096cf 100644 --- a/awx/ui/client/src/license/license.partial.html +++ b/awx/ui/client/src/license/license.partial.html @@ -167,19 +167,23 @@
- + User analytics: This data is used to enhance future releases of the Tower Software and help streamline customer experience and success.
- + Automation analytics: This data is used to enhance future releases of the Tower Software and to provide Automation Insights to Tower subscribers.
-
- - Save successful! - Invalid License - Save unsuccessful +
+
+ Save successful! + Save unsuccessful - {{licenseError}} +
+
+ +