From ba5715c6138f6fc055eeb6664982e934808b4f7d Mon Sep 17 00:00:00 2001 From: kennyboy55 Date: Wed, 5 Apr 2017 11:24:58 +0200 Subject: [PATCH] Revert some changes and bugfixes --- mean-app/dist/inline.bundle.map | 2 +- mean-app/dist/main.bundle.js | 8 ++++---- mean-app/dist/main.bundle.map | 2 +- mean-app/server/routes/webapi.js | 19 +++++++++---------- mean-app/src/app/chart.component.ts | 2 +- mean-app/src/app/data.service.ts | 6 +++--- 6 files changed, 19 insertions(+), 20 deletions(-) diff --git a/mean-app/dist/inline.bundle.map b/mean-app/dist/inline.bundle.map index 79e8d4d..5245a94 100644 --- a/mean-app/dist/inline.bundle.map +++ b/mean-app/dist/inline.bundle.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 03ea958628999344f79d"],"names":[],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAQ,oBAAoB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAY,2BAA2B;AACvC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAI;AACJ;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA,kDAA0C,oBAAoB,WAAW","file":"inline.bundle.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [], result;\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId])\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);\n \t\twhile(resolves.length)\n \t\t\tresolves.shift()();\n \t\tif(executeModules) {\n \t\t\tfor(i=0; i < executeModules.length; i++) {\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = executeModules[i]);\n \t\t\t}\n \t\t}\n \t\treturn result;\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// objects to store loaded and loading chunks\n \tvar installedChunks = {\n \t\t4: 0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n \t// This file contains only the entry chunk.\n \t// The chunk loading function for additional chunks\n \t__webpack_require__.e = function requireEnsure(chunkId) {\n \t\tif(installedChunks[chunkId] === 0)\n \t\t\treturn Promise.resolve();\n\n \t\t// an Promise means \"currently loading\".\n \t\tif(installedChunks[chunkId]) {\n \t\t\treturn installedChunks[chunkId][2];\n \t\t}\n \t\t// start chunk loading\n \t\tvar head = document.getElementsByTagName('head')[0];\n \t\tvar script = document.createElement('script');\n \t\tscript.type = 'text/javascript';\n \t\tscript.charset = 'utf-8';\n \t\tscript.async = true;\n \t\tscript.timeout = 120000;\n\n \t\tif (__webpack_require__.nc) {\n \t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n \t\t}\n \t\tscript.src = __webpack_require__.p + \"\" + chunkId + \".chunk.js\";\n \t\tvar timeout = setTimeout(onScriptComplete, 120000);\n \t\tscript.onerror = script.onload = onScriptComplete;\n \t\tfunction onScriptComplete() {\n \t\t\t// avoid mem leaks in IE.\n \t\t\tscript.onerror = script.onload = null;\n \t\t\tclearTimeout(timeout);\n \t\t\tvar chunk = installedChunks[chunkId];\n \t\t\tif(chunk !== 0) {\n \t\t\t\tif(chunk) chunk[1](new Error('Loading chunk ' + chunkId + ' failed.'));\n \t\t\t\tinstalledChunks[chunkId] = undefined;\n \t\t\t}\n \t\t};\n\n \t\tvar promise = new Promise(function(resolve, reject) {\n \t\t\tinstalledChunks[chunkId] = [resolve, reject];\n \t\t});\n \t\tinstalledChunks[chunkId][2] = promise;\n\n \t\thead.appendChild(script);\n \t\treturn promise;\n \t};\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 03ea958628999344f79d"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap faca4d869629051ae6a9"],"names":[],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAQ,oBAAoB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAY,2BAA2B;AACvC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAI;AACJ;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA,kDAA0C,oBAAoB,WAAW","file":"inline.bundle.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [], result;\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId])\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);\n \t\twhile(resolves.length)\n \t\t\tresolves.shift()();\n \t\tif(executeModules) {\n \t\t\tfor(i=0; i < executeModules.length; i++) {\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = executeModules[i]);\n \t\t\t}\n \t\t}\n \t\treturn result;\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// objects to store loaded and loading chunks\n \tvar installedChunks = {\n \t\t4: 0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n \t// This file contains only the entry chunk.\n \t// The chunk loading function for additional chunks\n \t__webpack_require__.e = function requireEnsure(chunkId) {\n \t\tif(installedChunks[chunkId] === 0)\n \t\t\treturn Promise.resolve();\n\n \t\t// an Promise means \"currently loading\".\n \t\tif(installedChunks[chunkId]) {\n \t\t\treturn installedChunks[chunkId][2];\n \t\t}\n \t\t// start chunk loading\n \t\tvar head = document.getElementsByTagName('head')[0];\n \t\tvar script = document.createElement('script');\n \t\tscript.type = 'text/javascript';\n \t\tscript.charset = 'utf-8';\n \t\tscript.async = true;\n \t\tscript.timeout = 120000;\n\n \t\tif (__webpack_require__.nc) {\n \t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n \t\t}\n \t\tscript.src = __webpack_require__.p + \"\" + chunkId + \".chunk.js\";\n \t\tvar timeout = setTimeout(onScriptComplete, 120000);\n \t\tscript.onerror = script.onload = onScriptComplete;\n \t\tfunction onScriptComplete() {\n \t\t\t// avoid mem leaks in IE.\n \t\t\tscript.onerror = script.onload = null;\n \t\t\tclearTimeout(timeout);\n \t\t\tvar chunk = installedChunks[chunkId];\n \t\t\tif(chunk !== 0) {\n \t\t\t\tif(chunk) chunk[1](new Error('Loading chunk ' + chunkId + ' failed.'));\n \t\t\t\tinstalledChunks[chunkId] = undefined;\n \t\t\t}\n \t\t};\n\n \t\tvar promise = new Promise(function(resolve, reject) {\n \t\t\tinstalledChunks[chunkId] = [resolve, reject];\n \t\t});\n \t\tinstalledChunks[chunkId][2] = promise;\n\n \t\thead.appendChild(script);\n \t\treturn promise;\n \t};\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap faca4d869629051ae6a9"],"sourceRoot":""} \ No newline at end of file diff --git a/mean-app/dist/main.bundle.js b/mean-app/dist/main.bundle.js index cc25b8a..19d49f7 100644 --- a/mean-app/dist/main.bundle.js +++ b/mean-app/dist/main.bundle.js @@ -56,13 +56,13 @@ var __metadata = (this && this.__metadata) || function (k, v) { var DataService = (function () { function DataService(http) { this.http = http; - this.dashboardURL = '/webapi/data'; + this.baseUrl = '/webapi/data'; } - DataService.prototype.dashboard = function () { + DataService.prototype.get = function () { var lineChartData$ = //( {data: [65, 59, 80, 81, 56, 55, 40], label: 'Series A'} ); this.http - .get(("" + this.dashboardURL), { headers: this.getHeaders() }) + .get(("" + this.baseUrl), { headers: this.getHeaders() }) .map(mapData); return lineChartData$; }; @@ -323,7 +323,7 @@ var LineChartComponent = (function () { LineChartComponent.prototype.ngOnInit = function () { var _this = this; this.dataService - .dashboard() + .get() .subscribe(function (res) { console.log("Received from service:"); console.log(res); diff --git a/mean-app/dist/main.bundle.map b/mean-app/dist/main.bundle.map index 8e0f980..3aad264 100644 --- a/mean-app/dist/main.bundle.map +++ b/mean-app/dist/main.bundle.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///./src/app/dashboard.component.ts","webpack:///./src/app/data.service.ts","webpack:///./src async","webpack:///./src/main.ts","webpack:///./src/app/app-routing.module.ts","webpack:///./src/app/app.component.ts","webpack:///./src/app/app.module.ts","webpack:///./src/app/chart.component.ts","webpack:///./src/environments/environment.ts","webpack:///./src/app/app.component.css","webpack:///./src/app/app.component.html","webpack:///./src/app/chart.component.html","webpack:///./src/app/dashboard.component.html"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAyC;AAOzC;IAAA;IAEA,CAAC;IAPD;QAAC,+EAAS,CAAC;YACT,QAAQ,EAAE,WAAW;YACrB,kCAAyC;SAC1C,CAAC;;0BAAA;IAIF,yBAAC;AAAD,CAAC;;;;;;;;;;;;;;;;;;;;;;;ACTyC;AAEZ;AACyB;AAOvD;IAGE,qBAAoB,IAAW;QAAX,SAAI,GAAJ,IAAI,CAAO;QAFvB,iBAAY,GAAW,cAAc,CAAC;IAEb,CAAC;IAElC,+BAAS,GAAT;QACE,IAAI,cAAc;QAChB,wEAAwE;QACxE,IAAI,CAAC,IAAI;aACN,GAAG,CAAC,CAAC,KAAG,IAAI,CAAC,YAAc,CAAC,EACzB,EAAC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,EAAC,CAAC;aAChC,GAAG,CAAC,OAAO,CAAC,CAAC;QAElB,MAAM,CAAC,cAAc,CAAC;IACxB,CAAC;IAEO,gCAAU,GAAlB;QACE,IAAI,OAAO,GAAG,IAAI,8DAAO,EAAE,CAAC;QAC5B,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;QAC7C,MAAM,CAAC,OAAO,CAAC;IACjB,CAAC;IArBH;QAAC,gFAAU,EAAE;;mBAAA;IAsBb,kBAAC;;AAAD,CAAC;AAED,iBAAiB,QAAiB;IAChC,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,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C,aAAa,CAAC,CAAC;YAEhC,KAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QAE5B,CAAC,CAAC,CAAC;QAEL,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;IA1DD;QAAC,+EAAS,CAAC,yEAAkB,CAAC;;qDAAA;IANhC;QAAC,+EAAS,CAAC;YACT,QAAQ,EAAE,YAAY;YACtB,kCAAqC;SACtC,CAAC;;0BAAA;IA8DF,yBAAC;;AAAD,CAAC;;;;;;;;;ACvED;AAAA,mFAAmF;AACnF,8FAA8F;AAC9F,yEAAyE;AACzE,+EAA+E;AAExE,IAAM,WAAW,GAAG;IACzB,UAAU,EAAE,KAAK;CAClB,CAAC;;;;;;;;ACPF,mB;;;;;;;ACAA,klCAAklC,OAAO,kI;;;;;;;ACAzlC,uGAAuG,2Y;;;;;;;ACAvG,iE","file":"main.bundle.js","sourcesContent":["import { Component } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'dashboard',\r\n templateUrl: './dashboard.component.html'\r\n})\r\n\r\nexport class DashboardComponent {\r\n\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/app/dashboard.component.ts","import { Injectable } from '@angular/core';\r\nimport { Observable } from 'rxjs/Rx';\r\nimport 'rxjs/add/operator/map'\r\nimport { Http, Response, Headers } from '@angular/http';\r\n\r\nimport { LineData } from './line-data';\r\nimport { GraphData } from './graph-data';\r\nimport { LabelData } from './label-data';\r\n\r\n@Injectable()\r\nexport class DataService {\r\n private dashboardURL: string = '/webapi/data';\r\n\r\n constructor(private http : Http){}\r\n\r\n dashboard(): Observable {\r\n let lineChartData$ =\r\n //( {data: [65, 59, 80, 81, 56, 55, 40], label: 'Series A'} );\r\n this.http\r\n .get((`${this.dashboardURL}`)\r\n , {headers: this.getHeaders()})\r\n .map(mapData);\r\n\r\n return lineChartData$;\r\n }\r\n\r\n private getHeaders(){\r\n let headers = new Headers();\r\n headers.append('Accept', 'application/json');\r\n return headers;\r\n }\r\n}\r\n\r\nfunction mapData(response:Response): GraphData {\r\n let nums = response.json().map(toData);\r\n let times = response.json().map(timeToData)\r\n\r\n let line:LineData = ({data: nums, label: \"Energieverbruik\"});\r\n let label:LabelData = ({data: times});\r\n let graph:GraphData = ({lines:line,labels:label});\r\n return graph;\r\n}\r\n\r\nfunction toData(r:any){\r\n let num = r.TOE1;\r\n return num;\r\n}\r\n\r\nfunction timeToData(r:any){\r\n let times = r.time.substring(11,19);\r\n return times;\r\n}\r\n\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/app/data.service.ts","function webpackEmptyContext(req) {\n\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n}\nwebpackEmptyContext.keys = function() { return []; };\nwebpackEmptyContext.resolve = webpackEmptyContext;\nmodule.exports = webpackEmptyContext;\nwebpackEmptyContext.id = 386;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src async\n// module id = 386\n// module chunks = 1","import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';\r\nimport { enableProdMode } from '@angular/core';\r\nimport { environment } from './environments/environment';\r\nimport { AppModule } from './app/app.module';\r\n\r\nif (environment.production) {\r\n enableProdMode();\r\n}\r\n\r\nplatformBrowserDynamic().bootstrapModule(AppModule);\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/main.ts","import { NgModule } from '@angular/core';\r\nimport { RouterModule, Routes } from '@angular/router';\r\nimport { DashboardComponent } from './dashboard.component';\r\n\r\nconst routes: Routes = [\r\n { path: '', redirectTo: '/dashboard', pathMatch: 'full' },\r\n { path: 'dashboard', component: DashboardComponent },\r\n];\r\n@NgModule({\r\n imports: [ RouterModule.forRoot(routes) ],\r\n exports: [ RouterModule ]\r\n})\r\nexport class AppRoutingModule {}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/app/app-routing.module.ts","import { Component } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'app-root',\r\n templateUrl: './app.component.html',\r\n styleUrls: ['./app.component.css']\r\n})\r\nexport class AppComponent {\r\n title = 'Energie';\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/app/app.component.ts","import { BrowserModule } from '@angular/platform-browser';\r\nimport { NgModule } from '@angular/core';\r\nimport { FormsModule } from '@angular/forms';\r\nimport { HttpModule } from '@angular/http';\r\nimport { ChartsModule } from 'ng2-charts/ng2-charts';\r\n\r\nimport { AppRoutingModule } from './app-routing.module';\r\n\r\nimport { AppComponent } from './app.component';\r\nimport { LineChartComponent } from './chart.component';\r\nimport { DashboardComponent } from './dashboard.component';\r\n\r\nimport { DataService } from './data.service';\r\n\r\n@NgModule({\r\n declarations: [\r\n AppComponent,\r\n LineChartComponent,\r\n DashboardComponent\r\n ],\r\n imports: [\r\n BrowserModule,\r\n FormsModule,\r\n HttpModule,\r\n ChartsModule,\r\n AppRoutingModule\r\n ],\r\n providers: [DataService],\r\n bootstrap: [AppComponent]\r\n})\r\nexport class AppModule { }\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/app/app.module.ts","import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';\r\nimport { DataService } from './data.service';\r\n\r\nimport { LineData } from './line-data';\r\nimport { BaseChartDirective } from 'ng2-charts/ng2-charts';\r\n\r\n@Component({\r\n selector: 'line-chart',\r\n templateUrl: './chart.component.html'\r\n})\r\nexport class LineChartComponent implements OnInit {\r\n\r\n @ViewChild(BaseChartDirective) public chart: BaseChartDirective;\r\n\r\n // lineChart\r\n public lineChartData:Array = [\r\n {data: [0,0,0,0,0,0,0], label: 'Totaal verbruik'}\r\n ];\r\n public lineChartLabels:Array = ['-1', '-2', '-3', '-4', '-5', '-6', '-7'];\r\n public lineChartOptions:any = {\r\n responsive: true,\r\n title: {\r\n display: true,\r\n position: 'left',\r\n text: 'Watt'\r\n }\r\n };\r\n public lineChartColors:Array = [\r\n { // grey\r\n backgroundColor: 'rgba(148,159,177,0.2)',\r\n borderColor: 'rgba(148,159,177,1)',\r\n pointBackgroundColor: 'rgba(148,159,177,1)',\r\n pointBorderColor: '#fff',\r\n pointHoverBackgroundColor: '#fff',\r\n pointHoverBorderColor: 'rgba(148,159,177,0.8)'\r\n }\r\n ];\r\n public lineChartLegend:boolean = true;\r\n public lineChartType:string = 'line';\r\n\r\n constructor(private dataService: DataService) {}\r\n\r\n ngOnInit(): void {\r\n\r\n this.dataService\r\n .dashboard()\r\n .subscribe(res => {\r\n console.log(\"Received from service:\");\r\n console.log(res);\r\n\r\n const newDataSet2 = [];\r\n newDataSet2.push(res.labels.data.slice());\r\n this.lineChartLabels = newDataSet2;\r\n\r\n console.log(\"Updated labels array\");\r\n console.log(this.lineChartLabels);\r\n\r\n const newDataSet = [];\r\n const newLine = {data: res.lines.data, label: res.lines.label};\r\n newDataSet.push(newLine);\r\n this.lineChartData = newDataSet;\r\n\r\n console.log(\"Updated lines array\");\r\n console.log(this.lineChartData);\r\n\r\n this.chart.chart.update();\r\n\r\n });\r\n\r\n console.log(\"Init\");\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/app/chart.component.ts","// The file contents for the current environment will overwrite these during build.\r\n// The build system defaults to the dev environment which uses `environment.ts`, but if you do\r\n// `ng build --env=prod` then `environment.prod.ts` will be used instead.\r\n// The list of which env maps to which file can be found in `angular-cli.json`.\r\n\r\nexport const environment = {\r\n production: false\r\n};\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/environments/environment.ts","module.exports = \"\"\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/app/app.component.css\n// module id = 665\n// module chunks = 1","module.exports = \"
\\r\\n\\r\\n \\r\\n\\r\\n
\\r\\n\\r\\n
\\r\\n
\\r\\n

{{title}} Avans

\\r\\n
\\r\\n
\\r\\n\\r\\n \\r\\n\\r\\n
\\r\\n
\\r\\n\"\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/app/app.component.html\n// module id = 666\n// module chunks = 1","module.exports = \"
\\r\\n
\\r\\n
\\r\\n \\r\\n
\\r\\n
\\r\\n
\"\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/app/chart.component.html\n// module id = 667\n// module chunks = 1","module.exports = \"
\\r\\n\\t\\r\\n
\"\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/app/dashboard.component.html\n// module id = 668\n// module chunks = 1"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///./src/app/dashboard.component.ts","webpack:///./src/app/data.service.ts","webpack:///./src async","webpack:///./src/main.ts","webpack:///./src/app/app-routing.module.ts","webpack:///./src/app/app.component.ts","webpack:///./src/app/app.module.ts","webpack:///./src/app/chart.component.ts","webpack:///./src/environments/environment.ts","webpack:///./src/app/app.component.css","webpack:///./src/app/app.component.html","webpack:///./src/app/chart.component.html","webpack:///./src/app/dashboard.component.html"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAyC;AAOzC;IAAA;IAEA,CAAC;IAPD;QAAC,+EAAS,CAAC;YACT,QAAQ,EAAE,WAAW;YACrB,kCAAyC;SAC1C,CAAC;;0BAAA;IAIF,yBAAC;AAAD,CAAC;;;;;;;;;;;;;;;;;;;;;;;ACTyC;AAEZ;AACyB;AAOvD;IAGE,qBAAoB,IAAW;QAAX,SAAI,GAAJ,IAAI,CAAO;QAFvB,YAAO,GAAW,cAAc,CAAC;IAER,CAAC;IAElC,yBAAG,GAAH;QACE,IAAI,cAAc;QAChB,wEAAwE;QACxE,IAAI,CAAC,IAAI;aACN,GAAG,CAAC,CAAC,KAAG,IAAI,CAAC,OAAS,CAAC,EACpB,EAAC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,EAAC,CAAC;aAChC,GAAG,CAAC,OAAO,CAAC,CAAC;QAElB,MAAM,CAAC,cAAc,CAAC;IACxB,CAAC;IAEO,gCAAU,GAAlB;QACE,IAAI,OAAO,GAAG,IAAI,8DAAO,EAAE,CAAC;QAC5B,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;QAC7C,MAAM,CAAC,OAAO,CAAC;IACjB,CAAC;IArBH;QAAC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AAI,CAAC,aAAa,GAAG,UAAU,CAAC;YAEhC,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;YACnC,OAAO,CAAC,GAAG,CAAC,KAAI,CAAC,aAAa,CAAC,CAAC;YAEhC,KAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QAE5B,CAAC,CAAC,CAAC;QAEL,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;IA1DD;QAAC,+EAAS,CAAC,yEAAkB,CAAC;;qDAAA;IANhC;QAAC,+EAAS,CAAC;YACT,QAAQ,EAAE,YAAY;YACtB,kCAAqC;SACtC,CAAC;;0BAAA;IA8DF,yBAAC;;AAAD,CAAC;;;;;;;;;ACvED;AAAA,mFAAmF;AACnF,8FAA8F;AAC9F,yEAAyE;AACzE,+EAA+E;AAExE,IAAM,WAAW,GAAG;IACzB,UAAU,EAAE,KAAK;CAClB,CAAC;;;;;;;;ACPF,mB;;;;;;;ACAA,klCAAklC,OAAO,kI;;;;;;;ACAzlC,uGAAuG,2Y;;;;;;;ACAvG,iE","file":"main.bundle.js","sourcesContent":["import { Component } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'dashboard',\r\n templateUrl: './dashboard.component.html'\r\n})\r\n\r\nexport class DashboardComponent {\r\n\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/app/dashboard.component.ts","import { Injectable } from '@angular/core';\r\nimport { Observable } from 'rxjs/Rx';\r\nimport 'rxjs/add/operator/map'\r\nimport { Http, Response, Headers } from '@angular/http';\r\n\r\nimport { LineData } from './line-data';\r\nimport { GraphData } from './graph-data';\r\nimport { LabelData } from './label-data';\r\n\r\n@Injectable()\r\nexport class DataService {\r\n private baseUrl: string = '/webapi/data';\r\n\r\n constructor(private http : Http){}\r\n\r\n get(): Observable {\r\n let lineChartData$ =\r\n //( {data: [65, 59, 80, 81, 56, 55, 40], label: 'Series A'} );\r\n this.http\r\n .get((`${this.baseUrl}`)\r\n , {headers: this.getHeaders()})\r\n .map(mapData);\r\n\r\n return lineChartData$;\r\n }\r\n\r\n private getHeaders(){\r\n let headers = new Headers();\r\n headers.append('Accept', 'application/json');\r\n return headers;\r\n }\r\n}\r\n\r\nfunction mapData(response:Response): GraphData {\r\n let nums = response.json().map(toData);\r\n let times = response.json().map(timeToData)\r\n\r\n let line:LineData = ({data: nums, label: \"Energieverbruik\"});\r\n let label:LabelData = ({data: times});\r\n let graph:GraphData = ({lines:line,labels:label});\r\n return graph;\r\n}\r\n\r\nfunction toData(r:any){\r\n let num = r.TOE1;\r\n return num;\r\n}\r\n\r\nfunction timeToData(r:any){\r\n let times = r.time.substring(11,19);\r\n return times;\r\n}\r\n\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/app/data.service.ts","function webpackEmptyContext(req) {\n\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n}\nwebpackEmptyContext.keys = function() { return []; };\nwebpackEmptyContext.resolve = webpackEmptyContext;\nmodule.exports = webpackEmptyContext;\nwebpackEmptyContext.id = 386;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src async\n// module id = 386\n// module chunks = 1","import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';\r\nimport { enableProdMode } from '@angular/core';\r\nimport { environment } from './environments/environment';\r\nimport { AppModule } from './app/app.module';\r\n\r\nif (environment.production) {\r\n enableProdMode();\r\n}\r\n\r\nplatformBrowserDynamic().bootstrapModule(AppModule);\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/main.ts","import { NgModule } from '@angular/core';\r\nimport { RouterModule, Routes } from '@angular/router';\r\nimport { DashboardComponent } from './dashboard.component';\r\n\r\nconst routes: Routes = [\r\n { path: '', redirectTo: '/dashboard', pathMatch: 'full' },\r\n { path: 'dashboard', component: DashboardComponent },\r\n];\r\n@NgModule({\r\n imports: [ RouterModule.forRoot(routes) ],\r\n exports: [ RouterModule ]\r\n})\r\nexport class AppRoutingModule {}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/app/app-routing.module.ts","import { Component } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'app-root',\r\n templateUrl: './app.component.html',\r\n styleUrls: ['./app.component.css']\r\n})\r\nexport class AppComponent {\r\n title = 'Energie';\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/app/app.component.ts","import { BrowserModule } from '@angular/platform-browser';\r\nimport { NgModule } from '@angular/core';\r\nimport { FormsModule } from '@angular/forms';\r\nimport { HttpModule } from '@angular/http';\r\nimport { ChartsModule } from 'ng2-charts/ng2-charts';\r\n\r\nimport { AppRoutingModule } from './app-routing.module';\r\n\r\nimport { AppComponent } from './app.component';\r\nimport { LineChartComponent } from './chart.component';\r\nimport { DashboardComponent } from './dashboard.component';\r\n\r\nimport { DataService } from './data.service';\r\n\r\n@NgModule({\r\n declarations: [\r\n AppComponent,\r\n LineChartComponent,\r\n DashboardComponent\r\n ],\r\n imports: [\r\n BrowserModule,\r\n FormsModule,\r\n HttpModule,\r\n ChartsModule,\r\n AppRoutingModule\r\n ],\r\n providers: [DataService],\r\n bootstrap: [AppComponent]\r\n})\r\nexport class AppModule { }\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/app/app.module.ts","import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';\r\nimport { DataService } from './data.service';\r\n\r\nimport { LineData } from './line-data';\r\nimport { BaseChartDirective } from 'ng2-charts/ng2-charts';\r\n\r\n@Component({\r\n selector: 'line-chart',\r\n templateUrl: './chart.component.html'\r\n})\r\nexport class LineChartComponent implements OnInit {\r\n\r\n @ViewChild(BaseChartDirective) public chart: BaseChartDirective;\r\n\r\n // lineChart\r\n public lineChartData:Array = [\r\n {data: [0,0,0,0,0,0,0], label: 'Totaal verbruik'}\r\n ];\r\n public lineChartLabels:Array = ['-1', '-2', '-3', '-4', '-5', '-6', '-7'];\r\n public lineChartOptions:any = {\r\n responsive: true,\r\n title: {\r\n display: true,\r\n position: 'left',\r\n text: 'Watt'\r\n }\r\n };\r\n public lineChartColors:Array = [\r\n { // grey\r\n backgroundColor: 'rgba(148,159,177,0.2)',\r\n borderColor: 'rgba(148,159,177,1)',\r\n pointBackgroundColor: 'rgba(148,159,177,1)',\r\n pointBorderColor: '#fff',\r\n pointHoverBackgroundColor: '#fff',\r\n pointHoverBorderColor: 'rgba(148,159,177,0.8)'\r\n }\r\n ];\r\n public lineChartLegend:boolean = true;\r\n public lineChartType:string = 'line';\r\n\r\n constructor(private dataService: DataService) {}\r\n\r\n ngOnInit(): void {\r\n\r\n this.dataService\r\n .get()\r\n .subscribe(res => {\r\n console.log(\"Received from service:\");\r\n console.log(res);\r\n\r\n const newDataSet2 = [];\r\n newDataSet2.push(res.labels.data.slice());\r\n this.lineChartLabels = newDataSet2;\r\n\r\n console.log(\"Updated labels array\");\r\n console.log(this.lineChartLabels);\r\n\r\n const newDataSet = [];\r\n const newLine = {data: res.lines.data, label: res.lines.label};\r\n newDataSet.push(newLine);\r\n this.lineChartData = newDataSet;\r\n\r\n console.log(\"Updated lines array\");\r\n console.log(this.lineChartData);\r\n\r\n this.chart.chart.update();\r\n\r\n });\r\n\r\n console.log(\"Init\");\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/app/chart.component.ts","// The file contents for the current environment will overwrite these during build.\r\n// The build system defaults to the dev environment which uses `environment.ts`, but if you do\r\n// `ng build --env=prod` then `environment.prod.ts` will be used instead.\r\n// The list of which env maps to which file can be found in `angular-cli.json`.\r\n\r\nexport const environment = {\r\n production: false\r\n};\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/environments/environment.ts","module.exports = \"\"\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/app/app.component.css\n// module id = 665\n// module chunks = 1","module.exports = \"
\\r\\n\\r\\n \\r\\n\\r\\n
\\r\\n\\r\\n
\\r\\n
\\r\\n

{{title}} Avans

\\r\\n
\\r\\n
\\r\\n\\r\\n \\r\\n\\r\\n
\\r\\n
\\r\\n\"\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/app/app.component.html\n// module id = 666\n// module chunks = 1","module.exports = \"
\\r\\n
\\r\\n
\\r\\n \\r\\n
\\r\\n
\\r\\n
\"\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/app/chart.component.html\n// module id = 667\n// module chunks = 1","module.exports = \"
\\r\\n\\t\\r\\n
\"\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/app/dashboard.component.html\n// module id = 668\n// module chunks = 1"],"sourceRoot":""} \ No newline at end of file diff --git a/mean-app/server/routes/webapi.js b/mean-app/server/routes/webapi.js index be9a397..3d887ef 100644 --- a/mean-app/server/routes/webapi.js +++ b/mean-app/server/routes/webapi.js @@ -25,8 +25,6 @@ router.post('/device', function(req, res){ }); - - router.get('/device', function(req, res){ 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) { 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) { 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; diff --git a/mean-app/src/app/chart.component.ts b/mean-app/src/app/chart.component.ts index 74c0a79..ff4b928 100644 --- a/mean-app/src/app/chart.component.ts +++ b/mean-app/src/app/chart.component.ts @@ -43,7 +43,7 @@ export class LineChartComponent implements OnInit { ngOnInit(): void { this.dataService - .dashboard() + .get() .subscribe(res => { console.log("Received from service:"); console.log(res); diff --git a/mean-app/src/app/data.service.ts b/mean-app/src/app/data.service.ts index 17670a6..74348b4 100644 --- a/mean-app/src/app/data.service.ts +++ b/mean-app/src/app/data.service.ts @@ -9,15 +9,15 @@ import { LabelData } from './label-data'; @Injectable() export class DataService { - private dashboardURL: string = '/webapi/data'; + private baseUrl: string = '/webapi/data'; constructor(private http : Http){} - dashboard(): Observable { + get(): Observable { let lineChartData$ = //( {data: [65, 59, 80, 81, 56, 55, 40], label: 'Series A'} ); this.http - .get((`${this.dashboardURL}`) + .get((`${this.baseUrl}`) , {headers: this.getHeaders()}) .map(mapData);