UI: Show error when connection roles fail to update on role create (#10980)

* Show error  when connection roles fail to update on role create

* Clean up errors for role, remove bad state setting after transition

* Add changelog
This commit is contained in:
Chelsea Shaw
2021-02-23 10:47:02 -06:00
committed by GitHub
parent 76584d2749
commit 5b68724e31
5 changed files with 36 additions and 32 deletions

View File

@@ -127,11 +127,15 @@ export default ApplicationAdapter.extend({
const backend = snapshot.attr('backend');
const id = snapshot.attr('name');
const db = snapshot.attr('database');
await this._updateAllowedRoles(store, {
role: id,
backend,
db: db[0],
});
try {
await this._updateAllowedRoles(store, {
role: id,
backend,
db: db[0],
});
} catch (e) {
throw new Error('Could not update allowed roles for selected database. Check Vault logs for details');
}
return this.ajax(this.urlFor(backend, id, roleType), 'POST', { data }).then(() => {
// ember data doesn't like 204s if it's not a DELETE