From 1a868116614dd9996c78e69941b537e9da19460b Mon Sep 17 00:00:00 2001 From: Aijana Schumann Date: Tue, 1 Feb 2022 13:18:42 +0100 Subject: Update ODLUX Updated to Material-ui 5, updated dashboard view, removed NetworkMap, LinkCalculator and LineOfSightApp, small bugfixes Issue-ID: CCSDK-3580 Signed-off-by: Aijana Schumann Change-Id: Id0fc148673e23a755cafc2be1c489248c38ff47c --- .../src/components/details/siteDetails.tsx | 248 --------------------- 1 file changed, 248 deletions(-) delete mode 100644 sdnr/wt/odlux/apps/networkMapApp/src/components/details/siteDetails.tsx (limited to 'sdnr/wt/odlux/apps/networkMapApp/src/components/details/siteDetails.tsx') diff --git a/sdnr/wt/odlux/apps/networkMapApp/src/components/details/siteDetails.tsx b/sdnr/wt/odlux/apps/networkMapApp/src/components/details/siteDetails.tsx deleted file mode 100644 index 7f0c1c926..000000000 --- a/sdnr/wt/odlux/apps/networkMapApp/src/components/details/siteDetails.tsx +++ /dev/null @@ -1,248 +0,0 @@ -/** - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt odlux - * ================================================================================================= - * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved. - * ================================================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - * ============LICENSE_END========================================================================== - */ - -import * as React from 'react'; -import { TextField, Tabs, Tab, Typography, AppBar, Button, Tooltip } from '@material-ui/core'; - - -import MaterialTable, { ColumnModel, ColumnType, MaterialTableCtorType } from "../../../../../framework/src/components/material-table"; - - -import { Site, Device, Address } from '../../model/site'; -import DenseTable from '../denseTable'; -import { LatLonToDMS } from '../../utils/mapUtils'; -import { CheckDeviceList, InitializeLoadedDevicesAction } from '../../actions/detailsAction'; -import { NavigateToApplication } from '../../../../../framework/src/actions/navigationActions'; -import connect, { Connect, IDispatcher } from '../../../../../framework/src/flux/connect'; -import { IApplicationStoreState } from '../../../../../framework/src/store/applicationStore'; -import StadokSite from '../../model/stadokSite'; -import { requestRest } from '../../../../../framework/src/services/restService'; -import StadokDetailsPopup from './stadokDetailsPopup'; - -type linkRow = { name: string, azimuth?: string} -type deviceRow = { id: string;type: string,name: string,manufacturer: string,owner: string,status?: string,port: number[]} - - -type panelId="links" | "nodes"; -type siteDetailProps = { - site: Site, - onLinkClick(id: string): void, -} & props; - -type props = Connect; - - -const SiteDetails: React.FunctionComponent = (props) => { - - const [value, setValue] = React.useState("links"); - const [height, setHeight] = React.useState(330); - const [openPopup, setOpenPopup] = React.useState(false); - const [staSite, setStaSite] = React.useState(null); - - const handleResize = () =>{ - const el = document.getElementById('site-details-panel')?.getBoundingClientRect(); - const el2 = document.getElementById('site-tabs')?.getBoundingClientRect(); - - if(el && el2){ - setHeight(el!.height - el2!.y +20); - } - - } - - //on mount - React.useEffect(()=>{ - handleResize(); - - window.addEventListener("resize", ()=>{console.log("really got resized.")}); - },[]); - - // on update - React.useEffect(()=>{ - - if(props.site.devices!== null && props.site.devices.length>0){ - props.initializeDevices(props.site.devices); - props.loadDevices(props.site.devices); - } - - handleResize(); - - }, [props.site]); - - const onHandleTabChange = (event: React.ChangeEvent<{}>, newValue: panelId) => { - setValue(newValue); - } - - const getFurtherInformation = (url: string) =>{ - - const request = requestRest(url, { method: "GET"}); - - request.then(result =>{ - if(result){ - setStaSite(result); - setOpenPopup(true); - }else{ - console.error(result); - } - - - }); - } - - const closePopup = () =>{ - setOpenPopup(false); - } - - //prepare link table - - let hasAzimuth = false; - const linkRows: linkRow[] = props.site.links?.map(link=> - { - if(link.azimuthB!==null){ - hasAzimuth=true; - return {name: link.name, azimuth: link.azimuthB.toFixed(2) } - - }else{ - return {name: link.name } - } - }); - - const linkTableHeader = hasAzimuth ? ["Link Name", "Azimuth in °"] : ["Link Name"]; - - //prepare device table - const deviceRows : deviceRow[] = props.updatedDevices?.map(device=>{ - return{ - id: device.id, - name: device.name, - type: device.type, - status: device.status, - manufacturer: device.manufacturer, - owner: device.owner, - port: device.port - } - }); - - - const adressString = props.site.address == null ? null : buildAdress(props.site.address); - - - return (
-

{props.site.name}

- { - props.site.operator !== '' && props.site.operator !== null ? - : - - } - { - props.site.type !== undefined && props.site.type.length > 0 && - - } - { - adressString !== null && - - } - { - props.site.heightAmslInMeters !== undefined && props.site.heightAmslInMeters > 0 && - - } - { - props.site.antennaHeightAmslInMeters !== undefined && props.site.antennaHeightAmslInMeters > 0 && - - } - - - - - - - - - - - { - value === "links" && - <> - { - props.site.links==null && - No links available. - } - - { - props.site.links?.length > 0 && - - } - - - - } - { - value === "nodes" && - <> - { - props.site.devices === null && - No nodes available. - } - - { - props.site.devices?.length>0 && props.updatedDevices !== null && - - } - - } - { - props.isSitedocReachable && props.site.furtherInformation!==null && props.site.furtherInformation.length>0 && - - } - - { - staSite !== null && openPopup && - } - -
- ) -} - -const buildAdress = (adress: Address) =>{ - - switch(adress.country){ - case "de": - return `${adress.streetAndNr}, ${adress.zipCode!== null? adress.zipCode : ''} ${adress.city}` - - case "us": - return `${adress.streetAndNr}, ${adress.city} ${adress.zipCode!== null? adress.zipCode : ''}` - - default: - console.log("address formatting for country {"+adress.country+"} not recognized, defaulting."); - return `${adress.streetAndNr}, ${adress.zipCode!== null? adress.zipCode : ''} ${adress.city}` - } - - -} - -const mapStateToProps = (state: IApplicationStoreState) => ({ - updatedDevices: state.network.details.checkedDevices, - isSitedocReachable: state.network.details.isSitedocReachable -}); - -const mapDispatchToProps = (dispatcher: IDispatcher) => ({ - initializeDevices: (devices: Device[]) => {dispatcher.dispatch(new InitializeLoadedDevicesAction(devices))}, - loadDevices: async (networkElements: Device[]) => { await dispatcher.dispatch(CheckDeviceList(networkElements)) }, - navigateToApplication: (applicationName: string, path?: string) => dispatcher.dispatch(new NavigateToApplication(applicationName, path, "test3")), - -}) - -export default connect(mapStateToProps, mapDispatchToProps)(SiteDetails); \ No newline at end of file -- cgit 1.2.3-korg