1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

feat: display all keys in properties tab

This commit is contained in:
2020-11-20 17:24:02 +01:00
parent dfb24c65f3
commit 27769f204f
7 changed files with 83 additions and 11 deletions

View File

@ -32,7 +32,7 @@
<span>{{ $t('word.add') }}</span>
<i class="mdi mdi-24px mdi-playlist-plus ml-1" />
</button>
<button class="btn btn-dark btn-sm d-none">
<button class="btn btn-dark btn-sm">
<span>{{ $t('word.indexes') }}</span>
<i class="mdi mdi-24px mdi-key mdi-rotate-45 ml-1" />
</button>
@ -52,6 +52,7 @@
v-if="localFields"
ref="queryTable"
:fields="localFields"
:indexes="localIndexes"
:tab-uid="tabUid"
:conn-uid="connection.uid"
:table="table"
@ -178,6 +179,8 @@ export default {
localFields: [],
originalKeyUsage: [],
localKeyUsage: [],
originalIndexes: [],
localIndexes: [],
localOptions: [],
lastTable: null
};
@ -257,6 +260,20 @@ export default {
this.addNotification({ status: 'error', message: err.stack });
}
try { // Indexes
const { status, response } = await Tables.getTableIndexes(params);
if (status === 'success') {
this.originalIndexes = response;
this.localIndexes = JSON.parse(JSON.stringify(response));
}
else
this.addNotification({ status: 'error', message: response });
}
catch (err) {
this.addNotification({ status: 'error', message: err.stack });
}
try { // Key usage (foreign keys)
const { status, response } = await Tables.getKeyUsage(params);

View File

@ -99,6 +99,7 @@
v-for="row in fields"
:key="row._id"
:row="row"
:indexes="getIndexes(row.name)"
:data-types="dataTypes"
@contextmenu="contextMenu"
/>
@ -122,6 +123,7 @@ export default {
},
props: {
fields: Array,
indexes: Array,
tabUid: [String, Number],
connUid: String,
table: String,
@ -195,6 +197,9 @@ export default {
},
removeField () {
this.$emit('remove-field', this.selectedField);
},
getIndexes (field) {
return this.indexes.filter(index => index.column === field);
}
}
};

View File

@ -7,12 +7,15 @@
</div>
</div>
<div class="td" tabindex="0">
<i
v-if="localRow.key"
:title="keyName(localRow.key)"
class="mdi mdi-key column-key c-help pl-1"
:class="`key-${localRow.key}`"
/>
<div class="text-center">
<i
v-for="index in indexes"
:key="index.name"
:title="index.type"
class="d-inline-block mdi mdi-key column-key c-help"
:class="`key-${index.type}`"
/>
</div>
</div>
<div class="td">
<span
@ -279,7 +282,8 @@ export default {
},
props: {
row: Object,
dataTypes: Array
dataTypes: Array,
indexes: Array
},
data () {
return {