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 KVObject from 'vault/lib/kv-object';
|
||||
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_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, {
|
||||
wizard: service(),
|
||||
controlGroup: service(),
|
||||
router: service(),
|
||||
store: service(),
|
||||
flashMessages: service(),
|
||||
|
@ -197,26 +199,35 @@ export default Component.extend(FocusOnInsertMixin, WithNavToNearestAncestor, {
|
|||
secretData.set(secretData.pathAttr, key);
|
||||
}
|
||||
|
||||
return secretData.save().then(() => {
|
||||
if (!secretData.isError) {
|
||||
if (isV2) {
|
||||
secret.set('id', key);
|
||||
return secretData
|
||||
.save()
|
||||
.then(() => {
|
||||
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
|
||||
secret
|
||||
.save()
|
||||
.then(() => {
|
||||
this.saveComplete(successCallback, key);
|
||||
})
|
||||
.catch(e => {
|
||||
this.set(e, e.errors.join(' '));
|
||||
});
|
||||
} else {
|
||||
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) {
|
||||
if (this.wizard.featureState === 'secret') {
|
||||
|
|
Loading…
Reference in New Issue