diff --git a/src/renderer/components/SettingBarContext.vue b/src/renderer/components/SettingBarContext.vue
index 2edc8982..c1fcd49c 100644
--- a/src/renderer/components/SettingBarContext.vue
+++ b/src/renderer/components/SettingBarContext.vue
@@ -15,6 +15,43 @@
:size="18"
/> {{ t('connection.disconnect') }}
+
+
+ {{ t('general.moveTo') }}
+
+
+
import { uidGen } from 'common/libs/uidGen';
+import { storeToRefs } from 'pinia';
import { computed, Prop, ref } from 'vue';
import { useI18n } from 'vue-i18n';
@@ -98,9 +136,12 @@ const {
getConnectionByUid,
getConnectionName,
addConnection,
- deleteConnection
+ deleteConnection,
+ addFolder
} = connectionsStore;
+const { getFolders: folders } = storeToRefs(connectionsStore);
+
const workspacesStore = useWorkspacesStore();
const {
@@ -121,6 +162,7 @@ const isConnectionEdit = ref(false);
const connectionName = computed(() => props.contextConnection.name || getConnectionName(props.contextConnection.uid) || t('general.folder', 1));
const isConnected = computed(() => getWorkspace(props.contextConnection.uid)?.connectionStatus === 'connected');
+const parsedFolders = computed(() => folders.value.filter(f => !f.connections.includes(props.contextConnection.uid)));
const confirmDeleteConnection = () => {
if (isConnected.value)
@@ -129,6 +171,16 @@ const confirmDeleteConnection = () => {
closeContext();
};
+const moveToFolder = (folderUid?: string) => {
+ if (!folderUid) {
+ addFolder({
+ connections: [props.contextConnection.uid]
+ });
+ }
+
+ closeContext();
+};
+
const duplicateConnection = () => {
let connectionCopy = getConnectionByUid(props.contextConnection.uid);
connectionCopy = {
diff --git a/src/renderer/components/WorkspaceTabPropsTableContext.vue b/src/renderer/components/WorkspaceTabPropsTableContext.vue
index e4aa2c71..b97f93c0 100644
--- a/src/renderer/components/WorkspaceTabPropsTableContext.vue
+++ b/src/renderer/components/WorkspaceTabPropsTableContext.vue
@@ -101,7 +101,13 @@ const props = defineProps({
selectedField: Object
});
-const emit = defineEmits(['close-context', 'duplicate-selected', 'delete-selected', 'add-new-index', 'add-to-index']);
+const emit = defineEmits([
+ 'close-context',
+ 'duplicate-selected',
+ 'delete-selected',
+ 'add-new-index',
+ 'add-to-index'
+]);
const hasPrimary = computed(() => props.indexes.some(index => index.type === 'PRIMARY'));
diff --git a/src/renderer/components/WorkspaceTabPropsTableFields.vue b/src/renderer/components/WorkspaceTabPropsTableFields.vue
index 32bf0c53..52332def 100644
--- a/src/renderer/components/WorkspaceTabPropsTableFields.vue
+++ b/src/renderer/components/WorkspaceTabPropsTableFields.vue
@@ -150,7 +150,13 @@ const props = defineProps({
mode: String
});
-const emit = defineEmits(['add-new-index', 'add-to-index', 'rename-field', 'duplicate-field', 'remove-field']);
+const emit = defineEmits([
+ 'add-new-index',
+ 'add-to-index',
+ 'rename-field',
+ 'duplicate-field',
+ 'remove-field'
+]);
const workspacesStore = useWorkspacesStore();
const consoleStore = useConsoleStore();
diff --git a/src/renderer/i18n/en-US.ts b/src/renderer/i18n/en-US.ts
index 66b0661a..c6f6e986 100644
--- a/src/renderer/i18n/en-US.ts
+++ b/src/renderer/i18n/en-US.ts
@@ -79,7 +79,8 @@ export const enUS = {
search: 'Search',
title: 'Title',
archive: 'Archive', // verb
- undo: 'Undo'
+ undo: 'Undo',
+ moveTo: 'Move to'
},
connection: { // Database connection
connection: 'Connection',
@@ -363,6 +364,7 @@ export const enUS = {
editFolder: 'Edit folder',
folderName: 'Folder name',
deleteFolder: 'Delete folder',
+ newFolder: 'New folder',
editConnectionAppearance: 'Edit connection appearance',
defaultCopyType: 'Default copy type',
showTableSize: 'Show table size in sidebar',
diff --git a/src/renderer/stores/connections.ts b/src/renderer/stores/connections.ts
index 647264be..2d8df113 100644
--- a/src/renderer/stores/connections.ts
+++ b/src/renderer/stores/connections.ts
@@ -90,8 +90,12 @@ export const useConnectionsStore = defineStore('connections', {
});
persistentStore.set('connectionsOrder', this.connectionsOrder);
},
- addFolder (params: {after: string; connections: [string, string]}) {
- const index = this.connectionsOrder.findIndex((conn: SidebarElement) => conn.uid === params.after);
+ addFolder (params: {after?: string; connections: [string, string?]}) {
+ const index = params.after
+ ? this.connectionsOrder.findIndex((conn: SidebarElement) => conn.uid === params.after)
+ : this.connectionsOrder.length;
+
+ this.removeFromFolders(params.connections);
this.connectionsOrder.splice(index, 0, {
isFolder: true,
@@ -102,6 +106,15 @@ export const useConnectionsStore = defineStore('connections', {
});
persistentStore.set('connectionsOrder', this.connectionsOrder);
},
+ removeFromFolders (...connections: string[]) { // Removes connections from folders
+ this.connectionsOrder = (this.connectionsOrder as SidebarElement[]).map(el => {
+ if (el.isFolder)
+ el.connections = el.connections.filter(uid => !connections.includes(uid));
+ return el;
+ });
+
+ this.clearEmptyFolders();
+ },
addToFolder (params: {folder: string; connection: string}) {
this.connectionsOrder = this.connectionsOrder.map((conn: SidebarElement) => {
if (conn.uid === params.folder)
@@ -113,11 +126,7 @@ export const useConnectionsStore = defineStore('connections', {
this.clearEmptyFolders();
},
deleteConnection (connection: SidebarElement | ConnectionParams) {
- this.connectionsOrder = (this.connectionsOrder as SidebarElement[]).map(el => { // Removes connection from folders
- if (el.isFolder && el.connections.includes(connection.uid))
- el.connections = el.connections.filter(uid => uid !== connection.uid);
- return el;
- });
+ this.removeFromFolders(connection.uid);
this.connectionsOrder = (this.connectionsOrder as SidebarElement[]).filter(el => el.uid !== connection.uid);
this.lastConnections = (this.lastConnections as SidebarElement[]).filter(el => el.uid !== connection.uid);
diff --git a/src/renderer/stores/workspaces.ts b/src/renderer/stores/workspaces.ts
index d23c75e9..466f120f 100644
--- a/src/renderer/stores/workspaces.ts
+++ b/src/renderer/stores/workspaces.ts
@@ -66,7 +66,7 @@ export interface Workspace {
uid: string;
client?: ClientCode;
database?: string;
- connectionStatus: 'connected' | 'disconnected' | 'failed';
+ connectionStatus: 'connected' | 'connecting' | 'disconnected' | 'failed';
selectedTab: string;
searchTerm: string;
tabs: WorkspaceTab[];