mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-14 13:33:03 +00:00
55647: Related publications on person pages
This commit is contained in:
@@ -28,12 +28,14 @@ import { RelatedEntitiesComponent } from './simple/related-entities/related-enti
|
|||||||
import { JournalPageFieldsComponent } from './simple/entity-types/journal/journal-page-fields.component';
|
import { JournalPageFieldsComponent } from './simple/entity-types/journal/journal-page-fields.component';
|
||||||
import { JournalIssuePageFieldsComponent } from './simple/entity-types/journal-issue/journal-issue-page-fields.component';
|
import { JournalIssuePageFieldsComponent } from './simple/entity-types/journal-issue/journal-issue-page-fields.component';
|
||||||
import { JournalVolumePageFieldsComponent } from './simple/entity-types/journal-volume/journal-volume-page-fields.component';
|
import { JournalVolumePageFieldsComponent } from './simple/entity-types/journal-volume/journal-volume-page-fields.component';
|
||||||
|
import { SearchPageModule } from '../+search-page/search-page.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
SharedModule,
|
SharedModule,
|
||||||
ItemPageRoutingModule
|
ItemPageRoutingModule,
|
||||||
|
SearchPageModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
ItemPageComponent,
|
ItemPageComponent,
|
||||||
|
@@ -24,10 +24,6 @@
|
|||||||
</ds-generic-item-page-field>
|
</ds-generic-item-page-field>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-md-6">
|
<div class="col-xs-12 col-md-6">
|
||||||
<ds-related-entities
|
|
||||||
[entities]="publications$ | async"
|
|
||||||
[label]="'relationships.isPublicationOf' | translate">
|
|
||||||
</ds-related-entities>
|
|
||||||
<ds-related-entities
|
<ds-related-entities
|
||||||
[entities]="projects$ | async"
|
[entities]="projects$ | async"
|
||||||
[label]="'relationships.isProjectOf' | translate">
|
[label]="'relationships.isProjectOf' | translate">
|
||||||
@@ -49,4 +45,11 @@
|
|||||||
[label]="'person.page.firstname'">
|
[label]="'person.page.firstname'">
|
||||||
</ds-generic-item-page-field>
|
</ds-generic-item-page-field>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-12 border-top pt-2">
|
||||||
|
<ds-filtered-search-page
|
||||||
|
[fixedFilterQuery]="fixedFilterQuery"
|
||||||
|
[fixedFilter$]="fixedFilter$"
|
||||||
|
[searchEnabled]="false">
|
||||||
|
</ds-filtered-search-page>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -9,6 +9,7 @@ import {
|
|||||||
EntityPageFieldsComponent, filterRelationsByTypeLabel,
|
EntityPageFieldsComponent, filterRelationsByTypeLabel,
|
||||||
relationsToItems
|
relationsToItems
|
||||||
} from '../shared/entity-page-fields.component';
|
} from '../shared/entity-page-fields.component';
|
||||||
|
import { SearchFixedFilterService } from '../../../../+search-page/search-filters/search-filter/search-fixed-filter.service';
|
||||||
|
|
||||||
@rendersEntityType('Person', ElementViewMode.Full)
|
@rendersEntityType('Person', ElementViewMode.Full)
|
||||||
@Component({
|
@Component({
|
||||||
@@ -20,10 +21,13 @@ export class PersonPageFieldsComponent extends EntityPageFieldsComponent {
|
|||||||
publications$: Observable<Item[]>;
|
publications$: Observable<Item[]>;
|
||||||
projects$: Observable<Item[]>;
|
projects$: Observable<Item[]>;
|
||||||
orgUnits$: Observable<Item[]>;
|
orgUnits$: Observable<Item[]>;
|
||||||
|
fixedFilter$: Observable<string>;
|
||||||
|
fixedFilterQuery: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(ITEM) public item: Item,
|
@Inject(ITEM) public item: Item,
|
||||||
private ids: ItemDataService
|
private ids: ItemDataService,
|
||||||
|
private fixedFilterService: SearchFixedFilterService
|
||||||
) {
|
) {
|
||||||
super(item);
|
super(item);
|
||||||
}
|
}
|
||||||
@@ -44,5 +48,8 @@ export class PersonPageFieldsComponent extends EntityPageFieldsComponent {
|
|||||||
filterRelationsByTypeLabel('isOrgUnitOfPerson'),
|
filterRelationsByTypeLabel('isOrgUnitOfPerson'),
|
||||||
relationsToItems(this.item.id, this.ids)
|
relationsToItems(this.item.id, this.ids)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.fixedFilterQuery = this.fixedFilterService.getQueryByRelations('isAuthorOfPublication', this.item.id);
|
||||||
|
this.fixedFilter$ = Observable.of('publication');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4,10 +4,15 @@ import { SearchFilterService } from './search-filters/search-filter/search-filte
|
|||||||
import { SearchService } from './search-service/search.service';
|
import { SearchService } from './search-service/search.service';
|
||||||
import { SearchSidebarService } from './search-sidebar/search-sidebar.service';
|
import { SearchSidebarService } from './search-sidebar/search-sidebar.service';
|
||||||
import { SearchPageComponent } from './search-page.component';
|
import { SearchPageComponent } from './search-page.component';
|
||||||
import { ChangeDetectionStrategy, Component, Injectable } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, Injectable, Input } from '@angular/core';
|
||||||
import { pushInOut } from '../shared/animations/push';
|
import { pushInOut } from '../shared/animations/push';
|
||||||
import { RouteService } from '../shared/services/route.service';
|
import { RouteService } from '../shared/services/route.service';
|
||||||
import { SearchConfigurationService } from './search-service/search-configuration.service';
|
import { SearchConfigurationService } from './search-service/search-configuration.service';
|
||||||
|
import { switchMap, tap } from 'rxjs/operators';
|
||||||
|
import { getSucceededRemoteData } from '../core/shared/operators';
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
import { PaginatedSearchOptions } from './paginated-search-options.model';
|
||||||
|
import { isNotEmpty } from '../shared/empty.util';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders a simple item page.
|
* This component renders a simple item page.
|
||||||
@@ -23,6 +28,12 @@ import { SearchConfigurationService } from './search-service/search-configuratio
|
|||||||
|
|
||||||
export class FilteredSearchPageComponent extends SearchPageComponent {
|
export class FilteredSearchPageComponent extends SearchPageComponent {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The actual query for the fixed filter.
|
||||||
|
* If empty, the query will be determined by the route parameter called 'filter'
|
||||||
|
*/
|
||||||
|
@Input() fixedFilterQuery: string;
|
||||||
|
|
||||||
constructor(protected service: SearchService,
|
constructor(protected service: SearchService,
|
||||||
protected sidebarService: SearchSidebarService,
|
protected sidebarService: SearchSidebarService,
|
||||||
protected windowService: HostWindowService,
|
protected windowService: HostWindowService,
|
||||||
@@ -32,4 +43,9 @@ export class FilteredSearchPageComponent extends SearchPageComponent {
|
|||||||
super(service, sidebarService, windowService, filterService, searchConfigService, routeService);
|
super(service, sidebarService, windowService, filterService, searchConfigService, routeService);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected getSearchOptions(): Observable<PaginatedSearchOptions> {
|
||||||
|
this.searchConfigService.updateFixedFilter(this.fixedFilterQuery);
|
||||||
|
return this.searchConfigService.paginatedSearchOptions;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -56,4 +56,8 @@ export class SearchFixedFilterService {
|
|||||||
return Observable.of(undefined);
|
return Observable.of(undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getQueryByRelations(relationType: string, itemUUID: string): string {
|
||||||
|
return `query=relation.${relationType}:${itemUUID}`;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -4,13 +4,13 @@
|
|||||||
id="search-sidebar"
|
id="search-sidebar"
|
||||||
[resultCount]="(resultsRD$ | async)?.payload.totalElements"></ds-search-sidebar>
|
[resultCount]="(resultsRD$ | async)?.payload.totalElements"></ds-search-sidebar>
|
||||||
<div class="col-12 col-md-9">
|
<div class="col-12 col-md-9">
|
||||||
<ds-search-form id="search-form"
|
<ds-search-form *ngIf="searchEnabled" id="search-form"
|
||||||
[query]="(searchOptions$ | async)?.query"
|
[query]="(searchOptions$ | async)?.query"
|
||||||
[scope]="(searchOptions$ | async)?.scope"
|
[scope]="(searchOptions$ | async)?.scope"
|
||||||
[currentUrl]="getSearchLink()"
|
[currentUrl]="getSearchLink()"
|
||||||
[scopes]="(scopeListRD$ | async)">
|
[scopes]="(scopeListRD$ | async)">
|
||||||
</ds-search-form>
|
</ds-search-form>
|
||||||
<ds-search-labels></ds-search-labels>
|
<ds-search-labels *ngIf="searchEnabled"></ds-search-labels>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div id="search-body"
|
<div id="search-body"
|
||||||
class="row-offcanvas row-offcanvas-left"
|
class="row-offcanvas row-offcanvas-left"
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<ds-search-results [searchResults]="resultsRD$ | async"
|
<ds-search-results [searchResults]="resultsRD$ | async"
|
||||||
[searchConfig]="searchOptions$ | async"
|
[searchConfig]="searchOptions$ | async"
|
||||||
[fixedFilter]="fixedFilter | async"></ds-search-results>
|
[fixedFilter]="fixedFilter$ | async"></ds-search-results>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
import { flatMap, switchMap, } from 'rxjs/operators';
|
import { flatMap, switchMap, } from 'rxjs/operators';
|
||||||
import { PaginatedList } from '../core/data/paginated-list';
|
import { PaginatedList } from '../core/data/paginated-list';
|
||||||
@@ -12,7 +12,7 @@ import { SearchResult } from './search-result.model';
|
|||||||
import { SearchService } from './search-service/search.service';
|
import { SearchService } from './search-service/search.service';
|
||||||
import { SearchSidebarService } from './search-sidebar/search-sidebar.service';
|
import { SearchSidebarService } from './search-sidebar/search-sidebar.service';
|
||||||
import { Subscription } from 'rxjs/Subscription';
|
import { Subscription } from 'rxjs/Subscription';
|
||||||
import { hasValue } from '../shared/empty.util';
|
import { hasValue, isNotEmpty } from '../shared/empty.util';
|
||||||
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
||||||
import { SearchConfigurationService } from './search-service/search-configuration.service';
|
import { SearchConfigurationService } from './search-service/search-configuration.service';
|
||||||
import { getSucceededRemoteData } from '../core/shared/operators';
|
import { getSucceededRemoteData } from '../core/shared/operators';
|
||||||
@@ -62,7 +62,17 @@ export class SearchPageComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
sub: Subscription;
|
sub: Subscription;
|
||||||
|
|
||||||
fixedFilter;
|
/**
|
||||||
|
* Whether or not the search bar should be visible
|
||||||
|
*/
|
||||||
|
@Input()
|
||||||
|
searchEnabled = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The currently applied filter (determines title of search)
|
||||||
|
*/
|
||||||
|
@Input()
|
||||||
|
fixedFilter$: Observable<string>;
|
||||||
|
|
||||||
constructor(protected service: SearchService,
|
constructor(protected service: SearchService,
|
||||||
protected sidebarService: SearchSidebarService,
|
protected sidebarService: SearchSidebarService,
|
||||||
@@ -81,7 +91,7 @@ export class SearchPageComponent implements OnInit {
|
|||||||
* If something changes, update the list of scopes for the dropdown
|
* If something changes, update the list of scopes for the dropdown
|
||||||
*/
|
*/
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.searchOptions$ = this.searchConfigService.paginatedSearchOptions;
|
this.searchOptions$ = this.getSearchOptions();
|
||||||
this.sub = this.searchOptions$
|
this.sub = this.searchOptions$
|
||||||
.switchMap((options) => this.service.search(options).pipe(getSucceededRemoteData()))
|
.switchMap((options) => this.service.search(options).pipe(getSucceededRemoteData()))
|
||||||
.subscribe((results) => {
|
.subscribe((results) => {
|
||||||
@@ -90,7 +100,13 @@ export class SearchPageComponent implements OnInit {
|
|||||||
this.scopeListRD$ = this.searchConfigService.getCurrentScope('').pipe(
|
this.scopeListRD$ = this.searchConfigService.getCurrentScope('').pipe(
|
||||||
switchMap((scopeId) => this.service.getScopes(scopeId))
|
switchMap((scopeId) => this.service.getScopes(scopeId))
|
||||||
);
|
);
|
||||||
this.fixedFilter = this.routeService.getRouteParameterValue('filter');
|
if (!isNotEmpty(this.fixedFilter$)) {
|
||||||
|
this.fixedFilter$ = this.routeService.getRouteParameterValue('filter');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected getSearchOptions(): Observable<PaginatedSearchOptions> {
|
||||||
|
return this.searchConfigService.paginatedSearchOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -89,6 +89,9 @@ const effects = [
|
|||||||
SearchTextFilterComponent,
|
SearchTextFilterComponent,
|
||||||
SearchHierarchyFilterComponent,
|
SearchHierarchyFilterComponent,
|
||||||
SearchBooleanFilterComponent,
|
SearchBooleanFilterComponent,
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
FilteredSearchPageComponent
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@ import { ActivatedRoute, Params } from '@angular/router';
|
|||||||
import { PaginatedSearchOptions } from '../paginated-search-options.model';
|
import { PaginatedSearchOptions } from '../paginated-search-options.model';
|
||||||
import { Injectable, OnDestroy } from '@angular/core';
|
import { Injectable, OnDestroy } from '@angular/core';
|
||||||
import { RouteService } from '../../shared/services/route.service';
|
import { RouteService } from '../../shared/services/route.service';
|
||||||
import { hasNoValue, hasValue, isEmpty, isNotEmpty } from '../../shared/empty.util';
|
import { hasNoValue, hasValue, isEmpty, isNotEmpty, isNotEmptyOperator } from '../../shared/empty.util';
|
||||||
import { RemoteData } from '../../core/data/remote-data';
|
import { RemoteData } from '../../core/data/remote-data';
|
||||||
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
||||||
import { Subscription } from 'rxjs/Subscription';
|
import { Subscription } from 'rxjs/Subscription';
|
||||||
@@ -14,6 +14,7 @@ import { getSucceededRemoteData } from '../../core/shared/operators';
|
|||||||
import { SearchFilter } from '../search-filter.model';
|
import { SearchFilter } from '../search-filter.model';
|
||||||
import { DSpaceObjectType } from '../../core/shared/dspace-object-type.model';
|
import { DSpaceObjectType } from '../../core/shared/dspace-object-type.model';
|
||||||
import { SearchFixedFilterService } from '../search-filters/search-filter/search-fixed-filter.service';
|
import { SearchFixedFilterService } from '../search-filters/search-filter/search-fixed-filter.service';
|
||||||
|
import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service that performs all actions that have to do with the current search configuration
|
* Service that performs all actions that have to do with the current search configuration
|
||||||
@@ -306,8 +307,21 @@ export class SearchConfigurationService implements OnDestroy {
|
|||||||
* @returns {Observable<string>} Emits the current fixed filter as a partial SearchOptions object
|
* @returns {Observable<string>} Emits the current fixed filter as a partial SearchOptions object
|
||||||
*/
|
*/
|
||||||
private getFixedFilterPart(): Observable<any> {
|
private getFixedFilterPart(): Observable<any> {
|
||||||
return this.getCurrentFixedFilter().map((fixedFilter) => {
|
return this.getCurrentFixedFilter().pipe(
|
||||||
|
isNotEmptyOperator(),
|
||||||
|
map((fixedFilter) => {
|
||||||
return { fixedFilter }
|
return { fixedFilter }
|
||||||
});
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public updateFixedFilter(fixedFilter: string) {
|
||||||
|
const currentPaginatedValue: PaginatedSearchOptions = this.paginatedSearchOptions.getValue();
|
||||||
|
const updatedPaginatedValue: PaginatedSearchOptions = Object.assign(currentPaginatedValue, { fixedFilter: fixedFilter });
|
||||||
|
this.paginatedSearchOptions.next(updatedPaginatedValue);
|
||||||
|
|
||||||
|
const currentValue: SearchOptions = this.searchOptions.getValue();
|
||||||
|
const updatedValue: SearchOptions = Object.assign(currentValue, { fixedFilter: fixedFilter });
|
||||||
|
this.searchOptions.next(updatedValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user