11import * as React from 'react' ;
22import { getLocString } from '../react-common/locReactSide' ;
3- import { IntegrationWithStatus } from './types' ;
3+ import { IntegrationWithStatus , IntegrationType } from './types' ;
44
55export interface IIntegrationItemProps {
66 integration : IntegrationWithStatus ;
77 onConfigure : ( integrationId : string ) => void ;
88 onDelete : ( integrationId : string ) => void ;
99}
1010
11+ const getIntegrationTypeLabel = ( type : IntegrationType ) : string => {
12+ switch ( type ) {
13+ case 'postgres' :
14+ return getLocString ( 'integrationsPostgresTypeLabel' , 'PostgreSQL' ) ;
15+ case 'bigquery' :
16+ return getLocString ( 'integrationsBigQueryTypeLabel' , 'BigQuery' ) ;
17+ default :
18+ return type ;
19+ }
20+ } ;
21+
1122export const IntegrationItem : React . FC < IIntegrationItemProps > = ( { integration, onConfigure, onDelete } ) => {
1223 const statusClass = integration . status === 'connected' ? 'status-connected' : 'status-disconnected' ;
1324 const statusText =
@@ -17,7 +28,15 @@ export const IntegrationItem: React.FC<IIntegrationItemProps> = ({ integration,
1728 const configureText = integration . config
1829 ? getLocString ( 'integrationsReconfigure' , 'Reconfigure' )
1930 : getLocString ( 'integrationsConfigure' , 'Configure' ) ;
20- const displayName = integration . config ?. name || integration . id ;
31+
32+ // Get the name: prefer config name, then project name, then ID
33+ const name = integration . config ?. name || integration . projectName || integration . id ;
34+
35+ // Get the type: prefer config type, then project type
36+ const type = integration . config ?. type || integration . projectType ;
37+
38+ // Build display name with type
39+ const displayName = type ? `${ name } (${ getIntegrationTypeLabel ( type ) } )` : name ;
2140
2241 return (
2342 < div className = "integration-item" >
0 commit comments