diff --git a/packages/web/src/impexp/FormConnectionSelect.svelte b/packages/web/src/impexp/FormConnectionSelect.svelte index 7d7a1ee56..49c5f5feb 100644 --- a/packages/web/src/impexp/FormConnectionSelect.svelte +++ b/packages/web/src/impexp/FormConnectionSelect.svelte @@ -12,7 +12,7 @@ ...(allowChooseModel ? [{ label: '(DB Model)', value: '__model' }] : []), ..._.sortBy( ($connections || []) - .filter(conn => !conn.unsaved && (direction == 'target' ? !conn.isReadOnly : true)) + .filter(conn => (direction == 'target' ? !conn.isReadOnly : true)) .map(conn => ({ value: conn._id, label: getConnectionLabel(conn), diff --git a/packages/web/src/perspectives/CustomJoinModal.svelte b/packages/web/src/perspectives/CustomJoinModal.svelte index 37bfaa28e..c8009acca 100644 --- a/packages/web/src/perspectives/CustomJoinModal.svelte +++ b/packages/web/src/perspectives/CustomJoinModal.svelte @@ -93,7 +93,7 @@ { value: null, label: 'The same as root' }, ..._.sortBy( ($connections || []) - .filter(x => !x.unsaved) + // .filter(x => !x.unsaved) .map(conn => ({ value: conn._id, label: getConnectionLabel(conn), diff --git a/packages/web/src/utility/OpenTabsOnStartup.svelte b/packages/web/src/utility/OpenTabsOnStartup.svelte index 71009c5f4..121bca880 100644 --- a/packages/web/src/utility/OpenTabsOnStartup.svelte +++ b/packages/web/src/utility/OpenTabsOnStartup.svelte @@ -51,7 +51,7 @@ if ( !$openedTabs.find(x => x.closedTime == null) && - !(await getConnectionList()).find(x => !x.unsaved) && + !(await getConnectionList()).length && $commandsCustomized['new.connection']?.enabled ) { openNewTab({ diff --git a/packages/web/src/widgets/ConnectionList.svelte b/packages/web/src/widgets/ConnectionList.svelte index 9af44be42..a9b21b4d6 100644 --- a/packages/web/src/widgets/ConnectionList.svelte +++ b/packages/web/src/widgets/ConnectionList.svelte @@ -49,6 +49,17 @@ let domContainer = null; let domFilter = null; + // function extractConnectionParent(data, openedConnections, openedSingleDatabaseConnections) { + // if (data.parent) { + // return data.parent; + // } + // if (data.unsaved && !openedConnections.includes(data._id) && !openedSingleDatabaseConnections.includes(data._id)) { + // return 'Recent & unsaved'; + // } + + // return null; + // } + $: connectionsWithStatus = $connections && $serverStatus ? $connections.map(conn => ({ @@ -57,19 +68,15 @@ })) : $connections; - $: connectionsWithStatusFiltered = connectionsWithStatus?.filter( - x => !x.unsaved || $openedConnections.includes(x._id) || $openedSingleDatabaseConnections.includes(x._id) - ); - $: connectionsWithParent = _.sortBy( - connectionsWithStatusFiltered - ? connectionsWithStatusFiltered?.filter(x => x.parent !== undefined && x.parent !== null && x.parent.length !== 0) + connectionsWithStatus + ? connectionsWithStatus?.filter(x => x.parent !== undefined && x.parent !== null && x.parent.length !== 0) : [], connection => (getConnectionLabel(connection) || '').toUpperCase() ); $: connectionsWithoutParent = _.sortBy( - connectionsWithStatusFiltered - ? connectionsWithStatusFiltered?.filter(x => x.parent === undefined || x.parent === null || x.parent.length === 0) + connectionsWithStatus + ? connectionsWithStatus?.filter(x => x.parent === undefined || x.parent === null || x.parent.length === 0) : [], connection => (getConnectionLabel(connection) || '').toUpperCase() ); @@ -293,7 +300,7 @@ }} /> - {#if $connections && !$connections.find(x => !x.unsaved) && $openedConnections.length == 0 && $commandsCustomized['new.connection']?.enabled && !$openedTabs.find(x => !x.closedTime && x.tabComponent == 'ConnectionTab' && !x.props?.conid)} + {#if $connections && $connections.length == 0 && $openedConnections.length == 0 && $commandsCustomized['new.connection']?.enabled && !$openedTabs.find(x => !x.closedTime && x.tabComponent == 'ConnectionTab' && !x.props?.conid)} runCommand('new.connection')} fillHorizontal >Add new connection