Skip to content

Commit

Permalink
Remove customization settings for VAST18 (#2)
Browse files Browse the repository at this point in the history
* remove: Customization for VAST18

* package clean
  • Loading branch information
hijiangtao authored May 2, 2018
1 parent 433965a commit 9f90c11
Show file tree
Hide file tree
Showing 24 changed files with 46 additions and 933 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,3 @@ typings/
.env

# customize configuration
conf/db.js
103 changes: 5 additions & 98 deletions api/v1/index.js
Original file line number Diff line number Diff line change
@@ -1,110 +1,17 @@
import {
connectMySQL,
jsonpTransfer
} from '../../util/base';
import {
queryGraph,
queryTest,
queryClusterDots,
queryTripFlow,
queryTreeMap,
queryAngleClusterStats,
queryAbnormalStats
queryTest
} from '../../util/agg-utils';
import {
mysqlParams
} from '../../conf/db';
import {
initAngleClusterParams,
initTreeMapParams,
initAbnormalStatsParams
} from '../../util/params';
import path from 'path';
import fs from 'fs';

const mysqlPool = connectMySQL(mysqlParams);

const testGraph = async (ctx, next) => {
ctx.body = await queryTest(mysqlPool);
}

/**
* 基本图查询后台 API 实现
* @param {*} ctx
* @param {*} next
*/
const basicGraph = async (ctx, next) => {
let queryParams = ctx.query,
cbFunc = queryParams.callback;

const res = await queryGraph({
mysqlPool
}, queryParams);
return ctx.body = jsonpTransfer(res, queryParams);
}

const clusterDots = async (ctx, next) => {
let queryParams = ctx.query,
cbFunc = queryParams.callback;
const test = async (ctx, next) => {
let queryParams = ctx.query;

const res = await queryClusterDots({
mysqlPool
}, queryParams);
const res = await queryTest();
return ctx.body = jsonpTransfer(res, queryParams);
}

const tripFlow = async (ctx, next) => {
let queryParams = ctx.query,
cbFunc = queryParams.callback;

const res = await queryTripFlow({
mysqlPool
}, queryParams);
return ctx.body = jsonpTransfer(res, queryParams);
}

const treeMap = async (ctx, next) => {
let params = ctx.query,
cbFunc = params.callback;

const queryParams = initTreeMapParams(params);

let file = path.resolve(queryParams.ResFilePath, queryParams.ResFileName),
ifResExist = fs.existsSync(file);

// console.log("queryParams.seedStrength: ", queryParams.seedStrength)
// let res = ifResExist ? JSON.parse(fs.readFileSync(file)) : await queryTreeMap(queryParams);
let res = await queryTreeMap(queryParams);

return ctx.body = jsonpTransfer(res, params);
}

const angleClusterStats = async (ctx, next) => {
let params = ctx.query,
cbFunc = params.callback;

const queryParams = initAngleClusterParams(params);

const res = await queryAngleClusterStats(queryParams);
return ctx.body = jsonpTransfer(res, params);
}

const abnormalStats = async (ctx, next) => {
let params = ctx.query,
cbFunc = params.callback;

const queryParams = initAbnormalStatsParams(params);

const res = await queryAbnormalStats(queryParams);
return ctx.body = jsonpTransfer(res, params);
}

export {
testGraph,
basicGraph,
clusterDots,
tripFlow,
treeMap,
angleClusterStats,
abnormalStats
test
}
12 changes: 12 additions & 0 deletions conf/db.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const mysqlParams = {
connectionLimit: 10,
host: '192.168.0.1',
user: 'root',
password: '',
database: '',
debug: true
}

export {
mysqlParams
}
1 change: 0 additions & 1 deletion conf/demo/div_to_poi_20160705112017070517.json

This file was deleted.

1 change: 0 additions & 1 deletion conf/demo/poi_to_div_20160705112017070517.json

This file was deleted.

33 changes: 0 additions & 33 deletions conf/format.js

This file was deleted.

15 changes: 0 additions & 15 deletions conf/sql.js

This file was deleted.

17 changes: 6 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
{
"name": "psychic-eureka",
"version": "1.0.0",
"description": "A simple backend server implementation Edit",
"name": "simple-server",
"version": "1.0.1",
"description": "A simple backend server implementation with Koa2",
"main": "index.js",
"scripts": {
"dev": "node index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/hijiangtao/psychic-eureka.git"
"url": "git+https://github.com/hijiangtao/simple-server.git"
},
"author": "Joe Jiang",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/hijiangtao/psychic-eureka/issues"
"url": "https://github.com/hijiangtao/simple-server/issues"
},
"homepage": "https://github.com/hijiangtao/psychic-eureka#readme",
"homepage": "https://github.com/hijiangtao/simple-server#readme",
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-preset-env": "^1.6.1",
"babel-preset-es2015": "^6.24.1",
"csvtojson": "^1.1.9",
"ejs": "^2.5.7",
"koa": "^2.4.1",
"koa-logger": "^3.1.0",
"koa-router": "^7.2.1",
"koa-static": "^4.0.1",
"koa-webpack": "^2.0.3",
"path": "^0.12.7",
"python-shell": "^0.5.0",
"webpack-dev-middleware": "^2.0.4",
"webpack-hot-middleware": "^2.21.0"
},
Expand All @@ -39,10 +37,7 @@
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-register": "^6.26.0",
"d3": "^4.12.2",
"koa-views": "^6.1.2",
"mongodb": "^3.0.1",
"mysql": "^2.15.0",
"webpack": "^3.10.0"
}
}
5 changes: 1 addition & 4 deletions public/css/demo.css
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
body {
/* background: yellow; */
/* background-image: url('../img/demo.png') */
}
body {}
26 changes: 0 additions & 26 deletions public/js/demo.js
Original file line number Diff line number Diff line change
@@ -1,26 +0,0 @@
// import d3 from 'd3';

