forked from hazza/dspace-angular
Fixed and updated merge related issues for simple search
This commit is contained in:
@@ -6,7 +6,7 @@ import { SearchPageComponent } from './search-page.component';
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: 'search', component: SearchPageComponent }
|
||||
{ path: '', component: SearchPageComponent }
|
||||
])
|
||||
]
|
||||
})
|
@@ -1,12 +1,12 @@
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { SearchService } from '../search/search.service';
|
||||
import { SearchService } from './search.service';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { RemoteData } from '../core/data/remote-data';
|
||||
import { SearchResult } from '../search/search-result.model';
|
||||
import { SearchResult } from './search-result.model';
|
||||
import { DSpaceObject } from '../core/shared/dspace-object.model';
|
||||
import { SortOptions } from '../core/cache/models/sort-options.model';
|
||||
import { PaginationComponentOptions } from '../shared/pagination/pagination-component-options.model';
|
||||
import { SearchOptions } from '../search/search-options.model';
|
||||
import { SearchOptions } from './search-options.model';
|
||||
import { CommunityDataService } from '../core/data/community-data.service';
|
||||
import { isNotEmpty } from '../shared/empty.util';
|
||||
import { Community } from '../core/shared/community.model';
|
@@ -8,10 +8,10 @@ import { SharedModule } from '../shared/shared.module';
|
||||
import { SearchPageRoutingModule } from './search-page-routing.module';
|
||||
import { SearchPageComponent } from './search-page.component';
|
||||
import { SearchResultsComponent } from './search-results/search-results.compontent';
|
||||
import { SearchModule } from '../search/search.module';
|
||||
import { ItemSearchResultListElementComponent } from '../object-list/search-result-list-element/item-search-result/item-search-result-list-element.component';
|
||||
import { CollectionSearchResultListElementComponent } from '../object-list/search-result-list-element/collection-search-result/collection-search-result-list-element.component';
|
||||
import { CommunitySearchResultListElementComponent } from '../object-list/search-result-list-element/community-search-result/community-search-result-list-element.component';
|
||||
import { SearchService } from './search.service';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -19,8 +19,7 @@ import { CommunitySearchResultListElementComponent } from '../object-list/search
|
||||
CommonModule,
|
||||
TranslateModule,
|
||||
RouterModule,
|
||||
SharedModule,
|
||||
SearchModule
|
||||
SharedModule
|
||||
],
|
||||
declarations: [
|
||||
SearchPageComponent,
|
||||
@@ -29,6 +28,9 @@ import { CommunitySearchResultListElementComponent } from '../object-list/search
|
||||
CollectionSearchResultListElementComponent,
|
||||
CommunitySearchResultListElementComponent
|
||||
],
|
||||
providers: [
|
||||
SearchService
|
||||
],
|
||||
entryComponents: [
|
||||
ItemSearchResultListElementComponent,
|
||||
CollectionSearchResultListElementComponent,
|
@@ -1,8 +1,8 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { RemoteData } from '../../core/data/remote-data';
|
||||
import { SearchResult } from '../../search/search-result.model';
|
||||
import { SearchResult } from '../search-result.model';
|
||||
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
||||
import { SearchOptions } from '../../search/search-options.model';
|
||||
import { SearchOptions } from '../search-options.model';
|
||||
|
||||
/**
|
||||
* This component renders a simple item page.
|
@@ -84,8 +84,8 @@ export class SearchService {
|
||||
});
|
||||
|
||||
const pageInfo = itemsRD.pageInfo.map((info: PageInfo) => {
|
||||
info.totalElements = info.totalElements > 20 ? 20 : info.totalElements;
|
||||
return info;
|
||||
const totalElements = info.totalElements > 20 ? 20 : info.totalElements;
|
||||
return Object.assign({}, info, {totalElements: totalElements});
|
||||
});
|
||||
|
||||
const payload = itemsRD.payload.map((items: Item[]) => {
|
@@ -11,6 +11,7 @@ import { PageNotFoundComponent } from './pagenotfound/pagenotfound.component';
|
||||
{ path: 'communities', loadChildren: './+community-page/community-page.module#CommunityPageModule' },
|
||||
{ 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: '**', pathMatch: 'full', component: PageNotFoundComponent },
|
||||
])
|
||||
],
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { SearchResult } from '../../../search/search-result.model';
|
||||
import { SearchResult } from '../../../+search-page/search-result.model';
|
||||
import { Collection } from '../../../core/shared/collection.model';
|
||||
|
||||
export class CollectionSearchResult extends SearchResult<Collection> {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { SearchResult } from '../../../search/search-result.model';
|
||||
import { SearchResult } from '../../../+search-page/search-result.model';
|
||||
import { Community } from '../../../core/shared/community.model';
|
||||
|
||||
export class CommunitySearchResult extends SearchResult<Community> {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { SearchResult } from '../../../search/search-result.model';
|
||||
import { SearchResult } from '../../../+search-page/search-result.model';
|
||||
import { Item } from '../../../core/shared/item.model';
|
||||
|
||||
export class ItemSearchResult extends SearchResult<Item> {
|
||||
|
@@ -2,7 +2,7 @@ import { Component, Inject } from '@angular/core';
|
||||
|
||||
import { ObjectListElementComponent } from '../object-list-element/object-list-element.component';
|
||||
import { ListableObject } from '../listable-object/listable-object.model';
|
||||
import { SearchResult } from '../../search/search-result.model';
|
||||
import { SearchResult } from '../../+search-page/search-result.model';
|
||||
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
||||
import { Metadatum } from '../../core/shared/metadatum.model';
|
||||
import { isEmpty, hasNoValue } from '../../shared/empty.util';
|
||||
|
@@ -1,17 +0,0 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CoreModule } from '../core/core.module';
|
||||
import { SearchService } from './search.service';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
||||
],
|
||||
declarations: [
|
||||
],
|
||||
exports: [
|
||||
],
|
||||
providers: [
|
||||
SearchService
|
||||
]
|
||||
})
|
||||
export class SearchModule { }
|
@@ -1,4 +1,4 @@
|
||||
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
||||
import { Router } from '@angular/router';
|
||||
import { isNotEmpty, hasValue, isEmpty } from '../empty.util';
|
||||
@@ -15,14 +15,12 @@ import { Observable } from 'rxjs/Observable';
|
||||
styleUrls: ['./search-form.component.scss'],
|
||||
templateUrl: './search-form.component.html',
|
||||
})
|
||||
export class SearchFormComponent implements OnInit, OnDestroy {
|
||||
export class SearchFormComponent {
|
||||
@Input() query: string;
|
||||
selectedId = '';
|
||||
// Optional existing search parameters
|
||||
@Input() currentParams: {};
|
||||
@Input() scopes: Observable<DSpaceObject[]>;
|
||||
scopeOptions: string[] = [];
|
||||
sub;
|
||||
|
||||
@Input()
|
||||
set scope(dso: DSpaceObject) {
|
||||
@@ -31,19 +29,6 @@ export class SearchFormComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.scopes) {
|
||||
this.sub =
|
||||
this.scopes
|
||||
.filter((scopes: DSpaceObject[]) => isEmpty(scopes))
|
||||
.subscribe((scopes: DSpaceObject[]) => {
|
||||
this.scopeOptions = scopes
|
||||
.map((scope: DSpaceObject) => scope.id);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
constructor(private router: Router) {
|
||||
}
|
||||
|
||||
@@ -75,9 +60,4 @@ export class SearchFormComponent implements OnInit, OnDestroy {
|
||||
return id1 === id2;
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
if (this.sub) {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user