@@ -15,6 +15,7 @@ import { useAuthService } from "core/services/auth";
1515import { FeatureItem , useFeature } from "core/services/features" ;
1616import { useIsCloudApp } from "core/utils/app" ;
1717import { Intent , useGeneratedIntent , useIntent } from "core/utils/rbac" ;
18+ import { useExperiment } from "hooks/services/Experiment" ;
1819import { useGetConnectorsOutOfDate } from "hooks/services/useConnector" ;
1920import { CloudHelpDropdown } from "packages/cloud/views/layout/CloudMainView/CloudHelpDropdown" ;
2021import { CloudSettingsRoutePaths } from "packages/cloud/views/settings/routePaths" ;
@@ -36,7 +37,7 @@ const WorkspaceNavItems = () => {
3637 const workspaceId = useCurrentWorkspaceId ( ) ;
3738 const basePath = `${ RoutePaths . Workspaces } /${ workspaceId } /` ;
3839 return (
39- < >
40+ < MenuContent data-testid = "navMainItems" >
4041 < NavItem
4142 label = { < FormattedMessage id = "sidebar.connections" /> }
4243 icon = "connection"
@@ -62,66 +63,76 @@ const WorkspaceNavItems = () => {
6263 to = { basePath + RoutePaths . ConnectorBuilder }
6364 />
6465 < NavItem
65- label = { < FormattedMessage id = "sidebar.settings " /> }
66+ label = { < FormattedMessage id = "sidebar.workspaceSettings " /> }
6667 icon = "gear"
6768 to = { basePath + RoutePaths . Settings }
6869 withNotification = { hasNewVersions }
6970 />
70- </ >
71+ </ MenuContent >
7172 ) ;
7273} ;
7374
7475const OrganizationNavItems = ( ) => {
7576 const organizationId = useCurrentOrganizationId ( ) ;
7677 const multiWorkspaceUI = useFeature ( FeatureItem . MultiWorkspaceUI ) ;
7778 const displayOrganizationUsers = useFeature ( FeatureItem . DisplayOrganizationUsers ) ;
78- const canViewOrgSettings = useIntent ( "ViewOrganizationSettings" , { organizationId } ) ;
79+ const canViewOrganizationSettings = useIntent ( "ViewOrganizationSettings" , { organizationId } ) ;
7980 const canManageOrganizationBilling = useGeneratedIntent ( Intent . ManageOrganizationBilling , { organizationId } ) ;
8081 const canViewOrganizationUsage = useGeneratedIntent ( Intent . ViewOrganizationUsage , { organizationId } ) ;
82+ const canManageEmbedded = useGeneratedIntent ( Intent . ViewConfigTemplates , { organizationId } ) ;
83+ const allowConfigTemplateEndpoints = useExperiment ( "platform.allow-config-template-endpoints" ) ;
84+ const isCloudApp = useIsCloudApp ( ) ;
8185 const basePath = `${ RoutePaths . Organization } /${ organizationId } /` ;
8286 return (
83- < >
84- { multiWorkspaceUI && canViewOrgSettings && (
85- < >
87+ < MenuContent data-testid = "navMainItems" >
88+ { multiWorkspaceUI && (
89+ < NavItem
90+ label = { < FormattedMessage id = "workspaces.title" /> }
91+ icon = "grid"
92+ to = { basePath + RoutePaths . Workspaces }
93+ testId = "workspacesLink"
94+ />
95+ ) }
96+ { isCloudApp && canManageEmbedded && allowConfigTemplateEndpoints && (
97+ < NavItem
98+ icon = "stars"
99+ label = { < FormattedMessage id = "settings.embedded" /> }
100+ to = { `${ basePath + RoutePaths . Settings } /${ CloudSettingsRoutePaths . Embedded } ` } // Make sure this is correct
101+ testId = "embeddedLink"
102+ />
103+ ) }
104+ { ( multiWorkspaceUI && canViewOrganizationSettings && displayOrganizationUsers ) ||
105+ ( isCloudApp && canViewOrganizationSettings && (
86106 < NavItem
87- label = { < FormattedMessage id = "workspaces.title " /> }
88- icon = "grid "
89- to = { basePath + RoutePaths . Workspaces }
90- testId = "workspacesLink "
107+ label = { < FormattedMessage id = "settings.members " /> }
108+ icon = "community "
109+ to = { basePath + SettingsRoutePaths . OrganizationMembers }
110+ testId = "organizationMembersLink "
91111 />
92- { displayOrganizationUsers && (
93- < NavItem
94- label = { < FormattedMessage id = "settings.members" /> }
95- icon = "community"
96- to = { basePath + SettingsRoutePaths . OrganizationMembers }
97- testId = "organizationMembersLink"
98- />
99- ) }
100- { canManageOrganizationBilling && (
101- < NavItem
102- label = { < FormattedMessage id = "sidebar.billing" /> }
103- icon = "credits"
104- to = { basePath + CloudSettingsRoutePaths . Billing }
105- testId = "billingLink"
106- />
107- ) }
108- { canViewOrganizationUsage && (
109- < NavItem
110- label = { < FormattedMessage id = "settings.usage" /> }
111- icon = "chart"
112- to = { basePath + CloudSettingsRoutePaths . OrganizationUsage }
113- testId = "organizationUsageLink"
114- />
115- ) }
116- </ >
112+ ) ) }
113+ { isCloudApp && canViewOrganizationSettings && canManageOrganizationBilling && (
114+ < NavItem
115+ label = { < FormattedMessage id = "sidebar.billing" /> }
116+ icon = "credits"
117+ to = { basePath + CloudSettingsRoutePaths . Billing }
118+ testId = "billingLink"
119+ />
120+ ) }
121+ { isCloudApp && canViewOrganizationSettings && canViewOrganizationUsage && (
122+ < NavItem
123+ label = { < FormattedMessage id = "settings.usage" /> }
124+ icon = "chart"
125+ to = { basePath + CloudSettingsRoutePaths . OrganizationUsage }
126+ testId = "organizationUsageLink"
127+ />
117128 ) }
118129 < NavItem
119130 label = { < FormattedMessage id = "settings.organizationSettings" /> }
120131 icon = "gear"
121132 to = { basePath + RoutePaths . Settings }
122133 testId = "orgSettingsLink"
123134 />
124- </ >
135+ </ MenuContent >
125136 ) ;
126137} ;
127138
@@ -132,8 +143,8 @@ export const SideBar: React.FC<PropsWithChildren> = () => {
132143 const isHidden = HIDDEN_SIDEBAR_PATHS . some ( ( path ) => ! ! matchPath ( path , pathname ) ) ;
133144 const isCloudApp = useIsCloudApp ( ) ;
134145
135- const organizationId = useCurrentOrganizationId ( ) ;
136- const showOrgNav = Boolean ( organizationId ) ;
146+ const showOrganizationNav = pathname . split ( "/" ) [ 1 ] === RoutePaths . Organization ;
147+ const showWorkspaceNav = pathname . split ( "/" ) [ 1 ] === RoutePaths . Workspaces ;
137148
138149 const username =
139150 authType === "simple" || authType === "none"
@@ -145,14 +156,13 @@ export const SideBar: React.FC<PropsWithChildren> = () => {
145156 return (
146157 < nav className = { classNames ( styles . sidebar , { [ styles . hidden ] : isHidden } ) } >
147158 < AirbyteOrgPicker />
148- { /* NOTE: AdminWorkspaceWarning wants a workspace */ }
159+ { /* NOTE: AdminWorkspaceWarning wants a workspace but one is not always available: https://github.com/airbytehq/airbyte-internal-issues/issues/12948 */ }
149160 { /* <IfFeatureEnabled feature={FeatureItem.ShowAdminWarningInWorkspace}>
150161 <AdminWorkspaceWarning />
151162 </IfFeatureEnabled> */ }
152163 < FlexContainer className = { styles . sidebar__menuItems } direction = "column" justifyContent = "flex-start" >
153- < MenuContent data-testid = "navMainItems" >
154- { showOrgNav ? < OrganizationNavItems /> : < WorkspaceNavItems /> }
155- </ MenuContent >
164+ { showOrganizationNav && < OrganizationNavItems /> }
165+ { showWorkspaceNav && < WorkspaceNavItems /> }
156166 < Box className = { styles . sidebar__menuContentSeparator } />
157167 < MenuContent >
158168 { isCloudApp ? < CloudHelpDropdown /> : < HelpDropdown /> }
0 commit comments