esnet / react-network-diagrams

Contains ESnet network mapping and circuit rendering code, as used in the ESnet portal.
http://software.es.net/react-network-diagrams
Other
196 stars 37 forks source link

Make handleSelectionChanged function dynamic #45

Closed mjtejeda closed 1 year ago

mjtejeda commented 4 years ago

Hello, I would like to know if there is a way to make the handleSelectionChanged function for the edges on the map more dynamic in order to decouple traffic data from the objects.

Here is a snippet of the code:

handleSelectionChanged(selectionType, selection) {
        if (selectionType === "edge" && selection === "MCT--SAX") {
            this.props.trafficKeyChanged("MCT - SAX");
        } else if (selectionType === "edge" && selection === "MCT--SL") {
            this.props.trafficKeyChanged("MCT - SL");
        } else if (selectionType === "edge" && selection === "MCT--AW") {
            this.props.trafficKeyChanged("MCT - AW");
        }