in hugegraph-hubble/hubble-fe/src/components/graph-management/metadata-configs/edge-type/ReuseEdgeTypes.tsx [388:464]
title: t('addition.operate.operate'),
dataIndex: 'manipulation',
width: '20%',
render(_: never, records: any, index: number) {
const originalName = edgeTypeStore.checkedReusableData!
.vertexlabel_conflicts[index].entity.name;
const changedName = edgeTypeStore.editedCheckedReusableData!
.vertexlabel_conflicts[index].entity.name;
const isChanged = changedName !== originalName;
if (index === vertexTypeEditIndex) {
return (
<div>
<span
className="metadata-properties-manipulation"
style={{
marginRight: 16,
color: isChanged ? '#2b65ff' : '#999'
}}
onClick={() => {
if (
!isChanged ||
!edgeTypeStore.validateReuseData(
'vertexType',
originalName,
changedName
)
) {
return;
}
edgeTypeStore.mutateReuseData(
'vertexType',
originalName,
changedName
);
setVertexTypeEditIndex(null);
edgeTypeStore.mutateReusableVertexTypeChangeIndexes(index);
}}
>
{t('addition.common.save')}
</span>
<span
className="metadata-properties-manipulation"
onClick={() => {
edgeTypeStore.resetValidateReuseErrorMessage('vertexType');
setVertexTypeEditIndex(null);
edgeTypeStore.resetEditedReusableVertexTypeName(index);
}}
>
{t('addition.common.cancel')}
</span>
</div>
);
}
return (
<div>
<span
className="metadata-properties-manipulation"
style={{
marginRight: 16,
color: vertexTypeEditIndex === null ? '#2b65ff' : '#999'
}}
onClick={() => {
if (vertexTypeEditIndex !== null) {
return;
}
setVertexTypeEditIndex(index);
}}
>
{t('addition.operate.rename')}
</span>
</div>
);
}