Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean modules #271

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
459775b
Clean modules
erssebaggala Aug 6, 2023
46c79e2
change openItem to openPath
erssebaggala Aug 7, 2023
03fa79d
Remove database from settings
erssebaggala Aug 7, 2023
e00fad1
add contextIsolation and use preload to expose api to renderer
erssebaggala Aug 10, 2023
2f8cbd3
Run migrations on initial installation
erssebaggala Aug 10, 2023
4b482fe
add first, last and other names to users model
erssebaggala Aug 10, 2023
06f1dbb
move excel manipulation logic to libs/excel.js
erssebaggala Aug 11, 2023
2b76981
fix report module
erssebaggala Aug 12, 2023
d2d8a12
setup node api modules
erssebaggala Aug 14, 2023
5652e2e
use node-gyp for napi addon native modules
erssebaggala Aug 16, 2023
d353b69
add spdlog, pugiml and fast-cpp-csv-parser to external deps for napi…
erssebaggala Aug 16, 2023
da350a9
rename module to telecomparser
erssebaggala Aug 19, 2023
3acd218
implement bulkcm parser as native module
erssebaggala Aug 19, 2023
29dfd50
rename parserr module to telecomparser
erssebaggala Aug 19, 2023
c63e500
fix bulkcmparser
erssebaggala Aug 20, 2023
d38d3ea
bulkcmparser completed
erssebaggala Aug 20, 2023
6927633
add licence notice
erssebaggala Aug 20, 2023
b8ae887
rename parser to boda-telecomparser
erssebaggala Aug 20, 2023
1b69dc4
add boost to external folder to fix issues on windows builts
erssebaggala Aug 24, 2023
5e320e5
add huaweil mml parser
erssebaggala Aug 25, 2023
1aceb77
add RuntimeTypeInfo to VCCLCompilerTool
erssebaggala Aug 25, 2023
6205b21
determine how OS path sep is determined
erssebaggala Aug 25, 2023
b40d318
fix folder selection on parse and import module
erssebaggala Aug 25, 2023
cb50b2e
fix windows compiler errors
erssebaggala Aug 25, 2023
3836a2d
update umzug to 3.3.1
erssebaggala Aug 27, 2023
4dd3b35
update model classes
erssebaggala Aug 27, 2023
150ac7e
make parsers context aware
erssebaggala Aug 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ venv
nbproject

docs/_build
boda-lite.sqlite3
db/boda-lite.sqlite3
boda-lite.sqlite.*

**/.DS_Store
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dist: trusty # use Ubuntu Trusty for Linux operation system
sudo: false

language: node_js
node_js: "10"
node_js: "16"

env:
global:
Expand All @@ -31,7 +31,6 @@ cache:

before_install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install rpm; fi

install:
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then npm install --global --production windows-build-tools --vs2015; fi
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then powershell -ExecutionPolicy ByPass -File db/scripts/travis_download_pg.ps1; fi
Expand Down
75 changes: 75 additions & 0 deletions DEVREADME.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Development notes

## Windows setup
* install windows build tools -- 2017+ preferred
* install paython 3+
* install nodejs 16+
* clone the repo
* con

## Setup
- install dependencies: `npm install` or yarn install
- Run web app: yarn run start
- Run electron: yarn run electron-dev-unix
- Running migrations: npx sequelize-cli db:migrate


## Migrations
```
#create model
npx sequelize-cli model:generate --name reports_categories --attributes name:string,parent_id:integer,notes:text,in_built:boolean,created_by:integer,updated_by:integer,created_at:date,updated_at:date

npx sequelize-cli model:generate --name reports --attributes name:string,parent_id:integer,notes:text,query:text,options:text,type:string,category_id:integer,in_built:boolean,created_by:integer,updated_by:integer,created_at:date,updated_at:date


#running migrations
npx sequelize-cli db:migrate

#undo migrations
npx sequelize-cli db:migrate:undo

#creating seed data
npx sequelize-cli seed:generate --name demo-user

#running seed data
npx sequelize-cli db:seed:all

#undoing seeders
npx sequelize-cli db:seed:undo


```

## Native modules

### Verify required tools are installed on linux or mac
```
node --version
npm --version
python --version
git --version
cc --version
make --version
```

## Add externals folder to vscode include path

* go to the extension settings
* locate the C/C++: Include Path setting
* Click "Add item" and insert the path to the externals folder.
* alternatively, search for @ext:ms-vscode.cpptools includePath in the settings search box and add the path to the externals folder.


## Installing libxml2 on macos

```
brew install automake autoconf libtool libxml2 pkg-config
brew link libxml2; fi

```


## Resources

* https://nodejs.github.io/node-addon-examples/about/what
* https://github.com/atiqg/Nodejs-Napi-Addon-Using-Cmake
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ platform telecommunication management desktop app.

![BTS-CE-Lite GIS](/gis.jpeg?raw=true "GIS")



## Running dev mode
``` bash
export SKIP_PREFLIGHT_CHECK=true
yarn run start

#
yarn run electron-dev-unix
```

## Getting help
To report issues with the application or request new features use the issue tracker. For help and customizations send an email to [email protected].

