diff --git a/config-ui/src/features/connections/components/name.tsx b/config-ui/src/features/connections/components/name.tsx index a8bcf9dedae..c1c2f6351e3 100644 --- a/config-ui/src/features/connections/components/name.tsx +++ b/config-ui/src/features/connections/components/name.tsx @@ -16,17 +16,63 @@ * */ +import { theme } from 'antd'; +import styled from 'styled-components'; + import { useAppSelector } from '@/hooks'; +import { getPluginConfig } from '@/plugins'; import { selectConnection, selectWebhook } from '../slice'; +const Wrapper = styled.div` + display: flex; + align-items: center; + + span + span { + margin-left: 4px; + } + + .icon { + display: inline-block; + width: 24px; + height: 24px; + + & > svg { + width: 100%; + height: 100%; + } + } + + .name { + max-width: 240px; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + } +`; + interface Props { plugin: string; connectionId: ID; } export const ConnectionName = ({ plugin, connectionId }: Props) => { + const { + token: { colorPrimary }, + } = theme.useToken(); + const connection = useAppSelector((state) => selectConnection(state, `${plugin}-${connectionId}`)); const webhook = useAppSelector((state) => selectWebhook(state, connectionId)); - return {connection ? connection.name : webhook ? webhook.name : `${plugin}/connection/${connectionId}`}; + const config = getPluginConfig(plugin); + + const name = connection ? connection.name : webhook ? webhook.name : `${plugin}/connection/${connectionId}`; + + return ( + + {config.icon({ color: colorPrimary })} + + {name} + + + ); }; diff --git a/config-ui/src/routes/blueprint/detail/configuration-panel.tsx b/config-ui/src/routes/blueprint/detail/configuration-panel.tsx index 5da82606ca5..a73b1074343 100644 --- a/config-ui/src/routes/blueprint/detail/configuration-panel.tsx +++ b/config-ui/src/routes/blueprint/detail/configuration-panel.tsx @@ -19,7 +19,7 @@ import { useState, useEffect, useMemo } from 'react'; import { Link } from 'react-router-dom'; import { FormOutlined, PlusOutlined } from '@ant-design/icons'; -import { theme, Flex, Table, Button } from 'antd'; +import { Flex, Table, Button } from 'antd'; import API from '@/api'; import { NoData } from '@/components'; @@ -47,10 +47,6 @@ export const ConfigurationPanel = ({ from, blueprint, onRefresh, onChangeTab }: const [rawPlan, setRawPlan] = useState(''); const [operating, setOperating] = useState(false); - const { - token: { colorPrimary }, - } = theme.useToken(); - useEffect(() => { setRawPlan(JSON.stringify(blueprint.plan, null, ' ')); }, [blueprint]); @@ -199,31 +195,25 @@ export const ConfigurationPanel = ({ from, blueprint, onRefresh, onChangeTab }: - {connections.map((cs) => { - const plugin = getPluginConfig(cs.plugin); - return ( - - - {plugin.icon({ color: colorPrimary })} - - - - {cs.scope.length} data scope - - - - Edit Data Scope and Scope Config - - - - ); - })} + {connections.map((cs) => ( + + + + {cs.scope.length} data scope + + + + Edit Data Scope and Scope Config + + + + ))} diff --git a/config-ui/src/routes/blueprint/detail/styled.ts b/config-ui/src/routes/blueprint/detail/styled.ts index 2bba817fcbb..6a4ecafb5a4 100644 --- a/config-ui/src/routes/blueprint/detail/styled.ts +++ b/config-ui/src/routes/blueprint/detail/styled.ts @@ -59,26 +59,6 @@ export const ConnectionItem = styled.li` margin-right: 0; } - .title { - display: flex; - align-items: center; - - .icon { - display: inline-block; - width: 24px; - height: 24px; - - & > svg { - width: 100%; - height: 100%; - } - } - - span + span { - margin-left: 8px; - } - } - .count { margin: 24px 0; }