From 328bf3cd654380f54b3d6d542c3b144d0f7660ab Mon Sep 17 00:00:00 2001 From: Svitlana Kalancha Date: Tue, 9 Jan 2018 12:52:19 +0100 Subject: [PATCH 01/50] Refactor table --- src/app/dashboard/metric/metric.component.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/dashboard/metric/metric.component.html b/src/app/dashboard/metric/metric.component.html index a68d21f..e414362 100644 --- a/src/app/dashboard/metric/metric.component.html +++ b/src/app/dashboard/metric/metric.component.html @@ -9,16 +9,16 @@ + + Average Block Time + {{ publicStatistics?.avgBlocktime }} Min + {{ privateStatistics?.avgBlocktime }} Sec + Average HashRate {{ publicStatistics?.avgHashrate }} GH/s {{ privateStatistics?.avgHashrate }} H/s - - Average Block Time - {{ publicStatistics?.avgBlocktime }} Min - {{ privateStatistics?.avgBlocktime }} Sec - Number of miners {{ publicStatistics?.numberOfMiners }} From 8cd61776312eb333d3a9cf33195c37ba4fe6efae Mon Sep 17 00:00:00 2001 From: Svitlana Kalancha Date: Tue, 9 Jan 2018 14:32:41 +0100 Subject: [PATCH 02/50] Change environment to BPT Lab --- src/environments/environment.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 9e01378..873c214 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -5,7 +5,7 @@ export const environment = { production: false, - baseURL: 'http://172.16.64.115:2020/api', + baseURL: 'https://bpt-lab.org/bp2017w1-bpchain/api', privateStatsResource: '/private/ethereum', publicStatsResource: '/public/ethereum', }; From b65c35dfe985974c1cbc02fa083acf013a6d3a28 Mon Sep 17 00:00:00 2001 From: Finn K Date: Wed, 10 Jan 2018 13:28:55 +0100 Subject: [PATCH 03/50] Add coveralls --- package.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 5aee2be..c5f4825 100644 --- a/package.json +++ b/package.json @@ -6,9 +6,10 @@ "ng": "ng", "start": "ng serve", "build": "ng build", - "test": "ng test", + "test": "ng test --code-cover && coveralls", "lint": "ng lint", - "e2e": "ng e2e" + "e2e": "ng e2e", + "coveralls": "cat ./coverage/lcov.info | coveralls && rm -rf ./coverage" }, "private": true, "dependencies": { @@ -38,6 +39,7 @@ "@types/jasminewd2": "~2.0.2", "@types/node": "^6.0.96", "codelyzer": "^4.0.1", + "coveralls": "^3.0.0", "jasmine-core": "~2.6.2", "jasmine-spec-reporter": "~4.1.0", "karma": "~1.7.0", From 86fd81d744fa4b2154091257404dee5d04923ab7 Mon Sep 17 00:00:00 2001 From: Finn K Date: Wed, 10 Jan 2018 13:34:58 +0100 Subject: [PATCH 04/50] Update travis.yml and package.json --- .travis.yml | 3 ++- package.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f58dbf6..27da11b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,4 +22,5 @@ before_install: - sudo apt-get install -y libappindicator1 fonts-liberation - wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb - sudo dpkg -i google-chrome*.deb - +after_success: + - npm run coveralls diff --git a/package.json b/package.json index c5f4825..da614f6 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "ng": "ng", "start": "ng serve", "build": "ng build", - "test": "ng test --code-cover && coveralls", + "test": "ng test --code-cover", "lint": "ng lint", "e2e": "ng e2e", "coveralls": "cat ./coverage/lcov.info | coveralls && rm -rf ./coverage" From 85806421e9e4902a691706c75debfadb1ed8311e Mon Sep 17 00:00:00 2001 From: Finn K Date: Wed, 10 Jan 2018 13:44:24 +0100 Subject: [PATCH 05/50] Add coveralls badge to readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a74deb8..4c2f777 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # AngularFrontend -Master-Branch: [![Build Status](https://travis-ci.org/BPChain/angular-frontend.svg?branch=master)](https://travis-ci.org/BPChain/angular-frontend) -Dev-Branch: [![Build Status](https://travis-ci.org/BPChain/angular-frontend.svg?branch=dev)](https://travis-ci.org/BPChain/angular-frontend) +Master-Branch: [![Build Status](https://travis-ci.org/BPChain/angular-frontend.svg?branch=master)](https://travis-ci.org/BPChain/angular-frontend) [![Coverage Status](https://coveralls.io/repos/github/BPChain/angular-frontend/badge.svg?branch=master)](https://coveralls.io/github/BPChain/angular-frontend?branch=master)
+Dev-Branch: [![Build Status](https://travis-ci.org/BPChain/angular-frontend.svg?branch=dev)](https://travis-ci.org/BPChain/angular-frontend) [![Coverage Status](https://coveralls.io/repos/github/BPChain/angular-frontend/badge.svg?branch=dev)](https://coveralls.io/github/BPChain/angular-frontend?branch=dev)
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.5.4. From e8ff09a85f4441cfe35785442a2878538e38534d Mon Sep 17 00:00:00 2001 From: Feram Bot Date: Wed, 10 Jan 2018 12:45:58 +0000 Subject: [PATCH 06/50] Fix code style --- src/app/dashboard/form/form.component.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/dashboard/form/form.component.css b/src/app/dashboard/form/form.component.css index 78daa66..4379ac0 100644 --- a/src/app/dashboard/form/form.component.css +++ b/src/app/dashboard/form/form.component.css @@ -6,12 +6,12 @@ mat-card { background: whitesmoke; } -.main-div{ +.main-div { display: flex; justify-content: center; align-items: center; } -mat-card mat-card-actions button{ +mat-card mat-card-actions button { float: right; } From e25c25deab32540381fc3e79f3e2c64e5acfefed Mon Sep 17 00:00:00 2001 From: Svitlana Kalancha Date: Wed, 10 Jan 2018 15:29:17 +0100 Subject: [PATCH 07/50] Add timespan setting to the linechart --- src/app/app.module.ts | 4 ++- src/app/dashboard/dashboard.component.ts | 1 + src/app/dashboard/form/form.component.html | 27 +++++++++++++++++++ src/app/dashboard/form/form.component.ts | 19 ++++++++++--- src/app/services/date-builder.service.spec.ts | 15 +++++++++++ src/app/services/date-builder.service.ts | 13 +++++++++ 6 files changed, 75 insertions(+), 4 deletions(-) create mode 100644 src/app/services/date-builder.service.spec.ts create mode 100644 src/app/services/date-builder.service.ts diff --git a/src/app/app.module.ts b/src/app/app.module.ts index ac9caf1..d8bb918 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -19,7 +19,8 @@ import {LinechartComponent} from "./dashboard/charts/linechart/linechart.compone import { MatButtonModule, MatIconModule, MatToolbarModule, MatCardModule, MatCheckboxModule, - MatDatepickerModule, MatFormFieldModule, MatNativeDateModule, MatInputModule, MatSnackBarModule, + MatDatepickerModule, MatFormFieldModule, MatNativeDateModule, MatInputModule, + MatSnackBarModule, MatSelectModule, } from "@angular/material"; import {FormsModule, ReactiveFormsModule} from "@angular/forms"; import {BrowserAnimationsModule} from "@angular/platform-browser/animations"; @@ -63,6 +64,7 @@ import {FlexLayoutModule} from "@angular/flex-layout"; MatFormFieldModule, MatInputModule, MatSnackBarModule, + MatSelectModule, ], providers: [HttpClientModule, DatePipe], bootstrap: [AppComponent], diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts index 6a7ef98..f5c759a 100644 --- a/src/app/dashboard/dashboard.component.ts +++ b/src/app/dashboard/dashboard.component.ts @@ -81,6 +81,7 @@ export class DashboardComponent implements OnInit, OnDestroy { loadTimeBasedPublicData(start: Date, end: Date){ let query = 'startTime=' + start.toISOString() + '&endTime=' + end.toISOString(); + console.log(start); this.publicStatisticsService.query(query) .subscribe( response => { diff --git a/src/app/dashboard/form/form.component.html b/src/app/dashboard/form/form.component.html index 6e3ba83..a97a00c 100644 --- a/src/app/dashboard/form/form.component.html +++ b/src/app/dashboard/form/form.component.html @@ -11,16 +11,43 @@

Define Network Type

Define Time Span

+ + + + None + {{hour}} + + : + + + None + {{minute}} + + +

+

+ + + None + {{hour}} + + : + + + None + {{minute}} + +

+ diff --git a/src/app/landing/landing.component.spec.ts b/src/app/landing/landing.component.spec.ts index fc4cff8..646db88 100644 --- a/src/app/landing/landing.component.spec.ts +++ b/src/app/landing/landing.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { LandingComponent } from './landing.component'; +import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; describe('LandingComponent', () => { let component: LandingComponent; @@ -8,7 +9,8 @@ describe('LandingComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ LandingComponent ] + declarations: [ LandingComponent ], + schemas: [ CUSTOM_ELEMENTS_SCHEMA ] }) .compileComponents(); })); diff --git a/src/app/menu/header/header.component.html b/src/app/menu/header/header.component.html index 6c83e8e..6b612e2 100644 --- a/src/app/menu/header/header.component.html +++ b/src/app/menu/header/header.component.html @@ -1,6 +1,6 @@ - + Chainboard From abe6ead838b0e1ed601d78a74c7873ce5f3b3bf9 Mon Sep 17 00:00:00 2001 From: bisbaldi Date: Tue, 9 Jan 2018 18:39:13 +0100 Subject: [PATCH 17/50] Hide form and table once data to show is selected --- src/app/dashboard/dashboard.component.html | 5 ++++- src/app/dashboard/dashboard.component.ts | 5 +++++ src/app/dashboard/form/form.component.html | 1 - src/app/landing/landing.component.html | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/app/dashboard/dashboard.component.html b/src/app/dashboard/dashboard.component.html index b5d8fea..ee73c38 100644 --- a/src/app/dashboard/dashboard.component.html +++ b/src/app/dashboard/dashboard.component.html @@ -1,6 +1,6 @@
-
+
@@ -26,6 +26,9 @@
+
+ +
diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts index 1c8b96f..8f4f686 100644 --- a/src/app/dashboard/dashboard.component.ts +++ b/src/app/dashboard/dashboard.component.ts @@ -103,6 +103,11 @@ export class DashboardComponent implements OnInit, OnDestroy { checkValidDates(start: Date, end: Date) { return start < end; } + + resetChecks() { + this.privateCheck = false; + this.publicCheck = false; + } } diff --git a/src/app/dashboard/form/form.component.html b/src/app/dashboard/form/form.component.html index 5ebca4c..33e21ce 100644 --- a/src/app/dashboard/form/form.component.html +++ b/src/app/dashboard/form/form.component.html @@ -55,7 +55,6 @@

Define Time Span

send
- diff --git a/src/app/landing/landing.component.html b/src/app/landing/landing.component.html index ef0ceb8..bfd5c78 100644 --- a/src/app/landing/landing.component.html +++ b/src/app/landing/landing.component.html @@ -1,7 +1,7 @@
- + Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. From e98d8ea382459d94d249ce5eca7d2ce8eaec9866 Mon Sep 17 00:00:00 2001 From: bisbaldi Date: Tue, 9 Jan 2018 18:39:28 +0100 Subject: [PATCH 18/50] Add not found component --- src/app/not-found/not-found.component.css | 0 src/app/not-found/not-found.component.html | 3 +++ src/app/not-found/not-found.component.spec.ts | 25 +++++++++++++++++++ src/app/not-found/not-found.component.ts | 15 +++++++++++ 4 files changed, 43 insertions(+) create mode 100644 src/app/not-found/not-found.component.css create mode 100644 src/app/not-found/not-found.component.html create mode 100644 src/app/not-found/not-found.component.spec.ts create mode 100644 src/app/not-found/not-found.component.ts diff --git a/src/app/not-found/not-found.component.css b/src/app/not-found/not-found.component.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/not-found/not-found.component.html b/src/app/not-found/not-found.component.html new file mode 100644 index 0000000..ff60493 --- /dev/null +++ b/src/app/not-found/not-found.component.html @@ -0,0 +1,3 @@ +

+ not-found works! +

diff --git a/src/app/not-found/not-found.component.spec.ts b/src/app/not-found/not-found.component.spec.ts new file mode 100644 index 0000000..35189ed --- /dev/null +++ b/src/app/not-found/not-found.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { NotFoundComponent } from './not-found.component'; + +describe('NotFoundComponent', () => { + let component: NotFoundComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ NotFoundComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(NotFoundComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/not-found/not-found.component.ts b/src/app/not-found/not-found.component.ts new file mode 100644 index 0000000..029bd54 --- /dev/null +++ b/src/app/not-found/not-found.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-not-found', + templateUrl: './not-found.component.html', + styleUrls: ['./not-found.component.css'] +}) +export class NotFoundComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} From 9207d02f900b12841f85bee3c5cbb36ca18e68ab Mon Sep 17 00:00:00 2001 From: bisbaldi Date: Wed, 10 Jan 2018 10:37:46 +0100 Subject: [PATCH 19/50] Remove landing component --- src/app/app-routing-module.ts | 6 ++--- src/app/app.module.ts | 4 ++-- src/app/landing/landing.component.css | 5 ----- src/app/landing/landing.component.html | 10 --------- src/app/landing/landing.component.spec.ts | 27 ----------------------- src/app/landing/landing.component.ts | 15 ------------- 6 files changed, 5 insertions(+), 62 deletions(-) delete mode 100644 src/app/landing/landing.component.css delete mode 100644 src/app/landing/landing.component.html delete mode 100644 src/app/landing/landing.component.spec.ts delete mode 100644 src/app/landing/landing.component.ts diff --git a/src/app/app-routing-module.ts b/src/app/app-routing-module.ts index 9a61840..915571e 100644 --- a/src/app/app-routing-module.ts +++ b/src/app/app-routing-module.ts @@ -2,14 +2,14 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { Router, RouterModule } from '@angular/router'; -import { LandingComponent } from './landing/landing.component'; import { NotFoundComponent } from './not-found/not-found.component'; import {DashboardComponent} from './dashboard/dashboard.component'; +import {ImpressumComponent} from './impressum/impressum.component'; export const appRoutes = [ - { path: 'landing', component: LandingComponent }, + { path: 'impressum', component: ImpressumComponent }, { path: 'dashboard', component: DashboardComponent }, - { path: '', pathMatch: 'full', redirectTo: '/landing' }, + { path: '', pathMatch: 'full', redirectTo: '/dashboard' }, { path: '**', component: NotFoundComponent } ]; diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 1bc214d..870cb9a 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -19,7 +19,6 @@ import { PublicChartsComponent } from './dashboard/charts/public-charts/public-c import { PrivateChartsComponent } from './dashboard/charts/private-charts/private-charts.component'; import { BarchartComponent } from './dashboard/charts/barchart/barchart.component'; import { LinechartComponent } from './dashboard/charts/linechart/linechart.component'; -import { LandingComponent } from './landing/landing.component'; import { NotFoundComponent } from './not-found/not-found.component'; import { AppRoutingModule } from './app-routing-module'; @@ -28,6 +27,7 @@ import { MatDatepickerModule, MatFormFieldModule, MatNativeDateModule, MatInputModule, MatSnackBarModule, MatSelectModule, } from '@angular/material'; +import { ImpressumComponent } from './impressum/impressum.component'; @NgModule({ declarations: [ @@ -42,8 +42,8 @@ import { PrivateChartsComponent, BarchartComponent, LinechartComponent, - LandingComponent, NotFoundComponent, + ImpressumComponent, ], imports: [ BrowserModule, diff --git a/src/app/landing/landing.component.css b/src/app/landing/landing.component.css deleted file mode 100644 index d649817..0000000 --- a/src/app/landing/landing.component.css +++ /dev/null @@ -1,5 +0,0 @@ -mat-card { - background: whitesmoke; - width: 50%; -} - diff --git a/src/app/landing/landing.component.html b/src/app/landing/landing.component.html deleted file mode 100644 index bfd5c78..0000000 --- a/src/app/landing/landing.component.html +++ /dev/null @@ -1,10 +0,0 @@ - -
-
- - Lorem ipsum - dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. - -
- -
diff --git a/src/app/landing/landing.component.spec.ts b/src/app/landing/landing.component.spec.ts deleted file mode 100644 index 646db88..0000000 --- a/src/app/landing/landing.component.spec.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { LandingComponent } from './landing.component'; -import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; - -describe('LandingComponent', () => { - let component: LandingComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ LandingComponent ], - schemas: [ CUSTOM_ELEMENTS_SCHEMA ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(LandingComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/landing/landing.component.ts b/src/app/landing/landing.component.ts deleted file mode 100644 index 057daa1..0000000 --- a/src/app/landing/landing.component.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'app-landing', - templateUrl: './landing.component.html', - styleUrls: ['./landing.component.css'] -}) -export class LandingComponent implements OnInit { - - constructor() { } - - ngOnInit() { - } - -} From 14b9aedf9d9626fe2bc169f1d6284686c00548e7 Mon Sep 17 00:00:00 2001 From: bisbaldi Date: Wed, 10 Jan 2018 10:38:10 +0100 Subject: [PATCH 20/50] Add impressum component --- src/app/impressum/impressum.component.css | 4 +++ src/app/impressum/impressum.component.html | 8 ++++++ src/app/impressum/impressum.component.spec.ts | 25 +++++++++++++++++++ src/app/impressum/impressum.component.ts | 15 +++++++++++ 4 files changed, 52 insertions(+) create mode 100644 src/app/impressum/impressum.component.css create mode 100644 src/app/impressum/impressum.component.html create mode 100644 src/app/impressum/impressum.component.spec.ts create mode 100644 src/app/impressum/impressum.component.ts diff --git a/src/app/impressum/impressum.component.css b/src/app/impressum/impressum.component.css new file mode 100644 index 0000000..978d1f1 --- /dev/null +++ b/src/app/impressum/impressum.component.css @@ -0,0 +1,4 @@ +mat-card { + background: whitesmoke; + width: 50%; +} diff --git a/src/app/impressum/impressum.component.html b/src/app/impressum/impressum.component.html new file mode 100644 index 0000000..c087305 --- /dev/null +++ b/src/app/impressum/impressum.component.html @@ -0,0 +1,8 @@ +
+
+ + Lorem ipsum + dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. + +
+
diff --git a/src/app/impressum/impressum.component.spec.ts b/src/app/impressum/impressum.component.spec.ts new file mode 100644 index 0000000..08b22e5 --- /dev/null +++ b/src/app/impressum/impressum.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ImpressumComponent } from './impressum.component'; + +describe('ImpressumComponent', () => { + let component: ImpressumComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ImpressumComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ImpressumComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/impressum/impressum.component.ts b/src/app/impressum/impressum.component.ts new file mode 100644 index 0000000..a59d2bb --- /dev/null +++ b/src/app/impressum/impressum.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-impressum', + templateUrl: './impressum.component.html', + styleUrls: ['./impressum.component.css'] +}) +export class ImpressumComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} From 28c36bf0edbf265081a92489a711e1995c7d2078 Mon Sep 17 00:00:00 2001 From: bisbaldi Date: Wed, 10 Jan 2018 10:44:40 +0100 Subject: [PATCH 21/50] Add impressum button --- src/app/menu/header/header.component.css | 4 ++++ src/app/menu/header/header.component.html | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/menu/header/header.component.css b/src/app/menu/header/header.component.css index 931faae..d1d1251 100644 --- a/src/app/menu/header/header.component.css +++ b/src/app/menu/header/header.component.css @@ -5,3 +5,7 @@ .mat-h1 { font-size: 2rem; } + +.spacer { + flex: 1 1 auto; +} diff --git a/src/app/menu/header/header.component.html b/src/app/menu/header/header.component.html index 6b612e2..ec4b0c8 100644 --- a/src/app/menu/header/header.component.html +++ b/src/app/menu/header/header.component.html @@ -1,8 +1,10 @@ - + Chainboard + + From 342d83a13798676ada6665968fd7843521b06e1f Mon Sep 17 00:00:00 2001 From: bisbaldi Date: Wed, 10 Jan 2018 11:49:15 +0100 Subject: [PATCH 22/50] Add update data button --- src/app/dashboard/dashboard.component.css | 3 +++ src/app/dashboard/dashboard.component.html | 12 +++++++++--- src/app/impressum/impressum.component.spec.ts | 4 +++- src/app/not-found/not-found.component.html | 4 +--- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/app/dashboard/dashboard.component.css b/src/app/dashboard/dashboard.component.css index e69de29..f55c8bb 100644 --- a/src/app/dashboard/dashboard.component.css +++ b/src/app/dashboard/dashboard.component.css @@ -0,0 +1,3 @@ +.margin { + margin: 0 10px; +} diff --git a/src/app/dashboard/dashboard.component.html b/src/app/dashboard/dashboard.component.html index ee73c38..1b74371 100644 --- a/src/app/dashboard/dashboard.component.html +++ b/src/app/dashboard/dashboard.component.html @@ -5,6 +5,15 @@

+
+ +
+
Public @@ -26,9 +35,6 @@
-
- -
diff --git a/src/app/impressum/impressum.component.spec.ts b/src/app/impressum/impressum.component.spec.ts index 08b22e5..0c86bab 100644 --- a/src/app/impressum/impressum.component.spec.ts +++ b/src/app/impressum/impressum.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { ImpressumComponent } from './impressum.component'; +import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; describe('ImpressumComponent', () => { let component: ImpressumComponent; @@ -8,7 +9,8 @@ describe('ImpressumComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ ImpressumComponent ] + declarations: [ ImpressumComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], }) .compileComponents(); })); diff --git a/src/app/not-found/not-found.component.html b/src/app/not-found/not-found.component.html index ff60493..8b13789 100644 --- a/src/app/not-found/not-found.component.html +++ b/src/app/not-found/not-found.component.html @@ -1,3 +1 @@ -

- not-found works! -

+ From c38b14701c26d49bff832c1235bd9b65db0106b5 Mon Sep 17 00:00:00 2001 From: bisbaldi Date: Wed, 10 Jan 2018 12:12:46 +0100 Subject: [PATCH 23/50] Include first draft of 404 page --- src/app/dashboard/dashboard.component.css | 4 ++- src/app/dashboard/dashboard.component.html | 10 +++++-- src/app/not-found/not-found.component.css | 34 ++++++++++++++++++++++ src/app/not-found/not-found.component.html | 15 +++++++++- 4 files changed, 59 insertions(+), 4 deletions(-) diff --git a/src/app/dashboard/dashboard.component.css b/src/app/dashboard/dashboard.component.css index f55c8bb..5ddbc30 100644 --- a/src/app/dashboard/dashboard.component.css +++ b/src/app/dashboard/dashboard.component.css @@ -1,3 +1,5 @@ .margin { - margin: 0 10px; + margin-left: 10px; + margin-top: 10px; + margin-bottom: 10px; } diff --git a/src/app/dashboard/dashboard.component.html b/src/app/dashboard/dashboard.component.html index 1b74371..1025e66 100644 --- a/src/app/dashboard/dashboard.component.html +++ b/src/app/dashboard/dashboard.component.html @@ -4,7 +4,6 @@ -
- +
+ +
diff --git a/src/app/not-found/not-found.component.css b/src/app/not-found/not-found.component.css index e69de29..6285595 100644 --- a/src/app/not-found/not-found.component.css +++ b/src/app/not-found/not-found.component.css @@ -0,0 +1,34 @@ +.background { + background-image: url("../../assets/images/background.png"); + background-size: cover; + background-repeat: no-repeat; + height: 400px; + display: flex; + justify-content: center; + align-items: center; +} + +.transparent-background { + background-color: rgba(0,0,0,0); +} + +.spacer{ + flex: 1 1 auto; +} + +.white-text{ + color: white; + text-align: center; + vertical-align: middle; +} + +.mat-h1{ + font-size: 4.2rem; +} + +.mat-h2{ + font-size: 1.64rem; + font-weight: 300; + margin: .82rem 0 .656rem 0; +} + diff --git a/src/app/not-found/not-found.component.html b/src/app/not-found/not-found.component.html index 8b13789..a3fb084 100644 --- a/src/app/not-found/not-found.component.html +++ b/src/app/not-found/not-found.component.html @@ -1 +1,14 @@ - +
+ + + + ERROR - 404 Not Found + + + + + Looks like this isn't the site your looking for + + + +
From 199163a8a1f35690d0be5ecd358be5cb2e54ae64 Mon Sep 17 00:00:00 2001 From: bisbaldi Date: Wed, 10 Jan 2018 12:16:13 +0100 Subject: [PATCH 24/50] Include customs element schema in not-found test --- src/app/not-found/not-found.component.spec.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/not-found/not-found.component.spec.ts b/src/app/not-found/not-found.component.spec.ts index 35189ed..c93a1a0 100644 --- a/src/app/not-found/not-found.component.spec.ts +++ b/src/app/not-found/not-found.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { NotFoundComponent } from './not-found.component'; +import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; describe('NotFoundComponent', () => { let component: NotFoundComponent; @@ -8,7 +9,8 @@ describe('NotFoundComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ NotFoundComponent ] + declarations: [ NotFoundComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], }) .compileComponents(); })); From 00ababa0131fe422daf8b41b6004c84a25944b9d Mon Sep 17 00:00:00 2001 From: Feram Bot Date: Wed, 10 Jan 2018 14:34:16 +0000 Subject: [PATCH 25/50] Fix code style --- src/app/dashboard/metric/metric.component.css | 7 +++---- src/app/dashboard/welcome/welcome.component.css | 10 +++++----- src/app/menu/footer/footer.component.css | 4 ++-- src/app/menu/header/header.component.css | 2 +- src/app/not-found/not-found.component.css | 10 +++++----- src/styles.scss | 3 ++- src/theme.scss | 12 +++--------- tslint.json | 5 ++++- 8 files changed, 25 insertions(+), 28 deletions(-) diff --git a/src/app/dashboard/metric/metric.component.css b/src/app/dashboard/metric/metric.component.css index f9d3c98..1ceebf8 100644 --- a/src/app/dashboard/metric/metric.component.css +++ b/src/app/dashboard/metric/metric.component.css @@ -3,12 +3,11 @@ mat-card { } table { - } -th, td { +th, +td { padding: 15px; text-align: left; - border-bottom: 1px solid #A7A7A7; - + border-bottom: 1px solid #a7a7a7; } diff --git a/src/app/dashboard/welcome/welcome.component.css b/src/app/dashboard/welcome/welcome.component.css index d5a8258..ad4685a 100644 --- a/src/app/dashboard/welcome/welcome.component.css +++ b/src/app/dashboard/welcome/welcome.component.css @@ -9,24 +9,24 @@ } .transparent-background { - background-color: rgba(0,0,0,0); + background-color: rgba(0, 0, 0, 0); } -.spacer{ +.spacer { flex: 1 1 auto; } -.white-text{ +.white-text { color: white; text-align: center; vertical-align: middle; } -.mat-h1{ +.mat-h1 { font-size: 4.2rem; } -.mat-h2{ +.mat-h2 { font-size: 1.64rem; font-weight: 300; margin: .82rem 0 .656rem 0; diff --git a/src/app/menu/footer/footer.component.css b/src/app/menu/footer/footer.component.css index 3432b4e..46cbf23 100644 --- a/src/app/menu/footer/footer.component.css +++ b/src/app/menu/footer/footer.component.css @@ -1,9 +1,9 @@ -.description{ +.description { font-size: 12px; font-style: normal; } -.spacer{ +.spacer { flex: 1 1 auto; } diff --git a/src/app/menu/header/header.component.css b/src/app/menu/header/header.component.css index d1d1251..a3d744f 100644 --- a/src/app/menu/header/header.component.css +++ b/src/app/menu/header/header.component.css @@ -1,5 +1,5 @@ .logo { - width:20%; + width: 20%; } .mat-h1 { diff --git a/src/app/not-found/not-found.component.css b/src/app/not-found/not-found.component.css index 6285595..dae50d3 100644 --- a/src/app/not-found/not-found.component.css +++ b/src/app/not-found/not-found.component.css @@ -9,24 +9,24 @@ } .transparent-background { - background-color: rgba(0,0,0,0); + background-color: rgba(0, 0, 0, 0); } -.spacer{ +.spacer { flex: 1 1 auto; } -.white-text{ +.white-text { color: white; text-align: center; vertical-align: middle; } -.mat-h1{ +.mat-h1 { font-size: 4.2rem; } -.mat-h2{ +.mat-h2 { font-size: 1.64rem; font-weight: 300; margin: .82rem 0 .656rem 0; diff --git a/src/styles.scss b/src/styles.scss index 60fcd8a..3b52c5d 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -1,6 +1,7 @@ @import 'theme.scss'; -html, body { +html, +body { height: 100%; margin: 0; } diff --git a/src/theme.scss b/src/theme.scss index 8ced419..600aba2 100644 --- a/src/theme.scss +++ b/src/theme.scss @@ -1,25 +1,19 @@ @import url('https://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700,700italic,800,800italic&subset=latin-ext'); @import url('https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic&subset=latin-ext'); - @import '~@angular/material/theming'; @include mat-core(); - $general-typography: mat-typography-config( - $font-family: 'Roboto, sans-serif', - $body-2: mat-typography-level(14px, 24px, 600) + $font-family: 'Roboto, sans-serif', $body-2: mat-typography-level(14px, 24px, 600) ); - $secondary-typography: mat-typography-config( $font-family: '"Open Sans", "Helvetica Neue", sans-serif' ); @include mat-core($general-typography); - $my-app-primary: mat-palette($mat-blue-grey, 800); -$my-app-accent: mat-palette($mat-teal, 400); -$my-app-warn: mat-palette($mat-deep-orange); - +$my-app-accent: mat-palette($mat-teal, 400); +$my-app-warn: mat-palette($mat-deep-orange); $my-app-theme: mat-light-theme($my-app-primary, $my-app-accent, $my-app-warn); @include angular-material-theme($my-app-theme); diff --git a/tslint.json b/tslint.json index 1c7b38b..52a5ae9 100644 --- a/tslint.json +++ b/tslint.json @@ -127,7 +127,10 @@ "app", "kebab-case" ], - "angular-whitespace": [true, "check-interpolation"], + "angular-whitespace": [ + true, + "check-interpolation" + ], "no-output-on-prefix": true, "use-input-property-decorator": true, "use-output-property-decorator": true, From c6b2670602866f912fa5c7c6ac8015aadf0d4515 Mon Sep 17 00:00:00 2001 From: Svitlana Kalancha Date: Wed, 10 Jan 2018 16:48:47 +0100 Subject: [PATCH 26/50] Create validation to data convertation --- src/app/dashboard/form/form.component.ts | 1 - src/app/services/date-builder.service.ts | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/dashboard/form/form.component.ts b/src/app/dashboard/form/form.component.ts index d83f6da..88c9f4f 100644 --- a/src/app/dashboard/form/form.component.ts +++ b/src/app/dashboard/form/form.component.ts @@ -31,7 +31,6 @@ export class FormComponent implements OnInit { ngOnInit() { } - emitEvent() { this.startDate = this.DateBuilderService.convertDate(this.startDate, this.startHours, this.startMinutes); this.endDate = this.DateBuilderService.convertDate(this.endDate, this.endHours, this.endMinutes); diff --git a/src/app/services/date-builder.service.ts b/src/app/services/date-builder.service.ts index 15c3865..5be0614 100644 --- a/src/app/services/date-builder.service.ts +++ b/src/app/services/date-builder.service.ts @@ -6,8 +6,12 @@ export class DateBuilderService { constructor() { } public convertDate(day:Date, hours: number, minutes: number) { + if (hours != null) { day.setHours(hours); + } + if (minutes != null) { day.setMinutes(minutes); + } return day; } } From 39e132b93a18e93802a649d796b5dadfd925eebc Mon Sep 17 00:00:00 2001 From: bisbaldi Date: Wed, 10 Jan 2018 16:52:10 +0100 Subject: [PATCH 27/50] Update max values for barcharts --- package-lock.json | 25 +++++++++++++++++++ .../private-charts.component.html | 2 +- .../public-charts.component.html | 2 +- src/app/dashboard/dashboard.component.spec.ts | 8 +++--- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4c60841..18b1bf1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1707,6 +1707,19 @@ "require-from-string": "1.2.1" } }, + "coveralls": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-3.0.0.tgz", + "integrity": "sha512-ZppXR9y5PraUOrf/DzHJY6gzNUhXYE3b9D43xEXs4QYZ7/Oe0Gy0CS+IPKWFfvQFXB3RG9QduaQUFehzSpGAFw==", + "dev": true, + "requires": { + "js-yaml": "3.7.0", + "lcov-parse": "0.0.10", + "log-driver": "1.2.5", + "minimist": "1.2.0", + "request": "2.81.0" + } + }, "create-ecdh": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.0.tgz", @@ -5544,6 +5557,12 @@ "invert-kv": "1.0.0" } }, + "lcov-parse": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/lcov-parse/-/lcov-parse-0.0.10.tgz", + "integrity": "sha1-GwuP+ayceIklBYK3C3ExXZ2m2aM=", + "dev": true + }, "less": { "version": "2.7.3", "resolved": "https://registry.npmjs.org/less/-/less-2.7.3.tgz", @@ -5692,6 +5711,12 @@ "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=", "dev": true }, + "log-driver": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.5.tgz", + "integrity": "sha1-euTsJXMC/XkNVXyxDJcQDYV7AFY=", + "dev": true + }, "log4js": { "version": "0.6.38", "resolved": "https://registry.npmjs.org/log4js/-/log4js-0.6.38.tgz", diff --git a/src/app/dashboard/charts/private-charts/private-charts.component.html b/src/app/dashboard/charts/private-charts/private-charts.component.html index 4f6ba4e..97c6498 100644 --- a/src/app/dashboard/charts/private-charts/private-charts.component.html +++ b/src/app/dashboard/charts/private-charts/private-charts.component.html @@ -1,6 +1,6 @@ - +
diff --git a/src/app/dashboard/charts/public-charts/public-charts.component.html b/src/app/dashboard/charts/public-charts/public-charts.component.html index 6cac166..8045f5e 100644 --- a/src/app/dashboard/charts/public-charts/public-charts.component.html +++ b/src/app/dashboard/charts/public-charts/public-charts.component.html @@ -1,6 +1,6 @@ - +
diff --git a/src/app/dashboard/dashboard.component.spec.ts b/src/app/dashboard/dashboard.component.spec.ts index ab6be33..b14c13b 100644 --- a/src/app/dashboard/dashboard.component.spec.ts +++ b/src/app/dashboard/dashboard.component.spec.ts @@ -1,10 +1,10 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { DashboardComponent } from './dashboard.component'; -import {CUSTOM_ELEMENTS_SCHEMA} from "@angular/core"; -import {PrivateStatisticsService} from "../services/private-statistics.service"; -import {PublicStatisticsService} from "../services/public-statistics.service"; -import {HttpClientModule} from "@angular/common/http"; +import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; +import {PrivateStatisticsService} from '../services/private-statistics.service'; +import {PublicStatisticsService} from '../services/public-statistics.service'; +import {HttpClientModule} from '@angular/common/http'; describe('DashboardComponent', () => { let component: DashboardComponent; From 84f6b95fc5692977018fe2c90014802aa26d6189 Mon Sep 17 00:00:00 2001 From: bisbaldi Date: Mon, 15 Jan 2018 10:02:32 +0100 Subject: [PATCH 28/50] Update query to include only 100 items --- src/app/dashboard/dashboard.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts index 8f4f686..185cf54 100644 --- a/src/app/dashboard/dashboard.component.ts +++ b/src/app/dashboard/dashboard.component.ts @@ -90,7 +90,7 @@ export class DashboardComponent implements OnInit, OnDestroy { } loadTimeBasedPrivateData(start: Date, end: Date) { - const query = 'startTime=' + start.toISOString() + '&endTime=' + end.toISOString(); + const query = 'startTime=' + start.toISOString() + '&endTime=' + end.toISOString() + '&numberOfItems=100'; console.log(start.toISOString()); this.privateStatisticsService.query(query) .subscribe( From b3c50554d63f45f1cd9096318fc57d6c2483bd93 Mon Sep 17 00:00:00 2001 From: bisbaldi Date: Mon, 15 Jan 2018 10:11:14 +0100 Subject: [PATCH 29/50] Remove helper arrays and frontend limitation to 50 items --- .../charts/linechart/linechart.component.ts | 29 +++++-------------- src/app/dashboard/dashboard.component.ts | 1 + 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/app/dashboard/charts/linechart/linechart.component.ts b/src/app/dashboard/charts/linechart/linechart.component.ts index 15a514b..7542990 100644 --- a/src/app/dashboard/charts/linechart/linechart.component.ts +++ b/src/app/dashboard/charts/linechart/linechart.component.ts @@ -1,12 +1,12 @@ import {Component, Input, OnChanges, OnInit} from '@angular/core'; -import {DatePipe} from "@angular/common"; +import {DatePipe} from '@angular/common'; @Component({ selector: 'app-linechart', templateUrl: './linechart.component.html', styleUrls: ['./linechart.component.css'] }) -export class LinechartComponent implements OnInit, OnChanges{ +export class LinechartComponent implements OnInit, OnChanges { @Input() labels: string[]; @Input() statistics: any; @@ -18,7 +18,7 @@ export class LinechartComponent implements OnInit, OnChanges{ private lineChartLabels = []; private lineChartData: Array; - constructor(private datePipe: DatePipe){ + constructor(private datePipe: DatePipe) { } @@ -46,8 +46,6 @@ export class LinechartComponent implements OnInit, OnChanges{ this.lineChartData = []; this.lineChartLabels.length = 0; - let dataHelperArray = []; - let dateHelperArray = []; let dataArray = []; let dates = []; dataArray = this.statistics.map(record => { @@ -57,32 +55,21 @@ export class LinechartComponent implements OnInit, OnChanges{ return this.datePipe.transform(record.timeStamp, 'short'); }); - // TODO remove once backend is fixed - let size = dataArray.length - for(let j = 1; j <= 50; j++){ - let index = (Math.floor(size/50)) * j; - dataHelperArray[j-1]=dataArray[index]; - dateHelperArray[j-1]=dates[index]; - } - - for (let i = 0; i < dateHelperArray.length; i++) { - this.lineChartLabels.push(dateHelperArray[i]); + for (let i = 0; i < dates.length; i++) { + this.lineChartLabels.push(dates[i]); } this.lineChartData = [ - {data: dataHelperArray, label: this.labels[0], borderWidth: [1]}, + {data: dataArray, label: this.labels[0], borderWidth: [1]}, ]; - - - } // events - public chartClicked(e:any):void { + public chartClicked(e: any): void { console.log(e); } - public chartHovered(e:any):void { + public chartHovered(e: any): void { console.log(e); } } diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts index 185cf54..d6dd2be 100644 --- a/src/app/dashboard/dashboard.component.ts +++ b/src/app/dashboard/dashboard.component.ts @@ -85,6 +85,7 @@ export class DashboardComponent implements OnInit, OnDestroy { .subscribe( response => { this.timeBasedPublicStatistics = response; + console.log(response); } ); } From d244a7d652f1f1933f1a1b5877bb797195ba4a9b Mon Sep 17 00:00:00 2001 From: bisbaldi Date: Tue, 16 Jan 2018 10:32:33 +0100 Subject: [PATCH 30/50] Update query to only get 100 items as a response --- src/app/dashboard/dashboard.component.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts index d6dd2be..e2f2d00 100644 --- a/src/app/dashboard/dashboard.component.ts +++ b/src/app/dashboard/dashboard.component.ts @@ -80,22 +80,21 @@ export class DashboardComponent implements OnInit, OnDestroy { } loadTimeBasedPublicData(start: Date, end: Date) { - const query = 'startTime=' + start.toISOString() + '&endTime=' + end.toISOString(); - this.publicStatisticsService.query(query) + const query = 'startTime=' + start.toISOString() + '&endTime=' + end.toISOString() + '&numberOfItems=100'; + this.publicStatisticsService.query(query) .subscribe( response => { this.timeBasedPublicStatistics = response; - console.log(response); } ); } loadTimeBasedPrivateData(start: Date, end: Date) { const query = 'startTime=' + start.toISOString() + '&endTime=' + end.toISOString() + '&numberOfItems=100'; - console.log(start.toISOString()); this.privateStatisticsService.query(query) .subscribe( response => { + console.log(response); this.timeBasedPrivateStatistics = response; } ); From 5ba7613546a990d4ad69fb81bc35728c26c342e4 Mon Sep 17 00:00:00 2001 From: Simon Siegert Date: Tue, 16 Jan 2018 11:10:06 +0100 Subject: [PATCH 31/50] Create Dockerfile and docker-compose.yml --- Dockerfile | 22 ++++++++++++++++++++++ docker-compose.yml | 7 +++++++ 2 files changed, 29 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..41ed062 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM node:8.4 + +ENV HOME=/home/app +WORKDIR $HOME + +COPY package.json package.json +COPY package-lock.json package-lock.json + +RUN npm install + +COPY tsconfig.json tsconfig.json +COPY tslint.json tslint.json +COPY protractor.conf.js protractor.conf.js +COPY karma.conf.js karma.conf.js +COPY .angular-cli.json .angular-cli.json + +COPY e2e e2e +COPY src src + +EXPOSE 4200:4200 + +ENTRYPOINT ["npm", "start", "--"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..91b331a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +version: "3.3" +services: + angular-frontend: + build: . + container_name: angular-frontend + ports: + - "4200:4200" From 4ac542583e4216d81b3d22e4d92eb1b92e443f48 Mon Sep 17 00:00:00 2001 From: Finn K Date: Tue, 16 Jan 2018 11:39:18 +0100 Subject: [PATCH 32/50] Expose angular to external connections --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index da614f6..d774c09 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "license": "MIT", "scripts": { "ng": "ng", - "start": "ng serve", + "start": "ng serve --host=0.0.0.0 --port=4200", "build": "ng build", "test": "ng test --code-cover", "lint": "ng lint", From d7f94ae353aa1899537213a604853a3bbad90706 Mon Sep 17 00:00:00 2001 From: Finn K Date: Tue, 16 Jan 2018 11:46:11 +0100 Subject: [PATCH 33/50] Exclude dockerfiles from coverage report --- karma.conf.js | 1 + 1 file changed, 1 insertion(+) diff --git a/karma.conf.js b/karma.conf.js index 8893c95..7cbbd87 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -22,6 +22,7 @@ module.exports = function (config) { angularCli: { environment: 'dev' }, + exclude: ['docker-compose.yml', 'Dockerfile'], reporters: ['progress', 'kjhtml'], port: 9876, colors: true, From ebf114239ca2cde335de92ba755b466d64475817 Mon Sep 17 00:00:00 2001 From: bisbaldi Date: Tue, 16 Jan 2018 12:45:37 +0100 Subject: [PATCH 34/50] Add tests for date builder service --- src/app/menu/header/header.component.spec.ts | 2 +- src/app/services/date-builder.service.spec.ts | 28 +++++++++++++++++++ src/app/services/date-builder.service.ts | 2 +- .../public-statistics.service.spec.ts | 2 +- 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/app/menu/header/header.component.spec.ts b/src/app/menu/header/header.component.spec.ts index 5f0aa6b..cebd68b 100644 --- a/src/app/menu/header/header.component.spec.ts +++ b/src/app/menu/header/header.component.spec.ts @@ -1,7 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { HeaderComponent } from './header.component'; -import {CUSTOM_ELEMENTS_SCHEMA} from "@angular/core"; +import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; describe('HeaderComponent', () => { let component: HeaderComponent; diff --git a/src/app/services/date-builder.service.spec.ts b/src/app/services/date-builder.service.spec.ts index af9bdd2..21befe1 100644 --- a/src/app/services/date-builder.service.spec.ts +++ b/src/app/services/date-builder.service.spec.ts @@ -2,8 +2,11 @@ import { TestBed, inject } from '@angular/core/testing'; import { DateBuilderService } from './date-builder.service'; +let testService; + describe('DateBuilderService', () => { beforeEach(() => { + testService = new DateBuilderService(); TestBed.configureTestingModule({ providers: [DateBuilderService] }); @@ -12,4 +15,29 @@ describe('DateBuilderService', () => { it('should be created', inject([DateBuilderService], (service: DateBuilderService) => { expect(service).toBeTruthy(); })); + + it('should set hours', () => { + const date = new Date('October 13, 2014 11:13:00'); + const modifiedDate = new Date('October 13, 2014 10:13:00'); + expect(testService.convertDate(date, 10, null)).toEqual(modifiedDate); + }); + + it('should set minutes', () => { + const date = new Date('October 13, 2014 11:13:00'); + const modifiedDate = new Date('October 13, 2014 11:10:00'); + expect(testService.convertDate(date, null, 10)).toEqual(modifiedDate); + }); + + it('should set hours and minutes', () => { + const date = new Date('October 13, 2014 11:13:00'); + const modifiedDate = new Date('October 13, 2014 10:10:00'); + expect(testService.convertDate(date, 10, 10)).toEqual(modifiedDate); + }); + + it('should not set hours and minutes', () => { + const date = new Date('October 13, 2014 11:13:00'); + expect(testService.convertDate(date, null, null)).toEqual(date); + }); + + }); diff --git a/src/app/services/date-builder.service.ts b/src/app/services/date-builder.service.ts index 5be0614..a7dc6e3 100644 --- a/src/app/services/date-builder.service.ts +++ b/src/app/services/date-builder.service.ts @@ -5,7 +5,7 @@ export class DateBuilderService { constructor() { } - public convertDate(day:Date, hours: number, minutes: number) { + public convertDate(day: Date, hours: number, minutes: number) { if (hours != null) { day.setHours(hours); } diff --git a/src/app/services/public-statistics.service.spec.ts b/src/app/services/public-statistics.service.spec.ts index 9d9a27d..e102231 100644 --- a/src/app/services/public-statistics.service.spec.ts +++ b/src/app/services/public-statistics.service.spec.ts @@ -1,7 +1,7 @@ import { TestBed, inject } from '@angular/core/testing'; import { PublicStatisticsService } from './public-statistics.service'; -import {HttpClientModule} from "@angular/common/http"; +import {HttpClientModule} from '@angular/common/http'; describe('PublicStatisticsService', () => { beforeEach(() => { From 695aedf13d792afd8e718cb1ea14fbe67a590ed3 Mon Sep 17 00:00:00 2001 From: Finn K Date: Tue, 16 Jan 2018 15:00:39 +0100 Subject: [PATCH 35/50] Define public host to fix invalid host header error --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d774c09..cee5ecd 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "license": "MIT", "scripts": { "ng": "ng", - "start": "ng serve --host=0.0.0.0 --port=4200", + "start": "ng serve --host=0.0.0.0 --port=4200 --public-host=https://bpt-lab.org/bp2017w1-frontend/", "build": "ng build", "test": "ng test --code-cover", "lint": "ng lint", From 7947d4e85ec86514fe5e7d3fc94f51ed6058ffb0 Mon Sep 17 00:00:00 2001 From: bisbaldi Date: Tue, 16 Jan 2018 16:25:39 +0100 Subject: [PATCH 36/50] Add tests for public-statistics-service get method --- src/app/services/date-builder.service.spec.ts | 40 ++++++++-------- .../public-statistics.service.spec.ts | 48 ++++++++++++++++--- src/app/services/public-statistics.service.ts | 4 +- 3 files changed, 65 insertions(+), 27 deletions(-) diff --git a/src/app/services/date-builder.service.spec.ts b/src/app/services/date-builder.service.spec.ts index 21befe1..c1af2aa 100644 --- a/src/app/services/date-builder.service.spec.ts +++ b/src/app/services/date-builder.service.spec.ts @@ -16,28 +16,30 @@ describe('DateBuilderService', () => { expect(service).toBeTruthy(); })); - it('should set hours', () => { - const date = new Date('October 13, 2014 11:13:00'); - const modifiedDate = new Date('October 13, 2014 10:13:00'); - expect(testService.convertDate(date, 10, null)).toEqual(modifiedDate); - }); + describe('convertDate()', () => { - it('should set minutes', () => { - const date = new Date('October 13, 2014 11:13:00'); - const modifiedDate = new Date('October 13, 2014 11:10:00'); - expect(testService.convertDate(date, null, 10)).toEqual(modifiedDate); - }); + it('should set hours', () => { + const date = new Date('October 13, 2014 11:13:00'); + const modifiedDate = new Date('October 13, 2014 10:13:00'); + expect(testService.convertDate(date, 10, null)).toEqual(modifiedDate); + }); - it('should set hours and minutes', () => { - const date = new Date('October 13, 2014 11:13:00'); - const modifiedDate = new Date('October 13, 2014 10:10:00'); - expect(testService.convertDate(date, 10, 10)).toEqual(modifiedDate); - }); + it('should set minutes', () => { + const date = new Date('October 13, 2014 11:13:00'); + const modifiedDate = new Date('October 13, 2014 11:10:00'); + expect(testService.convertDate(date, null, 10)).toEqual(modifiedDate); + }); - it('should not set hours and minutes', () => { - const date = new Date('October 13, 2014 11:13:00'); - expect(testService.convertDate(date, null, null)).toEqual(date); - }); + it('should set hours and minutes', () => { + const date = new Date('October 13, 2014 11:13:00'); + const modifiedDate = new Date('October 13, 2014 10:10:00'); + expect(testService.convertDate(date, 10, 10)).toEqual(modifiedDate); + }); + it('should not set hours and minutes', () => { + const date = new Date('October 13, 2014 11:13:00'); + expect(testService.convertDate(date, null, null)).toEqual(date); + }); + }); }); diff --git a/src/app/services/public-statistics.service.spec.ts b/src/app/services/public-statistics.service.spec.ts index e102231..b81a96d 100644 --- a/src/app/services/public-statistics.service.spec.ts +++ b/src/app/services/public-statistics.service.spec.ts @@ -1,17 +1,53 @@ -import { TestBed, inject } from '@angular/core/testing'; +import {TestBed, inject, async} from '@angular/core/testing'; import { PublicStatisticsService } from './public-statistics.service'; -import {HttpClientModule} from '@angular/common/http'; +import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing'; describe('PublicStatisticsService', () => { + + let service: PublicStatisticsService; + let httpMock: HttpTestingController; + beforeEach(() => { TestBed.configureTestingModule({ - imports: [HttpClientModule], - providers: [HttpClientModule, PublicStatisticsService] + imports: [HttpClientTestingModule], + providers: [PublicStatisticsService] }); + + service = TestBed.get(PublicStatisticsService); + httpMock = TestBed.get(HttpTestingController); + }); - it('should be created', inject([PublicStatisticsService], (service: PublicStatisticsService) => { + afterEach(() => { + httpMock.verify(); + }); + + it('should be created', () => { expect(service).toBeTruthy(); - })); + }); + + describe('get()', () => { + + it(`should issue a get request`, async(() => { + service.get().subscribe(); + httpMock.expectOne({ + url: '', + method: 'GET' + }); + }) + ); + + it(`should respond with fake data`, async() => { + service.get().subscribe((next) => { + expect(next).toEqual({ baz: '123' }); + }); + + httpMock.match({ + url: '', + method: 'GET' + })[0].flush({ baz: '123' }); + }); + }); + }); diff --git a/src/app/services/public-statistics.service.ts b/src/app/services/public-statistics.service.ts index abf94b2..a7b160a 100644 --- a/src/app/services/public-statistics.service.ts +++ b/src/app/services/public-statistics.service.ts @@ -1,6 +1,6 @@ import {Inject, Injectable} from '@angular/core'; -import {HttpClient} from "@angular/common/http"; -import {environment} from "../../environments/environment"; +import {HttpClient} from '@angular/common/http'; +import {environment} from '../../environments/environment'; @Injectable() export class PublicStatisticsService { From f7ad469b23277a0175b33babaffcf931fd84dd2a Mon Sep 17 00:00:00 2001 From: bisbaldi Date: Tue, 16 Jan 2018 16:42:48 +0100 Subject: [PATCH 37/50] Update tests for public-statistics-service get method --- .../public-statistics.service.spec.ts | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/app/services/public-statistics.service.spec.ts b/src/app/services/public-statistics.service.spec.ts index b81a96d..a65fb62 100644 --- a/src/app/services/public-statistics.service.spec.ts +++ b/src/app/services/public-statistics.service.spec.ts @@ -27,27 +27,39 @@ describe('PublicStatisticsService', () => { expect(service).toBeTruthy(); }); - describe('get()', () => { + describe(`get()`, () => { it(`should issue a get request`, async(() => { service.get().subscribe(); httpMock.expectOne({ - url: '', + url: `${service.url}`, method: 'GET' }); }) ); - it(`should respond with fake data`, async() => { - service.get().subscribe((next) => { - expect(next).toEqual({ baz: '123' }); + it(`should return an Observable { + const dummyStatistics = [ + { + '_id': '5a390f0be06d32001e7fb5d7', + 'avgBlocktime': 15.064466666666666, + 'avgHashrate': 21833916, + 'numberOfMiners': 65275, + 'numberOfWorkers': 178121, + 'timeToNextEpoch': 150192.73266666665, + 'timeStamp': 1513688843010, + 'chain': 'ethereum', + '__v': 0 + } + ]; + + service.get().subscribe(users => { + expect(users).toEqual(dummyStatistics); }); - httpMock.match({ - url: '', - method: 'GET' - })[0].flush({ baz: '123' }); - }); - }); + const req = httpMock.expectOne(`${service.url}`); + expect(req.request.method).toBe('GET'); + req.flush(dummyStatistics); + }); }); }); From 9106cf92f3d18adbe037b281503e09f9daee86c0 Mon Sep 17 00:00:00 2001 From: bisbaldi Date: Tue, 16 Jan 2018 16:52:44 +0100 Subject: [PATCH 38/50] Add tests for public-statistics-service query method --- .../public-statistics.service.spec.ts | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/app/services/public-statistics.service.spec.ts b/src/app/services/public-statistics.service.spec.ts index a65fb62..6604c04 100644 --- a/src/app/services/public-statistics.service.spec.ts +++ b/src/app/services/public-statistics.service.spec.ts @@ -50,16 +50,30 @@ describe('PublicStatisticsService', () => { 'timeStamp': 1513688843010, 'chain': 'ethereum', '__v': 0 - } + }, ]; - service.get().subscribe(users => { - expect(users).toEqual(dummyStatistics); + service.get().subscribe(result => { + expect(result).toEqual(dummyStatistics); }); const req = httpMock.expectOne(`${service.url}`); expect(req.request.method).toBe('GET'); req.flush(dummyStatistics); - }); }); + }); + }); + + describe(`query()`, () => { + + it(`should issue a query request`, async(() => { + service.query('test').subscribe(); + httpMock.expectOne({ + url: `${service.url}?test`, + method: 'GET' + }); + }) + ); + + }); }); From 680f3528a872b25ffdca9713d73d8d7cfe5b2244 Mon Sep 17 00:00:00 2001 From: bisbaldi Date: Wed, 17 Jan 2018 10:03:27 +0100 Subject: [PATCH 39/50] Add tests for public-statistics-service query method without query parameter --- src/app/services/public-statistics.service.spec.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/app/services/public-statistics.service.spec.ts b/src/app/services/public-statistics.service.spec.ts index 6604c04..7d7e4d4 100644 --- a/src/app/services/public-statistics.service.spec.ts +++ b/src/app/services/public-statistics.service.spec.ts @@ -74,6 +74,15 @@ describe('PublicStatisticsService', () => { }) ); + it(`should issue a query request without a query`, async(() => { + service.query().subscribe(); + httpMock.expectOne({ + url: `${service.url}`, + method: 'GET' + }); + }) + ); + }); }); From 06f8f672900935c8533fe2536145fb0b13e45ddd Mon Sep 17 00:00:00 2001 From: Finn K Date: Wed, 17 Jan 2018 10:34:13 +0100 Subject: [PATCH 40/50] Fix host settings --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cee5ecd..55e8d4a 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "license": "MIT", "scripts": { "ng": "ng", - "start": "ng serve --host=0.0.0.0 --port=4200 --public-host=https://bpt-lab.org/bp2017w1-frontend/", + "start": "ng serve --host=0.0.0.0 --port=4200 --disable-host-check", "build": "ng build", "test": "ng test --code-cover", "lint": "ng lint", From 88ecd0e1dc50a412ed81fbf6acbaf6f5133e6120 Mon Sep 17 00:00:00 2001 From: bisbaldi Date: Wed, 17 Jan 2018 10:41:02 +0100 Subject: [PATCH 41/50] Add tests for private-statistics-service --- .../private-statistics.service.spec.ts | 81 +++++++++++++++++-- .../public-statistics.service.spec.ts | 2 +- 2 files changed, 76 insertions(+), 7 deletions(-) diff --git a/src/app/services/private-statistics.service.spec.ts b/src/app/services/private-statistics.service.spec.ts index 1ef65e1..f124959 100644 --- a/src/app/services/private-statistics.service.spec.ts +++ b/src/app/services/private-statistics.service.spec.ts @@ -1,17 +1,86 @@ -import { TestBed, inject } from '@angular/core/testing'; +import {async, TestBed} from '@angular/core/testing'; import { PrivateStatisticsService } from './private-statistics.service'; -import {HttpClientModule} from "@angular/common/http"; +import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing'; describe('PrivateStatisticsService', () => { + + let service: PrivateStatisticsService; + let httpMock: HttpTestingController; + beforeEach(() => { TestBed.configureTestingModule({ - imports: [HttpClientModule], - providers: [PrivateStatisticsService, HttpClientModule] + imports: [HttpClientTestingModule], + providers: [PrivateStatisticsService] }); + + service = TestBed.get(PrivateStatisticsService); + httpMock = TestBed.get(HttpTestingController); + }); + + afterEach(() => { + httpMock.verify(); }); - it('should be created', inject([PrivateStatisticsService], (service: PrivateStatisticsService) => { + it('should be created', () => { expect(service).toBeTruthy(); - })); + }); + + describe(`get()`, () => { + + it(`should issue a get request`, async(() => { + service.get().subscribe(); + httpMock.expectOne({ + url: `${service.url}`, + method: 'GET' + }); + }) + ); + }); + + it(`should return an Observable { + const dummyStatistics = [ + {'_id': '5a5f18d840589c001e86ffeb', + 'chain': 'ethereum', + 'timeStamp': '2018-01-17T09:35:20.000Z', + 'numberOfHosts': 20, + 'numberOfMiners': 20, + 'avgHashrate': 31713.625, + 'avgBlocktime': 5.6375, + 'avgGasPrice': 18000000000, + 'avgDifficulty': 4373870.625, + '__v': 0}, + ]; + + service.get().subscribe(result => { + expect(result).toEqual(dummyStatistics); + }); + + const req = httpMock.expectOne(`${service.url}`); + expect(req.request.method).toBe('GET'); + req.flush(dummyStatistics); + }); + + describe(`query()`, () => { + + it(`should issue a query request`, async(() => { + service.query('test').subscribe(); + httpMock.expectOne({ + url: `${service.url}?test`, + method: 'GET' + }); + }) + ); + + it(`should issue a query request without a query`, async(() => { + service.query().subscribe(); + httpMock.expectOne({ + url: `${service.url}`, + method: 'GET' + }); + }) + ); + + }); + }); diff --git a/src/app/services/public-statistics.service.spec.ts b/src/app/services/public-statistics.service.spec.ts index 7d7e4d4..c2e8858 100644 --- a/src/app/services/public-statistics.service.spec.ts +++ b/src/app/services/public-statistics.service.spec.ts @@ -1,4 +1,4 @@ -import {TestBed, inject, async} from '@angular/core/testing'; +import {TestBed, async} from '@angular/core/testing'; import { PublicStatisticsService } from './public-statistics.service'; import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing'; From 612c5353be49f915f35c88ac338fb7017f4ce786 Mon Sep 17 00:00:00 2001 From: bisbaldi Date: Wed, 17 Jan 2018 13:29:16 +0100 Subject: [PATCH 42/50] Fix linting --- package.json | 2 +- src/app/app.component.spec.ts | 2 +- .../charts/barchart/barchart.component.spec.ts | 4 ++-- .../dashboard/charts/barchart/barchart.component.ts | 9 ++++----- .../private-charts/private-charts.component.spec.ts | 2 +- .../private-charts/private-charts.component.ts | 2 +- .../public-charts/public-charts.component.spec.ts | 2 +- .../charts/public-charts/public-charts.component.ts | 4 ++-- src/app/dashboard/form/form.component.html | 9 +++++---- src/app/dashboard/form/form.component.spec.ts | 6 +++--- src/app/dashboard/form/form.component.ts | 12 ++++++------ src/app/dashboard/metric/metric.component.spec.ts | 2 +- src/app/dashboard/metric/metric.component.ts | 4 ++-- src/app/dashboard/welcome/welcome.component.spec.ts | 2 +- src/app/menu/footer/footer.component.spec.ts | 2 +- src/app/services/private-statistics.service.ts | 4 ++-- 16 files changed, 34 insertions(+), 34 deletions(-) diff --git a/package.json b/package.json index 55e8d4a..6209932 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "ng": "ng", "start": "ng serve --host=0.0.0.0 --port=4200 --disable-host-check", "build": "ng build", - "test": "ng test --code-cover", + "test": "npm run lint && ng test --code-cover", "lint": "ng lint", "e2e": "ng e2e", "coveralls": "cat ./coverage/lcov.info | coveralls && rm -rf ./coverage" diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index 1b4be66..495c2f6 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -1,6 +1,6 @@ import { TestBed, async } from '@angular/core/testing'; import { AppComponent } from './app.component'; -import {CUSTOM_ELEMENTS_SCHEMA} from "@angular/core"; +import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; describe('AppComponent', () => { beforeEach(async(() => { diff --git a/src/app/dashboard/charts/barchart/barchart.component.spec.ts b/src/app/dashboard/charts/barchart/barchart.component.spec.ts index 63effc4..0a6fef3 100644 --- a/src/app/dashboard/charts/barchart/barchart.component.spec.ts +++ b/src/app/dashboard/charts/barchart/barchart.component.spec.ts @@ -1,8 +1,8 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { BarchartComponent } from './barchart.component'; -import {ChartsModule} from "ng2-charts"; -import {CUSTOM_ELEMENTS_SCHEMA} from "@angular/core"; +import {ChartsModule} from 'ng2-charts'; +import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; describe('BarchartComponent', () => { let component: BarchartComponent; diff --git a/src/app/dashboard/charts/barchart/barchart.component.ts b/src/app/dashboard/charts/barchart/barchart.component.ts index 330aa45..7b31d09 100644 --- a/src/app/dashboard/charts/barchart/barchart.component.ts +++ b/src/app/dashboard/charts/barchart/barchart.component.ts @@ -1,5 +1,4 @@ import {Component, Input, OnChanges, OnInit} from '@angular/core'; -import {PrivateStatistics} from "../../../services/PrivateStatistics"; @Component({ selector: 'app-barchart', @@ -40,19 +39,19 @@ export class BarchartComponent implements OnInit, OnChanges { ngOnChanges() { this.barChartData = []; - for(let i = 0; i < this.labels.length; i++){ + for (let i = 0; i < this.labels.length; i++) { this.barChartData.push( {data: [this.statistics[this.labels[i]]], label: this.labels[i]} - ) + ); } } // events - public chartClicked(e:any):void { + public chartClicked(e: any): void { console.log(e); } - public chartHovered(e:any):void { + public chartHovered(e: any): void { console.log(e); } diff --git a/src/app/dashboard/charts/private-charts/private-charts.component.spec.ts b/src/app/dashboard/charts/private-charts/private-charts.component.spec.ts index 22b265d..f242432 100644 --- a/src/app/dashboard/charts/private-charts/private-charts.component.spec.ts +++ b/src/app/dashboard/charts/private-charts/private-charts.component.spec.ts @@ -1,7 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { PrivateChartsComponent } from './private-charts.component'; -import {CUSTOM_ELEMENTS_SCHEMA} from "@angular/core"; +import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; describe('PrivateChartsComponent', () => { let component: PrivateChartsComponent; diff --git a/src/app/dashboard/charts/private-charts/private-charts.component.ts b/src/app/dashboard/charts/private-charts/private-charts.component.ts index ce32ff1..3a6e3be 100644 --- a/src/app/dashboard/charts/private-charts/private-charts.component.ts +++ b/src/app/dashboard/charts/private-charts/private-charts.component.ts @@ -1,5 +1,5 @@ import {Component, Input, OnInit} from '@angular/core'; -import {PrivateStatistics} from "../../../services/PrivateStatistics"; +import {PrivateStatistics} from '../../../services/PrivateStatistics'; @Component({ selector: 'app-private-charts', diff --git a/src/app/dashboard/charts/public-charts/public-charts.component.spec.ts b/src/app/dashboard/charts/public-charts/public-charts.component.spec.ts index 7dc655f..8d7f055 100644 --- a/src/app/dashboard/charts/public-charts/public-charts.component.spec.ts +++ b/src/app/dashboard/charts/public-charts/public-charts.component.spec.ts @@ -1,7 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { PublicChartsComponent } from './public-charts.component'; -import {CUSTOM_ELEMENTS_SCHEMA} from "@angular/core"; +import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; describe('PublicChartsComponent', () => { let component: PublicChartsComponent; diff --git a/src/app/dashboard/charts/public-charts/public-charts.component.ts b/src/app/dashboard/charts/public-charts/public-charts.component.ts index ed1ca18..c5d5f73 100644 --- a/src/app/dashboard/charts/public-charts/public-charts.component.ts +++ b/src/app/dashboard/charts/public-charts/public-charts.component.ts @@ -1,5 +1,5 @@ import {Component, Input, OnChanges, OnInit} from '@angular/core'; -import {PublicStatistics} from "../../../services/PublicStatistics"; +import {PublicStatistics} from '../../../services/PublicStatistics'; @Component({ selector: 'app-public-charts', @@ -16,6 +16,6 @@ export class PublicChartsComponent implements OnInit, OnChanges { ngOnInit() { } - ngOnChanges(){ + ngOnChanges() { } } diff --git a/src/app/dashboard/form/form.component.html b/src/app/dashboard/form/form.component.html index 33e21ce..c1ba92f 100644 --- a/src/app/dashboard/form/form.component.html +++ b/src/app/dashboard/form/form.component.html @@ -17,16 +17,17 @@

Define Time Span

+ None - {{hour}} + {{ hour }} : None - {{minute}} + {{ minute }}

@@ -39,13 +40,13 @@

Define Time Span

None - {{hour}} + {{ hour }} : None - {{minute}} + {{ minute }}

diff --git a/src/app/dashboard/form/form.component.spec.ts b/src/app/dashboard/form/form.component.spec.ts index 61cb4d6..b67a375 100644 --- a/src/app/dashboard/form/form.component.spec.ts +++ b/src/app/dashboard/form/form.component.spec.ts @@ -1,9 +1,9 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { FormComponent } from './form.component'; -import {CUSTOM_ELEMENTS_SCHEMA} from "@angular/core"; -import {MatDatepickerModule, MatNativeDateModule} from "@angular/material"; -import {FormsModule, ReactiveFormsModule} from "@angular/forms"; +import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; +import {MatDatepickerModule, MatNativeDateModule} from '@angular/material'; +import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import { DateBuilderService } from '../../services/date-builder.service'; describe('FormComponent', () => { diff --git a/src/app/dashboard/form/form.component.ts b/src/app/dashboard/form/form.component.ts index 88c9f4f..0055adb 100644 --- a/src/app/dashboard/form/form.component.ts +++ b/src/app/dashboard/form/form.component.ts @@ -23,18 +23,18 @@ export class FormComponent implements OnInit { minDate = new Date('2017-12-20'); maxDate = new Date(Date.now()); - hours = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23] - minutes = [0,10,20,30,40,50] + hours = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]; + minutes = [0, 10, 20, 30, 40, 50]; - constructor(private DateBuilderService: DateBuilderService) { } + constructor(private dateBuilderService: DateBuilderService) { } ngOnInit() { } emitEvent() { - this.startDate = this.DateBuilderService.convertDate(this.startDate, this.startHours, this.startMinutes); - this.endDate = this.DateBuilderService.convertDate(this.endDate, this.endHours, this.endMinutes); - this.showData.emit([this.privateChecked, this.publicChecked, this.startDate,this.endDate]); + this.startDate = this.dateBuilderService.convertDate(this.startDate, this.startHours, this.startMinutes); + this.endDate = this.dateBuilderService.convertDate(this.endDate, this.endHours, this.endMinutes); + this.showData.emit([this.privateChecked, this.publicChecked, this.startDate, this.endDate]); } } diff --git a/src/app/dashboard/metric/metric.component.spec.ts b/src/app/dashboard/metric/metric.component.spec.ts index b561a24..cf79886 100644 --- a/src/app/dashboard/metric/metric.component.spec.ts +++ b/src/app/dashboard/metric/metric.component.spec.ts @@ -1,7 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { MetricComponent } from './metric.component'; -import {CUSTOM_ELEMENTS_SCHEMA} from "@angular/core"; +import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; describe('MetricComponent', () => { let component: MetricComponent; diff --git a/src/app/dashboard/metric/metric.component.ts b/src/app/dashboard/metric/metric.component.ts index 0df5de6..7779c0a 100644 --- a/src/app/dashboard/metric/metric.component.ts +++ b/src/app/dashboard/metric/metric.component.ts @@ -1,6 +1,6 @@ import {Component, Input, OnInit} from '@angular/core'; -import {PublicStatistics} from "../../services/PublicStatistics"; -import {PrivateStatistics} from "../../services/PrivateStatistics"; +import {PublicStatistics} from '../../services/PublicStatistics'; +import {PrivateStatistics} from '../../services/PrivateStatistics'; @Component({ selector: 'app-metric', diff --git a/src/app/dashboard/welcome/welcome.component.spec.ts b/src/app/dashboard/welcome/welcome.component.spec.ts index 3a656b6..c84e616 100644 --- a/src/app/dashboard/welcome/welcome.component.spec.ts +++ b/src/app/dashboard/welcome/welcome.component.spec.ts @@ -1,7 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { WelcomeComponent } from './welcome.component'; -import {CUSTOM_ELEMENTS_SCHEMA} from "@angular/core"; +import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; describe('WelcomeComponent', () => { let component: WelcomeComponent; diff --git a/src/app/menu/footer/footer.component.spec.ts b/src/app/menu/footer/footer.component.spec.ts index 576427b..aecff81 100644 --- a/src/app/menu/footer/footer.component.spec.ts +++ b/src/app/menu/footer/footer.component.spec.ts @@ -1,7 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { FooterComponent } from './footer.component'; -import {CUSTOM_ELEMENTS_SCHEMA} from "@angular/core"; +import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; describe('FooterComponent', () => { let component: FooterComponent; diff --git a/src/app/services/private-statistics.service.ts b/src/app/services/private-statistics.service.ts index 7cc0841..802fe88 100644 --- a/src/app/services/private-statistics.service.ts +++ b/src/app/services/private-statistics.service.ts @@ -1,6 +1,6 @@ import {Inject, Injectable} from '@angular/core'; -import {environment} from "../../environments/environment"; -import {HttpClient} from "@angular/common/http"; +import {environment} from '../../environments/environment'; +import {HttpClient} from '@angular/common/http'; @Injectable() export class PrivateStatisticsService { From d3f0542e3162b2214f7c328701317b40d3060e48 Mon Sep 17 00:00:00 2001 From: bisbaldi Date: Wed, 17 Jan 2018 15:20:37 +0100 Subject: [PATCH 43/50] Add material module --- src/app/app-material.module.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/app/app-material.module.ts diff --git a/src/app/app-material.module.ts b/src/app/app-material.module.ts new file mode 100644 index 0000000..c9946d9 --- /dev/null +++ b/src/app/app-material.module.ts @@ -0,0 +1,10 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +@NgModule({ + imports: [ + CommonModule + ], + declarations: [] +}) +export class AppMaterialModule { } From 451283bcb7de561ce771fa1bd617f1f02c062985 Mon Sep 17 00:00:00 2001 From: bisbaldi Date: Wed, 17 Jan 2018 15:28:24 +0100 Subject: [PATCH 44/50] Import material module in app module --- src/app/app-material.module.ts | 33 +++++++++++++++++++++++++++++++-- src/app/app.module.ts | 22 ++++------------------ 2 files changed, 35 insertions(+), 20 deletions(-) diff --git a/src/app/app-material.module.ts b/src/app/app-material.module.ts index c9946d9..d880966 100644 --- a/src/app/app-material.module.ts +++ b/src/app/app-material.module.ts @@ -1,10 +1,39 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; +import { + MatButtonModule, MatCardModule, MatCheckboxModule, MatDatepickerModule, MatFormFieldModule, MatIconModule, + MatInputModule, + MatNativeDateModule, MatSelectModule, MatSnackBarModule, + MatToolbarModule +} from '@angular/material'; @NgModule({ imports: [ - CommonModule + CommonModule, + MatToolbarModule, + MatButtonModule, + MatIconModule, + MatCardModule, + MatCheckboxModule, + MatDatepickerModule, + MatNativeDateModule, + MatFormFieldModule, + MatInputModule, + MatSnackBarModule, + MatSelectModule, + ], + exports: [ + MatToolbarModule, + MatButtonModule, + MatIconModule, + MatCardModule, + MatCheckboxModule, + MatDatepickerModule, + MatNativeDateModule, + MatFormFieldModule, + MatInputModule, + MatSnackBarModule, + MatSelectModule, ], - declarations: [] }) export class AppMaterialModule { } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 870cb9a..634e60a 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -21,13 +21,8 @@ import { BarchartComponent } from './dashboard/charts/barchart/barchart.componen import { LinechartComponent } from './dashboard/charts/linechart/linechart.component'; import { NotFoundComponent } from './not-found/not-found.component'; import { AppRoutingModule } from './app-routing-module'; - -import { - MatButtonModule, MatIconModule, MatToolbarModule, MatCardModule, MatCheckboxModule, - MatDatepickerModule, MatFormFieldModule, MatNativeDateModule, MatInputModule, - MatSnackBarModule, MatSelectModule, -} from '@angular/material'; import { ImpressumComponent } from './impressum/impressum.component'; +import {AppMaterialModule} from './app-material.module'; @NgModule({ declarations: [ @@ -47,24 +42,15 @@ import { ImpressumComponent } from './impressum/impressum.component'; ], imports: [ BrowserModule, + BrowserAnimationsModule, + AppMaterialModule, FormsModule, ReactiveFormsModule, - BrowserAnimationsModule, ChartsModule, HttpClientModule, FlexLayoutModule, AppRoutingModule, - MatToolbarModule, - MatButtonModule, - MatIconModule, - MatCardModule, - MatCheckboxModule, - MatDatepickerModule, - MatNativeDateModule, - MatFormFieldModule, - MatInputModule, - MatSnackBarModule, - MatSelectModule, + ], providers: [HttpClientModule, DatePipe], bootstrap: [AppComponent], From e059f0894e8357de1fd483c769d5a32cec466161 Mon Sep 17 00:00:00 2001 From: bisbaldi Date: Wed, 17 Jan 2018 15:31:35 +0100 Subject: [PATCH 45/50] Add dashboard module --- src/app/dashboard/dashboard.module.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/app/dashboard/dashboard.module.ts b/src/app/dashboard/dashboard.module.ts index e69de29..fc20756 100644 --- a/src/app/dashboard/dashboard.module.ts +++ b/src/app/dashboard/dashboard.module.ts @@ -0,0 +1,10 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +@NgModule({ + imports: [ + CommonModule + ], + declarations: [] +}) +export class DashboardModule { } From 2ae5e272f8323d77724338db085d66988a90595e Mon Sep 17 00:00:00 2001 From: bisbaldi Date: Wed, 17 Jan 2018 15:44:03 +0100 Subject: [PATCH 46/50] Move dependencies from app to dashboard module --- src/app/app-material.module.ts | 3 +++ src/app/app.module.ts | 34 ++++---------------------- src/app/dashboard/dashboard.module.ts | 35 ++++++++++++++++++++++++--- 3 files changed, 40 insertions(+), 32 deletions(-) diff --git a/src/app/app-material.module.ts b/src/app/app-material.module.ts index d880966..7e40862 100644 --- a/src/app/app-material.module.ts +++ b/src/app/app-material.module.ts @@ -6,10 +6,12 @@ import { MatNativeDateModule, MatSelectModule, MatSnackBarModule, MatToolbarModule } from '@angular/material'; +import {FlexLayoutModule} from '@angular/flex-layout'; @NgModule({ imports: [ CommonModule, + FlexLayoutModule, MatToolbarModule, MatButtonModule, MatIconModule, @@ -23,6 +25,7 @@ import { MatSelectModule, ], exports: [ + FlexLayoutModule, MatToolbarModule, MatButtonModule, MatIconModule, diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 634e60a..a929bc4 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -1,42 +1,23 @@ import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; -import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; -import {ChartsModule} from 'ng2-charts'; -import {HttpClientModule} from '@angular/common/http'; -import {DatePipe} from '@angular/common'; -import {FlexLayoutModule} from '@angular/flex-layout'; -import { CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; import { AppComponent } from './app.component'; import { FooterComponent } from './menu/footer/footer.component'; import { HeaderComponent } from './menu/header/header.component'; -import { DashboardComponent } from './dashboard/dashboard.component'; -import { WelcomeComponent } from './dashboard/welcome/welcome.component'; -import { FormComponent } from './dashboard/form/form.component'; -import { MetricComponent } from './dashboard/metric/metric.component'; -import { PublicChartsComponent } from './dashboard/charts/public-charts/public-charts.component'; -import { PrivateChartsComponent } from './dashboard/charts/private-charts/private-charts.component'; -import { BarchartComponent } from './dashboard/charts/barchart/barchart.component'; -import { LinechartComponent } from './dashboard/charts/linechart/linechart.component'; import { NotFoundComponent } from './not-found/not-found.component'; import { AppRoutingModule } from './app-routing-module'; import { ImpressumComponent } from './impressum/impressum.component'; import {AppMaterialModule} from './app-material.module'; +import {DashboardModule} from './dashboard/dashboard.module'; @NgModule({ declarations: [ AppComponent, FooterComponent, HeaderComponent, - DashboardComponent, - WelcomeComponent, - FormComponent, - MetricComponent, - PublicChartsComponent, - PrivateChartsComponent, - BarchartComponent, - LinechartComponent, + + NotFoundComponent, ImpressumComponent, ], @@ -44,16 +25,11 @@ import {AppMaterialModule} from './app-material.module'; BrowserModule, BrowserAnimationsModule, AppMaterialModule, - FormsModule, - ReactiveFormsModule, - ChartsModule, - HttpClientModule, - FlexLayoutModule, + AppRoutingModule, + DashboardModule, ], - providers: [HttpClientModule, DatePipe], bootstrap: [AppComponent], - schemas: [CUSTOM_ELEMENTS_SCHEMA], }) export class AppModule { } diff --git a/src/app/dashboard/dashboard.module.ts b/src/app/dashboard/dashboard.module.ts index fc20756..b9d6201 100644 --- a/src/app/dashboard/dashboard.module.ts +++ b/src/app/dashboard/dashboard.module.ts @@ -1,10 +1,39 @@ import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; +import {CommonModule, DatePipe} from '@angular/common'; +import {WelcomeComponent} from './welcome/welcome.component'; +import {AppMaterialModule} from '../app-material.module'; +import {DashboardComponent} from './dashboard.component'; +import {FormsModule, ReactiveFormsModule} from '@angular/forms'; +import {FormComponent} from './form/form.component'; +import {MetricComponent} from './metric/metric.component'; +import {PublicChartsComponent} from './charts/public-charts/public-charts.component'; +import {PrivateChartsComponent} from './charts/private-charts/private-charts.component'; +import {BarchartComponent} from './charts/barchart/barchart.component'; +import {LinechartComponent} from './charts/linechart/linechart.component'; +import {ChartsModule} from 'ng2-charts'; +import {HttpClientModule} from '@angular/common/http'; @NgModule({ imports: [ - CommonModule + CommonModule, + AppMaterialModule, + FormsModule, + ReactiveFormsModule, + ChartsModule, + HttpClientModule, + + ], + declarations: [ + DashboardComponent, + WelcomeComponent, + FormComponent, + MetricComponent, + PublicChartsComponent, + PrivateChartsComponent, + BarchartComponent, + LinechartComponent, ], - declarations: [] + providers: [HttpClientModule, DatePipe], + }) export class DashboardModule { } From 2b739e6450a0c291425ad934061b26b2120d4b73 Mon Sep 17 00:00:00 2001 From: bisbaldi Date: Wed, 17 Jan 2018 15:47:40 +0100 Subject: [PATCH 47/50] Add dashboard routing module --- src/app/app-routing-module.ts | 2 +- src/app/app.module.ts | 7 ++----- src/app/dashboard/dashboard-routing-module.ts | 0 3 files changed, 3 insertions(+), 6 deletions(-) create mode 100644 src/app/dashboard/dashboard-routing-module.ts diff --git a/src/app/app-routing-module.ts b/src/app/app-routing-module.ts index 915571e..40ba6ba 100644 --- a/src/app/app-routing-module.ts +++ b/src/app/app-routing-module.ts @@ -1,6 +1,6 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; -import { Router, RouterModule } from '@angular/router'; +import { RouterModule } from '@angular/router'; import { NotFoundComponent } from './not-found/not-found.component'; import {DashboardComponent} from './dashboard/dashboard.component'; diff --git a/src/app/app.module.ts b/src/app/app.module.ts index a929bc4..8564957 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -14,10 +14,8 @@ import {DashboardModule} from './dashboard/dashboard.module'; @NgModule({ declarations: [ AppComponent, - FooterComponent, HeaderComponent, - - + FooterComponent, NotFoundComponent, ImpressumComponent, ], @@ -25,9 +23,8 @@ import {DashboardModule} from './dashboard/dashboard.module'; BrowserModule, BrowserAnimationsModule, AppMaterialModule, - - AppRoutingModule, DashboardModule, + AppRoutingModule, ], bootstrap: [AppComponent], diff --git a/src/app/dashboard/dashboard-routing-module.ts b/src/app/dashboard/dashboard-routing-module.ts new file mode 100644 index 0000000..e69de29 From 1613554a8639c0229d29a5698df35b46f49de0c3 Mon Sep 17 00:00:00 2001 From: bisbaldi Date: Wed, 17 Jan 2018 15:59:01 +0100 Subject: [PATCH 48/50] Add charts component --- src/app/dashboard/charts/charts.component.css | 0 .../dashboard/charts/charts.component.html | 3 +++ .../dashboard/charts/charts.component.spec.ts | 25 +++++++++++++++++++ src/app/dashboard/charts/charts.component.ts | 15 +++++++++++ 4 files changed, 43 insertions(+) create mode 100644 src/app/dashboard/charts/charts.component.css create mode 100644 src/app/dashboard/charts/charts.component.html create mode 100644 src/app/dashboard/charts/charts.component.spec.ts create mode 100644 src/app/dashboard/charts/charts.component.ts diff --git a/src/app/dashboard/charts/charts.component.css b/src/app/dashboard/charts/charts.component.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/dashboard/charts/charts.component.html b/src/app/dashboard/charts/charts.component.html new file mode 100644 index 0000000..4e49ef6 --- /dev/null +++ b/src/app/dashboard/charts/charts.component.html @@ -0,0 +1,3 @@ +

+ charts works! +

diff --git a/src/app/dashboard/charts/charts.component.spec.ts b/src/app/dashboard/charts/charts.component.spec.ts new file mode 100644 index 0000000..ff11619 --- /dev/null +++ b/src/app/dashboard/charts/charts.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ChartsComponent } from './charts.component'; + +describe('ChartsComponent', () => { + let component: ChartsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ChartsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ChartsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/dashboard/charts/charts.component.ts b/src/app/dashboard/charts/charts.component.ts new file mode 100644 index 0000000..76e6459 --- /dev/null +++ b/src/app/dashboard/charts/charts.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-charts', + templateUrl: './charts.component.html', + styleUrls: ['./charts.component.css'] +}) +export class ChartsComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} From 19851e0926f24d0ee798e5524d7c7bd31d3a48e2 Mon Sep 17 00:00:00 2001 From: bisbaldi Date: Wed, 17 Jan 2018 21:31:18 +0100 Subject: [PATCH 49/50] Add child routes for dashboard component --- src/app/dashboard/dashboard-routing-module.ts | 27 +++++++++++++++++++ src/app/dashboard/dashboard.component.html | 12 ++++----- src/app/dashboard/dashboard.module.ts | 4 +++ 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/src/app/dashboard/dashboard-routing-module.ts b/src/app/dashboard/dashboard-routing-module.ts index e69de29..cfcef5e 100644 --- a/src/app/dashboard/dashboard-routing-module.ts +++ b/src/app/dashboard/dashboard-routing-module.ts @@ -0,0 +1,27 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { RouterModule } from '@angular/router'; +import {DashboardComponent} from './dashboard.component'; +import {FormComponent} from './form/form.component'; +import {ChartsComponent} from './charts/charts.component'; + +export const appRoutes = [ + { path: 'dashboard', + component: DashboardComponent, + children: [ + {path: '', component: FormComponent}, + {path: 'charts', component: ChartsComponent} + ]}, +]; + +@NgModule({ + imports: [ + CommonModule, + RouterModule.forRoot(appRoutes) + ], + declarations: [], + exports: [ + RouterModule + ] +}) +export class DashboardRoutingModule { } diff --git a/src/app/dashboard/dashboard.component.html b/src/app/dashboard/dashboard.component.html index 1025e66..1954e8f 100644 --- a/src/app/dashboard/dashboard.component.html +++ b/src/app/dashboard/dashboard.component.html @@ -28,11 +28,11 @@ Private
- -
-
- -
+ +
+
+ +
@@ -43,4 +43,4 @@ Update Data
- + diff --git a/src/app/dashboard/dashboard.module.ts b/src/app/dashboard/dashboard.module.ts index b9d6201..eca1c2c 100644 --- a/src/app/dashboard/dashboard.module.ts +++ b/src/app/dashboard/dashboard.module.ts @@ -12,6 +12,8 @@ import {BarchartComponent} from './charts/barchart/barchart.component'; import {LinechartComponent} from './charts/linechart/linechart.component'; import {ChartsModule} from 'ng2-charts'; import {HttpClientModule} from '@angular/common/http'; +import {DashboardRoutingModule} from './dashboard-routing-module'; +import {ChartsComponent} from './charts/charts.component'; @NgModule({ imports: [ @@ -21,6 +23,7 @@ import {HttpClientModule} from '@angular/common/http'; ReactiveFormsModule, ChartsModule, HttpClientModule, + DashboardRoutingModule ], declarations: [ @@ -32,6 +35,7 @@ import {HttpClientModule} from '@angular/common/http'; PrivateChartsComponent, BarchartComponent, LinechartComponent, + ChartsComponent ], providers: [HttpClientModule, DatePipe], From 8672b08607e01bdea74fd46135035aabd3ac13a9 Mon Sep 17 00:00:00 2001 From: bisbaldi Date: Mon, 22 Jan 2018 15:38:20 +0100 Subject: [PATCH 50/50] Define form submit action in form component to get rid off form errors --- src/app/app.module.ts | 6 ++--- src/app/dashboard/charts/charts.component.css | 0 .../dashboard/charts/charts.component.html | 3 --- .../dashboard/charts/charts.component.spec.ts | 25 ----------------- src/app/dashboard/charts/charts.component.ts | 15 ----------- src/app/dashboard/dashboard-routing-module.ts | 27 ------------------- src/app/dashboard/dashboard.component.html | 1 - src/app/dashboard/dashboard.module.ts | 6 +---- src/app/dashboard/form/form.component.html | 4 +-- 9 files changed, 6 insertions(+), 81 deletions(-) delete mode 100644 src/app/dashboard/charts/charts.component.css delete mode 100644 src/app/dashboard/charts/charts.component.html delete mode 100644 src/app/dashboard/charts/charts.component.spec.ts delete mode 100644 src/app/dashboard/charts/charts.component.ts delete mode 100644 src/app/dashboard/dashboard-routing-module.ts diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 8564957..0733e12 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -1,6 +1,6 @@ import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; -import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { AppComponent } from './app.component'; import { FooterComponent } from './menu/footer/footer.component'; @@ -8,8 +8,8 @@ import { HeaderComponent } from './menu/header/header.component'; import { NotFoundComponent } from './not-found/not-found.component'; import { AppRoutingModule } from './app-routing-module'; import { ImpressumComponent } from './impressum/impressum.component'; -import {AppMaterialModule} from './app-material.module'; -import {DashboardModule} from './dashboard/dashboard.module'; +import { AppMaterialModule } from './app-material.module'; +import { DashboardModule } from './dashboard/dashboard.module'; @NgModule({ declarations: [ diff --git a/src/app/dashboard/charts/charts.component.css b/src/app/dashboard/charts/charts.component.css deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/dashboard/charts/charts.component.html b/src/app/dashboard/charts/charts.component.html deleted file mode 100644 index 4e49ef6..0000000 --- a/src/app/dashboard/charts/charts.component.html +++ /dev/null @@ -1,3 +0,0 @@ -

- charts works! -

diff --git a/src/app/dashboard/charts/charts.component.spec.ts b/src/app/dashboard/charts/charts.component.spec.ts deleted file mode 100644 index ff11619..0000000 --- a/src/app/dashboard/charts/charts.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { ChartsComponent } from './charts.component'; - -describe('ChartsComponent', () => { - let component: ChartsComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ChartsComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ChartsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/dashboard/charts/charts.component.ts b/src/app/dashboard/charts/charts.component.ts deleted file mode 100644 index 76e6459..0000000 --- a/src/app/dashboard/charts/charts.component.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'app-charts', - templateUrl: './charts.component.html', - styleUrls: ['./charts.component.css'] -}) -export class ChartsComponent implements OnInit { - - constructor() { } - - ngOnInit() { - } - -} diff --git a/src/app/dashboard/dashboard-routing-module.ts b/src/app/dashboard/dashboard-routing-module.ts deleted file mode 100644 index cfcef5e..0000000 --- a/src/app/dashboard/dashboard-routing-module.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { RouterModule } from '@angular/router'; -import {DashboardComponent} from './dashboard.component'; -import {FormComponent} from './form/form.component'; -import {ChartsComponent} from './charts/charts.component'; - -export const appRoutes = [ - { path: 'dashboard', - component: DashboardComponent, - children: [ - {path: '', component: FormComponent}, - {path: 'charts', component: ChartsComponent} - ]}, -]; - -@NgModule({ - imports: [ - CommonModule, - RouterModule.forRoot(appRoutes) - ], - declarations: [], - exports: [ - RouterModule - ] -}) -export class DashboardRoutingModule { } diff --git a/src/app/dashboard/dashboard.component.html b/src/app/dashboard/dashboard.component.html index 1954e8f..4831dab 100644 --- a/src/app/dashboard/dashboard.component.html +++ b/src/app/dashboard/dashboard.component.html @@ -43,4 +43,3 @@ Update Data - diff --git a/src/app/dashboard/dashboard.module.ts b/src/app/dashboard/dashboard.module.ts index eca1c2c..e45ea03 100644 --- a/src/app/dashboard/dashboard.module.ts +++ b/src/app/dashboard/dashboard.module.ts @@ -12,8 +12,6 @@ import {BarchartComponent} from './charts/barchart/barchart.component'; import {LinechartComponent} from './charts/linechart/linechart.component'; import {ChartsModule} from 'ng2-charts'; import {HttpClientModule} from '@angular/common/http'; -import {DashboardRoutingModule} from './dashboard-routing-module'; -import {ChartsComponent} from './charts/charts.component'; @NgModule({ imports: [ @@ -23,7 +21,6 @@ import {ChartsComponent} from './charts/charts.component'; ReactiveFormsModule, ChartsModule, HttpClientModule, - DashboardRoutingModule ], declarations: [ @@ -34,8 +31,7 @@ import {ChartsComponent} from './charts/charts.component'; PublicChartsComponent, PrivateChartsComponent, BarchartComponent, - LinechartComponent, - ChartsComponent + LinechartComponent ], providers: [HttpClientModule, DatePipe], diff --git a/src/app/dashboard/form/form.component.html b/src/app/dashboard/form/form.component.html index c1ba92f..e9d4543 100644 --- a/src/app/dashboard/form/form.component.html +++ b/src/app/dashboard/form/form.component.html @@ -3,7 +3,7 @@ Choose Blockchain -
+

Define Network Type

Public @@ -51,7 +51,7 @@

Define Time Span

-