Expand Down
2 changes: 2 additions & 0 deletions __tests__/data/sample_csvs/csv1.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
csv1-header1,csv1-header2,csv1-header3
csv1-row1,csv1-row2,csv1-row3
2 changes: 2 additions & 0 deletions __tests__/data/sample_csvs/csv2.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
csv2-header1,csv2-header2,csv2-header3
csv2-row1,csv2-row2,csv2-row3
217 changes: 217 additions & 0 deletions backend/ipc/actions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
const path = require('path');
const { shell, app, dialog } = require('electron');
const db = require('../libs/db');
const reports = require('../libs/reports');
const excel = require('../libs/excel');
const workerHelper = require('../workers/worker-helper');


const ACTIONS = [

//generic database query
{
name: 'db.query',
handler: async (args) => {
console.log('db.query:', args);
const results = await db.runQuery(args);
return results;
}
},

{
name: 'db.migrate-up',
handler: (args) => {
console.log('db.migrate-up');
return db.migrateUp();
}
},

{
name: 'reports.create-category',
handler: (args) => {
console.log('reports.create-category');
return reports.createCategory(args);
}
},
{
name: 'reports.create-report',
handler: (args) => {
console.log('reports.create-report');
return reports.createReport(args);
}
},
{
name: 'reports.update-report',
handler: (args) => {
console.log('reports.update-report');
return reports.updateReport(args);
}
},
{
name: 'shell.open-path',
handler: (args) => {
console.log('shell.open-path', args);
shell.openPath(args);
return true;
}
},
{
name: 'shell.open-link',
handler: (args) => {
console.log('shell.open-link', args);
shell.openExternal(args);
return true;
}
},
{
name: 'dialog.open-directory',
handler: (args) => {
console.log('dialog.open-directory', args);
var path = dialog.showOpenDialog({
properties: ['openDirectory']
});
return path;
}
},
{
name: 'log.add',
handler: (args) => {
console.log('log.add');
return true;
}
},
{
name: 'log.open-file',
handler: (args) => {
console.log('log.add');
return true;
}
},
{
name: 'cm.parse-cm-data',
handler: async (args) => {
console.log('cm.parse-cm-data', args);
const worker_script = path.join(__dirname, '..', 'workers/parse-cm-data.js');
result = await workerHelper.runWorkerScript(worker_script, args);
return result;

console.log('cm.parse-cm-data');
return true;
}
},
{
name: 'cm.load-cm-data',
handler: (args) => {
//@TODO: use a worker thread to parse cm data
console.log('cm.parse-cm-data');
return true;
}
},
{
name: 'reports.download',
handler: (args) => {
console.log('reports.download', args);
return true;
}
},
{
name: 'shell.show-item-in-folder',
handler: (args) => {
console.log('shell.show-item-in-folder', args);
shell.showItemInFolder(args.path);
return true;
}
},
{
name: 'app.get-path',
handler: (args) => {
console.log('app.get-path', args);
app.getPath(args.path);
return true;
}
},
{
name: 'gis.upload-file',
handler: (args) => {
console.log('gis.upload-file', args);
return true;
}

},
{
name: 'baseline.run',
handler: (args) => {
console.log('baseline.run', args);
return true;
}

},
{
name: 'baseline.upload',
handler: (args) => {
console.log('baseline.upload', args);
return true;
}
},
{
name: 'telecomlib.upload-parameter-reference',
handler: (args) => {
console.log('telecomlib.upload-parameter-reference', args);
return true;
}
},
{
name: 'telecomlib.auto-generate-parameter-reference',
handler: (args) => {
console.log('telecomlib.auto-generate-parameter-reference', args);
return true;
}
},
{
name: 'utilities.convert-csv-to-excel',
handler: async (args) => {
console.log('utilities.convert-csv-to-excel', args);
const worker_script = path.join(__dirname, '..', 'workers/csv-to-excel.js');
result = await workerHelper.runWorkerScript(worker_script, {
...args,
outputFolder: '/Users/ssebaggala/Development/BodastageGithub/bts-ce-lite' //args.outputFolder || app.getPath('downloads')
});

return result;

}
},
{
name: 'kml.get-data-header',
handler: (args) => {
console.log('kml.get-data-header', args);
return true;
}
},{
name: 'kml.generate-kml-file',
handler: (args) => {
console.log('kml.generate-kml-file', args);
return true;
}
},
{
name: 'log.open-log-file',
handler: (args) => {
console.log('log.open-log-file', args);
return true;
}
},
{
name: 'baseline.download-ref',
handler: (args) => {
console.log('baseline.download-ref', args);
return true;
}
}

];


module.exports = {
ACTIONS
}
5 changes: 5 additions & 0 deletions backend/ipc/init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const { start } = require('./start.js')
const { ACTIONS } = require('./actions.js');

// initialize & start IPC listener
start(ACTIONS);
23 changes: 23 additions & 0 deletions backend/ipc/start.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// initialize & start IPC listener

const { ipcMain } = require('electron')

// recieve ipc channel names & initialize them
const start = async (actions = []) => {
// start event listeners for each route
actions.forEach(action => (
ipcMain.handle(`${action.name}`, async (event, arg) => {
// Test args here:
// console.log('arg here', arg) // prints arg
const result = await action.handler(arg)
// event.returnValue -> synchronous reply
// event.reply -> async reply
return event.reply = result
})
))
}


module.exports = {
start
}
Loading