Fixed getSearchLink method with pages with embedded search

This commit is contained in:
Giuseppe Digilio
2019-05-09 15:13:03 +02:00
parent 137416c4ed
commit 7ea34ac8bf
2 changed files with 6 additions and 1 deletions

View File

@@ -15,6 +15,8 @@ import { SearchConfigurationService } from './search-service/search-configuratio
import { getSucceededRemoteData } from '../core/shared/operators';
import { SEARCH_CONFIG_SERVICE } from '../+my-dspace-page/my-dspace-page.component';
export const SEARCH_ROUTE = '/search';
/**
* This component renders a simple item page.
* The route parameter 'id' is used to request the item it represents.

View File

@@ -43,6 +43,8 @@ import { ViewMode } from '../../core/shared/view-mode.model';
import { ResourceType } from '../../core/shared/resource-type';
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
import { RouteService } from '../../shared/services/route.service';
import { MYDSPACE_ROUTE } from '../../+my-dspace-page/my-dspace-page.component';
import { SEARCH_ROUTE } from '../search-page.component';
/**
* Service that performs all general actions that have to do with the search page
@@ -356,7 +358,8 @@ export class SearchService implements OnDestroy {
getSearchLink(): string {
const urlTree = this.router.parseUrl(this.router.url);
const g: UrlSegmentGroup = urlTree.root.children[PRIMARY_OUTLET];
return '/' + g.toString();
const searchLink: any = '/' + g.toString();
return (searchLink !== SEARCH_ROUTE || searchLink !== MYDSPACE_ROUTE) ? SEARCH_ROUTE : searchLink;
}
/**