Skip to content

Commit

Permalink
Merge pull request #135 from erssebaggala/fix_refresh_db_setup
Browse files Browse the repository at this point in the history
Fix refresh db setup
  • Loading branch information
erssebaggala authored Oct 25, 2019
2 parents 957d6e3 + 478b37b commit 852bb21
Show file tree
Hide file tree
Showing 30 changed files with 460 additions and 284 deletions.
2 changes: 1 addition & 1 deletion background/background-process.html
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ <h1>Background process</h1>
try{
if(task === 'setup_database'){
//setupBodaDatabase(options.hostname, options.port, options.username, options.password);
const result = await utils.runMigrations(options.hostname, options.port, options.username, options.password);
const result = await utils.runMigrations(options.hostname, options.port, options.username, options.password, options.refreshSetup);
sendLogToUI('setup_database',result.status, result.message);
}
}catch(err){
Expand Down
2 changes: 1 addition & 1 deletion background/background-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ async function runMigrations(hostname, port, username, password, refreshSetup){

//Fresh installation
if(refreshSetup === true){

log.info("Running refresh database setup...");
const connectionString = `postgresql://${username}:${password}@${hostname}:${port}/postgres`;
const client = new Client({
connectionString: connectionString,
Expand Down
66 changes: 23 additions & 43 deletions background/kml.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ async function generate(options, type){

const dataFile = options.dataFile || null;
if(dataFile === null ) throw new Error("Data file not provided");


var workbook = XLSX.readFile(dataFile);

Expand All @@ -190,7 +191,7 @@ async function generate(options, type){
var cell = worksheet[cellRef];
headers.push(cell.v);
}

function getUniqueValuesForField(fieldName, filter){
let values = [];
const C = headers.indexOf(fieldName);
Expand Down Expand Up @@ -218,6 +219,9 @@ async function generate(options, type){
var cellRef = XLSX.utils.encode_cell(cellAddress);
var cell = worksheet[cellRef];

//skip empty values
if(cell === undefined) continue;

//Collect headers
if(values.indexOf(cell.v) < 0 ) values.push(cell.v);

Expand All @@ -232,30 +236,7 @@ async function generate(options, type){
const cellLabelIndex = headers.indexOf(options.cellLabelField);
const EARTH_RADIUS_KM = 6371*1000; //km

function getPolygonCoordinates(latitude, longitude, azimuth, radius, height, intNumSteps){
//const floAngleStep = 10; //azimuth/intNumSteps;
//const floAntAzimStart = azimuth + (intNumSteps/2) * floAngleStep;
//let coordinates = [];
//for(var i = 0; i < intNumSteps; i++){
// let lat = (latitude + 90 * radius * Math.cos(((floAntAzimStart - i * floAngleStep) * Math.PI / 180)) / (Math.PI / 2 * EARTH_RADIUS_KM));
// let lon = longitude + 90 * radius * Math.sin(((floAntAzimStart + i * floAngleStep) * Math.PI / 180)) /
// (Math.PI / 2 * EARTH_RADIUS_KM * Math.cos(((latitude + (latitude + 90 * radius * Math.cos(((floAntAzimStart + i * floAngleStep) * Math.PI / 180)) / (Math.PI / 2 * EARTH_RADIUS_KM))) / 2) * Math.PI / 180));
//
// coordinates.push([lon, lat])
//}
//
////add starting coordinates to close polygon
//coordinates.push(coordinates[0])


//intNumSteps,
//floAngleStep,
//floLongitude,
//floLatitude,
//floAntAzim,
//floCellRadiusOuter,
//floCellRadiusInner,
//floCellHeight,
function getPolygonCoordinates(latitude, longitude, azimuth, radius, height, intNumSteps){
const coordinates = createSemiDonutPolygonPoints( 5, 10, longitude, latitude, azimuth, radius, 0, height, EARTH_RADIUS_KM, Math.PI);

return coordinates;
Expand Down Expand Up @@ -353,13 +334,7 @@ async function generate(options, type){
function processFolders(folders, stream, filter){
if(folders.length === 0) {
for(var R = range.s.r + 1; R <= range.e.r; ++R) {
//for(var C = range.s.c; C <= range.e.c; ++C) {
// var cellAddress = {c:C, r:R};
// var cellRef = XLSX.utils.encode_cell(cellAddress);
// var cell = worksheet[cellRef];
//
//}


//DEBUG: STOP HERE FOR TESTING
//if(R === 2 ) return;

Expand All @@ -379,6 +354,11 @@ async function generate(options, type){
//skill row
if(!filterStatus) continue;

if( worksheet[XLSX.utils.encode_cell({c:latitudeIndex, r:R})] === undefined){
log.warn(`LATITUDE value is missing! for row=${R} and column=${latitudeIndex+1}`);
continue;
}

const latitude = worksheet[XLSX.utils.encode_cell({c:latitudeIndex, r:R})].v;
const longitude = worksheet[XLSX.utils.encode_cell({c:longitudeIndex, r:R})].v;
const azimuth = worksheet[XLSX.utils.encode_cell({c:azimuthIndex, r:R})].v;
Expand Down Expand Up @@ -530,17 +510,17 @@ async function generate(options, type){
stream.write('<open>0</open>\n');
stream.write('<description>Generated by Boda-Lite KML Generator Utility</description>\n');

stream.write(`
<ScreenOverlay>
<name>Legend: Boda-lite KML Utility</name>
<Icon>
<href>YourURL.html</href>
</Icon>
<overlayXY x="0" y="0" xunits="fraction" yunits="fraction"/>
<screenXY x="25" y="95" xunits="pixels" yunits="pixels"/>
<rotationXY x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>
<size x="0" y="0" xunits="pixels" yunits="pixels"/>
</ScreenOverlay>`);
//stream.write(`
//<ScreenOverlay>
// <name>Legend: Boda-lite KML Utility</name>
// <Icon>
// <href>YourURL.html</href>
// </Icon>
// <overlayXY x="0" y="0" xunits="fraction" yunits="fraction"/>
// <screenXY x="25" y="95" xunits="pixels" yunits="pixels"/>
// <rotationXY x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>
// <size x="0" y="0" xunits="pixels" yunits="pixels"/>
//</ScreenOverlay>`);

processFolders(options.folders, stream, {});

Expand Down
5 changes: 5 additions & 0 deletions docs/utilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ The **CSV to Excel** utility combines a list of csv files into one or different
an xlsb or xlsx file.

![GIS Module](/bts-ce-lite/img/utilities_0.3.1.png)

## KML Generator
The KML Generator Utility creates KML files for plotting network cells in Google Earth or any other tool that supports KML

![GIS Module](/bts-ce-lite/img/kml_generator.png)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Boda-Lite",
"version": "0.4.0",
"version": "0.4.1",
"description": "Boda-Lite is a telecommunication network management application",
"private": true,
"homepage": "./",
Expand Down
12 changes: 2 additions & 10 deletions src/modules/baseline/Baseline.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
import React from 'react';
import { Provider } from 'react-redux';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { connect } from 'react-redux';
import { addTab, setSidePanel } from '../layout/uilayout-actions';
import { Intent, Button, FileInput, HTMLSelect, Position,
ProgressBar, Classes, Switch, Icon, Tooltip, FormGroup, MenuItem,
import { Intent, Button, FileInput, HTMLSelect,
ProgressBar, Classes, Switch, Icon, FormGroup,
Collapse
} from "@blueprintjs/core";
import { Select } from "@blueprintjs/select";
import { AgGridReact } from 'ag-grid-react';
import 'ag-grid-community/dist/styles/ag-grid.css';
import 'ag-grid-community/dist/styles/ag-theme-balham.css';
import { runQuery, getSortAndFilteredQuery } from '../reports/DBQueryHelper.js';
import { renderToString } from 'react-dom/server';

//styles
import './baseline.css';
Expand Down Expand Up @@ -490,7 +485,6 @@ export default class Baseline extends React.Component {
},
processing: false
});
const excelFile = obj.message;
ipcRenderer.removeListener("parse-cm-request", this.addToBaselineRefListener);
this.agTblReload += 1;
this.gridApi.refreshInfiniteCache();
Expand Down Expand Up @@ -580,8 +574,6 @@ export default class Baseline extends React.Component {
</div>)
}

let outputFolderEllipsis = "file-text-dir-rtl"

return (

<div>
Expand Down
29 changes: 21 additions & 8 deletions src/modules/dashboard/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,23 +143,36 @@ class Dashboard extends React.Component {


<fieldset className="col-md-12 fieldset">
<legend className="legend">General</legend>
<legend className="legend">Utilities</legend>

<div className="row dashboard-icon">

<div className="col-md-2">
<div className="icon-display">
<a
title="Utilties"
href="#/utilities"
onClick={this.setSidePanel('UtilitiesSidePanel')}>
<FontAwesomeIcon icon="tools"/>
title="CSV to Excel"
href="#/#"
onClick={this.addTab({
component: 'CSVToExcelCombiner',
title: 'CSV to Excel'
})}>
<FontAwesomeIcon icon="file-excel"/>
</a></div>
<div className="icon-label">Utilties</div>
<div className="icon-label">CSV to Excel</div>
</div>

<div className="col-md-2">

<div className="icon-display">
<a
title="KML Generator"
href="#/#"
onClick={this.addTab({
component: 'KMLGenerator',
title: 'KML Generator'
})}>
<FontAwesomeIcon icon="globe"/>
</a></div>
<div className="icon-label">KML Generator</div>
</div>

<div className="col-md-2">
Expand Down
31 changes: 30 additions & 1 deletion src/modules/dashboard/DashboardSidepanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,40 @@ class DashboardSidePanel extends React.Component {

<a title="Reports" className="dropdown-item" href="/#" onClick={this.setSidePanel('ReportsTree')}> <FontAwesomeIcon icon="table"/> Reports</a>

<a title="Process CM dumps" className="dropdown-item" href="/#" onClick={this.addTab({
<a title="GIS" className="dropdown-item" href="/#" onClick={this.addTab({
component: 'GISMap',
title: 'GIS'
})}> <FontAwesomeIcon icon="globe-africa" /> GIS</a>


<a title="Baseline" className="dropdown-item" href="/#" onClick={this.addTab({
component: 'Baseline',
title: 'Baseline Audit'
})}> <FontAwesomeIcon icon="pencil-ruler" /> Baseline</a>


<a title="Parameter Reference" className="dropdown-item" href="/#" onClick={this.addTab({
component: 'ParameterLibrary',
title: 'Parameter Reference'
})}> <FontAwesomeIcon icon="book" /> Parameter Reference</a>



<span className="dropdown-item-text legend w-100">Utilities</span>


<a title="CSV to Excel" className="dropdown-item" href="/#" onClick={this.addTab({
component: 'CSVToExcelCombiner',
title: 'CSV to Excel'
})}> <FontAwesomeIcon icon="file-excel" /> CSV to Excel</a>

<a title="KML Generator" className="dropdown-item" href="/#" onClick={this.addTab({
component: 'KMLGenerator',
title: 'KML Generator'
})}> <FontAwesomeIcon icon="file-excel" /> KML Generator</a>



<span className="dropdown-item-text legend w-100">System</span>

<a className="dropdown-item" title="Profile" href="/#"
Expand Down
15 changes: 3 additions & 12 deletions src/modules/gis/GISMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ import 'leaflet/dist/leaflet.css';
import './gis.css';
import {
ResizeSensor,
Popover,
Button,
Intent,
PopoverInteractionKind,
Icon,
FormGroup,
InputGroup,
Expand All @@ -37,18 +35,14 @@ import {
gisUpdateCarrierColor,
gisUpdateSectorRadius
} from './gis-actions';
import { SemiCircle, SemiCircleMarker } from 'react-leaflet-semicircle';
import { SemiCircle } from 'react-leaflet-semicircle';
import 'react-leaflet-fullscreen-control'
import { FaRss } from "react-icons/fa";
import Control from 'react-leaflet-control';
import { Sidebar, Tab } from 'react-leaflet-sidetabs';
import { FiHome,
import {
FiChevronRight,
FiSearch,
FiSettings,
FiList,
FiRadio,
FiArrowRight,
FiShare2,
FiDatabase,
FiFilter } from "react-icons/fi";
Expand Down Expand Up @@ -371,9 +365,6 @@ class GISMap extends React.Component{

render(){

console.log('Rendering....');

const position = [this.state.lat, this.state.lng]
const height = this.state.height;
let center = [this.state.lat, this.state.lng]

Expand Down Expand Up @@ -412,7 +403,7 @@ class GISMap extends React.Component{
})
.map((cellid, i) => {
const cell = this.props.cells[cellid];
const beamWidth = parseInt(cell.antenna_beam) > 0 && parseInt(cell.antenna_beam) !== NaN ? cell.antenna_beam : 30;
const beamWidth = parseInt(cell.antenna_beam) > 0 && !isNaN(parseInt(cell.antenna_beam)) ? cell.antenna_beam : 30;
const lcTech = cell.technology.toLowerCase();

//Radius. Adjust by twice the last digit in the ci
Expand Down
6 changes: 3 additions & 3 deletions src/modules/gis/gis-reducer.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { GIS_CONFIRM_CELLS_RECEIVED, GIS_CONFIRM_NBRS_RECEIVED,
//Notifications
GIS_SHOW_ERROR,
GIS_SHOW_SUCCESS,
GIS_SHOW_INFO,
//GIS_SHOW_ERROR,
//GIS_SHOW_SUCCESS,
//GIS_SHOW_INFO,
GIS_HIDE_CELL_NBRS,
GIS_HIDE_RELATION,
GIS_CLEAR,
Expand Down
5 changes: 5 additions & 0 deletions src/modules/help/Help.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ export default class Help extends React.Component {
<a href="https://github.com/bodastage/bts-ce-lite/issues" onClick={this.handleOnClick}
target="_blank" rel="noopener noreferrer"> Github issue tracker</a></b></li>

<li>View <b>
<a href="https://www.bodastage.org/bts-ce-lite/docs/" onClick={this.handleOnClick}
target="_blank" rel="noopener noreferrer"> documentation</a></b> website</li>


</ul>

</div>
Expand Down
27 changes: 27 additions & 0 deletions src/modules/layout/UILayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import SplitterLayout from 'react-splitter-layout';
import 'react-splitter-layout/lib/index.css';
import './layout.less';
import VERSION from '../../version';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';

class UILayout extends React.Component {
constructor(props){
Expand Down Expand Up @@ -63,7 +64,33 @@ class UILayout extends React.Component {
icon="globe"
text="GIS"
onClick={this.addTab({component: 'GISMap',title: 'GIS'})}/>

<MenuItem
icon={<span><FontAwesomeIcon icon="pencil-ruler"/></span>}
text="Baseline Audit"
onClick={this.addTab({component: 'Baseline',title: 'Baseline Audit'})}/>

<MenuItem
icon={<span><FontAwesomeIcon icon="book"/></span>}
text="Parameter Reference"
onClick={this.addTab({component: 'ParameterLibrary',title: 'Parameter Reference'})}/>

<MenuDivider />

<MenuItem
icon={<span><FontAwesomeIcon icon="file-excel"/></span>}
text="CSV to Excel"
onClick={this.addTab({component: 'CSVToExcelCombiner',title: 'CSV to Excel'})}/>

<MenuItem
icon={<span><FontAwesomeIcon icon="globe"/></span>}
text="KML Generator"
onClick={this.addTab({component: 'KMLGenerator',title: 'KML Generator'})}/>


<MenuDivider />


<MenuItem icon="cog" text="Settings" onClick={this.addTab({
component: 'Settings', title: 'Settings'})}/>
</Menu>
Expand Down
Loading

0 comments on commit 852bb21

Please sign in to comment.