feat: functions and schedulers in query suggestions

This commit is contained in:
Fabio Di Stasio 2021-01-18 18:41:28 +01:00
parent afcf1c86ed
commit 8ff6e70145
4 changed files with 38 additions and 14 deletions

View File

@ -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",

View File

@ -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':
@ -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,

View File

@ -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;

View File

@ -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';
@ -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({
@ -33,7 +23,6 @@ export default new Vuex.Store({
notifications
},
plugins: [
vuexLocalStorage.plugin,
ipcUpdates
]
});