2 * ============LICENSE_START========================================================================
3 * ONAP : ccsdk feature sdnr wt odlux
4 * =================================================================================================
5 * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved.
6 * =================================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software distributed under the License
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14 * or implied. See the License for the specific language governing permissions and limitations under
16 * ============LICENSE_END==========================================================================
19 import * as React from 'react';
20 import { Paper, Typography, Tooltip } from '@material-ui/core';
21 import InfoIcon from '@material-ui/icons/Info';
23 import { IApplicationStoreState } from '../../../../framework/src/store/applicationStore';
24 import connect, { IDispatcher, Connect } from '../../../../framework/src/flux/connect';
26 type props = Connect<typeof mapStateToProps, typeof mapDispatchToProps>;
28 const mapStateToProps = (state: IApplicationStoreState) => ({
29 linkCount: state.network.map.statistics.links,
30 siteCount: state.network.map.statistics.sites,
31 isTopoServerReachable: state.network.connectivity.isToplogyServerAvailable,
32 isTileServerReachable: state.network.connectivity.isTileServerAvailable,
36 const mapDispatchToProps = (dispatcher: IDispatcher) => ({
39 const Statistics: React.FunctionComponent<props> = (props: props) =>{
41 const reachabe = props.isTopoServerReachable && props.isTileServerReachable;
44 return (<Paper style={{ padding: 5, position: 'absolute', display: 'flex', flexDirection: "column", top: 70, width: 200, marginLeft: 5 }}>
45 <div style={{ display: 'flex', flexDirection: "row" }}>
46 <Typography style={{ fontWeight: "bold", flex: "1", color: reachabe ? "black" : "lightgrey" }} >Statistics</Typography>
47 <Tooltip style={{ alignSelf: "flex-end" }} title="Gets updated when the map stops moving.">
48 <InfoIcon fontSize="small" />
52 <Typography style={{ color: reachabe ? "black" : "lightgrey" }}>Sites: {props.siteCount}</Typography>
53 <Typography style={{ color: reachabe ? "black" : "lightgrey" }}>Links: {props.linkCount}</Typography>
57 export default connect(mapStateToProps, mapDispatchToProps)(Statistics);