mirror of https://github.com/EdgeVPNio/portal.git
set subgraph cyelements to props & minor fixes.
parent
adc3b264a5
commit
1d0119d4d0
|
@ -1,3 +1,24 @@
|
||||||
|
/* EdgeVPNio
|
||||||
|
* Copyright 2021, University of Florida
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import ReactDOM from "react-dom";
|
import ReactDOM from "react-dom";
|
||||||
import CollapseButton from "./CustomCollapsibleButton";
|
import CollapseButton from "./CustomCollapsibleButton";
|
||||||
|
@ -10,11 +31,9 @@ import {
|
||||||
setRedrawGraph,
|
setRedrawGraph,
|
||||||
setSelectedElement,
|
setSelectedElement,
|
||||||
clearSelectedElement,
|
clearSelectedElement,
|
||||||
|
setSubgraphCyElements,
|
||||||
} from "../features/evio/evioSlice";
|
} from "../features/evio/evioSlice";
|
||||||
import {
|
import { elementTypes, appViews, nodeStates } from "./Shared";
|
||||||
elementTypes,
|
|
||||||
appViews,
|
|
||||||
nodeStates,} from "./Shared";
|
|
||||||
import { setCurrentView } from "../features/view/viewSlice";
|
import { setCurrentView } from "../features/view/viewSlice";
|
||||||
import { setZoomValue } from "../features/tools/toolsSlice";
|
import { setZoomValue } from "../features/tools/toolsSlice";
|
||||||
import CytoscapeComponent from "react-cytoscapejs";
|
import CytoscapeComponent from "react-cytoscapejs";
|
||||||
|
@ -295,33 +314,37 @@ class TopologyView extends React.Component {
|
||||||
>
|
>
|
||||||
{sidebarNodeslist.map((connectedNode) => {
|
{sidebarNodeslist.map((connectedNode) => {
|
||||||
try {
|
try {
|
||||||
var {connectedlinkDetail, tunnelId} = this.getConnectedLinkDetails(
|
var tunnelDetails = this.getConnectedLinkDetails(
|
||||||
cyNode,
|
cyNode,
|
||||||
connectedNode,
|
connectedNode,
|
||||||
connectedEdges
|
connectedEdges
|
||||||
);
|
); // returns { connectedlinkDetail, tunnelId }
|
||||||
var connectedNodeBtn = (
|
var connectedNodeBtn = (
|
||||||
<CollapseButton title={connectedNode.label}>
|
<CollapseButton title={connectedNode.label}>
|
||||||
<div className="DetailsLabel">Node ID</div>
|
<div className="DetailsLabel">Node ID</div>
|
||||||
<label id="valueLabel">{connectedNode.id}</label>
|
<label id="valueLabel">{connectedNode.id}</label>
|
||||||
<div className="DetailsLabel">Tunnel ID</div>
|
<div className="DetailsLabel">Tunnel ID</div>
|
||||||
<label id="valueLabel">{tunnelId}</label>
|
<label id="valueLabel">{tunnelDetails.tunnelId}</label>
|
||||||
<div className="DetailsLabel">Interface Name</div>
|
<div className="DetailsLabel">Interface Name</div>
|
||||||
<label id="valueLabel">{connectedlinkDetail.TapName}</label>
|
<label id="valueLabel">
|
||||||
|
{tunnelDetails.connectedlinkDetail.TapName}
|
||||||
|
</label>
|
||||||
<div className="DetailsLabel">MAC</div>
|
<div className="DetailsLabel">MAC</div>
|
||||||
<label id="valueLabel">{connectedlinkDetail.MAC}</label>
|
<label id="valueLabel">
|
||||||
|
{tunnelDetails.connectedlinkDetail.MAC}
|
||||||
|
</label>
|
||||||
<div className="DetailsLabel">State</div>
|
<div className="DetailsLabel">State</div>
|
||||||
<label id="valueLabel">
|
<label id="valueLabel">
|
||||||
{connectedlinkDetail.State.slice(
|
{tunnelDetails.connectedlinkDetail.State.slice(
|
||||||
7,
|
7,
|
||||||
connectedlinkDetail.State.length
|
tunnelDetails.connectedlinkDetail.State.length
|
||||||
)}
|
)}
|
||||||
</label>
|
</label>
|
||||||
<div className="DetailsLabel">Tunnel Type</div>
|
<div className="DetailsLabel">Tunnel Type</div>
|
||||||
<label id="valueLabel">
|
<label id="valueLabel">
|
||||||
{connectedlinkDetail.Type.slice(
|
{tunnelDetails.connectedlinkDetail.Type.slice(
|
||||||
6,
|
6,
|
||||||
connectedlinkDetail.Type.length
|
tunnelDetails.connectedlinkDetail.Type.length
|
||||||
)}
|
)}
|
||||||
</label>
|
</label>
|
||||||
</CollapseButton>
|
</CollapseButton>
|
||||||
|
@ -736,6 +759,12 @@ class TopologyView extends React.Component {
|
||||||
var part = this.partitionElements(selectedCyEle);
|
var part = this.partitionElements(selectedCyEle);
|
||||||
part.excluded.addClass("hidden");
|
part.excluded.addClass("hidden");
|
||||||
}
|
}
|
||||||
|
setSubgraphCyElementsProp() {
|
||||||
|
var id = JSON.parse(this.props.selectedCyElementData).id;
|
||||||
|
var selectedCyEle = this.cy.getElementById(id);
|
||||||
|
var part = this.partitionElements(selectedCyEle);
|
||||||
|
this.props.setSubgraphCyElements(part.neighborhood);
|
||||||
|
}
|
||||||
|
|
||||||
handleSwitch = (selectedTunnel, adj) => {
|
handleSwitch = (selectedTunnel, adj) => {
|
||||||
this.isSwapToggle = !this.isSwapToggle;
|
this.isSwapToggle = !this.isSwapToggle;
|
||||||
|
@ -820,7 +849,7 @@ class TopologyView extends React.Component {
|
||||||
this.autoRefresh = false;
|
this.autoRefresh = false;
|
||||||
clearTimeout(this.timeoutId);
|
clearTimeout(this.timeoutId);
|
||||||
//this.props.clearSelectedElement();
|
//this.props.clearSelectedElement();
|
||||||
this.props.setCyElements([]);
|
//this.props.setCyElements([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderTopologyContent() {
|
renderTopologyContent() {
|
||||||
|
@ -829,6 +858,7 @@ class TopologyView extends React.Component {
|
||||||
this.props.selectedView === appViews.SubgraphView
|
this.props.selectedView === appViews.SubgraphView
|
||||||
) {
|
) {
|
||||||
this.hideExcludedCyEles();
|
this.hideExcludedCyEles();
|
||||||
|
this.setSubgraphCyElementsProp();
|
||||||
} else if (
|
} else if (
|
||||||
this.props.selectedView === appViews.TopologyView &&
|
this.props.selectedView === appViews.TopologyView &&
|
||||||
this.cy !== null &&
|
this.cy !== null &&
|
||||||
|
@ -899,6 +929,7 @@ const mapDispatchToProps = {
|
||||||
setCyElements,
|
setCyElements,
|
||||||
setRedrawGraph,
|
setRedrawGraph,
|
||||||
setSelectedElement,
|
setSelectedElement,
|
||||||
|
setSubgraphCyElements,
|
||||||
clearSelectedElement,
|
clearSelectedElement,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue