mirror of https://github.com/Fabio286/antares.git
fix(UI): no foreign key select editing query results
This commit is contained in:
parent
2c6e35288f
commit
5b21d17f3a
|
@ -33,6 +33,7 @@ An application created with minimalism and semplicity in mind, with features in
|
||||||
- Database management (add/edit/delete).
|
- Database management (add/edit/delete).
|
||||||
- Full tables management, including indexes and foreign keys.
|
- Full tables management, including indexes and foreign keys.
|
||||||
- Views, triggers, stored routines, functions and schedulers management (add/edit/delete).
|
- Views, triggers, stored routines, functions and schedulers management (add/edit/delete).
|
||||||
|
- Fake table data filler.
|
||||||
- Run queries on multiple tabs.
|
- Run queries on multiple tabs.
|
||||||
- Query suggestions and auto complete.
|
- Query suggestions and auto complete.
|
||||||
- Native dark theme.
|
- Native dark theme.
|
||||||
|
@ -53,7 +54,6 @@ This is a roadmap with major features will come in near future.
|
||||||
- More context menu shortcuts.
|
- More context menu shortcuts.
|
||||||
- More keyboard shortcuts.
|
- More keyboard shortcuts.
|
||||||
- Query logs console.
|
- Query logs console.
|
||||||
- Fake data filler.
|
|
||||||
- Import/export and migration.
|
- Import/export and migration.
|
||||||
- Light theme.
|
- Light theme.
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ Depending on your distribution, you will need to run the following command:
|
||||||
**Italian Translation** (46%) / [Giuseppe Gigliotti](https://github.com/ReverbOD) [[#20](https://github.com/Fabio286/antares/pull/20)]
|
**Italian Translation** (46%) / [Giuseppe Gigliotti](https://github.com/ReverbOD) [[#20](https://github.com/Fabio286/antares/pull/20)]
|
||||||
**Arabic Translation** (45%) / [Mohd-PH](https://github.com/Mohd-PH) [[#29](https://github.com/Fabio286/antares/pull/29)]
|
**Arabic Translation** (45%) / [Mohd-PH](https://github.com/Mohd-PH) [[#29](https://github.com/Fabio286/antares/pull/29)]
|
||||||
**Spanish Translation** (46%) / [hongkfui](https://github.com/hongkfui) [[#32](https://github.com/Fabio286/antares/pull/32)]
|
**Spanish Translation** (46%) / [hongkfui](https://github.com/hongkfui) [[#32](https://github.com/Fabio286/antares/pull/32)]
|
||||||
**French Translation** (100%) / [MrAnyx](https://github.com/MrAnyx) [[#32](https://github.com/Fabio286/antares/pull/44)]
|
**French Translation** (100%) / [MrAnyx](https://github.com/MrAnyx) [[#44](https://github.com/Fabio286/antares/pull/44)]
|
||||||
|
|
||||||
## Reviews
|
## Reviews
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
@dblclick="editON($event, col, cKey)"
|
@dblclick="editON($event, col, cKey)"
|
||||||
>{{ col | typeFormat(getFieldType(cKey), getFieldPrecision(cKey)) | cutText }}</span>
|
>{{ col | typeFormat(getFieldType(cKey), getFieldPrecision(cKey)) | cutText }}</span>
|
||||||
<ForeignKeySelect
|
<ForeignKeySelect
|
||||||
v-else-if="foreignKeys.includes(cKey)"
|
v-else-if="isForeignKey(cKey)"
|
||||||
class="editable-field"
|
class="editable-field"
|
||||||
:value.sync="editingContent"
|
:value.sync="editingContent"
|
||||||
:key-usage="getKeyUsage(cKey)"
|
:key-usage="getKeyUsage(cKey)"
|
||||||
|
@ -260,7 +260,19 @@ export default {
|
||||||
return this.keyUsage.map(key => key.field);
|
return this.keyUsage.map(key => key.field);
|
||||||
},
|
},
|
||||||
isEditable () {
|
isEditable () {
|
||||||
return this.fields ? !!(this.fields[0].schema && this.fields[0].table) : false;
|
if (this.fields) {
|
||||||
|
const nElements = this.fields.reduce((acc, curr) => {
|
||||||
|
acc.add(curr.table);
|
||||||
|
acc.add(curr.schema);
|
||||||
|
return acc;
|
||||||
|
}, new Set([]));
|
||||||
|
|
||||||
|
if (nElements.size > 2) return false;
|
||||||
|
|
||||||
|
return !!(this.fields[0].schema && this.fields[0].table);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -271,6 +283,12 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
isForeignKey (key) {
|
||||||
|
if (key.includes('.'))
|
||||||
|
key = key.split('.').pop();
|
||||||
|
|
||||||
|
return this.foreignKeys.includes(key);
|
||||||
|
},
|
||||||
getFieldType (cKey) {
|
getFieldType (cKey) {
|
||||||
let type = 'unknown';
|
let type = 'unknown';
|
||||||
const field = this.getFieldObj(cKey);
|
const field = this.getFieldObj(cKey);
|
||||||
|
@ -423,6 +441,8 @@ export default {
|
||||||
this.$emit('select-row', event, row);
|
this.$emit('select-row', event, row);
|
||||||
},
|
},
|
||||||
getKeyUsage (keyName) {
|
getKeyUsage (keyName) {
|
||||||
|
if (keyName.includes('.'))
|
||||||
|
return this.keyUsage.find(key => key.field === keyName.split('.').pop());
|
||||||
return this.keyUsage.find(key => key.field === keyName);
|
return this.keyUsage.find(key => key.field === keyName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue