in hugegraph-hubble/hubble-fe/src/stores/GraphManagementStore/dataAnalyzeStore/dataAnalyzeStore.ts [502:576]
syncGraphEditableProperties(type: 'vertex' | 'edge') {
Object.values(this.editedSelectedGraphDataProperties).forEach(
(property) => {
property.clear();
}
);
const selectedLabel =
type === 'vertex'
? this.vertexTypes.find(
({ name }) => name === this.selectedGraphData.label
)
: this.edgeTypes.find(
({ name }) => name === this.selectedGraphLinkData.label
);
if (!isUndefined(selectedLabel)) {
const selectedGraphData =
type === 'vertex' ? this.selectedGraphData : this.selectedGraphLinkData;
const selectedGraphDataPropertKeys = Object.keys(
type === 'vertex'
? this.selectedGraphData.properties
: this.selectedGraphLinkData.properties
);
// to keep sort of primary keys, need to iter it first
if (type === 'vertex') {
(selectedLabel as VertexType).primary_keys.forEach((name) => {
if (selectedGraphDataPropertKeys.includes(name)) {
this.editedSelectedGraphDataProperties.primary.set(
name,
convertArrayToString(selectedGraphData.properties[name])
);
remove(selectedGraphDataPropertKeys, (key) => key === name);
}
});
} else {
(selectedLabel as EdgeType).sort_keys.forEach((name) => {
if (selectedGraphDataPropertKeys.includes(name)) {
this.editedSelectedGraphDataProperties.primary.set(
name,
convertArrayToString(selectedGraphData.properties[name])
);
remove(selectedGraphDataPropertKeys, (key) => key === name);
}
});
}
selectedLabel.properties
.filter(({ nullable }) => !nullable)
.forEach(({ name }) => {
if (selectedGraphDataPropertKeys.includes(name)) {
this.editedSelectedGraphDataProperties.nonNullable.set(
name,
convertArrayToString(selectedGraphData.properties[name])
);
}
remove(selectedGraphDataPropertKeys, (key) => key === name);
});
selectedLabel.properties
.filter(({ nullable }) => nullable)
.forEach(({ name }) => {
if (selectedGraphDataPropertKeys.includes(name)) {
this.editedSelectedGraphDataProperties.nullable.set(
name,
convertArrayToString(selectedGraphData.properties[name])
);
}
});
}
}