mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33:04 +00:00
start of resolvers
This commit is contained in:
@@ -8,13 +8,19 @@ module.exports = {
|
||||
nameSpace: '/'
|
||||
},
|
||||
// The REST API server settings.
|
||||
rest: {
|
||||
ssl: true,
|
||||
host: 'dspace7.4science.it',
|
||||
port: 443,
|
||||
// NOTE: Space is capitalized because 'namespace' is a reserved string in TypeScript
|
||||
nameSpace: '/dspace-spring-rest/api'
|
||||
},
|
||||
// rest: {
|
||||
// ssl: true,
|
||||
// host: 'dspace7.4science.it',
|
||||
// port: 443,
|
||||
// // NOTE: Space is capitalized because 'namespace' is a reserved string in TypeScript
|
||||
// nameSpace: '/dspace-spring-rest/api'
|
||||
// },
|
||||
rest: {
|
||||
ssl: false,
|
||||
host: 'dspace7-internal.atmire.com',
|
||||
port: 80,
|
||||
nameSpace: '/rest/api'
|
||||
},
|
||||
// Caching settings
|
||||
cache: {
|
||||
// NOTE: how long should objects be cached for by default
|
||||
|
21
src/app/+collection-page/collection-page-resolver.service.ts
Normal file
21
src/app/+collection-page/collection-page-resolver.service.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, Resolve, Router, RouterStateSnapshot } from '@angular/router';
|
||||
import { Collection } from '../core/shared/collection.model';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { CollectionDataService } from '../core/data/collection-data.service';
|
||||
import { RemoteData } from '../core/data/remote-data';
|
||||
import { filter } from 'rxjs/operators';
|
||||
|
||||
@Injectable()
|
||||
export class CollectionPageResolverService implements Resolve<RemoteData<Collection>> {
|
||||
constructor(private collectionService: CollectionDataService, private router: Router) {
|
||||
}
|
||||
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<RemoteData<Collection>> | Promise<RemoteData<Collection>> | RemoteData<Collection> {
|
||||
const id = route.params.id;
|
||||
console.log(id);
|
||||
// const collection = this.collectionService.findById(id).pipe(filter((c) => c.hasSucceeded));
|
||||
return this.collectionService.findById(id).pipe(filter((c) => c.hasSucceeded));
|
||||
// return Observable.of(new RemoteData(false, false, true, null, new Collection()));
|
||||
}
|
||||
}
|
@@ -2,12 +2,21 @@ import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { CollectionPageComponent } from './collection-page.component';
|
||||
import { CollectionPageResolverService } from './collection-page-resolver.service';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: ':id', component: CollectionPageComponent, pathMatch: 'full' }
|
||||
{
|
||||
path: ':id',
|
||||
component: CollectionPageComponent,
|
||||
pathMatch: 'full',
|
||||
resolve: { collection: CollectionPageResolverService }
|
||||
}
|
||||
])
|
||||
],
|
||||
providers: [
|
||||
CollectionPageResolverService
|
||||
]
|
||||
})
|
||||
export class CollectionPageRoutingModule {
|
||||
|
@@ -44,6 +44,8 @@ export class CollectionPageComponent implements OnInit, OnDestroy {
|
||||
private metadata: MetadataService,
|
||||
private route: ActivatedRoute
|
||||
) {
|
||||
console.log('component');
|
||||
console.log('Collections data:', this.route.snapshot.data);
|
||||
this.paginationConfig = new PaginationComponentOptions();
|
||||
this.paginationConfig.id = 'collection-page-pagination';
|
||||
this.paginationConfig.pageSize = 5;
|
||||
|
Reference in New Issue
Block a user