backport of UI: handle control group error on SSH (#23034)
Co-authored-by: Chelsea Shaw <82459713+hashishaw@users.noreply.github.com>
This commit is contained in:
parent
3ba22f14e0
commit
3505868165
|
@ -0,0 +1,3 @@
|
|||
```release-note:bug
|
||||
ui (enterprise): Fix error message when generating SSH credential with control group
|
||||
```
|
|
@ -31,6 +31,7 @@ const MODEL_TYPES = {
|
|||
};
|
||||
|
||||
export default Component.extend({
|
||||
controlGroup: service(),
|
||||
store: service(),
|
||||
router: service(),
|
||||
// set on the component
|
||||
|
@ -95,8 +96,21 @@ export default Component.extend({
|
|||
create() {
|
||||
const model = this.model;
|
||||
this.set('loading', true);
|
||||
this.model.save().finally(() => {
|
||||
this.model
|
||||
.save()
|
||||
.then(() => {
|
||||
model.set('hasGenerated', true);
|
||||
})
|
||||
.catch((error) => {
|
||||
// Handle control group AdapterError
|
||||
if (error.message === 'Control Group encountered') {
|
||||
this.controlGroup.saveTokenFromError(error);
|
||||
const err = this.controlGroup.logFromError(error);
|
||||
error.errors = [err.content];
|
||||
}
|
||||
throw error;
|
||||
})
|
||||
.finally(() => {
|
||||
this.set('loading', false);
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue