From ed90960925515fc266a8aacad392e5b7191eaa22 Mon Sep 17 00:00:00 2001 From: Betsy Button Date: Thu, 15 May 2025 18:07:29 -0400 Subject: [PATCH 1/3] moved refresh button --- .../src/connections-navigation-tree.tsx | 18 +++++++++--------- .../src/item-actions.ts | 10 +++++----- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/compass-connections-navigation/src/connections-navigation-tree.tsx b/packages/compass-connections-navigation/src/connections-navigation-tree.tsx index 58ba9a36511..2a0833f8d4b 100644 --- a/packages/compass-connections-navigation/src/connections-navigation-tree.tsx +++ b/packages/compass-connections-navigation/src/connections-navigation-tree.tsx @@ -114,7 +114,7 @@ const ConnectionsNavigationTree: React.FunctionComponent< const getCollapseAfterForConnectedItem = useCallback( (actions: NavigationItemActions) => { - const [firstAction, secondAction] = actions; + const [firstAction, secondAction, thirdAction] = actions; const actionCanBeShownInline = ( action: NavigationItemActions[number] @@ -123,7 +123,7 @@ const ConnectionsNavigationTree: React.FunctionComponent< return false; } - return ['create-database', 'open-shell'].includes( + return ['refresh-databases', 'create-database', 'open-shell'].includes( (action as ItemAction).action ); }; @@ -131,23 +131,23 @@ const ConnectionsNavigationTree: React.FunctionComponent< // this is the normal case for a connection that is writable and when we // also have shell enabled if ( - actionCanBeShownInline(firstAction) && - actionCanBeShownInline(secondAction) + actionCanBeShownInline(secondAction) && + actionCanBeShownInline(thirdAction) ) { - return 2; + return 3; } // this will happen when the either the connection is not writable or the // preference is readonly, or shell is not enabled in which case we either // do not show create-database action or open-shell action if ( - actionCanBeShownInline(firstAction) || - actionCanBeShownInline(secondAction) + actionCanBeShownInline(secondAction) || + actionCanBeShownInline(thirdAction) ) { - return 1; + return 2; } - return 0; + return 1; }, [] ); diff --git a/packages/compass-connections-navigation/src/item-actions.ts b/packages/compass-connections-navigation/src/item-actions.ts index 9e4f58c5b19..4609f0d9a76 100644 --- a/packages/compass-connections-navigation/src/item-actions.ts +++ b/packages/compass-connections-navigation/src/item-actions.ts @@ -93,6 +93,11 @@ export const connectedConnectionItemActions = ({ connectionInfo, }); return stripNullActions([ + { + action: 'refresh-databases', + label: 'Refresh databases', + icon: 'Refresh', + }, hasWriteActionsDisabled ? null : { @@ -123,11 +128,6 @@ export const connectedConnectionItemActions = ({ icon: 'InfoWithCircle', label: 'Show connection info', }, - { - action: 'refresh-databases', - label: 'Refresh databases', - icon: 'Refresh', - }, { action: 'connection-disconnect', icon: 'Disconnect', From 72c45c0ca2a1cc2a0e2aa01f75dceb018e81d16a Mon Sep 17 00:00:00 2001 From: Betsy Button Date: Thu, 15 May 2025 18:09:26 -0400 Subject: [PATCH 2/3] comment added --- .../src/connections-navigation-tree.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/compass-connections-navigation/src/connections-navigation-tree.tsx b/packages/compass-connections-navigation/src/connections-navigation-tree.tsx index 2a0833f8d4b..5c3ea0434ac 100644 --- a/packages/compass-connections-navigation/src/connections-navigation-tree.tsx +++ b/packages/compass-connections-navigation/src/connections-navigation-tree.tsx @@ -147,6 +147,7 @@ const ConnectionsNavigationTree: React.FunctionComponent< return 2; } + // always display the refresh action (firstAction) return 1; }, [] From f14a92616286449f69c2f00f09ae677e9a1d4f27 Mon Sep 17 00:00:00 2001 From: Betsy Button Date: Thu, 15 May 2025 23:38:26 -0400 Subject: [PATCH 3/3] removed unused var --- .../src/connections-navigation-tree.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/compass-connections-navigation/src/connections-navigation-tree.tsx b/packages/compass-connections-navigation/src/connections-navigation-tree.tsx index 5c3ea0434ac..e1460e13f66 100644 --- a/packages/compass-connections-navigation/src/connections-navigation-tree.tsx +++ b/packages/compass-connections-navigation/src/connections-navigation-tree.tsx @@ -114,7 +114,7 @@ const ConnectionsNavigationTree: React.FunctionComponent< const getCollapseAfterForConnectedItem = useCallback( (actions: NavigationItemActions) => { - const [firstAction, secondAction, thirdAction] = actions; + const [, secondAction, thirdAction] = actions; const actionCanBeShownInline = ( action: NavigationItemActions[number]