feat(AdminApplication): hide oauth tab for unsupported apps

This commit is contained in:
Ali BARIN
2025-01-27 10:18:56 +00:00
parent eb1e0bfe1a
commit 7558250879

View File

@@ -31,18 +31,22 @@ export default function AdminApplication() {
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md')); const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md'));
const formatMessage = useFormatMessage(); const formatMessage = useFormatMessage();
const navigate = useNavigate(); const navigate = useNavigate();
const connectionsPathMatch = useMatch({ const connectionsPathMatch = useMatch({
path: URLS.ADMIN_APP_CONNECTIONS_PATTERN, path: URLS.ADMIN_APP_CONNECTIONS_PATTERN,
end: false, end: false,
}); });
const settingsPathMatch = useMatch({ const settingsPathMatch = useMatch({
path: URLS.ADMIN_APP_SETTINGS_PATTERN, path: URLS.ADMIN_APP_SETTINGS_PATTERN,
end: false, end: false,
}); });
const oauthClientsPathMatch = useMatch({ const oauthClientsPathMatch = useMatch({
path: URLS.ADMIN_APP_AUTH_CLIENTS_PATTERN, path: URLS.ADMIN_APP_AUTH_CLIENTS_PATTERN,
end: false, end: false,
}); });
const { appKey } = useParams(); const { appKey } = useParams();
const { data, loading } = useApp(appKey); const { data, loading } = useApp(appKey);
@@ -86,6 +90,8 @@ export default function AdminApplication() {
value={URLS.ADMIN_APP_SETTINGS_PATTERN} value={URLS.ADMIN_APP_SETTINGS_PATTERN}
component={Link} component={Link}
/> />
{app.supportsOauthClients && (
<Tab <Tab
data-test="oauth-clients-tab" data-test="oauth-clients-tab"
label={formatMessage('adminApps.oauthClients')} label={formatMessage('adminApps.oauthClients')}
@@ -93,6 +99,7 @@ export default function AdminApplication() {
value={URLS.ADMIN_APP_AUTH_CLIENTS_PATTERN} value={URLS.ADMIN_APP_AUTH_CLIENTS_PATTERN}
component={Link} component={Link}
/> />
)}
</Tabs> </Tabs>
</Box> </Box>
@@ -101,10 +108,14 @@ export default function AdminApplication() {
path={`/settings/*`} path={`/settings/*`}
element={<AdminApplicationSettings appKey={appKey} />} element={<AdminApplicationSettings appKey={appKey} />}
/> />
{app.supportsOauthClients && (
<Route <Route
path={`/oauth-clients/*`} path={`/oauth-clients/*`}
element={<AdminApplicationOAuthClients appKey={appKey} />} element={<AdminApplicationOAuthClients appKey={appKey} />}
/> />
)}
<Route <Route
path="/" path="/"
element={ element={
@@ -116,6 +127,8 @@ export default function AdminApplication() {
</Grid> </Grid>
</Grid> </Grid>
</Container> </Container>
{app.supportsOauthClients && (
<Routes> <Routes>
<Route <Route
path="/oauth-clients/create" path="/oauth-clients/create"
@@ -127,6 +140,7 @@ export default function AdminApplication() {
/> />
} }
/> />
<Route <Route
path="/oauth-clients/:clientId" path="/oauth-clients/:clientId"
element={ element={
@@ -137,6 +151,7 @@ export default function AdminApplication() {
} }
/> />
</Routes> </Routes>
)}
</> </>
); );
} }