Skip to content

Commit c475d73

Browse files
harish-viswaHarness
authored andcommitted
feat: updated icons for connectors (#10399)
* d44a0a feat: updated icons for connectors
1 parent 6dee81c commit c475d73

File tree

6 files changed

+42
-24
lines changed

6 files changed

+42
-24
lines changed

packages/ui/src/views/connectors/components/ConnectorsPalleteSection.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { IconV2, LogoV2, Text } from '@/components'
1+
import { IconV2, Text } from '@/components'
22
import { useTranslation } from '@/context'
33
import { StepsPaletteContentLayout } from '@views/unified-pipeline-studio/components/palette-drawer/components/step-palette-content-layout'
44
import { StepsPaletteItemLayout } from '@views/unified-pipeline-studio/components/palette-drawer/components/step-palette-item-layout'
55

6-
import { ConnectorTypeToLogoNameMap } from '../connectors-list/utils'
76
import { AnyConnectorDefinition } from '../types'
7+
import { ConnectorsLogo } from './connectors-logo'
88

99
export interface ConnectorsPaletteSectionProps {
1010
connectors: AnyConnectorDefinition[]
@@ -20,8 +20,6 @@ export function ConnectorsPaletteSection(props: ConnectorsPaletteSectionProps) {
2020
<StepsPaletteContentLayout.Section>
2121
{connectors?.length > 0 ? (
2222
connectors.map(connector => {
23-
const logoName = ConnectorTypeToLogoNameMap.get(connector.type)
24-
2523
return (
2624
<StepsPaletteContentLayout.SectionItem key={connector.type}>
2725
<StepsPaletteItemLayout.Root
@@ -30,7 +28,7 @@ export function ConnectorsPaletteSection(props: ConnectorsPaletteSectionProps) {
3028
}}
3129
>
3230
<StepsPaletteItemLayout.Left className="flex items-center">
33-
{logoName ? <LogoV2 name={logoName} size="md" /> : <IconV2 name="connectors" size="lg" />}
31+
<ConnectorsLogo type={connector.type} iconSize="xl" logoSize="md" />
3432
</StepsPaletteItemLayout.Left>
3533
<StepsPaletteItemLayout.Right>
3634
<StepsPaletteItemLayout.Header>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { IconPropsV2, IconV2 } from '@components/icon-v2'
2+
import { LogoPropsV2, LogoV2 } from '@components/logo-v2'
3+
4+
import { ConnectorTypeToIconNameMap, ConnectorTypeToLogoNameMap } from '../connectors-list/utils'
5+
import { ConnectorConfigType } from '../types'
6+
7+
interface ConnectorsLogoProps {
8+
type: ConnectorConfigType
9+
iconSize?: IconPropsV2['size']
10+
logoSize?: LogoPropsV2['size']
11+
}
12+
13+
export const ConnectorsLogo = (props: ConnectorsLogoProps) => {
14+
const { type, iconSize = 'lg', logoSize = 'sm' } = props
15+
16+
const logoName = ConnectorTypeToLogoNameMap.get(type)
17+
const iconName = ConnectorTypeToIconNameMap.get(type) ?? 'connectors'
18+
19+
return logoName ? <LogoV2 name={logoName} size={logoSize} /> : <IconV2 name={iconName} size={iconSize} />
20+
}

packages/ui/src/views/connectors/connector-details/connector-details-header.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { FC } from 'react'
22

3-
import { Button, IconV2, Layout, Link, LogoV2, MoreActionsTooltip, StatusBadge, Text, TimeAgoCard } from '@/components'
3+
import { Button, IconV2, Layout, Link, MoreActionsTooltip, StatusBadge, Text, TimeAgoCard } from '@/components'
44
import { useTranslation } from '@/context'
55

6-
import { ConnectorTypeToLogoNameMap } from '../connectors-list/utils'
6+
import { ConnectorsLogo } from '../components/connectors-logo'
77
import { ConnectorDetailsHeaderProps } from './types'
88

99
const DATE_FORMAT_OPTIONS = {
@@ -21,7 +21,6 @@ const ConnectorDetailsHeader: FC<ConnectorDetailsHeaderProps> = ({
2121
}) => {
2222
const { createdAt, lastModifiedAt, status, type } = connectorDetails
2323
const { t } = useTranslation()
24-
const logoName = ConnectorTypeToLogoNameMap.get(type)
2524

2625
return (
2726
<Layout.Vertical className="px-8" gap="sm">
@@ -31,7 +30,7 @@ const ConnectorDetailsHeader: FC<ConnectorDetailsHeaderProps> = ({
3130
</Link>
3231
) : null}
3332
<Layout.Horizontal gap="xs" align="center">
34-
{logoName ? <LogoV2 name={logoName} size="lg" /> : <IconV2 name="connectors" size="lg" />}
33+
<ConnectorsLogo type={type} iconSize="xl" logoSize="lg" />
3534
<Text as="h1" variant="heading-section">
3635
{connectorDetails.name}
3736
</Text>

packages/ui/src/views/connectors/connector-reference/connector-reference.tsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { FC } from 'react'
22

3-
import { Alert, Button, ButtonLayout, IconV2, LogoV2, StackedList } from '@/components'
3+
import { Alert, Button, ButtonLayout, StackedList } from '@/components'
44
import { ConnectorItem, connectorRefFilters, DirectionEnum, EntityReference, EntityRendererProps } from '@/views'
55
import { cn } from '@utils/cn'
66

7-
import { ConnectorTypeToLogoNameMap } from '../connectors-list/utils'
7+
import { ConnectorsLogo } from '../components/connectors-logo'
88

99
export interface ConnectorReferenceProps {
1010
// Data
@@ -63,20 +63,13 @@ export const ConnectorReference: FC<ConnectorReferenceProps> = ({
6363
// Custom entity renderer for connectors
6464
const renderEntity = (props: EntityRendererProps<any>) => {
6565
const { entity, isSelected, onSelect } = props
66-
const connectorLogo = entity.connector.type ? ConnectorTypeToLogoNameMap.get(entity.connector.type) : undefined
6766

6867
return (
6968
<StackedList.Item
7069
className={cn({ 'bg-cn-hover': isSelected })}
7170
paddingY="sm"
7271
onClick={() => onSelect(entity)}
73-
thumbnail={
74-
connectorLogo ? (
75-
<LogoV2 name={connectorLogo} size="sm" />
76-
) : (
77-
<IconV2 name="connectors" size="md" className="text-cn-3" />
78-
)
79-
}
72+
thumbnail={<ConnectorsLogo type={entity.connector.type} iconSize="md" logoSize="sm" />}
8073
>
8174
<StackedList.Field title={entity.connector.name} description={entity.connector.description} />
8275
</StackedList.Item>

packages/ui/src/views/connectors/connectors-list/connectors-list.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
Button,
55
Favorite,
66
IconV2,
7-
LogoV2,
87
MoreActionsTooltip,
98
NoData,
109
Popover,
@@ -18,8 +17,9 @@ import { cn } from '@utils/cn'
1817
import { ExecutionState } from '@views/repo/pull-request'
1918

2019
import { ConnectorStatusType, ConnectorTestConnectionDialog } from '../components/connector-test-connection-dialog'
20+
import { ConnectorsLogo } from '../components/connectors-logo'
2121
import { ConnectorListItem, ConnectorListProps } from './types'
22-
import { ConnectorDisplayNameMap, ConnectorTypeToLogoNameMap } from './utils'
22+
import { ConnectorDisplayNameMap } from './utils'
2323

2424
const isStatusSuccess = (status?: string) => status?.toLowerCase() === ExecutionState.SUCCESS.toLowerCase()
2525

@@ -127,8 +127,7 @@ export function ConnectorsList({
127127
<Table.Body>
128128
{connectors.map(connector => {
129129
const { name, identifier, type, spec, status, lastModifiedAt, createdAt, isFavorite } = connector
130-
const connectorLogo = type ? ConnectorTypeToLogoNameMap.get(type) : undefined
131-
const connectorType = type ? ConnectorDisplayNameMap.get(type) : ''
130+
const connectorType = ConnectorDisplayNameMap.get(type)
132131
const connectorDetailUrl = toConnectorDetails?.({ identifier, type, spec, status, lastModifiedAt }) || ''
133132

134133
return (
@@ -138,7 +137,7 @@ export function ConnectorsList({
138137
</Table.Cell>
139138
<Table.Cell className={CELL_MIN_WIDTH}>
140139
<div className="flex w-full items-center gap-2">
141-
{connectorLogo ? <LogoV2 name={connectorLogo} size="sm" /> : <IconV2 name="connectors" size="lg" />}
140+
<ConnectorsLogo type={type} />
142141
<Text truncate>{connectorType || ''}</Text>
143142
</div>
144143
</Table.Cell>

packages/ui/src/views/connectors/connectors-list/utils.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { IconV2NamesType } from '@components/icon-v2'
12
import { LogoNameMapV2 } from '@components/logo-v2'
23

34
import { ConnectorConfigType } from '../types'
@@ -16,6 +17,7 @@ export const ConnectorTypeToLogoNameMap: Map<ConnectorConfigType, keyof typeof L
1617
['GcpKms', 'google'],
1718
['AwsKms', 'aws'],
1819
['TerraformCloud', 'terraform'],
20+
['Terraform', 'terraform'],
1921
['Vault', 'hashicorp'],
2022
['HttpHelmRepo', 'helm'],
2123
['Rancher', 'rancher'],
@@ -39,6 +41,7 @@ export const ConnectorTypeToLogoNameMap: Map<ConnectorConfigType, keyof typeof L
3941
['AzureArtifacts', 'azure'],
4042
['Jenkins', 'jenkins'],
4143
['Bamboo', 'bamboo'],
44+
['Spot', 'spot'],
4245
['PagerDuty', 'pagerduty'],
4346
['JDBC', 'java'],
4447
['SumoLogic', 'sumo-logic'],
@@ -48,6 +51,12 @@ export const ConnectorTypeToLogoNameMap: Map<ConnectorConfigType, keyof typeof L
4851
['Confluence', 'confluence']
4952
])
5053

54+
export const ConnectorTypeToIconNameMap: Map<ConnectorConfigType, IconV2NamesType> = new Map([
55+
['Pdc', 'physical-data-center'],
56+
['CustomHealth', 'health-shield']
57+
// ['ErrorTracking', 'error-tracking']
58+
])
59+
5160
export const ConnectorDisplayNameMap: Map<ConnectorConfigType, string> = new Map([
5261
['K8sCluster', 'Kubernetes cluster'],
5362
['Git', 'Git'],

0 commit comments

Comments
 (0)