mirror of
https://github.com/smartxworks/sunmao-ui.git
synced 2025-04-06 21:40:23 +08:00
fix(editor): allow removing data source trait
This commit is contained in:
parent
851481f13b
commit
71df7cd9c2
@ -39,7 +39,7 @@ export const GeneralTraitForm: React.FC<Props> = props => {
|
||||
<VStack key={trait.type} className={formWrapperCSS}>
|
||||
<HStack width="full" justifyContent="space-between">
|
||||
<strong>{trait.type}</strong>
|
||||
{!tImpl.metadata.isDataSource && onRemove ? (
|
||||
{onRemove ? (
|
||||
<IconButton
|
||||
aria-label="remove trait"
|
||||
variant="ghost"
|
||||
|
@ -82,7 +82,7 @@ export const DataSourceGroup: React.FC<Props> = props => {
|
||||
<AccordionButton justifyContent="space-between">
|
||||
<HStack>
|
||||
{type === 'component' ? <Tag colorScheme="blue">C</Tag> : undefined}
|
||||
<Text fontWeight="bold">{title}</Text>
|
||||
<Text fontWeight="bold">{title || 'Unknown'}</Text>
|
||||
</HStack>
|
||||
<AccordionIcon />
|
||||
</AccordionButton>
|
||||
|
@ -33,7 +33,7 @@ export const DataSourceList: React.FC<Props> = props => {
|
||||
const tDataSources = dataSources.filter(ds => ds.type === 'core/v1/dummy');
|
||||
const cDataSources = dataSources.filter(ds => ds.type !== 'core/v1/dummy');
|
||||
const cdsMap = groupBy(cDataSources, c => c.type);
|
||||
const tdsMap = groupBy(tDataSources, c => c.traits[0]?.type);
|
||||
const tdsMap = groupBy(tDataSources, c => c.traits[0]?.type || '');
|
||||
const cdsGroups = Object.keys(cdsMap).map(type => {
|
||||
return {
|
||||
title: type,
|
||||
@ -44,7 +44,7 @@ export const DataSourceList: React.FC<Props> = props => {
|
||||
const tdsGroups = Object.keys(tdsMap).map(type => {
|
||||
return {
|
||||
title: type,
|
||||
dataSources: tdsMap[type],
|
||||
dataSources: tdsMap[type] || [],
|
||||
type: 'trait',
|
||||
};
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user