forked from acouzens/open5gs
fix the bug when profile is changes
This commit is contained in:
parent
588a6ba012
commit
6c8d4328fb
|
@ -4,6 +4,8 @@ import PropTypes from 'prop-types';
|
|||
import withWidth, { SMALL } from 'helpers/with-width';
|
||||
import { Form } from 'components';
|
||||
|
||||
import traverse from 'traverse';
|
||||
|
||||
const schema = {
|
||||
"title": "Subscriber Configuration",
|
||||
"type": "object",
|
||||
|
@ -480,7 +482,6 @@ class Edit extends Component {
|
|||
getFormDataFromProfile(profile) {
|
||||
let formData;
|
||||
|
||||
|
||||
formData = Object.assign({}, this.props.profiles.filter(p => p._id === profile)[0]);
|
||||
formData = Object.assign(formData, { profile });
|
||||
|
||||
|
@ -488,6 +489,20 @@ class Edit extends Component {
|
|||
delete formData._id;
|
||||
delete formData.__v;
|
||||
|
||||
traverse(formData).forEach(function(x) {
|
||||
if (this.key == 'downlink') this.update(Number(x));
|
||||
if (this.key == 'uplink') this.update(Number(x));
|
||||
})
|
||||
if (formData.security) {
|
||||
if (formData.security.opc) {
|
||||
formData.security.op_type = 0;
|
||||
formData.security.op_value = formData.security.opc;
|
||||
} else {
|
||||
formData.security.op_type = 1;
|
||||
formData.security.op_value = formData.security.op;
|
||||
}
|
||||
}
|
||||
|
||||
return formData;
|
||||
}
|
||||
|
||||
|
|
|
@ -104,22 +104,6 @@ class Document extends Component {
|
|||
this.setState({ formData });
|
||||
}
|
||||
|
||||
profiles.data.map(profile => {
|
||||
traverse(profile).forEach(function(x) {
|
||||
if (this.key == 'downlink') this.update(Number(x));
|
||||
if (this.key == 'uplink') this.update(Number(x));
|
||||
})
|
||||
if (profile.security) {
|
||||
if (profile.security.opc) {
|
||||
profile.security.op_type = 0;
|
||||
profile.security.op_value = profile.security.opc;
|
||||
} else {
|
||||
profile.security.op_type = 1;
|
||||
profile.security.op_value = profile.security.op;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (status.response) {
|
||||
NProgress.configure({
|
||||
parent: 'body',
|
||||
|
|
Loading…
Reference in New Issue