diff --git a/src/components/Resource/FacilityPortTable.jsx b/src/components/Resource/FacilityPortTable.jsx new file mode 100644 index 0000000..a77f141 --- /dev/null +++ b/src/components/Resource/FacilityPortTable.jsx @@ -0,0 +1,72 @@ +import React, { Component } from "react"; +import Table from "../common/Table"; + +class FacilityPortTable extends Component { + columns = [ + { + content: (fp) => ({fp.name}), + path: "name", + label: "Name", + }, + { + content: (fp) => ( +
+ { + fp.vlan_range && fp.vlan_range.length > 0 && + fp.vlan_range.map((range, index) => + + {`[${range}]`} + + ) + } +
+ ), + path: "vlan_range", + label: "VLAN Range" + }, + { + content: (fp) => ( +
+ { + fp.allocated_vlan_range && fp.allocated_vlan_range.length > 0 && + fp.allocated_vlan_range.map((range, index) => + + {`${range}`} + + ) + } +
+ ), + path: "allocated_vlan_range", + label: "Allocated VLAN Range" + } + ]; + + render() { + const { facilityPorts, totalCount } = this.props; + return ( +
+
+
+ Facility Ports ({totalCount}) +
+
+
+ + + + ); + } +} + +export default FacilityPortTable; diff --git a/src/components/Resource/SummaryTable.jsx b/src/components/Resource/SummaryTable.jsx index 6f35192..e88c7ff 100644 --- a/src/components/Resource/SummaryTable.jsx +++ b/src/components/Resource/SummaryTable.jsx @@ -57,7 +57,7 @@ class SummaryTable extends Component { return (
-
+
Sites ({totalCount})
@@ -79,7 +79,7 @@ class SummaryTable extends Component { */}
-
+
Component Available:
diff --git a/src/pages/PublicationTracker.jsx b/src/pages/PublicationTracker.jsx index 1b13174..847a094 100644 --- a/src/pages/PublicationTracker.jsx +++ b/src/pages/PublicationTracker.jsx @@ -134,7 +134,7 @@ class PublicationTracker extends Component { !showSpinner &&
- Displaying {totalCount} publications. + Displaying {totalCount} publications.
{ + getSiteData = () => { const { pageSize, currentPage, @@ -154,9 +159,18 @@ class Resources extends Component { return { totalCount: filtered.length, data: resources }; }; + getFPData = () => { + const { facilityPorts } = this.state; + return { totalCount: facilityPorts.length, facilityPorts: facilityPorts }; + } + + + render() { - const { pageSize, currentPage, sortColumn, searchQuery, activeDetailName } = this.state; - const { totalCount, data } = this.getPageData(); + const { pageSize, currentPage, sortColumn, searchQuery, + activeDetailName, facilityPorts } = this.state; + const { totalCount, data } = this.getSiteData(); + const { totalFPCount } = this.getFPData(); return (
@@ -199,6 +213,14 @@ class Resources extends Component { />
+
+
+ +
+
); diff --git a/src/services/parser/facilityPortsParser.js b/src/services/parser/facilityPortsParser.js new file mode 100644 index 0000000..98874f5 --- /dev/null +++ b/src/services/parser/facilityPortsParser.js @@ -0,0 +1,14 @@ +export default function parseSites(data) { + let abqm_elements = JSON.parse(data.model); + const nodes = abqm_elements.nodes; + const facility_ports = nodes.filter(n => n.Type === "FacilityPort"); + const parsedFacilityPorts = []; + for (const fp of facility_ports) { + parsedFacilityPorts.push({ + "name": fp["Name"], + "vlan_range": JSON.parse(fp["Labels"]).vlan_range, + "allocated_vlan_range": fp["LabelAllocations"] ? JSON.parse(fp["LabelAllocations"]).vlan : [] + }) + } + return parsedFacilityPorts; +} \ No newline at end of file