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'"> <option v-if="localOptions.returns === 'VOID'">
VOID VOID
</option> </option>
<option v-if="!isInDataTypes">
{{ localOptions.returns }}
</option>
<optgroup <optgroup
v-for="group in workspace.dataTypes" v-for="group in workspace.dataTypes"
:key="group.group" :key="group.group"
@ -178,6 +181,21 @@ export default {
}, },
customizations () { customizations () {
return this.workspace.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 () { created () {

View File

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