Performance improvements

This commit is contained in:
Fabio 2020-06-13 18:14:32 +02:00
parent 68b128c550
commit 3e13b9962d
6 changed files with 23 additions and 4 deletions

View File

@ -7,6 +7,7 @@ import { autoUpdater } from 'electron-updater';
import ipcHandlers from './ipc-handlers';
if (module.hot) module.hot.accept();
const isDevelopment = process.env.NODE_ENV === 'development';
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 'true';

View File

@ -57,6 +57,7 @@ export class AntaresConnector {
switch (this.client) {
case 'maria':
case 'mysql': {
console.log(mysql);
const [rows, fields] = await this.connection.query(sql);
return { rows, fields };
}

View File

@ -7,4 +7,6 @@ export default class {
static getStructure (connection) {
return connection.raw('SELECT * FROM information_schema.TABLES ORDER BY TABLE_SCHEMA, TABLE_NAME ASC');
}
// TODO: SELECT * FROM `information_schema`.`COLUMNS` WHERE TABLE_SCHEMA='fepcomdb' AND TABLE_NAME='macchine' ORDER BY ORDINAL_POSITION;
}

View File

@ -7,6 +7,7 @@
<button
class="btn btn-link btn-sm"
:class="{'loading':isQuering}"
:disabled="!query"
@click="runQuery"
>
<span>{{ $t('word.run') }}</span>

View File

@ -38,7 +38,7 @@ import WorkspaceQueryTable from '@/components/WorkspaceQueryTable';
import { mapGetters, mapActions } from 'vuex';
export default {
name: 'WorkspaceQueryTab',
name: 'WorkspaceTableTab',
components: {
WorkspaceQueryTable
},
@ -49,7 +49,8 @@ export default {
data () {
return {
isQuering: false,
results: {}
results: {},
lastTable: null
};
},
computed: {
@ -59,13 +60,25 @@ export default {
workspace () {
return this.getWorkspace(this.connection.uid);
},
isSelected () {
return this.workspace.selected_tab === 1;
},
query () {
return `SELECT * FROM \`${this.table}\` LIMIT 1000`;// TODO: use query builder
}
},
watch: {
table: function () {
this.runQuery();
if (this.isSelected) {
this.runQuery();
this.lastTable = this.table;
}
},
isSelected: function (val) {
if (val && this.lastTable !== this.table) {
this.runQuery();
this.lastTable = this.table;
}
}
},
created () {

View File

@ -108,12 +108,13 @@ export default {
removeConnected ({ commit }, uid) {
Connection.disconnect(uid);
commit('REMOVE_CONNECTED', uid);
commit('SELECT_TAB', { uid, tab: 0 });
},
addWorkspace ({ commit, dispatch, getters }, uid) {
const workspace = {
uid,
connected: false,
selectedTab: 0,
selected_tab: 0,
tabs: [{ uid: 1, type: 'table' }],
structure: {},
breadcrumbs: {}