in hugegraph-hubble/hubble-fe/src/components/graph-management/metadata-configs/edge-type/ReuseEdgeTypes.tsx [775:867]
render(_: never, records: any, index: number) {
if (index === propertyIndexEditIndex) {
const originalName = edgeTypeStore.checkedReusableData!
.propertyindex_conflicts[index].entity.name;
const changedName = edgeTypeStore.editedCheckedReusableData!
.propertyindex_conflicts[index].entity.name;
const isChanged = changedName !== originalName;
return (
<div>
<span
className="metadata-properties-manipulation"
style={{
marginRight: 16,
color: isChanged ? '#2b65ff' : '#999'
}}
onClick={() => {
if (
!isChanged ||
!edgeTypeStore.validateReuseData(
'property_index',
originalName,
changedName
)
) {
return;
}
edgeTypeStore.mutateReuseData(
'property_index',
originalName,
changedName
);
setPropertyIndexEditIndex(null);
edgeTypeStore.mutateReusableVertexTypeChangeIndexes(index);
}}
>
{t('addition.common.save')}
</span>
<span
className="metadata-properties-manipulation"
onClick={() => {
edgeTypeStore.resetValidateReuseErrorMessage(
'property_index'
);
setPropertyIndexEditIndex(null);
edgeTypeStore.resetEditedReusablePropertyIndexName(index);
}}
>
{t('addition.common.cancel')}
</span>
</div>
);
}
return (
<div>
<span
className="metadata-properties-manipulation"
style={{
marginRight: 16,
color: propertyIndexEditIndex === null ? '#2b65ff' : '#999'
}}
onClick={() => {
if (propertyIndexEditIndex !== null) {
return;
}
setPropertyIndexEditIndex(index);
}}
>
{t('addition.operate.rename')}
</span>
<span
className="metadata-properties-manipulation"
style={{
color: propertyIndexEditIndex === null ? '#2b65ff' : '#999'
}}
onClick={async () => {
if (propertyIndexEditIndex !== null) {
return;
}
setPropertyIndexEditIndex(null);
edgeTypeStore.deleteReuseData('propertyindex_conflicts', index);
}}
>
{t('addition.common.del')}
</span>
</div>
);
}