Revert some changes and bugfixes

This commit is contained in:
2017-04-05 11:24:58 +02:00
parent efc2f1284d
commit ba5715c613
6 changed files with 19 additions and 20 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+4 -4
View File
@@ -56,13 +56,13 @@ var __metadata = (this && this.__metadata) || function (k, v) {
var DataService = (function () { var DataService = (function () {
function DataService(http) { function DataService(http) {
this.http = http; this.http = http;
this.dashboardURL = '/webapi/data'; this.baseUrl = '/webapi/data';
} }
DataService.prototype.dashboard = function () { DataService.prototype.get = function () {
var lineChartData$ = var lineChartData$ =
//<LineData>( {data: [65, 59, 80, 81, 56, 55, 40], label: 'Series A'} ); //<LineData>( {data: [65, 59, 80, 81, 56, 55, 40], label: 'Series A'} );
this.http this.http
.get(("" + this.dashboardURL), { headers: this.getHeaders() }) .get(("" + this.baseUrl), { headers: this.getHeaders() })
.map(mapData); .map(mapData);
return lineChartData$; return lineChartData$;
}; };
@@ -323,7 +323,7 @@ var LineChartComponent = (function () {
LineChartComponent.prototype.ngOnInit = function () { LineChartComponent.prototype.ngOnInit = function () {
var _this = this; var _this = this;
this.dataService this.dataService
.dashboard() .get()
.subscribe(function (res) { .subscribe(function (res) {
console.log("Received from service:"); console.log("Received from service:");
console.log(res); console.log(res);
+1 -1
View File
File diff suppressed because one or more lines are too long
+9 -10
View File
@@ -25,8 +25,6 @@ router.post('/device', function(req, res){
}); });
router.get('/device', function(req, res){ router.get('/device', function(req, res){
connection.query( connection.query(
@@ -43,18 +41,11 @@ router.get('/device', function(req, res){
}); });
}); });
/* GET api listing. */
router.get('/', function(req, res) {
res.status(200);
res.send("{\"success\":\"true\"}");
});
router.get('/data', function(req, res) { router.get('/data', function(req, res) {
connection.query( connection.query(
'SELECT TOE1`, time FROM measurement ORDER BY time DESC LIMIT 0,10', 'SELECT TOE1, time FROM measurement ORDER BY time DESC LIMIT 0,10',
function (error, results, fields) { function (error, results, fields) {
if (error) throw error; if (error) throw error;
@@ -69,4 +60,12 @@ router.get('/data', function(req, res) {
}); });
/* GET api listing. */
router.get('/', function(req, res) {
res.status(200);
res.send("{\"success\":\"true\"}");
});
module.exports = router; module.exports = router;
+1 -1
View File
@@ -43,7 +43,7 @@ export class LineChartComponent implements OnInit {
ngOnInit(): void { ngOnInit(): void {
this.dataService this.dataService
.dashboard() .get()
.subscribe(res => { .subscribe(res => {
console.log("Received from service:"); console.log("Received from service:");
console.log(res); console.log(res);
+3 -3
View File
@@ -9,15 +9,15 @@ import { LabelData } from './label-data';
@Injectable() @Injectable()
export class DataService { export class DataService {
private dashboardURL: string = '/webapi/data'; private baseUrl: string = '/webapi/data';
constructor(private http : Http){} constructor(private http : Http){}
dashboard(): Observable<GraphData> { get(): Observable<GraphData> {
let lineChartData$ = let lineChartData$ =
//<LineData>( {data: [65, 59, 80, 81, 56, 55, 40], label: 'Series A'} ); //<LineData>( {data: [65, 59, 80, 81, 56, 55, 40], label: 'Series A'} );
this.http this.http
.get((`${this.dashboardURL}`) .get((`${this.baseUrl}`)
, {headers: this.getHeaders()}) , {headers: this.getHeaders()})
.map(mapData); .map(mapData);