1
1
mirror of https://github.com/Fabio286/antares.git synced 2024-12-25 08:20:39 +01:00

fix: some properties do not reset after fields changes

This commit is contained in:
Fabio Di Stasio 2020-12-11 12:57:24 +01:00
parent 9291a7a7b4
commit 3ed5ea023e

View File

@ -105,7 +105,7 @@
<input <input
v-model="localRow.nullable" v-model="localRow.nullable"
type="checkbox" type="checkbox"
:disabled="localRow.key === 'pri'" :disabled="!isNullable"
> >
<i class="form-icon" /> <i class="form-icon" />
</label> </label>
@ -228,7 +228,7 @@
<label class="form-radio form-inline"> <label class="form-radio form-inline">
<input <input
v-model="defaultValue.type" v-model="defaultValue.type"
:disabled="localRow.key !== 'pri'" :disabled="!canAutoincrement"
type="radio" type="radio"
name="default" name="default"
value="autoincrement" value="autoincrement"
@ -330,6 +330,12 @@ export default {
}, },
collations () { collations () {
return this.getWorkspace(this.selectedWorkspace).collations; return this.getWorkspace(this.selectedWorkspace).collations;
},
canAutoincrement () {
return this.indexes.some(index => ['PRIMARY', 'UNIQUE'].includes(index.type));
},
isNullable () {
return !this.indexes.some(index => ['PRIMARY'].includes(index.type));
} }
}, },
watch: { watch: {
@ -338,6 +344,13 @@ export default {
}, },
row () { row () {
this.localRow = this.row; this.localRow = this.row;
},
indexes () {
if (!this.canAutoincrement)
this.localRow.autoIncrement = false;
if (!this.isNullable)
this.localRow.nullable = false;
} }
}, },
mounted () { mounted () {
@ -433,6 +446,12 @@ export default {
if (!this.fieldType.collation) if (!this.fieldType.collation)
this.localRow.collation = null; this.localRow.collation = null;
if (!this.fieldType.unsigned)
this.localRow.unsigned = false;
if (!this.fieldType.zerofill)
this.localRow.zerofill = false;
} }
if (this.editingField === 'default') { if (this.editingField === 'default') {