// console.log('Updating');

// let t = () => {
// return new Promise((resolve, reject) => {
// resolve("Resolve ok");
// });
// }

// t().then(res => {
// alert(`Promise result: ${res}`)
// }).catch(err => {
// throw new Error("Err");
// });

// let asyncTest = async() => {
// alert('Async before');
// let after = await t();
// alert(`Async result: ${after}`);
// alert('Async after');
// }

// alert("Normally Hi");

// asyncTest();
10 changes: 4 additions & 6 deletions router/root.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ const Router = require('koa-router');
const router = new Router();

router
.get('/home', async(ctx) => {
.get('/', async (ctx) => {
await ctx.render('home', {});
})
.get('/home', async (ctx) => {
await ctx.render('home', {});
});

// router
// .get('/home', async(ctx) => {
// await ctx.render('home', {});
// });

module.exports = router;
8 changes: 1 addition & 7 deletions router/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ const router = new Router({
import * as api from '../api/v1/index.js';

router
.get('/testGraph', api.testGraph)
.get('/basicGraph', api.basicGraph)
.get('/clusterDots', api.clusterDots)
.get('/tripFlow', api.tripFlow)
.get('/treeMap', api.treeMap)
.get('/angleClusterStats', api.angleClusterStats)
.get('/abnormalStats', api.abnormalStats);
.get('/test', api.test);

module.exports = router;
26 changes: 1 addition & 25 deletions util/agg-utils.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,7 @@
import {
test as queryTest
} from './methods/test';
import {
queryGraph
} from './methods/queryGraph';
import {
queryClusterDots
} from './methods/queryClusterDots';
import {
queryTripFlow
} from './methods/queryTripFlow';
import {
queryTreeMap
} from './methods/queryTreeMap';
import {
queryAngleClusterStats
} from './methods/queryAngleClusterStats';
import {
queryAbnormalStats
} from './methods/queryAbnormalStats';

export {
queryTest,
queryGraph,
queryClusterDots,
queryTripFlow,
queryTreeMap,
queryAngleClusterStats,
queryAbnormalStats
queryTest
}
Loading

0 comments on commit 9f90c11

Please sign in to comment.