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

Performance improvements

This commit is contained in:
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'; import ipcHandlers from './ipc-handlers';
if (module.hot) module.hot.accept();
const isDevelopment = process.env.NODE_ENV === 'development'; const isDevelopment = process.env.NODE_ENV === 'development';
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 'true'; process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 'true';

View File

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

View File

@ -7,4 +7,6 @@ export default class {
static getStructure (connection) { static getStructure (connection) {
return connection.raw('SELECT * FROM information_schema.TABLES ORDER BY TABLE_SCHEMA, TABLE_NAME ASC'); 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 <button
class="btn btn-link btn-sm" class="btn btn-link btn-sm"
:class="{'loading':isQuering}" :class="{'loading':isQuering}"
:disabled="!query"
@click="runQuery" @click="runQuery"
> >
<span>{{ $t('word.run') }}</span> <span>{{ $t('word.run') }}</span>

View File

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

View File

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