mirror of https://github.com/rancher/ui.git
Fix the ns issue in creating dns/pvc page
https://github.com/rancher/rancher/issues/16692
This commit is contained in:
parent
02a53c3815
commit
8c2a0b85d4
|
|
@ -7,6 +7,7 @@ import Component from '@ember/component';
|
|||
import { next } from '@ember/runloop';
|
||||
import ViewNewEdit from 'shared/mixins/view-new-edit';
|
||||
import layout from './template';
|
||||
import Errors from 'ui/utils/errors';
|
||||
import {
|
||||
ARECORD, CNAME, ALIAS, WORKLOAD, SELECTOR
|
||||
} from 'ui/models/dnsrecord';
|
||||
|
|
@ -74,8 +75,12 @@ export default Component.extend(ViewNewEdit, ChildHook, {
|
|||
set(this, 'model.namespaceId', get(this, 'namespace.id') || '__placeholder__');
|
||||
const self = this;
|
||||
const sup = this._super;
|
||||
const errors = [];
|
||||
|
||||
if ( get(this, 'namespaceErrors.length') ) {
|
||||
errors.pushObjects(get(this, 'namespaceErrors') || []);
|
||||
set(this, 'errors', errors);
|
||||
|
||||
if ( get(errors, 'length') !== 0 ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -83,6 +88,8 @@ export default Component.extend(ViewNewEdit, ChildHook, {
|
|||
set(this, 'model.namespaceId', get(this, 'namespace.id'));
|
||||
|
||||
return sup.apply(self, ...arguments);
|
||||
}).catch((err) => {
|
||||
set(this, 'errors', [Errors.stringify(err)]);
|
||||
});
|
||||
},
|
||||
|
||||
|
|
@ -137,8 +144,6 @@ export default Component.extend(ViewNewEdit, ChildHook, {
|
|||
break;
|
||||
}
|
||||
|
||||
errors.pushObjects(get(this, 'namespaceErrors') || []);
|
||||
|
||||
set(this, 'errors', errors);
|
||||
|
||||
return errors.length === 0;
|
||||
|
|
|
|||
|
|
@ -124,6 +124,5 @@
|
|||
|
||||
{{#if editing}}
|
||||
{{top-errors errors=errors}}
|
||||
{{top-errors errors=namespaceErrors}}
|
||||
{{save-cancel editing=isEdit save="save" cancel="cancel"}}
|
||||
{{/if}}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import Component from '@ember/component';
|
|||
import ViewNewEdit from 'shared/mixins/view-new-edit';
|
||||
import ChildHook from 'shared/mixins/child-hook';
|
||||
import layout from './template';
|
||||
import Errors from 'ui/utils/errors';
|
||||
|
||||
export default Component.extend(ViewNewEdit, ChildHook, {
|
||||
intl: service(),
|
||||
|
|
@ -133,7 +134,12 @@ export default Component.extend(ViewNewEdit, ChildHook, {
|
|||
const sup = this._super;
|
||||
|
||||
if ( get(this, 'selectNamespace') ) {
|
||||
if ( get(this, 'namespaceErrors.length') ) {
|
||||
const errors = [];
|
||||
|
||||
errors.pushObjects(get(this, 'namespaceErrors') || []);
|
||||
set(this, 'errors', errors);
|
||||
|
||||
if ( get(errors, 'length') !== 0 ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -141,6 +147,8 @@ export default Component.extend(ViewNewEdit, ChildHook, {
|
|||
set(pr, 'namespaceId', get(this, 'namespace.id'));
|
||||
|
||||
return sup.apply(self, ...arguments);
|
||||
}).catch((err) => {
|
||||
set(this, 'errors', [Errors.stringify(err)]);
|
||||
});
|
||||
} else {
|
||||
if ( !get(pr, 'namespaceId') ) {
|
||||
|
|
|
|||
|
|
@ -159,7 +159,5 @@
|
|||
|
||||
{{#unless isView}}
|
||||
{{top-errors errors=errors}}
|
||||
{{top-errors errors=namespaceErrors}}
|
||||
|
||||
{{save-cancel createLabel=(if actuallySave 'saveCancel.create' 'cruPersistentVolumeClaim.define.addActionLabel') save="save" cancel="viewEditCancel"}}
|
||||
{{/unless}}
|
||||
|
|
|
|||
Loading…
Reference in New Issue