fix(UI): data type not listed in selection if not present in global types

This commit is contained in:
Fabio Di Stasio 2021-04-19 11:07:29 +02:00
parent cafb65560a
commit 6eb2977568
2 changed files with 37 additions and 1 deletions

View File

@ -80,6 +80,9 @@
<option v-if="localOptions.returns === 'VOID'">
VOID
</option>
<option v-if="!isInDataTypes">
{{ localOptions.returns }}
</option>
<optgroup
v-for="group in workspace.dataTypes"
:key="group.group"
@ -178,6 +181,21 @@ export default {
},
customizations () {
return this.workspace.customizations;
},
isInDataTypes () {
let typeNames = [];
for (const group of this.workspace.dataTypes) {
const groupTypeNames = group.types.reduce((acc, curr) => {
acc.push(curr.name);
return acc;
}, []);
typeNames = [
...groupTypeNames,
...typeNames
];
}
return typeNames.includes(this.localOptions.returns);
}
},
created () {

View File

@ -60,6 +60,9 @@
class="form-select editable-field small-select text-uppercase"
@blur="editOFF"
>
<option v-if="!isInDataTypes">
{{ row.type }}
</option>
<optgroup
v-for="group in dataTypes"
:key="group.group"
@ -68,7 +71,7 @@
<option
v-for="type in group.types"
:key="type.name"
:selected="localRow.type.toUpperCase() === type.name"
:selected="localRow.type === type.name"
:value="type.name"
>
{{ type.name }}
@ -374,6 +377,21 @@ export default {
},
isNullable () {
return !this.indexes.some(index => ['PRIMARY'].includes(index.type));
},
isInDataTypes () {
let typeNames = [];
for (const group of this.dataTypes) {
const groupTypeNames = group.types.reduce((acc, curr) => {
acc.push(curr.name);
return acc;
}, []);
typeNames = [
...groupTypeNames,
...typeNames
];
}
return typeNames.includes(this.row.type);
}
},
watch: {