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:
parent
a9232bf399
commit
b52620e039
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:bug
|
||||||
|
ui: Fix error message caused by control group
|
||||||
|
```
|
|
@ -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,26 +199,35 @@ export default Component.extend(FocusOnInsertMixin, WithNavToNearestAncestor, {
|
||||||
secretData.set(secretData.pathAttr, key);
|
secretData.set(secretData.pathAttr, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
return secretData.save().then(() => {
|
return secretData
|
||||||
if (!secretData.isError) {
|
.save()
|
||||||
if (isV2) {
|
.then(() => {
|
||||||
secret.set('id', key);
|
if (!secretData.isError) {
|
||||||
|
if (isV2) {
|
||||||
|
secret.set('id', key);
|
||||||
|
}
|
||||||
|
if (isV2 && Object.keys(secret.changedAttributes()).length) {
|
||||||
|
// save secret metadata
|
||||||
|
secret
|
||||||
|
.save()
|
||||||
|
.then(() => {
|
||||||
|
this.saveComplete(successCallback, key);
|
||||||
|
})
|
||||||
|
.catch(e => {
|
||||||
|
this.set(e, e.errors.join(' '));
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.saveComplete(successCallback, key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (isV2 && Object.keys(secret.changedAttributes()).length) {
|
})
|
||||||
// save secret metadata
|
.catch(error => {
|
||||||
secret
|
if (error instanceof ControlGroupError) {
|
||||||
.save()
|
let errorMessage = this.controlGroup.logFromError(error);
|
||||||
.then(() => {
|
this.set('error', errorMessage.content);
|
||||||
this.saveComplete(successCallback, key);
|
|
||||||
})
|
|
||||||
.catch(e => {
|
|
||||||
this.set(e, e.errors.join(' '));
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.saveComplete(successCallback, key);
|
|
||||||
}
|
}
|
||||||
}
|
throw error;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
saveComplete(callback, key) {
|
saveComplete(callback, key) {
|
||||||
if (this.wizard.featureState === 'secret') {
|
if (this.wizard.featureState === 'secret') {
|
||||||
|
|
Loading…
Reference in New Issue