diff --git a/src/main/ipc-handlers/tables.js b/src/main/ipc-handlers/tables.js index 47ef823f..997dadb0 100644 --- a/src/main/ipc-handlers/tables.js +++ b/src/main/ipc-handlers/tables.js @@ -84,7 +84,7 @@ export default (connections) => { }); ipcMain.handle('update-table-cell', async (event, params) => { - delete params.row._id; + delete params.row._antares_id; try { // TODO: move to client classes let escapedParam; diff --git a/src/renderer/components/ModalAskParameters.vue b/src/renderer/components/ModalAskParameters.vue index 1f2ff79a..487d2753 100644 --- a/src/renderer/components/ModalAskParameters.vue +++ b/src/renderer/components/ModalAskParameters.vue @@ -17,7 +17,7 @@
diff --git a/src/renderer/components/WorkspaceTabNewTable.vue b/src/renderer/components/WorkspaceTabNewTable.vue index bbfe7c87..1d20fc8d 100644 --- a/src/renderer/components/WorkspaceTabNewTable.vue +++ b/src/renderer/components/WorkspaceTabNewTable.vue @@ -344,7 +344,7 @@ export default { }, addField () { this.localFields.push({ - _id: uidGen(), + _antares_id: uidGen(), name: `${this.$tc('word.field', 1)}_${++this.newFieldsCounter}`, key: '', type: this.workspace.dataTypes[0].types[0].name, @@ -385,8 +385,8 @@ export default { }); }, duplicateField (uid) { - const fieldToClone = Object.assign({}, this.localFields.find(field => field._id === uid)); - fieldToClone._id = uidGen(); + const fieldToClone = Object.assign({}, this.localFields.find(field => field._antares_id === uid)); + fieldToClone._antares_id = uidGen(); fieldToClone.name = `${fieldToClone.name}_copy`; fieldToClone.order = this.localFields.length + 1; this.localFields = [...this.localFields, fieldToClone]; @@ -397,11 +397,11 @@ export default { }, 20); }, removeField (uid) { - this.localFields = this.localFields.filter(field => field._id !== uid); + this.localFields = this.localFields.filter(field => field._antares_id !== uid); }, addNewIndex (payload) { this.localIndexes = [...this.localIndexes, { - _id: uidGen(), + _antares_id: uidGen(), name: payload.index === 'PRIMARY' ? 'PRIMARY' : payload.field, fields: [payload.field], type: payload.index, @@ -413,7 +413,7 @@ export default { }, addToIndex (payload) { this.localIndexes = this.localIndexes.map(index => { - if (index._id === payload.index) index.fields.push(payload.field); + if (index._antares_id === payload.index) index.fields.push(payload.field); return index; }); }, diff --git a/src/renderer/components/WorkspaceTabPropsFunction.vue b/src/renderer/components/WorkspaceTabPropsFunction.vue index edb6046d..c8a4d04a 100644 --- a/src/renderer/components/WorkspaceTabPropsFunction.vue +++ b/src/renderer/components/WorkspaceTabPropsFunction.vue @@ -373,7 +373,7 @@ export default { this.originalFunction = response; this.originalFunction.parameters = [...this.originalFunction.parameters.map(param => { - param._id = uidGen(); + param._antares_id = uidGen(); return param; })]; diff --git a/src/renderer/components/WorkspaceTabPropsFunctionParamsModal.vue b/src/renderer/components/WorkspaceTabPropsFunctionParamsModal.vue index 2e86217d..40adae63 100644 --- a/src/renderer/components/WorkspaceTabPropsFunctionParamsModal.vue +++ b/src/renderer/components/WorkspaceTabPropsFunctionParamsModal.vue @@ -36,10 +36,10 @@
@@ -56,7 +56,7 @@ @@ -196,7 +196,7 @@ export default { }, computed: { selectedParamObj () { - return this.parametersProxy.find(param => param._id === this.selectedParam); + return this.parametersProxy.find(param => param._antares_id === this.selectedParam); }, isChanged () { return JSON.stringify(this.localParameters) !== JSON.stringify(this.parametersProxy); @@ -238,7 +238,7 @@ export default { }, addParameter () { this.parametersProxy = [...this.parametersProxy, { - _id: uidGen(), + _antares_id: uidGen(), name: `Param${this.i++}`, type: 'INT', context: 'IN', @@ -253,7 +253,7 @@ export default { }, 20); }, removeParameter (uid) { - this.parametersProxy = this.parametersProxy.filter(param => param._id !== uid); + this.parametersProxy = this.parametersProxy.filter(param => param._antares_id !== uid); if (this.selectedParam === name && this.parametersProxy.length) this.resetSelectedID(); @@ -266,7 +266,7 @@ export default { this.resetSelectedID(); }, resetSelectedID () { - this.selectedParam = this.parametersProxy.length ? this.parametersProxy[0]._id : ''; + this.selectedParam = this.parametersProxy.length ? this.parametersProxy[0]._antares_id : ''; } } }; diff --git a/src/renderer/components/WorkspaceTabPropsRoutine.vue b/src/renderer/components/WorkspaceTabPropsRoutine.vue index f9f4e894..ced738d0 100644 --- a/src/renderer/components/WorkspaceTabPropsRoutine.vue +++ b/src/renderer/components/WorkspaceTabPropsRoutine.vue @@ -318,7 +318,7 @@ export default { this.originalRoutine = response; this.originalRoutine.parameters = [...this.originalRoutine.parameters.map(param => { - param._id = uidGen(); + param._antares_id = uidGen(); return param; })]; diff --git a/src/renderer/components/WorkspaceTabPropsRoutineParamsModal.vue b/src/renderer/components/WorkspaceTabPropsRoutineParamsModal.vue index 5802511c..6c3c0381 100644 --- a/src/renderer/components/WorkspaceTabPropsRoutineParamsModal.vue +++ b/src/renderer/components/WorkspaceTabPropsRoutineParamsModal.vue @@ -36,10 +36,10 @@
@@ -56,7 +56,7 @@ @@ -196,7 +196,7 @@ export default { }, computed: { selectedParamObj () { - return this.parametersProxy.find(param => param._id === this.selectedParam); + return this.parametersProxy.find(param => param._antares_id === this.selectedParam); }, isChanged () { return JSON.stringify(this.localParameters) !== JSON.stringify(this.parametersProxy); @@ -238,7 +238,7 @@ export default { }, addParameter () { this.parametersProxy = [...this.parametersProxy, { - _id: uidGen(), + _antares_id: uidGen(), name: `param${this.i++}`, type: this.workspace.dataTypes[0].types[0].name, context: 'IN', @@ -253,7 +253,7 @@ export default { }, 20); }, removeParameter (uid) { - this.parametersProxy = this.parametersProxy.filter(param => param._id !== uid); + this.parametersProxy = this.parametersProxy.filter(param => param._antares_id !== uid); if (this.selectedParam === name && this.parametersProxy.length) this.resetSelectedID(); @@ -266,7 +266,7 @@ export default { this.resetSelectedID(); }, resetSelectedID () { - this.selectedParam = this.parametersProxy.length ? this.parametersProxy[0]._id : ''; + this.selectedParam = this.parametersProxy.length ? this.parametersProxy[0]._antares_id : ''; } } }; diff --git a/src/renderer/components/WorkspaceTabPropsTable.vue b/src/renderer/components/WorkspaceTabPropsTable.vue index 10db2a23..3e392d61 100644 --- a/src/renderer/components/WorkspaceTabPropsTable.vue +++ b/src/renderer/components/WorkspaceTabPropsTable.vue @@ -342,7 +342,7 @@ export default { field.default = `'${field.default}'`; } - return { ...field, _id: uidGen() }; + return { ...field, _antares_id: uidGen() }; }); this.localFields = JSON.parse(JSON.stringify(this.originalFields)); } @@ -365,7 +365,7 @@ export default { this.originalIndexes = Object.keys(indexesObj).map(index => { return { - _id: uidGen(), + _antares_id: uidGen(), name: index, fields: indexesObj[index].map(field => field.column), type: indexesObj[index][0].type, @@ -391,7 +391,7 @@ export default { if (status === 'success') { this.originalKeyUsage = response.map(foreign => { return { - _id: uidGen(), + _antares_id: uidGen(), ...foreign }; }); @@ -411,25 +411,25 @@ export default { this.isSaving = true; // FIELDS - const originalIDs = this.originalFields.reduce((acc, curr) => [...acc, curr._id], []); - const localIDs = this.localFields.reduce((acc, curr) => [...acc, curr._id], []); + const originalIDs = this.originalFields.reduce((acc, curr) => [...acc, curr._antares_id], []); + const localIDs = this.localFields.reduce((acc, curr) => [...acc, curr._antares_id], []); // Fields Additions - const additions = this.localFields.filter((field, i) => !originalIDs.includes(field._id)).map(field => { - const lI = this.localFields.findIndex(localField => localField._id === field._id); + const additions = this.localFields.filter((field, i) => !originalIDs.includes(field._antares_id)).map(field => { + const lI = this.localFields.findIndex(localField => localField._antares_id === field._antares_id); const after = lI > 0 ? this.localFields[lI - 1].name : false; return { ...field, after }; }); // Fields Deletions - const deletions = this.originalFields.filter(field => !localIDs.includes(field._id)); + const deletions = this.originalFields.filter(field => !localIDs.includes(field._antares_id)); // Fields Changes const changes = []; this.originalFields.forEach((originalField, oI) => { - const lI = this.localFields.findIndex(localField => localField._id === originalField._id); - const originalSibling = oI > 0 ? this.originalFields[oI - 1]._id : false; - const localSibling = lI > 0 ? this.localFields[lI - 1]._id : false; + const lI = this.localFields.findIndex(localField => localField._antares_id === originalField._antares_id); + const originalSibling = oI > 0 ? this.originalFields[oI - 1]._antares_id : false; + const localSibling = lI > 0 ? this.localFields[lI - 1]._antares_id : false; const after = lI > 0 ? this.localFields[lI - 1].name : false; const orgName = originalField.name; @@ -450,15 +450,15 @@ export default { changes: [], deletions: [] }; - const originalIndexIDs = this.originalIndexes.reduce((acc, curr) => [...acc, curr._id], []); - const localIndexIDs = this.localIndexes.reduce((acc, curr) => [...acc, curr._id], []); + const originalIndexIDs = this.originalIndexes.reduce((acc, curr) => [...acc, curr._antares_id], []); + const localIndexIDs = this.localIndexes.reduce((acc, curr) => [...acc, curr._antares_id], []); // Index Additions - indexChanges.additions = this.localIndexes.filter(index => !originalIndexIDs.includes(index._id)); + indexChanges.additions = this.localIndexes.filter(index => !originalIndexIDs.includes(index._antares_id)); // Index Changes this.originalIndexes.forEach(originalIndex => { - const lI = this.localIndexes.findIndex(localIndex => localIndex._id === originalIndex._id); + const lI = this.localIndexes.findIndex(localIndex => localIndex._antares_id === originalIndex._antares_id); if (JSON.stringify(originalIndex) !== JSON.stringify(this.localIndexes[lI])) { if (this.localIndexes[lI]) { indexChanges.changes.push({ @@ -471,7 +471,7 @@ export default { }); // Index Deletions - indexChanges.deletions = this.originalIndexes.filter(index => !localIndexIDs.includes(index._id)); + indexChanges.deletions = this.originalIndexes.filter(index => !localIndexIDs.includes(index._antares_id)); // FOREIGN KEYS const foreignChanges = { @@ -479,15 +479,15 @@ export default { changes: [], deletions: [] }; - const originalForeignIDs = this.originalKeyUsage.reduce((acc, curr) => [...acc, curr._id], []); - const localForeignIDs = this.localKeyUsage.reduce((acc, curr) => [...acc, curr._id], []); + const originalForeignIDs = this.originalKeyUsage.reduce((acc, curr) => [...acc, curr._antares_id], []); + const localForeignIDs = this.localKeyUsage.reduce((acc, curr) => [...acc, curr._antares_id], []); // Foreigns Additions - foreignChanges.additions = this.localKeyUsage.filter(foreign => !originalForeignIDs.includes(foreign._id)); + foreignChanges.additions = this.localKeyUsage.filter(foreign => !originalForeignIDs.includes(foreign._antares_id)); // Foreigns Changes this.originalKeyUsage.forEach(originalForeign => { - const lI = this.localKeyUsage.findIndex(localForeign => localForeign._id === originalForeign._id); + const lI = this.localKeyUsage.findIndex(localForeign => localForeign._antares_id === originalForeign._antares_id); if (JSON.stringify(originalForeign) !== JSON.stringify(this.localKeyUsage[lI])) { if (this.localKeyUsage[lI]) { foreignChanges.changes.push({ @@ -499,7 +499,7 @@ export default { }); // Foreigns Deletions - foreignChanges.deletions = this.originalKeyUsage.filter(foreign => !localForeignIDs.includes(foreign._id)); + foreignChanges.deletions = this.originalKeyUsage.filter(foreign => !localForeignIDs.includes(foreign._antares_id)); // ALTER const params = { @@ -555,7 +555,7 @@ export default { }, addField () { this.localFields.push({ - _id: uidGen(), + _antares_id: uidGen(), name: `${this.$tc('word.field', 1)}_${++this.newFieldsCounter}`, key: '', type: this.workspace.dataTypes[0].types[0].name, @@ -597,8 +597,8 @@ export default { }); }, duplicateField (uid) { - const fieldToClone = Object.assign({}, this.localFields.find(field => field._id === uid)); - fieldToClone._id = uidGen(); + const fieldToClone = Object.assign({}, this.localFields.find(field => field._antares_id === uid)); + fieldToClone._antares_id = uidGen(); fieldToClone.name = `${fieldToClone.name}_copy`; fieldToClone.order = this.localFields.length + 1; this.localFields = [...this.localFields, fieldToClone]; @@ -609,11 +609,11 @@ export default { }, 20); }, removeField (uid) { - this.localFields = this.localFields.filter(field => field._id !== uid); + this.localFields = this.localFields.filter(field => field._antares_id !== uid); }, addNewIndex (payload) { this.localIndexes = [...this.localIndexes, { - _id: uidGen(), + _antares_id: uidGen(), name: payload.index === 'PRIMARY' ? 'PRIMARY' : payload.field, fields: [payload.field], type: payload.index, @@ -625,7 +625,7 @@ export default { }, addToIndex (payload) { this.localIndexes = this.localIndexes.map(index => { - if (index._id === payload.index) index.fields.push(payload.field); + if (index._antares_id === payload.index) index.fields.push(payload.field); return index; }); }, diff --git a/src/renderer/components/WorkspaceTabPropsTableContext.vue b/src/renderer/components/WorkspaceTabPropsTableContext.vue index 3e8b2982..feebd394 100644 --- a/src/renderer/components/WorkspaceTabPropsTableContext.vue +++ b/src/renderer/components/WorkspaceTabPropsTableContext.vue @@ -27,7 +27,7 @@ :key="index.name" class="context-element" :class="{'disabled': index.fields.includes(selectedField.name)}" - @click="addToIndex(index._id)" + @click="addToIndex(index._antares_id)" > {{ index.name }}
diff --git a/src/renderer/components/WorkspaceTabPropsTableFields.vue b/src/renderer/components/WorkspaceTabPropsTableFields.vue index a77cd8fa..dafc3cfb 100644 --- a/src/renderer/components/WorkspaceTabPropsTableFields.vue +++ b/src/renderer/components/WorkspaceTabPropsTableFields.vue @@ -109,7 +109,7 @@ > field._id === uid); + this.selectedField = this.fields.find(field => field._antares_id === uid); this.contextEvent = event; this.isContext = true; }, duplicateField () { - this.$emit('duplicate-field', this.selectedField._id); + this.$emit('duplicate-field', this.selectedField._antares_id); }, removeField () { - this.$emit('remove-field', this.selectedField._id); + this.$emit('remove-field', this.selectedField._antares_id); }, getIndexes (field) { return this.indexes.reduce((acc, curr) => { diff --git a/src/renderer/components/WorkspaceTabPropsTableForeignModal.vue b/src/renderer/components/WorkspaceTabPropsTableForeignModal.vue index 5dcdd8ed..7289a099 100644 --- a/src/renderer/components/WorkspaceTabPropsTableForeignModal.vue +++ b/src/renderer/components/WorkspaceTabPropsTableForeignModal.vue @@ -36,10 +36,10 @@
@@ -68,7 +68,7 @@ @@ -238,7 +238,7 @@ export default { }, computed: { selectedForeignObj () { - return this.foreignProxy.find(foreign => foreign._id === this.selectedForeignID); + return this.foreignProxy.find(foreign => foreign._antares_id === this.selectedForeignID); }, isChanged () { return JSON.stringify(this.localKeyUsage) !== JSON.stringify(this.foreignProxy); @@ -288,7 +288,7 @@ export default { }, addForeign () { this.foreignProxy = [...this.foreignProxy, { - _id: uidGen(), + _antares_id: uidGen(), constraintName: `FK_${this.foreignProxy.length + 1}`, refSchema: this.schema, table: this.table, @@ -307,19 +307,19 @@ export default { }, 20); }, removeIndex (id) { - this.foreignProxy = this.foreignProxy.filter(foreign => foreign._id !== id); + this.foreignProxy = this.foreignProxy.filter(foreign => foreign._antares_id !== id); if (this.selectedForeignID === id && this.foreignProxy.length) this.resetSelectedID(); }, clearChanges () { this.foreignProxy = JSON.parse(JSON.stringify(this.localKeyUsage)); - if (!this.foreignProxy.some(foreign => foreign._id === this.selectedForeignID)) + if (!this.foreignProxy.some(foreign => foreign._antares_id === this.selectedForeignID)) this.resetSelectedID(); }, toggleField (field) { this.foreignProxy = this.foreignProxy.map(foreign => { - if (foreign._id === this.selectedForeignID) + if (foreign._antares_id === this.selectedForeignID) foreign.field = field; return foreign; @@ -327,14 +327,14 @@ export default { }, toggleRefField (field) { this.foreignProxy = this.foreignProxy.map(foreign => { - if (foreign._id === this.selectedForeignID) + if (foreign._antares_id === this.selectedForeignID) foreign.refField = field; return foreign; }); }, resetSelectedID () { - this.selectedForeignID = this.foreignProxy.length ? this.foreignProxy[0]._id : ''; + this.selectedForeignID = this.foreignProxy.length ? this.foreignProxy[0]._antares_id : ''; }, async getRefFields () { if (!this.selectedForeignObj.refTable) return; diff --git a/src/renderer/components/WorkspaceTabPropsTableIndexesModal.vue b/src/renderer/components/WorkspaceTabPropsTableIndexesModal.vue index 4b520a98..72b14fbc 100644 --- a/src/renderer/components/WorkspaceTabPropsTableIndexesModal.vue +++ b/src/renderer/components/WorkspaceTabPropsTableIndexesModal.vue @@ -36,10 +36,10 @@
@@ -56,7 +56,7 @@ @@ -163,7 +163,7 @@ export default { }, computed: { selectedIndexObj () { - return this.indexesProxy.find(index => index._id === this.selectedIndexID); + return this.indexesProxy.find(index => index._antares_id === this.selectedIndexID); }, isChanged () { return JSON.stringify(this.localIndexes) !== JSON.stringify(this.indexesProxy); @@ -200,7 +200,7 @@ export default { }, addIndex () { this.indexesProxy = [...this.indexesProxy, { - _id: uidGen(), + _antares_id: uidGen(), name: 'NEW_INDEX', fields: [], type: 'INDEX', @@ -218,19 +218,19 @@ export default { }, 20); }, removeIndex (id) { - this.indexesProxy = this.indexesProxy.filter(index => index._id !== id); + this.indexesProxy = this.indexesProxy.filter(index => index._antares_id !== id); if (this.selectedIndexID === id && this.indexesProxy.length) this.resetSelectedID(); }, clearChanges () { this.indexesProxy = JSON.parse(JSON.stringify(this.localIndexes)); - if (!this.indexesProxy.some(index => index._id === this.selectedIndexID)) + if (!this.indexesProxy.some(index => index._antares_id === this.selectedIndexID)) this.resetSelectedID(); }, toggleField (field) { this.indexesProxy = this.indexesProxy.map(index => { - if (index._id === this.selectedIndexID) { + if (index._antares_id === this.selectedIndexID) { if (index.fields.includes(field)) index.fields = index.fields.filter(f => f !== field); else @@ -240,7 +240,7 @@ export default { }); }, resetSelectedID () { - this.selectedIndexID = this.indexesProxy.length ? this.indexesProxy[0]._id : ''; + this.selectedIndexID = this.indexesProxy.length ? this.indexesProxy[0]._antares_id : ''; } } }; diff --git a/src/renderer/components/WorkspaceTabPropsTableRow.vue b/src/renderer/components/WorkspaceTabPropsTableRow.vue index 21d247d5..a3590e36 100644 --- a/src/renderer/components/WorkspaceTabPropsTableRow.vue +++ b/src/renderer/components/WorkspaceTabPropsTableRow.vue @@ -1,5 +1,5 @@