1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-02-17 12:10:39 +01:00

refactor: better description in foreign key value select

This commit is contained in:
Fabio Di Stasio 2021-05-20 15:07:51 +02:00
parent 0f10c9e824
commit 840241c3cc
2 changed files with 4 additions and 3 deletions

View File

@ -51,7 +51,8 @@ export default {
}),
isValidDefault () {
if (!this.foreignList.length) return true;
return this.value === null || this.foreignList.some(foreign => foreign.foreign_column.toString() === this.value.toString());
if (this.value === null) return false;
return this.foreignList.some(foreign => foreign.foreign_column.toString() === this.value.toString());
}
},
async created () {
@ -65,7 +66,7 @@ export default {
try { // Field data
const { status, response } = await Tables.getTableColumns(params);
if (status === 'success') {
const textField = response.find(field => [...TEXT, ...LONG_TEXT].includes(field.type));
const textField = response.find(field => [...TEXT, ...LONG_TEXT].includes(field.type) && field.name !== this.keyUsage.refField);
foreignDesc = textField ? textField.name : false;
}
else

View File

@ -253,7 +253,7 @@ export default {
fieldDefault = +field.default;
if ([...TEXT, ...LONG_TEXT].includes(field.type))
fieldDefault = field.default ? field.default.substring(1, field.default.length - 1) : '';
fieldDefault = field.default;
if ([...TIME, ...DATE].includes(field.type))
fieldDefault = field.default;