diff --git a/ui/src/app.tsx b/ui/src/app.tsx index 066426899..25107c0d2 100644 --- a/ui/src/app.tsx +++ b/ui/src/app.tsx @@ -1,7 +1,5 @@ import React from 'react' -import { InteractionType } from '@azure/msal-browser' -import { MsalAuthenticationTemplate, MsalProvider } from '@azure/msal-react' import { Layout } from 'antd' import { QueryClient, QueryClientProvider } from 'react-query' import { BrowserRouter, Route, Routes } from 'react-router-dom' @@ -20,54 +18,53 @@ import Projects from '@/pages/Projects' import ResponseErrors from '@/pages/ResponseErrors' import RoleManagement from '@/pages/RoleManagement' +import AzureMsal from './components/AzureMsal' import Header from './components/HeaderBar/header' import SideMenu from './components/SiderMenu/siteMenu' -import { getMsalConfig } from './utils/utils' const queryClient = new QueryClient() -const msalClient = getMsalConfig() +const enableRBAC = window.environment?.enableRBAC +const authEnable: boolean = (enableRBAC ? enableRBAC : process.env.REACT_APP_ENABLE_RBAC) === 'true' const App = () => { return ( - - - - - - - -
- - - } /> - } /> - } /> - } /> - } /> - } /> - } - /> - } - /> - } /> - } /> - } /> - } /> - } /> - } /> - - - + + + + + + +
+ + + } /> + } /> + } /> + } /> + } /> + } /> + } + /> + } + /> + } /> + } /> + } /> + } /> + } /> + } /> + + - - - - + + + + ) } diff --git a/ui/src/components/AzureMsal/index.tsx b/ui/src/components/AzureMsal/index.tsx new file mode 100644 index 000000000..2166c30c0 --- /dev/null +++ b/ui/src/components/AzureMsal/index.tsx @@ -0,0 +1,28 @@ +import React, { ReactNode } from 'react' + +import { InteractionType } from '@azure/msal-browser' +import { MsalAuthenticationTemplate, MsalProvider } from '@azure/msal-react' + +import { getMsalConfig } from '@/utils/utils' + +const msalInstance = getMsalConfig() + +export interface AzureMsalProps { + children?: ReactNode + enable?: boolean +} + +const AzureMsal = (props: AzureMsalProps) => { + const { children, enable } = props + return enable ? ( + + + {children} + + + ) : ( + <>{children} + ) +} + +export default AzureMsal