diff --git a/src/app/+search-page/search-page-routing.module.ts b/src/app/+search-page/search-page-routing.module.ts
index 083a1b4410..315e15a593 100644
--- a/src/app/+search-page/search-page-routing.module.ts
+++ b/src/app/+search-page/search-page-routing.module.ts
@@ -1,7 +1,6 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
-import { SearchComponent } from './search.component';
import { ConfigurationSearchPageGuard } from './configuration-search-page.guard';
import { ConfigurationSearchPageComponent } from './configuration-search-page.component';
import { SearchPageComponent } from './search-page.component';
diff --git a/src/app/+search-page/search-page.module.ts b/src/app/+search-page/search-page.module.ts
index c3dbfe3196..e5ce670013 100644
--- a/src/app/+search-page/search-page.module.ts
+++ b/src/app/+search-page/search-page.module.ts
@@ -8,9 +8,11 @@ import { ConfigurationSearchPageComponent } from './configuration-search-page.co
import { ConfigurationSearchPageGuard } from './configuration-search-page.guard';
import { SearchTrackerComponent } from './search-tracker.component';
import { StatisticsModule } from '../statistics/statistics.module';
+import { SearchComponent } from './search.component';
const components = [
SearchPageComponent,
+ SearchComponent,
ConfigurationSearchPageComponent,
SearchTrackerComponent
];
diff --git a/src/app/+search-page/search-tracker.component.ts b/src/app/+search-page/search-tracker.component.ts
index e1df9b3905..58867e3f03 100644
--- a/src/app/+search-page/search-tracker.component.ts
+++ b/src/app/+search-page/search-tracker.component.ts
@@ -2,16 +2,17 @@ import { Component, Inject, OnInit } from '@angular/core';
import { Angulartics2 } from 'angulartics2';
import { filter, map, switchMap } from 'rxjs/operators';
import { SearchComponent } from './search.component';
-import { SearchService } from './search-service/search.service';
import { SidebarService } from '../shared/sidebar/sidebar.service';
-import { SearchConfigurationService } from './search-service/search-configuration.service';
import { HostWindowService } from '../shared/host-window.service';
import { SEARCH_CONFIG_SERVICE } from '../+my-dspace-page/my-dspace-page.component';
import { RouteService } from '../core/services/route.service';
import { hasValue } from '../shared/empty.util';
-import { SearchQueryResponse } from './search-service/search-query-response.model';
import { SearchSuccessResponse } from '../core/cache/response.models';
-import { PaginatedSearchOptions } from './paginated-search-options.model';
+import { SearchConfigurationService } from '../core/shared/search/search-configuration.service';
+import { Router } from '@angular/router';
+import { SearchService } from '../core/shared/search/search.service';
+import { PaginatedSearchOptions } from '../shared/search/paginated-search-options.model';
+import { SearchQueryResponse } from '../shared/search/search-query-response.model';
/**
* This component triggers a page view statistic
@@ -30,14 +31,15 @@ import { PaginatedSearchOptions } from './paginated-search-options.model';
export class SearchTrackerComponent extends SearchComponent implements OnInit {
constructor(
- protected service:SearchService,
- protected sidebarService:SidebarService,
- protected windowService:HostWindowService,
- @Inject(SEARCH_CONFIG_SERVICE) public searchConfigService:SearchConfigurationService,
- protected routeService:RouteService,
- public angulartics2:Angulartics2
+ protected service: SearchService,
+ protected sidebarService: SidebarService,
+ protected windowService: HostWindowService,
+ @Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService,
+ protected routeService: RouteService,
+ public angulartics2: Angulartics2,
+ protected router: Router
) {
- super(service, sidebarService, windowService, searchConfigService, routeService);
+ super(service, sidebarService, windowService, searchConfigService, routeService, router);
}
ngOnInit():void {
@@ -58,9 +60,9 @@ export class SearchTrackerComponent extends SearchComponent implements OnInit {
)
)
.subscribe((entry) => {
- const config:PaginatedSearchOptions = entry.searchOptions;
- const searchQueryResponse:SearchQueryResponse = entry.response;
- const filters:Array<{ filter:string, operator:string, value:string, label:string; }> = [];
+ const config: PaginatedSearchOptions = entry.searchOptions;
+ const searchQueryResponse: SearchQueryResponse = entry.response;
+ const filters:Array<{ filter: string, operator: string, value: string, label: string; }> = [];
const appliedFilters = searchQueryResponse.appliedFilters || [];
for (let i = 0, filtersLength = appliedFilters.length; i < filtersLength; i++) {
const appliedFilter = appliedFilters[i];
diff --git a/src/app/+search-page/search.component.html b/src/app/+search-page/search.component.html
index 9423062bde..a6e83d2b64 100644
--- a/src/app/+search-page/search.component.html
+++ b/src/app/+search-page/search.component.html
@@ -46,5 +46,9 @@
[scopes]="(scopeListRD$ | async)"
[inPlaceSearch]="inPlaceSearch">
+
diff --git a/src/app/+search-page/search.component.ts b/src/app/+search-page/search.component.ts
index cc763e253f..bfb99755d8 100644
--- a/src/app/+search-page/search.component.ts
+++ b/src/app/+search-page/search.component.ts
@@ -1,20 +1,22 @@
import { ChangeDetectionStrategy, Component, Inject, Input, OnInit } from '@angular/core';
-import { BehaviorSubject, Observable, of as observableOf, Subscription } from 'rxjs';
+import { BehaviorSubject, Observable, Subscription } from 'rxjs';
import { startWith, switchMap, } from 'rxjs/operators';
import { PaginatedList } from '../core/data/paginated-list';
import { RemoteData } from '../core/data/remote-data';
import { DSpaceObject } from '../core/shared/dspace-object.model';
import { pushInOut } from '../shared/animations/push';
import { HostWindowService } from '../shared/host-window.service';
-import { PaginatedSearchOptions } from './paginated-search-options.model';
-import { SearchResult } from './search-result.model';
-import { SearchService } from './search-service/search.service';
import { SidebarService } from '../shared/sidebar/sidebar.service';
import { hasValue, isNotEmpty } from '../shared/empty.util';
-import { SearchConfigurationService } from './search-service/search-configuration.service';
import { getSucceededRemoteData } from '../core/shared/operators';
import { RouteService } from '../core/services/route.service';
import { SEARCH_CONFIG_SERVICE } from '../+my-dspace-page/my-dspace-page.component';
+import { SearchConfigurationService } from '../core/shared/search/search-configuration.service';
+import { SearchResult } from '../shared/search/search-result.model';
+import { PaginatedSearchOptions } from '../shared/search/paginated-search-options.model';
+import { SearchService } from '../core/shared/search/search.service';
+import { currentPath } from '../shared/utils/route.utils';
+import { Router } from '@angular/router';
@Component({
selector: 'ds-search',
@@ -96,7 +98,8 @@ export class SearchComponent implements OnInit {
protected sidebarService: SidebarService,
protected windowService: HostWindowService,
@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService,
- protected routeService: RouteService) {
+ protected routeService: RouteService,
+ protected router: Router) {
this.isXsOrSm$ = this.windowService.isXsOrSm();
}
@@ -159,7 +162,7 @@ export class SearchComponent implements OnInit {
*/
private getSearchLink(): string {
if (this.inPlaceSearch) {
- return './';
+ return currentPath(this.router);
}
return this.service.getSearchLink();
}
diff --git a/src/app/app.effects.ts b/src/app/app.effects.ts
index 22df36e1ac..64573609c7 100644
--- a/src/app/app.effects.ts
+++ b/src/app/app.effects.ts
@@ -1,8 +1,8 @@
import { StoreEffects } from './store.effects';
import { NotificationsEffects } from './shared/notifications/notifications.effects';
import { NavbarEffects } from './navbar/navbar.effects';
-import { RelationshipEffects } from './shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/relationship.effects';
import { SidebarEffects } from './shared/sidebar/sidebar-effects.service';
+import { RelationshipEffects } from './shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/relationship.effects';
export const appEffects = [
StoreEffects,
diff --git a/src/app/core/data/relationship-type.service.ts b/src/app/core/data/relationship-type.service.ts
index a30dd5d57e..627fc4863f 100644
--- a/src/app/core/data/relationship-type.service.ts
+++ b/src/app/core/data/relationship-type.service.ts
@@ -4,7 +4,6 @@ import { HALEndpointService } from '../shared/hal-endpoint.service';
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
import { filter, find, map, switchMap, tap } from 'rxjs/operators';
import { configureRequest, getSucceededRemoteData } from '../shared/operators';
-import { FindAllOptions, FindAllRequest } from './request.models';
import { Observable } from 'rxjs/internal/Observable';
import { RelationshipType } from '../shared/item-relationships/relationship-type.model';
import { RemoteData } from './remote-data';
@@ -12,6 +11,7 @@ import { PaginatedList } from './paginated-list';
import { combineLatest as observableCombineLatest } from 'rxjs';
import { ItemType } from '../shared/item-relationships/item-type.model';
import { isNotUndefined } from '../../shared/empty.util';
+import { FindListOptions, FindListRequest } from './request.models';
/**
* The service handling all relationship requests
@@ -35,11 +35,11 @@ export class RelationshipTypeService {
);
}
- getAllRelationshipTypes(options: FindAllOptions): Observable>> {
+ getAllRelationshipTypes(options: FindListOptions): Observable>> {
const link$ = this.halService.getEndpoint(this.linkPath);
return link$
.pipe(
- map((endpointURL: string) => new FindAllRequest(this.requestService.generateRequestId(), endpointURL, options)),
+ map((endpointURL: string) => new FindListRequest(this.requestService.generateRequestId(), endpointURL, options)),
configureRequest(this.requestService),
switchMap(() => this.rdbService.buildList(link$))
);
diff --git a/src/app/statistics/statistics.service.spec.ts b/src/app/statistics/statistics.service.spec.ts
index 3a416968f8..c6cc4c10b5 100644
--- a/src/app/statistics/statistics.service.spec.ts
+++ b/src/app/statistics/statistics.service.spec.ts
@@ -3,10 +3,9 @@ import { RequestService } from '../core/data/request.service';
import { HALEndpointServiceStub } from '../shared/testing/hal-endpoint-service-stub';
import { getMockRequestService } from '../shared/mocks/mock-request.service';
import { TrackRequest } from './track-request.model';
-import { ResourceType } from '../core/shared/resource-type';
-import { SearchOptions } from '../+search-page/search-options.model';
import { isEqual } from 'lodash';
import { DSpaceObjectType } from '../core/shared/dspace-object-type.model';
+import { SearchOptions } from '../shared/search/search-options.model';
describe('StatisticsService', () => {
let service:StatisticsService;
diff --git a/src/app/statistics/statistics.service.ts b/src/app/statistics/statistics.service.ts
index cd89125b3c..004e013164 100644
--- a/src/app/statistics/statistics.service.ts
+++ b/src/app/statistics/statistics.service.ts
@@ -3,10 +3,10 @@ import { Injectable } from '@angular/core';
import { DSpaceObject } from '../core/shared/dspace-object.model';
import { map, take } from 'rxjs/operators';
import { TrackRequest } from './track-request.model';
-import { SearchOptions } from '../+search-page/search-options.model';
import { hasValue, isNotEmpty } from '../shared/empty.util';
import { HALEndpointService } from '../core/shared/hal-endpoint.service';
import { RestRequest } from '../core/data/request.models';
+import { SearchOptions } from '../shared/search/search-options.model';
/**
* The statistics service
@@ -15,24 +15,24 @@ import { RestRequest } from '../core/data/request.models';
export class StatisticsService {
constructor(
- protected requestService:RequestService,
- protected halService:HALEndpointService,
+ protected requestService: RequestService,
+ protected halService: HALEndpointService,
) {
}
- private sendEvent(linkPath:string, body:any) {
+ private sendEvent(linkPath: string, body: any) {
const requestId = this.requestService.generateRequestId();
this.halService.getEndpoint(linkPath).pipe(
- map((endpoint:string) => new TrackRequest(requestId, endpoint, JSON.stringify(body))),
+ map((endpoint: string) => new TrackRequest(requestId, endpoint, JSON.stringify(body))),
take(1) // otherwise the previous events will fire again
- ).subscribe((request:RestRequest) => this.requestService.configure(request));
+ ).subscribe((request: RestRequest) => this.requestService.configure(request));
}
/**
* To track a page view
* @param dso: The dso which was viewed
*/
- trackViewEvent(dso:DSpaceObject) {
+ trackViewEvent(dso: DSpaceObject) {
this.sendEvent('/statistics/viewevents', {
targetId: dso.uuid,
targetType: (dso as any).type
@@ -47,10 +47,10 @@ export class StatisticsService {
* @param filters: An array of search filters used to filter the result set
*/
trackSearchEvent(
- searchOptions:SearchOptions,
- page:{ size:number, totalElements:number, totalPages:number, number:number },
- sort:{ by:string, order:string },
- filters?:Array<{ filter:string, operator:string, value:string, label:string }>
+ searchOptions: SearchOptions,
+ page: { size: number, totalElements: number, totalPages: number, number: number },
+ sort: { by: string, order: string },
+ filters?: Array<{ filter: string, operator: string, value: string, label: string }>
) {
const body = {
query: searchOptions.query,
@@ -66,13 +66,13 @@ export class StatisticsService {
},
};
if (hasValue(searchOptions.configuration)) {
- Object.assign(body, {configuration: searchOptions.configuration})
+ Object.assign(body, { configuration: searchOptions.configuration })
}
if (hasValue(searchOptions.dsoType)) {
- Object.assign(body, {dsoType: searchOptions.dsoType.toLowerCase()})
+ Object.assign(body, { dsoType: searchOptions.dsoType.toLowerCase() })
}
if (hasValue(searchOptions.scope)) {
- Object.assign(body, {scope: searchOptions.scope})
+ Object.assign(body, { scope: searchOptions.scope })
}
if (isNotEmpty(filters)) {
const bodyFilters = [];
@@ -85,7 +85,7 @@ export class StatisticsService {
label: filter.label
})
}
- Object.assign(body, {appliedFilters: bodyFilters})
+ Object.assign(body, { appliedFilters: bodyFilters })
}
this.sendEvent('/statistics/searchevents', body);
}