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({
|
export default Component.extend({
|
||||||
|
controlGroup: service(),
|
||||||
store: service(),
|
store: service(),
|
||||||
router: service(),
|
router: service(),
|
||||||
// set on the component
|
// set on the component
|
||||||
|
@ -95,10 +96,23 @@ export default Component.extend({
|
||||||
create() {
|
create() {
|
||||||
const model = this.model;
|
const model = this.model;
|
||||||
this.set('loading', true);
|
this.set('loading', true);
|
||||||
this.model.save().finally(() => {
|
this.model
|
||||||
model.set('hasGenerated', true);
|
.save()
|
||||||
this.set('loading', false);
|
.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);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
codemirrorUpdated(attr, val, codemirror) {
|
codemirrorUpdated(attr, val, codemirror) {
|
||||||
|
|
Loading…
Reference in New Issue