fix: disable cell editor for not editable results

This commit is contained in:
Fabio 2020-10-10 16:54:00 +02:00
parent d560c384f5
commit b7c779eef6
4 changed files with 11 additions and 5 deletions

View File

@ -197,8 +197,9 @@ export class MySQLClient extends AntaresCore {
const remappedFields = fields ? fields.map(field => { const remappedFields = fields ? fields.map(field => {
return { return {
name: field.name, name: field.name,
db: field.db, schema: field.db,
table: field.orgTable table: field.orgTable,
type: 'varchar'
}; };
}) : []; }) : [];

View File

@ -103,7 +103,7 @@ export default {
if (field.table) cachedTable = field.table;// Needed for some queries on information_schema if (field.table) cachedTable = field.table;// Needed for some queries on information_schema
return { return {
table: field.table || cachedTable, table: field.table || cachedTable,
schema: field.db || 'INFORMATION_SCHEMA' schema: field.schema || 'INFORMATION_SCHEMA'
}; };
}).filter((val, i, arr) => arr.findIndex(el => el.schema === val.schema && el.table === val.table) === i); }).filter((val, i, arr) => arr.findIndex(el => el.schema === val.schema && el.table === val.table) === i);
} }
@ -162,7 +162,7 @@ export default {
}); });
} }
fieldsArr[qI] = fieldsArr[qI] ? [...fieldsArr[qI], ...fields] : fields.length ? fields : result.fields; fieldsArr[qI] = fieldsArr[qI] ? [...fieldsArr[qI], ...fields] : fields.length >= result.fields.length ? fields : result.fields;
} }
else else
this.addNotification({ status: 'error', message: response }); this.addNotification({ status: 'error', message: response });

View File

@ -212,7 +212,7 @@ export default {
}, },
getSchema (index) { getSchema (index) {
if (this.resultsWithRows[index] && this.resultsWithRows[index].fields && this.resultsWithRows[index].fields.length) if (this.resultsWithRows[index] && this.resultsWithRows[index].fields && this.resultsWithRows[index].fields.length)
return this.resultsWithRows[index].fields[0].db; return this.resultsWithRows[index].fields[0].schema;
return this.workspaceSchema; return this.workspaceSchema;
}, },
getPrimaryValue (row) { getPrimaryValue (row) {

View File

@ -254,6 +254,9 @@ export default {
}, },
foreignKeys () { foreignKeys () {
return this.keyUsage.map(key => key.column); return this.keyUsage.map(key => key.column);
},
isEditable () {
return this.fields ? !!(this.fields[0].schema && this.fields[0].table) : false;
} }
}, },
watch: { watch: {
@ -296,6 +299,8 @@ export default {
return bufferToBase64(val); return bufferToBase64(val);
}, },
editON (event, content, field) { editON (event, content, field) {
if (!this.isEditable) return;
const type = this.getFieldType(field); const type = this.getFieldType(field);
this.originalContent = content; this.originalContent = content;
this.editingType = type; this.editingType = type;