Skip to content

Commit

Permalink
Merge ebdb17d into 62ff2d3
Browse files Browse the repository at this point in the history
  • Loading branch information
atarix83 committed Apr 4, 2018
2 parents 62ff2d3 + ebdb17d commit afe4833
Show file tree
Hide file tree
Showing 87 changed files with 2,929 additions and 86 deletions.
3 changes: 3 additions & 0 deletions package.json
Expand Up @@ -98,8 +98,10 @@
"font-awesome": "4.7.0",
"http-server": "0.11.1",
"https": "1.0.0",
"js-cookie": "2.2.0",
"js.clone": "0.0.3",
"jsonschema": "1.2.2",
"jwt-decode": "^2.2.0",
"methods": "1.1.2",
"morgan": "1.9.0",
"ngx-pagination": "3.0.3",
Expand All @@ -122,6 +124,7 @@
"@types/express-serve-static-core": "4.11.1",
"@types/hammerjs": "2.0.35",
"@types/jasmine": "^2.8.6",
"@types/js-cookie": "2.1.0",
"@types/memory-cache": "0.2.0",
"@types/mime": "2.0.0",
"@types/node": "^9.4.6",
Expand Down
30 changes: 29 additions & 1 deletion resources/i18n/en.json
Expand Up @@ -46,7 +46,9 @@
}
},
"nav": {
"home": "Home"
"home": "Home",
"login": "Log In",
"logout": "Log Out"
},
"pagination": {
"results-per-page": "Results Per Page",
Expand Down Expand Up @@ -145,5 +147,31 @@
"item": "Error fetching item",
"objects": "Error fetching objects",
"search-results": "Error fetching search results"
},
"login": {
"title": "Login",
"form": {
"header": "Please log in to DSpace",
"email": "Email address",
"forgot-password": "Have you forgotten your password?",
"new-user": "New user? Click here to register.",
"password": "Password",
"submit": "Log in"
}
},
"logout": {
"title": "Logout",
"form": {
"header": "Log out from DSpace",
"submit": "Log out"
}
},
"auth": {
"messages": {
"expired": "Your session has expired. Please log in again."
},
"errors": {
"invalid-user": "Invalid email or password."
}
}
}
1 change: 0 additions & 1 deletion src/app/+home-page/home-page.component.ts
Expand Up @@ -6,5 +6,4 @@ import { Component } from '@angular/core';
templateUrl: './home-page.component.html'
})
export class HomePageComponent {

}
13 changes: 13 additions & 0 deletions src/app/+login-page/login-page-routing.module.ts
@@ -0,0 +1,13 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';

import { LoginPageComponent } from './login-page.component';

@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: LoginPageComponent, data: { title: 'login.title' } }
])
]
})
export class LoginPageRoutingModule { }
5 changes: 5 additions & 0 deletions src/app/+login-page/login-page.component.html
@@ -0,0 +1,5 @@
<div class="text-center mt-5">
<img class="mb-4" src="assets/images/dspace-logo.png" alt="" width="72" height="72">
<h1 class="h3 mb-0 font-weight-normal">{{"login.form.header" | translate}}</h1>
<ds-log-in></ds-log-in>
</div>
Empty file.
21 changes: 21 additions & 0 deletions src/app/+login-page/login-page.component.ts
@@ -0,0 +1,21 @@
import { Component, OnDestroy } from '@angular/core';

import { Store } from '@ngrx/store';

import { AppState } from '../app.reducer';
import { ResetAuthenticationMessagesAction } from '../core/auth/auth.actions';

@Component({
selector: 'ds-login-page',
styleUrls: ['./login-page.component.scss'],
templateUrl: './login-page.component.html'
})
export class LoginPageComponent implements OnDestroy {

constructor(private store: Store<AppState>) {}

ngOnDestroy() {
// Clear all authentication messages when leaving login page
this.store.dispatch(new ResetAuthenticationMessagesAction());
}
}
19 changes: 19 additions & 0 deletions src/app/+login-page/login-page.module.ts
@@ -0,0 +1,19 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { SharedModule } from '../shared/shared.module';
import { LoginPageComponent } from './login-page.component';
import { LoginPageRoutingModule } from './login-page-routing.module';

