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

fix: field apparently loses index or foreign key on rename in table editor

This commit is contained in:
2021-04-16 17:42:16 +02:00
parent 2584c9b9c2
commit 7d2ace9456
5 changed files with 35 additions and 19 deletions

View File

@@ -68,6 +68,7 @@
@remove-field="removeField"
@add-new-index="addNewIndex"
@add-to-index="addToIndex"
@rename-field="renameField"
/>
</div>
<WorkspacePropsOptionsModal
@@ -457,6 +458,20 @@ export default {
scrollable.scrollTop = scrollable.scrollHeight + 30;
}, 20);
},
renameField (payload) {
this.localIndexes = this.localIndexes.map(index => {
const fi = index.fields.findIndex(field => field === payload.old);
if (fi !== -1)
index.fields[fi] = payload.new;
return index;
});
this.localKeyUsage = this.localKeyUsage.map(key => {
if (key.field === payload.old)
key.field = payload.new;
return key;
});
},
removeField (uid) {
this.localFields = this.localFields.filter(field => field._id !== uid);
},