diff --git a/src/renderer/components/SettingBarContext.vue b/src/renderer/components/SettingBarContext.vue index c1fcd49c..2564ac14 100644 --- a/src/renderer/components/SettingBarContext.vue +++ b/src/renderer/components/SettingBarContext.vue @@ -37,7 +37,7 @@ /> {{ t('application.newFolder') }}
{{ folder.name || t('general.folder') }}
+ +
+ + {{ t('application.outOfFolder') }} +
@@ -137,7 +150,9 @@ const { getConnectionName, addConnection, deleteConnection, - addFolder + addFolder, + addToFolder, + removeFromFolders } = connectionsStore; const { getFolders: folders } = storeToRefs(connectionsStore); @@ -162,7 +177,8 @@ 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 filteredFolders = computed(() => folders.value.filter(f => !f.connections.includes(props.contextConnection.uid))); +const isInFolder = computed(() => folders.value.some(f => f.connections.includes(props.contextConnection.uid))); const confirmDeleteConnection = () => { if (isConnected.value) @@ -177,10 +193,21 @@ const moveToFolder = (folderUid?: string) => { connections: [props.contextConnection.uid] }); } + else { + addToFolder({ + folder: folderUid, + connection: props.contextConnection.uid + }); + } closeContext(); }; +const outOfFolder = () => { + removeFromFolders(props.contextConnection.uid); + closeContext(); +}; + const duplicateConnection = () => { let connectionCopy = getConnectionByUid(props.contextConnection.uid); connectionCopy = { diff --git a/src/renderer/i18n/en-US.ts b/src/renderer/i18n/en-US.ts index c6f6e986..d69bc992 100644 --- a/src/renderer/i18n/en-US.ts +++ b/src/renderer/i18n/en-US.ts @@ -365,6 +365,7 @@ export const enUS = { folderName: 'Folder name', deleteFolder: 'Delete folder', newFolder: 'New folder', + outOfFolder: 'Out of 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 2d8df113..b3b16f92 100644 --- a/src/renderer/stores/connections.ts +++ b/src/renderer/stores/connections.ts @@ -95,7 +95,7 @@ export const useConnectionsStore = defineStore('connections', { ? this.connectionsOrder.findIndex((conn: SidebarElement) => conn.uid === params.after) : this.connectionsOrder.length; - this.removeFromFolders(params.connections); + this.removeFromFolders(...params.connections); this.connectionsOrder.splice(index, 0, { isFolder: true, @@ -116,6 +116,8 @@ export const useConnectionsStore = defineStore('connections', { this.clearEmptyFolders(); }, addToFolder (params: {folder: string; connection: string}) { + this.removeFromFolders(params.connection); + this.connectionsOrder = this.connectionsOrder.map((conn: SidebarElement) => { if (conn.uid === params.folder) conn.connections.push(params.connection);