Refine the related menu

This commit is contained in:
Steven Zou 2017-02-22 17:50:46 +08:00
parent a97e00f251
commit 495a3150d3
12 changed files with 23 additions and 47 deletions

View File

@ -21,7 +21,7 @@
<div class="form-group"> <div class="form-group">
<label for="account_settings_full_name" class="col-md-4 required">Full name</label> <label for="account_settings_full_name" class="col-md-4 required">Full name</label>
<label for="account_settings_email" aria-haspopup="true" role="tooltip" class="tooltip tooltip-validation tooltip-md tooltip-bottom-right" [class.invalid]="fullNameInput.invalid && (fullNameInput.dirty || fullNameInput.touched)"> <label for="account_settings_email" aria-haspopup="true" role="tooltip" class="tooltip tooltip-validation tooltip-md tooltip-bottom-right" [class.invalid]="fullNameInput.invalid && (fullNameInput.dirty || fullNameInput.touched)">
<input type="text" name="account_settings_full_name" #fullNameInput="ngModel" [(ngModel)]="account.realname" required maxLength="20" maxLengthExt="20" id="account_settings_full_name" size="48"> <input type="text" name="account_settings_full_name" #fullNameInput="ngModel" [(ngModel)]="account.realname" required maxLengthExt="20" id="account_settings_full_name" size="48">
<span class="tooltip-content"> <span class="tooltip-content">
Max length of full name is 20 Max length of full name is 20
</span> </span>
@ -36,7 +36,7 @@
<clr-alert [clrAlertType]="'alert-danger'" [clrAlertClosable]="true" [hidden]='errorMessage === ""'> <clr-alert [clrAlertType]="'alert-danger'" [clrAlertClosable]="true" [hidden]='errorMessage === ""'>
<div class="alert-item"> <div class="alert-item">
<span class="alert-text"> <span class="alert-text">
This alert indicates success. {{errorMessage}}
</span> </span>
</div> </div>
</clr-alert> </clr-alert>

View File