@NgModule({
imports: [
LoginPageRoutingModule,
CommonModule,
SharedModule,
],
declarations: [
LoginPageComponent
]
})
export class LoginPageModule {

}
19 changes: 19 additions & 0 deletions src/app/+logout-page/logout-page-routing.module.ts
@@ -0,0 +1,19 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';

import { LogoutPageComponent } from './logout-page.component';
import { AuthenticatedGuard } from '../core/auth/authenticated.guard';

@NgModule({
imports: [
RouterModule.forChild([
{
canActivate: [AuthenticatedGuard],
path: '',
component: LogoutPageComponent,
data: { title: 'logout.title' }
}
])
]
})
export class LogoutPageRoutingModule { }
5 changes: 5 additions & 0 deletions src/app/+logout-page/logout-page.component.html
@@ -0,0 +1,5 @@
<div class="text-center mt-5">
<img class="mb-4" src="assets/images/dspace-logo.png" alt="" width="72" height="72">
<h1 class="h3 mb-0 font-weight-normal">{{"logout.form.header" | translate}}</h1>
<ds-log-out></ds-log-out>
</div>
15 changes: 15 additions & 0 deletions src/app/+logout-page/logout-page.component.scss
@@ -0,0 +1,15 @@
.login-container {
height: 100%;
display: -ms-flexbox;
display: -webkit-box;
display: flex;
-ms-flex-align: center;
-ms-flex-pack: center;
-webkit-box-align: center;
align-items: center;
-webkit-box-pack: center;
justify-content: center;
padding-top: 40px;
padding-bottom: 40px;
background-color: #f5f5f5;
}
10 changes: 10 additions & 0 deletions src/app/+logout-page/logout-page.component.ts
@@ -0,0 +1,10 @@
import { Component } from '@angular/core';

@Component({
selector: 'ds-logout-page',
styleUrls: ['./logout-page.component.scss'],
templateUrl: './logout-page.component.html'
})
export class LogoutPageComponent {

}
19 changes: 19 additions & 0 deletions src/app/+logout-page/logout-page.module.ts
@@ -0,0 +1,19 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { SharedModule } from '../shared/shared.module';
import { LogoutPageComponent } from './logout-page.component';
import { LogoutPageRoutingModule } from './logout-page-routing.module';

@NgModule({
imports: [
LogoutPageRoutingModule,
CommonModule,
SharedModule,
],
declarations: [
LogoutPageComponent
]
})
export class LogoutPageModule {

}
Expand Up @@ -6,7 +6,7 @@ import { FacetValue } from '../../search-service/facet-value.model';
import { SearchFilterService } from './search-filter.service';
import { Observable } from 'rxjs/Observable';
import { slide } from '../../../shared/animations/slide';
import { RouteService } from '../../../shared/route.service';
import { RouteService } from '../../../shared/services/route.service';
import { first } from 'rxjs/operator/first';

