Fix relations

This commit is contained in:
soupette 2019-03-25 19:08:17 +01:00
parent 618d8afa4d
commit d2f50f7bae
6 changed files with 11 additions and 13 deletions

View File

@ -329,7 +329,9 @@ export const formatModelAttributes = attributes =>
if (
((curr.includes('max') || curr.includes('min')) && !value) ||
curr === 'isVirtual' ||
(curr === 'dominant' && !value)
(curr === 'dominant' && !value) ||
(curr === 'columnName' && value === '') ||
(curr === 'targetColumnName' && value === '')
) {
return acc2;
}

View File

@ -54,16 +54,16 @@ export function* submitCT({
body.plugin = source;
}
yield put(emitEvent('willSaveContentType'));
emitEvent('willSaveContentType');
const opts = { method: 'PUT', body };
yield call(request, requestURL, opts, true);
yield put(emitEvent('didSaveContentType'));
emitEvent('didSaveContentType');
yield put(submitContentTypeSucceeded(oldContentTypeName));
if (name !== oldContentTypeName) {
yield put(emitEvent('didEditNameOfContentType'));
emitEvent('didEditNameOfContentType');
const appPlugins = plugins.toJS ? plugins.toJS() : plugins;
const appMenu = get(appPlugins, ['content-manager', 'leftMenuSections'], []);
@ -86,14 +86,14 @@ export function* submitCT({
/* istanbul ignore-next */
export function* submitTempCT({ body, context: { emitEvent, plugins, updatePlugin } }) {
try {
yield put(emitEvent('willSaveContentType'));
emitEvent('willSaveContentType');
const requestURL = `/${pluginId}/models`;
const opts = { method: 'POST', body };
yield call(request, requestURL, opts, true);
yield put(emitEvent('didSaveContentType'));
emitEvent('didSaveContentType');
yield put(submitTempContentTypeSucceeded());
const { name } = body;

View File

@ -140,7 +140,6 @@ describe('Content Type Builder Action utils', () => {
pluginValue: 'users-permissions',
plugin: true,
configurable: false,
targetColumnName: '',
target: 'role',
},
},
@ -152,7 +151,6 @@ describe('Content Type Builder Action utils', () => {
nature: 'manyToMany',
pluginValue: 'users-permissions',
plugin: true,
targetColumnName: '',
target: 'role2',
},
},
@ -740,7 +738,6 @@ describe('App actions', () => {
pluginValue: 'users-permissions',
plugin: true,
configurable: false,
targetColumnName: '',
target: 'role',
},
},
@ -833,7 +830,6 @@ describe('App actions', () => {
pluginValue: 'users-permissions',
plugin: true,
configurable: false,
targetColumnName: '',
target: 'role',
},
},

View File

@ -359,7 +359,6 @@
"type": "checkbox",
"value": false,
"validations": {
"required": true
}
}
]

View File

@ -266,7 +266,7 @@ export class ModelPage extends React.Component {
} = this.props;
const attributeType = ['integer', 'biginteger', 'float', 'decimal'].includes(type) ? 'number' : type;
if (canOpenModal) {
if (canOpenModal || this.isUpdatingTemporaryContentType()) {
setTemporaryAttribute(attributeName, this.isUpdatingTemporaryContentType(), this.getModelName());
await this.wait();

View File

@ -30,8 +30,9 @@
"users": {
"collection": "user",
"via": "role",
"configurable": false,
"plugin": "users-permissions"
}
},
"collectionName": "users-permissions_role"
}
}