@ -5,13 +5,15 @@ import { CoreModule } from '../core/core.module';
import { SignInComponent } from './sign-in/sign-in.component'; import { SignInComponent } from './sign-in/sign-in.component';
import { PasswordSettingComponent } from './password/password-setting.component'; import { PasswordSettingComponent } from './password/password-setting.component';
import { AccountSettingsModalComponent } from './account-settings/account-settings-modal.component'; import { AccountSettingsModalComponent } from './account-settings/account-settings-modal.component';
import { SharedModule } from '../shared/shared.module';
import { PasswordSettingService } from './password/password-setting.service'; import { PasswordSettingService } from './password/password-setting.service';
@NgModule({ @NgModule({
imports: [ imports: [
CoreModule, CoreModule,
RouterModule RouterModule,
SharedModule
], ],
declarations: [SignInComponent, PasswordSettingComponent, AccountSettingsModalComponent], declarations: [SignInComponent, PasswordSettingComponent, AccountSettingsModalComponent],
exports: [SignInComponent, PasswordSettingComponent, AccountSettingsModalComponent], exports: [SignInComponent, PasswordSettingComponent, AccountSettingsModalComponent],

View File

@ -1,4 +1,4 @@
import { Component, ViewChild, AfterViewChecked, Output, EventEmitter } from '@angular/core'; import { Component, ViewChild, AfterViewChecked } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { NgForm } from '@angular/forms'; import { NgForm } from '@angular/forms';
@ -20,9 +20,6 @@ export class PasswordSettingComponent implements AfterViewChecked {
pwdFormRef: NgForm; pwdFormRef: NgForm;
@ViewChild("changepwdForm") pwdForm: NgForm; @ViewChild("changepwdForm") pwdForm: NgForm;
@Output() private pwdChange = new EventEmitter<any>();
constructor(private passwordService: PasswordSettingService, private session: SessionService){} constructor(private passwordService: PasswordSettingService, private session: SessionService){}
//If form is valid //If form is valid
@ -90,9 +87,6 @@ export class PasswordSettingComponent implements AfterViewChecked {
}) })
.then(() => { .then(() => {
this.onCalling = false; this.onCalling = false;
//Tell shell to reset current view
this.pwdChange.emit(true);
this.close(); this.close();
}) })
.catch(error => { .catch(error => {

View File

@ -31,8 +31,7 @@
<div [class.visibility-hidden]="signInStatus != statusError" class="error active"> <div [class.visibility-hidden]="signInStatus != statusError" class="error active">
Invalid user name or password Invalid user name or password
</div> </div>
<button [class.visibility-hidden]="signInStatus === statusOnGoing" [disabled]="signInStatus === statusOnGoing" type="submit" class="btn btn-primary" (click)="signIn()">LOG IN</button> <button [disabled]="signInStatus === statusOnGoing" type="submit" class="btn btn-primary" (click)="signIn()">LOG IN</button>
<div [class.visibility-hidden]="signInStatus != statusOnGoing" class="progress loop progress-size-small"><progress></progress></div>
<a href="javascript:void(0)" class="signup" (click)="signUp()">Sign up for an account</a> <a href="javascript:void(0)" class="signup" (click)="signUp()">Sign up for an account</a>
</div> </div>
</form> </form>

View File

@ -6,9 +6,9 @@ import { ClarityModule } from 'clarity-angular';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { BaseModule } from './base/base.module'; import { BaseModule } from './base/base.module';
import { HarborRoutingModule } from './harbor-routing.module'; import { HarborRoutingModule } from './harbor-routing.module';
import { SharedModule } from './shared/shared.module'; import { SharedModule } from './shared/shared.module';
import { AccountModule } from './account/account.module';
@NgModule({ @NgModule({
declarations: [ declarations: [
@ -17,6 +17,7 @@ import { SharedModule } from './shared/shared.module';
imports: [ imports: [
SharedModule, SharedModule,
BaseModule, BaseModule,
AccountModule,
HarborRoutingModule HarborRoutingModule
], ],
providers: [], providers: [],

View File

@ -4,6 +4,7 @@ import { SharedModule } from '../shared/shared.module';
import { DashboardModule } from '../dashboard/dashboard.module'; import { DashboardModule } from '../dashboard/dashboard.module';
import { ProjectModule } from '../project/project.module'; import { ProjectModule } from '../project/project.module';
import { UserModule } from '../user/user.module'; import { UserModule } from '../user/user.module';
import { AccountModule } from '../account/account.module';
import { NavigatorComponent } from './navigator/navigator.component'; import { NavigatorComponent } from './navigator/navigator.component';
import { GlobalSearchComponent } from './global-search/global-search.component'; import { GlobalSearchComponent } from './global-search/global-search.component';
@ -19,7 +20,8 @@ import { BaseRoutingModule } from './base-routing.module';
DashboardModule, DashboardModule,
ProjectModule, ProjectModule,
UserModule, UserModule,
BaseRoutingModule BaseRoutingModule,
AccountModule
], ],
declarations: [ declarations: [
NavigatorComponent, NavigatorComponent,

View File

@ -27,4 +27,4 @@
</div> </div>
</clr-main-container> </clr-main-container>
<account-settings-modal></account-settings-modal> <account-settings-modal></account-settings-modal>
<password-setting (pwdChange)="watchPwdChange($event)"></password-setting> <password-setting></password-setting>

View File

@ -77,11 +77,4 @@ export class HarborShellComponent implements OnInit {
this.isSearchResultsOpened = false; this.isSearchResultsOpened = false;
} }
} }
//Watch password whether changed
watchPwdChange(event: any): void {
if (event) {
this.navigator.logOut(true);
}
}
} }

View File

@ -19,10 +19,11 @@
<clr-icon shape="caret down"></clr-icon> <clr-icon shape="caret down"></clr-icon>
</button> </button>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a href="javascript:void(0)" clrDropdownItem (click)="openAccountSettingsModal()">Account Settings</a> <a href="javascript:void(0)" clrDropdownItem (click)="openAccountSettingsModal()">User Profile</a>
<a href="javascript:void(0)" clrDropdownItem (click)="openChangePwdModal()">Change Password</a> <a href="javascript:void(0)" clrDropdownItem (click)="openChangePwdModal()">Change Password</a>
<a href="javascript:void(0)" clrDropdownItem>About</a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a href="javascript:void(0)" clrDropdownItem (click)="logOut(false)">Log out</a> <a href="javascript:void(0)" clrDropdownItem (click)="logOut()">Log out</a>
</div> </div>
</clr-dropdown> </clr-dropdown>
<clr-dropdown class="dropdown bottom-left"> <clr-dropdown class="dropdown bottom-left">
@ -37,16 +38,5 @@
<a href="javascript:void(0)" clrDropdownItem>中文繁體</a> <a href="javascript:void(0)" clrDropdownItem>中文繁體</a>
</div> </div>
</clr-dropdown> </clr-dropdown>
<clr-dropdown class="dropdown bottom-right">
<button class="nav-icon" clrDropdownToggle>
<clr-icon shape="cog"></clr-icon>
<clr-icon shape="caret down"></clr-icon>
</button>
<div class="dropdown-menu">
<a href="javascript:void(0)" clrDropdownItem>Preferences</a>
<a href="javascript:void(0)" clrDropdownItem>Add User</a>
<a href="javascript:void(0)" clrDropdownItem>About</a>
</div>
</clr-dropdown>
</div> </div>
</clr-header> </clr-header>

View File

@ -54,17 +54,12 @@ export class NavigatorComponent implements OnInit {
} }
//Log out system //Log out system
logOut(reSignIn: boolean): void { logOut(): void {
this.session.signOff() this.session.signOff()
.then(() => { .then(() => {
this.sessionUser = null; this.sessionUser = null;
if (reSignIn) { //Naviagte to the sign in route
//Naviagte to the sign in route this.router.navigate(["/sign-in"]);
this.router.navigate(["/sign-in"]);
} else {
//Naviagte to the default route
this.router.navigate(["/harbor"]);
}
}) })
.catch()//TODO: .catch()//TODO:
} }

View File

@ -16,7 +16,7 @@ export function maxLengthExtValidator(length: number): ValidatorFn {
for (var i = 0; i < len; i++) { for (var i = 0; i < len; i++) {
if (regExp.test(value[i])) { if (regExp.test(value[i])) {
count += 2; count += 3;
} else { } else {
count++; count++;
} }

View File

@ -1,6 +1,6 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { CoreModule } from '../core/core.module'; import { CoreModule } from '../core/core.module';
import { AccountModule } from '../account/account.module'; //import { AccountModule } from '../account/account.module';
import { SessionService } from '../shared/session.service'; import { SessionService } from '../shared/session.service';
import { MessageComponent } from '../global-message/message.component'; import { MessageComponent } from '../global-message/message.component';
@ -10,7 +10,7 @@ import { MaxLengthExtValidatorDirective } from './max-length-ext.directive';
@NgModule({ @NgModule({
imports: [ imports: [
CoreModule, CoreModule,
AccountModule //AccountModule
], ],
declarations: [ declarations: [
MessageComponent, MessageComponent,
@ -18,7 +18,7 @@ import { MaxLengthExtValidatorDirective } from './max-length-ext.directive';
], ],
exports: [ exports: [
CoreModule, CoreModule,
AccountModule, // AccountModule,
MessageComponent, MessageComponent,
MaxLengthExtValidatorDirective MaxLengthExtValidatorDirective
], ],