Merge pull request #2311 from automatisch/hide-oauth-tab-in-admin-for-unsupported-apps
feat(AdminApplication): hide oauth tab for unsupported apps
This commit is contained in:
@@ -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>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user