From f333557c8bf0a74eb7b88d6294dea2a420b1ec61 Mon Sep 17 00:00:00 2001 From: Aijana Schumann Date: Thu, 18 Feb 2021 10:55:11 +0100 Subject: Update NetworkMap and LinkCalculator Update NetworkMap and LinkCalculator to use the topology-server-v2 API, minior bugfixes for NetworkMap Issue-ID: CCSDK-3172 Signed-off-by: Aijana Schumann Change-Id: Ia5690c5039d7a9431443bc131fe398cc79d08287 --- .../src/handlers/linkCalculationAppRootHandler.ts | 4 +- .../src/views/linkCalculationComponent.tsx | 98 +++++++++-------- .../apps/linkCalculationApp/webpack.config.js | 14 +-- .../networkMapApp/src/actions/detailsAction.ts | 11 +- .../apps/networkMapApp/src/actions/mapActions.ts | 9 +- .../apps/networkMapApp/src/actions/popupActions.ts | 5 +- .../src/components/details/details.tsx | 17 ++- .../src/components/details/linkDetails.tsx | 2 +- .../src/components/details/siteDetails.tsx | 121 ++++++++++++++++----- .../apps/networkMapApp/src/components/map.tsx | 48 ++++---- .../apps/networkMapApp/src/components/mapPopup.tsx | 12 +- .../networkMapApp/src/components/searchBar.tsx | 12 +- sdnr/wt/odlux/apps/networkMapApp/src/config.ts | 4 +- .../networkMapApp/src/handlers/detailsReducer.ts | 14 ++- .../apps/networkMapApp/src/handlers/mapReducer.ts | 4 +- .../networkMapApp/src/handlers/popupReducer.ts | 9 +- .../apps/networkMapApp/src/model/historyEntry.ts | 4 +- sdnr/wt/odlux/apps/networkMapApp/src/model/link.ts | 8 +- .../apps/networkMapApp/src/model/popupElements.ts | 22 ++++ sdnr/wt/odlux/apps/networkMapApp/src/model/site.ts | 34 +++--- .../wt/odlux/apps/networkMapApp/src/utils/utils.ts | 6 +- sdnr/wt/odlux/apps/networkMapApp/webpack.config.js | 16 +-- sdnr/wt/odlux/framework/pom.xml | 2 +- sdnr/wt/odlux/odlux.properties | 6 +- 24 files changed, 294 insertions(+), 188 deletions(-) create mode 100644 sdnr/wt/odlux/apps/networkMapApp/src/model/popupElements.ts (limited to 'sdnr/wt/odlux') diff --git a/sdnr/wt/odlux/apps/linkCalculationApp/src/handlers/linkCalculationAppRootHandler.ts b/sdnr/wt/odlux/apps/linkCalculationApp/src/handlers/linkCalculationAppRootHandler.ts index 012e457e0..608367072 100644 --- a/sdnr/wt/odlux/apps/linkCalculationApp/src/handlers/linkCalculationAppRootHandler.ts +++ b/sdnr/wt/odlux/apps/linkCalculationApp/src/handlers/linkCalculationAppRootHandler.ts @@ -45,8 +45,8 @@ export type ILinkCalculationAppStateState= { Lon2: number, rainVal : number, rainAtt : number, - siteA: any, - siteB: any, + siteA: string, + siteB: string, reachable: boolean, polarization : string | null, amslA: number, diff --git a/sdnr/wt/odlux/apps/linkCalculationApp/src/views/linkCalculationComponent.tsx b/sdnr/wt/odlux/apps/linkCalculationApp/src/views/linkCalculationComponent.tsx index 7c54ed185..c498379b7 100644 --- a/sdnr/wt/odlux/apps/linkCalculationApp/src/views/linkCalculationComponent.tsx +++ b/sdnr/wt/odlux/apps/linkCalculationApp/src/views/linkCalculationComponent.tsx @@ -56,7 +56,7 @@ const mapProps = (state: IApplicationStoreState) => ({ month : state.linkCalculation.calculations.month }); -const BASE_URL="/topology/services" +const BASE_URL="/topology/linkcalculator" const mapDispatch = (dispatcher: IDispatcher) => ({ @@ -107,17 +107,14 @@ const mapDispatch = (dispatcher: IDispatcher) => ({ UpdateWorstMonthRain : (month:string) => { dispatcher.dispatch (new UpdateWorstMonthRainAction(month)) } - - }); - - type linkCalculationProps = Connect; interface initialState { rainMethodDisplay: boolean, + absorptionMethod : string; horizontalBoxChecked: boolean, latitude1Error: string, longitude1Error:string @@ -125,6 +122,7 @@ interface initialState { longitude2Error:string, frequencyError: string, rainMethodError: string, + attenuationMethodError : string, worstmonth : boolean, showWM : string @@ -137,19 +135,21 @@ class LinkCalculation extends React.Component{ - const result = await fetch(BASE_URL+'/calculations/distance/' + lat1 + '/' + lon1 + '/' + lat2 + '/' + lon2) + const result = await fetch(BASE_URL+'/distance/' + lat1 + ',' + lon1 + ',' + lat2 + ',' + lon2) const json = await result.json() return json.distanceInKm } @@ -176,7 +176,7 @@ class LinkCalculation extends React.Component { + rainAttCal = (lat1: any, lon1: any, lat2: any, lon2: any, frequency: any, distance: number, polarization : string, worstmonth:boolean) => { if(!worstmonth){ - fetch(BASE_URL+'/calculations/rain/Annual/' + lat1 + '/' + lon1 + '/' + lat2 + '/' + lon2 + '/' + frequency+ '/'+ distance + '/' + polarization) + fetch(BASE_URL+'/rain/annual/' + lat1 + ',' + lon1 + ',' + lat2 + ',' + lon2 + '/' + frequency+ '/'+ distance + '/' + polarization.toUpperCase()) .then(res => res.json()) - .then(result => { this.props.UpdateRainAtt(result.RainAtt) ; this.props.updateRainValue(result.rainfall) }) + .then(result => { this.props.UpdateRainAtt(result.rainAttenuation) ; this.props.updateRainValue(result.rainFall.rainrate)}) } else { - fetch(BASE_URL+'/calculations/rain/WM/' + lat1 + '/' + lon1 + '/' + lat2 + '/' + lon2 + '/' + frequency+ '/'+ distance + '/' + polarization) + fetch(BASE_URL+'/rain/worstmonth/' + lat1 + ',' + lon1 + ',' + lat2 + ',' + lon2 + '/' + frequency+ '/'+ distance + '/' + polarization.toUpperCase()) .then(res => res.json()) - .then(result => { this.props.UpdateRainAtt(result.RainAtt) ; this.props.updateRainValue(result.rainfallWM); this.props.UpdateWorstMonthRain (result.month); this.setState({showWM: '- Wm is : '})}) + .then(result => { this.props.UpdateRainAtt(result.rainAttenuation) ; this.props.updateRainValue(result.rainFall.rainrate); this.props.UpdateWorstMonthRain (result.rainFall.period); this.setState({showWM: '- Wm is : '})}) } } - manualRain = (rainfall: number, frequency: number, distance:number, polarization : any) => { - fetch(BASE_URL+'/calculations/rain/' + rainfall + '/' + frequency + '/' + distance+ '/' + polarization) + manualRain = (rainfall: number, frequency: number, distance:number, polarization : string) => { + fetch(BASE_URL+'/rain/' + rainfall + '/' + frequency + '/' + distance+ '/' + polarization.toUpperCase()) .then(res => res.json()) - .then(result => { this.props.specificRain(result.RainAtt) }) + .then(result => { this.props.specificRain(result.rainAttenuation) }) } FSL = (distance:number, frequency:number) => { - fetch(BASE_URL+'/calculations/FSL/' + distance + '/' + frequency) + fetch(BASE_URL+'/fsl/' + distance + '/' + frequency) .then(res=>res.json()) - .then (result => {this.props.FSL(result.free)}) + .then (result => {this.props.FSL(result.fspl)}) } - AbsorptionAtt =(lat1: number, lon1: number, lat2: number, lon2: number, distance:number, frequency:number, worstmonth:boolean) => { + AbsorptionAtt =(lat1: number, lon1: number, lat2: number, lon2: number, distance:number, frequency:number, worstmonth:boolean, absorptionMethod : string) => { if(!worstmonth) { - fetch(BASE_URL+'/calculations/absorption/Annual/' +lat1 + '/' + lon1 + '/' + lat2 + '/' + lon2 + '/' + distance + '/' + frequency) + fetch(BASE_URL+'/absorption/annual/' +lat1 + ',' + lon1 + ',' + lat2 + ',' + lon2 + '/' + distance + '/' + frequency + '/' +absorptionMethod) .then(res=>res.json()) - .then (result => {this.props.UpdateAbsorption(result.OxLoss, result.WaterLoss)}) + .then (result => {this.props.UpdateAbsorption(result.oxygenLoss, result.waterLoss)}) } else { - fetch(BASE_URL+'/calculations/absorption/WM/' +lat1 + '/' + lon1 + '/' + lat2 + '/' + lon2 + '/' + distance + '/' + frequency) + fetch(BASE_URL+'/absorption/annual/' +lat1 + ',' + lon1 + ',' + lat2 + ',' + lon2 + '/' + distance + '/' + frequency + '/' +absorptionMethod) .then(res=>res.json()) - .then (result => {this.props.UpdateAbsorption(result.OxLoss, result.WaterLoss)}) + .then (result => {this.props.UpdateAbsorption(result.oxygenLoss, result.waterLoss)}) } } @@ -236,11 +236,12 @@ class LinkCalculation extends React.Component { - fetch (BASE_URL+'/calculations/fsl/0/0') - .then(res => {if (res.ok) {this.props.reachable===false && this.props.UpdateConectivity(true)}else {this.props.reachable===true && this.props.UpdateConectivity(false)} }) - .catch (res => {this.props.reachable===true && this.props.UpdateConectivity(false)} ) + fetch (BASE_URL+'/fsl/1/1') + .then(res => {if (res.ok) { this.props.UpdateConectivity(true)}else {this.props.UpdateConectivity(false)} }) + .catch (res => {this.props.UpdateConectivity(false)} ) } handleChange =(e:any) => { @@ -346,7 +347,7 @@ class LinkCalculation extends React.Component
 
-
Site Name
+ {(this.props.siteA.length>0 || this.props.siteB.length>0) &&
Site Name
}
Latitude
Longitude
Azimuth
@@ -359,6 +360,7 @@ class LinkCalculation extends React.ComponentRain Model
Rainfall Rate
Rain Loss
+
Absorption Model
Oxygen Specific Attenuation
Water Vapor Specific Attenuation
@@ -366,7 +368,7 @@ class LinkCalculation extends React.Component
Site A
-
{this.props.siteA }
+ {this.props.siteA.length>0 &&
{this.props.siteA }
}
{this.props.lat1 && this.LatLonToDMS(this.props.lat1)}
{this.props.lon1 && this.LatLonToDMS(this.props.lon1)}
0
@@ -375,11 +377,11 @@ class LinkCalculation extends React.Component -
{this.props.distance.toFixed(3)} km
+
{this.props.distance?.toFixed(3)} km
{
this.props.updatePolarization(e.target.value)}>Horizontal {this.props.updatePolarization(e.target.value)}}>Vertical
}
-
{0 ? 'error' : 'input'} onChange={(e) => { this.props.updateFrequency(Number(e.target.value)); e.target.value==='0'? this.setState({frequencyError: 'select a frequency'}): this.setState({frequencyError:''})}}> @@ -391,20 +393,28 @@ class LinkCalculation extends React.Component38 GHz - }
{this.state.frequencyError}
+ }
{this.state.frequencyError}
{this.props.fsl.toFixed(3)} dB
-
{0 ? 'error' : 'input'} onChange = {(e) => {e.target.value === 'itu' ? this.setState({ rainMethodDisplay: false}):this.setState({ rainMethodDisplay: true}); e.target.value==='0'? this.setState({rainMethodError: 'select a Rain model'}): this.setState({rainMethodError:''}) }}> + - + }
{this.state.rainMethodError}
{
{ this.props.updateRainValue(Number(e.target.value)) }} value={this.props.rainVal} disabled={this.state.rainMethodDisplay === false ? true : false}> mm/hr {this.state.showWM} {this.props.month}
}
{this.props.rainAtt.toFixed(3)} dB
+ +
{}
{this.state.attenuationMethodError}
+
{this.props.absorptionOxygen.toFixed(3)} dB
{this.props.absorptionWater.toFixed(3)} dB
{