mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
refactor: migration to pinia
This commit is contained in:
@ -40,6 +40,7 @@ const downloadFile = url => {
|
|||||||
await downloadFile(fileUrl);
|
await downloadFile(fileUrl);
|
||||||
await unzip(filePath, destFolder);
|
await unzip(filePath, destFolder);
|
||||||
fs.unlinkSync(filePath);
|
fs.unlinkSync(filePath);
|
||||||
|
fs.unlinkSync(`${destFolder}/package.json`);// <- Avoid to display annoyng npm script in vscode
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
@ -26,11 +26,13 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { defineAsyncComponent } from 'vue';
|
import { defineAsyncComponent } from 'vue';
|
||||||
import { mapGetters } from 'vuex';
|
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { ipcRenderer } from 'electron';
|
import { ipcRenderer } from 'electron';
|
||||||
import { Menu, getCurrentWindow } from '@electron/remote';
|
import { Menu, getCurrentWindow } from '@electron/remote';
|
||||||
import { useApplicationStore } from '@/stores/application';
|
import { useApplicationStore } from '@/stores/application';
|
||||||
|
import { useConnectionsStore } from '@/stores/connections';
|
||||||
|
import { useSettingsStore } from '@/stores/settings';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import TheSettingBar from '@/components/TheSettingBar';
|
import TheSettingBar from '@/components/TheSettingBar';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -48,30 +50,32 @@ export default {
|
|||||||
},
|
},
|
||||||
setup () {
|
setup () {
|
||||||
const applicationStore = useApplicationStore();
|
const applicationStore = useApplicationStore();
|
||||||
|
const connectionsStore = useConnectionsStore();
|
||||||
|
const settingsStore = useSettingsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
isLoading,
|
isLoading,
|
||||||
isSettingModal,
|
isSettingModal,
|
||||||
isScratchpad
|
isScratchpad
|
||||||
} = storeToRefs(applicationStore);
|
} = storeToRefs(applicationStore);
|
||||||
|
const { connections } = storeToRefs(connectionsStore);
|
||||||
|
const { applicationTheme, disableBlur } = storeToRefs(settingsStore);
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
const { checkVersionUpdate } = applicationStore;
|
const { checkVersionUpdate } = applicationStore;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
applicationStore,
|
|
||||||
isLoading,
|
isLoading,
|
||||||
isSettingModal,
|
isSettingModal,
|
||||||
isScratchpad,
|
isScratchpad,
|
||||||
checkVersionUpdate
|
checkVersionUpdate,
|
||||||
|
connections,
|
||||||
|
applicationTheme,
|
||||||
|
disableBlur,
|
||||||
|
selectedWorkspace
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
...mapGetters({
|
|
||||||
connections: 'connections/getConnections',
|
|
||||||
applicationTheme: 'settings/getApplicationTheme',
|
|
||||||
disableBlur: 'settings/getDisableBlur',
|
|
||||||
selectedWorkspace: 'workspaces/getSelected'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
mounted () {
|
mounted () {
|
||||||
ipcRenderer.send('check-for-updates');
|
ipcRenderer.send('check-for-updates');
|
||||||
this.checkVersionUpdate();
|
this.checkVersionUpdate();
|
||||||
|
@ -12,7 +12,8 @@
|
|||||||
<script>
|
<script>
|
||||||
import * as ace from 'ace-builds';
|
import * as ace from 'ace-builds';
|
||||||
import 'ace-builds/webpack-resolver';
|
import 'ace-builds/webpack-resolver';
|
||||||
import { mapGetters } from 'vuex';
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { useSettingsStore } from '@/stores/settings';
|
||||||
import { uidGen } from 'common/libs/uidGen';
|
import { uidGen } from 'common/libs/uidGen';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -27,20 +28,29 @@ export default {
|
|||||||
height: { type: Number, default: 200 }
|
height: { type: Number, default: 200 }
|
||||||
},
|
},
|
||||||
emits: ['update:modelValue'],
|
emits: ['update:modelValue'],
|
||||||
|
setup () {
|
||||||
|
const settingsStore = useSettingsStore();
|
||||||
|
|
||||||
|
const {
|
||||||
|
editorTheme,
|
||||||
|
editorFontSize,
|
||||||
|
autoComplete,
|
||||||
|
lineWrap
|
||||||
|
} = storeToRefs(settingsStore);
|
||||||
|
|
||||||
|
return {
|
||||||
|
editorTheme,
|
||||||
|
editorFontSize,
|
||||||
|
autoComplete,
|
||||||
|
lineWrap
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
editor: null,
|
editor: null,
|
||||||
id: null
|
id: uidGen()
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
...mapGetters({
|
|
||||||
editorTheme: 'settings/getEditorTheme',
|
|
||||||
editorFontSize: 'settings/getEditorFontSize',
|
|
||||||
autoComplete: 'settings/getAutoComplete',
|
|
||||||
lineWrap: 'settings/getLineWrap'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
watch: {
|
watch: {
|
||||||
mode () {
|
mode () {
|
||||||
if (this.editor)
|
if (this.editor)
|
||||||
@ -78,9 +88,6 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
|
||||||
this.id = uidGen('E');
|
|
||||||
},
|
|
||||||
mounted () {
|
mounted () {
|
||||||
this.editor = ace.edit(`editor-${this.id}`, {
|
this.editor = ace.edit(`editor-${this.id}`, {
|
||||||
mode: `ace/mode/${this.mode}`,
|
mode: `ace/mode/${this.mode}`,
|
||||||
|
@ -4,10 +4,10 @@
|
|||||||
<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">
|
||||||
{{ lastPart(value) }}
|
{{ lastPart(modelValue) }}
|
||||||
</span>
|
</span>
|
||||||
<i
|
<i
|
||||||
v-if="value.length"
|
v-if="modelValue.length"
|
||||||
class="file-uploader-reset mdi mdi-close"
|
class="file-uploader-reset mdi mdi-close"
|
||||||
@click.prevent="clear"
|
@click.prevent="clear"
|
||||||
/>
|
/>
|
||||||
@ -30,7 +30,7 @@ export default {
|
|||||||
default: 'Browse',
|
default: 'Browse',
|
||||||
type: String
|
type: String
|
||||||
},
|
},
|
||||||
value: {
|
modelValue: {
|
||||||
default: '',
|
default: '',
|
||||||
type: String
|
type: String
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { VueMaskDirective } from 'v-mask';
|
|
||||||
import { TEXT, LONG_TEXT, NUMBER, FLOAT, DATE, TIME, DATETIME, BLOB, BIT } from 'common/fieldTypes';
|
import { TEXT, LONG_TEXT, NUMBER, FLOAT, DATE, TIME, DATETIME, BLOB, BIT } from 'common/fieldTypes';
|
||||||
import BaseUploadInput from '@/components/BaseUploadInput';
|
import BaseUploadInput from '@/components/BaseUploadInput';
|
||||||
import ForeignKeySelect from '@/components/ForeignKeySelect';
|
import ForeignKeySelect from '@/components/ForeignKeySelect';
|
||||||
@ -117,9 +116,6 @@ export default {
|
|||||||
ForeignKeySelect,
|
ForeignKeySelect,
|
||||||
BaseUploadInput
|
BaseUploadInput
|
||||||
},
|
},
|
||||||
directives: {
|
|
||||||
mask: VueMaskDirective
|
|
||||||
},
|
|
||||||
props: {
|
props: {
|
||||||
type: String,
|
type: String,
|
||||||
field: Object,
|
field: Object,
|
||||||
|
@ -22,8 +22,10 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Tables from '@/ipc-api/Tables';
|
import Tables from '@/ipc-api/Tables';
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import { TEXT, LONG_TEXT } from 'common/fieldTypes';
|
import { TEXT, LONG_TEXT } from 'common/fieldTypes';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
export default {
|
export default {
|
||||||
name: 'ForeignKeySelect',
|
name: 'ForeignKeySelect',
|
||||||
props: {
|
props: {
|
||||||
@ -35,15 +37,20 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
emits: ['update:modelValue', 'blur'],
|
emits: ['update:modelValue', 'blur'],
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
return { addNotification, selectedWorkspace };
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
foreignList: []
|
foreignList: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
selectedWorkspace: 'workspaces/getSelected'
|
|
||||||
}),
|
|
||||||
isValidDefault () {
|
isValidDefault () {
|
||||||
if (!this.foreignList.length) return true;
|
if (!this.foreignList.length) return true;
|
||||||
if (this.modelValue === null) return false;
|
if (this.modelValue === null) return false;
|
||||||
@ -88,9 +95,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification'
|
|
||||||
}),
|
|
||||||
onChange () {
|
onChange () {
|
||||||
this.$emit('update:modelValue', this.$refs.editField.value);
|
this.$emit('update:modelValue', this.$refs.editField.value);
|
||||||
},
|
},
|
||||||
|
@ -68,8 +68,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import Schema from '@/ipc-api/Schema';
|
import Schema from '@/ipc-api/Schema';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ModalEditSchema',
|
name: 'ModalEditSchema',
|
||||||
@ -77,6 +79,21 @@ export default {
|
|||||||
selectedSchema: String
|
selectedSchema: String
|
||||||
},
|
},
|
||||||
emits: ['close'],
|
emits: ['close'],
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const { getWorkspace, getDatabaseVariable } = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace,
|
||||||
|
getDatabaseVariable
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
database: {
|
database: {
|
||||||
@ -87,11 +104,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace',
|
|
||||||
getDatabaseVariable: 'workspaces/getDatabaseVariable'
|
|
||||||
}),
|
|
||||||
collations () {
|
collations () {
|
||||||
return this.getWorkspace(this.selectedWorkspace).collations;
|
return this.getWorkspace(this.selectedWorkspace).collations;
|
||||||
},
|
},
|
||||||
@ -131,9 +143,6 @@ export default {
|
|||||||
window.removeEventListener('keydown', this.onKey);
|
window.removeEventListener('keydown', this.onKey);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification'
|
|
||||||
}),
|
|
||||||
async updateSchema () {
|
async updateSchema () {
|
||||||
if (this.database.collation !== this.database.prevCollation) {
|
if (this.database.collation !== this.database.prevCollation) {
|
||||||
try {
|
try {
|
||||||
|
@ -271,7 +271,8 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ipcRenderer } from 'electron';
|
import { ipcRenderer } from 'electron';
|
||||||
import { mapActions, mapGetters } from 'vuex';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import customizations from 'common/customizations';
|
import customizations from 'common/customizations';
|
||||||
import Application from '@/ipc-api/Application';
|
import Application from '@/ipc-api/Application';
|
||||||
@ -279,11 +280,30 @@ import Schema from '@/ipc-api/Schema';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ModalExportSchema',
|
name: 'ModalExportSchema',
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
selectedSchema: String
|
selectedSchema: String
|
||||||
},
|
},
|
||||||
emits: ['close'],
|
emits: ['close'],
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const {
|
||||||
|
getWorkspace,
|
||||||
|
getDatabaseVariable,
|
||||||
|
refreshSchema
|
||||||
|
} = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace,
|
||||||
|
getDatabaseVariable,
|
||||||
|
refreshSchema
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
isExporting: false,
|
isExporting: false,
|
||||||
@ -301,11 +321,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace',
|
|
||||||
getDatabaseVariable: 'workspaces/getDatabaseVariable'
|
|
||||||
}),
|
|
||||||
currentWorkspace () {
|
currentWorkspace () {
|
||||||
return this.getWorkspace(this.selectedWorkspace);
|
return this.getWorkspace(this.selectedWorkspace);
|
||||||
},
|
},
|
||||||
@ -370,10 +385,6 @@ export default {
|
|||||||
ipcRenderer.off('export-progress', this.updateProgress);
|
ipcRenderer.off('export-progress', this.updateProgress);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification',
|
|
||||||
refreshSchema: 'workspaces/refreshSchema'
|
|
||||||
}),
|
|
||||||
async startExport () {
|
async startExport () {
|
||||||
this.isExporting = true;
|
this.isExporting = true;
|
||||||
const { uid, client } = this.currentWorkspace;
|
const { uid, client } = this.currentWorkspace;
|
||||||
|
@ -188,7 +188,8 @@
|
|||||||
<script>
|
<script>
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { TEXT, LONG_TEXT, NUMBER, FLOAT, DATE, TIME, DATETIME, BLOB, BIT } from 'common/fieldTypes';
|
import { TEXT, LONG_TEXT, NUMBER, FLOAT, DATE, TIME, DATETIME, BLOB, BIT } from 'common/fieldTypes';
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import Tables from '@/ipc-api/Tables';
|
import Tables from '@/ipc-api/Tables';
|
||||||
import FakerSelect from '@/components/FakerSelect';
|
import FakerSelect from '@/components/FakerSelect';
|
||||||
|
|
||||||
@ -203,6 +204,21 @@ export default {
|
|||||||
keyUsage: Array
|
keyUsage: Array
|
||||||
},
|
},
|
||||||
emits: ['reload', 'hide'],
|
emits: ['reload', 'hide'],
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const { getWorkspace, getWorkspaceTab } = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace,
|
||||||
|
getWorkspaceTab
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
localRow: {},
|
localRow: {},
|
||||||
@ -213,11 +229,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace',
|
|
||||||
getWorkspaceTab: 'workspaces/getWorkspaceTab'
|
|
||||||
}),
|
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.selectedWorkspace);
|
return this.getWorkspace(this.selectedWorkspace);
|
||||||
},
|
},
|
||||||
@ -288,9 +299,6 @@ export default {
|
|||||||
window.removeEventListener('keydown', this.onKey);
|
window.removeEventListener('keydown', this.onKey);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification'
|
|
||||||
}),
|
|
||||||
typeClass (type) {
|
typeClass (type) {
|
||||||
if (type)
|
if (type)
|
||||||
return `type-${type.toLowerCase().replaceAll(' ', '_').replaceAll('"', '')}`;
|
return `type-${type.toLowerCase().replaceAll(' ', '_').replaceAll('"', '')}`;
|
||||||
|
@ -99,7 +99,9 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { useHistoryStore } from '@/stores/history';
|
||||||
|
import { useConnectionsStore } from '@/stores/connections';
|
||||||
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
import BaseVirtualScroll from '@/components/BaseVirtualScroll';
|
import BaseVirtualScroll from '@/components/BaseVirtualScroll';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -111,6 +113,18 @@ export default {
|
|||||||
connection: Object
|
connection: Object
|
||||||
},
|
},
|
||||||
emits: ['select-query', 'close'],
|
emits: ['select-query', 'close'],
|
||||||
|
setup () {
|
||||||
|
const { getHistoryByWorkspace, deleteQueryFromHistory } = useHistoryStore();
|
||||||
|
const { getConnectionName } = useConnectionsStore();
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
|
||||||
|
return {
|
||||||
|
getHistoryByWorkspace,
|
||||||
|
deleteQueryFromHistory,
|
||||||
|
getConnectionName,
|
||||||
|
addNotification
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
resultsSize: 1000,
|
resultsSize: 1000,
|
||||||
@ -122,10 +136,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
getConnectionName: 'connections/getConnectionName',
|
|
||||||
getHistoryByWorkspace: 'history/getHistoryByWorkspace'
|
|
||||||
}),
|
|
||||||
connectionName () {
|
connectionName () {
|
||||||
return this.getConnectionName(this.connection.uid);
|
return this.getConnectionName(this.connection.uid);
|
||||||
},
|
},
|
||||||
@ -165,10 +175,6 @@ export default {
|
|||||||
clearInterval(this.refreshInterval);
|
clearInterval(this.refreshInterval);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification',
|
|
||||||
deleteQueryFromHistory: 'history/deleteQueryFromHistory'
|
|
||||||
}),
|
|
||||||
copyQuery (sql) {
|
copyQuery (sql) {
|
||||||
navigator.clipboard.writeText(sql);
|
navigator.clipboard.writeText(sql);
|
||||||
},
|
},
|
||||||
|
@ -51,9 +51,11 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ipcRenderer } from 'electron';
|
import { ipcRenderer } from 'electron';
|
||||||
import { mapActions, mapGetters } from 'vuex';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import Schema from '@/ipc-api/Schema';
|
import Schema from '@/ipc-api/Schema';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ModalImportSchema',
|
name: 'ModalImportSchema',
|
||||||
@ -62,6 +64,21 @@ export default {
|
|||||||
selectedSchema: String
|
selectedSchema: String
|
||||||
},
|
},
|
||||||
emits: ['close'],
|
emits: ['close'],
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const { getWorkspace, refreshSchema } = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace,
|
||||||
|
refreshSchema
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
sqlFile: '',
|
sqlFile: '',
|
||||||
@ -74,10 +91,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
|
||||||
}),
|
|
||||||
currentWorkspace () {
|
currentWorkspace () {
|
||||||
return this.getWorkspace(this.selectedWorkspace);
|
return this.getWorkspace(this.selectedWorkspace);
|
||||||
},
|
},
|
||||||
@ -99,10 +112,6 @@ export default {
|
|||||||
ipcRenderer.off('query-error', this.handleQueryError);
|
ipcRenderer.off('query-error', this.handleQueryError);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification',
|
|
||||||
refreshSchema: 'workspaces/refreshSchema'
|
|
||||||
}),
|
|
||||||
async startImport (sqlFile) {
|
async startImport (sqlFile) {
|
||||||
this.isImporting = true;
|
this.isImporting = true;
|
||||||
this.sqlFile = sqlFile;
|
this.sqlFile = sqlFile;
|
||||||
|
@ -68,12 +68,29 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import Schema from '@/ipc-api/Schema';
|
import Schema from '@/ipc-api/Schema';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ModalNewSchema',
|
name: 'ModalNewSchema',
|
||||||
emits: ['reload', 'close'],
|
emits: ['reload', 'close'],
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const { getWorkspace, getDatabaseVariable } = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace,
|
||||||
|
getDatabaseVariable
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
@ -84,11 +101,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace',
|
|
||||||
getDatabaseVariable: 'workspaces/getDatabaseVariable'
|
|
||||||
}),
|
|
||||||
collations () {
|
collations () {
|
||||||
return this.getWorkspace(this.selectedWorkspace).collations;
|
return this.getWorkspace(this.selectedWorkspace).collations;
|
||||||
},
|
},
|
||||||
@ -110,9 +122,6 @@ export default {
|
|||||||
window.removeEventListener('keydown', this.onKey);
|
window.removeEventListener('keydown', this.onKey);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification'
|
|
||||||
}),
|
|
||||||
async createSchema () {
|
async createSchema () {
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
try {
|
try {
|
||||||
|
@ -121,25 +121,38 @@
|
|||||||
<script>
|
<script>
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { TEXT, LONG_TEXT, NUMBER, FLOAT, DATE, TIME, DATETIME, BLOB, BIT } from 'common/fieldTypes';
|
import { TEXT, LONG_TEXT, NUMBER, FLOAT, DATE, TIME, DATETIME, BLOB, BIT } from 'common/fieldTypes';
|
||||||
import { VueMaskDirective } from 'v-mask';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import Tables from '@/ipc-api/Tables';
|
import Tables from '@/ipc-api/Tables';
|
||||||
import ForeignKeySelect from '@/components/ForeignKeySelect';
|
import ForeignKeySelect from '@/components/ForeignKeySelect';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ModalNewTableRow',
|
name: 'ModalNewTableRow',
|
||||||
components: {
|
components: {
|
||||||
ForeignKeySelect
|
ForeignKeySelect
|
||||||
},
|
},
|
||||||
directives: {
|
|
||||||
mask: VueMaskDirective
|
|
||||||
},
|
|
||||||
props: {
|
props: {
|
||||||
tabUid: [String, Number],
|
tabUid: [String, Number],
|
||||||
fields: Array,
|
fields: Array,
|
||||||
keyUsage: Array
|
keyUsage: Array
|
||||||
},
|
},
|
||||||
emits: ['reload', 'hide'],
|
emits: ['reload', 'hide'],
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const { getWorkspace, getWorkspaceTab } = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace,
|
||||||
|
getWorkspaceTab
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
localRow: {},
|
localRow: {},
|
||||||
@ -149,11 +162,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace',
|
|
||||||
getWorkspaceTab: 'workspaces/getWorkspaceTab'
|
|
||||||
}),
|
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.selectedWorkspace);
|
return this.getWorkspace(this.selectedWorkspace);
|
||||||
},
|
},
|
||||||
@ -217,9 +225,6 @@ export default {
|
|||||||
window.removeEventListener('keydown', this.onKey);
|
window.removeEventListener('keydown', this.onKey);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification'
|
|
||||||
}),
|
|
||||||
typeClass (type) {
|
typeClass (type) {
|
||||||
if (type)
|
if (type)
|
||||||
return `type-${type.toLowerCase().replaceAll(' ', '_').replaceAll('"', '')}`;
|
return `type-${type.toLowerCase().replaceAll(' ', '_').replaceAll('"', '')}`;
|
||||||
|
@ -134,9 +134,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
|
||||||
import arrayToFile from '../libs/arrayToFile';
|
import arrayToFile from '../libs/arrayToFile';
|
||||||
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
import Schema from '@/ipc-api/Schema';
|
import Schema from '@/ipc-api/Schema';
|
||||||
|
import { useConnectionsStore } from '@/stores/connections';
|
||||||
import BaseVirtualScroll from '@/components/BaseVirtualScroll';
|
import BaseVirtualScroll from '@/components/BaseVirtualScroll';
|
||||||
import ModalProcessesListRow from '@/components/ModalProcessesListRow';
|
import ModalProcessesListRow from '@/components/ModalProcessesListRow';
|
||||||
import ModalProcessesListContext from '@/components/ModalProcessesListContext';
|
import ModalProcessesListContext from '@/components/ModalProcessesListContext';
|
||||||
@ -152,6 +153,12 @@ export default {
|
|||||||
connection: Object
|
connection: Object
|
||||||
},
|
},
|
||||||
emits: ['close'],
|
emits: ['close'],
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const { getConnectionName } = useConnectionsStore();
|
||||||
|
|
||||||
|
return { addNotification, getConnectionName };
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
resultsSize: 1000,
|
resultsSize: 1000,
|
||||||
@ -170,9 +177,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
getConnectionName: 'connections/getConnectionName'
|
|
||||||
}),
|
|
||||||
connectionName () {
|
connectionName () {
|
||||||
return this.getConnectionName(this.connection.uid);
|
return this.getConnectionName(this.connection.uid);
|
||||||
},
|
},
|
||||||
@ -212,9 +216,6 @@ export default {
|
|||||||
clearInterval(this.refreshInterval);
|
clearInterval(this.refreshInterval);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification'
|
|
||||||
}),
|
|
||||||
async getProcessesList () {
|
async getProcessesList () {
|
||||||
this.isQuering = true;
|
this.isQuering = true;
|
||||||
|
|
||||||
|
@ -319,9 +319,10 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { shell } from 'electron';
|
import { shell } from 'electron';
|
||||||
import { mapActions, mapGetters } from 'vuex';
|
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { useApplicationStore } from '@/stores/application';
|
import { useApplicationStore } from '@/stores/application';
|
||||||
|
import { useSettingsStore } from '@/stores/settings';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import localesNames from '@/i18n/supported-locales';
|
import localesNames from '@/i18n/supported-locales';
|
||||||
import ModalSettingsUpdate from '@/components/ModalSettingsUpdate';
|
import ModalSettingsUpdate from '@/components/ModalSettingsUpdate';
|
||||||
import ModalSettingsChangelog from '@/components/ModalSettingsChangelog';
|
import ModalSettingsChangelog from '@/components/ModalSettingsChangelog';
|
||||||
@ -336,23 +337,75 @@ export default {
|
|||||||
},
|
},
|
||||||
setup () {
|
setup () {
|
||||||
const applicationStore = useApplicationStore();
|
const applicationStore = useApplicationStore();
|
||||||
|
const settingsStore = useSettingsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
selectedSettingTab,
|
selectedSettingTab,
|
||||||
updateStatus
|
updateStatus
|
||||||
} = storeToRefs(applicationStore);
|
} = storeToRefs(applicationStore);
|
||||||
|
const {
|
||||||
|
locale: selectedLocale,
|
||||||
|
dataTabLimit: pageSize,
|
||||||
|
autoComplete: selectedAutoComplete,
|
||||||
|
lineWrap: selectedLineWrap,
|
||||||
|
notificationsTimeout,
|
||||||
|
restoreTabs,
|
||||||
|
disableBlur,
|
||||||
|
applicationTheme,
|
||||||
|
editorTheme,
|
||||||
|
editorFontSize
|
||||||
|
} = storeToRefs(settingsStore);
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const {
|
||||||
|
changeLocale,
|
||||||
|
changePageSize,
|
||||||
|
changeRestoreTabs,
|
||||||
|
changeDisableBlur,
|
||||||
|
changeAutoComplete,
|
||||||
|
changeLineWrap,
|
||||||
|
changeApplicationTheme,
|
||||||
|
changeEditorTheme,
|
||||||
|
changeEditorFontSize,
|
||||||
|
updateNotificationsTimeout
|
||||||
|
} = settingsStore;
|
||||||
const {
|
const {
|
||||||
hideSettingModal,
|
hideSettingModal,
|
||||||
appName,
|
appName,
|
||||||
appVersion
|
appVersion
|
||||||
} = applicationStore;
|
} = applicationStore;
|
||||||
|
const { getWorkspace } = workspacesStore;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
appName,
|
appName,
|
||||||
appVersion,
|
appVersion,
|
||||||
selectedSettingTab,
|
selectedSettingTab,
|
||||||
updateStatus,
|
updateStatus,
|
||||||
closeModal: hideSettingModal
|
closeModal: hideSettingModal,
|
||||||
|
selectedLocale,
|
||||||
|
pageSize,
|
||||||
|
selectedAutoComplete,
|
||||||
|
selectedLineWrap,
|
||||||
|
notificationsTimeout,
|
||||||
|
restoreTabs,
|
||||||
|
disableBlur,
|
||||||
|
applicationTheme,
|
||||||
|
editorTheme,
|
||||||
|
editorFontSize,
|
||||||
|
changeLocale,
|
||||||
|
changePageSize,
|
||||||
|
changeRestoreTabs,
|
||||||
|
changeDisableBlur,
|
||||||
|
changeAutoComplete,
|
||||||
|
changeLineWrap,
|
||||||
|
changeApplicationTheme,
|
||||||
|
changeEditorTheme,
|
||||||
|
changeEditorFontSize,
|
||||||
|
updateNotificationsTimeout,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
@ -417,20 +470,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
selectedLocale: 'settings/getLocale',
|
|
||||||
pageSize: 'settings/getDataTabLimit',
|
|
||||||
selectedAutoComplete: 'settings/getAutoComplete',
|
|
||||||
selectedLineWrap: 'settings/getLineWrap',
|
|
||||||
notificationsTimeout: 'settings/getNotificationsTimeout',
|
|
||||||
restoreTabs: 'settings/getRestoreTabs',
|
|
||||||
disableBlur: 'settings/getDisableBlur',
|
|
||||||
applicationTheme: 'settings/getApplicationTheme',
|
|
||||||
editorTheme: 'settings/getEditorTheme',
|
|
||||||
editorFontSize: 'settings/getEditorFontSize',
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
|
||||||
}),
|
|
||||||
locales () {
|
locales () {
|
||||||
const locales = [];
|
const locales = [];
|
||||||
for (const locale of this.$i18n.availableLocales)
|
for (const locale of this.$i18n.availableLocales)
|
||||||
@ -480,18 +519,6 @@ ORDER BY
|
|||||||
window.removeEventListener('keydown', this.onKey);
|
window.removeEventListener('keydown', this.onKey);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
changeLocale: 'settings/changeLocale',
|
|
||||||
changePageSize: 'settings/changePageSize',
|
|
||||||
changeRestoreTabs: 'settings/changeRestoreTabs',
|
|
||||||
changeDisableBlur: 'settings/changeDisableBlur',
|
|
||||||
changeAutoComplete: 'settings/changeAutoComplete',
|
|
||||||
changeLineWrap: 'settings/changeLineWrap',
|
|
||||||
changeApplicationTheme: 'settings/changeApplicationTheme',
|
|
||||||
changeEditorTheme: 'settings/changeEditorTheme',
|
|
||||||
changeEditorFontSize: 'settings/changeEditorFontSize',
|
|
||||||
updateNotificationsTimeout: 'settings/updateNotificationsTimeout'
|
|
||||||
}),
|
|
||||||
selectTab (tab) {
|
selectTab (tab) {
|
||||||
this.selectedTab = tab;
|
this.selectedTab = tab;
|
||||||
},
|
},
|
||||||
|
@ -54,28 +54,32 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ipcRenderer, shell } from 'electron';
|
import { ipcRenderer, shell } from 'electron';
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { useApplicationStore } from '@/stores/application';
|
import { useApplicationStore } from '@/stores/application';
|
||||||
|
import { useSettingsStore } from '@/stores/settings';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ModalSettingsUpdate',
|
name: 'ModalSettingsUpdate',
|
||||||
setup () {
|
setup () {
|
||||||
const applicationStore = useApplicationStore();
|
const applicationStore = useApplicationStore();
|
||||||
|
const settingsStore = useSettingsStore();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
updateStatus,
|
updateStatus,
|
||||||
getDownloadProgress
|
getDownloadProgress
|
||||||
} = storeToRefs(applicationStore);
|
} = storeToRefs(applicationStore);
|
||||||
|
const { allowPrerelease } = storeToRefs(settingsStore);
|
||||||
|
|
||||||
|
const { changeAllowPrerelease } = settingsStore;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
updateStatus,
|
updateStatus,
|
||||||
downloadPercentage: getDownloadProgress
|
downloadPercentage: getDownloadProgress,
|
||||||
|
allowPrerelease,
|
||||||
|
changeAllowPrerelease
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
allowPrerelease: 'settings/getAllowPrerelease'
|
|
||||||
}),
|
|
||||||
updateMessage () {
|
updateMessage () {
|
||||||
switch (this.updateStatus) {
|
switch (this.updateStatus) {
|
||||||
case 'noupdate':
|
case 'noupdate':
|
||||||
@ -98,9 +102,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
changeAllowPrerelease: 'settings/changeAllowPrerelease'
|
|
||||||
}),
|
|
||||||
openOutside (link) {
|
openOutside (link) {
|
||||||
shell.openExternal(link);
|
shell.openExternal(link);
|
||||||
},
|
},
|
||||||
|
@ -12,9 +12,9 @@
|
|||||||
import * as ace from 'ace-builds';
|
import * as ace from 'ace-builds';
|
||||||
import 'ace-builds/webpack-resolver';
|
import 'ace-builds/webpack-resolver';
|
||||||
import '../libs/ext-language_tools';
|
import '../libs/ext-language_tools';
|
||||||
import { mapGetters } from 'vuex';
|
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { useApplicationStore } from '@/stores/application';
|
import { useApplicationStore } from '@/stores/application';
|
||||||
|
import { useSettingsStore } from '@/stores/settings';
|
||||||
import Tables from '@/ipc-api/Tables';
|
import Tables from '@/ipc-api/Tables';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -32,14 +32,26 @@ export default {
|
|||||||
setup () {
|
setup () {
|
||||||
const editor = null;
|
const editor = null;
|
||||||
const applicationStore = useApplicationStore();
|
const applicationStore = useApplicationStore();
|
||||||
|
const settingsStore = useSettingsStore();
|
||||||
|
|
||||||
const { setBaseCompleters } = applicationStore;
|
const { setBaseCompleters } = applicationStore;
|
||||||
|
|
||||||
const { baseCompleter } = storeToRefs(applicationStore);
|
const { baseCompleter } = storeToRefs(applicationStore);
|
||||||
|
const {
|
||||||
|
editorTheme,
|
||||||
|
editorFontSize,
|
||||||
|
autoComplete,
|
||||||
|
lineWrap
|
||||||
|
} = storeToRefs(settingsStore);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
editor,
|
editor,
|
||||||
|
|
||||||
baseCompleter,
|
baseCompleter,
|
||||||
setBaseCompleters
|
setBaseCompleters,
|
||||||
|
editorTheme,
|
||||||
|
editorFontSize,
|
||||||
|
autoComplete,
|
||||||
|
lineWrap
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
@ -52,12 +64,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
editorTheme: 'settings/getEditorTheme',
|
|
||||||
editorFontSize: 'settings/getEditorFontSize',
|
|
||||||
autoComplete: 'settings/getAutoComplete',
|
|
||||||
lineWrap: 'settings/getLineWrap'
|
|
||||||
}),
|
|
||||||
tables () {
|
tables () {
|
||||||
return this.workspace
|
return this.workspace
|
||||||
? this.workspace.structure.filter(schema => schema.name === this.schema)
|
? this.workspace.structure.filter(schema => schema.name === this.schema)
|
||||||
|
@ -30,10 +30,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapActions, mapGetters } from 'vuex';
|
|
||||||
import { uidGen } from 'common/libs/uidGen';
|
import { uidGen } from 'common/libs/uidGen';
|
||||||
|
import { useConnectionsStore } from '@/stores/connections';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import BaseContextMenu from '@/components/BaseContextMenu';
|
import BaseContextMenu from '@/components/BaseContextMenu';
|
||||||
import ConfirmModal from '@/components/BaseConfirmModal';
|
import ConfirmModal from '@/components/BaseConfirmModal';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'SettingBarContext',
|
name: 'SettingBarContext',
|
||||||
@ -46,6 +48,25 @@ export default {
|
|||||||
contextConnection: Object
|
contextConnection: Object
|
||||||
},
|
},
|
||||||
emits: ['close-context'],
|
emits: ['close-context'],
|
||||||
|
setup () {
|
||||||
|
const {
|
||||||
|
getConnectionName,
|
||||||
|
addConnection,
|
||||||
|
deleteConnection
|
||||||
|
} = useConnectionsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const { selectWorkspace } = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
getConnectionName,
|
||||||
|
addConnection,
|
||||||
|
deleteConnection,
|
||||||
|
selectedWorkspace,
|
||||||
|
selectWorkspace
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
isConfirmModal: false,
|
isConfirmModal: false,
|
||||||
@ -53,20 +74,11 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
getConnectionName: 'connections/getConnectionName',
|
|
||||||
selectedWorkspace: 'workspaces/getSelected'
|
|
||||||
}),
|
|
||||||
connectionName () {
|
connectionName () {
|
||||||
return this.getConnectionName(this.contextConnection.uid);
|
return this.getConnectionName(this.contextConnection.uid);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addConnection: 'connections/addConnection',
|
|
||||||
deleteConnection: 'connections/deleteConnection',
|
|
||||||
selectWorkspace: 'workspaces/selectWorkspace'
|
|
||||||
}),
|
|
||||||
confirmDeleteConnection () {
|
confirmDeleteConnection () {
|
||||||
if (this.selectedWorkspace === this.contextConnection.uid)
|
if (this.selectedWorkspace === this.contextConnection.uid)
|
||||||
this.selectWorkspace();
|
this.selectWorkspace();
|
||||||
@ -78,7 +90,7 @@ export default {
|
|||||||
connectionCopy = {
|
connectionCopy = {
|
||||||
...connectionCopy,
|
...connectionCopy,
|
||||||
uid: uidGen('C'),
|
uid: uidGen('C'),
|
||||||
name: connectionCopy.name ? `${connectionCopy.name}_copy` : ''
|
name: connectionCopy.name ? `${connectionCopy?.name}_copy` : ''
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addConnection(connectionCopy);
|
this.addConnection(connectionCopy);
|
||||||
|
@ -27,27 +27,30 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex';
|
|
||||||
import { useApplicationStore } from '@/stores/application';
|
import { useApplicationStore } from '@/stores/application';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
const { shell } = require('electron');
|
const { shell } = require('electron');
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TheFooter',
|
name: 'TheFooter',
|
||||||
setup () {
|
setup () {
|
||||||
const applicationStore = useApplicationStore();
|
const applicationStore = useApplicationStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: workspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
const { appVersion, showSettingModal } = applicationStore;
|
const { appVersion, showSettingModal } = applicationStore;
|
||||||
|
const { getWorkspace } = workspacesStore;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
appVersion,
|
appVersion,
|
||||||
showSettingModal
|
showSettingModal,
|
||||||
|
workspace,
|
||||||
|
getWorkspace
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
workspace: 'workspaces/getSelected',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
|
||||||
}),
|
|
||||||
version () {
|
version () {
|
||||||
return this.getWorkspace(this.workspace) ? this.getWorkspace(this.workspace).version : null;
|
return this.getWorkspace(this.workspace) ? this.getWorkspace(this.workspace).version : null;
|
||||||
},
|
},
|
||||||
|
@ -17,24 +17,37 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useSettingsStore } from '@/stores/settings';
|
||||||
import BaseNotification from '@/components/BaseNotification';
|
import BaseNotification from '@/components/BaseNotification';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TheNotificationsBoard',
|
name: 'TheNotificationsBoard',
|
||||||
components: {
|
components: {
|
||||||
BaseNotification
|
BaseNotification
|
||||||
},
|
},
|
||||||
|
setup () {
|
||||||
|
const notificationsStore = useNotificationsStore();
|
||||||
|
const settingsStore = useSettingsStore();
|
||||||
|
|
||||||
|
const { removeNotification } = notificationsStore;
|
||||||
|
|
||||||
|
const { notifications } = storeToRefs(notificationsStore);
|
||||||
|
const { notificationsTimeout } = storeToRefs(settingsStore);
|
||||||
|
|
||||||
|
return {
|
||||||
|
removeNotification,
|
||||||
|
notifications,
|
||||||
|
notificationsTimeout
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
timeouts: {}
|
timeouts: {}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
notifications: 'notifications/getNotifications',
|
|
||||||
notificationsTimeout: 'settings/getNotificationsTimeout'
|
|
||||||
}),
|
|
||||||
latestNotifications () {
|
latestNotifications () {
|
||||||
return this.notifications.slice(0, 10);
|
return this.notifications.slice(0, 10);
|
||||||
}
|
}
|
||||||
@ -51,9 +64,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
removeNotification: 'notifications/removeNotification'
|
|
||||||
}),
|
|
||||||
clearTimeouts () {
|
clearTimeouts () {
|
||||||
for (const uid in this.timeouts) {
|
for (const uid in this.timeouts) {
|
||||||
clearTimeout(this.timeouts[uid]);
|
clearTimeout(this.timeouts[uid]);
|
||||||
|
@ -29,10 +29,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapActions, mapGetters } from 'vuex';
|
import { storeToRefs } from 'pinia';
|
||||||
import { useApplicationStore } from '@/stores/application';
|
import { useApplicationStore } from '@/stores/application';
|
||||||
import ConfirmModal from '@/components/BaseConfirmModal';
|
import ConfirmModal from '@/components/BaseConfirmModal';
|
||||||
import TextEditor from '@/components/BaseTextEditor';
|
import TextEditor from '@/components/BaseTextEditor';
|
||||||
|
import { useScratchpadStore } from '@/stores/scratchpad';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TheScratchpad',
|
name: 'TheScratchpad',
|
||||||
@ -43,8 +44,16 @@ export default {
|
|||||||
emits: ['hide'],
|
emits: ['hide'],
|
||||||
setup () {
|
setup () {
|
||||||
const applicationStore = useApplicationStore();
|
const applicationStore = useApplicationStore();
|
||||||
|
const scratchpadStore = useScratchpadStore();
|
||||||
|
|
||||||
return { hideScratchpad: applicationStore.hideScratchpad };
|
const { notes } = storeToRefs(scratchpadStore);
|
||||||
|
const { changeNotes } = scratchpadStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
notes,
|
||||||
|
hideScratchpad: applicationStore.hideScratchpad,
|
||||||
|
changeNotes
|
||||||
|
};
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
@ -52,11 +61,6 @@ export default {
|
|||||||
debounceTimeout: null
|
debounceTimeout: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
...mapGetters({
|
|
||||||
notes: 'scratchpad/getNotes'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
watch: {
|
watch: {
|
||||||
localNotes () {
|
localNotes () {
|
||||||
clearTimeout(this.debounceTimeout);
|
clearTimeout(this.debounceTimeout);
|
||||||
@ -70,9 +74,6 @@ export default {
|
|||||||
this.localNotes = this.notes;
|
this.localNotes = this.notes;
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
changeNotes: 'scratchpad/changeNotes'
|
|
||||||
}),
|
|
||||||
hideModal () {
|
hideModal () {
|
||||||
this.$emit('hide');
|
this.$emit('hide');
|
||||||
}
|
}
|
||||||
|
@ -56,9 +56,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapActions, mapGetters } from 'vuex';
|
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { useApplicationStore } from '@/stores/application';
|
import { useApplicationStore } from '@/stores/application';
|
||||||
|
import { useConnectionsStore } from '@/stores/connections';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import Draggable from 'vuedraggable';
|
import Draggable from 'vuedraggable';
|
||||||
import SettingBarContext from '@/components/SettingBarContext';
|
import SettingBarContext from '@/components/SettingBarContext';
|
||||||
|
|
||||||
@ -70,14 +71,28 @@ export default {
|
|||||||
},
|
},
|
||||||
setup () {
|
setup () {
|
||||||
const applicationStore = useApplicationStore();
|
const applicationStore = useApplicationStore();
|
||||||
|
const connectionsStore = useConnectionsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
const { updateStatus } = storeToRefs(applicationStore);
|
const { updateStatus } = storeToRefs(applicationStore);
|
||||||
|
const { connections: getConnections } = storeToRefs(connectionsStore);
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
const { showSettingModal, showScratchpad } = applicationStore;
|
const { showSettingModal, showScratchpad } = applicationStore;
|
||||||
|
const { getConnectionName, updateConnections } = connectionsStore;
|
||||||
|
const { getWorkspace, selectWorkspace } = workspacesStore;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
applicationStore,
|
applicationStore,
|
||||||
updateStatus,
|
updateStatus,
|
||||||
showSettingModal,
|
showSettingModal,
|
||||||
showScratchpad
|
showScratchpad,
|
||||||
|
getConnections,
|
||||||
|
getConnectionName,
|
||||||
|
updateConnections,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace,
|
||||||
|
selectWorkspace
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
@ -91,12 +106,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
getConnections: 'connections/getConnections',
|
|
||||||
getConnectionName: 'connections/getConnectionName',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace',
|
|
||||||
selectedWorkspace: 'workspaces/getSelected'
|
|
||||||
}),
|
|
||||||
connections: {
|
connections: {
|
||||||
get () {
|
get () {
|
||||||
return this.getConnections;
|
return this.getConnections;
|
||||||
@ -110,10 +119,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
updateConnections: 'connections/updateConnections',
|
|
||||||
selectWorkspace: 'workspaces/selectWorkspace'
|
|
||||||
}),
|
|
||||||
contextMenu (event, connection) {
|
contextMenu (event, connection) {
|
||||||
this.contextEvent = event;
|
this.contextEvent = event;
|
||||||
this.contextConnection = connection;
|
this.contextConnection = connection;
|
||||||
|
@ -55,10 +55,26 @@
|
|||||||
<script>
|
<script>
|
||||||
import { ipcRenderer } from 'electron';
|
import { ipcRenderer } from 'electron';
|
||||||
import { getCurrentWindow } from '@electron/remote';
|
import { getCurrentWindow } from '@electron/remote';
|
||||||
import { mapGetters } from 'vuex';
|
import { useConnectionsStore } from '@/stores/connections';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TheTitleBar',
|
name: 'TheTitleBar',
|
||||||
|
setup () {
|
||||||
|
const { getConnectionName } = useConnectionsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const { getWorkspace } = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
getConnectionName,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
w: getCurrentWindow(),
|
w: getCurrentWindow(),
|
||||||
@ -68,11 +84,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
getConnectionName: 'connections/getConnectionName',
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
|
||||||
}),
|
|
||||||
windowTitle () {
|
windowTitle () {
|
||||||
if (!this.selectedWorkspace) return '';
|
if (!this.selectedWorkspace) return '';
|
||||||
if (this.selectedWorkspace === 'NEW') return this.$t('message.createNewConnection');
|
if (this.selectedWorkspace === 'NEW') return this.$t('message.createNewConnection');
|
||||||
|
@ -469,9 +469,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { storeToRefs } from 'pinia';
|
||||||
import Draggable from 'vuedraggable';
|
import Draggable from 'vuedraggable';
|
||||||
import Connection from '@/ipc-api/Connection';
|
import Connection from '@/ipc-api/Connection';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
|
|
||||||
import WorkspaceEmptyState from '@/components/WorkspaceEmptyState';
|
import WorkspaceEmptyState from '@/components/WorkspaceEmptyState';
|
||||||
import WorkspaceExploreBar from '@/components/WorkspaceExploreBar';
|
import WorkspaceExploreBar from '@/components/WorkspaceExploreBar';
|
||||||
import WorkspaceEditConnectionPanel from '@/components/WorkspaceEditConnectionPanel';
|
import WorkspaceEditConnectionPanel from '@/components/WorkspaceEditConnectionPanel';
|
||||||
@ -525,6 +527,34 @@ export default {
|
|||||||
props: {
|
props: {
|
||||||
connection: Object
|
connection: Object
|
||||||
},
|
},
|
||||||
|
setup () {
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const {
|
||||||
|
getWorkspace,
|
||||||
|
addWorkspace,
|
||||||
|
connectWorkspace,
|
||||||
|
removeConnected,
|
||||||
|
selectTab,
|
||||||
|
newTab,
|
||||||
|
removeTab,
|
||||||
|
updateTabs
|
||||||
|
} = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace,
|
||||||
|
addWorkspace,
|
||||||
|
connectWorkspace,
|
||||||
|
removeConnected,
|
||||||
|
selectTab,
|
||||||
|
newTab,
|
||||||
|
removeTab,
|
||||||
|
updateTabs
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
hasWheelEvent: false,
|
hasWheelEvent: false,
|
||||||
@ -533,10 +563,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
|
||||||
}),
|
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.connection.uid);
|
return this.getWorkspace(this.connection.uid);
|
||||||
},
|
},
|
||||||
@ -604,15 +630,6 @@ export default {
|
|||||||
window.removeEventListener('keydown', this.onKey);
|
window.removeEventListener('keydown', this.onKey);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addWorkspace: 'workspaces/addWorkspace',
|
|
||||||
connectWorkspace: 'workspaces/connectWorkspace',
|
|
||||||
removeConnected: 'workspaces/removeConnected',
|
|
||||||
selectTab: 'workspaces/selectTab',
|
|
||||||
newTab: 'workspaces/newTab',
|
|
||||||
removeTab: 'workspaces/removeTab',
|
|
||||||
updateTabs: 'workspaces/updateTabs'
|
|
||||||
}),
|
|
||||||
addQueryTab () {
|
addQueryTab () {
|
||||||
this.newTab({ uid: this.connection.uid, type: 'query' });
|
this.newTab({ uid: this.connection.uid, type: 'query' });
|
||||||
},
|
},
|
||||||
|
@ -396,10 +396,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapActions } from 'vuex';
|
|
||||||
import customizations from 'common/customizations';
|
import customizations from 'common/customizations';
|
||||||
import Connection from '@/ipc-api/Connection';
|
import Connection from '@/ipc-api/Connection';
|
||||||
import { uidGen } from 'common/libs/uidGen';
|
import { uidGen } from 'common/libs/uidGen';
|
||||||
|
import { useConnectionsStore } from '@/stores/connections';
|
||||||
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import ModalAskCredentials from '@/components/ModalAskCredentials';
|
import ModalAskCredentials from '@/components/ModalAskCredentials';
|
||||||
import BaseUploadInput from '@/components/BaseUploadInput';
|
import BaseUploadInput from '@/components/BaseUploadInput';
|
||||||
|
|
||||||
@ -409,6 +411,20 @@ export default {
|
|||||||
ModalAskCredentials,
|
ModalAskCredentials,
|
||||||
BaseUploadInput
|
BaseUploadInput
|
||||||
},
|
},
|
||||||
|
setup () {
|
||||||
|
const { addConnection } = useConnectionsStore();
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { connectWorkspace, selectWorkspace } = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addConnection,
|
||||||
|
addNotification,
|
||||||
|
connectWorkspace,
|
||||||
|
selectWorkspace
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
clients: [
|
clients: [
|
||||||
@ -472,12 +488,6 @@ export default {
|
|||||||
}, 20);
|
}, 20);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addConnection: 'connections/addConnection',
|
|
||||||
connectWorkspace: 'workspaces/connectWorkspace',
|
|
||||||
addNotification: 'notifications/addNotification',
|
|
||||||
selectWorkspace: 'workspaces/selectWorkspace'
|
|
||||||
}),
|
|
||||||
setDefaults () {
|
setDefaults () {
|
||||||
this.connection.user = this.customizations.defaultUser;
|
this.connection.user = this.customizations.defaultUser;
|
||||||
this.connection.port = this.customizations.defaultPort;
|
this.connection.port = this.customizations.defaultPort;
|
||||||
|
@ -394,8 +394,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapActions } from 'vuex';
|
|
||||||
import customizations from 'common/customizations';
|
import customizations from 'common/customizations';
|
||||||
|
import { useConnectionsStore } from '@/stores/connections';
|
||||||
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import Connection from '@/ipc-api/Connection';
|
import Connection from '@/ipc-api/Connection';
|
||||||
import ModalAskCredentials from '@/components/ModalAskCredentials';
|
import ModalAskCredentials from '@/components/ModalAskCredentials';
|
||||||
import BaseUploadInput from '@/components/BaseUploadInput';
|
import BaseUploadInput from '@/components/BaseUploadInput';
|
||||||
@ -409,6 +411,17 @@ export default {
|
|||||||
props: {
|
props: {
|
||||||
connection: Object
|
connection: Object
|
||||||
},
|
},
|
||||||
|
setup () {
|
||||||
|
const { editConnection } = useConnectionsStore();
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const { connectWorkspace } = useWorkspacesStore();
|
||||||
|
|
||||||
|
return {
|
||||||
|
editConnection,
|
||||||
|
addNotification,
|
||||||
|
connectWorkspace
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
clients: [
|
clients: [
|
||||||
@ -444,11 +457,6 @@ export default {
|
|||||||
this.localConnection = JSON.parse(JSON.stringify(this.connection));
|
this.localConnection = JSON.parse(JSON.stringify(this.connection));
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
editConnection: 'connections/editConnection',
|
|
||||||
connectWorkspace: 'workspaces/connectWorkspace',
|
|
||||||
addNotification: 'notifications/addNotification'
|
|
||||||
}),
|
|
||||||
async startConnection () {
|
async startConnection () {
|
||||||
await this.saveConnection();
|
await this.saveConnection();
|
||||||
this.isConnecting = true;
|
this.isConnecting = true;
|
||||||
|
@ -25,27 +25,35 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { useSettingsStore } from '@/stores/settings';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceEmptyState',
|
name: 'WorkspaceEmptyState',
|
||||||
emits: ['new-tab'],
|
emits: ['new-tab'],
|
||||||
|
setup () {
|
||||||
|
const settingsStore = useSettingsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { applicationTheme } = storeToRefs(settingsStore);
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const { getWorkspace, changeBreadcrumbs } = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
applicationTheme,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace,
|
||||||
|
changeBreadcrumbs
|
||||||
|
};
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
applicationTheme: 'settings/getApplicationTheme',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace',
|
|
||||||
selectedWorkspace: 'workspaces/getSelected'
|
|
||||||
}),
|
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.selectedWorkspace);
|
return this.getWorkspace(this.selectedWorkspace);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
this.changeBreadcrumbs({ schema: this.workspace.breadcrumbs.schema });
|
this.changeBreadcrumbs({ schema: this.workspace.breadcrumbs.schema });
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
...mapActions({
|
|
||||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -115,7 +115,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { useConnectionsStore } from '@/stores/connections';
|
||||||
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useSettingsStore } from '@/stores/settings';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
|
|
||||||
import Tables from '@/ipc-api/Tables';
|
import Tables from '@/ipc-api/Tables';
|
||||||
import Views from '@/ipc-api/Views';
|
import Views from '@/ipc-api/Views';
|
||||||
@ -128,6 +131,7 @@ import TableContext from '@/components/WorkspaceExploreBarTableContext';
|
|||||||
import MiscContext from '@/components/WorkspaceExploreBarMiscContext';
|
import MiscContext from '@/components/WorkspaceExploreBarMiscContext';
|
||||||
import MiscFolderContext from '@/components/WorkspaceExploreBarMiscFolderContext';
|
import MiscFolderContext from '@/components/WorkspaceExploreBarMiscFolderContext';
|
||||||
import ModalNewSchema from '@/components/ModalNewSchema';
|
import ModalNewSchema from '@/components/ModalNewSchema';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceExploreBar',
|
name: 'WorkspaceExploreBar',
|
||||||
@ -143,6 +147,45 @@ export default {
|
|||||||
connection: Object,
|
connection: Object,
|
||||||
isSelected: Boolean
|
isSelected: Boolean
|
||||||
},
|
},
|
||||||
|
setup () {
|
||||||
|
const { getConnectionName } = useConnectionsStore();
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const settingsStore = useSettingsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { explorebarSize } = storeToRefs(settingsStore);
|
||||||
|
|
||||||
|
const { changeExplorebarSize } = settingsStore;
|
||||||
|
const {
|
||||||
|
getWorkspace,
|
||||||
|
disconnectWorkspace,
|
||||||
|
refreshStructure,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
selectTab,
|
||||||
|
newTab,
|
||||||
|
removeTabs,
|
||||||
|
setSearchTerm,
|
||||||
|
addLoadingElement,
|
||||||
|
removeLoadingElement
|
||||||
|
} = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
getConnectionName,
|
||||||
|
addNotification,
|
||||||
|
explorebarSize,
|
||||||
|
changeExplorebarSize,
|
||||||
|
getWorkspace,
|
||||||
|
disconnectWorkspace,
|
||||||
|
refreshStructure,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
selectTab,
|
||||||
|
newTab,
|
||||||
|
removeTabs,
|
||||||
|
setSearchTerm,
|
||||||
|
addLoadingElement,
|
||||||
|
removeLoadingElement
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
isRefreshing: false,
|
isRefreshing: false,
|
||||||
@ -174,11 +217,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
getWorkspace: 'workspaces/getWorkspace',
|
|
||||||
explorebarSize: 'settings/getExplorebarSize',
|
|
||||||
getConnectionName: 'connections/getConnectionName'
|
|
||||||
}),
|
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.connection.uid);
|
return this.getWorkspace(this.connection.uid);
|
||||||
},
|
},
|
||||||
@ -222,19 +260,6 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
disconnectWorkspace: 'workspaces/removeConnected',
|
|
||||||
refreshStructure: 'workspaces/refreshStructure',
|
|
||||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs',
|
|
||||||
selectTab: 'workspaces/selectTab',
|
|
||||||
newTab: 'workspaces/newTab',
|
|
||||||
removeTabs: 'workspaces/removeTabs',
|
|
||||||
setSearchTerm: 'workspaces/setSearchTerm',
|
|
||||||
addNotification: 'notifications/addNotification',
|
|
||||||
changeExplorebarSize: 'settings/changeExplorebarSize',
|
|
||||||
addLoadingElement: 'workspaces/addLoadingElement',
|
|
||||||
removeLoadingElement: 'workspaces/removeLoadingElement'
|
|
||||||
}),
|
|
||||||
async refresh () {
|
async refresh () {
|
||||||
if (!this.isRefreshing) {
|
if (!this.isRefreshing) {
|
||||||
this.isRefreshing = true;
|
this.isRefreshing = true;
|
||||||
|
@ -65,7 +65,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import BaseContextMenu from '@/components/BaseContextMenu';
|
import BaseContextMenu from '@/components/BaseContextMenu';
|
||||||
import ConfirmModal from '@/components/BaseConfirmModal';
|
import ConfirmModal from '@/components/BaseConfirmModal';
|
||||||
import ModalAskParameters from '@/components/ModalAskParameters';
|
import ModalAskParameters from '@/components/ModalAskParameters';
|
||||||
@ -73,6 +74,7 @@ import Triggers from '@/ipc-api/Triggers';
|
|||||||
import Routines from '@/ipc-api/Routines';
|
import Routines from '@/ipc-api/Routines';
|
||||||
import Functions from '@/ipc-api/Functions';
|
import Functions from '@/ipc-api/Functions';
|
||||||
import Schedulers from '@/ipc-api/Schedulers';
|
import Schedulers from '@/ipc-api/Schedulers';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceExploreBarMiscContext',
|
name: 'WorkspaceExploreBarMiscContext',
|
||||||
@ -87,6 +89,32 @@ export default {
|
|||||||
selectedSchema: String
|
selectedSchema: String
|
||||||
},
|
},
|
||||||
emits: ['close-context', 'reload'],
|
emits: ['close-context', 'reload'],
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const {
|
||||||
|
getWorkspace,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
addLoadingElement,
|
||||||
|
removeLoadingElement,
|
||||||
|
removeTabs,
|
||||||
|
newTab
|
||||||
|
} = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
addLoadingElement,
|
||||||
|
removeLoadingElement,
|
||||||
|
removeTabs,
|
||||||
|
newTab
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
isDeleteModal: false,
|
isDeleteModal: false,
|
||||||
@ -96,10 +124,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
|
||||||
}),
|
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.selectedWorkspace);
|
return this.getWorkspace(this.selectedWorkspace);
|
||||||
},
|
},
|
||||||
@ -123,14 +147,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification',
|
|
||||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs',
|
|
||||||
addLoadingElement: 'workspaces/addLoadingElement',
|
|
||||||
removeLoadingElement: 'workspaces/removeLoadingElement',
|
|
||||||
removeTabs: 'workspaces/removeTabs',
|
|
||||||
newTab: 'workspaces/newTab'
|
|
||||||
}),
|
|
||||||
showDeleteModal () {
|
showDeleteModal () {
|
||||||
this.isDeleteModal = true;
|
this.isDeleteModal = true;
|
||||||
},
|
},
|
||||||
|
@ -42,8 +42,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import BaseContextMenu from '@/components/BaseContextMenu';
|
import BaseContextMenu from '@/components/BaseContextMenu';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceExploreBarMiscContext',
|
name: 'WorkspaceExploreBarMiscContext',
|
||||||
@ -55,26 +57,40 @@ export default {
|
|||||||
selectedMisc: String,
|
selectedMisc: String,
|
||||||
selectedSchema: String
|
selectedSchema: String
|
||||||
},
|
},
|
||||||
emits: ['open-create-trigger-tab', 'open-create-routine-tab', 'open-create-function-tab', 'open-create-trigger-function-tab', 'open-create-scheduler-tab', 'close-context'],
|
emits: [
|
||||||
|
'open-create-trigger-tab',
|
||||||
|
'open-create-routine-tab',
|
||||||
|
'open-create-function-tab',
|
||||||
|
'open-create-trigger-function-tab',
|
||||||
|
'open-create-scheduler-tab',
|
||||||
|
'close-context'
|
||||||
|
],
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const { getWorkspace, changeBreadcrumbs } = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace,
|
||||||
|
changeBreadcrumbs
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
localElement: {}
|
localElement: {}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
|
||||||
}),
|
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.selectedWorkspace);
|
return this.getWorkspace(this.selectedWorkspace);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification',
|
|
||||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs'
|
|
||||||
}),
|
|
||||||
showDeleteModal () {
|
showDeleteModal () {
|
||||||
this.isDeleteModal = true;
|
this.isDeleteModal = true;
|
||||||
},
|
},
|
||||||
|
@ -243,8 +243,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapActions, mapGetters } from 'vuex';
|
import { useSettingsStore } from '@/stores/settings';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import { formatBytes } from 'common/libs/formatBytes';
|
import { formatBytes } from 'common/libs/formatBytes';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceExploreBarSchema',
|
name: 'WorkspaceExploreBarSchema',
|
||||||
@ -252,19 +254,45 @@ export default {
|
|||||||
database: Object,
|
database: Object,
|
||||||
connection: Object
|
connection: Object
|
||||||
},
|
},
|
||||||
emits: ['show-schema-context', 'show-table-context', 'show-misc-context', 'show-misc-folder-context'],
|
emits: [
|
||||||
|
'show-schema-context',
|
||||||
|
'show-table-context',
|
||||||
|
'show-misc-context',
|
||||||
|
'show-misc-folder-context'
|
||||||
|
],
|
||||||
|
setup () {
|
||||||
|
const settingsStore = useSettingsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { applicationTheme } = storeToRefs(settingsStore);
|
||||||
|
|
||||||
|
const {
|
||||||
|
getLoadedSchemas,
|
||||||
|
getWorkspace,
|
||||||
|
getSearchTerm,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
addLoadedSchema,
|
||||||
|
newTab,
|
||||||
|
refreshSchema
|
||||||
|
} = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
applicationTheme,
|
||||||
|
getLoadedSchemas,
|
||||||
|
getWorkspace,
|
||||||
|
getSearchTerm,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
addLoadedSchema,
|
||||||
|
newTab,
|
||||||
|
refreshSchema
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
isLoading: false
|
isLoading: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
getLoadedSchemas: 'workspaces/getLoadedSchemas',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace',
|
|
||||||
getSearchTerm: 'workspaces/getSearchTerm',
|
|
||||||
applicationTheme: 'settings/getApplicationTheme'
|
|
||||||
}),
|
|
||||||
searchTerm () {
|
searchTerm () {
|
||||||
return this.getSearchTerm(this.connection.uid);
|
return this.getSearchTerm(this.connection.uid);
|
||||||
},
|
},
|
||||||
@ -332,12 +360,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs',
|
|
||||||
addLoadedSchema: 'workspaces/addLoadedSchema',
|
|
||||||
newTab: 'workspaces/newTab',
|
|
||||||
refreshSchema: 'workspaces/refreshSchema'
|
|
||||||
}),
|
|
||||||
formatBytes,
|
formatBytes,
|
||||||
async selectSchema (schema) {
|
async selectSchema (schema) {
|
||||||
if (!this.loadedSchemas.has(schema) && !this.isLoading) {
|
if (!this.loadedSchemas.has(schema) && !this.isLoading) {
|
||||||
|
@ -124,7 +124,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import BaseContextMenu from '@/components/BaseContextMenu';
|
import BaseContextMenu from '@/components/BaseContextMenu';
|
||||||
import ConfirmModal from '@/components/BaseConfirmModal';
|
import ConfirmModal from '@/components/BaseConfirmModal';
|
||||||
import ModalEditSchema from '@/components/ModalEditSchema';
|
import ModalEditSchema from '@/components/ModalEditSchema';
|
||||||
@ -132,6 +133,7 @@ import ModalExportSchema from '@/components/ModalExportSchema';
|
|||||||
import ModalImportSchema from '@/components/ModalImportSchema';
|
import ModalImportSchema from '@/components/ModalImportSchema';
|
||||||
import Schema from '@/ipc-api/Schema';
|
import Schema from '@/ipc-api/Schema';
|
||||||
import Application from '@/ipc-api/Application';
|
import Application from '@/ipc-api/Application';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceExploreBarSchemaContext',
|
name: 'WorkspaceExploreBarSchemaContext',
|
||||||
@ -157,6 +159,24 @@ export default {
|
|||||||
'close-context',
|
'close-context',
|
||||||
'reload'
|
'reload'
|
||||||
],
|
],
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const {
|
||||||
|
getWorkspace,
|
||||||
|
changeBreadcrumbs
|
||||||
|
} = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace,
|
||||||
|
changeBreadcrumbs
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
isDeleteModal: false,
|
isDeleteModal: false,
|
||||||
@ -166,19 +186,11 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
|
||||||
}),
|
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.selectedWorkspace);
|
return this.getWorkspace(this.selectedWorkspace);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification',
|
|
||||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs'
|
|
||||||
}),
|
|
||||||
openCreateTableTab () {
|
openCreateTableTab () {
|
||||||
this.$emit('open-create-table-tab');
|
this.$emit('open-create-table-tab');
|
||||||
},
|
},
|
||||||
|
@ -72,10 +72,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import BaseContextMenu from '@/components/BaseContextMenu';
|
import BaseContextMenu from '@/components/BaseContextMenu';
|
||||||
import ConfirmModal from '@/components/BaseConfirmModal';
|
import ConfirmModal from '@/components/BaseConfirmModal';
|
||||||
import Tables from '@/ipc-api/Tables';
|
import Tables from '@/ipc-api/Tables';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceExploreBarTableContext',
|
name: 'WorkspaceExploreBarTableContext',
|
||||||
@ -89,6 +91,32 @@ export default {
|
|||||||
selectedSchema: String
|
selectedSchema: String
|
||||||
},
|
},
|
||||||
emits: ['close-context', 'duplicate-table', 'reload', 'delete-table'],
|
emits: ['close-context', 'duplicate-table', 'reload', 'delete-table'],
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const {
|
||||||
|
getWorkspace,
|
||||||
|
newTab,
|
||||||
|
removeTabs,
|
||||||
|
addLoadingElement,
|
||||||
|
removeLoadingElement,
|
||||||
|
changeBreadcrumbs
|
||||||
|
} = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
getWorkspace,
|
||||||
|
newTab,
|
||||||
|
removeTabs,
|
||||||
|
addLoadingElement,
|
||||||
|
removeLoadingElement,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
selectedWorkspace
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
isDeleteModal: false,
|
isDeleteModal: false,
|
||||||
@ -96,10 +124,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
|
||||||
}),
|
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.selectedWorkspace);
|
return this.getWorkspace(this.selectedWorkspace);
|
||||||
},
|
},
|
||||||
@ -108,14 +132,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification',
|
|
||||||
newTab: 'workspaces/newTab',
|
|
||||||
removeTabs: 'workspaces/removeTabs',
|
|
||||||
addLoadingElement: 'workspaces/addLoadingElement',
|
|
||||||
removeLoadingElement: 'workspaces/removeLoadingElement',
|
|
||||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs'
|
|
||||||
}),
|
|
||||||
showDeleteModal () {
|
showDeleteModal () {
|
||||||
this.isDeleteModal = true;
|
this.isDeleteModal = true;
|
||||||
},
|
},
|
||||||
|
@ -203,11 +203,13 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import BaseLoader from '@/components/BaseLoader';
|
import BaseLoader from '@/components/BaseLoader';
|
||||||
import QueryEditor from '@/components/QueryEditor';
|
import QueryEditor from '@/components/QueryEditor';
|
||||||
import WorkspaceTabPropsFunctionParamsModal from '@/components/WorkspaceTabPropsFunctionParamsModal';
|
import WorkspaceTabPropsFunctionParamsModal from '@/components/WorkspaceTabPropsFunctionParamsModal';
|
||||||
import Functions from '@/ipc-api/Functions';
|
import Functions from '@/ipc-api/Functions';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceTabNewFunction',
|
name: 'WorkspaceTabNewFunction',
|
||||||
@ -222,6 +224,34 @@ export default {
|
|||||||
isSelected: Boolean,
|
isSelected: Boolean,
|
||||||
schema: String
|
schema: String
|
||||||
},
|
},
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const {
|
||||||
|
getWorkspace,
|
||||||
|
refreshStructure,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
setUnsavedChanges,
|
||||||
|
newTab,
|
||||||
|
removeTab,
|
||||||
|
renameTabs
|
||||||
|
} = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace,
|
||||||
|
refreshStructure,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
setUnsavedChanges,
|
||||||
|
newTab,
|
||||||
|
removeTab,
|
||||||
|
renameTabs
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
@ -235,10 +265,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
|
||||||
}),
|
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.connection.uid);
|
return this.getWorkspace(this.connection.uid);
|
||||||
},
|
},
|
||||||
@ -309,15 +335,6 @@ export default {
|
|||||||
window.removeEventListener('keydown', this.onKey);
|
window.removeEventListener('keydown', this.onKey);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification',
|
|
||||||
refreshStructure: 'workspaces/refreshStructure',
|
|
||||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs',
|
|
||||||
setUnsavedChanges: 'workspaces/setUnsavedChanges',
|
|
||||||
newTab: 'workspaces/newTab',
|
|
||||||
removeTab: 'workspaces/removeTab',
|
|
||||||
renameTabs: 'workspaces/renameTabs'
|
|
||||||
}),
|
|
||||||
async saveChanges () {
|
async saveChanges () {
|
||||||
if (this.isSaving) return;
|
if (this.isSaving) return;
|
||||||
this.isSaving = true;
|
this.isSaving = true;
|
||||||
|
@ -163,11 +163,13 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import QueryEditor from '@/components/QueryEditor';
|
import QueryEditor from '@/components/QueryEditor';
|
||||||
import BaseLoader from '@/components/BaseLoader';
|
import BaseLoader from '@/components/BaseLoader';
|
||||||
import WorkspaceTabPropsRoutineParamsModal from '@/components/WorkspaceTabPropsRoutineParamsModal';
|
import WorkspaceTabPropsRoutineParamsModal from '@/components/WorkspaceTabPropsRoutineParamsModal';
|
||||||
import Routines from '@/ipc-api/Routines';
|
import Routines from '@/ipc-api/Routines';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceTabNewRoutine',
|
name: 'WorkspaceTabNewRoutine',
|
||||||
@ -182,6 +184,34 @@ export default {
|
|||||||
isSelected: Boolean,
|
isSelected: Boolean,
|
||||||
schema: String
|
schema: String
|
||||||
},
|
},
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const {
|
||||||
|
getWorkspace,
|
||||||
|
refreshStructure,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
setUnsavedChanges,
|
||||||
|
newTab,
|
||||||
|
removeTab,
|
||||||
|
renameTabs
|
||||||
|
} = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace,
|
||||||
|
refreshStructure,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
setUnsavedChanges,
|
||||||
|
newTab,
|
||||||
|
removeTab,
|
||||||
|
renameTabs
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
@ -195,10 +225,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
|
||||||
}),
|
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.connection.uid);
|
return this.getWorkspace(this.connection.uid);
|
||||||
},
|
},
|
||||||
@ -268,15 +294,6 @@ export default {
|
|||||||
window.removeEventListener('keydown', this.onKey);
|
window.removeEventListener('keydown', this.onKey);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification',
|
|
||||||
refreshStructure: 'workspaces/refreshStructure',
|
|
||||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs',
|
|
||||||
setUnsavedChanges: 'workspaces/setUnsavedChanges',
|
|
||||||
newTab: 'workspaces/newTab',
|
|
||||||
removeTab: 'workspaces/removeTab',
|
|
||||||
renameTabs: 'workspaces/renameTabs'
|
|
||||||
}),
|
|
||||||
async saveChanges () {
|
async saveChanges () {
|
||||||
if (this.isSaving) return;
|
if (this.isSaving) return;
|
||||||
this.isSaving = true;
|
this.isSaving = true;
|
||||||
|
@ -142,7 +142,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import BaseLoader from '@/components/BaseLoader';
|
import BaseLoader from '@/components/BaseLoader';
|
||||||
import QueryEditor from '@/components/QueryEditor';
|
import QueryEditor from '@/components/QueryEditor';
|
||||||
import WorkspaceTabPropsSchedulerTimingModal from '@/components/WorkspaceTabPropsSchedulerTimingModal';
|
import WorkspaceTabPropsSchedulerTimingModal from '@/components/WorkspaceTabPropsSchedulerTimingModal';
|
||||||
@ -161,6 +162,34 @@ export default {
|
|||||||
isSelected: Boolean,
|
isSelected: Boolean,
|
||||||
schema: String
|
schema: String
|
||||||
},
|
},
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const {
|
||||||
|
getWorkspace,
|
||||||
|
refreshStructure,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
setUnsavedChanges,
|
||||||
|
newTab,
|
||||||
|
removeTab,
|
||||||
|
renameTabs
|
||||||
|
} = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace,
|
||||||
|
refreshStructure,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
setUnsavedChanges,
|
||||||
|
newTab,
|
||||||
|
removeTab,
|
||||||
|
renameTabs
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
@ -174,10 +203,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
|
||||||
}),
|
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.connection.uid);
|
return this.getWorkspace(this.connection.uid);
|
||||||
},
|
},
|
||||||
@ -244,15 +269,6 @@ export default {
|
|||||||
window.removeEventListener('keydown', this.onKey);
|
window.removeEventListener('keydown', this.onKey);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification',
|
|
||||||
refreshStructure: 'workspaces/refreshStructure',
|
|
||||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs',
|
|
||||||
setUnsavedChanges: 'workspaces/setUnsavedChanges',
|
|
||||||
newTab: 'workspaces/newTab',
|
|
||||||
removeTab: 'workspaces/removeTab',
|
|
||||||
renameTabs: 'workspaces/renameTabs'
|
|
||||||
}),
|
|
||||||
async saveChanges () {
|
async saveChanges () {
|
||||||
if (this.isSaving) return;
|
if (this.isSaving) return;
|
||||||
this.isSaving = true;
|
this.isSaving = true;
|
||||||
|
@ -165,7 +165,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import { uidGen } from 'common/libs/uidGen';
|
import { uidGen } from 'common/libs/uidGen';
|
||||||
import Tables from '@/ipc-api/Tables';
|
import Tables from '@/ipc-api/Tables';
|
||||||
import BaseLoader from '@/components/BaseLoader';
|
import BaseLoader from '@/components/BaseLoader';
|
||||||
@ -173,6 +174,7 @@ import WorkspaceTabPropsTableFields from '@/components/WorkspaceTabPropsTableFie
|
|||||||
import WorkspaceTabPropsTableIndexesModal from '@/components/WorkspaceTabPropsTableIndexesModal';
|
import WorkspaceTabPropsTableIndexesModal from '@/components/WorkspaceTabPropsTableIndexesModal';
|
||||||
import WorkspaceTabPropsTableForeignModal from '@/components/WorkspaceTabPropsTableForeignModal';
|
import WorkspaceTabPropsTableForeignModal from '@/components/WorkspaceTabPropsTableForeignModal';
|
||||||
import WorkspaceTabNewTableEmptyState from '@/components/WorkspaceTabNewTableEmptyState';
|
import WorkspaceTabNewTableEmptyState from '@/components/WorkspaceTabNewTableEmptyState';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceTabNewTable',
|
name: 'WorkspaceTabNewTable',
|
||||||
@ -189,6 +191,36 @@ export default {
|
|||||||
isSelected: Boolean,
|
isSelected: Boolean,
|
||||||
schema: String
|
schema: String
|
||||||
},
|
},
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const {
|
||||||
|
getWorkspace,
|
||||||
|
getDatabaseVariable,
|
||||||
|
refreshStructure,
|
||||||
|
setUnsavedChanges,
|
||||||
|
newTab,
|
||||||
|
renameTabs,
|
||||||
|
removeTab,
|
||||||
|
changeBreadcrumbs
|
||||||
|
} = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
getWorkspace,
|
||||||
|
getDatabaseVariable,
|
||||||
|
refreshStructure,
|
||||||
|
setUnsavedChanges,
|
||||||
|
newTab,
|
||||||
|
renameTabs,
|
||||||
|
removeTab,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
selectedWorkspace
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
@ -209,11 +241,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
getWorkspace: 'workspaces/getWorkspace',
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getDatabaseVariable: 'workspaces/getDatabaseVariable'
|
|
||||||
}),
|
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.connection.uid);
|
return this.getWorkspace(this.connection.uid);
|
||||||
},
|
},
|
||||||
@ -280,15 +307,6 @@ export default {
|
|||||||
window.removeEventListener('keydown', this.onKey);
|
window.removeEventListener('keydown', this.onKey);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification',
|
|
||||||
refreshStructure: 'workspaces/refreshStructure',
|
|
||||||
setUnsavedChanges: 'workspaces/setUnsavedChanges',
|
|
||||||
newTab: 'workspaces/newTab',
|
|
||||||
renameTabs: 'workspaces/renameTabs',
|
|
||||||
removeTab: 'workspaces/removeTab',
|
|
||||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs'
|
|
||||||
}),
|
|
||||||
async saveChanges () {
|
async saveChanges () {
|
||||||
if (this.isSaving || !this.isValid) return;
|
if (this.isSaving || !this.isValid) return;
|
||||||
this.isSaving = true;
|
this.isSaving = true;
|
||||||
|
@ -132,10 +132,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import QueryEditor from '@/components/QueryEditor';
|
import QueryEditor from '@/components/QueryEditor';
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
|
||||||
import BaseLoader from '@/components/BaseLoader';
|
import BaseLoader from '@/components/BaseLoader';
|
||||||
import Triggers from '@/ipc-api/Triggers';
|
import Triggers from '@/ipc-api/Triggers';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceTabNewTrigger',
|
name: 'WorkspaceTabNewTrigger',
|
||||||
@ -149,6 +151,34 @@ export default {
|
|||||||
isSelected: Boolean,
|
isSelected: Boolean,
|
||||||
schema: String
|
schema: String
|
||||||
},
|
},
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const {
|
||||||
|
getWorkspace,
|
||||||
|
refreshStructure,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
setUnsavedChanges,
|
||||||
|
newTab,
|
||||||
|
removeTab,
|
||||||
|
renameTabs
|
||||||
|
} = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace,
|
||||||
|
refreshStructure,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
setUnsavedChanges,
|
||||||
|
newTab,
|
||||||
|
removeTab,
|
||||||
|
renameTabs
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
@ -162,10 +192,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
|
||||||
}),
|
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.connection.uid);
|
return this.getWorkspace(this.connection.uid);
|
||||||
},
|
},
|
||||||
@ -233,15 +259,6 @@ export default {
|
|||||||
window.removeEventListener('keydown', this.onKey);
|
window.removeEventListener('keydown', this.onKey);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification',
|
|
||||||
refreshStructure: 'workspaces/refreshStructure',
|
|
||||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs',
|
|
||||||
setUnsavedChanges: 'workspaces/setUnsavedChanges',
|
|
||||||
newTab: 'workspaces/newTab',
|
|
||||||
removeTab: 'workspaces/removeTab',
|
|
||||||
renameTabs: 'workspaces/renameTabs'
|
|
||||||
}),
|
|
||||||
changeEvents (event) {
|
changeEvents (event) {
|
||||||
if (this.customizations.triggerMultipleEvents) {
|
if (this.customizations.triggerMultipleEvents) {
|
||||||
this.localEvents[event] = !this.localEvents[event];
|
this.localEvents[event] = !this.localEvents[event];
|
||||||
|
@ -108,10 +108,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import BaseLoader from '@/components/BaseLoader';
|
import BaseLoader from '@/components/BaseLoader';
|
||||||
import QueryEditor from '@/components/QueryEditor';
|
import QueryEditor from '@/components/QueryEditor';
|
||||||
import Functions from '@/ipc-api/Functions';
|
import Functions from '@/ipc-api/Functions';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceTabNewTriggerFunction',
|
name: 'WorkspaceTabNewTriggerFunction',
|
||||||
@ -125,6 +127,34 @@ export default {
|
|||||||
isSelected: Boolean,
|
isSelected: Boolean,
|
||||||
schema: String
|
schema: String
|
||||||
},
|
},
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const {
|
||||||
|
getWorkspace,
|
||||||
|
refreshStructure,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
setUnsavedChanges,
|
||||||
|
newTab,
|
||||||
|
removeTab,
|
||||||
|
renameTabs
|
||||||
|
} = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace,
|
||||||
|
refreshStructure,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
setUnsavedChanges,
|
||||||
|
newTab,
|
||||||
|
removeTab,
|
||||||
|
renameTabs
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
@ -139,10 +169,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
|
||||||
}),
|
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.connection.uid);
|
return this.getWorkspace(this.connection.uid);
|
||||||
},
|
},
|
||||||
@ -209,15 +235,6 @@ export default {
|
|||||||
window.removeEventListener('keydown', this.onKey);
|
window.removeEventListener('keydown', this.onKey);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification',
|
|
||||||
refreshStructure: 'workspaces/refreshStructure',
|
|
||||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs',
|
|
||||||
setUnsavedChanges: 'workspaces/setUnsavedChanges',
|
|
||||||
newTab: 'workspaces/newTab',
|
|
||||||
removeTab: 'workspaces/removeTab',
|
|
||||||
renameTabs: 'workspaces/renameTabs'
|
|
||||||
}),
|
|
||||||
async saveChanges () {
|
async saveChanges () {
|
||||||
if (this.isSaving) return;
|
if (this.isSaving) return;
|
||||||
this.isSaving = true;
|
this.isSaving = true;
|
||||||
|
@ -121,10 +121,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import BaseLoader from '@/components/BaseLoader';
|
import BaseLoader from '@/components/BaseLoader';
|
||||||
import QueryEditor from '@/components/QueryEditor';
|
import QueryEditor from '@/components/QueryEditor';
|
||||||
import Views from '@/ipc-api/Views';
|
import Views from '@/ipc-api/Views';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceTabNewView',
|
name: 'WorkspaceTabNewView',
|
||||||
@ -138,6 +140,34 @@ export default {
|
|||||||
isSelected: Boolean,
|
isSelected: Boolean,
|
||||||
schema: String
|
schema: String
|
||||||
},
|
},
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const {
|
||||||
|
getWorkspace,
|
||||||
|
refreshStructure,
|
||||||
|
setUnsavedChanges,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
newTab,
|
||||||
|
removeTab,
|
||||||
|
renameTabs
|
||||||
|
} = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace,
|
||||||
|
refreshStructure,
|
||||||
|
setUnsavedChanges,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
newTab,
|
||||||
|
removeTab,
|
||||||
|
renameTabs
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
@ -150,10 +180,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
|
||||||
}),
|
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.connection.uid);
|
return this.getWorkspace(this.connection.uid);
|
||||||
},
|
},
|
||||||
@ -216,15 +242,6 @@ export default {
|
|||||||
window.removeEventListener('keydown', this.onKey);
|
window.removeEventListener('keydown', this.onKey);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification',
|
|
||||||
refreshStructure: 'workspaces/refreshStructure',
|
|
||||||
setUnsavedChanges: 'workspaces/setUnsavedChanges',
|
|
||||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs',
|
|
||||||
newTab: 'workspaces/newTab',
|
|
||||||
removeTab: 'workspaces/removeTab',
|
|
||||||
renameTabs: 'workspaces/renameTabs'
|
|
||||||
}),
|
|
||||||
async saveChanges () {
|
async saveChanges () {
|
||||||
if (this.isSaving) return;
|
if (this.isSaving) return;
|
||||||
this.isSaving = true;
|
this.isSaving = true;
|
||||||
|
@ -222,13 +222,15 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import { uidGen } from 'common/libs/uidGen';
|
import { uidGen } from 'common/libs/uidGen';
|
||||||
import BaseLoader from '@/components/BaseLoader';
|
import BaseLoader from '@/components/BaseLoader';
|
||||||
import QueryEditor from '@/components/QueryEditor';
|
import QueryEditor from '@/components/QueryEditor';
|
||||||
import WorkspaceTabPropsFunctionParamsModal from '@/components/WorkspaceTabPropsFunctionParamsModal';
|
import WorkspaceTabPropsFunctionParamsModal from '@/components/WorkspaceTabPropsFunctionParamsModal';
|
||||||
import ModalAskParameters from '@/components/ModalAskParameters';
|
import ModalAskParameters from '@/components/ModalAskParameters';
|
||||||
import Functions from '@/ipc-api/Functions';
|
import Functions from '@/ipc-api/Functions';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceTabPropsFunction',
|
name: 'WorkspaceTabPropsFunction',
|
||||||
@ -244,6 +246,32 @@ export default {
|
|||||||
isSelected: Boolean,
|
isSelected: Boolean,
|
||||||
schema: String
|
schema: String
|
||||||
},
|
},
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const {
|
||||||
|
getWorkspace,
|
||||||
|
refreshStructure,
|
||||||
|
renameTabs,
|
||||||
|
newTab,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
setUnsavedChanges
|
||||||
|
} = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace,
|
||||||
|
refreshStructure,
|
||||||
|
renameTabs,
|
||||||
|
newTab,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
setUnsavedChanges
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
@ -258,10 +286,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
|
||||||
}),
|
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.connection.uid);
|
return this.getWorkspace(this.connection.uid);
|
||||||
},
|
},
|
||||||
@ -346,14 +370,6 @@ export default {
|
|||||||
window.removeEventListener('keydown', this.onKey);
|
window.removeEventListener('keydown', this.onKey);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification',
|
|
||||||
refreshStructure: 'workspaces/refreshStructure',
|
|
||||||
renameTabs: 'workspaces/renameTabs',
|
|
||||||
newTab: 'workspaces/newTab',
|
|
||||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs',
|
|
||||||
setUnsavedChanges: 'workspaces/setUnsavedChanges'
|
|
||||||
}),
|
|
||||||
async getFunctionData () {
|
async getFunctionData () {
|
||||||
if (!this.function) return;
|
if (!this.function) return;
|
||||||
|
|
||||||
|
@ -179,13 +179,15 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import { uidGen } from 'common/libs/uidGen';
|
import { uidGen } from 'common/libs/uidGen';
|
||||||
import QueryEditor from '@/components/QueryEditor';
|
import QueryEditor from '@/components/QueryEditor';
|
||||||
import BaseLoader from '@/components/BaseLoader';
|
import BaseLoader from '@/components/BaseLoader';
|
||||||
import WorkspaceTabPropsRoutineParamsModal from '@/components/WorkspaceTabPropsRoutineParamsModal';
|
import WorkspaceTabPropsRoutineParamsModal from '@/components/WorkspaceTabPropsRoutineParamsModal';
|
||||||
import ModalAskParameters from '@/components/ModalAskParameters';
|
import ModalAskParameters from '@/components/ModalAskParameters';
|
||||||
import Routines from '@/ipc-api/Routines';
|
import Routines from '@/ipc-api/Routines';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceTabPropsRoutine',
|
name: 'WorkspaceTabPropsRoutine',
|
||||||
@ -201,6 +203,32 @@ export default {
|
|||||||
isSelected: Boolean,
|
isSelected: Boolean,
|
||||||
schema: String
|
schema: String
|
||||||
},
|
},
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const {
|
||||||
|
getWorkspace,
|
||||||
|
refreshStructure,
|
||||||
|
renameTabs,
|
||||||
|
newTab,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
setUnsavedChanges
|
||||||
|
} = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace,
|
||||||
|
refreshStructure,
|
||||||
|
renameTabs,
|
||||||
|
newTab,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
setUnsavedChanges
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
@ -215,10 +243,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
|
||||||
}),
|
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.connection.uid);
|
return this.getWorkspace(this.connection.uid);
|
||||||
},
|
},
|
||||||
@ -291,14 +315,6 @@ export default {
|
|||||||
window.removeEventListener('keydown', this.onKey);
|
window.removeEventListener('keydown', this.onKey);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification',
|
|
||||||
refreshStructure: 'workspaces/refreshStructure',
|
|
||||||
renameTabs: 'workspaces/renameTabs',
|
|
||||||
newTab: 'workspaces/newTab',
|
|
||||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs',
|
|
||||||
setUnsavedChanges: 'workspaces/setUnsavedChanges'
|
|
||||||
}),
|
|
||||||
async getRoutineData () {
|
async getRoutineData () {
|
||||||
if (!this.routine) return;
|
if (!this.routine) return;
|
||||||
|
|
||||||
|
@ -141,11 +141,13 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import BaseLoader from '@/components/BaseLoader';
|
import BaseLoader from '@/components/BaseLoader';
|
||||||
import QueryEditor from '@/components/QueryEditor';
|
import QueryEditor from '@/components/QueryEditor';
|
||||||
import WorkspaceTabPropsSchedulerTimingModal from '@/components/WorkspaceTabPropsSchedulerTimingModal';
|
import WorkspaceTabPropsSchedulerTimingModal from '@/components/WorkspaceTabPropsSchedulerTimingModal';
|
||||||
import Schedulers from '@/ipc-api/Schedulers';
|
import Schedulers from '@/ipc-api/Schedulers';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceTabPropsScheduler',
|
name: 'WorkspaceTabPropsScheduler',
|
||||||
@ -160,6 +162,32 @@ export default {
|
|||||||
isSelected: Boolean,
|
isSelected: Boolean,
|
||||||
schema: String
|
schema: String
|
||||||
},
|
},
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const {
|
||||||
|
getWorkspace,
|
||||||
|
refreshStructure,
|
||||||
|
renameTabs,
|
||||||
|
newTab,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
setUnsavedChanges
|
||||||
|
} = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace,
|
||||||
|
refreshStructure,
|
||||||
|
renameTabs,
|
||||||
|
newTab,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
setUnsavedChanges
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
@ -173,10 +201,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
|
||||||
}),
|
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.connection.uid);
|
return this.getWorkspace(this.connection.uid);
|
||||||
},
|
},
|
||||||
@ -243,14 +267,6 @@ export default {
|
|||||||
window.removeEventListener('keydown', this.onKey);
|
window.removeEventListener('keydown', this.onKey);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification',
|
|
||||||
refreshStructure: 'workspaces/refreshStructure',
|
|
||||||
renameTabs: 'workspaces/renameTabs',
|
|
||||||
newTab: 'workspaces/newTab',
|
|
||||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs',
|
|
||||||
setUnsavedChanges: 'workspaces/setUnsavedChanges'
|
|
||||||
}),
|
|
||||||
async getSchedulerData () {
|
async getSchedulerData () {
|
||||||
if (!this.scheduler) return;
|
if (!this.scheduler) return;
|
||||||
|
|
||||||
|
@ -139,7 +139,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ConfirmModal from '@/components/BaseConfirmModal';
|
import ConfirmModal from '@/components/BaseConfirmModal';
|
||||||
import { VueMaskDirective } from 'v-mask';
|
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -147,9 +146,6 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
ConfirmModal
|
ConfirmModal
|
||||||
},
|
},
|
||||||
directives: {
|
|
||||||
mask: VueMaskDirective
|
|
||||||
},
|
|
||||||
props: {
|
props: {
|
||||||
localOptions: Object,
|
localOptions: Object,
|
||||||
workspace: Object
|
workspace: Object
|
||||||
|
@ -177,13 +177,15 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import { uidGen } from 'common/libs/uidGen';
|
import { uidGen } from 'common/libs/uidGen';
|
||||||
import Tables from '@/ipc-api/Tables';
|
import Tables from '@/ipc-api/Tables';
|
||||||
import BaseLoader from '@/components/BaseLoader';
|
import BaseLoader from '@/components/BaseLoader';
|
||||||
import WorkspaceTabPropsTableFields from '@/components/WorkspaceTabPropsTableFields';
|
import WorkspaceTabPropsTableFields from '@/components/WorkspaceTabPropsTableFields';
|
||||||
import WorkspaceTabPropsTableIndexesModal from '@/components/WorkspaceTabPropsTableIndexesModal';
|
import WorkspaceTabPropsTableIndexesModal from '@/components/WorkspaceTabPropsTableIndexesModal';
|
||||||
import WorkspaceTabPropsTableForeignModal from '@/components/WorkspaceTabPropsTableForeignModal';
|
import WorkspaceTabPropsTableForeignModal from '@/components/WorkspaceTabPropsTableForeignModal';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceTabPropsTable',
|
name: 'WorkspaceTabPropsTable',
|
||||||
@ -199,6 +201,32 @@ export default {
|
|||||||
table: String,
|
table: String,
|
||||||
schema: String
|
schema: String
|
||||||
},
|
},
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const {
|
||||||
|
getWorkspace,
|
||||||
|
getDatabaseVariable,
|
||||||
|
refreshStructure,
|
||||||
|
renameTabs,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
setUnsavedChanges
|
||||||
|
} = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
getDatabaseVariable,
|
||||||
|
getWorkspace,
|
||||||
|
selectedWorkspace,
|
||||||
|
refreshStructure,
|
||||||
|
setUnsavedChanges,
|
||||||
|
renameTabs,
|
||||||
|
changeBreadcrumbs
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
@ -219,11 +247,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
getWorkspace: 'workspaces/getWorkspace',
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getDatabaseVariable: 'workspaces/getDatabaseVariable'
|
|
||||||
}),
|
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.connection.uid);
|
return this.getWorkspace(this.connection.uid);
|
||||||
},
|
},
|
||||||
@ -281,13 +304,6 @@ export default {
|
|||||||
window.removeEventListener('keydown', this.onKey);
|
window.removeEventListener('keydown', this.onKey);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification',
|
|
||||||
refreshStructure: 'workspaces/refreshStructure',
|
|
||||||
setUnsavedChanges: 'workspaces/setUnsavedChanges',
|
|
||||||
renameTabs: 'workspaces/renameTabs',
|
|
||||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs'
|
|
||||||
}),
|
|
||||||
async getTableOptions (params) {
|
async getTableOptions (params) {
|
||||||
const db = this.workspace.structure.find(db => db.name === this.schema);
|
const db = this.workspace.structure.find(db => db.name === this.schema);
|
||||||
|
|
||||||
|
@ -125,10 +125,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapActions, mapGetters } from 'vuex';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import Draggable from 'vuedraggable';
|
import Draggable from 'vuedraggable';
|
||||||
import TableRow from '@/components/WorkspaceTabPropsTableRow';
|
import TableRow from '@/components/WorkspaceTabPropsTableRow';
|
||||||
import TableContext from '@/components/WorkspaceTabPropsTableContext';
|
import TableContext from '@/components/WorkspaceTabPropsTableContext';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceTabPropsTableFields',
|
name: 'WorkspaceTabPropsTableFields',
|
||||||
@ -149,6 +151,20 @@ export default {
|
|||||||
mode: String
|
mode: String
|
||||||
},
|
},
|
||||||
emits: ['add-new-index', 'add-to-index', 'rename-field', 'duplicate-field', 'remove-field'],
|
emits: ['add-new-index', 'add-to-index', 'rename-field', 'duplicate-field', 'remove-field'],
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const { getWorkspace } = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
resultsSize: 1000,
|
resultsSize: 1000,
|
||||||
@ -159,10 +175,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
getWorkspaceTab: 'workspaces/getWorkspaceTab',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
|
||||||
}),
|
|
||||||
workspaceSchema () {
|
workspaceSchema () {
|
||||||
return this.getWorkspace(this.connUid).breadcrumbs.schema;
|
return this.getWorkspace(this.connUid).breadcrumbs.schema;
|
||||||
},
|
},
|
||||||
@ -201,9 +213,6 @@ export default {
|
|||||||
window.removeEventListener('resize', this.resizeResults);
|
window.removeEventListener('resize', this.resizeResults);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification'
|
|
||||||
}),
|
|
||||||
resizeResults () {
|
resizeResults () {
|
||||||
if (this.$refs.resultTable) {
|
if (this.$refs.resultTable) {
|
||||||
const el = this.$refs.tableWrapper;
|
const el = this.$refs.tableWrapper;
|
||||||
|
@ -202,7 +202,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapActions } from 'vuex';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
import { uidGen } from 'common/libs/uidGen';
|
import { uidGen } from 'common/libs/uidGen';
|
||||||
import Tables from '@/ipc-api/Tables';
|
import Tables from '@/ipc-api/Tables';
|
||||||
import ConfirmModal from '@/components/BaseConfirmModal';
|
import ConfirmModal from '@/components/BaseConfirmModal';
|
||||||
@ -222,6 +222,11 @@ export default {
|
|||||||
workspace: Object
|
workspace: Object
|
||||||
},
|
},
|
||||||
emits: ['foreigns-update', 'hide'],
|
emits: ['foreigns-update', 'hide'],
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
|
||||||
|
return { addNotification };
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
foreignProxy: [],
|
foreignProxy: [],
|
||||||
@ -264,9 +269,6 @@ export default {
|
|||||||
window.removeEventListener('resize', this.getModalInnerHeight);
|
window.removeEventListener('resize', this.getModalInnerHeight);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification'
|
|
||||||
}),
|
|
||||||
confirmForeignsChange () {
|
confirmForeignsChange () {
|
||||||
this.foreignProxy = this.foreignProxy.filter(foreign =>
|
this.foreignProxy = this.foreignProxy.filter(foreign =>
|
||||||
foreign.field &&
|
foreign.field &&
|
||||||
|
@ -343,8 +343,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex';
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import ConfirmModal from '@/components/BaseConfirmModal';
|
import ConfirmModal from '@/components/BaseConfirmModal';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceTabPropsTableRow',
|
name: 'WorkspaceTabPropsTableRow',
|
||||||
@ -359,6 +360,20 @@ export default {
|
|||||||
customizations: Object
|
customizations: Object
|
||||||
},
|
},
|
||||||
emits: ['contextmenu', 'rename-field'],
|
emits: ['contextmenu', 'rename-field'],
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const { getWorkspace } = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
localRow: {},
|
localRow: {},
|
||||||
@ -376,10 +391,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
|
||||||
}),
|
|
||||||
localLength () {
|
localLength () {
|
||||||
const localLength = this.localRow.numLength || this.localRow.charLength || this.localRow.datePrecision || this.localRow.numPrecision || 0;
|
const localLength = this.localRow.numLength || this.localRow.charLength || this.localRow.datePrecision || this.localRow.numPrecision || 0;
|
||||||
return localLength === true ? null : localLength;
|
return localLength === true ? null : localLength;
|
||||||
|
@ -131,10 +131,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import QueryEditor from '@/components/QueryEditor';
|
import QueryEditor from '@/components/QueryEditor';
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
|
||||||
import BaseLoader from '@/components/BaseLoader';
|
import BaseLoader from '@/components/BaseLoader';
|
||||||
import Triggers from '@/ipc-api/Triggers';
|
import Triggers from '@/ipc-api/Triggers';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceTabPropsTrigger',
|
name: 'WorkspaceTabPropsTrigger',
|
||||||
@ -148,6 +150,32 @@ export default {
|
|||||||
isSelected: Boolean,
|
isSelected: Boolean,
|
||||||
schema: String
|
schema: String
|
||||||
},
|
},
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const {
|
||||||
|
getWorkspace,
|
||||||
|
refreshStructure,
|
||||||
|
renameTabs,
|
||||||
|
newTab,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
setUnsavedChanges
|
||||||
|
} = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace,
|
||||||
|
refreshStructure,
|
||||||
|
renameTabs,
|
||||||
|
newTab,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
setUnsavedChanges
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
@ -161,10 +189,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
|
||||||
}),
|
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.connection.uid);
|
return this.getWorkspace(this.connection.uid);
|
||||||
},
|
},
|
||||||
@ -234,14 +258,6 @@ export default {
|
|||||||
window.removeEventListener('keydown', this.onKey);
|
window.removeEventListener('keydown', this.onKey);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification',
|
|
||||||
refreshStructure: 'workspaces/refreshStructure',
|
|
||||||
renameTabs: 'workspaces/renameTabs',
|
|
||||||
newTab: 'workspaces/newTab',
|
|
||||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs',
|
|
||||||
setUnsavedChanges: 'workspaces/setUnsavedChanges'
|
|
||||||
}),
|
|
||||||
async getTriggerData () {
|
async getTriggerData () {
|
||||||
if (!this.trigger) return;
|
if (!this.trigger) return;
|
||||||
|
|
||||||
|
@ -102,12 +102,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import { uidGen } from 'common/libs/uidGen';
|
import { uidGen } from 'common/libs/uidGen';
|
||||||
import BaseLoader from '@/components/BaseLoader';
|
import BaseLoader from '@/components/BaseLoader';
|
||||||
import QueryEditor from '@/components/QueryEditor';
|
import QueryEditor from '@/components/QueryEditor';
|
||||||
import ModalAskParameters from '@/components/ModalAskParameters';
|
import ModalAskParameters from '@/components/ModalAskParameters';
|
||||||
import Functions from '@/ipc-api/Functions';
|
import Functions from '@/ipc-api/Functions';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceTabPropsTriggerFunction',
|
name: 'WorkspaceTabPropsTriggerFunction',
|
||||||
@ -122,6 +124,32 @@ export default {
|
|||||||
isSelected: Boolean,
|
isSelected: Boolean,
|
||||||
schema: String
|
schema: String
|
||||||
},
|
},
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const {
|
||||||
|
getWorkspace,
|
||||||
|
refreshStructure,
|
||||||
|
renameTabs,
|
||||||
|
newTab,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
setUnsavedChanges
|
||||||
|
} = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace,
|
||||||
|
refreshStructure,
|
||||||
|
renameTabs,
|
||||||
|
newTab,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
setUnsavedChanges
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
@ -136,10 +164,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
|
||||||
}),
|
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.connection.uid);
|
return this.getWorkspace(this.connection.uid);
|
||||||
},
|
},
|
||||||
@ -211,14 +235,6 @@ export default {
|
|||||||
window.removeEventListener('keydown', this.onKey);
|
window.removeEventListener('keydown', this.onKey);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification',
|
|
||||||
refreshStructure: 'workspaces/refreshStructure',
|
|
||||||
renameTabs: 'workspaces/renameTabs',
|
|
||||||
newTab: 'workspaces/newTab',
|
|
||||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs',
|
|
||||||
setUnsavedChanges: 'workspaces/setUnsavedChanges'
|
|
||||||
}),
|
|
||||||
async getFunctionData () {
|
async getFunctionData () {
|
||||||
if (!this.function) return;
|
if (!this.function) return;
|
||||||
|
|
||||||
|
@ -120,10 +120,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import BaseLoader from '@/components/BaseLoader';
|
import BaseLoader from '@/components/BaseLoader';
|
||||||
import QueryEditor from '@/components/QueryEditor';
|
import QueryEditor from '@/components/QueryEditor';
|
||||||
import Views from '@/ipc-api/Views';
|
import Views from '@/ipc-api/Views';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceTabPropsView',
|
name: 'WorkspaceTabPropsView',
|
||||||
@ -137,6 +139,30 @@ export default {
|
|||||||
schema: String,
|
schema: String,
|
||||||
view: String
|
view: String
|
||||||
},
|
},
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const {
|
||||||
|
getWorkspace,
|
||||||
|
refreshStructure,
|
||||||
|
renameTabs,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
setUnsavedChanges
|
||||||
|
} = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace,
|
||||||
|
refreshStructure,
|
||||||
|
renameTabs,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
setUnsavedChanges
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
@ -149,10 +175,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
|
||||||
}),
|
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.connection.uid);
|
return this.getWorkspace(this.connection.uid);
|
||||||
},
|
},
|
||||||
@ -212,13 +234,6 @@ export default {
|
|||||||
window.removeEventListener('keydown', this.onKey);
|
window.removeEventListener('keydown', this.onKey);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification',
|
|
||||||
refreshStructure: 'workspaces/refreshStructure',
|
|
||||||
setUnsavedChanges: 'workspaces/setUnsavedChanges',
|
|
||||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs',
|
|
||||||
renameTabs: 'workspaces/renameTabs'
|
|
||||||
}),
|
|
||||||
async getViewData () {
|
async getViewData () {
|
||||||
if (!this.view) return;
|
if (!this.view) return;
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
|
@ -188,7 +188,9 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { format } from 'sql-formatter';
|
import { format } from 'sql-formatter';
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { useHistoryStore } from '@/stores/history';
|
||||||
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import Schema from '@/ipc-api/Schema';
|
import Schema from '@/ipc-api/Schema';
|
||||||
import QueryEditor from '@/components/QueryEditor';
|
import QueryEditor from '@/components/QueryEditor';
|
||||||
import BaseLoader from '@/components/BaseLoader';
|
import BaseLoader from '@/components/BaseLoader';
|
||||||
@ -196,6 +198,7 @@ import WorkspaceTabQueryTable from '@/components/WorkspaceTabQueryTable';
|
|||||||
import WorkspaceTabQueryEmptyState from '@/components/WorkspaceTabQueryEmptyState';
|
import WorkspaceTabQueryEmptyState from '@/components/WorkspaceTabQueryEmptyState';
|
||||||
import ModalHistory from '@/components/ModalHistory';
|
import ModalHistory from '@/components/ModalHistory';
|
||||||
import tableTabs from '@/mixins/tableTabs';
|
import tableTabs from '@/mixins/tableTabs';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceTabQuery',
|
name: 'WorkspaceTabQuery',
|
||||||
@ -212,6 +215,31 @@ export default {
|
|||||||
tab: Object,
|
tab: Object,
|
||||||
isSelected: Boolean
|
isSelected: Boolean
|
||||||
},
|
},
|
||||||
|
setup () {
|
||||||
|
const { getHistoryByWorkspace, saveHistory } = useHistoryStore();
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const {
|
||||||
|
getWorkspace,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
updateTabContent,
|
||||||
|
setUnsavedChanges
|
||||||
|
} = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
getHistoryByWorkspace,
|
||||||
|
saveHistory,
|
||||||
|
addNotification,
|
||||||
|
selectedWorkspace,
|
||||||
|
getWorkspace,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
updateTabContent,
|
||||||
|
setUnsavedChanges
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
query: '',
|
query: '',
|
||||||
@ -230,11 +258,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
getWorkspace: 'workspaces/getWorkspace',
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
getHistoryByWorkspace: 'history/getHistoryByWorkspace'
|
|
||||||
}),
|
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.connection.uid);
|
return this.getWorkspace(this.connection.uid);
|
||||||
},
|
},
|
||||||
@ -305,13 +328,6 @@ export default {
|
|||||||
Schema.destroyConnectionToCommit(params);
|
Schema.destroyConnectionToCommit(params);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification',
|
|
||||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs',
|
|
||||||
updateTabContent: 'workspaces/updateTabContent',
|
|
||||||
setUnsavedChanges: 'workspaces/setUnsavedChanges',
|
|
||||||
saveHistory: 'history/saveHistory'
|
|
||||||
}),
|
|
||||||
async runQuery (query) {
|
async runQuery (query) {
|
||||||
if (!query || this.isQuering) return;
|
if (!query || this.isQuering) return;
|
||||||
this.isQuering = true;
|
this.isQuering = true;
|
||||||
|
@ -108,14 +108,17 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { uidGen } from 'common/libs/uidGen';
|
import { uidGen } from 'common/libs/uidGen';
|
||||||
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useSettingsStore } from '@/stores/settings';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import arrayToFile from '../libs/arrayToFile';
|
import arrayToFile from '../libs/arrayToFile';
|
||||||
import { TEXT, LONG_TEXT, BLOB } from 'common/fieldTypes';
|
import { TEXT, LONG_TEXT, BLOB } from 'common/fieldTypes';
|
||||||
import BaseVirtualScroll from '@/components/BaseVirtualScroll';
|
import BaseVirtualScroll from '@/components/BaseVirtualScroll';
|
||||||
import WorkspaceTabQueryTableRow from '@/components/WorkspaceTabQueryTableRow';
|
import WorkspaceTabQueryTableRow from '@/components/WorkspaceTabQueryTableRow';
|
||||||
import TableContext from '@/components/WorkspaceTabQueryTableContext';
|
import TableContext from '@/components/WorkspaceTabQueryTableContext';
|
||||||
import ConfirmModal from '@/components/BaseConfirmModal';
|
import ConfirmModal from '@/components/BaseConfirmModal';
|
||||||
import { mapActions, mapGetters } from 'vuex';
|
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceTabQueryTable',
|
name: 'WorkspaceTabQueryTable',
|
||||||
@ -133,6 +136,19 @@ export default {
|
|||||||
elementType: { type: String, default: 'table' }
|
elementType: { type: String, default: 'table' }
|
||||||
},
|
},
|
||||||
emits: ['update-field', 'delete-selected', 'hard-sort'],
|
emits: ['update-field', 'delete-selected', 'hard-sort'],
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const settingsStore = useSettingsStore();
|
||||||
|
const { getWorkspace } = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { dataTabLimit: pageSize } = storeToRefs(settingsStore);
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
pageSize,
|
||||||
|
getWorkspace
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
resultsSize: 0,
|
resultsSize: 0,
|
||||||
@ -150,10 +166,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
getWorkspace: 'workspaces/getWorkspace',
|
|
||||||
pageSize: 'settings/getDataTabLimit'
|
|
||||||
}),
|
|
||||||
workspaceSchema () {
|
workspaceSchema () {
|
||||||
return this.getWorkspace(this.connUid).breadcrumbs.schema;
|
return this.getWorkspace(this.connUid).breadcrumbs.schema;
|
||||||
},
|
},
|
||||||
@ -261,9 +273,6 @@ export default {
|
|||||||
window.removeEventListener('resize', this.resizeResults);
|
window.removeEventListener('resize', this.resizeResults);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification'
|
|
||||||
}),
|
|
||||||
fieldType (cKey) {
|
fieldType (cKey) {
|
||||||
let type = 'unknown';
|
let type = 'unknown';
|
||||||
const field = this.fields.filter(field => field.name === cKey)[0];
|
const field = this.fields.filter(field => field.name === cKey)[0];
|
||||||
|
@ -219,7 +219,6 @@ import {
|
|||||||
SPATIAL,
|
SPATIAL,
|
||||||
IS_MULTI_SPATIAL
|
IS_MULTI_SPATIAL
|
||||||
} from 'common/fieldTypes';
|
} from 'common/fieldTypes';
|
||||||
import { VueMaskDirective } from 'v-mask';
|
|
||||||
import ConfirmModal from '@/components/BaseConfirmModal';
|
import ConfirmModal from '@/components/BaseConfirmModal';
|
||||||
import TextEditor from '@/components/BaseTextEditor';
|
import TextEditor from '@/components/BaseTextEditor';
|
||||||
import BaseMap from '@/components/BaseMap';
|
import BaseMap from '@/components/BaseMap';
|
||||||
@ -233,9 +232,6 @@ export default {
|
|||||||
ForeignKeySelect,
|
ForeignKeySelect,
|
||||||
BaseMap
|
BaseMap
|
||||||
},
|
},
|
||||||
directives: {
|
|
||||||
mask: VueMaskDirective
|
|
||||||
},
|
|
||||||
props: {
|
props: {
|
||||||
row: Object,
|
row: Object,
|
||||||
fields: Object,
|
fields: Object,
|
||||||
|
@ -177,13 +177,16 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Tables from '@/ipc-api/Tables';
|
import Tables from '@/ipc-api/Tables';
|
||||||
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useSettingsStore } from '@/stores/settings';
|
||||||
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import BaseLoader from '@/components/BaseLoader';
|
import BaseLoader from '@/components/BaseLoader';
|
||||||
import WorkspaceTabQueryTable from '@/components/WorkspaceTabQueryTable';
|
import WorkspaceTabQueryTable from '@/components/WorkspaceTabQueryTable';
|
||||||
import WorkspaceTabTableFilters from '@/components/WorkspaceTabTableFilters';
|
import WorkspaceTabTableFilters from '@/components/WorkspaceTabTableFilters';
|
||||||
import ModalNewTableRow from '@/components/ModalNewTableRow';
|
import ModalNewTableRow from '@/components/ModalNewTableRow';
|
||||||
import ModalFakerRows from '@/components/ModalFakerRows';
|
import ModalFakerRows from '@/components/ModalFakerRows';
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
|
||||||
import tableTabs from '@/mixins/tableTabs';
|
import tableTabs from '@/mixins/tableTabs';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceTabTable',
|
name: 'WorkspaceTabTable',
|
||||||
@ -202,6 +205,24 @@ export default {
|
|||||||
schema: String,
|
schema: String,
|
||||||
elementType: String
|
elementType: String
|
||||||
},
|
},
|
||||||
|
setup () {
|
||||||
|
const { addNotification } = useNotificationsStore();
|
||||||
|
const settingsStore = useSettingsStore();
|
||||||
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { dataTabLimit: limit } = storeToRefs(settingsStore);
|
||||||
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
|
|
||||||
|
const { changeBreadcrumbs, getWorkspace } = workspacesStore;
|
||||||
|
|
||||||
|
return {
|
||||||
|
addNotification,
|
||||||
|
limit,
|
||||||
|
selectedWorkspace,
|
||||||
|
changeBreadcrumbs,
|
||||||
|
getWorkspace
|
||||||
|
};
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
tabUid: 'data', // ???
|
tabUid: 'data', // ???
|
||||||
@ -222,11 +243,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
getWorkspace: 'workspaces/getWorkspace',
|
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
|
||||||
limit: 'settings/getDataTabLimit'
|
|
||||||
}),
|
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.connection.uid);
|
return this.getWorkspace(this.connection.uid);
|
||||||
},
|
},
|
||||||
@ -309,10 +325,6 @@ export default {
|
|||||||
clearInterval(this.refreshInterval);
|
clearInterval(this.refreshInterval);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
|
||||||
addNotification: 'notifications/addNotification',
|
|
||||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs'
|
|
||||||
}),
|
|
||||||
async getTableData () {
|
async getTableData () {
|
||||||
if (!this.table || !this.isSelected) return;
|
if (!this.table || !this.isSelected) return;
|
||||||
this.isQuering = true;
|
this.isQuering = true;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { createApp, configureCompat } from 'vue';
|
import { createApp, configureCompat } 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 { VueMaskDirective } from 'v-mask';
|
||||||
|
import { useSettingsStore } from '@/stores/settings';
|
||||||
|
|
||||||
import App from '@/App.vue';
|
import App from '@/App.vue';
|
||||||
import { store } from '@/store';
|
|
||||||
import { pinia } from '@/stores';
|
import { pinia } from '@/stores';
|
||||||
import i18n from '@/i18n';
|
import i18n from '@/i18n';
|
||||||
|
|
||||||
@ -15,10 +15,19 @@ configureCompat({
|
|||||||
MODE: 3
|
MODE: 3
|
||||||
});
|
});
|
||||||
|
|
||||||
i18n.global.locale = store.state.settings.locale;
|
// https://github.com/probil/v-mask/issues/498#issuecomment-827027834
|
||||||
|
const vMaskV2 = VueMaskDirective;
|
||||||
|
const vMaskV3 = {
|
||||||
|
beforeMount: vMaskV2.bind,
|
||||||
|
updated: vMaskV2.componentUpdated,
|
||||||
|
unmounted: vMaskV2.unbind
|
||||||
|
};
|
||||||
|
|
||||||
createApp(App)
|
createApp(App)
|
||||||
.use(store)
|
.directive('mask', vMaskV3)
|
||||||
.use(pinia)
|
.use(pinia)
|
||||||
.use(i18n)
|
.use(i18n)
|
||||||
.mount('#app');
|
.mount('#app');
|
||||||
|
|
||||||
|
const { locale } = useSettingsStore();
|
||||||
|
i18n.global.locale = locale;
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
import { createStore } from 'vuex/dist/vuex.esm-bundler';
|
|
||||||
|
|
||||||
import application from './modules/application.store';
|
|
||||||
import settings from './modules/settings.store';
|
|
||||||
import history from './modules/history.store';
|
|
||||||
import scratchpad from './modules/scratchpad.store';
|
|
||||||
import connections from './modules/connections.store';
|
|
||||||
import workspaces from './modules/workspaces.store';
|
|
||||||
import notifications from './modules/notifications.store';
|
|
||||||
|
|
||||||
import ipcUpdates from './plugins/ipcUpdates';
|
|
||||||
import ipcExceptions from './plugins/ipcExceptions';
|
|
||||||
import ipcShortcuts from './plugins/ipcShortcuts';
|
|
||||||
|
|
||||||
export const store = createStore({
|
|
||||||
strict: true,
|
|
||||||
modules: {
|
|
||||||
application,
|
|
||||||
settings,
|
|
||||||
history,
|
|
||||||
scratchpad,
|
|
||||||
connections,
|
|
||||||
workspaces,
|
|
||||||
notifications
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
ipcUpdates,
|
|
||||||
ipcExceptions,
|
|
||||||
ipcShortcuts
|
|
||||||
]
|
|
||||||
});
|
|
@ -1,106 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
import Store from 'electron-store';
|
|
||||||
const persistentStore = new Store({ name: 'settings' });
|
|
||||||
|
|
||||||
export default {
|
|
||||||
namespaced: true,
|
|
||||||
strict: true,
|
|
||||||
state: {
|
|
||||||
app_name: 'Antares - SQL Client',
|
|
||||||
app_version: process.env.PACKAGE_VERSION || 0,
|
|
||||||
cached_version: persistentStore.get('cached_version', 0),
|
|
||||||
is_loading: false,
|
|
||||||
is_new_modal: false,
|
|
||||||
is_setting_modal: false,
|
|
||||||
is_scratchpad: false,
|
|
||||||
selected_setting_tab: 'general',
|
|
||||||
selected_conection: {},
|
|
||||||
update_status: 'noupdate', // noupdate, available, checking, nocheck, downloading, downloaded, disabled
|
|
||||||
download_progress: 0,
|
|
||||||
base_completer: [] // Needed to reset ace editor, due global-only ace completer
|
|
||||||
},
|
|
||||||
getters: {
|
|
||||||
isLoading: state => state.is_loading,
|
|
||||||
appName: state => state.app_name,
|
|
||||||
appVersion: state => state.app_version,
|
|
||||||
cachedVersion: state => state.cached_version,
|
|
||||||
getBaseCompleter: state => state.base_completer,
|
|
||||||
getSelectedConnection: state => state.selected_conection,
|
|
||||||
isNewModal: state => state.is_new_modal,
|
|
||||||
isSettingModal: state => state.is_setting_modal,
|
|
||||||
isScratchpad: state => state.is_scratchpad,
|
|
||||||
selectedSettingTab: state => state.selected_setting_tab,
|
|
||||||
getUpdateStatus: state => state.update_status,
|
|
||||||
getDownloadProgress: state => Number(state.download_progress.toFixed(1))
|
|
||||||
},
|
|
||||||
mutations: {
|
|
||||||
SET_LOADING_STATUS (state, payload) {
|
|
||||||
state.is_loading = payload;
|
|
||||||
},
|
|
||||||
SET_BASE_COMPLETER (state, payload) {
|
|
||||||
state.base_completer = payload;
|
|
||||||
},
|
|
||||||
SHOW_NEW_CONNECTION_MODAL (state) {
|
|
||||||
state.is_new_modal = true;
|
|
||||||
},
|
|
||||||
HIDE_NEW_CONNECTION_MODAL (state) {
|
|
||||||
state.is_new_modal = false;
|
|
||||||
},
|
|
||||||
SHOW_SETTING_MODAL (state, tab) {
|
|
||||||
state.selected_setting_tab = tab;
|
|
||||||
state.is_setting_modal = true;
|
|
||||||
},
|
|
||||||
HIDE_SETTING_MODAL (state) {
|
|
||||||
state.is_setting_modal = false;
|
|
||||||
},
|
|
||||||
SHOW_SCRATCHPAD (state) {
|
|
||||||
state.is_scratchpad = true;
|
|
||||||
},
|
|
||||||
HIDE_SCRATCHPAD (state) {
|
|
||||||
state.is_scratchpad = false;
|
|
||||||
},
|
|
||||||
CHANGE_CACHED_VERSION (state) {
|
|
||||||
state.cached_version = state.app_version;
|
|
||||||
persistentStore.set('cached_version', state.cached_version);
|
|
||||||
},
|
|
||||||
CHANGE_UPDATE_STATUS (state, status) {
|
|
||||||
state.update_status = status;
|
|
||||||
},
|
|
||||||
CHANGE_PROGRESS_PERCENTAGE (state, percentage) {
|
|
||||||
state.download_progress = percentage;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
checkVersionUpdate ({ getters, commit, dispatch }) {
|
|
||||||
if (getters.appVersion !== getters.cachedVersion) {
|
|
||||||
dispatch('showSettingModal', 'changelog');
|
|
||||||
commit('CHANGE_CACHED_VERSION');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
setLoadingStatus ({ commit }, payload) {
|
|
||||||
commit('SET_LOADING_STATUS', payload);
|
|
||||||
},
|
|
||||||
setBaseCompleter ({ commit }, payload) {
|
|
||||||
commit('SET_BASE_COMPLETER', payload);
|
|
||||||
},
|
|
||||||
// Modals
|
|
||||||
showNewConnModal ({ commit }) {
|
|
||||||
commit('SHOW_NEW_CONNECTION_MODAL');
|
|
||||||
},
|
|
||||||
hideNewConnModal ({ commit }) {
|
|
||||||
commit('HIDE_NEW_CONNECTION_MODAL');
|
|
||||||
},
|
|
||||||
showSettingModal ({ commit }, tab) {
|
|
||||||
commit('SHOW_SETTING_MODAL', tab);
|
|
||||||
},
|
|
||||||
hideSettingModal ({ commit }) {
|
|
||||||
commit('HIDE_SETTING_MODAL');
|
|
||||||
},
|
|
||||||
showScratchpad ({ commit }) {
|
|
||||||
commit('SHOW_SCRATCHPAD');
|
|
||||||
},
|
|
||||||
hideScratchpad ({ commit }) {
|
|
||||||
commit('HIDE_SCRATCHPAD');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
@ -1,84 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
import Store from 'electron-store';
|
|
||||||
import crypto from 'crypto';
|
|
||||||
const key = localStorage.getItem('key');
|
|
||||||
|
|
||||||
if (!key)
|
|
||||||
localStorage.setItem('key', crypto.randomBytes(16).toString('hex'));
|
|
||||||
else
|
|
||||||
localStorage.setItem('key', key);
|
|
||||||
|
|
||||||
const persistentStore = new Store({
|
|
||||||
name: 'connections',
|
|
||||||
encryptionKey: key,
|
|
||||||
clearInvalidConfig: true
|
|
||||||
});
|
|
||||||
|
|
||||||
export default {
|
|
||||||
namespaced: true,
|
|
||||||
strict: true,
|
|
||||||
state: {
|
|
||||||
connections: persistentStore.get('connections', [])
|
|
||||||
},
|
|
||||||
getters: {
|
|
||||||
getConnections: state => state.connections,
|
|
||||||
getConnectionName: state => uid => {
|
|
||||||
const connection = state.connections.filter(connection => connection.uid === uid)[0];
|
|
||||||
let connectionName = '';
|
|
||||||
|
|
||||||
if (connection.name)
|
|
||||||
connectionName = connection.name;
|
|
||||||
else if (connection.ask)
|
|
||||||
connectionName = `${connection.host}:${connection.port}`;
|
|
||||||
else if (connection.databasePath) {
|
|
||||||
let string = connection.databasePath.split(/[/\\]+/).pop();
|
|
||||||
|
|
||||||
if (string.length >= 30)
|
|
||||||
string = `...${string.slice(-30)}`;
|
|
||||||
|
|
||||||
connectionName = string;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
connectionName = `${connection.user + '@'}${connection.host}:${connection.port}`;
|
|
||||||
|
|
||||||
return connectionName;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mutations: {
|
|
||||||
ADD_CONNECTION (state, connection) {
|
|
||||||
state.connections.push(connection);
|
|
||||||
persistentStore.set('connections', state.connections);
|
|
||||||
},
|
|
||||||
DELETE_CONNECTION (state, connection) {
|
|
||||||
state.connections = state.connections.filter(el => el.uid !== connection.uid);
|
|
||||||
persistentStore.set('connections', state.connections);
|
|
||||||
},
|
|
||||||
EDIT_CONNECTION (state, connection) {
|
|
||||||
const editedConnections = state.connections.map(conn => {
|
|
||||||
if (conn.uid === connection.uid) return connection;
|
|
||||||
return conn;
|
|
||||||
});
|
|
||||||
state.connections = editedConnections;
|
|
||||||
state.selected_conection = {};
|
|
||||||
persistentStore.set('connections', state.connections);
|
|
||||||
},
|
|
||||||
UPDATE_CONNECTIONS (state, connections) {
|
|
||||||
state.connections = connections;
|
|
||||||
persistentStore.set('connections', state.connections);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
addConnection ({ commit }, connection) {
|
|
||||||
commit('ADD_CONNECTION', connection);
|
|
||||||
},
|
|
||||||
deleteConnection ({ commit }, connection) {
|
|
||||||
commit('DELETE_CONNECTION', connection);
|
|
||||||
},
|
|
||||||
editConnection ({ commit }, connection) {
|
|
||||||
commit('EDIT_CONNECTION', connection);
|
|
||||||
},
|
|
||||||
updateConnections ({ commit }, connections) {
|
|
||||||
commit('UPDATE_CONNECTIONS', connections);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
@ -1,54 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
import Store from 'electron-store';
|
|
||||||
import { uidGen } from 'common/libs/uidGen';
|
|
||||||
const persistentStore = new Store({ name: 'history' });
|
|
||||||
const historySize = 1000;
|
|
||||||
|
|
||||||
export default {
|
|
||||||
namespaced: true,
|
|
||||||
strict: true,
|
|
||||||
state: {
|
|
||||||
history: persistentStore.get('history', {}),
|
|
||||||
favorites: persistentStore.get('favorites', {})
|
|
||||||
},
|
|
||||||
getters: {
|
|
||||||
getHistoryByWorkspace: state => uid => state.history[uid]
|
|
||||||
},
|
|
||||||
mutations: {
|
|
||||||
SET_HISTORY (state, args) {
|
|
||||||
if (!(args.uid in state.history))
|
|
||||||
state.history[args.uid] = [];
|
|
||||||
|
|
||||||
state.history[args.uid] = [
|
|
||||||
{
|
|
||||||
uid: uidGen('H'),
|
|
||||||
sql: args.query,
|
|
||||||
date: new Date(),
|
|
||||||
schema: args.schema
|
|
||||||
},
|
|
||||||
...state.history[args.uid]
|
|
||||||
];
|
|
||||||
|
|
||||||
if (state.history[args.uid].length > historySize)
|
|
||||||
state.history[args.uid] = state.history[args.uid].slice(0, historySize);
|
|
||||||
|
|
||||||
persistentStore.set('history', state.history);
|
|
||||||
},
|
|
||||||
DELETE_QUERY_FROM_HISTORY (state, query) {
|
|
||||||
state.history[query.workspace] = state.history[query.workspace].filter(q => q.uid !== query.uid);
|
|
||||||
persistentStore.set('history', state.history);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
saveHistory ({ commit, getters }, args) {
|
|
||||||
if (getters.getHistoryByWorkspace(args.uid) &&
|
|
||||||
getters.getHistoryByWorkspace(args.uid).length &&
|
|
||||||
getters.getHistoryByWorkspace(args.uid)[0].sql === args.query
|
|
||||||
) return;
|
|
||||||
commit('SET_HISTORY', args);
|
|
||||||
},
|
|
||||||
deleteQueryFromHistory ({ commit }, query) {
|
|
||||||
commit('DELETE_QUERY_FROM_HISTORY', query);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
@ -1,30 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
import { uidGen } from 'common/libs/uidGen';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
namespaced: true,
|
|
||||||
strict: true,
|
|
||||||
state: {
|
|
||||||
notifications: []
|
|
||||||
},
|
|
||||||
getters: {
|
|
||||||
getNotifications: state => state.notifications
|
|
||||||
},
|
|
||||||
mutations: {
|
|
||||||
ADD_NOTIFICATION (state, payload) {
|
|
||||||
state.notifications.unshift(payload);
|
|
||||||
},
|
|
||||||
REMOVE_NOTIFICATION (state, uid) {
|
|
||||||
state.notifications = state.notifications.filter(item => item.uid !== uid);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
addNotification ({ commit }, payload) {
|
|
||||||
payload.uid = uidGen('N');
|
|
||||||
commit('ADD_NOTIFICATION', payload);
|
|
||||||
},
|
|
||||||
removeNotification ({ commit }, uid) {
|
|
||||||
commit('REMOVE_NOTIFICATION', uid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
@ -1,129 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
import i18n from '@/i18n';
|
|
||||||
import Store from 'electron-store';
|
|
||||||
const persistentStore = new Store({ name: 'settings' });
|
|
||||||
const isDarkTheme = window.matchMedia('(prefers-color-scheme: dark)');
|
|
||||||
const defaultAppTheme = isDarkTheme.matches ? 'dark' : 'light';
|
|
||||||
const defaultEditorTheme = isDarkTheme.matches ? 'twilight' : 'sqlserver';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
namespaced: true,
|
|
||||||
strict: true,
|
|
||||||
state: {
|
|
||||||
locale: persistentStore.get('locale', 'en-US'),
|
|
||||||
allow_prerelease: persistentStore.get('allow_prerelease', true),
|
|
||||||
explorebar_size: persistentStore.get('explorebar_size', null),
|
|
||||||
notifications_timeout: persistentStore.get('notifications_timeout', 5),
|
|
||||||
data_tab_limit: persistentStore.get('data_tab_limit', 1000),
|
|
||||||
auto_complete: persistentStore.get('auto_complete', true),
|
|
||||||
line_wrap: persistentStore.get('line_wrap', true),
|
|
||||||
application_theme: persistentStore.get('application_theme', defaultAppTheme),
|
|
||||||
editor_theme: persistentStore.get('editor_theme', defaultEditorTheme),
|
|
||||||
editor_font_size: persistentStore.get('editor_font_size', 'medium'),
|
|
||||||
restore_tabs: persistentStore.get('restore_tabs', true),
|
|
||||||
disable_blur: persistentStore.get('disable_blur', false)
|
|
||||||
},
|
|
||||||
getters: {
|
|
||||||
getLocale: state => state.locale,
|
|
||||||
getDataTabLimit: state => state.data_tab_limit,
|
|
||||||
getAllowPrerelease: state => state.allow_prerelease,
|
|
||||||
getExplorebarSize: state => state.explorebar_size,
|
|
||||||
getNotificationsTimeout: state => state.notifications_timeout,
|
|
||||||
getAutoComplete: state => state.auto_complete,
|
|
||||||
getLineWrap: state => state.line_wrap,
|
|
||||||
getApplicationTheme: state => state.application_theme,
|
|
||||||
getEditorTheme: state => state.editor_theme,
|
|
||||||
getEditorFontSize: state => state.editor_font_size,
|
|
||||||
getRestoreTabs: state => state.restore_tabs,
|
|
||||||
getDisableBlur: state => state.disable_blur
|
|
||||||
},
|
|
||||||
mutations: {
|
|
||||||
SET_LOCALE (state, locale) {
|
|
||||||
state.locale = locale;
|
|
||||||
i18n.global.locale = locale;
|
|
||||||
persistentStore.set('locale', state.locale);
|
|
||||||
},
|
|
||||||
SET_DATA_TAB_LIMIT (state, limit) {
|
|
||||||
state.data_tab_limit = limit;
|
|
||||||
persistentStore.set('data_tab_limit', state.data_tab_limit);
|
|
||||||
},
|
|
||||||
SET_ALLOW_PRERELEASE (state, allow) {
|
|
||||||
state.allow_prerelease = allow;
|
|
||||||
persistentStore.set('allow_prerelease', state.allow_prerelease);
|
|
||||||
},
|
|
||||||
SET_NOTIFICATIONS_TIMEOUT (state, timeout) {
|
|
||||||
state.notifications_timeout = timeout;
|
|
||||||
persistentStore.set('notifications_timeout', state.notifications_timeout);
|
|
||||||
},
|
|
||||||
SET_AUTO_COMPLETE (state, val) {
|
|
||||||
state.auto_complete = val;
|
|
||||||
persistentStore.set('auto_complete', state.auto_complete);
|
|
||||||
},
|
|
||||||
SET_LINE_WRAP (state, val) {
|
|
||||||
state.line_wrap = val;
|
|
||||||
persistentStore.set('line_wrap', state.line_wrap);
|
|
||||||
},
|
|
||||||
SET_EXPLOREBAR_SIZE (state, size) {
|
|
||||||
state.explorebar_size = size;
|
|
||||||
persistentStore.set('explorebar_size', state.explorebar_size);
|
|
||||||
},
|
|
||||||
SET_APPLICATION_THEME (state, theme) {
|
|
||||||
state.application_theme = theme;
|
|
||||||
persistentStore.set('application_theme', state.application_theme);
|
|
||||||
},
|
|
||||||
SET_EDITOR_THEME (state, theme) {
|
|
||||||
state.editor_theme = theme;
|
|
||||||
persistentStore.set('editor_theme', state.editor_theme);
|
|
||||||
},
|
|
||||||
SET_EDITOR_FONT_SIZE (state, size) {
|
|
||||||
state.editor_font_size = size;
|
|
||||||
persistentStore.set('editor_font_size', state.editor_font_size);
|
|
||||||
},
|
|
||||||
SET_RESTORE_TABS (state, val) {
|
|
||||||
state.restore_tabs = val;
|
|
||||||
persistentStore.set('restore_tabs', state.restore_tabs);
|
|
||||||
},
|
|
||||||
SET_DISABLE_BLUR (state, val) {
|
|
||||||
state.disable_blur = val;
|
|
||||||
persistentStore.set('disable_blur', state.disable_blur);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
changeLocale ({ commit }, locale) {
|
|
||||||
commit('SET_LOCALE', locale);
|
|
||||||
},
|
|
||||||
changePageSize ({ commit }, limit) {
|
|
||||||
commit('SET_DATA_TAB_LIMIT', limit);
|
|
||||||
},
|
|
||||||
changeAllowPrerelease ({ commit }, allow) {
|
|
||||||
commit('SET_ALLOW_PRERELEASE', allow);
|
|
||||||
},
|
|
||||||
updateNotificationsTimeout ({ commit }, timeout) {
|
|
||||||
commit('SET_NOTIFICATIONS_TIMEOUT', timeout);
|
|
||||||
},
|
|
||||||
changeExplorebarSize ({ commit }, size) {
|
|
||||||
commit('SET_EXPLOREBAR_SIZE', size);
|
|
||||||
},
|
|
||||||
changeAutoComplete ({ commit }, val) {
|
|
||||||
commit('SET_AUTO_COMPLETE', val);
|
|
||||||
},
|
|
||||||
changeLineWrap ({ commit }, val) {
|
|
||||||
commit('SET_LINE_WRAP', val);
|
|
||||||
},
|
|
||||||
changeApplicationTheme ({ commit }, theme) {
|
|
||||||
commit('SET_APPLICATION_THEME', theme);
|
|
||||||
},
|
|
||||||
changeEditorTheme ({ commit }, theme) {
|
|
||||||
commit('SET_EDITOR_THEME', theme);
|
|
||||||
},
|
|
||||||
changeEditorFontSize ({ commit }, size) {
|
|
||||||
commit('SET_EDITOR_FONT_SIZE', size);
|
|
||||||
},
|
|
||||||
changeRestoreTabs ({ commit }, size) {
|
|
||||||
commit('SET_RESTORE_TABS', size);
|
|
||||||
},
|
|
||||||
changeDisableBlur ({ commit }, val) {
|
|
||||||
commit('SET_DISABLE_BLUR', val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
@ -1,727 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
import Store from 'electron-store';
|
|
||||||
import Connection from '@/ipc-api/Connection';
|
|
||||||
import Schema from '@/ipc-api/Schema';
|
|
||||||
import Users from '@/ipc-api/Users';
|
|
||||||
import { uidGen } from 'common/libs/uidGen';
|
|
||||||
const persistentStore = new Store({ name: 'tabs' });
|
|
||||||
const tabIndex = [];
|
|
||||||
|
|
||||||
export default {
|
|
||||||
namespaced: true,
|
|
||||||
strict: true,
|
|
||||||
state: {
|
|
||||||
workspaces: [],
|
|
||||||
selected_workspace: null
|
|
||||||
},
|
|
||||||
getters: {
|
|
||||||
getSelected: state => {
|
|
||||||
if (!state.workspaces.length) return 'NEW';
|
|
||||||
if (state.selected_workspace) return state.selected_workspace;
|
|
||||||
return state.workspaces[0].uid;
|
|
||||||
},
|
|
||||||
getWorkspace: state => uid => {
|
|
||||||
return state.workspaces.find(workspace => workspace.uid === uid);
|
|
||||||
},
|
|
||||||
getDatabaseVariable: state => (uid, name) => {
|
|
||||||
return state.workspaces.find(workspace => workspace.uid === uid).variables.find(variable => variable.name === name);
|
|
||||||
},
|
|
||||||
getWorkspaceTab: (state, getters) => tUid => {
|
|
||||||
if (!getters.getSelected) return;
|
|
||||||
const workspace = state.workspaces.find(workspace => workspace.uid === getters.getSelected);
|
|
||||||
if ('tabs' in workspace)
|
|
||||||
return workspace.tabs.find(tab => tab.uid === tUid);
|
|
||||||
return {};
|
|
||||||
},
|
|
||||||
getConnected: state => {
|
|
||||||
return state.workspaces
|
|
||||||
.filter(workspace => workspace.connectionStatus === 'connected')
|
|
||||||
.map(workspace => workspace.uid);
|
|
||||||
},
|
|
||||||
getLoadedSchemas: state => uid => {
|
|
||||||
return state.workspaces.find(workspace => workspace.uid === uid).loadedSchemas;
|
|
||||||
},
|
|
||||||
getSearchTerm: state => uid => {
|
|
||||||
return state.workspaces.find(workspace => workspace.uid === uid).searchTerm;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mutations: {
|
|
||||||
SELECT_WORKSPACE (state, uid) {
|
|
||||||
if (!uid)
|
|
||||||
state.selected_workspace = state.workspaces.length ? state.workspaces[0].uid : 'NEW';
|
|
||||||
else
|
|
||||||
state.selected_workspace = uid;
|
|
||||||
},
|
|
||||||
SET_CONNECTED (state, payload) {
|
|
||||||
const { uid, client, dataTypes, indexTypes, customizations, structure, version } = payload;
|
|
||||||
|
|
||||||
const cachedTabs = payload.restoreTabs ? persistentStore.get(uid, []) : [];
|
|
||||||
|
|
||||||
if (cachedTabs.length) {
|
|
||||||
tabIndex[uid] = cachedTabs.reduce((acc, curr) => {
|
|
||||||
if (curr.index > acc) acc = curr.index;
|
|
||||||
return acc;
|
|
||||||
}, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
state.workspaces = state.workspaces.map(workspace => workspace.uid === uid
|
|
||||||
? {
|
|
||||||
...workspace,
|
|
||||||
client,
|
|
||||||
dataTypes,
|
|
||||||
indexTypes,
|
|
||||||
customizations,
|
|
||||||
structure,
|
|
||||||
connectionStatus: 'connected',
|
|
||||||
tabs: cachedTabs,
|
|
||||||
selectedTab: cachedTabs.length ? cachedTabs[0].uid : null,
|
|
||||||
version
|
|
||||||
}
|
|
||||||
: workspace);
|
|
||||||
},
|
|
||||||
SET_CONNECTING (state, uid) {
|
|
||||||
state.workspaces = state.workspaces.map(workspace => workspace.uid === uid
|
|
||||||
? {
|
|
||||||
...workspace,
|
|
||||||
structure: {},
|
|
||||||
breadcrumbs: {},
|
|
||||||
loadedSchemas: new Set(),
|
|
||||||
connectionStatus: 'connecting'
|
|
||||||
}
|
|
||||||
: workspace);
|
|
||||||
},
|
|
||||||
SET_FAILED (state, uid) {
|
|
||||||
state.workspaces = state.workspaces.map(workspace => workspace.uid === uid
|
|
||||||
? {
|
|
||||||
...workspace,
|
|
||||||
structure: {},
|
|
||||||
breadcrumbs: {},
|
|
||||||
loadedSchemas: new Set(),
|
|
||||||
connectionStatus: 'failed'
|
|
||||||
}
|
|
||||||
: workspace);
|
|
||||||
},
|
|
||||||
SET_DISCONNECTED (state, uid) {
|
|
||||||
state.workspaces = state.workspaces.map(workspace => workspace.uid === uid
|
|
||||||
? {
|
|
||||||
...workspace,
|
|
||||||
structure: {},
|
|
||||||
breadcrumbs: {},
|
|
||||||
loadedSchemas: new Set(),
|
|
||||||
connectionStatus: 'disconnected'
|
|
||||||
}
|
|
||||||
: workspace);
|
|
||||||
},
|
|
||||||
REFRESH_STRUCTURE (state, { uid, structure }) {
|
|
||||||
state.workspaces = state.workspaces.map(workspace => workspace.uid === uid
|
|
||||||
? {
|
|
||||||
...workspace,
|
|
||||||
structure
|
|
||||||
}
|
|
||||||
: workspace);
|
|
||||||
},
|
|
||||||
REFRESH_SCHEMA (state, { uid, schema, schemaElements }) {
|
|
||||||
state.workspaces = state.workspaces.map(workspace => {
|
|
||||||
if (workspace.uid === uid) {
|
|
||||||
const schemaIndex = workspace.structure.findIndex(s => s.name === schema);
|
|
||||||
|
|
||||||
if (schemaIndex !== -1)
|
|
||||||
workspace.structure[schemaIndex] = schemaElements;
|
|
||||||
else
|
|
||||||
workspace.structure.push(schemaElements);
|
|
||||||
}
|
|
||||||
return workspace;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
REFRESH_COLLATIONS (state, { uid, collations }) {
|
|
||||||
state.workspaces = state.workspaces.map(workspace => workspace.uid === uid
|
|
||||||
? {
|
|
||||||
...workspace,
|
|
||||||
collations
|
|
||||||
}
|
|
||||||
: workspace);
|
|
||||||
},
|
|
||||||
REFRESH_VARIABLES (state, { uid, variables }) {
|
|
||||||
state.workspaces = state.workspaces.map(workspace => workspace.uid === uid
|
|
||||||
? {
|
|
||||||
...workspace,
|
|
||||||
variables
|
|
||||||
}
|
|
||||||
: workspace);
|
|
||||||
},
|
|
||||||
REFRESH_ENGINES (state, { uid, engines }) {
|
|
||||||
state.workspaces = state.workspaces.map(workspace => workspace.uid === uid
|
|
||||||
? {
|
|
||||||
...workspace,
|
|
||||||
engines
|
|
||||||
}
|
|
||||||
: workspace);
|
|
||||||
},
|
|
||||||
REFRESH_USERS (state, { uid, users }) {
|
|
||||||
state.workspaces = state.workspaces.map(workspace => workspace.uid === uid
|
|
||||||
? {
|
|
||||||
...workspace,
|
|
||||||
users
|
|
||||||
}
|
|
||||||
: workspace);
|
|
||||||
},
|
|
||||||
ADD_WORKSPACE (state, workspace) {
|
|
||||||
state.workspaces.push(workspace);
|
|
||||||
},
|
|
||||||
CHANGE_BREADCRUMBS (state, { uid, breadcrumbs }) {
|
|
||||||
state.workspaces = state.workspaces.map(workspace => workspace.uid === uid
|
|
||||||
? {
|
|
||||||
...workspace,
|
|
||||||
breadcrumbs
|
|
||||||
}
|
|
||||||
: workspace);
|
|
||||||
},
|
|
||||||
SET_SEARCH_TERM (state, { uid, term }) {
|
|
||||||
state.workspaces = state.workspaces.map(workspace => workspace.uid === uid
|
|
||||||
? {
|
|
||||||
...workspace,
|
|
||||||
searchTerm: term
|
|
||||||
}
|
|
||||||
: workspace);
|
|
||||||
},
|
|
||||||
NEW_TAB (state, { uid, tab, content, type, autorun, schema, elementName, elementType }) {
|
|
||||||
if (type === 'query')
|
|
||||||
tabIndex[uid] = tabIndex[uid] ? ++tabIndex[uid] : 1;
|
|
||||||
|
|
||||||
const newTab = {
|
|
||||||
uid: tab,
|
|
||||||
index: type === 'query' ? tabIndex[uid] : null,
|
|
||||||
selected: false,
|
|
||||||
type,
|
|
||||||
schema,
|
|
||||||
elementName,
|
|
||||||
elementType,
|
|
||||||
fields: [],
|
|
||||||
keyUsage: [],
|
|
||||||
content: content || '',
|
|
||||||
autorun: !!autorun
|
|
||||||
};
|
|
||||||
|
|
||||||
state.workspaces = state.workspaces.map(workspace => {
|
|
||||||
if (workspace.uid === uid) {
|
|
||||||
return {
|
|
||||||
...workspace,
|
|
||||||
tabs: [...workspace.tabs, newTab]
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return workspace;
|
|
||||||
});
|
|
||||||
|
|
||||||
persistentStore.set(uid, state.workspaces.find(workspace => workspace.uid === uid).tabs);
|
|
||||||
},
|
|
||||||
REMOVE_TAB (state, { uid, tab: tUid }) {
|
|
||||||
state.workspaces = state.workspaces.map(workspace => {
|
|
||||||
if (workspace.uid === uid) {
|
|
||||||
return {
|
|
||||||
...workspace,
|
|
||||||
tabs: workspace.tabs.filter(tab => tab.uid !== tUid)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return workspace;
|
|
||||||
});
|
|
||||||
|
|
||||||
persistentStore.set(uid, state.workspaces.find(workspace => workspace.uid === uid).tabs);
|
|
||||||
},
|
|
||||||
REMOVE_TABS (state, { uid, schema, elementName, elementType }) { // Multiple tabs based on schema and element name
|
|
||||||
if (elementType === 'procedure') elementType = 'routine'; // TODO: pass directly "routine"
|
|
||||||
|
|
||||||
state.workspaces = state.workspaces.map(workspace => {
|
|
||||||
if (workspace.uid === uid) {
|
|
||||||
return {
|
|
||||||
...workspace,
|
|
||||||
tabs: workspace.tabs.filter(tab =>
|
|
||||||
tab.schema !== schema ||
|
|
||||||
tab.elementName !== elementName ||
|
|
||||||
tab.elementType !== elementType
|
|
||||||
)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return workspace;
|
|
||||||
});
|
|
||||||
|
|
||||||
persistentStore.set(uid, state.workspaces.find(workspace => workspace.uid === uid).tabs);
|
|
||||||
},
|
|
||||||
REPLACE_TAB (state, { uid, tab: tUid, type, schema, content, elementName, elementType }) {
|
|
||||||
state.workspaces = state.workspaces.map(workspace => {
|
|
||||||
if (workspace.uid === uid) {
|
|
||||||
return {
|
|
||||||
...workspace,
|
|
||||||
tabs: workspace.tabs.map(tab => {
|
|
||||||
if (tab.uid === tUid)
|
|
||||||
return { ...tab, type, schema, content, elementName, elementType };
|
|
||||||
|
|
||||||
return tab;
|
|
||||||
})
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return workspace;
|
|
||||||
});
|
|
||||||
|
|
||||||
persistentStore.set(uid, state.workspaces.find(workspace => workspace.uid === uid).tabs);
|
|
||||||
},
|
|
||||||
RENAME_TABS (state, { uid, schema, elementName, elementNewName }) {
|
|
||||||
state.workspaces = state.workspaces.map(workspace => {
|
|
||||||
if (workspace.uid === uid) {
|
|
||||||
return {
|
|
||||||
...workspace,
|
|
||||||
tabs: workspace.tabs.map(tab => {
|
|
||||||
if (tab.elementName === elementName && tab.schema === schema) {
|
|
||||||
return {
|
|
||||||
...tab,
|
|
||||||
elementName: elementNewName
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return tab;
|
|
||||||
})
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return workspace;
|
|
||||||
});
|
|
||||||
|
|
||||||
persistentStore.set(uid, state.workspaces.find(workspace => workspace.uid === uid).tabs);
|
|
||||||
},
|
|
||||||
SELECT_TAB (state, { uid, tab }) {
|
|
||||||
state.workspaces = state.workspaces.map(workspace => workspace.uid === uid ? { ...workspace, selectedTab: tab } : workspace);
|
|
||||||
},
|
|
||||||
UPDATE_TABS (state, { uid, tabs }) {
|
|
||||||
state.workspaces = state.workspaces.map(workspace => workspace.uid === uid ? { ...workspace, tabs } : workspace);
|
|
||||||
persistentStore.set(uid, state.workspaces.find(workspace => workspace.uid === uid).tabs);
|
|
||||||
},
|
|
||||||
SET_TAB_FIELDS (state, { cUid, tUid, fields }) {
|
|
||||||
state.workspaces = state.workspaces.map(workspace => {
|
|
||||||
if (workspace.uid === cUid) {
|
|
||||||
return {
|
|
||||||
...workspace,
|
|
||||||
tabs: workspace.tabs.map(tab => {
|
|
||||||
if (tab.uid === tUid)
|
|
||||||
return { ...tab, fields };
|
|
||||||
else
|
|
||||||
return tab;
|
|
||||||
})
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return workspace;
|
|
||||||
});
|
|
||||||
|
|
||||||
persistentStore.set(uid, state.workspaces.find(workspace => workspace.uid === uid).tabs);
|
|
||||||
},
|
|
||||||
SET_TAB_KEY_USAGE (state, { cUid, tUid, keyUsage }) {
|
|
||||||
state.workspaces = state.workspaces.map(workspace => {
|
|
||||||
if (workspace.uid === cUid) {
|
|
||||||
return {
|
|
||||||
...workspace,
|
|
||||||
tabs: workspace.tabs.map(tab => {
|
|
||||||
if (tab.uid === tUid)
|
|
||||||
return { ...tab, keyUsage };
|
|
||||||
else
|
|
||||||
return tab;
|
|
||||||
})
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return workspace;
|
|
||||||
});
|
|
||||||
|
|
||||||
persistentStore.set(uid, state.workspaces.find(workspace => workspace.uid === uid).tabs);
|
|
||||||
},
|
|
||||||
SET_UNSAVED_CHANGES (state, { uid, tUid, isChanged }) {
|
|
||||||
state.workspaces = state.workspaces.map(workspace => {
|
|
||||||
if (workspace.uid === uid) {
|
|
||||||
return {
|
|
||||||
...workspace,
|
|
||||||
tabs: workspace.tabs.map(tab => {
|
|
||||||
if (tab.uid === tUid)
|
|
||||||
return { ...tab, isChanged };
|
|
||||||
|
|
||||||
return tab;
|
|
||||||
})
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return workspace;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
ADD_LOADED_SCHEMA (state, payload) {
|
|
||||||
state.workspaces = state.workspaces.map(workspace => {
|
|
||||||
if (workspace.uid === payload.uid)
|
|
||||||
workspace.loadedSchemas.add(payload.schema);
|
|
||||||
return workspace;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
ADD_LOADING_ELEMENT (state, payload) {
|
|
||||||
state.workspaces = state.workspaces.map(workspace => {
|
|
||||||
if (workspace.uid === payload.uid)
|
|
||||||
workspace.loadingElements.push(payload.element);
|
|
||||||
return workspace;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
REMOVE_LOADING_ELEMENT (state, payload) {
|
|
||||||
state.workspaces = state.workspaces.map(workspace => {
|
|
||||||
if (workspace.uid === payload.uid) {
|
|
||||||
const loadingElements = workspace.loadingElements.filter(el =>
|
|
||||||
el.schema !== payload.element.schema &&
|
|
||||||
el.name !== payload.element.name &&
|
|
||||||
el.type !== payload.element.type
|
|
||||||
);
|
|
||||||
|
|
||||||
workspace = { ...workspace, loadingElements };
|
|
||||||
}
|
|
||||||
return workspace;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
selectWorkspace ({ commit }, uid) {
|
|
||||||
commit('SELECT_WORKSPACE', uid);
|
|
||||||
},
|
|
||||||
async connectWorkspace ({ dispatch, commit, rootGetters }, connection) {
|
|
||||||
commit('SET_CONNECTING', connection.uid);
|
|
||||||
|
|
||||||
try {
|
|
||||||
const { status, response } = await Connection.connect(connection);
|
|
||||||
if (status === 'error') {
|
|
||||||
dispatch('notifications/addNotification', { status, message: response }, { root: true });
|
|
||||||
commit('SET_FAILED', connection.uid);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
let dataTypes = [];
|
|
||||||
let indexTypes = [];
|
|
||||||
let customizations = {};
|
|
||||||
|
|
||||||
switch (connection.client) {
|
|
||||||
case 'mysql':
|
|
||||||
case 'maria':
|
|
||||||
dataTypes = require('common/data-types/mysql');
|
|
||||||
indexTypes = require('common/index-types/mysql');
|
|
||||||
customizations = require('common/customizations/mysql');
|
|
||||||
break;
|
|
||||||
case 'pg':
|
|
||||||
dataTypes = require('common/data-types/postgresql');
|
|
||||||
indexTypes = require('common/index-types/postgresql');
|
|
||||||
customizations = require('common/customizations/postgresql');
|
|
||||||
break;
|
|
||||||
case 'sqlite':
|
|
||||||
dataTypes = require('common/data-types/sqlite');
|
|
||||||
indexTypes = require('common/index-types/sqlite');
|
|
||||||
customizations = require('common/customizations/sqlite');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { status, response: version } = await Schema.getVersion(connection.uid);
|
|
||||||
|
|
||||||
if (status === 'error')
|
|
||||||
dispatch('notifications/addNotification', { status, message: version }, { root: true });
|
|
||||||
|
|
||||||
// Check if Maria or MySQL
|
|
||||||
const isMySQL = version.name.includes('MySQL');
|
|
||||||
|
|
||||||
if (isMySQL && connection.client !== 'mysql') {
|
|
||||||
const connProxy = Object.assign({}, connection);
|
|
||||||
connProxy.client = 'mysql';
|
|
||||||
dispatch('connections/editConnection', connProxy, { root: true });
|
|
||||||
}
|
|
||||||
else if (!isMySQL && connection.client === 'mysql') {
|
|
||||||
const connProxy = Object.assign({}, connection);
|
|
||||||
connProxy.client = 'maria';
|
|
||||||
dispatch('connections/editConnection', connProxy, { root: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
commit('SET_CONNECTED', {
|
|
||||||
uid: connection.uid,
|
|
||||||
client: connection.client,
|
|
||||||
dataTypes,
|
|
||||||
indexTypes,
|
|
||||||
customizations,
|
|
||||||
structure: response,
|
|
||||||
version,
|
|
||||||
restoreTabs: rootGetters['settings/getRestoreTabs']
|
|
||||||
});
|
|
||||||
dispatch('refreshCollations', connection.uid);
|
|
||||||
dispatch('refreshVariables', connection.uid);
|
|
||||||
dispatch('refreshEngines', connection.uid);
|
|
||||||
dispatch('refreshUsers', connection.uid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
dispatch('notifications/addNotification', { status: 'error', message: err.stack }, { root: true });
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async refreshStructure ({ dispatch, commit, getters }, uid) {
|
|
||||||
try {
|
|
||||||
const { status, response } = await Schema.getStructure({ uid, schemas: getters.getLoadedSchemas(uid) });
|
|
||||||
|
|
||||||
if (status === 'error')
|
|
||||||
dispatch('notifications/addNotification', { status, message: response }, { root: true });
|
|
||||||
else
|
|
||||||
commit('REFRESH_STRUCTURE', { uid, structure: response });
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
dispatch('notifications/addNotification', { status: 'error', message: err.stack }, { root: true });
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async refreshSchema ({ dispatch, commit }, { uid, schema }) {
|
|
||||||
try {
|
|
||||||
const { status, response } = await Schema.getStructure({ uid, schemas: new Set([schema]) });
|
|
||||||
if (status === 'error')
|
|
||||||
dispatch('notifications/addNotification', { status, message: response }, { root: true });
|
|
||||||
else
|
|
||||||
commit('REFRESH_SCHEMA', { uid, schema, schemaElements: response.find(_schema => _schema.name === schema) });
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
dispatch('notifications/addNotification', { status: 'error', message: err.stack }, { root: true });
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async refreshCollations ({ dispatch, commit }, uid) {
|
|
||||||
try {
|
|
||||||
const { status, response } = await Schema.getCollations(uid);
|
|
||||||
if (status === 'error')
|
|
||||||
dispatch('notifications/addNotification', { status, message: response }, { root: true });
|
|
||||||
else
|
|
||||||
commit('REFRESH_COLLATIONS', { uid, collations: response });
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
dispatch('notifications/addNotification', { status: 'error', message: err.stack }, { root: true });
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async refreshVariables ({ dispatch, commit }, uid) {
|
|
||||||
try {
|
|
||||||
const { status, response } = await Schema.getVariables(uid);
|
|
||||||
if (status === 'error')
|
|
||||||
dispatch('notifications/addNotification', { status, message: response }, { root: true });
|
|
||||||
else
|
|
||||||
commit('REFRESH_VARIABLES', { uid, variables: response });
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
dispatch('notifications/addNotification', { status: 'error', message: err.stack }, { root: true });
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async refreshEngines ({ dispatch, commit }, uid) {
|
|
||||||
try {
|
|
||||||
const { status, response } = await Schema.getEngines(uid);
|
|
||||||
if (status === 'error')
|
|
||||||
dispatch('notifications/addNotification', { status, message: response }, { root: true });
|
|
||||||
else
|
|
||||||
commit('REFRESH_ENGINES', { uid, engines: response });
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
dispatch('notifications/addNotification', { status: 'error', message: err.stack }, { root: true });
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async refreshUsers ({ dispatch, commit }, uid) {
|
|
||||||
try {
|
|
||||||
const { status, response } = await Users.getUsers(uid);
|
|
||||||
if (status === 'error')
|
|
||||||
dispatch('notifications/addNotification', { status, message: response }, { root: true });
|
|
||||||
else
|
|
||||||
commit('REFRESH_USERS', { uid, users: response });
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
dispatch('notifications/addNotification', { status: 'error', message: err.stack }, { root: true });
|
|
||||||
}
|
|
||||||
},
|
|
||||||
removeConnected ({ commit }, uid) {
|
|
||||||
Connection.disconnect(uid);
|
|
||||||
commit('SET_DISCONNECTED', uid);
|
|
||||||
commit('SELECT_TAB', { uid, tab: 0 });
|
|
||||||
},
|
|
||||||
async addWorkspace ({ commit }, uid) {
|
|
||||||
const workspace = {
|
|
||||||
uid,
|
|
||||||
connectionStatus: 'disconnected',
|
|
||||||
selectedTab: 0,
|
|
||||||
searchTerm: '',
|
|
||||||
tabs: [],
|
|
||||||
structure: {},
|
|
||||||
variables: [],
|
|
||||||
collations: [],
|
|
||||||
users: [],
|
|
||||||
breadcrumbs: {},
|
|
||||||
loadingElements: [],
|
|
||||||
loadedSchemas: new Set()
|
|
||||||
};
|
|
||||||
|
|
||||||
await commit('ADD_WORKSPACE', workspace);
|
|
||||||
},
|
|
||||||
changeBreadcrumbs ({ commit, getters }, payload) {
|
|
||||||
const breadcrumbsObj = {
|
|
||||||
schema: null,
|
|
||||||
table: null,
|
|
||||||
trigger: null,
|
|
||||||
triggerFunction: null,
|
|
||||||
procedure: null,
|
|
||||||
function: null,
|
|
||||||
scheduler: null,
|
|
||||||
view: null,
|
|
||||||
query: null
|
|
||||||
};
|
|
||||||
|
|
||||||
commit('CHANGE_BREADCRUMBS', { uid: getters.getSelected, breadcrumbs: { ...breadcrumbsObj, ...payload } });
|
|
||||||
},
|
|
||||||
addLoadedSchema ({ commit, getters }, schema) {
|
|
||||||
commit('ADD_LOADED_SCHEMA', { uid: getters.getSelected, schema });
|
|
||||||
},
|
|
||||||
addLoadingElement ({ commit, getters }, element) {
|
|
||||||
commit('ADD_LOADING_ELEMENT', { uid: getters.getSelected, element });
|
|
||||||
},
|
|
||||||
removeLoadingElement ({ commit, getters }, element) {
|
|
||||||
commit('REMOVE_LOADING_ELEMENT', { uid: getters.getSelected, element });
|
|
||||||
},
|
|
||||||
setSearchTerm ({ commit, getters }, term) {
|
|
||||||
commit('SET_SEARCH_TERM', { uid: getters.getSelected, term });
|
|
||||||
},
|
|
||||||
newTab ({ state, commit }, { uid, content, type, autorun, schema, elementName, elementType }) {
|
|
||||||
let tabUid;
|
|
||||||
const workspaceTabs = state.workspaces.find(workspace => workspace.uid === uid);
|
|
||||||
|
|
||||||
switch (type) {
|
|
||||||
case 'new-table':
|
|
||||||
case 'new-trigger':
|
|
||||||
case 'new-trigger-function':
|
|
||||||
case 'new-function':
|
|
||||||
case 'new-routine':
|
|
||||||
case 'new-scheduler':
|
|
||||||
tabUid = uidGen('T');
|
|
||||||
commit('NEW_TAB', {
|
|
||||||
uid,
|
|
||||||
tab: tabUid,
|
|
||||||
content,
|
|
||||||
type,
|
|
||||||
autorun,
|
|
||||||
schema,
|
|
||||||
elementName,
|
|
||||||
elementType
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case 'temp-data':
|
|
||||||
case 'temp-trigger-props':
|
|
||||||
case 'temp-trigger-function-props':
|
|
||||||
case 'temp-function-props':
|
|
||||||
case 'temp-routine-props':
|
|
||||||
case 'temp-scheduler-props': {
|
|
||||||
const existentTab = workspaceTabs
|
|
||||||
? workspaceTabs.tabs.find(tab =>
|
|
||||||
tab.schema === schema &&
|
|
||||||
tab.elementName === elementName &&
|
|
||||||
tab.elementType === elementType &&
|
|
||||||
[type, type.replace('temp-', '')].includes(tab.type))
|
|
||||||
: false;
|
|
||||||
|
|
||||||
if (existentTab) { // if tab exists
|
|
||||||
tabUid = existentTab.uid;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
const tempTabs = workspaceTabs ? workspaceTabs.tabs.filter(tab => tab.type.includes('temp-')) : false;
|
|
||||||
|
|
||||||
if (tempTabs && tempTabs.length) { // if temp tab already opened
|
|
||||||
for (const tab of tempTabs) {
|
|
||||||
if (tab.isChanged) {
|
|
||||||
commit('REPLACE_TAB', { // make permanent a temp table with unsaved changes
|
|
||||||
uid,
|
|
||||||
tab: tab.uid,
|
|
||||||
type: tab.type.replace('temp-', ''),
|
|
||||||
schema: tab.schema,
|
|
||||||
elementName: tab.elementName,
|
|
||||||
elementType: tab.elementType
|
|
||||||
});
|
|
||||||
|
|
||||||
tabUid = uidGen('T');
|
|
||||||
commit('NEW_TAB', { uid, tab: tabUid, content, type, autorun, schema, elementName, elementType });
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
commit('REPLACE_TAB', { uid, tab: tab.uid, type, schema, elementName, elementType });
|
|
||||||
tabUid = tab.uid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tabUid = uidGen('T');
|
|
||||||
commit('NEW_TAB', { uid, tab: tabUid, content, type, autorun, schema, elementName, elementType });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'data':
|
|
||||||
case 'table-props':
|
|
||||||
case 'trigger-props':
|
|
||||||
case 'trigger-function-props':
|
|
||||||
case 'function-props':
|
|
||||||
case 'routine-props':
|
|
||||||
case 'scheduler-props': {
|
|
||||||
const existentTab = workspaceTabs
|
|
||||||
? workspaceTabs.tabs.find(tab =>
|
|
||||||
tab.schema === schema &&
|
|
||||||
tab.elementName === elementName &&
|
|
||||||
tab.elementType === elementType &&
|
|
||||||
[`temp-${type}`, type].includes(tab.type))
|
|
||||||
: false;
|
|
||||||
|
|
||||||
if (existentTab) {
|
|
||||||
commit('REPLACE_TAB', { uid, tab: existentTab.uid, type, schema, elementName, elementType });
|
|
||||||
tabUid = existentTab.uid;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tabUid = uidGen('T');
|
|
||||||
commit('NEW_TAB', { uid, tab: tabUid, content, type, autorun, schema, elementName, elementType });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
tabUid = uidGen('T');
|
|
||||||
commit('NEW_TAB', { uid, tab: tabUid, content, type, autorun, schema, elementName, elementType });
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
commit('SELECT_TAB', { uid, tab: tabUid });
|
|
||||||
},
|
|
||||||
checkSelectedTabExists ({ state, commit }, uid) {
|
|
||||||
const workspace = state.workspaces.find(workspace => workspace.uid === uid);
|
|
||||||
const isSelectedExistent = workspace
|
|
||||||
? workspace.tabs.some(tab => tab.uid === workspace.selectedTab)
|
|
||||||
: false;
|
|
||||||
|
|
||||||
if (!isSelectedExistent && workspace.tabs.length)
|
|
||||||
commit('SELECT_TAB', { uid, tab: workspace.tabs[workspace.tabs.length - 1].uid });
|
|
||||||
},
|
|
||||||
updateTabContent ({ commit }, { uid, tab, type, schema, content }) {
|
|
||||||
commit('REPLACE_TAB', { uid, tab, type, schema, content });
|
|
||||||
},
|
|
||||||
renameTabs ({ commit }, payload) {
|
|
||||||
commit('RENAME_TABS', payload);
|
|
||||||
},
|
|
||||||
removeTab ({ commit, dispatch }, payload) {
|
|
||||||
commit('REMOVE_TAB', payload);
|
|
||||||
dispatch('checkSelectedTabExists', payload.uid);
|
|
||||||
},
|
|
||||||
removeTabs ({ commit, dispatch }, payload) {
|
|
||||||
commit('REMOVE_TABS', payload);
|
|
||||||
dispatch('checkSelectedTabExists', payload.uid);
|
|
||||||
},
|
|
||||||
selectTab ({ commit }, payload) {
|
|
||||||
commit('SELECT_TAB', payload);
|
|
||||||
},
|
|
||||||
updateTabs ({ commit }, payload) {
|
|
||||||
commit('UPDATE_TABS', payload);
|
|
||||||
},
|
|
||||||
setTabFields ({ commit }, payload) {
|
|
||||||
commit('SET_TAB_FIELDS', payload);
|
|
||||||
},
|
|
||||||
setTabKeyUsage ({ commit }, payload) {
|
|
||||||
commit('SET_TAB_KEY_USAGE', payload);
|
|
||||||
},
|
|
||||||
setUnsavedChanges ({ commit }, payload) {
|
|
||||||
commit('SET_UNSAVED_CHANGES', payload);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
@ -1,7 +0,0 @@
|
|||||||
import { ipcRenderer } from 'electron';
|
|
||||||
|
|
||||||
export default store => {
|
|
||||||
ipcRenderer.on('unhandled-exception', (event, error) => {
|
|
||||||
store.dispatch('notifications/addNotification', { status: 'error', message: error.message });
|
|
||||||
});
|
|
||||||
};
|
|
@ -1,12 +0,0 @@
|
|||||||
import { ipcRenderer } from 'electron';
|
|
||||||
|
|
||||||
export default store => {
|
|
||||||
ipcRenderer.on('toggle-preferences', () => {
|
|
||||||
store.dispatch('application/showSettingModal', 'general');
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcRenderer.on('open-updates-preferences', () => {
|
|
||||||
store.dispatch('application/showSettingModal', 'update');
|
|
||||||
ipcRenderer.send('check-for-updates');
|
|
||||||
});
|
|
||||||
};
|
|
@ -1,36 +0,0 @@
|
|||||||
import { ipcRenderer } from 'electron';
|
|
||||||
|
|
||||||
export default store => {
|
|
||||||
ipcRenderer.on('checking-for-update', () => {
|
|
||||||
store.commit('application/CHANGE_UPDATE_STATUS', 'checking');
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcRenderer.on('update-available', () => {
|
|
||||||
store.commit('application/CHANGE_UPDATE_STATUS', 'available');
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcRenderer.on('update-not-available', () => {
|
|
||||||
store.commit('application/CHANGE_UPDATE_STATUS', 'noupdate');
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcRenderer.on('check-failed', () => {
|
|
||||||
store.commit('application/CHANGE_UPDATE_STATUS', 'nocheck');
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcRenderer.on('no-auto-update', () => {
|
|
||||||
store.commit('application/CHANGE_UPDATE_STATUS', 'disabled');
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcRenderer.on('download-progress', (event, data) => {
|
|
||||||
store.commit('application/CHANGE_UPDATE_STATUS', 'downloading');
|
|
||||||
store.commit('application/CHANGE_PROGRESS_PERCENTAGE', data.percent);
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcRenderer.on('update-downloaded', () => {
|
|
||||||
store.commit('application/CHANGE_UPDATE_STATUS', 'downloaded');
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcRenderer.on('link-to-download', () => {
|
|
||||||
store.commit('application/CHANGE_UPDATE_STATUS', 'link');
|
|
||||||
});
|
|
||||||
};
|
|
70
src/renderer/stores/connections.js
Normal file
70
src/renderer/stores/connections.js
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
import { defineStore, acceptHMRUpdate } from 'pinia';
|
||||||
|
import Store from 'electron-store';
|
||||||
|
import crypto from 'crypto';
|
||||||
|
const key = localStorage.getItem('key');
|
||||||
|
|
||||||
|
if (!key)
|
||||||
|
localStorage.setItem('key', crypto.randomBytes(16).toString('hex'));
|
||||||
|
else
|
||||||
|
localStorage.setItem('key', key);
|
||||||
|
|
||||||
|
const persistentStore = new Store({
|
||||||
|
name: 'connections',
|
||||||
|
encryptionKey: key,
|
||||||
|
clearInvalidConfig: true
|
||||||
|
});
|
||||||
|
|
||||||
|
export const useConnectionsStore = defineStore('connections', {
|
||||||
|
state: () => ({
|
||||||
|
connections: persistentStore.get('connections', [])
|
||||||
|
}),
|
||||||
|
getters: {
|
||||||
|
getConnectionName: state => uid => {
|
||||||
|
const connection = state.connections.filter(connection => connection.uid === uid)[0];
|
||||||
|
let connectionName = '';
|
||||||
|
|
||||||
|
if (connection.name)
|
||||||
|
connectionName = connection.name;
|
||||||
|
else if (connection.ask)
|
||||||
|
connectionName = `${connection.host}:${connection.port}`;
|
||||||
|
else if (connection.databasePath) {
|
||||||
|
let string = connection.databasePath.split(/[/\\]+/).pop();
|
||||||
|
|
||||||
|
if (string.length >= 30)
|
||||||
|
string = `...${string.slice(-30)}`;
|
||||||
|
|
||||||
|
connectionName = string;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
connectionName = `${connection.user + '@'}${connection.host}:${connection.port}`;
|
||||||
|
|
||||||
|
return connectionName;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
addConnection (connection) {
|
||||||
|
this.connections.push(connection);
|
||||||
|
persistentStore.set('connections', this.connections);
|
||||||
|
},
|
||||||
|
deleteConnection (connection) {
|
||||||
|
this.connections = this.connections.filter(el => el.uid !== connection.uid);
|
||||||
|
persistentStore.set('connections', this.connections);
|
||||||
|
},
|
||||||
|
editConnection (connection) {
|
||||||
|
const editedConnections = this.connections.map(conn => {
|
||||||
|
if (conn.uid === connection.uid) return connection;
|
||||||
|
return conn;
|
||||||
|
});
|
||||||
|
this.connections = editedConnections;
|
||||||
|
this.selected_conection = {};
|
||||||
|
persistentStore.set('connections', this.connections);
|
||||||
|
},
|
||||||
|
updateConnections (connections) {
|
||||||
|
this.connections = connections;
|
||||||
|
persistentStore.set('connections', this.connections);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (import.meta.webpackHot)
|
||||||
|
import.meta.webpackHot.accept(acceptHMRUpdate(useConnectionsStore, import.meta.webpackHot));
|
48
src/renderer/stores/history.js
Normal file
48
src/renderer/stores/history.js
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
import { defineStore, acceptHMRUpdate } from 'pinia';
|
||||||
|
import Store from 'electron-store';
|
||||||
|
import { uidGen } from 'common/libs/uidGen';
|
||||||
|
const persistentStore = new Store({ name: 'history' });
|
||||||
|
const historySize = 1000;
|
||||||
|
|
||||||
|
export const useHistoryStore = defineStore('history', {
|
||||||
|
state: () => ({
|
||||||
|
history: persistentStore.get('history', {}),
|
||||||
|
favorites: persistentStore.get('favorites', {})
|
||||||
|
}),
|
||||||
|
getters: {
|
||||||
|
getHistoryByWorkspace: state => uid => state.history[uid]
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
saveHistory (args) {
|
||||||
|
if (this.getHistoryByWorkspace(args.uid) &&
|
||||||
|
this.getHistoryByWorkspace(args.uid).length &&
|
||||||
|
this.getHistoryByWorkspace(args.uid)[0].sql === args.query
|
||||||
|
) return;
|
||||||
|
|
||||||
|
if (!(args.uid in this.history))
|
||||||
|
this.history[args.uid] = [];
|
||||||
|
|
||||||
|
this.history[args.uid] = [
|
||||||
|
{
|
||||||
|
uid: uidGen('H'),
|
||||||
|
sql: args.query,
|
||||||
|
date: new Date(),
|
||||||
|
schema: args.schema
|
||||||
|
},
|
||||||
|
...this.history[args.uid]
|
||||||
|
];
|
||||||
|
|
||||||
|
if (this.history[args.uid].length > historySize)
|
||||||
|
this.history[args.uid] = this.history[args.uid].slice(0, historySize);
|
||||||
|
|
||||||
|
persistentStore.set('history', this.history);
|
||||||
|
},
|
||||||
|
deleteQueryFromHistory (query) {
|
||||||
|
this.history[query.workspace] = this.history[query.workspace].filter(q => q.uid !== query.uid);
|
||||||
|
persistentStore.set('history', this.history);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (import.meta.webpackHot)
|
||||||
|
import.meta.webpackHot.accept(acceptHMRUpdate(useHistoryStore, import.meta.webpackHot));
|
@ -2,10 +2,12 @@
|
|||||||
import { createPinia } from 'pinia';
|
import { createPinia } from 'pinia';
|
||||||
import { ipcUpdates } from './plugins/ipcUpdates';
|
import { ipcUpdates } from './plugins/ipcUpdates';
|
||||||
import { ipcShortcuts } from './plugins/ipcShortcuts';
|
import { ipcShortcuts } from './plugins/ipcShortcuts';
|
||||||
|
import { ipcExceptions } from './plugins/ipcExceptions';
|
||||||
|
|
||||||
const pinia = createPinia();
|
const pinia = createPinia();
|
||||||
pinia
|
pinia
|
||||||
.use(ipcUpdates)
|
.use(ipcUpdates)
|
||||||
.use(ipcShortcuts);
|
.use(ipcShortcuts)
|
||||||
|
.use(ipcExceptions);
|
||||||
|
|
||||||
export { pinia };
|
export { pinia };
|
||||||
|
20
src/renderer/stores/notifications.js
Normal file
20
src/renderer/stores/notifications.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { defineStore, acceptHMRUpdate } from 'pinia';
|
||||||
|
import { uidGen } from 'common/libs/uidGen';
|
||||||
|
|
||||||
|
export const useNotificationsStore = defineStore('notifications', {
|
||||||
|
state: () => ({
|
||||||
|
notifications: []
|
||||||
|
}),
|
||||||
|
actions: {
|
||||||
|
addNotification (payload) {
|
||||||
|
payload.uid = uidGen('N');
|
||||||
|
this.notifications.unshift(payload);
|
||||||
|
},
|
||||||
|
removeNotification (uid) {
|
||||||
|
this.notifications = this.notifications.filter(item => item.uid !== uid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (import.meta.webpackHot)
|
||||||
|
import.meta.webpackHot.accept(acceptHMRUpdate(useNotificationsStore, import.meta.webpackHot));
|
7
src/renderer/stores/plugins/ipcExceptions.js
Normal file
7
src/renderer/stores/plugins/ipcExceptions.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { ipcRenderer } from 'electron';
|
||||||
|
|
||||||
|
export function ipcExceptions ({ store }) {
|
||||||
|
ipcRenderer.on('unhandled-exception', (event, error) => {
|
||||||
|
store.notifications.addNotification({ status: 'error', message: error.message });
|
||||||
|
});
|
||||||
|
}
|
@ -1,25 +1,18 @@
|
|||||||
'use strict';
|
import { defineStore, acceptHMRUpdate } from 'pinia';
|
||||||
import Store from 'electron-store';
|
import Store from 'electron-store';
|
||||||
const persistentStore = new Store({ name: 'notes' });
|
const persistentStore = new Store({ name: 'notes' });
|
||||||
|
|
||||||
export default {
|
export const useScratchpadStore = defineStore('scratchpad', {
|
||||||
namespaced: true,
|
state: () => ({
|
||||||
strict: true,
|
|
||||||
state: {
|
|
||||||
notes: persistentStore.get('notes', '# HOW TO SUPPORT ANTARES\n\n- [ ] Leave a star to Antares [GitHub repo](https://github.com/antares-sql/antares)\n- [ ] Send feedbacks and advices\n- [ ] Report for bugs\n- [ ] If you enjoy, share Antares with friends\n\n# ABOUT SCRATCHPAD\n\nThis is a scratchpad where you can save your **personal notes**. It supports `markdown` format, but you are free to use plain text.\nThis content is just a placeholder, feel free to clear it to make space for your notes.\n')
|
notes: persistentStore.get('notes', '# HOW TO SUPPORT ANTARES\n\n- [ ] Leave a star to Antares [GitHub repo](https://github.com/antares-sql/antares)\n- [ ] Send feedbacks and advices\n- [ ] Report for bugs\n- [ ] If you enjoy, share Antares with friends\n\n# ABOUT SCRATCHPAD\n\nThis is a scratchpad where you can save your **personal notes**. It supports `markdown` format, but you are free to use plain text.\nThis content is just a placeholder, feel free to clear it to make space for your notes.\n')
|
||||||
},
|
}),
|
||||||
getters: {
|
|
||||||
getNotes: state => state.notes
|
|
||||||
},
|
|
||||||
mutations: {
|
|
||||||
SET_NOTES (state, notes) {
|
|
||||||
state.notes = notes;
|
|
||||||
persistentStore.set('notes', state.notes);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
actions: {
|
actions: {
|
||||||
changeNotes ({ commit }, notes) {
|
changeNotes (notes) {
|
||||||
commit('SET_NOTES', notes);
|
this.notes = notes;
|
||||||
|
persistentStore.set('notes', this.notes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
|
if (import.meta.webpackHot)
|
||||||
|
import.meta.webpackHot.accept(acceptHMRUpdate(useScratchpadStore, import.meta.webpackHot));
|
78
src/renderer/stores/settings.js
Normal file
78
src/renderer/stores/settings.js
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
import { defineStore, acceptHMRUpdate } from 'pinia';
|
||||||
|
import i18n from '@/i18n';
|
||||||
|
import Store from 'electron-store';
|
||||||
|
const persistentStore = new Store({ name: 'settings' });
|
||||||
|
const isDarkTheme = window.matchMedia('(prefers-color-scheme: dark)');
|
||||||
|
const defaultAppTheme = isDarkTheme.matches ? 'dark' : 'light';
|
||||||
|
const defaultEditorTheme = isDarkTheme.matches ? 'twilight' : 'sqlserver';
|
||||||
|
|
||||||
|
export const useSettingsStore = defineStore('settings', {
|
||||||
|
state: () => ({
|
||||||
|
locale: persistentStore.get('locale', 'en-US'),
|
||||||
|
allowPrerelease: persistentStore.get('allow_prerelease', true),
|
||||||
|
explorebarSize: persistentStore.get('explorebar_size', null),
|
||||||
|
notificationsTimeout: persistentStore.get('notifications_timeout', 5),
|
||||||
|
dataTabLimit: persistentStore.get('data_tab_limit', 1000),
|
||||||
|
autoComplete: persistentStore.get('auto_complete', true),
|
||||||
|
lineWrap: persistentStore.get('line_wrap', true),
|
||||||
|
applicationTheme: persistentStore.get('application_theme', defaultAppTheme),
|
||||||
|
editorTheme: persistentStore.get('editor_theme', defaultEditorTheme),
|
||||||
|
editorFontSize: persistentStore.get('editor_font_size', 'medium'),
|
||||||
|
restoreTabs: persistentStore.get('restore_tabs', true),
|
||||||
|
disableBlur: persistentStore.get('disable_blur', false)
|
||||||
|
}),
|
||||||
|
actions: {
|
||||||
|
changeLocale (locale) {
|
||||||
|
this.locale = locale;
|
||||||
|
i18n.global.locale = locale;
|
||||||
|
persistentStore.set('locale', this.locale);
|
||||||
|
},
|
||||||
|
changePageSize (limit) {
|
||||||
|
this.dataTabLimit = limit;
|
||||||
|
persistentStore.set('data_tab_limit', this.dataTabLimit);
|
||||||
|
},
|
||||||
|
changeAllowPrerelease (allow) {
|
||||||
|
this.allowPrerelease = allow;
|
||||||
|
persistentStore.set('allow_prerelease', this.allowPrerelease);
|
||||||
|
},
|
||||||
|
updateNotificationsTimeout (timeout) {
|
||||||
|
this.notificationsTimeout = timeout;
|
||||||
|
persistentStore.set('notifications_timeout', this.notificationsTimeout);
|
||||||
|
},
|
||||||
|
changeExplorebarSize (size) {
|
||||||
|
this.explorebarSize = size;
|
||||||
|
persistentStore.set('explorebar_size', this.explorebarSize);
|
||||||
|
},
|
||||||
|
changeAutoComplete (val) {
|
||||||
|
this.autoComplete = val;
|
||||||
|
persistentStore.set('auto_complete', this.autoComplete);
|
||||||
|
},
|
||||||
|
changeLineWrap (val) {
|
||||||
|
this.lineWrap = val;
|
||||||
|
persistentStore.set('line_wrap', this.lineWrap);
|
||||||
|
},
|
||||||
|
changeApplicationTheme (theme) {
|
||||||
|
this.applicationTheme = theme;
|
||||||
|
persistentStore.set('application_theme', this.applicationTheme);
|
||||||
|
},
|
||||||
|
changeEditorTheme (theme) {
|
||||||
|
this.editorTheme = theme;
|
||||||
|
persistentStore.set('editor_theme', this.editorTheme);
|
||||||
|
},
|
||||||
|
changeEditorFontSize (size) {
|
||||||
|
this.editorFontSize = size;
|
||||||
|
persistentStore.set('editor_font_size', this.editorFontSize);
|
||||||
|
},
|
||||||
|
changeRestoreTabs (val) {
|
||||||
|
this.restoreTabs = val;
|
||||||
|
persistentStore.set('restore_tabs', this.restoreTabs);
|
||||||
|
},
|
||||||
|
changeDisableBlur (val) {
|
||||||
|
this.disableBlur = val;
|
||||||
|
persistentStore.set('disable_blur', this.disableBlur);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (import.meta.webpackHot)
|
||||||
|
import.meta.webpackHot.accept(acceptHMRUpdate(useSettingsStore, import.meta.webpackHot));
|
678
src/renderer/stores/workspaces.js
Normal file
678
src/renderer/stores/workspaces.js
Normal file
@ -0,0 +1,678 @@
|
|||||||
|
import { defineStore, acceptHMRUpdate } from 'pinia';
|
||||||
|
import Store from 'electron-store';
|
||||||
|
import Connection from '@/ipc-api/Connection';
|
||||||
|
import Schema from '@/ipc-api/Schema';
|
||||||
|
import Users from '@/ipc-api/Users';
|
||||||
|
import { uidGen } from 'common/libs/uidGen';
|
||||||
|
import { useConnectionsStore } from '@/stores/connections';
|
||||||
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useSettingsStore } from '@/stores/settings';
|
||||||
|
|
||||||
|
const persistentStore = new Store({ name: 'tabs' });
|
||||||
|
const tabIndex = [];
|
||||||
|
|
||||||
|
export const useWorkspacesStore = defineStore('workspaces', {
|
||||||
|
state: () => ({
|
||||||
|
workspaces: [],
|
||||||
|
selectedWorkspace: null
|
||||||
|
}),
|
||||||
|
getters: {
|
||||||
|
getSelected: state => {
|
||||||
|
if (!state.workspaces.length) return 'NEW';
|
||||||
|
if (state.selectedWorkspace) return state.selectedWorkspace;
|
||||||
|
return state.workspaces[0].uid;
|
||||||
|
},
|
||||||
|
getWorkspace: state => uid => {
|
||||||
|
return state.workspaces.find(workspace => workspace.uid === uid);
|
||||||
|
},
|
||||||
|
getDatabaseVariable: state => (uid, name) => {
|
||||||
|
return state.workspaces.find(workspace => workspace.uid === uid).variables.find(variable => variable.name === name);
|
||||||
|
},
|
||||||
|
getWorkspaceTab (state) {
|
||||||
|
return tUid => {
|
||||||
|
if (!this.getSelected) return;
|
||||||
|
const workspace = state.workspaces.find(workspace => workspace.uid === this.getSelected);
|
||||||
|
if ('tabs' in workspace)
|
||||||
|
return workspace.tabs.find(tab => tab.uid === tUid);
|
||||||
|
return {};
|
||||||
|
};
|
||||||
|
},
|
||||||
|
getConnected: state => {
|
||||||
|
return state.workspaces
|
||||||
|
.filter(workspace => workspace.connectionStatus === 'connected')
|
||||||
|
.map(workspace => workspace.uid);
|
||||||
|
},
|
||||||
|
getLoadedSchemas: state => uid => {
|
||||||
|
return state.workspaces.find(workspace => workspace.uid === uid).loadedSchemas;
|
||||||
|
},
|
||||||
|
getSearchTerm: state => uid => {
|
||||||
|
return state.workspaces.find(workspace => workspace.uid === uid).searchTerm;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
selectWorkspace (uid) {
|
||||||
|
if (!uid)
|
||||||
|
this.selectedWorkspace = this.workspaces.length ? this.workspaces[0].uid : 'NEW';
|
||||||
|
else
|
||||||
|
this.selectedWorkspace = uid;
|
||||||
|
},
|
||||||
|
async connectWorkspace (connection) {
|
||||||
|
this.workspaces = this.workspaces.map(workspace => workspace.uid === connection.uid
|
||||||
|
? {
|
||||||
|
...workspace,
|
||||||
|
structure: {},
|
||||||
|
breadcrumbs: {},
|
||||||
|
loadedSchemas: new Set(),
|
||||||
|
connectionStatus: 'connecting'
|
||||||
|
}
|
||||||
|
: workspace);
|
||||||
|
|
||||||
|
const connectionsStore = useConnectionsStore();
|
||||||
|
const notificationsStore = useNotificationsStore();
|
||||||
|
const settingsStore = useSettingsStore();
|
||||||
|
|
||||||
|
try {
|
||||||
|
const { status, response } = await Connection.connect(connection);
|
||||||
|
|
||||||
|
if (status === 'error') {
|
||||||
|
notificationsStore.addNotification({ status, message: response });
|
||||||
|
this.workspaces = this.workspaces.map(workspace => workspace.uid === connection.uid
|
||||||
|
? {
|
||||||
|
...workspace,
|
||||||
|
structure: {},
|
||||||
|
breadcrumbs: {},
|
||||||
|
loadedSchemas: new Set(),
|
||||||
|
connectionStatus: 'failed'
|
||||||
|
}
|
||||||
|
: workspace);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
let dataTypes = [];
|
||||||
|
let indexTypes = [];
|
||||||
|
let customizations = {};
|
||||||
|
|
||||||
|
switch (connection.client) {
|
||||||
|
case 'mysql':
|
||||||
|
case 'maria':
|
||||||
|
dataTypes = require('common/data-types/mysql');
|
||||||
|
indexTypes = require('common/index-types/mysql');
|
||||||
|
customizations = require('common/customizations/mysql');
|
||||||
|
break;
|
||||||
|
case 'pg':
|
||||||
|
dataTypes = require('common/data-types/postgresql');
|
||||||
|
indexTypes = require('common/index-types/postgresql');
|
||||||
|
customizations = require('common/customizations/postgresql');
|
||||||
|
break;
|
||||||
|
case 'sqlite':
|
||||||
|
dataTypes = require('common/data-types/sqlite');
|
||||||
|
indexTypes = require('common/index-types/sqlite');
|
||||||
|
customizations = require('common/customizations/sqlite');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { status, response: version } = await Schema.getVersion(connection.uid);
|
||||||
|
|
||||||
|
if (status === 'error')
|
||||||
|
notificationsStore.addNotification({ status, message: version });
|
||||||
|
|
||||||
|
// Check if Maria or MySQL
|
||||||
|
const isMySQL = version.name.includes('MySQL');
|
||||||
|
|
||||||
|
if (isMySQL && connection.client !== 'mysql') {
|
||||||
|
const connProxy = Object.assign({}, connection);
|
||||||
|
connProxy.client = 'mysql';
|
||||||
|
connectionsStore.editConnection(connProxy);
|
||||||
|
}
|
||||||
|
else if (!isMySQL && connection.client === 'mysql') {
|
||||||
|
const connProxy = Object.assign({}, connection);
|
||||||
|
connProxy.client = 'maria';
|
||||||
|
connectionsStore.editConnection(connProxy);
|
||||||
|
}
|
||||||
|
|
||||||
|
const cachedTabs = settingsStore.restoreTabs ? persistentStore.get(connection.uid, []) : [];
|
||||||
|
|
||||||
|
if (cachedTabs.length) {
|
||||||
|
tabIndex[connection.uid] = cachedTabs.reduce((acc, curr) => {
|
||||||
|
if (curr.index > acc) acc = curr.index;
|
||||||
|
return acc;
|
||||||
|
}, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.workspaces = this.workspaces.map(workspace => workspace.uid === connection.uid
|
||||||
|
? {
|
||||||
|
...workspace,
|
||||||
|
client: connection.client,
|
||||||
|
dataTypes,
|
||||||
|
indexTypes,
|
||||||
|
customizations,
|
||||||
|
structure: response,
|
||||||
|
connectionStatus: 'connected',
|
||||||
|
tabs: cachedTabs,
|
||||||
|
selectedTab: cachedTabs.length ? cachedTabs[0].uid : null,
|
||||||
|
version
|
||||||
|
}
|
||||||
|
: workspace);
|
||||||
|
|
||||||
|
this.refreshCollations(connection.uid);
|
||||||
|
this.refreshVariables(connection.uid);
|
||||||
|
this.refreshEngines(connection.uid);
|
||||||
|
this.refreshUsers(connection.uid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
notificationsStore.addNotification({ status: 'error', message: err.stack });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async refreshStructure (uid) {
|
||||||
|
const notificationsStore = useNotificationsStore();
|
||||||
|
|
||||||
|
try {
|
||||||
|
const { status, response } = await Schema.getStructure({ uid, schemas: this.getLoadedSchemas(uid) });
|
||||||
|
|
||||||
|
if (status === 'error')
|
||||||
|
notificationsStore.addNotification({ status, message: response });
|
||||||
|
else {
|
||||||
|
this.workspaces = this.workspaces.map(workspace => workspace.uid === uid
|
||||||
|
? {
|
||||||
|
...workspace,
|
||||||
|
structure: response
|
||||||
|
}
|
||||||
|
: workspace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
notificationsStore.addNotification({ status: 'error', message: err.stack });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async refreshSchema ({ uid, schema }) {
|
||||||
|
const notificationsStore = useNotificationsStore();
|
||||||
|
|
||||||
|
try {
|
||||||
|
const { status, response } = await Schema.getStructure({ uid, schemas: new Set([schema]) });
|
||||||
|
if (status === 'error')
|
||||||
|
notificationsStore.addNotification({ status, message: response });
|
||||||
|
else {
|
||||||
|
const schemaElements =response.find(_schema => _schema.name === schema);
|
||||||
|
this.workspaces = this.workspaces.map(workspace => {
|
||||||
|
if (workspace.uid === uid) {
|
||||||
|
const schemaIndex = workspace.structure.findIndex(s => s.name === schema);
|
||||||
|
|
||||||
|
if (schemaIndex !== -1)
|
||||||
|
workspace.structure[schemaIndex] = schemaElements;
|
||||||
|
else
|
||||||
|
workspace.structure.push(schemaElements);
|
||||||
|
}
|
||||||
|
return workspace;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
notificationsStore.addNotification({ status: 'error', message: err.stack });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async refreshCollations (uid) {
|
||||||
|
const notificationsStore = useNotificationsStore();
|
||||||
|
|
||||||
|
try {
|
||||||
|
const { status, response } = await Schema.getCollations(uid);
|
||||||
|
if (status === 'error')
|
||||||
|
notificationsStore.addNotification({ status, message: response });
|
||||||
|
else {
|
||||||
|
this.workspaces = this.workspaces.map(workspace => workspace.uid === uid
|
||||||
|
? {
|
||||||
|
...workspace,
|
||||||
|
collations: response
|
||||||
|
}
|
||||||
|
: workspace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
notificationsStore.addNotification({ status: 'error', message: err.stack });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async refreshVariables (uid) {
|
||||||
|
const notificationsStore = useNotificationsStore();
|
||||||
|
|
||||||
|
try {
|
||||||
|
const { status, response } = await Schema.getVariables(uid);
|
||||||
|
if (status === 'error')
|
||||||
|
notificationsStore.addNotification({ status, message: response });
|
||||||
|
else {
|
||||||
|
this.workspaces = this.workspaces.map(workspace => workspace.uid === uid
|
||||||
|
? {
|
||||||
|
...workspace,
|
||||||
|
variables: response
|
||||||
|
}
|
||||||
|
: workspace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
notificationsStore.addNotification({ status: 'error', message: err.stack });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async refreshEngines (uid) {
|
||||||
|
const notificationsStore = useNotificationsStore();
|
||||||
|
|
||||||
|
try {
|
||||||
|
const { status, response } = await Schema.getEngines(uid);
|
||||||
|
if (status === 'error')
|
||||||
|
notificationsStore.addNotification({ status, message: response });
|
||||||
|
else {
|
||||||
|
this.workspaces = this.workspaces.map(workspace => workspace.uid === uid
|
||||||
|
? {
|
||||||
|
...workspace,
|
||||||
|
engines: response
|
||||||
|
}
|
||||||
|
: workspace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
notificationsStore.addNotification({ status: 'error', message: err.stack });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async refreshUsers (uid) {
|
||||||
|
const notificationsStore = useNotificationsStore();
|
||||||
|
|
||||||
|
try {
|
||||||
|
const { status, response } = await Users.getUsers(uid);
|
||||||
|
if (status === 'error')
|
||||||
|
notificationsStore.addNotification({ status, message: response });
|
||||||
|
else {
|
||||||
|
this.workspaces = this.workspaces.map(workspace => workspace.uid === uid
|
||||||
|
? {
|
||||||
|
...workspace,
|
||||||
|
users: response
|
||||||
|
}
|
||||||
|
: workspace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
notificationsStore.addNotification({ status: 'error', message: err.stack });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
removeConnected (uid) {
|
||||||
|
Connection.disconnect(uid);
|
||||||
|
this.workspaces = this.workspaces.map(workspace => workspace.uid === uid
|
||||||
|
? {
|
||||||
|
...workspace,
|
||||||
|
structure: {},
|
||||||
|
breadcrumbs: {},
|
||||||
|
loadedSchemas: new Set(),
|
||||||
|
connectionStatus: 'disconnected'
|
||||||
|
}
|
||||||
|
: workspace);
|
||||||
|
|
||||||
|
this.selectTab({ uid, tab: 0 });
|
||||||
|
},
|
||||||
|
addWorkspace (uid) {
|
||||||
|
const workspace = {
|
||||||
|
uid,
|
||||||
|
connectionStatus: 'disconnected',
|
||||||
|
selectedTab: 0,
|
||||||
|
searchTerm: '',
|
||||||
|
tabs: [],
|
||||||
|
structure: {},
|
||||||
|
variables: [],
|
||||||
|
collations: [],
|
||||||
|
users: [],
|
||||||
|
breadcrumbs: {},
|
||||||
|
loadingElements: [],
|
||||||
|
loadedSchemas: new Set()
|
||||||
|
};
|
||||||
|
|
||||||
|
this.workspaces.push(workspace);
|
||||||
|
},
|
||||||
|
changeBreadcrumbs (payload) {
|
||||||
|
const breadcrumbsObj = {
|
||||||
|
schema: null,
|
||||||
|
table: null,
|
||||||
|
trigger: null,
|
||||||
|
triggerFunction: null,
|
||||||
|
procedure: null,
|
||||||
|
function: null,
|
||||||
|
scheduler: null,
|
||||||
|
view: null,
|
||||||
|
query: null
|
||||||
|
};
|
||||||
|
|
||||||
|
this.workspaces = this.workspaces.map(workspace => workspace.uid === this.getSelected
|
||||||
|
? {
|
||||||
|
...workspace,
|
||||||
|
breadcrumbs: { ...breadcrumbsObj, ...payload }
|
||||||
|
}
|
||||||
|
: workspace);
|
||||||
|
},
|
||||||
|
addLoadedSchema (schema) {
|
||||||
|
this.workspaces = this.workspaces.map(workspace => {
|
||||||
|
if (workspace.uid === this.getSelected)
|
||||||
|
workspace.loadedSchemas.add(schema);
|
||||||
|
return workspace;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addLoadingElement (element) {
|
||||||
|
this.workspaces = this.workspaces.map(workspace => {
|
||||||
|
if (workspace.uid === this.getSelected)
|
||||||
|
workspace.loadingElements.push(element);
|
||||||
|
return workspace;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
removeLoadingElement (element) {
|
||||||
|
this.workspaces = this.workspaces.map(workspace => {
|
||||||
|
if (workspace.uid === this.getSelected) {
|
||||||
|
const loadingElements = workspace.loadingElements.filter(el =>
|
||||||
|
el.schema !== element.schema &&
|
||||||
|
el.name !== element.name &&
|
||||||
|
el.type !== element.type
|
||||||
|
);
|
||||||
|
|
||||||
|
workspace = { ...workspace, loadingElements };
|
||||||
|
}
|
||||||
|
return workspace;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
setSearchTerm (term) {
|
||||||
|
this.workspaces = this.workspaces.map(workspace => workspace.uid === this.getSelected
|
||||||
|
? {
|
||||||
|
...workspace,
|
||||||
|
searchTerm: term
|
||||||
|
}
|
||||||
|
: workspace);
|
||||||
|
},
|
||||||
|
_addTab ({ uid, tab, content, type, autorun, schema, elementName, elementType }) {
|
||||||
|
if (type === 'query')
|
||||||
|
tabIndex[uid] = tabIndex[uid] ? ++tabIndex[uid] : 1;
|
||||||
|
|
||||||
|
const newTab = {
|
||||||
|
uid: tab,
|
||||||
|
index: type === 'query' ? tabIndex[uid] : null,
|
||||||
|
selected: false,
|
||||||
|
type,
|
||||||
|
schema,
|
||||||
|
elementName,
|
||||||
|
elementType,
|
||||||
|
fields: [],
|
||||||
|
keyUsage: [],
|
||||||
|
content: content || '',
|
||||||
|
autorun: !!autorun
|
||||||
|
};
|
||||||
|
|
||||||
|
this.workspaces = this.workspaces.map(workspace => {
|
||||||
|
if (workspace.uid === uid) {
|
||||||
|
return {
|
||||||
|
...workspace,
|
||||||
|
tabs: [...workspace.tabs, newTab]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return workspace;
|
||||||
|
});
|
||||||
|
|
||||||
|
persistentStore.set(uid, this.workspaces.find(workspace => workspace.uid === uid).tabs);
|
||||||
|
},
|
||||||
|
_replaceTab ({ uid, tab: tUid, type, schema, content, elementName, elementType }) {
|
||||||
|
this.workspaces = this.workspaces.map(workspace => {
|
||||||
|
if (workspace.uid === uid) {
|
||||||
|
return {
|
||||||
|
...workspace,
|
||||||
|
tabs: workspace.tabs.map(tab => {
|
||||||
|
if (tab.uid === tUid)
|
||||||
|
return { ...tab, type, schema, content, elementName, elementType };
|
||||||
|
|
||||||
|
return tab;
|
||||||
|
})
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return workspace;
|
||||||
|
});
|
||||||
|
|
||||||
|
persistentStore.set(uid, this.workspaces.find(workspace => workspace.uid === uid).tabs);
|
||||||
|
},
|
||||||
|
newTab ({ uid, content, type, autorun, schema, elementName, elementType }) {
|
||||||
|
let tabUid;
|
||||||
|
const workspaceTabs = this.workspaces.find(workspace => workspace.uid === uid);
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case 'new-table':
|
||||||
|
case 'new-trigger':
|
||||||
|
case 'new-trigger-function':
|
||||||
|
case 'new-function':
|
||||||
|
case 'new-routine':
|
||||||
|
case 'new-scheduler':
|
||||||
|
tabUid = uidGen('T');
|
||||||
|
this._addTab({
|
||||||
|
uid,
|
||||||
|
tab: tabUid,
|
||||||
|
content,
|
||||||
|
type,
|
||||||
|
autorun,
|
||||||
|
schema,
|
||||||
|
elementName,
|
||||||
|
elementType
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'temp-data':
|
||||||
|
case 'temp-trigger-props':
|
||||||
|
case 'temp-trigger-function-props':
|
||||||
|
case 'temp-function-props':
|
||||||
|
case 'temp-routine-props':
|
||||||
|
case 'temp-scheduler-props': {
|
||||||
|
const existentTab = workspaceTabs
|
||||||
|
? workspaceTabs.tabs.find(tab =>
|
||||||
|
tab.schema === schema &&
|
||||||
|
tab.elementName === elementName &&
|
||||||
|
tab.elementType === elementType &&
|
||||||
|
[type, type.replace('temp-', '')].includes(tab.type))
|
||||||
|
: false;
|
||||||
|
|
||||||
|
if (existentTab) { // if tab exists
|
||||||
|
tabUid = existentTab.uid;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const tempTabs = workspaceTabs ? workspaceTabs.tabs.filter(tab => tab.type.includes('temp-')) : false;
|
||||||
|
|
||||||
|
if (tempTabs && tempTabs.length) { // if temp tab already opened
|
||||||
|
for (const tab of tempTabs) {
|
||||||
|
if (tab.isChanged) {
|
||||||
|
this._replaceTab({ // make permanent a temp table with unsaved changes
|
||||||
|
uid,
|
||||||
|
tab: tab.uid,
|
||||||
|
type: tab.type.replace('temp-', ''),
|
||||||
|
schema: tab.schema,
|
||||||
|
elementName: tab.elementName,
|
||||||
|
elementType: tab.elementType
|
||||||
|
});
|
||||||
|
|
||||||
|
tabUid = uidGen('T');
|
||||||
|
this._addTab({ uid, tab: tabUid, content, type, autorun, schema, elementName, elementType });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this._replaceTab({ uid, tab: tab.uid, type, schema, elementName, elementType });
|
||||||
|
tabUid = tab.uid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tabUid = uidGen('T');
|
||||||
|
this._addTab({ uid, tab: tabUid, content, type, autorun, schema, elementName, elementType });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'data':
|
||||||
|
case 'table-props':
|
||||||
|
case 'trigger-props':
|
||||||
|
case 'trigger-function-props':
|
||||||
|
case 'function-props':
|
||||||
|
case 'routine-props':
|
||||||
|
case 'scheduler-props': {
|
||||||
|
const existentTab = workspaceTabs
|
||||||
|
? workspaceTabs.tabs.find(tab =>
|
||||||
|
tab.schema === schema &&
|
||||||
|
tab.elementName === elementName &&
|
||||||
|
tab.elementType === elementType &&
|
||||||
|
[`temp-${type}`, type].includes(tab.type))
|
||||||
|
: false;
|
||||||
|
|
||||||
|
if (existentTab) {
|
||||||
|
this._replaceTab({ uid, tab: existentTab.uid, type, schema, elementName, elementType });
|
||||||
|
tabUid = existentTab.uid;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tabUid = uidGen('T');
|
||||||
|
this._addTab({ uid, tab: tabUid, content, type, autorun, schema, elementName, elementType });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
tabUid = uidGen('T');
|
||||||
|
this._addTab({ uid, tab: tabUid, content, type, autorun, schema, elementName, elementType });
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.selectTab({ uid, tab: tabUid });
|
||||||
|
},
|
||||||
|
checkSelectedTabExists (uid) {
|
||||||
|
const workspace = this.workspaces.find(workspace => workspace.uid === uid);
|
||||||
|
const isSelectedExistent = workspace
|
||||||
|
? workspace.tabs.some(tab => tab.uid === workspace.selectedTab)
|
||||||
|
: false;
|
||||||
|
|
||||||
|
if (!isSelectedExistent && workspace.tabs.length)
|
||||||
|
this.selectTab({ uid, tab: workspace.tabs[workspace.tabs.length - 1].uid });
|
||||||
|
},
|
||||||
|
updateTabContent ({ uid, tab, type, schema, content }) {
|
||||||
|
this._replaceTab({ uid, tab, type, schema, content });
|
||||||
|
},
|
||||||
|
renameTabs ({ uid, schema, elementName, elementNewName }) {
|
||||||
|
this.workspaces = this.workspaces.map(workspace => {
|
||||||
|
if (workspace.uid === uid) {
|
||||||
|
return {
|
||||||
|
...workspace,
|
||||||
|
tabs: workspace.tabs.map(tab => {
|
||||||
|
if (tab.elementName === elementName && tab.schema === schema) {
|
||||||
|
return {
|
||||||
|
...tab,
|
||||||
|
elementName: elementNewName
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return tab;
|
||||||
|
})
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return workspace;
|
||||||
|
});
|
||||||
|
|
||||||
|
persistentStore.set(uid, this.workspaces.find(workspace => workspace.uid === uid).tabs);
|
||||||
|
},
|
||||||
|
removeTab ({ uid, tab: tUid }) {
|
||||||
|
this.workspaces = this.workspaces.map(workspace => {
|
||||||
|
if (workspace.uid === uid) {
|
||||||
|
return {
|
||||||
|
...workspace,
|
||||||
|
tabs: workspace.tabs.filter(tab => tab.uid !== tUid)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return workspace;
|
||||||
|
});
|
||||||
|
|
||||||
|
persistentStore.set(uid, this.workspaces.find(workspace => workspace.uid === uid).tabs);
|
||||||
|
this.checkSelectedTabExists(uid);
|
||||||
|
},
|
||||||
|
removeTabs ({ uid, schema, elementName, elementType }) { // Multiple tabs based on schema and element name
|
||||||
|
if (elementType === 'procedure') elementType = 'routine'; // TODO: pass directly "routine"
|
||||||
|
|
||||||
|
this.workspaces = this.workspaces.map(workspace => {
|
||||||
|
if (workspace.uid === uid) {
|
||||||
|
return {
|
||||||
|
...workspace,
|
||||||
|
tabs: workspace.tabs.filter(tab =>
|
||||||
|
tab.schema !== schema ||
|
||||||
|
tab.elementName !== elementName ||
|
||||||
|
tab.elementType !== elementType
|
||||||
|
)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return workspace;
|
||||||
|
});
|
||||||
|
|
||||||
|
persistentStore.set(uid, this.workspaces.find(workspace => workspace.uid === uid).tabs);
|
||||||
|
this.checkSelectedTabExists(uid);
|
||||||
|
},
|
||||||
|
selectTab ({ uid, tab }) {
|
||||||
|
this.workspaces = this.workspaces.map(workspace => workspace.uid === uid
|
||||||
|
? { ...workspace, selectedTab: tab }
|
||||||
|
: workspace
|
||||||
|
);
|
||||||
|
},
|
||||||
|
updateTabs ({ uid, tabs }) {
|
||||||
|
this.workspaces = this.workspaces.map(workspace => workspace.uid === uid
|
||||||
|
? { ...workspace, tabs }
|
||||||
|
: workspace
|
||||||
|
);
|
||||||
|
persistentStore.set(uid, this.workspaces.find(workspace => workspace.uid === uid).tabs);
|
||||||
|
},
|
||||||
|
setTabFields ({ cUid, tUid, fields }) {
|
||||||
|
this.workspaces = this.workspaces.map(workspace => {
|
||||||
|
if (workspace.uid === cUid) {
|
||||||
|
return {
|
||||||
|
...workspace,
|
||||||
|
tabs: workspace.tabs.map(tab => {
|
||||||
|
if (tab.uid === tUid)
|
||||||
|
return { ...tab, fields };
|
||||||
|
else
|
||||||
|
return tab;
|
||||||
|
})
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return workspace;
|
||||||
|
});
|
||||||
|
|
||||||
|
persistentStore.set(cUid, this.workspaces.find(workspace => workspace.uid === cUid).tabs);
|
||||||
|
},
|
||||||
|
setTabKeyUsage ({ cUid, tUid, keyUsage }) {
|
||||||
|
this.workspaces = this.workspaces.map(workspace => {
|
||||||
|
if (workspace.uid === cUid) {
|
||||||
|
return {
|
||||||
|
...workspace,
|
||||||
|
tabs: workspace.tabs.map(tab => {
|
||||||
|
if (tab.uid === tUid)
|
||||||
|
return { ...tab, keyUsage };
|
||||||
|
else
|
||||||
|
return tab;
|
||||||
|
})
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return workspace;
|
||||||
|
});
|
||||||
|
|
||||||
|
persistentStore.set(cUid, this.workspaces.find(workspace => workspace.uid === cUid).tabs);
|
||||||
|
},
|
||||||
|
setUnsavedChanges ({ uid, tUid, isChanged }) {
|
||||||
|
this.workspaces = this.workspaces.map(workspace => {
|
||||||
|
if (workspace.uid === uid) {
|
||||||
|
return {
|
||||||
|
...workspace,
|
||||||
|
tabs: workspace.tabs.map(tab => {
|
||||||
|
if (tab.uid === tUid)
|
||||||
|
return { ...tab, isChanged };
|
||||||
|
|
||||||
|
return tab;
|
||||||
|
})
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return workspace;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (import.meta.webpackHot)
|
||||||
|
import.meta.webpackHot.accept(acceptHMRUpdate(useWorkspacesStore, import.meta.webpackHot));
|
@ -14,7 +14,7 @@ const parsedContributors = contributors.reduce((acc, c) => {
|
|||||||
}, []).join(',');
|
}, []).join(',');
|
||||||
|
|
||||||
const isDevMode = process.env.NODE_ENV !== 'production';
|
const isDevMode = process.env.NODE_ENV !== 'production';
|
||||||
const whiteListedModules = ['.bin', 'vue', '@vue', 'pinia', 'vue-i18n'];
|
const whiteListedModules = ['.bin', 'vue', '@vue', 'vuex', 'pinia', 'vue-i18n'];
|
||||||
const externals = {};
|
const externals = {};
|
||||||
|
|
||||||
fs.readdirSync('node_modules')
|
fs.readdirSync('node_modules')
|
||||||
|
Reference in New Issue
Block a user