mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Add name to be configurable from the UI * Update public/app/features/auth-config/ProviderConfigPage.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Align test --------- Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
import React from 'react';
|
|
|
|
import { isIconName } from '@grafana/data';
|
|
import { Badge, Card, Icon } from '@grafana/ui';
|
|
|
|
import { UIMap } from '../constants';
|
|
import { getProviderUrl } from '../utils/url';
|
|
|
|
type Props = {
|
|
providerId: string;
|
|
enabled: boolean;
|
|
configPath?: string;
|
|
authType?: string;
|
|
onClick?: () => void;
|
|
};
|
|
|
|
export function ProviderCard({ providerId, enabled, configPath, authType, onClick }: Props) {
|
|
//@ts-expect-error
|
|
const url = getProviderUrl({ configPath, id: providerId });
|
|
const [iconName, displayName] = UIMap[providerId] || ['lock', providerId.toUpperCase()];
|
|
return (
|
|
<Card href={url} onClick={onClick}>
|
|
<Card.Heading>{displayName}</Card.Heading>
|
|
<Card.Meta>{authType}</Card.Meta>
|
|
{isIconName(iconName) && (
|
|
<Card.Figure>
|
|
<Icon name={iconName} size={'xxxl'} />
|
|
</Card.Figure>
|
|
)}
|
|
<Card.Actions>
|
|
<Badge text={enabled ? 'Enabled' : 'Not enabled'} color={enabled ? 'green' : 'blue'} />
|
|
</Card.Actions>
|
|
</Card>
|
|
);
|
|
}
|