diff --git a/endpoints/api/suconfig.py b/endpoints/api/suconfig.py index 526eb7d71..9235e8ef3 100644 --- a/endpoints/api/suconfig.py +++ b/endpoints/api/suconfig.py @@ -288,13 +288,12 @@ class SuperUserSetAndValidateLicense(ApiResource): statuses = decoded_license.validate({}) all_met = all(status.is_met() for status in statuses) - if not all_met: - raise InvalidRequest('License is insufficient') + if all_met: + config_provider.save_license(license_contents) - config_provider.save_license(license_contents) return { - 'decoded': {}, - 'success': True + 'status': [status.as_dict(for_private=True) for status in statuses], + 'success': all_met, } diff --git a/endpoints/api/superuser.py b/endpoints/api/superuser.py index 5f635e642..7344da266 100644 --- a/endpoints/api/superuser.py +++ b/endpoints/api/superuser.py @@ -856,12 +856,10 @@ class SuperUserLicense(ApiResource): statuses = decoded_license.validate(app.config) all_met = all(status.is_met() for status in statuses) - if not all_met: - raise InvalidRequest('License is insufficient') return { - 'decoded': {}, - 'success': True + 'status': [status.as_dict(for_private=True) for status in statuses], + 'success': all_met, } abort(403) @@ -882,16 +880,14 @@ class SuperUserLicense(ApiResource): statuses = decoded_license.validate(app.config) all_met = all(status.is_met() for status in statuses) - if not all_met: - raise InvalidRequest('License is insufficient') - - config_provider.save_license(license_contents) - - license_validator.compute_license_sufficiency() + if all_met: + # Save the license and update the license check thread. + config_provider.save_license(license_contents) + license_validator.compute_license_sufficiency() return { - 'decoded': {}, - 'success': True + 'status': [status.as_dict(for_private=True) for status in statuses], + 'success': all_met, } abort(403) diff --git a/static/css/core-ui.css b/static/css/core-ui.css index bd482b37e..5ce33c73b 100644 --- a/static/css/core-ui.css +++ b/static/css/core-ui.css @@ -567,6 +567,11 @@ a:focus { margin-right: 4px; } +.config-license-field-element .required { + background-color: #f5f5f5; + color: #333; +} + .config-license-field-element textarea { padding: 10px; margin-bottom: 10px; @@ -577,9 +582,8 @@ a:focus { margin-bottom: 26px; } -.config-license-field-element table td:first-child { - width: 150px; - font-weight: bold; +.config-license-field-element table { + margin-top: 20px; } .config-license-field-element .fa { @@ -594,6 +598,10 @@ a:focus { color: #D64456; } +.config-license-field-element li { + padding: 4px; +} + .co-checkbox { position: relative; } diff --git a/static/css/pages/setup.css b/static/css/pages/setup.css index 2ca87dbdc..2cdeb027b 100644 --- a/static/css/pages/setup.css +++ b/static/css/pages/setup.css @@ -36,6 +36,10 @@ margin-bottom: 16px; } +.initial-setup-modal .config-license-field { + margin-top: 30px; +} + .initial-setup-modal .license-valid .fa { margin-right: 6px; } @@ -43,14 +47,3 @@ .initial-setup-modal .license-valid table { margin-top: 40px; } - -.initial-setup-modal .license-valid table td { - border: 0px; - padding: 4px; -} - -.initial-setup-modal .license-valid table td:first-child { - font-weight: bold; - max-width: 100px; - padding-right: 20px; -} diff --git a/static/directives/config/config-license-field.html b/static/directives/config/config-license-field.html index 9eb688156..f414f2aa6 100644 --- a/static/directives/config/config-license-field.html +++ b/static/directives/config/config-license-field.html @@ -3,19 +3,54 @@ config if the license is invalid (since this box will be empty and therefore "required") --> -
+ -Product: | {{ licenseDecoded.publicProductName || licenseDecoded.productName }} | |||
Plan: | {{ licenseDecoded.publicPlanName || licenseDecoded.planName }} | Requirement | +Required Count | +Subscription | +Subscription Count | +Expiration Date | + +
{{ requirementTitles[status.requirement.name] }} | +{{ status.requirement.count }} | +{{ status.entitlement.product_name }} | +{{ status.entitlement.count }} | ++ |
The following errors were found:
+{{ status.requirement.count }}
areis required: License provides {{ status.entitlement.count }}
+ {{ status.entitlement.expiration.expiration_date }}
+ Product: | {{ currentState.licenseDecoded.publicProductName || currentState.licenseDecoded.productName }} |
Plan: | {{ currentState.licenseDecoded.publicPlanName || currentState.licenseDecoded.planName }} |