UI/control groups kv (#11143)

* forced reload causing issues removed and tested

* better logging for handling controlGroup error

* cleanup

* add changelog

* address pr comments
This commit is contained in:
Angel Garbarino 2021-03-22 10:03:47 -06:00 committed by GitHub
parent a9232bf399
commit b52620e039
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 18 deletions

3
changelog/11143.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
ui: Fix error message caused by control group
```

View File

@ -9,6 +9,7 @@ import WithNavToNearestAncestor from 'vault/mixins/with-nav-to-nearest-ancestor'
import keys from 'vault/lib/keycodes'; import keys from 'vault/lib/keycodes';
import KVObject from 'vault/lib/kv-object'; import KVObject from 'vault/lib/kv-object';
import { maybeQueryRecord } from 'vault/macros/maybe-query-record'; import { maybeQueryRecord } from 'vault/macros/maybe-query-record';
import ControlGroupError from 'vault/lib/control-group-error';
const LIST_ROUTE = 'vault.cluster.secrets.backend.list'; const LIST_ROUTE = 'vault.cluster.secrets.backend.list';
const LIST_ROOT_ROUTE = 'vault.cluster.secrets.backend.list-root'; const LIST_ROOT_ROUTE = 'vault.cluster.secrets.backend.list-root';
@ -16,6 +17,7 @@ const SHOW_ROUTE = 'vault.cluster.secrets.backend.show';
export default Component.extend(FocusOnInsertMixin, WithNavToNearestAncestor, { export default Component.extend(FocusOnInsertMixin, WithNavToNearestAncestor, {
wizard: service(), wizard: service(),
controlGroup: service(),
router: service(), router: service(),
store: service(), store: service(),
flashMessages: service(), flashMessages: service(),
@ -197,7 +199,9 @@ export default Component.extend(FocusOnInsertMixin, WithNavToNearestAncestor, {
secretData.set(secretData.pathAttr, key); secretData.set(secretData.pathAttr, key);
} }
return secretData.save().then(() => { return secretData
.save()
.then(() => {
if (!secretData.isError) { if (!secretData.isError) {
if (isV2) { if (isV2) {
secret.set('id', key); secret.set('id', key);
@ -216,6 +220,13 @@ export default Component.extend(FocusOnInsertMixin, WithNavToNearestAncestor, {
this.saveComplete(successCallback, key); this.saveComplete(successCallback, key);
} }
} }
})
.catch(error => {
if (error instanceof ControlGroupError) {
let errorMessage = this.controlGroup.logFromError(error);
this.set('error', errorMessage.content);
}
throw error;
}); });
}, },
saveComplete(callback, key) { saveComplete(callback, key) {