Add support for custom error messaging on license page

This commit is contained in:
mabashian 2019-08-30 10:08:13 -04:00 committed by Ryan Petrello
parent 53925f5e98
commit 38a7d62745
No known key found for this signature in database
GPG Key ID: F2AA5F2122351777
4 changed files with 19 additions and 13 deletions

View File

@ -25,8 +25,8 @@ export default
.then((response) =>{
return response.data;
})
.catch(() => {
return $q.reject();
.catch(({data}) => {
return $q.reject(data);
});
},

View File

@ -124,8 +124,7 @@
}
}
.License-submit--success, .License-submit--failure{
line-height: 33px;
.License-submit--success, .License-submit--failure {
margin: 0;
}
.License-file--container {

View File

@ -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;
});
};
}];

View File

@ -167,19 +167,23 @@
</span>
<div class="License-analyticsCheckboxGroup">
<div class="License-analyticsCheckbox checkbox">
<input type="checkbox" ng-model="newLicense.pendo" ng-disabled="!user_is_superuser" required>
<input type="checkbox" ng-model="newLicense.pendo" ng-disabled="!user_is_superuser">
<translate>User analytics: This data is used to enhance future releases of the Tower Software and help streamline customer experience and success.</translate>
</div>
<div class="License-analyticsCheckbox checkbox">
<input type="checkbox" ng-model="newLicense.insights" ng-disabled="!user_is_superuser" required>
<input type="checkbox" ng-model="newLicense.insights" ng-disabled="!user_is_superuser">
<translate>Automation analytics: This data is used to enhance future releases of the Tower Software and to provide Automation Insights to Tower subscribers.</translate>
</div>
</div>
</div>
<div>
<button ng-click="submit()" class="btn btn-success pull-right" ng-disabled="(!newLicense.file && (!rhCreds.username || !rhCreds.password)) || (newLicense.file && newLicense.file.license_key == null) || newLicense.eula == null || !user_is_superuser" translate>Submit</button>
<span ng-show="success == true" class="License-greenText License-submit--success pull-right" translate>Save successful!</span>
<span ng-show="licenseError == true" class="License-redText License-submit--failure pull-right" translate>Invalid License - Save unsuccessful</span>
<div style="display: flex;flex-direction: row;align-content:flex-end;">
<div style="flex: 1">
<span ng-show="success == true" class="License-greenText License-submit--success pull-right" translate>Save successful!</span>
<span ng-show="licenseError" class="License-redText License-submit--failure pull-right" translate>Save unsuccessful - {{licenseError}}</span>
</div>
<div>
<button ng-click="submit()" class="btn btn-success pull-right" ng-disabled="(!newLicense.file && (!rhCreds.username || !rhCreds.password)) || (newLicense.file && newLicense.file.license_key == null) || newLicense.eula == null || !user_is_superuser" translate>Submit</button>
</div>
</div>
</form>
</div>