Skip to content

Commit

Permalink
feat: functions and schedulers in query suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Jan 18, 2021
1 parent afcf1c8 commit 8ff6e70
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 14 deletions.
3 changes: 1 addition & 2 deletions package.json
Expand Up @@ -67,8 +67,7 @@
"vue-i18n": "^8.22.2",
"vue-the-mask": "^0.11.1",
"vuedraggable": "^2.24.3",
"vuex": "^3.6.0",
"vuex-persist": "^3.1.3"
"vuex": "^3.6.0"
},
"devDependencies": {
"babel-eslint": "^10.1.0",
Expand Down
32 changes: 31 additions & 1 deletion src/renderer/components/QueryEditor.vue
Expand Up @@ -81,6 +81,34 @@ export default {
})
: [];
},
functions () {
return this.workspace
? this.workspace.structure.filter(schema => schema.name === this.schema)
.reduce((acc, curr) => {
acc.push(...curr.functions);
return acc;
}, []).map(func => {
return {
name: `${func.name}()`,
type: 'function'
};
})
: [];
},
schedulers () {
return this.workspace
? this.workspace.structure.filter(schema => schema.name === this.schema)
.reduce((acc, curr) => {
acc.push(...curr.schedulers);
return acc;
}, []).map(scheduler => {
return {
name: scheduler.name,
type: 'scheduler'
};
})
: [];
},
mode () {
switch (this.workspace.client) {
case 'mysql':
Expand Down Expand Up @@ -160,7 +188,9 @@ export default {
[
...this.tables,
...this.triggers,
...this.procedures
...this.procedures,
...this.functions,
...this.schedulers
].forEach(el => {
completions.push({
value: el.name,
Expand Down
6 changes: 6 additions & 0 deletions src/renderer/libs/ext-language_tools.js
Expand Up @@ -1245,6 +1245,12 @@ ace.define('ace/autocomplete/popup', ['require', 'exports', 'module', 'ace/virtu
case 'routine':
iconClass = 'mdi-sync-circle';
break;
case 'function':
iconClass = 'mdi-arrow-right-bold-box';
break;
case 'scheduler':
iconClass = 'mdi-calendar-clock';
break;
case 'keyword':
iconClass = 'mdi-cube';
break;
Expand Down
11 changes: 0 additions & 11 deletions src/renderer/store/index.js
Expand Up @@ -2,7 +2,6 @@

import Vue from 'vue';
import Vuex from 'vuex';
import VuexPersist from 'vuex-persist';

import application from './modules/application.store';
import settings from './modules/settings.store';
Expand All @@ -12,15 +11,6 @@ import notifications from './modules/notifications.store';

import ipcUpdates from './plugins/ipcUpdates';

const vuexLocalStorage = new VuexPersist({
key: 'application', // The key to store the state on in the storage provider.
storage: window.localStorage,
reducer: state => ({
connections: state.connections,
settings: state.settings
})
});

Vue.use(Vuex);

export default new Vuex.Store({
Expand All @@ -33,7 +23,6 @@ export default new Vuex.Store({
notifications
},
plugins: [
vuexLocalStorage.plugin,
ipcUpdates
]
});

0 comments on commit 8ff6e70

Please sign in to comment.