@ -2,7 +2,7 @@ import { css } from '@emotion/css';
import React from 'react' ;
import { GrafanaTheme2 } from '@grafana/data' ;
import { Badge , Card , useStyles2 } from '@grafana/ui' ;
import { Badge , Card , useStyles2 , Icon , Tooltip } from '@grafana/ui' ;
import { BASE_PATH } from '../constants' ;
@ -12,18 +12,41 @@ type Props = {
providerId : string ;
displayName : string ;
enabled : boolean ;
configFoundInIniFile? : boolean ;
configPath? : string ;
authType? : string ;
badges? : JSX.Element [ ] ;
} ;
export function ProviderCard ( { providerId , displayName , enabled , configPath , authType , badges } : Props ) {
export function ProviderCard ( {
providerId ,
displayName ,
enabled ,
configFoundInIniFile ,
configPath ,
authType ,
badges ,
} : Props ) {
const styles = useStyles2 ( getStyles ) ;
configPath = BASE_PATH + ( configPath || providerId ) ;
return (
< Card href = { configPath } className = { styles . container } >
< Card.Heading className = { styles . name } > { displayName } < / Card.Heading >
{ configFoundInIniFile && (
< >
< span className = { styles . initext } >
< Tooltip
content = { ` Note: Settings enabled in the .ini configuration file will overwritten by the current settings. ` }
>
< >
< Icon name = "adjust-circle" / >
Configuration found in . ini file
< / >
< / Tooltip >
< / span >
< / >
) }
< div className = { styles . footer } >
{ authType && < Badge text = { authType } color = "blue" icon = "info-circle" / > }
{ enabled ? < Badge text = "Enabled" color = "green" icon = "check" / > : < Badge text = "Not enabled" color = "red" / > }
@ -57,5 +80,11 @@ export const getStyles = (theme: GrafanaTheme2) => {
color : $ { theme . colors . text . primary } ;
margin : 0 ;
` ,
initext : css `
font - size : $ { theme . typography . bodySmall . fontSize } ;
color : $ { theme . colors . text . secondary } ;
padding : $ { theme . spacing ( 1 ) } 0 ; // Add some padding
max - width : 90 % ; // Add a max-width to prevent text from stretching too wide
` ,
} ;
} ;