Skip to content
Snippets Groups Projects
Commit cc598b91 authored by Saket Agrahari's avatar Saket Agrahari
Browse files

[COMP-345] : Pert Team

parent 91933750
Branches
Tags
1 merge request!104[COMP-345] : Pert Team
......@@ -21,6 +21,7 @@ import {ConnectivityCategory, ServiceCategory} from "./Schema";
import ConnectedUserPage from "./pages/ConnectedUser";
import FibreLightPage from "./pages/FibreLight";
import MonitoringToolsPage from "./pages/MonitoringTools";
import NetworkPertTeam from "./pages/NetworkPertTeam";
const router = createBrowserRouter([
{ path: "/budget", element: <BudgetPage /> },
......@@ -53,6 +54,7 @@ const router = createBrowserRouter([
{ path: "/professional-services", element: <ServicesPage category={ServiceCategory.professional_services} /> },
{ path: "/fibre-light", element: <FibreLightPage /> },
{ path: "/monitoring-tools", element: <MonitoringToolsPage /> },
{ path: "/pert-team", element: <NetworkPertTeam /> },
{ path: "*", element: <Landing /> },
]);
......
......@@ -41,6 +41,10 @@ export interface FibreLight extends NrenAndYearDatapoint {
light_description: (string | null)
}
export interface PertTeam extends NrenAndYearDatapoint {
pert_team: (string | null)
}
export interface MonitoringTools extends NrenAndYearDatapoint {
tool_descriptions: (string | null)[],
netflow_processing_description: (string | null)
......
......@@ -22,6 +22,11 @@ const NetworkSidebar = () => {
<span>Tools for Monitoring or Troubleshooting the Network - Offered to Client Institutions</span>
</Link>
</Row>
<Row>
<Link to="/pert-team" className="link-text-underline">
<span>NRENs with Performance Enhancement Response Teams</span>
</Link>
</Row>
</Sidebar>
)
}
......
......@@ -152,7 +152,12 @@ function CompendiumData(): ReactElement {
<Link to="/monitoring-tools" className="link-text-underline">
<span>Tools for Monitoring or Troubleshooting the Network - Offered to Client Institutions</span>
</Link>
</Row>
</Row>
<Row>
<Link to="/pert-team" className="link-text-underline">
<span>NRENs with Performance Enhancement Response Teams</span>
</Link>
</Row>
</div>
</CollapsibleBox>
<CollapsibleBox title={Sections.Services} startCollapsed>
......
import React, { useContext } from "react";
import { Table } from "react-bootstrap";
import { PertTeam } from "../Schema";
import { createMatrixDataLookup } from "../helpers/dataconversion";
import ColorPill from "../components/ColorPill";
import DataPage from "../components/DataPage";
import Filter from "../components/graphing/Filter";
import { Sections } from "../helpers/constants";
import { FilterSelectionContext } from "../helpers/FilterSelectionProvider";
import ChartContainer from "../components/graphing/ChartContainer";
import { useData } from "../helpers/useData";
function NetworkPertTeam(): React.ReactElement {
const { filterSelection, setFilterSelection } = useContext(FilterSelectionContext);
const { data: pertTeamData, years, nrens } = useData<PertTeam>('/api/network/pert-team', setFilterSelection);
const selectedData = (pertTeamData).filter(data =>
filterSelection.selectedYears.includes(data.year) && filterSelection.selectedNrens.includes(data.nren)
);
const dataLookup = createMatrixDataLookup(selectedData, 'pert_team');
const filterNode = <Filter
filterOptions={{ availableYears: [...years], availableNrens: [...nrens.values()] }}
filterSelection={filterSelection}
setFilterSelection={setFilterSelection}
coloredYears
/>
const showYears = [...filterSelection.selectedYears.filter(year => years.has(year))].sort();
return (
<DataPage title="NRENs with Performance Enhancement Response Teams"
description="Some NRENs have an in-house Performance Enhancement Response Team,
or PERT, to investigate network performance issues."
category={Sections.Network} filter={filterNode}
data={selectedData} filename="fibre_light_of_nrens_per_year">
<>
<ChartContainer>
<Table className="charging-struct-table" striped bordered responsive>
<colgroup>
<col span={1} style={{ width: "25%" }} />
<col span={1} style={{ width: "25%" }} />
<col span={1} style={{ width: "25%" }} />
<col span={1} style={{ width: "25%" }} />
</colgroup>
<thead>
<tr>
<th></th>
<th>Yes</th>
<th>No</th>
<th>Planned</th>
</tr>
</thead>
<tbody>
{Array.from(dataLookup.entries()).map(([nren, nrenMap]) => (
<tr key={nren}>
<td>{nren}</td>
{["yes",
"no",
"planned"].map(column_key => (
<td key={column_key}>
{nrenMap.has(column_key) &&
showYears.map(year => {
const chargingYears = nrenMap.get(column_key)!;
return <ColorPill key={year} year={year} active={chargingYears.has(year)} tooltip={""}/>;
})
}
</td>
))}
</tr>
))}
</tbody>
</Table>
</ChartContainer>
</>
</DataPage>
);
}
export default NetworkPertTeam;
......@@ -21,6 +21,7 @@ from compendium_v2.routes.connectivity import routes as connectivity
from compendium_v2.routes.data_download import routes as data_download
from compendium_v2.routes.fibre_light import routes as fibre_light
from compendium_v2.routes.monitoring_tools import routes as monitoring_tools
from compendium_v2.routes.network import routes as network
routes = Blueprint('compendium-v2-api', __name__)
routes.register_blueprint(budget_routes, url_prefix='/budget')
......@@ -41,6 +42,7 @@ routes.register_blueprint(connectivity, url_prefix='/connectivity')
routes.register_blueprint(data_download, url_prefix='/data-download')
routes.register_blueprint(fibre_light, url_prefix='/fibre-light')
routes.register_blueprint(monitoring_tools, url_prefix='/monitoring-tools')
routes.register_blueprint(network, url_prefix='/network')
logger = logging.getLogger(__name__)
......
......@@ -6,7 +6,7 @@ from flask import Blueprint, jsonify
routes = Blueprint('monitoring-tools', __name__)
MONITORING_TOLS_RESPONSE_SCHEMA = {
MONITORING_TOOLS_RESPONSE_SCHEMA = {
'$schema': 'http://json-schema.org/draft-07/schema#',
'definitions': {
'monitoring_tools': {
......@@ -18,7 +18,7 @@ MONITORING_TOLS_RESPONSE_SCHEMA = {
'tool_descriptions': {'type': 'array', 'items': {'type': 'string'}},
'netflow_processing_description': {'type': 'array', 'items': {'type': 'string'}}
},
'required': ['nren', 'nren_country', 'year', 'light_description'],
'required': ['nren', 'nren_country', 'year', 'tool_descriptions'],
'additionalProperties': False
}
},
......@@ -41,7 +41,7 @@ def network_monitoring_tools_extract_data(monitoring_tools: MonitoringTools) ->
@common.require_accepts_json
def monitoring_tools_view() -> Any:
"""
handler for /api/fibre-light/ requests
handler for /api/monitoring-tools/ requests
Endpoint for getting the fibre operation models the NREN.
This endpoint retrieves fibre operation model that of the NREN.
......@@ -49,7 +49,7 @@ def monitoring_tools_view() -> Any:
response will be formatted as:
.. asjson::
compendium_v2.routes.monitoring_tools.MONITORING_TOLS_RESPONSE_SCHEMA
compendium_v2.routes.monitoring_tools.MONITORING_TOOLS_RESPONSE_SCHEMA
:return:
"""
......
from typing import Any
from compendium_v2.db.presentation_models import PertTeam
from compendium_v2.routes import common
from flask import Blueprint, jsonify
routes = Blueprint('network', __name__)
PERT_TEAM_RESPONSE_SCHEMA = {
'$schema': 'http://json-schema.org/draft-07/schema#',
'definitions': {
'pert_team': {
'type': 'object',
'properties': {
'nren': {'type': 'string'},
'nren_country': {'type': 'string'},
'year': {'type': 'integer'},
'pert_team': {'type': 'array', 'items': {'type': 'string'}}
},
'required': ['nren', 'nren_country', 'year', 'pert_team'],
'additionalProperties': False
}
},
'type': 'array',
'items': {'$ref': '#/definitions/pert_team'}
}
def pert_team_extract_data(pert_team: PertTeam) -> dict:
return {
'nren': pert_team.nren.name,
'nren_country': pert_team.nren.country,
'year': int(pert_team.year),
'pert_team': pert_team.pert_team.value,
}
@routes.route('/pert-team', methods=['GET'])
@common.require_accepts_json
def pert_team_view() -> Any:
"""
handler for /api/network/pert-team requests
Endpoint for getting the fibre operation models the NREN.
This endpoint retrieves fibre operation model that of the NREN.
response will be formatted as:
.. asjson::
compendium_v2.routes.monitoring_tools.PERT_TEAM_RESPONSE_SCHEMA
:return:
"""
entries = []
records = common.get_data(PertTeam)
for entry in records:
entries.append(pert_team_extract_data(entry))
return jsonify(entries)
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment