From 727026dfe3713f75b1eaef74f1956ba764812c90 Mon Sep 17 00:00:00 2001 From: Emil Abraham Date: Mon, 18 Mar 2019 22:00:25 -0400 Subject: [PATCH 1/5] base of statistics branch, added metrics service --- src/app/services/metrics.service.spec.ts | 12 ++ src/app/services/metrics.service.ts | 23 ++++ src/app/statistics/statistics.component.css | 120 ------------------- src/app/statistics/statistics.component.html | 78 +++--------- src/app/statistics/statistics.component.ts | 17 ++- 5 files changed, 64 insertions(+), 186 deletions(-) create mode 100644 src/app/services/metrics.service.spec.ts create mode 100644 src/app/services/metrics.service.ts diff --git a/src/app/services/metrics.service.spec.ts b/src/app/services/metrics.service.spec.ts new file mode 100644 index 0000000..56233d4 --- /dev/null +++ b/src/app/services/metrics.service.spec.ts @@ -0,0 +1,12 @@ +import { TestBed } from '@angular/core/testing'; + +import { MetricsService } from './metrics.service'; + +describe('MetricsService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: MetricsService = TestBed.get(MetricsService); + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/services/metrics.service.ts b/src/app/services/metrics.service.ts new file mode 100644 index 0000000..0b4f3e0 --- /dev/null +++ b/src/app/services/metrics.service.ts @@ -0,0 +1,23 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs/Observable'; +import 'rxjs/add/observable/throw'; +import 'rxjs/add/operator/catch'; +import { ReplaySubject } from 'rxjs'; + + +@Injectable({ + providedIn: 'root' +}) +export class MetricsService { + + constructor(private http: HttpClient) { } + + getRecentMetrics(token) { + return this.http.post('http://localhost:3000/data/exp/month/1', { + headers: { + Authorization: 'Bearer ' + 'eyJhbGciOiJSUzI1NiJ9.eyJpZCI6MywiZW1haWwiOiJ0ZXN0LmFjY291bnRAdWNvbm4uZWR1Iiwib3JnX2lkIjoxLCJmaXJzdF9uYW1lIjoiVGVzdCIsImxhc3RfbmFtZSI6IkFjY291bnQiLCJwZXJtaXNzaW9ucyI6eyIxIjp7ImlkIjo0LCJuYW1lIjoiQ2xpZW50IiwicGVybWlzc2lvbnMiOnsiZ2VuX3JlYWQiOjEsImdlbl9leGVjdXRlIjowLCJkYXRhX3JlYWQiOjEsImRhdGFfZXhwb3J0IjowLCJvcmdfbWFuYWdlIjowfX19fQ.CPMhtApFtRzyPjkRrt5NSVeqWvrn57UI0ifb2QB9rkRE97WvNdCp8h8cAdR-X5Ft5K6jMjXbEsgsmBxEvc6z7Q' + } + }); + } +} diff --git a/src/app/statistics/statistics.component.css b/src/app/statistics/statistics.component.css index c516a24..e69de29 100644 --- a/src/app/statistics/statistics.component.css +++ b/src/app/statistics/statistics.component.css @@ -1,120 +0,0 @@ -.bubble { - width: 75px; - height: 75px; - border-radius: 50%; - font-size: 25px; - color: #fff; - line-height: 0px; - background:#00cc66; -} -input -{ - background: transparent; - border: none; - margin-left: 20px; - margin-top: 20px -} -div { - margin: 20px; - display: inline-block; -} - -.tg-list { - text-align: center; - display: flex; - align-items: center; -} -.tg-list-item { - margin: 0 2em; -} -.tgl { - display: none; -} -.tgl, .tgl:after, .tgl:before, .tgl *, .tgl *:after, .tgl *:before, .tgl + .tgl-btn { - box-sizing: border-box; -} -.tgl::-moz-selection, .tgl:after::-moz-selection, .tgl:before::-moz-selection, .tgl *::-moz-selection, .tgl *:after::-moz-selection, .tgl *:before::-moz-selection, .tgl + .tgl-btn::-moz-selection { - background: none; -} -.tgl::selection, .tgl:after::selection, .tgl:before::selection, .tgl *::selection, .tgl *:after::selection, .tgl *:before::selection, .tgl + .tgl-btn::selection { - background: none; -} -.tgl + .tgl-btn { - outline: 0; - display: block; - width: 4em; - height: 2em; - position: relative; - cursor: pointer; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} -.tgl + .tgl-btn:after, .tgl + .tgl-btn:before { - position: relative; - display: block; - content: ""; - width: 50%; - height: 100%; -} -.tgl + .tgl-btn:after { - left: 0; -} -.tgl + .tgl-btn:before { - display: none; -} -.tgl:checked + .tgl-btn:after { - left: 50%; -} -.tgl-flip + .tgl-btn { - padding: 2px; - transition: all .2s ease; - font-family: sans-serif; - -webkit-perspective: 100px; - perspective: 100px; -} -.tgl-flip + .tgl-btn:after, .tgl-flip + .tgl-btn:before { - display: inline-block; - transition: all .4s ease; - width: 100%; - text-align: center; - position: absolute; - line-height: 2em; - font-weight: bold; - color: #fff; - position: absolute; - top: 0; - left: 0; - -webkit-backface-visibility: hidden; - backface-visibility: hidden; - border-radius: 4px; -} -.tgl-flip + .tgl-btn:after { - content: attr(data-tg-on); - background: #02C66F; - -webkit-transform: rotateY(-180deg); - transform: rotateY(-180deg); -} -.tgl-flip + .tgl-btn:before { - background: #FF3A19; - content: attr(data-tg-off); -} -.tgl-flip + .tgl-btn:active:before { - -webkit-transform: rotateY(-20deg); - transform: rotateY(-20deg); -} -.tgl-flip:checked + .tgl-btn:before { - -webkit-transform: rotateY(180deg); - transform: rotateY(180deg); -} -.tgl-flip:checked + .tgl-btn:after { - -webkit-transform: rotateY(0); - transform: rotateY(0); - left: 0; - background: #7FC6A6; -} -.tgl-flip:checked + .tgl-btn:active:after { - -webkit-transform: rotateY(20deg); - transform: rotateY(20deg); -} diff --git a/src/app/statistics/statistics.component.html b/src/app/statistics/statistics.component.html index e22bc58..7f531b3 100644 --- a/src/app/statistics/statistics.component.html +++ b/src/app/statistics/statistics.component.html @@ -1,67 +1,17 @@ -
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
+
+
+
+ 1 +
+
+ 1 +
+
+ 1 +
+
+
+
@@ -106,4 +108,4 @@
-
--> \ No newline at end of file +
--> diff --git a/src/app/statistics/statistics.component.ts b/src/app/statistics/statistics.component.ts index 6e2ae53..b1eb7b8 100644 --- a/src/app/statistics/statistics.component.ts +++ b/src/app/statistics/statistics.component.ts @@ -1,6 +1,6 @@ -import { Component, OnInit } from '@angular/core'; -import { MetricsService } from '../services/metrics.service'; -import { HttpClient, HttpHeaders } from '@angular/common/http'; +import {Component, OnInit} from '@angular/core'; +import {MetricsService} from '../services/metrics.service'; +import {HttpClient, HttpHeaders} from '@angular/common/http'; @Component({ @@ -10,15 +10,15 @@ import { HttpClient, HttpHeaders } from '@angular/common/http'; }) export class StatisticsComponent implements OnInit { - fuelTempGraphData: any; - fuelTemp1: any; + fuelTempGraphData: any; + fuelTemp1: any; - oilTempGraphData: any; - oilTemp1: any; + oilTempGraphData: any; + oilTemp1: any; + + constructor(public data: MetricsService, private http: HttpClient) { - constructor(public data: MetricsService, private http: HttpClient) { - const jsonToken = localStorage.getItem('auth_token'); try { this.data.getRecentMetrics(jsonToken).subscribe((data) => { @@ -27,7 +27,7 @@ export class StatisticsComponent implements OnInit { this.fuelTemp1 = Math.round(this.metric.outputs[0].dps[0][1]); console.log(this.fuelTemp1); - this.oilTemp1 = this.metric.outputs[1].dps[0][1]; + this.oilTemp1 = this.metric.outputs[1].dps[0][1]; }); } catch (err) { @@ -35,11 +35,6 @@ export class StatisticsComponent implements OnInit { } - - - - - /* //console.log(this.fuelTemp1); @@ -77,7 +72,7 @@ export class StatisticsComponent implements OnInit { }; */ - + } @@ -94,145 +89,141 @@ export class StatisticsComponent implements OnInit { public isMonth: boolean = false; public isYear: boolean = false; - viewRecent() - { + viewRecent() { + + this.isRecent = true; + this.isHour = false; + this.isDay = false; + this.isWeek = false; + this.isMonth = false; + this.isYear = false; - this.isRecent = true; - this.isHour = false; - this.isDay = false; - this.isWeek = false; - this.isMonth = false; - this.isYear = false; - } - viewHour() - { - - this.isRecent = false; - this.isHour = true; - this.isDay = false; - this.isWeek = false; - this.isMonth = false; - this.isYear = false; - + + viewHour() { + + this.isRecent = false; + this.isHour = true; + this.isDay = false; + this.isWeek = false; + this.isMonth = false; + this.isYear = false; + } - viewDay() - { - - this.isRecent = false; - this.isHour = false; - this.isDay = true; - this.isWeek = false; - this.isMonth = false; - this.isYear = false; - + + viewDay() { + + this.isRecent = false; + this.isHour = false; + this.isDay = true; + this.isWeek = false; + this.isMonth = false; + this.isYear = false; + } - viewWeek() - { - - this.isRecent = false; - this.isHour = false; - this.isDay = false; - this.isWeek = true; - this.isMonth = false; - this.isYear = false; - + + viewWeek() { + + this.isRecent = false; + this.isHour = false; + this.isDay = false; + this.isWeek = true; + this.isMonth = false; + this.isYear = false; + } - viewMonth() - { - - this.isRecent = false; - this.isHour = false; - this.isDay = false; - this.isWeek = false; - this.isMonth = true; - this.isYear = false; - + + viewMonth() { + + this.isRecent = false; + this.isHour = false; + this.isDay = false; + this.isWeek = false; + this.isMonth = true; + this.isYear = false; + } - viewYear() - { - - this.isRecent = false; - this.isHour = false; - this.isDay = false; - this.isWeek = false; - this.isMonth = false; - this.isYear = true; - + + viewYear() { + + this.isRecent = false; + this.isHour = false; + this.isDay = false; + this.isWeek = false; + this.isMonth = false; + this.isYear = true; + } - setDial(dialValue, metricName) - { - console.log(dialValue); - var returnVal = { + setDial(dialValue, metricName) { + console.log(dialValue); + + var returnVal = { + + 'chart': { + 'caption': metricName, + 'lowerLimit': '0', + 'upperLimit': '200', + 'showValue': '1', + 'theme': 'fusion', + 'showToolTip': '0' + }, + 'colorRange': { + 'color': [{ + 'minValue': '0', + 'maxValue': '50', + 'code': '#F2726F' + }, { + 'minValue': '50', + 'maxValue': '75', + 'code': '#FFC533' + }, { + 'minValue': '75', + 'maxValue': '200', + 'code': '#62B58F' + }] + }, + 'dials': { + 'dial': [{ + 'value': dialValue + }] + } - "chart": { - "caption": metricName, - "lowerLimit": "0", - "upperLimit": "200", - "showValue": "1", - "theme": "fusion", - "showToolTip": "0" - }, - "colorRange": { - "color": [{ - "minValue": "0", - "maxValue": "50", - "code": "#F2726F" - }, { - "minValue": "50", - "maxValue": "75", - "code": "#FFC533" - }, { - "minValue": "75", - "maxValue": "200", - "code": "#62B58F" - }] - }, - "dials": { - "dial": [{ - "value": dialValue - }] - } - - }; - return returnVal; + }; + return returnVal; } - ngOnInit() - { + ngOnInit() { - const jsonToken = localStorage.getItem('auth_token'); + const jsonToken = localStorage.getItem('auth_token'); try { this.data.getRecentMetrics(jsonToken).subscribe((data) => { //console.log(data.outputs[1].dps[0][1]); this.metric = data; this.fuelTemp = Math.round(this.metric.outputs[0].dps[0][1]); - this.oilTemp = this.metric.outputs[1].dps[0][1]; + this.oilTemp = this.metric.outputs[1].dps[0][1]; - this.fuelTempGraphData = this.setDial(this.fuelTemp, "Fuel Temperature"); - this.oilTempGraphData = this.setDial(this.oilTemp, "Oil Temperature"); + this.fuelTempGraphData = this.setDial(this.fuelTemp, 'Fuel Temperature'); + this.oilTempGraphData = this.setDial(this.oilTemp, 'Oil Temperature'); }); } catch (err) { return err; } - try{ + try { - this.data.getYearMetrics(jsonToken).subscribe((data) => { + this.data.getYearMetrics(jsonToken).subscribe((data) => { - this.metricYearAvg = data; + this.metricYearAvg = data; - this.fuelTempYearAvg = this.metricYearAvg.outputs[0].dps[0][1]; + this.fuelTempYearAvg = this.metricYearAvg.outputs[0].dps[0][1]; - }); - } - catch(err) - { - return err; + }); + } catch (err) { + return err; } From 4e838bb1b96d7efd0e761be76137b28f2eb54250 Mon Sep 17 00:00:00 2001 From: Emil Abraham Date: Wed, 3 Apr 2019 13:46:55 -0400 Subject: [PATCH 5/5] added gauges --- package-lock.json | 81 +++++-------------- src/app/services/metrics.service.ts | 32 +++++--- src/app/statistics/statistics.component.html | 59 ++++++++++++-- src/app/statistics/statistics.component.ts | 83 ++++---------------- 4 files changed, 111 insertions(+), 144 deletions(-) diff --git a/package-lock.json b/package-lock.json index 86d7354..ed050df 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1274,7 +1274,6 @@ "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", "dev": true, - "optional": true, "requires": { "delegates": "^1.0.0", "readable-stream": "^2.0.6" @@ -2461,8 +2460,7 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", - "dev": true, - "optional": true + "dev": true }, "constants-browserify": { "version": "1.0.0", @@ -2729,8 +2727,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true, - "optional": true + "dev": true }, "decode-uri-component": { "version": "0.2.0", @@ -2859,8 +2856,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", - "dev": true, - "optional": true + "dev": true }, "depd": { "version": "1.1.2", @@ -3884,8 +3880,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -3906,14 +3901,12 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -3928,20 +3921,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -4058,8 +4048,7 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -4071,7 +4060,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -4086,7 +4074,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -4094,14 +4081,12 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -4120,7 +4105,6 @@ "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -4201,8 +4185,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -4214,7 +4197,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -4300,8 +4282,7 @@ "safe-buffer": { "version": "5.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -4337,7 +4318,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -4357,7 +4337,6 @@ "version": "3.0.1", "bundled": true, "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -4401,14 +4380,12 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true } } }, @@ -4417,7 +4394,6 @@ "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz", "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", "dev": true, - "optional": true, "requires": { "graceful-fs": "^4.1.2", "inherits": "~2.0.0", @@ -4430,7 +4406,6 @@ "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", "dev": true, - "optional": true, "requires": { "aproba": "^1.0.3", "console-control-strings": "^1.0.0", @@ -4468,8 +4443,7 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", - "dev": true, - "optional": true + "dev": true }, "get-stream": { "version": "3.0.0", @@ -4705,8 +4679,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", - "dev": true, - "optional": true + "dev": true }, "has-value": { "version": "1.0.0", @@ -5375,8 +5348,7 @@ "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", - "dev": true, - "optional": true + "dev": true }, "is-windows": { "version": "1.0.2", @@ -6009,7 +5981,6 @@ "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, - "optional": true, "requires": { "graceful-fs": "^4.1.2", "parse-json": "^2.2.0", @@ -6022,8 +5993,7 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true, - "optional": true + "dev": true } } }, @@ -6301,8 +6271,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", - "dev": true, - "optional": true + "dev": true }, "map-visit": { "version": "1.0.0", @@ -6955,7 +6924,6 @@ "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", "dev": true, - "optional": true, "requires": { "are-we-there-yet": "~1.1.2", "console-control-strings": "~1.1.0", @@ -7441,7 +7409,6 @@ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", "dev": true, - "optional": true, "requires": { "error-ex": "^1.2.0" } @@ -8094,7 +8061,6 @@ "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", "dev": true, - "optional": true, "requires": { "load-json-file": "^1.0.0", "normalize-package-data": "^2.3.2", @@ -8106,7 +8072,6 @@ "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", "dev": true, - "optional": true, "requires": { "graceful-fs": "^4.1.2", "pify": "^2.0.0", @@ -8117,8 +8082,7 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true, - "optional": true + "dev": true } } }, @@ -8127,7 +8091,6 @@ "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", "dev": true, - "optional": true, "requires": { "find-up": "^1.0.0", "read-pkg": "^1.0.0" @@ -8138,7 +8101,6 @@ "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", "dev": true, - "optional": true, "requires": { "path-exists": "^2.0.0", "pinkie-promise": "^2.0.0" @@ -8149,7 +8111,6 @@ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", "dev": true, - "optional": true, "requires": { "pinkie-promise": "^2.0.0" } @@ -9405,7 +9366,6 @@ "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", "dev": true, - "optional": true, "requires": { "is-utf8": "^0.2.0" } @@ -10821,7 +10781,6 @@ "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", "dev": true, - "optional": true, "requires": { "string-width": "^1.0.2 || 2" } diff --git a/src/app/services/metrics.service.ts b/src/app/services/metrics.service.ts index e0598a0..07a739c 100644 --- a/src/app/services/metrics.service.ts +++ b/src/app/services/metrics.service.ts @@ -16,9 +16,9 @@ export class MetricsService { getRecentMetrics(token) { let gen_id = localStorage.getItem('gen_id'); - return this.http.get('http://localhost:3000/data/query/exp/year/' + gen_id, { + return this.http.get('http://sd5-backend.engr.uconn.edu/data/query/exp/year/' + gen_id, { headers: { - Authorization: 'Bearer ' + 'eyJhbGciOiJSUzI1NiJ9.eyJpZCI6MywiZW1haWwiOiJ0ZXN0LmFjY291bnRAdWNvbm4uZWR1Iiwib3JnX2lkIjoxLCJmaXJzdF9uYW1lIjoiVGVzdCIsImxhc3RfbmFtZSI6IkFjY291bnQiLCJwZXJtaXNzaW9ucyI6eyIxIjp7ImlkIjo0LCJuYW1lIjoiQ2xpZW50IiwicGVybWlzc2lvbnMiOnsiZ2VuX3JlYWQiOjEsImdlbl9leGVjdXRlIjowLCJkYXRhX3JlYWQiOjEsImRhdGFfZXhwb3J0IjowLCJvcmdfbWFuYWdlIjowfX19fQ.CPMhtApFtRzyPjkRrt5NSVeqWvrn57UI0ifb2QB9rkRE97WvNdCp8h8cAdR-X5Ft5K6jMjXbEsgsmBxEvc6z7Q' + Authorization: 'Bearer ' + token } }); } @@ -26,9 +26,9 @@ export class MetricsService { getHourMetrics(token) { let gen_id = localStorage.getItem('gen_id'); - return this.http.get('http://localhost:3000/data/query/exp/hour/' + gen_id, { + return this.http.get('http://sd5-backend.engr.uconn.edu/data/query/exp/hour/' + gen_id, { headers: { - Authorization: 'Bearer ' + 'eyJhbGciOiJSUzI1NiJ9.eyJpZCI6MywiZW1haWwiOiJ0ZXN0LmFjY291bnRAdWNvbm4uZWR1Iiwib3JnX2lkIjoxLCJmaXJzdF9uYW1lIjoiVGVzdCIsImxhc3RfbmFtZSI6IkFjY291bnQiLCJwZXJtaXNzaW9ucyI6eyIxIjp7ImlkIjo0LCJuYW1lIjoiQ2xpZW50IiwicGVybWlzc2lvbnMiOnsiZ2VuX3JlYWQiOjEsImdlbl9leGVjdXRlIjowLCJkYXRhX3JlYWQiOjEsImRhdGFfZXhwb3J0IjowLCJvcmdfbWFuYWdlIjowfX19fQ.CPMhtApFtRzyPjkRrt5NSVeqWvrn57UI0ifb2QB9rkRE97WvNdCp8h8cAdR-X5Ft5K6jMjXbEsgsmBxEvc6z7Q' + Authorization: 'Bearer ' + token } }); } @@ -36,9 +36,9 @@ export class MetricsService { getDayMetrics(token) { let gen_id = localStorage.getItem('gen_id'); - return this.http.get('http://localhost:3000/data/query/exp/day/' + gen_id, { + return this.http.get('http://sd5-backend.engr.uconn.edu/data/query/exp/day/' + gen_id, { headers: { - Authorization: 'Bearer ' + 'eyJhbGciOiJSUzI1NiJ9.eyJpZCI6MywiZW1haWwiOiJ0ZXN0LmFjY291bnRAdWNvbm4uZWR1Iiwib3JnX2lkIjoxLCJmaXJzdF9uYW1lIjoiVGVzdCIsImxhc3RfbmFtZSI6IkFjY291bnQiLCJwZXJtaXNzaW9ucyI6eyIxIjp7ImlkIjo0LCJuYW1lIjoiQ2xpZW50IiwicGVybWlzc2lvbnMiOnsiZ2VuX3JlYWQiOjEsImdlbl9leGVjdXRlIjowLCJkYXRhX3JlYWQiOjEsImRhdGFfZXhwb3J0IjowLCJvcmdfbWFuYWdlIjowfX19fQ.CPMhtApFtRzyPjkRrt5NSVeqWvrn57UI0ifb2QB9rkRE97WvNdCp8h8cAdR-X5Ft5K6jMjXbEsgsmBxEvc6z7Q' + Authorization: 'Bearer ' + token } }); } @@ -46,18 +46,18 @@ export class MetricsService { getWeekMetrics(token) { let gen_id = localStorage.getItem('gen_id'); - return this.http.get('http://localhost:3000/data/query/exp/week/' + gen_id, { + return this.http.get('http://sd5-backend.engr.uconn.edu/data/query/exp/week/' + gen_id, { headers: { - Authorization: 'Bearer ' + 'eyJhbGciOiJSUzI1NiJ9.eyJpZCI6MywiZW1haWwiOiJ0ZXN0LmFjY291bnRAdWNvbm4uZWR1Iiwib3JnX2lkIjoxLCJmaXJzdF9uYW1lIjoiVGVzdCIsImxhc3RfbmFtZSI6IkFjY291bnQiLCJwZXJtaXNzaW9ucyI6eyIxIjp7ImlkIjo0LCJuYW1lIjoiQ2xpZW50IiwicGVybWlzc2lvbnMiOnsiZ2VuX3JlYWQiOjEsImdlbl9leGVjdXRlIjowLCJkYXRhX3JlYWQiOjEsImRhdGFfZXhwb3J0IjowLCJvcmdfbWFuYWdlIjowfX19fQ.CPMhtApFtRzyPjkRrt5NSVeqWvrn57UI0ifb2QB9rkRE97WvNdCp8h8cAdR-X5Ft5K6jMjXbEsgsmBxEvc6z7Q' + Authorization: 'Bearer ' + token } }); } getMonthMetrics(token) { let gen_id = localStorage.getItem('gen_id'); - return this.http.get('http://localhost:3000/data/query/exp/month/' + gen_id, { + return this.http.get('http://sd5-backend.engr.uconn.edu/data/query/exp/month/' + gen_id, { headers: { - Authorization: 'Bearer ' + 'eyJhbGciOiJSUzI1NiJ9.eyJpZCI6MywiZW1haWwiOiJ0ZXN0LmFjY291bnRAdWNvbm4uZWR1Iiwib3JnX2lkIjoxLCJmaXJzdF9uYW1lIjoiVGVzdCIsImxhc3RfbmFtZSI6IkFjY291bnQiLCJwZXJtaXNzaW9ucyI6eyIxIjp7ImlkIjo0LCJuYW1lIjoiQ2xpZW50IiwicGVybWlzc2lvbnMiOnsiZ2VuX3JlYWQiOjEsImdlbl9leGVjdXRlIjowLCJkYXRhX3JlYWQiOjEsImRhdGFfZXhwb3J0IjowLCJvcmdfbWFuYWdlIjowfX19fQ.CPMhtApFtRzyPjkRrt5NSVeqWvrn57UI0ifb2QB9rkRE97WvNdCp8h8cAdR-X5Ft5K6jMjXbEsgsmBxEvc6z7Q' + Authorization: 'Bearer ' + token } }); } @@ -65,7 +65,17 @@ export class MetricsService { getYearMetrics(token) { let gen_id = localStorage.getItem('gen_id'); - return this.http.get('http://localhost:3000/data/query/exp/year/' + gen_id, { + return this.http.get('http://sd5-backend.engr.uconn.edu/data/query/exp/year/' + gen_id, { + headers: { + Authorization: 'Bearer ' + token + } + }); + } + + getDevMetrics(token) { + + let gen_id = localStorage.getItem('gen_id'); + return this.http.get('http://localhost:3000/data/query/exp/dev/' + gen_id, { headers: { Authorization: 'Bearer ' + 'eyJhbGciOiJSUzI1NiJ9.eyJpZCI6MywiZW1haWwiOiJ0ZXN0LmFjY291bnRAdWNvbm4uZWR1Iiwib3JnX2lkIjoxLCJmaXJzdF9uYW1lIjoiVGVzdCIsImxhc3RfbmFtZSI6IkFjY291bnQiLCJwZXJtaXNzaW9ucyI6eyIxIjp7ImlkIjo0LCJuYW1lIjoiQ2xpZW50IiwicGVybWlzc2lvbnMiOnsiZ2VuX3JlYWQiOjEsImdlbl9leGVjdXRlIjowLCJkYXRhX3JlYWQiOjEsImRhdGFfZXhwb3J0IjowLCJvcmdfbWFuYWdlIjowfX19fQ.CPMhtApFtRzyPjkRrt5NSVeqWvrn57UI0ifb2QB9rkRE97WvNdCp8h8cAdR-X5Ft5K6jMjXbEsgsmBxEvc6z7Q' } diff --git a/src/app/statistics/statistics.component.html b/src/app/statistics/statistics.component.html index 9dfa946..e74550d 100644 --- a/src/app/statistics/statistics.component.html +++ b/src/app/statistics/statistics.component.html @@ -1,4 +1,5 @@
+
+ +
+ + +
+
+ + +
+
+ + +
+
+ + +
- + +
- + +
- + +
- + + +
+
+ +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+