From a2328d41b38afff0304e03b37ddcae76ac4b4b0b Mon Sep 17 00:00:00 2001 From: Aashil Date: Fri, 26 Aug 2016 17:34:08 -0400 Subject: [PATCH 1/3] Add router to the stackbot so that we can navigate more efficiently. * app.routing.ts -> holds the routing config and path data. * integrations.component.ts, integrations.component.html -> new component to store the integrations * Add code to implement routing in app.module.ts --- default/src/app/app.component.html | 8 ++++++-- default/src/app/app.module.ts | 10 +++++++++- default/src/app/app.routing.ts | 15 +++++++++++++++ default/src/app/integrations.component.html | 1 + default/src/app/integrations.component.ts | 7 +++++++ default/src/index.html | 1 + 6 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 default/src/app/app.routing.ts create mode 100644 default/src/app/integrations.component.html create mode 100644 default/src/app/integrations.component.ts diff --git a/default/src/app/app.component.html b/default/src/app/app.component.html index edc57bb..7f4a061 100644 --- a/default/src/app/app.component.html +++ b/default/src/app/app.component.html @@ -4,7 +4,11 @@

Stackbot

- - + + Report
+ Integrations
+ + +
diff --git a/default/src/app/app.module.ts b/default/src/app/app.module.ts index 396183c..1e380be 100644 --- a/default/src/app/app.module.ts +++ b/default/src/app/app.module.ts @@ -4,6 +4,11 @@ import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { AngularFireModule, AuthProviders, AuthMethods } from 'angularfire2'; +import { + LocationStrategy, + HashLocationStrategy +} from '@angular/common'; + import { HTTP_PROVIDERS } from '@angular/http'; import { AUTH_PROVIDERS } from 'angular2-jwt'; import { FocusMeDirective } from './shared/focus-me.directive'; @@ -16,7 +21,9 @@ import { ReportComponent } from './report/index'; import { AuthService, AuthButtonComponent, AuthIntegrationsComponent } from './auth/index'; import { SearchComponent } from './search/index'; -// DO NOT DELETE: This is needed or the compiler says, Cannot find namespace 'firebase'. +import { routing, appRoutingProviders } from './app.routing'; + +// DO NOT DELETE: This is needed of the compiler says, Cannot find namespace 'firebase'. /* tslint:disable */ import * as firebase from 'firebase'; /* tslint:enable */ @@ -59,6 +66,7 @@ let imports = [ FormsModule, CommonModule, BrowserModule, + routing ]; diff --git a/default/src/app/app.routing.ts b/default/src/app/app.routing.ts new file mode 100644 index 0000000..91325b4 --- /dev/null +++ b/default/src/app/app.routing.ts @@ -0,0 +1,15 @@ +import { Routes, RouterModule } from '@angular/router'; +import {IntegrationsComponent} from './integrations.component'; +import { ReportComponent} from './report/index'; + +const appRoutes: Routes = [ + { path: 'report', component: ReportComponent }, + { path: 'integrations', component: IntegrationsComponent }, + { path: '', component: IntegrationsComponent }, +]; + +export const appRoutingProviders: any[] = [ + +]; + +export const routing = RouterModule.forRoot(appRoutes); diff --git a/default/src/app/integrations.component.html b/default/src/app/integrations.component.html new file mode 100644 index 0000000..1098323 --- /dev/null +++ b/default/src/app/integrations.component.html @@ -0,0 +1 @@ +

This is integrations page

\ No newline at end of file diff --git a/default/src/app/integrations.component.ts b/default/src/app/integrations.component.ts new file mode 100644 index 0000000..96017b8 --- /dev/null +++ b/default/src/app/integrations.component.ts @@ -0,0 +1,7 @@ +import { Component } from '@angular/core'; + +@Component({ + templateUrl: 'integrations.component.html' +}) + +export class IntegrationsComponent { } diff --git a/default/src/index.html b/default/src/index.html index bded6e9..cbc9c7c 100644 --- a/default/src/index.html +++ b/default/src/index.html @@ -1,6 +1,7 @@ + Stackbot From 7ebcb4a91aa15965bf83ffe229cbc1462770ba54 Mon Sep 17 00:00:00 2001 From: Aashil Date: Fri, 26 Aug 2016 17:36:55 -0400 Subject: [PATCH 2/3] Use LocationStrategy and HashLocationStrategy to use hashes in the url. * This is needed so that we don't have to mention each route in the GAE's app.yaml --- default/src/app/app.module.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/default/src/app/app.module.ts b/default/src/app/app.module.ts index 1e380be..f557ee0 100644 --- a/default/src/app/app.module.ts +++ b/default/src/app/app.module.ts @@ -49,6 +49,8 @@ let providers = [ HTTP_PROVIDERS, AuthService, BackendService, + appRoutingProviders, + {provide: LocationStrategy, useClass: HashLocationStrategy} ]; let declarations = [ From 6e12693c83e565f83962e1418ff12dd89e3f9a00 Mon Sep 17 00:00:00 2001 From: Aashil Date: Fri, 26 Aug 2016 17:39:49 -0400 Subject: [PATCH 3/3] PROD-253: Fixme * The report data is displayed when a user logs in. * TODO: The table data doesn't get removed when a user logs out. --- default/src/app/report/report.component.html | 1 + 1 file changed, 1 insertion(+) diff --git a/default/src/app/report/report.component.html b/default/src/app/report/report.component.html index 7e9eb2c..b038e44 100644 --- a/default/src/app/report/report.component.html +++ b/default/src/app/report/report.component.html @@ -1,4 +1,5 @@
+

Report