From 72e5f592595eca41bcf33c729580e425b7ad2f9c Mon Sep 17 00:00:00 2001 From: Marcus Robinson Date: Fri, 5 Jan 2024 17:25:37 +0000 Subject: [PATCH] Fix workspace menu and connect button issues (#3821) --- CHANGELOG.md | 2 + ui/app/package.json | 2 +- .../components/shared/ResourceContextMenu.tsx | 40 ++++++++++--------- .../workspaces/WorkspaceLeftNav.tsx | 20 +++++----- 4 files changed, 34 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af5f7e54b7..7c37410bcb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ ENHANCEMENTS: * Switch to Structured Firewall Logs ([#3816](https://github.com/microsoft/AzureTRE/pull/3816)) BUG FIXES: +* Fix issue with workspace menu not working correctly([#3819](https://github.com/microsoft/AzureTRE/issues/3819)) +* Fix issue with connect button showing when no uri([#3820](https://github.com/microsoft/AzureTRE/issues/3820)) COMPONENTS: diff --git a/ui/app/package.json b/ui/app/package.json index 6429a551d6..b3512d0d95 100644 --- a/ui/app/package.json +++ b/ui/app/package.json @@ -1,6 +1,6 @@ { "name": "tre-ui", - "version": "0.5.17", + "version": "0.5.18", "private": true, "dependencies": { "@azure/msal-browser": "^2.35.0", diff --git a/ui/app/src/components/shared/ResourceContextMenu.tsx b/ui/app/src/components/shared/ResourceContextMenu.tsx index 4ddf65f8ce..d3c714b4e0 100644 --- a/ui/app/src/components/shared/ResourceContextMenu.tsx +++ b/ui/app/src/components/shared/ResourceContextMenu.tsx @@ -142,25 +142,27 @@ export const ResourceContextMenu: React.FunctionComponent { window.open(props.resource.properties.connection_uri, '_blank') }, - disabled: shouldDisableConnect() - }) - } - else if (props.resource.properties.is_exposed_externally === false) { - menuItems.push({ - key: 'connect', - text: 'Connect', - title: shouldDisableConnect() ? 'Resource must be deployed, enabled & powered on to connect' : 'Connect to resource', - iconProps: { iconName: 'PlugConnected' }, - onClick: () => setShowCopyUrl(true), - disabled: shouldDisableConnect() - }) + if(props.resource.properties.connection_uri){ + if (props.resource.properties.is_exposed_externally === true) { + menuItems.push({ + key: 'connect', + text: 'Connect', + title: shouldDisableConnect() ? 'Resource must be deployed, enabled & powered on to connect' : 'Connect to resource', + iconProps: { iconName: 'PlugConnected' }, + onClick: () => { window.open(props.resource.properties.connection_uri, '_blank') }, + disabled: shouldDisableConnect() + }) + } + else if (props.resource.properties.is_exposed_externally === false) { + menuItems.push({ + key: 'connect', + text: 'Connect', + title: shouldDisableConnect() ? 'Resource must be deployed, enabled & powered on to connect' : 'Connect to resource', + iconProps: { iconName: 'PlugConnected' }, + onClick: () => setShowCopyUrl(true), + disabled: shouldDisableConnect() + }) + } } diff --git a/ui/app/src/components/workspaces/WorkspaceLeftNav.tsx b/ui/app/src/components/workspaces/WorkspaceLeftNav.tsx index b3c5561538..3bf1914b70 100644 --- a/ui/app/src/components/workspaces/WorkspaceLeftNav.tsx +++ b/ui/app/src/components/workspaces/WorkspaceLeftNav.tsx @@ -31,8 +31,8 @@ export const WorkspaceLeftNav: React.FunctionComponent = serviceLinkArray.push( { name: service.properties.display_name, - url: `${ApiEndpoint.WorkspaceServices}/${service.id}`, - key: `${ApiEndpoint.WorkspaceServices}/${service.id}` + url: `/${ApiEndpoint.Workspaces}/${workspaceCtx.workspace.id}/${ApiEndpoint.WorkspaceServices}/${service.id}`, + key: `/${ApiEndpoint.Workspaces}/${workspaceCtx.workspace.id}/${ApiEndpoint.WorkspaceServices}/${service.id}` }); }); @@ -41,8 +41,8 @@ export const WorkspaceLeftNav: React.FunctionComponent = sharedServiceLinkArray.push( { name: service.properties.display_name, - url: `${ApiEndpoint.SharedServices}/${service.id}`, - key: `${ApiEndpoint.SharedServices}/${service.id}` + url: `/${ApiEndpoint.Workspaces}/${workspaceCtx.workspace.id}/${ApiEndpoint.SharedServices}/${service.id}`, + key: `/${ApiEndpoint.Workspaces}/${workspaceCtx.workspace.id}/${ApiEndpoint.SharedServices}/${service.id}` }); }); @@ -57,15 +57,15 @@ export const WorkspaceLeftNav: React.FunctionComponent = }, { name: 'Services', - key: ApiEndpoint.WorkspaceServices, - url: ApiEndpoint.WorkspaceServices, + key: `/${ApiEndpoint.Workspaces}/${workspaceCtx.workspace.id}/${ApiEndpoint.WorkspaceServices}`, + url: `/${ApiEndpoint.Workspaces}/${workspaceCtx.workspace.id}/${ApiEndpoint.WorkspaceServices}`, isExpanded: true, links: serviceLinkArray }, { name: 'Shared Services', - key: ApiEndpoint.SharedServices, - url: ApiEndpoint.SharedServices, + key: `/${ApiEndpoint.Workspaces}/${workspaceCtx.workspace.id}/${ApiEndpoint.SharedServices}`, + url: `/${ApiEndpoint.Workspaces}/${workspaceCtx.workspace.id}/${ApiEndpoint.SharedServices}`, isExpanded: false, links: sharedServiceLinkArray } @@ -77,8 +77,8 @@ export const WorkspaceLeftNav: React.FunctionComponent = if (workspaceCtx.workspace.properties !== undefined && workspaceCtx.workspace.properties.enable_airlock) { serviceNavLinks[0].links.push({ name: 'Airlock', - key: ApiEndpoint.AirlockRequests, - url: ApiEndpoint.AirlockRequests + key: `/${ApiEndpoint.Workspaces}/${workspaceCtx.workspace.id}/${ApiEndpoint.AirlockRequests}`, + url: `/${ApiEndpoint.Workspaces}/${workspaceCtx.workspace.id}/${ApiEndpoint.AirlockRequests}`, }); }