refactor: vue3 migration in progress

This commit is contained in:
Fabio Di Stasio 2022-04-21 14:39:24 +02:00
parent 9a0f982723
commit 443170bbb1
61 changed files with 607 additions and 563 deletions

View File

@ -7,7 +7,7 @@
"extends": [ "extends": [
"standard", "standard",
"plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/recommended",
"plugin:vue/recommended" "plugin:vue/vue3-recommended"
], ],
"parser": "vue-eslint-parser", "parser": "vue-eslint-parser",
"parserOptions": { "parserOptions": {
@ -17,6 +17,7 @@
"requireConfigFile": false "requireConfigFile": false
}, },
"plugins": [ "plugins": [
"vue",
"@typescript-eslint" "@typescript-eslint"
], ],
"rules": { "rules": {

View File

@ -109,13 +109,13 @@
"@mdi/font": "^6.1.95", "@mdi/font": "^6.1.95",
"@turf/helpers": "^6.5.0", "@turf/helpers": "^6.5.0",
"@vscode/vscode-languagedetection": "^1.0.21", "@vscode/vscode-languagedetection": "^1.0.21",
"@vue/compat": "^3.2.33",
"ace-builds": "^1.4.13", "ace-builds": "^1.4.13",
"better-sqlite3": "^7.5.0", "better-sqlite3": "^7.5.0",
"electron-log": "^4.4.1", "electron-log": "^4.4.1",
"electron-store": "^8.0.1", "electron-store": "^8.0.1",
"electron-updater": "^4.6.1", "electron-updater": "^4.6.1",
"electron-window-state": "^5.0.3", "electron-window-state": "^5.0.3",
"faker": "^5.5.3",
"leaflet": "^1.7.1", "leaflet": "^1.7.1",
"marked": "^4.0.0", "marked": "^4.0.0",
"moment": "^2.29.1", "moment": "^2.29.1",
@ -128,9 +128,10 @@
"sql-formatter": "^4.0.2", "sql-formatter": "^4.0.2",
"ssh2-promise": "^1.0.2", "ssh2-promise": "^1.0.2",
"v-mask": "^2.3.0", "v-mask": "^2.3.0",
"vue-i18n": "^8.26.5", "vue": "^3.2.33",
"vuedraggable": "^2.24.3", "vue-i18n": "^9.1.9",
"vuex": "^3.6.2" "vuedraggable": "^4.1.0",
"vuex": "^4.0.2"
}, },
"devDependencies": { "devDependencies": {
"@babel/eslint-parser": "^7.15.7", "@babel/eslint-parser": "^7.15.7",
@ -141,6 +142,7 @@
"@types/pg": "^8.6.5", "@types/pg": "^8.6.5",
"@typescript-eslint/eslint-plugin": "^5.18.0", "@typescript-eslint/eslint-plugin": "^5.18.0",
"@typescript-eslint/parser": "^5.18.0", "@typescript-eslint/parser": "^5.18.0",
"@vue/compiler-sfc": "^3.2.33",
"all-contributors-cli": "^6.20.0", "all-contributors-cli": "^6.20.0",
"babel-loader": "^8.2.3", "babel-loader": "^8.2.3",
"chalk": "^4.1.2", "chalk": "^4.1.2",
@ -172,10 +174,8 @@
"tree-kill": "^1.2.2", "tree-kill": "^1.2.2",
"ts-loader": "^9.2.8", "ts-loader": "^9.2.8",
"typescript": "^4.6.3", "typescript": "^4.6.3",
"vue": "^2.6.14",
"vue-eslint-parser": "^8.3.0", "vue-eslint-parser": "^8.3.0",
"vue-loader": "^15.9.8", "vue-loader": "^16.8.3",
"vue-template-compiler": "^2.6.14",
"webpack": "^5.60.0", "webpack": "^5.60.0",
"webpack-cli": "^4.9.1", "webpack-cli": "^4.9.1",
"webpack-dev-server": "^4.4.0" "webpack-dev-server": "^4.4.0"

View File

@ -19,7 +19,7 @@ let manualRestart = null;
const remoteDebugging = process.argv.includes('--remote-debug'); const remoteDebugging = process.argv.includes('--remote-debug');
if (remoteDebugging) { if (remoteDebugging) {
// disable dvtools open in electron // disable devtools open in electron
process.env.RENDERER_REMOTE_DEBUGGING = true; process.env.RENDERER_REMOTE_DEBUGGING = true;
} }

View File

@ -109,8 +109,8 @@ else {
mainWindow = await createMainWindow(); mainWindow = await createMainWindow();
createAppMenu(); createAppMenu();
// if (isDevelopment) if (isDevelopment)
// mainWindow.webContents.openDevTools(); mainWindow.webContents.openDevTools();
process.on('uncaughtException', error => { process.on('uncaughtException', error => {
mainWindow.webContents.send('unhandled-exception', error); mainWindow.webContents.send('unhandled-exception', error);

View File

@ -25,25 +25,24 @@
</template> </template>
<script> <script>
import { defineAsyncComponent } from 'vue';
import { mapActions, mapGetters } from 'vuex'; import { mapActions, mapGetters } from 'vuex';
import { ipcRenderer } from 'electron'; import { ipcRenderer } from 'electron';
import { Menu, getCurrentWindow } from '@electron/remote'; import { Menu, getCurrentWindow } from '@electron/remote';
import TheSettingBar from '@/components/TheSettingBar';
export default { export default {
name: 'App', name: 'App',
components: { components: {
TheTitleBar: () => import(/* webpackChunkName: "TheTitleBar" */'@/components/TheTitleBar'), TheTitleBar: defineAsyncComponent(() => import(/* webpackChunkName: "TheTitleBar" */'@/components/TheTitleBar')),
TheSettingBar: () => import(/* webpackChunkName: "TheSettingBar" */'@/components/TheSettingBar'), TheSettingBar,
TheFooter: () => import(/* webpackChunkName: "TheFooter" */'@/components/TheFooter'), TheFooter: defineAsyncComponent(() => import(/* webpackChunkName: "TheFooter" */'@/components/TheFooter')),
TheNotificationsBoard: () => import(/* webpackChunkName: "TheNotificationsBoard" */'@/components/TheNotificationsBoard'), TheNotificationsBoard: defineAsyncComponent(() => import(/* webpackChunkName: "TheNotificationsBoard" */'@/components/TheNotificationsBoard')),
Workspace: () => import(/* webpackChunkName: "Workspace" */'@/components/Workspace'), Workspace: defineAsyncComponent(() => import(/* webpackChunkName: "Workspace" */'@/components/Workspace')),
WorkspaceAddConnectionPanel: () => import(/* webpackChunkName: "WorkspaceAddConnectionPanel" */'@/components/WorkspaceAddConnectionPanel'), WorkspaceAddConnectionPanel: defineAsyncComponent(() => import(/* webpackChunkName: "WorkspaceAddConnectionPanel" */'@/components/WorkspaceAddConnectionPanel')),
ModalSettings: () => import(/* webpackChunkName: "ModalSettings" */'@/components/ModalSettings'), ModalSettings: defineAsyncComponent(() => import(/* webpackChunkName: "ModalSettings" */'@/components/ModalSettings')),
TheScratchpad: () => import(/* webpackChunkName: "TheScratchpad" */'@/components/TheScratchpad'), TheScratchpad: defineAsyncComponent(() => import(/* webpackChunkName: "TheScratchpad" */'@/components/TheScratchpad')),
BaseTextEditor: () => import(/* webpackChunkName: "BaseTextEditor" */'@/components/BaseTextEditor') BaseTextEditor: defineAsyncComponent(() => import(/* webpackChunkName: "BaseTextEditor" */'@/components/BaseTextEditor'))
},
data () {
return {};
}, },
computed: { computed: {
...mapGetters({ ...mapGetters({

View File

@ -81,7 +81,7 @@ export default {
created () { created () {
window.addEventListener('keydown', this.onKey); window.addEventListener('keydown', this.onKey);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
}, },
methods: { methods: {

View File

@ -61,7 +61,7 @@ export default {
if (this.$refs.contextContent) if (this.$refs.contextContent)
this.contextSize = this.$refs.contextContent.getBoundingClientRect(); this.contextSize = this.$refs.contextContent.getBoundingClientRect();
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
}, },
methods: { methods: {

View File

@ -4,7 +4,7 @@
<i class="mdi mdi-folder-open mr-1" />{{ message }} <i class="mdi mdi-folder-open mr-1" />{{ message }}
</span> </span>
<span class="text-ellipsis file-uploader-value"> <span class="text-ellipsis file-uploader-value">
{{ value | lastPart }} {{ lastPart(value) }}
</span> </span>
<i <i
v-if="value.length" v-if="value.length"
@ -25,16 +25,6 @@
<script> <script>
export default { export default {
name: 'BaseUploadInput', name: 'BaseUploadInput',
filters: {
lastPart (string) {
if (!string) return '';
string = string.split(/[/\\]+/).pop();
if (string.length >= 19)
string = `...${string.slice(-19)}`;
return string;
}
},
props: { props: {
message: { message: {
default: 'Browse', default: 'Browse',
@ -56,6 +46,14 @@ export default {
methods: { methods: {
clear () { clear () {
this.$emit('clear'); this.$emit('clear');
},
lastPart (string) {
if (!string) return '';
string = string.split(/[/\\]+/).pop();
if (string.length >= 19)
string = `...${string.slice(-19)}`;
return string;
} }
} }
}; };

View File

@ -49,7 +49,7 @@ export default {
mounted () { mounted () {
this.setScrollElement(); this.setScrollElement();
}, },
beforeDestroy () { beforeUnmount () {
this.localScrollElement.removeEventListener('scroll', this.checkScrollPosition); this.localScrollElement.removeEventListener('scroll', this.checkScrollPosition);
}, },
methods: { methods: {

View File

@ -36,8 +36,8 @@
<ForeignKeySelect <ForeignKeySelect
v-else-if="foreignKeys.includes(field.name)" v-else-if="foreignKeys.includes(field.name)"
ref="formInput" ref="formInput"
v-model="selectedValue"
class="form-select" class="form-select"
:value.sync="selectedValue"
:key-usage="getKeyUsage(field.name)" :key-usage="getKeyUsage(field.name)"
:disabled="!isChecked" :disabled="!isChecked"
/> />

View File

@ -15,7 +15,7 @@
:value="row.foreign_column" :value="row.foreign_column"
:selected="row.foreign_column === value" :selected="row.foreign_column === value"
> >
{{ row.foreign_column }} {{ 'foreign_description' in row ? ` - ${row.foreign_description}` : '' | cutText }} {{ row.foreign_column }} {{ cutText('foreign_description' in row ? ` - ${row.foreign_description}` : '') }}
</option> </option>
</select> </select>
</template> </template>
@ -26,12 +26,6 @@ import { mapGetters, mapActions } from 'vuex';
import { TEXT, LONG_TEXT } from 'common/fieldTypes'; import { TEXT, LONG_TEXT } from 'common/fieldTypes';
export default { export default {
name: 'ForeignKeySelect', name: 'ForeignKeySelect',
filters: {
cutText (val) {
if (typeof val !== 'string') return val;
return val.length > 15 ? `${val.substring(0, 15)}...` : val;
}
},
props: { props: {
value: [String, Number], value: [String, Number],
keyUsage: Object, keyUsage: Object,
@ -98,6 +92,10 @@ export default {
}), }),
onChange () { onChange () {
this.$emit('update:value', this.$refs.editField.value); this.$emit('update:value', this.$refs.editField.value);
},
cutText (val) {
if (typeof val !== 'string') return val;
return val.length > 15 ? `${val.substring(0, 15)}...` : val;
} }
} }
}; };

View File

@ -36,7 +36,7 @@
class="input-group-addon field-type cut-text" class="input-group-addon field-type cut-text"
:class="typeClass(parameter.type)" :class="typeClass(parameter.type)"
> >
{{ parameter.type }} {{ parameter.length | wrapNumber }} {{ parameter.type }} {{ wrapNumber(parameter.length) }}
</span> </span>
</div> </div>
</div> </div>
@ -56,12 +56,6 @@ export default {
components: { components: {
ConfirmModal ConfirmModal
}, },
filters: {
wrapNumber (num) {
if (!num) return '';
return `(${num})`;
}
},
props: { props: {
localRoutine: Object, localRoutine: Object,
client: String client: String
@ -83,7 +77,7 @@ export default {
this.$refs.firstInput[0].focus(); this.$refs.firstInput[0].focus();
}, 20); }, 20);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
}, },
methods: { methods: {
@ -122,6 +116,10 @@ export default {
e.stopPropagation(); e.stopPropagation();
if (e.key === 'Escape') if (e.key === 'Escape')
this.closeModal(); this.closeModal();
},
wrapNumber (num) {
if (!num) return '';
return `(${num})`;
} }
} }
}; };

View File

@ -29,7 +29,7 @@ export default {
created () { created () {
window.addEventListener('keydown', this.onKey); window.addEventListener('keydown', this.onKey);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
}, },
methods: { methods: {

View File

@ -124,7 +124,7 @@ export default {
this.$refs.firstInput.focus(); this.$refs.firstInput.focus();
}, 20); }, 20);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
}, },
methods: { methods: {

View File

@ -85,8 +85,8 @@
> >
<input <input
type="checkbox" type="checkbox"
:indeterminate.prop="includeStructureStatus === 2" :indeterminate="includeStructureStatus === 2"
:checked.prop="!!includeStructureStatus" :checked="!!includeStructureStatus"
> >
<i class="form-icon" /> <i class="form-icon" />
</label> </label>
@ -98,8 +98,8 @@
> >
<input <input
type="checkbox" type="checkbox"
:indeterminate.prop="includeContentStatus === 2" :indeterminate="includeContentStatus === 2"
:checked.prop="!!includeContentStatus" :checked="!!includeContentStatus"
> >
<i class="form-icon" /> <i class="form-icon" />
</label> </label>
@ -111,8 +111,8 @@
> >
<input <input
type="checkbox" type="checkbox"
:indeterminate.prop="includeDropStatementStatus === 2" :indeterminate="includeDropStatementStatus === 2"
:checked.prop="!!includeDropStatementStatus" :checked="!!includeDropStatementStatus"
> >
<i class="form-icon" /> <i class="form-icon" />
</label> </label>
@ -202,7 +202,6 @@
v-model.number="options.sqlInsertAfter" v-model.number="options.sqlInsertAfter"
type="number" type="number"
class="form-input" class="form-input"
value="250"
> >
</div> </div>
<div class="column col-6"> <div class="column col-6">
@ -363,7 +362,7 @@ export default {
ipcRenderer.on('export-progress', this.updateProgress); ipcRenderer.on('export-progress', this.updateProgress);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
ipcRenderer.off('export-progress', this.updateProgress); ipcRenderer.off('export-progress', this.updateProgress);
}, },

View File

@ -25,6 +25,7 @@
</div> </div>
<div class="column columns col-sm-12"> <div class="column columns col-sm-12">
<FakerSelect <FakerSelect
v-model="localRow[field.name]"
:type="field.type" :type="field.type"
class="column columns pr-0" class="column columns pr-0"
:is-checked="!fieldsToExclude.includes(field.name)" :is-checked="!fieldsToExclude.includes(field.name)"
@ -33,10 +34,9 @@
:field="field" :field="field"
:field-length="fieldLength(field)" :field-length="fieldLength(field)"
:field-obj="localRow[field.name]" :field-obj="localRow[field.name]"
:value.sync="localRow[field.name]"
> >
<span class="input-group-addon field-type" :class="typeClass(field.type)"> <span class="input-group-addon field-type" :class="typeClass(field.type)">
{{ field.type }} {{ fieldLength(field) | wrapNumber }} {{ field.type }} {{ wrapNumber(fieldLength(field)) }}
</span> </span>
<label class="form-checkbox ml-3" :title="$t('word.insert')"> <label class="form-checkbox ml-3" :title="$t('word.insert')">
<input <input
@ -195,12 +195,6 @@ export default {
components: { components: {
FakerSelect FakerSelect
}, },
filters: {
wrapNumber (num) {
if (!num) return '';
return `(${num})`;
}
},
props: { props: {
tabUid: [String, Number], tabUid: [String, Number],
fields: Array, fields: Array,
@ -287,7 +281,7 @@ export default {
this.localRow = { ...rowObj }; this.localRow = { ...rowObj };
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
}, },
methods: { methods: {
@ -367,6 +361,10 @@ export default {
e.stopPropagation(); e.stopPropagation();
if (e.key === 'Escape') if (e.key === 'Escape')
this.closeModal(); this.closeModal();
},
wrapNumber (num) {
if (!num) return '';
return `(${num})`;
} }
} }
}; };

View File

@ -44,7 +44,7 @@
:visible-height="resultsSize" :visible-height="resultsSize"
:scroll-element="scrollElement" :scroll-element="scrollElement"
> >
<template slot-scope="{ items }"> <template #default="{ items }">
<div <div
v-for="query in items" v-for="query in items"
:key="query.uid" :key="query.uid"
@ -156,7 +156,7 @@ export default {
this.resizeResults(); this.resizeResults();
window.addEventListener('resize', this.resizeResults); window.addEventListener('resize', this.resizeResults);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey, { capture: true }); window.removeEventListener('keydown', this.onKey, { capture: true });
window.removeEventListener('resize', this.resizeResults); window.removeEventListener('resize', this.resizeResults);
clearInterval(this.refreshInterval); clearInterval(this.refreshInterval);

View File

@ -89,7 +89,7 @@ export default {
ipcRenderer.on('import-progress', this.updateProgress); ipcRenderer.on('import-progress', this.updateProgress);
ipcRenderer.on('query-error', this.handleQueryError); ipcRenderer.on('query-error', this.handleQueryError);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
ipcRenderer.off('import-progress', this.updateProgress); ipcRenderer.off('import-progress', this.updateProgress);
ipcRenderer.off('query-error', this.handleQueryError); ipcRenderer.off('query-error', this.handleQueryError);

View File

@ -103,7 +103,7 @@ export default {
this.$refs.firstInput.focus(); this.$refs.firstInput.focus();
}, 20); }, 20);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
}, },
methods: { methods: {

View File

@ -27,8 +27,8 @@
<ForeignKeySelect <ForeignKeySelect
v-if="foreignKeys.includes(field.name)" v-if="foreignKeys.includes(field.name)"
ref="formInput" ref="formInput"
v-model="localRow[field.name]"
class="form-select" class="form-select"
:value.sync="localRow[field.name]"
:key-usage="getKeyUsage(field.name)" :key-usage="getKeyUsage(field.name)"
:disabled="fieldsToExclude.includes(field.name)" :disabled="fieldsToExclude.includes(field.name)"
/> />
@ -71,7 +71,7 @@
:tabindex="key+1" :tabindex="key+1"
> >
<span class="input-group-addon" :class="typeCLass(field.type)"> <span class="input-group-addon" :class="typeCLass(field.type)">
{{ field.type }} {{ fieldLength(field) | wrapNumber }} {{ field.type }} {{ wrapNumber(fieldLength(field)) }}
</span> </span>
<label class="form-checkbox ml-3" :title="$t('word.insert')"> <label class="form-checkbox ml-3" :title="$t('word.insert')">
<input <input
@ -132,12 +132,6 @@ export default {
directives: { directives: {
mask: VueMaskDirective mask: VueMaskDirective
}, },
filters: {
wrapNumber (num) {
if (!num) return '';
return `(${num})`;
}
},
props: { props: {
tabUid: [String, Number], tabUid: [String, Number],
fields: Array, fields: Array,
@ -216,7 +210,7 @@ export default {
firstSelectableInput.focus(); firstSelectableInput.focus();
}, 20); }, 20);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
}, },
methods: { methods: {
@ -331,6 +325,10 @@ export default {
e.stopPropagation(); e.stopPropagation();
if (e.key === 'Escape') if (e.key === 'Escape')
this.closeModal(); this.closeModal();
},
wrapNumber (num) {
if (!num) return '';
return `(${num})`;
} }
} }
}; };

View File

@ -112,7 +112,7 @@
:visible-height="resultsSize" :visible-height="resultsSize"
:scroll-element="scrollElement" :scroll-element="scrollElement"
> >
<template slot-scope="{ items }"> <template #default="{ items }">
<ModalProcessesListRow <ModalProcessesListRow
v-for="row in items" v-for="row in items"
:key="row.id" :key="row.id"
@ -203,7 +203,7 @@ export default {
this.getProcessesList(); this.getProcessesList();
window.addEventListener('resize', this.resizeResults); window.addEventListener('resize', this.resizeResults);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey, { capture: true }); window.removeEventListener('keydown', this.onKey, { capture: true });
window.removeEventListener('resize', this.resizeResults); window.removeEventListener('resize', this.resizeResults);
clearInterval(this.refreshInterval); clearInterval(this.refreshInterval);

View File

@ -12,7 +12,7 @@
class="cell-content" class="cell-content"
:class="`${isNull(col)} type-${typeof col === 'number' ? 'int' : 'varchar'}`" :class="`${isNull(col)} type-${typeof col === 'number' ? 'int' : 'varchar'}`"
@dblclick="dblClick(cKey)" @dblclick="dblClick(cKey)"
>{{ col | cutText }}</span> >{{ cutText(col) }}</span>
</div> </div>
<ConfirmModal <ConfirmModal
v-if="isInfoModal" v-if="isInfoModal"
@ -53,12 +53,6 @@ export default {
ConfirmModal, ConfirmModal,
TextEditor TextEditor
}, },
filters: {
cutText (val) {
if (typeof val !== 'string') return val;
return val.length > 250 ? `${val.substring(0, 250)}[...]` : val;
}
},
props: { props: {
row: Object row: Object
}, },
@ -95,6 +89,10 @@ export default {
this.editingField = null; this.editingField = null;
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
} }
},
cutText (val) {
if (typeof val !== 'string') return val;
return val.length > 250 ? `${val.substring(0, 250)}[...]` : val;
} }
} }
}; };

View File

@ -455,7 +455,7 @@ ORDER BY
this.selectedTab = this.selectedSettingTab; this.selectedTab = this.selectedSettingTab;
window.addEventListener('keydown', this.onKey); window.addEventListener('keydown', this.onKey);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
}, },
methods: { methods: {

View File

@ -4,7 +4,7 @@
@mouseenter="clearTimeouts" @mouseenter="clearTimeouts"
@mouseleave="rearmTimeouts" @mouseleave="rearmTimeouts"
> >
<transition-group name="slide-fade"> <transition-group tag="div" name="slide-fade">
<BaseNotification <BaseNotification
v-for="notification in latestNotifications" v-for="notification in latestNotifications"
:key="notification.uid" :key="notification.uid"

View File

@ -15,7 +15,7 @@
<div> <div>
<div> <div>
<TextEditor <TextEditor
:value.sync="localNotes" v-model="localNotes"
editor-class="textarea-editor" editor-class="textarea-editor"
mode="markdown" mode="markdown"
:auto-focus="true" :auto-focus="true"

View File

@ -10,22 +10,23 @@
<ul class="settingbar-elements"> <ul class="settingbar-elements">
<Draggable <Draggable
v-model="connections" v-model="connections"
:item-key="uid"
@start="isDragging = true" @start="isDragging = true"
@end="dragStop" @end="dragStop"
> >
<li <template #item="{element}">
v-for="connection in connections" <li
:key="connection.uid" :draggable="true"
draggable="true" class="settingbar-element btn btn-link ex-tooltip"
class="settingbar-element btn btn-link ex-tooltip" :class="{'selected': element.uid === selectedWorkspace}"
:class="{'selected': connection.uid === selectedWorkspace}" @click.stop="selectWorkspace(element.uid)"
@click.stop="selectWorkspace(connection.uid)" @contextmenu.prevent="contextMenu($event, element)"
@contextmenu.prevent="contextMenu($event, connection)" @mouseover.self="tooltipPosition"
@mouseover.self="tooltipPosition" >
> <i class="settingbar-element-icon dbi" :class="`dbi-${element.client} ${getStatusBadge(element.uid)}`" />
<i class="settingbar-element-icon dbi" :class="`dbi-${connection.client} ${getStatusBadge(connection.uid)}`" /> <span v-if="!isDragging" class="ex-tooltip-content">{{ getConnectionName(element.uid) }}</span>
<span v-if="!isDragging" class="ex-tooltip-content">{{ getConnectionName(connection.uid) }}</span> </li>
</li> </template>
</Draggable> </Draggable>
<li <li
class="settingbar-element btn btn-link ex-tooltip" class="settingbar-element btn btn-link ex-tooltip"

View File

@ -87,7 +87,7 @@ export default {
created () { created () {
window.addEventListener('resize', this.onResize); window.addEventListener('resize', this.onResize);
}, },
destroyed () { unmounted () {
window.removeEventListener('resize', this.onResize); window.removeEventListener('resize', this.onResize);
}, },
methods: { methods: {

View File

@ -1,264 +1,265 @@
<template> <template>
<div v-show="isSelected" class="workspace column columns col-gapless"> <div v-show="isSelected" class="workspace column columns col-gapless">
<WorkspaceExploreBar <WorkspaceExploreBar
v-if="workspace.connectionStatus === 'connected'" v-if="workspace?.connectionStatus === 'connected'"
:connection="connection" :connection="connection"
:is-selected="isSelected" :is-selected="isSelected"
/> />
<div v-if="workspace.connectionStatus === 'connected'" class="workspace-tabs column columns col-gapless"> <div v-if="workspace?.connectionStatus === 'connected'" class="workspace-tabs column columns col-gapless">
<Draggable <Draggable
ref="tabWrap" ref="tabWrap"
v-model="draggableTabs" v-model="draggableTabs"
tag="ul" tag="ul"
:item-key="uid"
group="tabs" group="tabs"
class="tab tab-block column col-12" class="tab tab-block column col-12"
draggable=".tab-draggable" draggable=".tab-draggable"
@mouseover.native="addWheelEvent" @mouseover="addWheelEvent"
> >
<li <template #item="{element}">
v-for="(tab, i) of draggableTabs" <li
:key="i" class="tab-item tab-draggable"
class="tab-item tab-draggable" :draggable="true"
draggable="true" :class="{'active': selectedTab === element.uid}"
:class="{'active': selectedTab === tab.uid}" @mousedown.left="selectTab({uid: workspace.uid, tab: element.uid})"
@mousedown.left="selectTab({uid: workspace.uid, tab: tab.uid})" @mouseup.middle="closeTab(element)"
@mouseup.middle="closeTab(tab)"
>
<a
v-if="tab.type === 'query'"
class="tab-link"
:class="{'badge': tab.isChanged}"
> >
<i class="mdi mdi-18px mdi-code-tags mr-1" /> <a
<span> v-if="element.type === 'query'"
<span>{{ tab.content || 'Query' | cutText }} #{{ tab.index }}</span> class="tab-link"
<span :class="{'badge': element.isChanged}"
class="btn btn-clear" >
:title="$t('word.close')" <i class="mdi mdi-18px mdi-code-tags mr-1" />
@mousedown.left.stop <span>
@click.stop="closeTab(tab)" <span>{{ cutText(element.content || 'Query') }} #{{ element.index }}</span>
/> <span
</span> class="btn btn-clear"
</a> :title="$t('word.close')"
@mousedown.left.stop
@click.stop="closeTab(element)"
/>
</span>
</a>
<a <a
v-else-if="tab.type === 'temp-data'" v-else-if="element.type === 'temp-data'"
class="tab-link" class="tab-link"
@dblclick="openAsPermanentTab(tab)" @dblclick="openAsPermanentTab(element)"
> >
<i class="mdi mdi-18px mr-1" :class="tab.elementType === 'view' ? 'mdi-table-eye' : 'mdi-table'" /> <i class="mdi mdi-18px mr-1" :class="element.elementType === 'view' ? 'mdi-table-eye' : 'mdi-table'" />
<span :title="`${$t('word.data').toUpperCase()}: ${$tc(`word.${tab.elementType}`)}`"> <span :title="`${$t('word.data').toUpperCase()}: ${$tc(`word.${element.elementType}`)}`">
<span class=" text-italic">{{ tab.elementName | cutText }}</span> <span class=" text-italic">{{ cutText(element.elementName) }}</span>
<span <span
class="btn btn-clear" class="btn btn-clear"
:title="$t('word.close')" :title="$t('word.close')"
@mousedown.left.stop @mousedown.left.stop
@click.stop="closeTab(tab)" @click.stop="closeTab(element)"
/> />
</span> </span>
</a> </a>
<a v-else-if="tab.type === 'data'" class="tab-link"> <a v-else-if="element.type === 'data'" class="tab-link">
<i class="mdi mdi-18px mr-1" :class="tab.elementType === 'view' ? 'mdi-table-eye' : 'mdi-table'" /> <i class="mdi mdi-18px mr-1" :class="element.elementType === 'view' ? 'mdi-table-eye' : 'mdi-table'" />
<span :title="`${$t('word.data').toUpperCase()}: ${$tc(`word.${tab.elementType}`)}`"> <span :title="`${$t('word.data').toUpperCase()}: ${$tc(`word.${element.elementType}`)}`">
{{ tab.elementName | cutText }} {{ cutText(element.elementName) }}
<span <span
class="btn btn-clear" class="btn btn-clear"
:title="$t('word.close')" :title="$t('word.close')"
@mousedown.left.stop @mousedown.left.stop
@click.stop="closeTab(tab)" @click.stop="closeTab(element)"
/> />
</span> </span>
</a> </a>
<a <a
v-else-if="tab.type === 'new-table'" v-else-if="element.type === 'new-table'"
class="tab-link" class="tab-link"
:class="{'badge': tab.isChanged}" :class="{'badge': element.isChanged}"
> >
<i class="mdi mdi-shape-square-plus mdi-18px mr-1" /> <i class="mdi mdi-shape-square-plus mdi-18px mr-1" />
<span :title="`${$t('word.new').toUpperCase()}: ${$tc(`word.${tab.elementType}`)}`"> <span :title="`${$t('word.new').toUpperCase()}: ${$tc(`word.${element.elementType}`)}`">
{{ $t('message.newTable') }} {{ $t('message.newTable') }}
<span <span
class="btn btn-clear" class="btn btn-clear"
:title="$t('word.close')" :title="$t('word.close')"
@mousedown.left.stop @mousedown.left.stop
@click.stop="closeTab(tab)" @click.stop="closeTab(element)"
/> />
</span> </span>
</a> </a>
<a <a
v-else-if="tab.type === 'table-props'" v-else-if="element.type === 'table-props'"
class="tab-link" class="tab-link"
:class="{'badge': tab.isChanged}" :class="{'badge': element.isChanged}"
> >
<i class="mdi mdi-tune-vertical-variant mdi-18px mr-1" /> <i class="mdi mdi-tune-vertical-variant mdi-18px mr-1" />
<span :title="`${$t('word.settings').toUpperCase()}: ${$tc(`word.${tab.elementType}`)}`"> <span :title="`${$t('word.settings').toUpperCase()}: ${$tc(`word.${element.elementType}`)}`">
{{ tab.elementName | cutText }} {{ cutText(element.elementName) }}
<span <span
class="btn btn-clear" class="btn btn-clear"
:title="$t('word.close')" :title="$t('word.close')"
@mousedown.left.stop @mousedown.left.stop
@click.stop="closeTab(tab)" @click.stop="closeTab(element)"
/> />
</span> </span>
</a> </a>
<a <a
v-else-if="tab.type === 'view-props'" v-else-if="element.type === 'view-props'"
class="tab-link" class="tab-link"
:class="{'badge': tab.isChanged}" :class="{'badge': element.isChanged}"
> >
<i class="mdi mdi-tune-vertical-variant mdi-18px mr-1" /> <i class="mdi mdi-tune-vertical-variant mdi-18px mr-1" />
<span :title="`${$t('word.settings').toUpperCase()}: ${$tc(`word.view`)}`"> <span :title="`${$t('word.settings').toUpperCase()}: ${$tc(`word.view`)}`">
{{ tab.elementName | cutText }} {{ cutText(element.elementName) }}
<span <span
class="btn btn-clear" class="btn btn-clear"
:title="$t('word.close')" :title="$t('word.close')"
@mousedown.left.stop @mousedown.left.stop
@click.stop="closeTab(tab)" @click.stop="closeTab(element)"
/> />
</span> </span>
</a> </a>
<a <a
v-else-if="tab.type === 'new-view'" v-else-if="element.type === 'new-view'"
class="tab-link" class="tab-link"
:class="{'badge': tab.isChanged}" :class="{'badge': element.isChanged}"
> >
<i class="mdi mdi-shape-square-plus mdi-18px mr-1" /> <i class="mdi mdi-shape-square-plus mdi-18px mr-1" />
<span :title="`${$t('word.new').toUpperCase()}: ${$tc(`word.${tab.elementType}`)}`"> <span :title="`${$t('word.new').toUpperCase()}: ${$tc(`word.${element.elementType}`)}`">
{{ $t('message.newView') }} {{ $t('message.newView') }}
<span <span
class="btn btn-clear" class="btn btn-clear"
:title="$t('word.close')" :title="$t('word.close')"
@mousedown.left.stop @mousedown.left.stop
@click.stop="closeTab(tab)" @click.stop="closeTab(element)"
/> />
</span> </span>
</a> </a>
<a <a
v-else-if="tab.type === 'new-trigger'" v-else-if="element.type === 'new-trigger'"
class="tab-link" class="tab-link"
:class="{'badge': tab.isChanged}" :class="{'badge': element.isChanged}"
> >
<i class="mdi mdi-shape-square-plus mdi-18px mr-1" /> <i class="mdi mdi-shape-square-plus mdi-18px mr-1" />
<span :title="`${$t('word.new').toUpperCase()}: ${$tc(`word.${tab.elementType}`)}`"> <span :title="`${$t('word.new').toUpperCase()}: ${$tc(`word.${element.elementType}`)}`">
{{ $t('message.newTrigger') }} {{ $t('message.newTrigger') }}
<span <span
class="btn btn-clear" class="btn btn-clear"
:title="$t('word.close')" :title="$t('word.close')"
@mousedown.left.stop @mousedown.left.stop
@click.stop="closeTab(tab)" @click.stop="closeTab(element)"
/> />
</span> </span>
</a> </a>
<a <a
v-else-if="tab.type === 'new-routine'" v-else-if="element.type === 'new-routine'"
class="tab-link" class="tab-link"
:class="{'badge': tab.isChanged}" :class="{'badge': element.isChanged}"
> >
<i class="mdi mdi-shape-square-plus mdi-18px mr-1" /> <i class="mdi mdi-shape-square-plus mdi-18px mr-1" />
<span :title="`${$t('word.new').toUpperCase()}: ${$tc(`word.${tab.elementType}`)}`"> <span :title="`${$t('word.new').toUpperCase()}: ${$tc(`word.${element.elementType}`)}`">
{{ $t('message.newRoutine') }} {{ $t('message.newRoutine') }}
<span <span
class="btn btn-clear" class="btn btn-clear"
:title="$t('word.close')" :title="$t('word.close')"
@mousedown.left.stop @mousedown.left.stop
@click.stop="closeTab(tab)" @click.stop="closeTab(element)"
/> />
</span> </span>
</a> </a>
<a <a
v-else-if="tab.type === 'new-function'" v-else-if="element.type === 'new-function'"
class="tab-link" class="tab-link"
:class="{'badge': tab.isChanged}" :class="{'badge': element.isChanged}"
> >
<i class="mdi mdi-shape-square-plus mdi-18px mr-1" /> <i class="mdi mdi-shape-square-plus mdi-18px mr-1" />
<span :title="`${$t('word.new').toUpperCase()}: ${$tc(`word.${tab.elementType}`)}`"> <span :title="`${$t('word.new').toUpperCase()}: ${$tc(`word.${element.elementType}`)}`">
{{ $t('message.newFunction') }} {{ $t('message.newFunction') }}
<span <span
class="btn btn-clear" class="btn btn-clear"
:title="$t('word.close')" :title="$t('word.close')"
@mousedown.left.stop @mousedown.left.stop
@click.stop="closeTab(tab)" @click.stop="closeTab(element)"
/> />
</span> </span>
</a> </a>
<a <a
v-else-if="tab.type === 'new-trigger-function'" v-else-if="element.type === 'new-trigger-function'"
class="tab-link" class="tab-link"
:class="{'badge': tab.isChanged}" :class="{'badge': element.isChanged}"
> >
<i class="mdi mdi-shape-square-plus mdi-18px mr-1" /> <i class="mdi mdi-shape-square-plus mdi-18px mr-1" />
<span :title="`${$t('word.new').toUpperCase()}: ${$tc(`word.${tab.elementType}`)}`"> <span :title="`${$t('word.new').toUpperCase()}: ${$tc(`word.${element.elementType}`)}`">
{{ $t('message.newTriggerFunction') }} {{ $t('message.newTriggerFunction') }}
<span <span
class="btn btn-clear" class="btn btn-clear"
:title="$t('word.close')" :title="$t('word.close')"
@mousedown.left.stop @mousedown.left.stop
@click.stop="closeTab(tab)" @click.stop="closeTab(element)"
/> />
</span> </span>
</a> </a>
<a <a
v-else-if="tab.type === 'new-scheduler'" v-else-if="element.type === 'new-scheduler'"
class="tab-link" class="tab-link"
:class="{'badge': tab.isChanged}" :class="{'badge': element.isChanged}"
> >
<i class="mdi mdi-shape-square-plus mdi-18px mr-1" /> <i class="mdi mdi-shape-square-plus mdi-18px mr-1" />
<span :title="`${$t('word.new').toUpperCase()}: ${$tc(`word.${tab.elementType}`)}`"> <span :title="`${$t('word.new').toUpperCase()}: ${$tc(`word.${element.elementType}`)}`">
{{ $t('message.newScheduler') }} {{ $t('message.newScheduler') }}
<span <span
class="btn btn-clear" class="btn btn-clear"
:title="$t('word.close')" :title="$t('word.close')"
@mousedown.left.stop @mousedown.left.stop
@click.stop="closeTab(tab)" @click.stop="closeTab(element)"
/> />
</span> </span>
</a> </a>
<a <a
v-else-if="tab.type.includes('temp-')" v-else-if="element.type.includes('temp-')"
class="tab-link" class="tab-link"
:class="{'badge': tab.isChanged}" :class="{'badge': element.isChanged}"
@dblclick="openAsPermanentTab(tab)" @dblclick="openAsPermanentTab(element)"
> >
<i class="mdi mdi-18px mdi-tune-vertical-variant mr-1" /> <i class="mdi mdi-18px mdi-tune-vertical-variant mr-1" />
<span :title="`${$t('word.settings').toUpperCase()}: ${$tc(`word.${tab.elementType}`)}`"> <span :title="`${$t('word.settings').toUpperCase()}: ${$tc(`word.${element.elementType}`)}`">
<span class=" text-italic">{{ tab.elementName | cutText }}</span> <span class=" text-italic">{{ cutText(element.elementName) }}</span>
<span <span
class="btn btn-clear" class="btn btn-clear"
:title="$t('word.close')" :title="$t('word.close')"
@mousedown.left.stop @mousedown.left.stop
@click.stop="closeTab(tab)" @click.stop="closeTab(element)"
/> />
</span> </span>
</a> </a>
<a <a
v-else v-else
class="tab-link" class="tab-link"
:class="{'badge': tab.isChanged}" :class="{'badge': element.isChanged}"
> >
<i class="mdi mdi-18px mdi-tune-vertical-variant mr-1" /> <i class="mdi mdi-18px mdi-tune-vertical-variant mr-1" />
<span :title="`${$t('word.settings').toUpperCase()}: ${$tc(`word.${tab.elementType}`)}`"> <span :title="`${$t('word.settings').toUpperCase()}: ${$tc(`word.${element.elementType}`)}`">
{{ tab.elementName | cutText }} {{ cutText(element.elementName) }}
<span <span
class="btn btn-clear" class="btn btn-clear"
:title="$t('word.close')" :title="$t('word.close')"
@mousedown.left.stop @mousedown.left.stop
@click.stop="closeTab(tab)" @click.stop="closeTab(element)"
/> />
</span> </span>
</a> </a>
</li> </li>
</template>
<template #header> <template #header>
<li <li
v-if="workspace.customizations.processesList" v-if="workspace.customizations.processesList"
@ -521,15 +522,6 @@ export default {
ModalProcessesList, ModalProcessesList,
ModalDiscardChanges ModalDiscardChanges
}, },
filters: {
cutText (string) {
const limit = 20;
const escapedString = string.replace(/\s{2,}/g, ' ');
if (escapedString.length > limit)
return `${escapedString.substr(0, limit)}...`;
return escapedString;
}
},
props: { props: {
connection: Object connection: Object
}, },
@ -589,13 +581,16 @@ export default {
} }
}, },
watch: { watch: {
queryTabs: function (newVal, oldVal) { queryTabs: {
if (newVal.length > oldVal.length) { handler (newVal, oldVal) {
setTimeout(() => { if (newVal.length > oldVal.length) {
const scroller = this.$refs.tabWrap; setTimeout(() => {
if (scroller) scroller.$el.scrollLeft = scroller.$el.scrollWidth; const scroller = this.$refs.tabWrap;
}, 0); if (scroller) scroller.$el.scrollLeft = scroller.$el.scrollWidth;
} }, 0);
}
},
deep: true
} }
}, },
async created () { async created () {
@ -605,7 +600,7 @@ export default {
if (isInitiated) if (isInitiated)
this.connectWorkspace(this.connection); this.connectWorkspace(this.connection);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
}, },
methods: { methods: {
@ -683,6 +678,13 @@ export default {
}); });
this.hasWheelEvent = true; this.hasWheelEvent = true;
} }
},
cutText (string) {
const limit = 20;
const escapedString = string.replace(/\s{2,}/g, ' ');
if (escapedString.length > limit)
return `${escapedString.substr(0, limit)}...`;
return escapedString;
} }
} }
}; };

