in hugegraph-hubble/hubble-fe/src/components/graph-management/metadata-configs/vertex-type/ReuseVertexTypes.tsx [400:493]
render(_: never, records: any, index: number) {
if (index === propertyEditIndex) {
const originalName = vertexTypeStore.checkedReusableData!
.propertykey_conflicts[index].entity.name;
const changedName = vertexTypeStore.editedCheckedReusableData!
.propertykey_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 ||
!vertexTypeStore.validateReuseData(
'property',
originalName,
changedName
)
) {
return;
}
vertexTypeStore.mutateReuseData(
'property',
originalName,
changedName
);
setPropertyEditIndex(null);
vertexTypeStore.mutateReusablePropertyNameChangeIndexes(
index
);
}}
>
{t('addition.common.save')}
</span>
<span
className="metadata-properties-manipulation"
onClick={() => {
vertexTypeStore.resetValidateReuseErrorMessage('property');
setPropertyEditIndex(null);
vertexTypeStore.resetEditedReusablePropertyName(index);
}}
>
{t('addition.common.cancel')}
</span>
</div>
);
}
return (
<div>
<span
className="metadata-properties-manipulation"
style={{
marginRight: 16,
color: propertyEditIndex === null ? '#2b65ff' : '#999'
}}
onClick={() => {
if (propertyEditIndex !== null) {
return;
}
setPropertyEditIndex(index);
}}
>
{t('addition.operate.rename')}
</span>
<span
className="metadata-properties-manipulation"
style={{
color: propertyEditIndex === null ? '#2b65ff' : '#999'
}}
onClick={() => {
if (propertyEditIndex !== null) {
return;
}
setPropertyEditIndex(null);
vertexTypeStore.deleteReuseData('propertykey_conflicts', index);
}}
>
{t('addition.common.del')}
</span>
</div>
);
}