Auth: Display page not found when the provider is invalid (#92563)

display page not found when the provider is invalid
This commit is contained in:
Mihai Doarna 2024-08-28 14:06:24 +03:00 committed by GitHub
parent a9c2c97531
commit 2b70945fda
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,6 +6,7 @@ import { Badge, Stack, Text } from '@grafana/ui';
import { Page } from 'app/core/components/Page/Page';
import { GrafanaRouteComponentProps } from 'app/core/navigation/types';
import { PageNotFound } from '../../core/components/PageNotFound/PageNotFound';
import { StoreState } from '../../types';
import { ProviderConfigForm } from './ProviderConfigForm';
@ -57,15 +58,16 @@ export type Props = ConnectedProps<typeof connector>;
* Separate the Page logic from the Content logic for easier testing.
*/
export const ProviderConfigPage = ({ config, loadProviders, isLoading, provider }: Props) => {
const pageNav = getPageNav(config);
useEffect(() => {
loadProviders(provider);
}, [loadProviders, provider]);
if (!config) {
return null;
if (!config || !config.provider || !UIMap[config.provider]) {
return <PageNotFound />;
}
const pageNav = getPageNav(config);
return (
<Page
navId="authentication"