View File

@ -185,7 +185,7 @@
<QueryEditor <QueryEditor
v-show="isSelected" v-show="isSelected"
ref="queryEditor" ref="queryEditor"
:value.sync="localFunction.sql" v-model="localFunction.sql"
:workspace="workspace" :workspace="workspace"
:schema="schema" :schema="schema"
:height="editorHeight" :height="editorHeight"
@ -302,10 +302,10 @@ export default {
this.$refs.firstInput.focus(); this.$refs.firstInput.focus();
}, 100); }, 100);
}, },
destroyed () { unmounted () {
window.removeEventListener('resize', this.resizeQueryEditor); window.removeEventListener('resize', this.resizeQueryEditor);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
}, },
methods: { methods: {

View File

@ -145,7 +145,7 @@
v-show="isSelected" v-show="isSelected"
:key="`new-${_uid}`" :key="`new-${_uid}`"
ref="queryEditor" ref="queryEditor"
:value.sync="localRoutine.sql" v-model="localRoutine.sql"
:workspace="workspace" :workspace="workspace"
:schema="schema" :schema="schema"
:height="editorHeight" :height="editorHeight"
@ -261,10 +261,10 @@ export default {
window.addEventListener('resize', this.resizeQueryEditor); window.addEventListener('resize', this.resizeQueryEditor);
}, },
destroyed () { unmounted () {
window.removeEventListener('resize', this.resizeQueryEditor); window.removeEventListener('resize', this.resizeQueryEditor);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
}, },
methods: { methods: {

View File

@ -125,7 +125,7 @@
<QueryEditor <QueryEditor
v-show="isSelected" v-show="isSelected"
ref="queryEditor" ref="queryEditor"
:value.sync="localScheduler.sql" v-model="localScheduler.sql"
:workspace="workspace" :workspace="workspace"
:schema="schema" :schema="schema"
:height="editorHeight" :height="editorHeight"
@ -237,10 +237,10 @@ export default {
window.addEventListener('resize', this.resizeQueryEditor); window.addEventListener('resize', this.resizeQueryEditor);
}, },
destroyed () { unmounted () {
window.removeEventListener('resize', this.resizeQueryEditor); window.removeEventListener('resize', this.resizeQueryEditor);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
}, },
methods: { methods: {

View File

@ -276,7 +276,7 @@ export default {
this.$refs.firstInput.focus(); this.$refs.firstInput.focus();
}, 100); }, 100);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
}, },
methods: { methods: {

View File

@ -122,7 +122,7 @@
<QueryEditor <QueryEditor
v-show="isSelected" v-show="isSelected"
ref="queryEditor" ref="queryEditor"
:value.sync="localTrigger.sql" v-model="localTrigger.sql"
:workspace="workspace" :workspace="workspace"
:schema="schema" :schema="schema"
:height="editorHeight" :height="editorHeight"
@ -226,10 +226,10 @@ export default {
window.addEventListener('resize', this.resizeQueryEditor); window.addEventListener('resize', this.resizeQueryEditor);
}, },
destroyed () { unmounted () {
window.removeEventListener('resize', this.resizeQueryEditor); window.removeEventListener('resize', this.resizeQueryEditor);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
}, },
methods: { methods: {

View File

@ -98,7 +98,7 @@
<QueryEditor <QueryEditor
v-show="isSelected" v-show="isSelected"
ref="queryEditor" ref="queryEditor"
:value.sync="localFunction.sql" v-model="localFunction.sql"
:workspace="workspace" :workspace="workspace"
:schema="schema" :schema="schema"
:height="editorHeight" :height="editorHeight"
@ -202,10 +202,10 @@ export default {
window.addEventListener('resize', this.resizeQueryEditor); window.addEventListener('resize', this.resizeQueryEditor);
}, },
destroyed () { unmounted () {
window.removeEventListener('resize', this.resizeQueryEditor); window.removeEventListener('resize', this.resizeQueryEditor);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
}, },
methods: { methods: {

View File

@ -111,7 +111,7 @@
<QueryEditor <QueryEditor
v-show="isSelected" v-show="isSelected"
ref="queryEditor" ref="queryEditor"
:value.sync="localView.sql" v-model="localView.sql"
:workspace="workspace" :workspace="workspace"
:schema="schema" :schema="schema"
:height="editorHeight" :height="editorHeight"
@ -209,10 +209,10 @@ export default {
window.addEventListener('resize', this.resizeQueryEditor); window.addEventListener('resize', this.resizeQueryEditor);
}, },
destroyed () { unmounted () {
window.removeEventListener('resize', this.resizeQueryEditor); window.removeEventListener('resize', this.resizeQueryEditor);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
}, },
methods: { methods: {

View File

@ -197,7 +197,7 @@
<QueryEditor <QueryEditor
v-show="isSelected" v-show="isSelected"
ref="queryEditor" ref="queryEditor"
:value.sync="localFunction.sql" v-model="localFunction.sql"
:workspace="workspace" :workspace="workspace"
:schema="schema" :schema="schema"
:height="editorHeight" :height="editorHeight"
@ -339,10 +339,10 @@ export default {
mounted () { mounted () {
window.addEventListener('resize', this.resizeQueryEditor); window.addEventListener('resize', this.resizeQueryEditor);
}, },
destroyed () { unmounted () {
window.removeEventListener('resize', this.resizeQueryEditor); window.removeEventListener('resize', this.resizeQueryEditor);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
}, },
methods: { methods: {

View File

@ -215,7 +215,7 @@ export default {
this.getModalInnerHeight(); this.getModalInnerHeight();
window.addEventListener('resize', this.getModalInnerHeight); window.addEventListener('resize', this.getModalInnerHeight);
}, },
destroyed () { unmounted () {
window.removeEventListener('resize', this.getModalInnerHeight); window.removeEventListener('resize', this.getModalInnerHeight);
}, },
methods: { methods: {

View File

@ -154,7 +154,7 @@
v-show="isSelected" v-show="isSelected"
:key="`${routine}-${_uid}`" :key="`${routine}-${_uid}`"
ref="queryEditor" ref="queryEditor"
:value.sync="localRoutine.sql" v-model="localRoutine.sql"
:workspace="workspace" :workspace="workspace"
:schema="schema" :schema="schema"
:height="editorHeight" :height="editorHeight"
@ -284,10 +284,10 @@ export default {
mounted () { mounted () {
window.addEventListener('resize', this.resizeQueryEditor); window.addEventListener('resize', this.resizeQueryEditor);
}, },
destroyed () { unmounted () {
window.removeEventListener('resize', this.resizeQueryEditor); window.removeEventListener('resize', this.resizeQueryEditor);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
}, },
methods: { methods: {

View File

@ -215,7 +215,7 @@ export default {
this.getModalInnerHeight(); this.getModalInnerHeight();
window.addEventListener('resize', this.getModalInnerHeight); window.addEventListener('resize', this.getModalInnerHeight);
}, },
destroyed () { unmounted () {
window.removeEventListener('resize', this.getModalInnerHeight); window.removeEventListener('resize', this.getModalInnerHeight);
}, },
methods: { methods: {

View File

@ -124,7 +124,7 @@
<QueryEditor <QueryEditor
v-show="isSelected" v-show="isSelected"
ref="queryEditor" ref="queryEditor"
:value.sync="localScheduler.sql" v-model="localScheduler.sql"
:workspace="workspace" :workspace="workspace"
:schema="schema" :schema="schema"
:height="editorHeight" :height="editorHeight"
@ -236,10 +236,10 @@ export default {
mounted () { mounted () {
window.addEventListener('resize', this.resizeQueryEditor); window.addEventListener('resize', this.resizeQueryEditor);
}, },
destroyed () { unmounted () {
window.removeEventListener('resize', this.resizeQueryEditor); window.removeEventListener('resize', this.resizeQueryEditor);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
}, },
methods: { methods: {

View File

@ -228,7 +228,7 @@ export default {
return this.getWorkspace(this.connection.uid); return this.getWorkspace(this.connection.uid);
}, },
tabUid () { tabUid () {
return this.$vnode.key; return this.$vnode?.key;
}, },
defaultEngine () { defaultEngine () {
const engine = this.getDatabaseVariable(this.connection.uid, 'default_storage_engine'); const engine = this.getDatabaseVariable(this.connection.uid, 'default_storage_engine');
@ -277,7 +277,7 @@ export default {
this.getFieldsData(); this.getFieldsData();
window.addEventListener('keydown', this.onKey); window.addEventListener('keydown', this.onKey);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
}, },
methods: { methods: {
@ -415,7 +415,7 @@ export default {
const localIDs = this.localFields.reduce((acc, curr) => [...acc, curr._antares_id], []); const localIDs = this.localFields.reduce((acc, curr) => [...acc, curr._antares_id], []);
// Fields Additions // Fields Additions
const additions = this.localFields.filter((field, i) => !originalIDs.includes(field._antares_id)).map(field => { const additions = this.localFields.filter(field => !originalIDs.includes(field._antares_id)).map(field => {
const lI = this.localFields.findIndex(localField => localField._antares_id === field._antares_id); const lI = this.localFields.findIndex(localField => localField._antares_id === field._antares_id);
const after = lI > 0 ? this.localFields[lI - 1].name : false; const after = lI > 0 ? this.localFields[lI - 1].name : false;
return { ...field, after }; return { ...field, after };

View File

@ -105,19 +105,20 @@
ref="resultTable" ref="resultTable"
:list="fields" :list="fields"
class="tbody" class="tbody"
:item-key="_antares_id"
handle=".row-draggable" handle=".row-draggable"
> >
<TableRow <template #item="{element}">
v-for="row in fields" <TableRow
:key="row._antares_id" :row="element"
:row="row" :indexes="getIndexes(element.name)"
:indexes="getIndexes(row.name)" :foreigns="getForeigns(element.name)"
:foreigns="getForeigns(row.name)" :data-types="dataTypes"
:data-types="dataTypes" :customizations="customizations"
:customizations="customizations" @contextmenu="contextMenu"
@contextmenu="contextMenu" @rename-field="$emit('rename-field', $event)"
@rename-field="$emit('rename-field', $event)" />
/> </template>
</Draggable> </Draggable>
</div> </div>
</div> </div>
@ -195,7 +196,7 @@ export default {
mounted () { mounted () {
window.addEventListener('resize', this.resizeResults); window.addEventListener('resize', this.resizeResults);
}, },
destroyed () { unmounted () {
window.removeEventListener('resize', this.resizeResults); window.removeEventListener('resize', this.resizeResults);
}, },
methods: { methods: {

View File

@ -259,7 +259,7 @@ export default {
this.getModalInnerHeight(); this.getModalInnerHeight();
window.addEventListener('resize', this.getModalInnerHeight); window.addEventListener('resize', this.getModalInnerHeight);
}, },
destroyed () { unmounted () {
window.removeEventListener('resize', this.getModalInnerHeight); window.removeEventListener('resize', this.getModalInnerHeight);
}, },
methods: { methods: {

View File

@ -181,7 +181,7 @@ export default {
this.getModalInnerHeight(); this.getModalInnerHeight();
window.addEventListener('resize', this.getModalInnerHeight); window.addEventListener('resize', this.getModalInnerHeight);
}, },
destroyed () { unmounted () {
window.removeEventListener('resize', this.getModalInnerHeight); window.removeEventListener('resize', this.getModalInnerHeight);
}, },
methods: { methods: {

View File

@ -121,7 +121,7 @@
<QueryEditor <QueryEditor
v-show="isSelected" v-show="isSelected"
ref="queryEditor" ref="queryEditor"
:value.sync="localTrigger.sql" v-model="localTrigger.sql"
:workspace="workspace" :workspace="workspace"
:schema="schema" :schema="schema"
:height="editorHeight" :height="editorHeight"
@ -227,10 +227,10 @@ export default {
mounted () { mounted () {
window.addEventListener('resize', this.resizeQueryEditor); window.addEventListener('resize', this.resizeQueryEditor);
}, },
destroyed () { unmounted () {
window.removeEventListener('resize', this.resizeQueryEditor); window.removeEventListener('resize', this.resizeQueryEditor);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
}, },
methods: { methods: {

View File

@ -85,7 +85,7 @@
<QueryEditor <QueryEditor
v-show="isSelected" v-show="isSelected"
ref="queryEditor" ref="queryEditor"
:value.sync="localFunction.sql" v-model="localFunction.sql"
:workspace="workspace" :workspace="workspace"
:schema="schema" :schema="schema"
:height="editorHeight" :height="editorHeight"
@ -204,10 +204,10 @@ export default {
mounted () { mounted () {
window.addEventListener('resize', this.resizeQueryEditor); window.addEventListener('resize', this.resizeQueryEditor);
}, },
destroyed () { unmounted () {
window.removeEventListener('resize', this.resizeQueryEditor); window.removeEventListener('resize', this.resizeQueryEditor);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
}, },
methods: { methods: {

View File

@ -110,7 +110,7 @@
<QueryEditor <QueryEditor
v-show="isSelected" v-show="isSelected"
ref="queryEditor" ref="queryEditor"
:value.sync="localView.sql" v-model="localView.sql"
:workspace="workspace" :workspace="workspace"
:schema="schema" :schema="schema"
:height="editorHeight" :height="editorHeight"
@ -205,10 +205,10 @@ export default {
mounted () { mounted () {
window.addEventListener('resize', this.resizeQueryEditor); window.addEventListener('resize', this.resizeQueryEditor);
}, },
destroyed () { unmounted () {
window.removeEventListener('resize', this.resizeQueryEditor); window.removeEventListener('resize', this.resizeQueryEditor);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
}, },
methods: { methods: {

View File

@ -3,18 +3,18 @@
v-show="isSelected" v-show="isSelected"
class="workspace-query-tab column col-12 columns col-gapless no-outline p-0" class="workspace-query-tab column col-12 columns col-gapless no-outline p-0"
tabindex="0" tabindex="0"
@keydown.116="runQuery(query)" @keydown.f5="runQuery(query)"
@keydown.75="killTabQuery" @keydown.k="killTabQuery"
@keydown.ctrl.alt.87="clear" @keydown.ctrl.alt.w="clear"
@keydown.ctrl.66="beautify" @keydown.ctrl.b="beautify"
@keydown.ctrl.71="openHistoryModal" @keydown.ctrl.g="openHistoryModal"
> >
<div class="workspace-query-runner column col-12"> <div class="workspace-query-runner column col-12">
<QueryEditor <QueryEditor
v-show="isSelected" v-show="isSelected"
ref="queryEditor" ref="queryEditor"
v-model="query"
:auto-focus="true" :auto-focus="true"
:value.sync="query"
:workspace="workspace" :workspace="workspace"
:schema="breadcrumbsSchema" :schema="breadcrumbsSchema"
:is-selected="isSelected" :is-selected="isSelected"
@ -296,7 +296,7 @@ export default {
if (this.tab.autorun) if (this.tab.autorun)
this.runQuery(this.query); this.runQuery(this.query);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
const params = { const params = {
uid: this.connection.uid, uid: this.connection.uid,

View File

@ -4,8 +4,8 @@
class="vscroll no-outline" class="vscroll no-outline"
tabindex="0" tabindex="0"
:style="{'height': resultsSize+'px'}" :style="{'height': resultsSize+'px'}"
@keyup.46="showDeleteConfirmModal" @keyup.delete="showDeleteConfirmModal"
@keydown.ctrl.65="selectAllRows($event)" @keydown.ctrl.a="selectAllRows($event)"
@keydown.esc="deselectRows" @keydown.esc="deselectRows"
> >
<TableContext <TableContext
@ -68,7 +68,7 @@
:visible-height="resultsSize" :visible-height="resultsSize"
:scroll-element="scrollElement" :scroll-element="scrollElement"
> >
<template slot-scope="{ items }"> <template #default="{ items }">
<WorkspaceTabQueryTableRow <WorkspaceTabQueryTableRow
v-for="row in items" v-for="row in items"
:key="row._antares_id" :key="row._antares_id"
@ -256,7 +256,7 @@ export default {
mounted () { mounted () {
window.addEventListener('resize', this.resizeResults); window.addEventListener('resize', this.resizeResults);
}, },
destroyed () { unmounted () {
window.removeEventListener('resize', this.resizeResults); window.removeEventListener('resize', this.resizeResults);
}, },
methods: { methods: {

View File

@ -18,11 +18,11 @@
class="cell-content" class="cell-content"
:class="`${isNull(col)} ${typeClass(fields[cKey].type)}`" :class="`${isNull(col)} ${typeClass(fields[cKey].type)}`"
@dblclick="editON($event, col, cKey)" @dblclick="editON($event, col, cKey)"
>{{ col | typeFormat(fields[cKey].type.toLowerCase(), fields[cKey].length) | cutText }}</span> >{{ cutText(typeFormat(col, fields[cKey].type.toLowerCase(), fields[cKey].length)) }}</span>
<ForeignKeySelect <ForeignKeySelect
v-else-if="isForeignKey(cKey)" v-else-if="isForeignKey(cKey)"
v-model="editingContent"
class="editable-field" class="editable-field"
:value.sync="editingContent"
:key-usage="getKeyUsage(cKey)" :key-usage="getKeyUsage(cKey)"
size="small" size="small"
@blur="editOFF" @blur="editOFF"
@ -85,7 +85,7 @@
<div class="mb-2"> <div class="mb-2">
<div> <div>
<TextEditor <TextEditor
:value.sync="editingContent" v-model="editingContent"
editor-class="textarea-editor" editor-class="textarea-editor"
:mode="editorMode" :mode="editorMode"
/> />
@ -176,7 +176,7 @@
</transition> </transition>
<div class="editor-field-info"> <div class="editor-field-info">
<div> <div>
<b>{{ $t('word.size') }}</b>: {{ editingContent.length | formatBytes }}<br> <b>{{ $t('word.size') }}</b>: {{ formatBytes(editingContent.length) }}<br>
<b>{{ $t('word.mimeType') }}</b>: {{ contentInfo.mime }} <b>{{ $t('word.mimeType') }}</b>: {{ contentInfo.mime }}
</div> </div>
<div><b>{{ $t('word.type') }}</b>: {{ editingType.toUpperCase() }}</div> <div><b>{{ $t('word.type') }}</b>: {{ editingType.toUpperCase() }}</div>
@ -236,58 +236,6 @@ export default {
directives: { directives: {
mask: VueMaskDirective mask: VueMaskDirective
}, },
filters: {
formatBytes,
cutText (val) {
if (typeof val !== 'string') return val;
return val.length > 128 ? `${val.substring(0, 128)}[...]` : val;
},
typeFormat (val, type, precision) {
if (!val) return val;
type = type.toUpperCase();
if (DATE.includes(type))
return moment(val).isValid() ? moment(val).format('YYYY-MM-DD') : val;
if (DATETIME.includes(type)) {
if (typeof val === 'string')
return val;
let datePrecision = '';
for (let i = 0; i < precision; i++)
datePrecision += i === 0 ? '.S' : 'S';
return moment(val).isValid() ? moment(val).format(`YYYY-MM-DD HH:mm:ss${datePrecision}`) : val;
}
if (BLOB.includes(type)) {
const buff = Buffer.from(val);
if (!buff.length) return '';
const hex = buff.toString('hex').substring(0, 8).toUpperCase();
return `${mimeFromHex(hex).mime} (${formatBytes(buff.length)})`;
}
if (BIT.includes(type)) {
if (typeof val === 'number') val = [val];
const hex = Buffer.from(val).toString('hex');
const bitString = hexToBinary(hex);
return parseInt(bitString).toString().padStart(precision, '0');
}
if (ARRAY.includes(type)) {
if (Array.isArray(val))
return JSON.stringify(val).replaceAll('[', '{').replaceAll(']', '}');
return val;
}
if (SPATIAL.includes(type))
return val;
return typeof val === 'object' ? JSON.stringify(val) : val;
}
},
props: { props: {
row: Object, row: Object,
fields: Object, fields: Object,
@ -449,15 +397,15 @@ export default {
window.addEventListener('keydown', this.onKey); window.addEventListener('keydown', this.onKey);
const type = this.fields[field].type.toUpperCase(); ; const type = this.fields[field].type.toUpperCase();
this.originalContent = this.$options.filters.typeFormat(content, type, this.fields[field].length); this.originalContent = this.typeFormat(content, type, this.fields[field].length);
this.editingType = type; this.editingType = type;
this.editingField = field; this.editingField = field;
this.editingLength = this.fields[field].length; this.editingLength = this.fields[field].length;
if ([...LONG_TEXT, ...ARRAY, ...TEXT_SEARCH].includes(type)) { if ([...LONG_TEXT, ...ARRAY, ...TEXT_SEARCH].includes(type)) {
this.isTextareaEditor = true; this.isTextareaEditor = true;
this.editingContent = this.$options.filters.typeFormat(content, type); this.editingContent = this.typeFormat(content, type);
return; return;
} }
@ -465,7 +413,7 @@ export default {
if (content) { if (content) {
this.isMultiSpatial = IS_MULTI_SPATIAL.includes(type); this.isMultiSpatial = IS_MULTI_SPATIAL.includes(type);
this.isMapModal = true; this.isMapModal = true;
this.editingContent = this.$options.filters.typeFormat(content, type); this.editingContent = this.typeFormat(content, type);
} }
return; return;
} }
@ -513,7 +461,7 @@ export default {
this.editingContent = this.editingContent.slice(0, -1); this.editingContent = this.editingContent.slice(0, -1);
} }
if (this.editingContent === this.$options.filters.typeFormat(this.originalContent, this.editingType, this.editingLength)) return;// If not changed if (this.editingContent === this.typeFormat(this.originalContent, this.editingType, this.editingLength)) return;// If not changed
content = this.editingContent; content = this.editingContent;
} }
@ -590,6 +538,56 @@ export default {
this.editingField = null; this.editingField = null;
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
} }
},
formatBytes,
cutText (val) {
if (typeof val !== 'string') return val;
return val.length > 128 ? `${val.substring(0, 128)}[...]` : val;
},
typeFormat (val, type, precision) {
if (!val) return val;
type = type.toUpperCase();
if (DATE.includes(type))
return moment(val).isValid() ? moment(val).format('YYYY-MM-DD') : val;
if (DATETIME.includes(type)) {
if (typeof val === 'string')
return val;
let datePrecision = '';
for (let i = 0; i < precision; i++)
datePrecision += i === 0 ? '.S' : 'S';
return moment(val).isValid() ? moment(val).format(`YYYY-MM-DD HH:mm:ss${datePrecision}`) : val;
}
if (BLOB.includes(type)) {
const buff = Buffer.from(val);
if (!buff.length) return '';
const hex = buff.toString('hex').substring(0, 8).toUpperCase();
return `${mimeFromHex(hex).mime} (${formatBytes(buff.length)})`;
}
if (BIT.includes(type)) {
if (typeof val === 'number') val = [val];
const hex = Buffer.from(val).toString('hex');
const bitString = hexToBinary(hex);
return parseInt(bitString).toString().padStart(precision, '0');
}
if (ARRAY.includes(type)) {
if (Array.isArray(val))
return JSON.stringify(val).replaceAll('[', '{').replaceAll(']', '}');
return val;
}
if (SPATIAL.includes(type))
return val;
return typeof val === 'object' ? JSON.stringify(val) : val;
} }
} }
}; };

View File

@ -117,14 +117,14 @@
<i class="mdi mdi-timer-sand mdi-rotate-180 pr-1" /> <b>{{ results[0].duration / 1000 }}s</b> <i class="mdi mdi-timer-sand mdi-rotate-180 pr-1" /> <b>{{ results[0].duration / 1000 }}s</b>
</div> </div>
<div v-if="results.length && results[0].rows"> <div v-if="results.length && results[0].rows">
{{ $t('word.results') }}: <b>{{ results[0].rows.length | localeString }}</b> {{ $t('word.results') }}: <b>{{ localeString(results[0].rows.length) }}</b>
</div> </div>
<div v-if="hasApproximately || (page > 1 && approximateCount)"> <div v-if="hasApproximately || (page > 1 && approximateCount)">
{{ $t('word.total') }}: <b {{ $t('word.total') }}: <b
:title="!customizations.tableRealCount ? $t('word.approximately') : ''" :title="!customizations.tableRealCount ? $t('word.approximately') : ''"
> >
<span v-if="!customizations.tableRealCount"></span> <span v-if="!customizations.tableRealCount"></span>
{{ approximateCount | localeString }} {{ localeString(approximateCount) }}
</b> </b>
</div> </div>
<div class="d-flex" :title="$t('word.schema')"> <div class="d-flex" :title="$t('word.schema')">
@ -194,12 +194,6 @@ export default {
ModalNewTableRow, ModalNewTableRow,
ModalFakerRows ModalFakerRows
}, },
filters: {
localeString (val) {
if (val !== null)
return val.toLocaleString();
}
},
mixins: [tableTabs], mixins: [tableTabs],
props: { props: {
connection: Object, connection: Object,
@ -310,7 +304,7 @@ export default {
this.getTableData(); this.getTableData();
window.addEventListener('keydown', this.onKey); window.addEventListener('keydown', this.onKey);
}, },
beforeDestroy () { beforeUnmount () {
window.removeEventListener('keydown', this.onKey); window.removeEventListener('keydown', this.onKey);
clearInterval(this.refreshInterval); clearInterval(this.refreshInterval);
}, },
@ -335,8 +329,8 @@ export default {
table: this.table, table: this.table,
limit: this.limit, limit: this.limit,
page: this.page, page: this.page,
sortParams: this.sortParams, sortParams: { ...this.sortParams },
where: this.filters || [] where: [...this.filters] || []
}; };
try { // Table data try { // Table data
@ -458,6 +452,10 @@ export default {
updateFilters (clausoles) { updateFilters (clausoles) {
this.filters = clausoles; this.filters = clausoles;
this.getTableData(); this.getTableData();
},
localeString (val) {
if (val !== null)
return val.toLocaleString();
} }
} }
}; };

View File

@ -0,0 +1,64 @@
// TODO: unfinished
import Tables from '@/ipc-api/Tables';
import { ref } from 'vue';
export default function useResultTables (uid, reloadTable, addNotification) {
const tableRef = ref(null);
const isQuering = ref(false);
async function updateField (payload) {
isQuering.value = true;
const params = {
uid: uid,
...payload
};
try {
const { status, response } = await Tables.updateTableCell(params);
if (status === 'success') {
if (response.reload)// Needed for blob fields
reloadTable();
else
tableRef.applyUpdate(payload);
}
else
addNotification({ status: 'error', message: response });
}
catch (err) {
addNotification({ status: 'error', message: err.stack });
}
isQuering.value = false;
}
async function deleteSelected (payload) {
isQuering.value = true;
const params = {
uid: uid,
...payload
};
try {
const { status, response } = await Tables.deleteTableRows(params);
isQuering.value = false;
if (status === 'success')
reloadTable();
else
this.addNotification({ status: 'error', message: response });
}
catch (err) {
this.addNotification({ status: 'error', message: err.stack });
isQuering.value = false;
}
}
return {
tableRef,
isQuering,
updateField,
deleteSelected
};
}

View File

@ -1,9 +1,7 @@
import Vue from 'vue'; import { createI18n } from 'vue-i18n/dist/vue-i18n.esm-bundler.js';// NOTES: temporary fix to compile error
import VueI18n from 'vue-i18n';
Vue.use(VueI18n); const i18n = locale => createI18n({
locale,
const i18n = new VueI18n({
messages: { messages: {
'en-US': require('./en-US'), 'en-US': require('./en-US'),
'it-IT': require('./it-IT'), 'it-IT': require('./it-IT'),

View File

@ -1,20 +1,15 @@
'use strict'; 'use strict';
import { createApp } from 'vue';
import Vue from 'vue';
import '@mdi/font/css/materialdesignicons.css'; import '@mdi/font/css/materialdesignicons.css';
import 'leaflet/dist/leaflet.css'; import 'leaflet/dist/leaflet.css';
import '@/scss/main.scss'; import '@/scss/main.scss';
import App from '@/App.vue'; import App from '@/App.vue';
import store from '@/store'; import { store } from '@/store';
import i18n from '@/i18n'; import i18n from '@/i18n';
i18n.locale = store.state.settings.locale; const app = createApp(App);
Vue.config.productionTip = false; app.use(store);
app.use(i18n(store.state.settings.locale));
new Vue({ app.mount('#app');
render: h => h(App),
store,
i18n
}).$mount('#app');

View File

@ -6,12 +6,12 @@ import connStringConstruct from '../libs/connStringDecode';
export default class { export default class {
static makeTest (params) { static makeTest (params) {
params = connStringConstruct(params); params = connStringConstruct(params);
return ipcRenderer.invoke('test-connection', params); return ipcRenderer.invoke('test-connection', { ...params });
} }
static connect (params) { static connect (params) {
params = connStringConstruct(params); params = connStringConstruct(params);
return ipcRenderer.invoke('connect', params); return ipcRenderer.invoke('connect', { ...params });
} }
static checkConnection (uid) { static checkConnection (uid) {

View File

@ -3,23 +3,23 @@ import { ipcRenderer } from 'electron';
export default class { export default class {
static createSchema (params) { static createSchema (params) {
return ipcRenderer.invoke('create-schema', params); return ipcRenderer.invoke('create-schema', { ...params });
} }
static updateSchema (params) { static updateSchema (params) {
return ipcRenderer.invoke('update-schema', params); return ipcRenderer.invoke('update-schema', { ...params });
} }
static getDatabaseCollation (params) { static getDatabaseCollation (params) {
return ipcRenderer.invoke('get-schema-collation', params); return ipcRenderer.invoke('get-schema-collation', { ...params });
} }
static deleteSchema (params) { static deleteSchema (params) {
return ipcRenderer.invoke('delete-schema', params); return ipcRenderer.invoke('delete-schema', { ...params });
} }
static getStructure (params) { static getStructure (params) {
return ipcRenderer.invoke('get-structure', params); return ipcRenderer.invoke('get-structure', { ...params });
} }
static getCollations (uid) { static getCollations (uid) {
@ -43,35 +43,35 @@ export default class {
} }
static killProcess (params) { static killProcess (params) {
return ipcRenderer.invoke('kill-process', params); return ipcRenderer.invoke('kill-process', { ...params });
} }
static killTabQuery (params) { static killTabQuery (params) {
return ipcRenderer.invoke('kill-tab-query', params); return ipcRenderer.invoke('kill-tab-query', { ...params });
} }
static commitTab (params) { static commitTab (params) {
return ipcRenderer.invoke('commit-tab', params); return ipcRenderer.invoke('commit-tab', { ...params });
} }
static rollbackTab (params) { static rollbackTab (params) {
return ipcRenderer.invoke('rollback-tab', params); return ipcRenderer.invoke('rollback-tab', { ...params });
} }
static destroyConnectionToCommit (params) { static destroyConnectionToCommit (params) {
return ipcRenderer.invoke('destroy-connection-to-commit', params); return ipcRenderer.invoke('destroy-connection-to-commit', { ...params });
} }
static useSchema (params) { static useSchema (params) {
return ipcRenderer.invoke('use-schema', params); return ipcRenderer.invoke('use-schema', { ...params });
} }
static rawQuery (params) { static rawQuery (params) {
return ipcRenderer.invoke('raw-query', params); return ipcRenderer.invoke('raw-query', { ...params });
} }
static export (params) { static export (params) {
return ipcRenderer.invoke('export', params); return ipcRenderer.invoke('export', { ...params });
} }
static abortExport () { static abortExport () {
@ -79,7 +79,7 @@ export default class {
} }
static import (params) { static import (params) {
return ipcRenderer.invoke('import-sql', params); return ipcRenderer.invoke('import-sql', { ...params });
} }
static abortImport () { static abortImport () {

View File

@ -3,66 +3,66 @@ import { ipcRenderer } from 'electron';
export default class { export default class {
static getTableColumns (params) { static getTableColumns (params) {
return ipcRenderer.invoke('get-table-columns', params); return ipcRenderer.invoke('get-table-columns', { ...params });
} }
static getTableData (params) { static getTableData (params) {
return ipcRenderer.invoke('get-table-data', params); return ipcRenderer.invoke('get-table-data', { ...params });
} }
static getTableApproximateCount (params) { static getTableApproximateCount (params) {
return ipcRenderer.invoke('get-table-count', params); return ipcRenderer.invoke('get-table-count', { ...params });
} }
static getTableOptions (params) { static getTableOptions (params) {
return ipcRenderer.invoke('get-table-options', params); return ipcRenderer.invoke('get-table-options', { ...params });
} }
static getTableIndexes (params) { static getTableIndexes (params) {
return ipcRenderer.invoke('get-table-indexes', params); return ipcRenderer.invoke('get-table-indexes', { ...params });
} }
static getKeyUsage (params) { static getKeyUsage (params) {
return ipcRenderer.invoke('get-key-usage', params); return ipcRenderer.invoke('get-key-usage', { ...params });
} }
static updateTableCell (params) { static updateTableCell (params) {
return ipcRenderer.invoke('update-table-cell', params); return ipcRenderer.invoke('update-table-cell', { ...params });
} }
static deleteTableRows (params) { static deleteTableRows (params) {
return ipcRenderer.invoke('delete-table-rows', params); return ipcRenderer.invoke('delete-table-rows', { ...params });
} }
static insertTableRows (params) { static insertTableRows (params) {
return ipcRenderer.invoke('insert-table-rows', params); return ipcRenderer.invoke('insert-table-rows', { ...params });
} }
static insertTableFakeRows (params) { static insertTableFakeRows (params) {
return ipcRenderer.invoke('insert-table-fake-rows', params); return ipcRenderer.invoke('insert-table-fake-rows', { ...params });
} }
static getForeignList (params) { static getForeignList (params) {
return ipcRenderer.invoke('get-foreign-list', params); return ipcRenderer.invoke('get-foreign-list', { ...params });
} }
static createTable (params) { static createTable (params) {
return ipcRenderer.invoke('create-table', params); return ipcRenderer.invoke('create-table', { ...params });
} }
static alterTable (params) { static alterTable (params) {
return ipcRenderer.invoke('alter-table', params); return ipcRenderer.invoke('alter-table', { ...params });
} }
static duplicateTable (params) { static duplicateTable (params) {
return ipcRenderer.invoke('duplicate-table', params); return ipcRenderer.invoke('duplicate-table', { ...params });
} }
static truncateTable (params) { static truncateTable (params) {
return ipcRenderer.invoke('truncate-table', params); return ipcRenderer.invoke('truncate-table', { ...params });
} }
static dropTable (params) { static dropTable (params) {
return ipcRenderer.invoke('drop-table', params); return ipcRenderer.invoke('drop-table', { ...params });
} }
} }

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
import { createStore } from 'vuex/dist/vuex.esm-bundler';
import Vue from 'vue'; // import Vue from 'vue';
import Vuex from 'vuex'; // import Vuex from 'vuex';
import application from './modules/application.store'; import application from './modules/application.store';
import settings from './modules/settings.store'; import settings from './modules/settings.store';
@ -15,9 +15,9 @@ import ipcUpdates from './plugins/ipcUpdates';
import ipcExceptions from './plugins/ipcExceptions'; import ipcExceptions from './plugins/ipcExceptions';
import ipcShortcuts from './plugins/ipcShortcuts'; import ipcShortcuts from './plugins/ipcShortcuts';
Vue.use(Vuex); // Vue.use(Vuex);
export default new Vuex.Store({ export const store = createStore({
strict: true, strict: true,
modules: { modules: {
application, application,

View File

@ -268,7 +268,7 @@ export default {
persistentStore.set(uid, state.workspaces.find(workspace => workspace.uid === uid).tabs); persistentStore.set(uid, state.workspaces.find(workspace => workspace.uid === uid).tabs);
}, },
RENAME_TABS (state, { uid, schema, elementName, elementType, elementNewName }) { RENAME_TABS (state, { uid, schema, elementName, elementNewName }) {
state.workspaces = state.workspaces.map(workspace => { state.workspaces = state.workspaces.map(workspace => {
if (workspace.uid === uid) { if (workspace.uid === uid) {
return { return {
@ -386,7 +386,7 @@ export default {
selectWorkspace ({ commit }, uid) { selectWorkspace ({ commit }, uid) {
commit('SELECT_WORKSPACE', uid); commit('SELECT_WORKSPACE', uid);
}, },
async connectWorkspace ({ dispatch, commit, getters, rootGetters }, connection) { async connectWorkspace ({ dispatch, commit, rootGetters }, connection) {
commit('SET_CONNECTING', connection.uid); commit('SET_CONNECTING', connection.uid);
try { try {
@ -536,7 +536,7 @@ export default {
commit('SET_DISCONNECTED', uid); commit('SET_DISCONNECTED', uid);
commit('SELECT_TAB', { uid, tab: 0 }); commit('SELECT_TAB', { uid, tab: 0 });
}, },
addWorkspace ({ commit }, uid) { async addWorkspace ({ commit }, uid) {
const workspace = { const workspace = {
uid, uid,
connectionStatus: 'disconnected', connectionStatus: 'disconnected',
@ -552,7 +552,7 @@ export default {
loadedSchemas: new Set() loadedSchemas: new Set()
}; };
commit('ADD_WORKSPACE', workspace); await commit('ADD_WORKSPACE', workspace);
}, },
changeBreadcrumbs ({ commit, getters }, payload) { changeBreadcrumbs ({ commit, getters }, payload) {
const breadcrumbsObj = { const breadcrumbsObj = {

View File

@ -1,11 +1,11 @@
import { ipcRenderer } from 'electron'; import { ipcRenderer } from 'electron';
export default store => { export default store => {
ipcRenderer.on('toggle-preferences', (event, error) => { ipcRenderer.on('toggle-preferences', () => {
store.dispatch('application/showSettingModal', 'general'); store.dispatch('application/showSettingModal', 'general');
}); });
ipcRenderer.on('open-updates-preferences', (event, error) => { ipcRenderer.on('open-updates-preferences', () => {
store.dispatch('application/showSettingModal', 'update'); store.dispatch('application/showSettingModal', 'update');
ipcRenderer.send('check-for-updates'); ipcRenderer.send('check-for-updates');
}); });

View File

@ -14,7 +14,7 @@ const parsedContributors = contributors.reduce((acc, c) => {
}, []).join(','); }, []).join(',');
const externals = Object.keys(dependencies).concat(Object.keys(devDependencies)); const externals = Object.keys(dependencies).concat(Object.keys(devDependencies));
const isDevMode = process.env.NODE_ENV === 'development'; const isDevMode = process.env.NODE_ENV !== 'production';
const whiteListedModules = ['vue']; const whiteListedModules = ['vue'];
const config = { const config = {
@ -39,9 +39,9 @@ const config = {
externals: externals.filter((d) => !whiteListedModules.includes(d)), externals: externals.filter((d) => !whiteListedModules.includes(d)),
resolve: { resolve: {
alias: { alias: {
vue$: 'vue/dist/vue.common.js', // vue$: 'vue/dist/vue.common.js',
common: path.resolve(__dirname, 'src/common'), '@': path.resolve(__dirname, 'src/renderer'),
'@': path.resolve(__dirname, 'src/renderer') common: path.resolve(__dirname, 'src/common')
}, },
extensions: ['', '.js', '.vue', '.json'], extensions: ['', '.js', '.vue', '.json'],
fallback: { fallback: {