From 59bea0e3653ee7e026d2e700d4b118b5d92dbda7 Mon Sep 17 00:00:00 2001 From: Steven Zou Date: Tue, 21 Feb 2017 14:04:15 +0800 Subject: [PATCH 1/2] implement harbor shell related things with authorization support --- harbor-app/src/app/account/account.module.ts | 13 +++-- .../account/forgot-password.component.html | 0 .../app/account/forgot-password.component.ts | 10 ---- .../app/account/reset-password.component.html | 0 .../app/account/reset-password.component.ts | 10 ---- .../app/account/sign-in/sign-in.component.ts | 15 +++--- .../src/app/account/sign-up.component.html | 1 - .../src/app/account/sign-up.component.ts | 10 ---- harbor-app/src/app/app.module.ts | 8 ++- .../account-settings-modal.component.html | 2 +- .../src/app/base/base-routing.module.ts | 21 ++++++-- .../harbor-shell/harbor-shell.component.html | 5 +- .../harbor-shell/harbor-shell.component.ts | 37 +++++++++---- .../base/navigator/navigator.component.html | 13 +++-- .../app/base/navigator/navigator.component.ts | 53 +++++++++++++++++-- harbor-app/src/app/harbor-routing.module.ts | 11 +++- .../src/app/project/project-routing.module.ts | 31 ++++++++--- harbor-app/src/app/shared/session.service.ts | 34 +++++++++--- harbor-app/src/app/shared/shared.module.ts | 5 +- 19 files changed, 190 insertions(+), 89 deletions(-) delete mode 100644 harbor-app/src/app/account/forgot-password.component.html delete mode 100644 harbor-app/src/app/account/forgot-password.component.ts delete mode 100644 harbor-app/src/app/account/reset-password.component.html delete mode 100644 harbor-app/src/app/account/reset-password.component.ts delete mode 100644 harbor-app/src/app/account/sign-up.component.html delete mode 100644 harbor-app/src/app/account/sign-up.component.ts diff --git a/harbor-app/src/app/account/account.module.ts b/harbor-app/src/app/account/account.module.ts index 7ace60143..218981c9c 100644 --- a/harbor-app/src/app/account/account.module.ts +++ b/harbor-app/src/app/account/account.module.ts @@ -1,15 +1,20 @@ import { NgModule } from '@angular/core'; -import { SharedModule } from '../shared/shared.module'; import { RouterModule } from '@angular/router'; +import { CoreModule } from '../core/core.module'; import { SignInComponent } from './sign-in/sign-in.component'; +import { PasswordSettingComponent } from './password/password-setting.component'; + +import { PasswordSettingService } from './password/password-setting.service'; @NgModule({ imports: [ - SharedModule, + CoreModule, RouterModule ], - declarations: [SignInComponent], - exports: [SignInComponent] + declarations: [SignInComponent, PasswordSettingComponent], + exports: [SignInComponent, PasswordSettingComponent], + + providers: [PasswordSettingService] }) export class AccountModule { } \ No newline at end of file diff --git a/harbor-app/src/app/account/forgot-password.component.html b/harbor-app/src/app/account/forgot-password.component.html deleted file mode 100644 index e69de29bb..000000000 diff --git a/harbor-app/src/app/account/forgot-password.component.ts b/harbor-app/src/app/account/forgot-password.component.ts deleted file mode 100644 index 307b4ec3e..000000000 --- a/harbor-app/src/app/account/forgot-password.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Component } from '@angular/core'; -import { Router } from '@angular/router'; - -@Component({ - selector: 'forgot-password', - templateUrl: "forgot-password.component.html" -}) -export class ForgotPasswordComponent { - // constructor(private router: Router){} -} \ No newline at end of file diff --git a/harbor-app/src/app/account/reset-password.component.html b/harbor-app/src/app/account/reset-password.component.html deleted file mode 100644 index e69de29bb..000000000 diff --git a/harbor-app/src/app/account/reset-password.component.ts b/harbor-app/src/app/account/reset-password.component.ts deleted file mode 100644 index 868dcd35a..000000000 --- a/harbor-app/src/app/account/reset-password.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Component } from '@angular/core'; -import { Router } from '@angular/router'; - -@Component({ - selector: 'reset-password', - templateUrl: "reset-password.component.html" -}) -export class ResetPasswordComponent { - // constructor(private router: Router){} -} \ No newline at end of file diff --git a/harbor-app/src/app/account/sign-in/sign-in.component.ts b/harbor-app/src/app/account/sign-in/sign-in.component.ts index 8c33029d4..848a75337 100644 --- a/harbor-app/src/app/account/sign-in/sign-in.component.ts +++ b/harbor-app/src/app/account/sign-in/sign-in.component.ts @@ -97,8 +97,7 @@ export class SignInComponent implements AfterViewChecked { //Trigger the signin action signIn(): void { //Should validate input firstly - if (!this.validate()) { - console.info("return"); + if (!this.validate() || this.signInStatus === signInStatusOnGoing) { return; } @@ -113,14 +112,18 @@ export class SignInComponent implements AfterViewChecked { //Validate the sign-in session this.session.retrieveUser() - .then(() => { + .then(user => { //Routing to the right location - let nextRoute = ["/harbor", "dashboard"]; + let nextRoute = ["/harbor", "projects"]; this.router.navigate(nextRoute); }) - .catch(this.handleError); + .catch(error => { + this.handleError(error); + }); }) - .catch(this.handleError); + .catch(error => { + this.handleError(error); + }); } //Help user navigate to the sign up diff --git a/harbor-app/src/app/account/sign-up.component.html b/harbor-app/src/app/account/sign-up.component.html deleted file mode 100644 index fae4c1f44..000000000 --- a/harbor-app/src/app/account/sign-up.component.html +++ /dev/null @@ -1 +0,0 @@ -

Placeholder for signup

\ No newline at end of file diff --git a/harbor-app/src/app/account/sign-up.component.ts b/harbor-app/src/app/account/sign-up.component.ts deleted file mode 100644 index 3d97950fa..000000000 --- a/harbor-app/src/app/account/sign-up.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Component } from '@angular/core'; -import { Router } from '@angular/router'; - -@Component({ - selector: 'sign-up', - templateUrl: "sign-up.component.html" -}) -export class SignUpComponent { - // constructor(private router: Router){} -} \ No newline at end of file diff --git a/harbor-app/src/app/app.module.ts b/harbor-app/src/app/app.module.ts index c7991e8d2..71f96e112 100644 --- a/harbor-app/src/app/app.module.ts +++ b/harbor-app/src/app/app.module.ts @@ -4,25 +4,23 @@ import { FormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; import { ClarityModule } from 'clarity-angular'; import { AppComponent } from './app.component'; -import { AccountModule } from './account/account.module'; import { BaseModule } from './base/base.module'; import { HarborRoutingModule } from './harbor-routing.module'; -import { CoreModule } from './core/core.module'; +import { SharedModule } from './shared/shared.module'; @NgModule({ declarations: [ AppComponent, ], imports: [ - CoreModule, - AccountModule, + SharedModule, BaseModule, HarborRoutingModule ], providers: [], - bootstrap: [ AppComponent ] + bootstrap: [AppComponent] }) export class AppModule { } diff --git a/harbor-app/src/app/base/account-settings/account-settings-modal.component.html b/harbor-app/src/app/base/account-settings/account-settings-modal.component.html index fff3ba84e..de47a471b 100644 --- a/harbor-app/src/app/base/account-settings/account-settings-modal.component.html +++ b/harbor-app/src/app/base/account-settings/account-settings-modal.component.html @@ -1,4 +1,4 @@ - +