/**
Expand Down
Expand Up @@ -13,7 +13,7 @@ import {
import { hasValue, } from '../../../shared/empty.util';
import { SearchFilterConfig } from '../../search-service/search-filter-config.model';
import { SearchService } from '../../search-service/search.service';
import { RouteService } from '../../../shared/route.service';
import { RouteService } from '../../../shared/services/route.service';

const filterStateSelector = (state: SearchFiltersState) => state.searchFilter;

Expand Down
2 changes: 1 addition & 1 deletion src/app/+search-page/search-service/search.service.spec.ts
Expand Up @@ -7,7 +7,7 @@ import { Component } from '@angular/core';
import { SearchService } from './search.service';
import { ItemDataService } from './../../core/data/item-data.service';
import { ViewMode } from '../../+search-page/search-options.model';
import { RouteService } from '../../shared/route.service';
import { RouteService } from '../../shared/services/route.service';

@Component({ template: '' })
class DummyComponent { }
Expand Down
2 changes: 1 addition & 1 deletion src/app/+search-page/search-service/search.service.ts
Expand Up @@ -13,7 +13,7 @@ import { PageInfo } from '../../core/shared/page-info.model';
import { hasValue, isNotEmpty } from '../../shared/empty.util';
import { ItemSearchResult } from '../../shared/object-collection/shared/item-search-result.model';
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
import { RouteService } from '../../shared/route.service';
import { RouteService } from '../../shared/services/route.service';
import { SearchOptions } from '../search-options.model';
import { SearchResult } from '../search-result.model';
import { FacetValue } from './facet-value.model';
Expand Down
2 changes: 2 additions & 0 deletions src/app/app-routing.module.ts
Expand Up @@ -12,6 +12,8 @@ import { PageNotFoundComponent } from './pagenotfound/pagenotfound.component';
{ path: 'collections', loadChildren: './+collection-page/collection-page.module#CollectionPageModule' },
{ path: 'items', loadChildren: './+item-page/item-page.module#ItemPageModule' },
{ path: 'search', loadChildren: './+search-page/search-page.module#SearchPageModule' },
{ path: 'login', loadChildren: './+login-page/login-page.module#LoginPageModule' },
{ path: 'logout', loadChildren: './+logout-page/logout-page.module#LogoutPageModule' },
{ path: '**', pathMatch: 'full', component: PageNotFoundComponent },
])
],
Expand Down
5 changes: 4 additions & 1 deletion src/app/app.component.spec.ts
Expand Up @@ -26,10 +26,12 @@ import { HostWindowResizeAction } from './shared/host-window.actions';
import { MetadataService } from './core/metadata/metadata.service';

import { GLOBAL_CONFIG, ENV_CONFIG } from '../config';
import { NativeWindowRef, NativeWindowService } from './shared/window.service';
import { NativeWindowRef, NativeWindowService } from './shared/services/window.service';

import { MockTranslateLoader } from './shared/mocks/mock-translate-loader';
import { MockMetadataService } from './shared/mocks/mock-metadata-service';
import { PlatformServiceStub } from './shared/testing/platform-service-stub';
import { PlatformService } from './shared/services/platform.service';

let comp: AppComponent;
let fixture: ComponentFixture<AppComponent>;
Expand All @@ -56,6 +58,7 @@ describe('App component', () => {
{ provide: GLOBAL_CONFIG, useValue: ENV_CONFIG },
{ provide: NativeWindowService, useValue: new NativeWindowRef() },
{ provide: MetadataService, useValue: new MockMetadataService() },
{ provide: PlatformService, useValue: new PlatformServiceStub() },
AppComponent
],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
Expand Down
14 changes: 12 additions & 2 deletions src/app/app.component.ts
Expand Up @@ -16,7 +16,10 @@ import { GLOBAL_CONFIG, GlobalConfig } from '../config';
import { MetadataService } from './core/metadata/metadata.service';
import { HostWindowResizeAction } from './shared/host-window.actions';
import { HostWindowState } from './shared/host-window.reducer';
import { NativeWindowRef, NativeWindowService } from './shared/window.service';
import { NativeWindowRef, NativeWindowService } from './shared/services/window.service';
import { CheckAuthenticationTokenAction } from './core/auth/auth.actions';
import { isAuthenticated } from './core/auth/selectors';
import { PlatformService } from './shared/services/platform.service';

@Component({
selector: 'ds-app',
Expand All @@ -32,7 +35,8 @@ export class AppComponent implements OnInit {
@Inject(NativeWindowService) private _window: NativeWindowRef,
private translate: TranslateService,
private store: Store<HostWindowState>,
private metadata: MetadataService
private metadata: MetadataService,
private platformService: PlatformService
) {
// this language will be used as a fallback when a translation isn't found in the current language
translate.setDefaultLang('en');
Expand All @@ -51,6 +55,12 @@ export class AppComponent implements OnInit {
const color: string = this.config.production ? 'red' : 'green';
console.info(`Environment: %c${env}`, `color: ${color}; font-weight: bold;`);
this.dispatchWindowSize(this._window.nativeWindow.innerWidth, this._window.nativeWindow.innerHeight);
if (this.platformService.isServer) {
this.store.select(isAuthenticated)
.take(1)
.filter((authenticated) => !authenticated)
.subscribe((authenticated) => this.store.dispatch(new CheckAuthenticationTokenAction()));
}
}

@HostListener('window:resize', ['$event'])
Expand Down
1 change: 1 addition & 0 deletions src/app/app.effects.ts
@@ -1,6 +1,7 @@

import { HeaderEffects } from './header/header.effects';
import { StoreEffects } from './store.effects';
import { AuthEffects } from './core/auth/auth.effects';

export const appEffects = [
StoreEffects,
Expand Down
2 changes: 2 additions & 0 deletions src/app/app.module.ts
Expand Up @@ -29,6 +29,7 @@ import { HeaderComponent } from './header/header.component';
import { PageNotFoundComponent } from './pagenotfound/pagenotfound.component';

import { DSpaceRouterStateSerializer } from './shared/ngrx/dspace-router-state-serializer';
import { SharedModule } from './shared/shared.module';

export function getConfig() {
return ENV_CONFIG;
Expand All @@ -52,6 +53,7 @@ if (!ENV_CONFIG.production) {
@NgModule({
imports: [
CommonModule,
SharedModule,
HttpClientModule,
AppRoutingModule,
CoreModule.forRoot(),
Expand Down
66 changes: 34 additions & 32 deletions src/app/app.reducer.ts
@@ -1,32 +1,34 @@
import { ActionReducerMap } from '@ngrx/store';
import * as fromRouter from '@ngrx/router-store';

import { headerReducer, HeaderState } from './header/header.reducer';
import { hostWindowReducer, HostWindowState } from './shared/host-window.reducer';
import {
SearchSidebarState,
sidebarReducer
} from './+search-page/search-sidebar/search-sidebar.reducer';
import {
filterReducer,
SearchFiltersState
} from './+search-page/search-filters/search-filter/search-filter.reducer';
import { truncatableReducer, TruncatablesState } from './shared/truncatable/truncatable.reducer';

export interface AppState {
router: fromRouter.RouterReducerState;
hostWindow: HostWindowState;
header: HeaderState;
searchSidebar: SearchSidebarState;
searchFilter: SearchFiltersState;
truncatable: TruncatablesState;
}

export const appReducers: ActionReducerMap<AppState> = {
router: fromRouter.routerReducer,
hostWindow: hostWindowReducer,
header: headerReducer,
searchSidebar: sidebarReducer,
searchFilter: filterReducer,
truncatable: truncatableReducer
};
import { ActionReducerMap } from '@ngrx/store';
import * as fromRouter from '@ngrx/router-store';

import { headerReducer, HeaderState } from './header/header.reducer';
import { hostWindowReducer, HostWindowState } from './shared/host-window.reducer';
import {
SearchSidebarState,
sidebarReducer
} from './+search-page/search-sidebar/search-sidebar.reducer';
import {
filterReducer,
SearchFiltersState
} from './+search-page/search-filters/search-filter/search-filter.reducer';
import { truncatableReducer, TruncatablesState } from './shared/truncatable/truncatable.reducer';

export interface AppState {
router: fromRouter.RouterReducerState;
hostWindow: HostWindowState;
header: HeaderState;
searchSidebar: SearchSidebarState;
searchFilter: SearchFiltersState;
truncatable: TruncatablesState;
}

export const appReducers: ActionReducerMap<AppState> = {
router: fromRouter.routerReducer,
hostWindow: hostWindowReducer,
header: headerReducer,
searchSidebar: sidebarReducer,
searchFilter: filterReducer,
truncatable: truncatableReducer
};

export const routerStateSelector = (state: AppState) => state.router;

0 comments on commit afe4833

Please sign in to comment.