"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/app/core/shared/search/search.service.ts" between
dspace-angular-dspace-7.0.tar.gz and dspace-angular-dspace-7.1.tar.gz

About: dspace-angular is the Angular-based frontend of DSpace, a digital repository system to capture, store, index, preserve and redistribute an organization’s research material in digital formats.

search.service.ts  (dspace-angular-dspace-7.0):search.service.ts  (dspace-angular-dspace-7.1)
import { combineLatest as observableCombineLatest, Observable, of as observableO f } from 'rxjs'; import { combineLatest as observableCombineLatest, Observable } from 'rxjs';
import { Injectable, OnDestroy } from '@angular/core'; import { Injectable, OnDestroy } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { map, switchMap, take } from 'rxjs/operators'; import { map, switchMap, take } from 'rxjs/operators';
import { followLink, FollowLinkConfig } from '../../../shared/utils/follow-link- config.model'; import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model ';
import { LinkService } from '../../cache/builders/link.service'; import { LinkService } from '../../cache/builders/link.service';
import { PaginatedList } from '../../data/paginated-list.model'; import { PaginatedList } from '../../data/paginated-list.model';
import { ResponseParsingService } from '../../data/parsing.service'; import { ResponseParsingService } from '../../data/parsing.service';
import { RemoteData } from '../../data/remote-data'; import { RemoteData } from '../../data/remote-data';
import { GetRequest, RestRequest } from '../../data/request.models'; import { GetRequest, RestRequest } from '../../data/request.models';
import { RequestService } from '../../data/request.service'; import { RequestService } from '../../data/request.service';
import { DSpaceObject } from '../dspace-object.model'; import { DSpaceObject } from '../dspace-object.model';
import { GenericConstructor } from '../generic-constructor'; import { GenericConstructor } from '../generic-constructor';
import { HALEndpointService } from '../hal-endpoint.service'; import { HALEndpointService } from '../hal-endpoint.service';
import { URLCombiner } from '../../url-combiner/url-combiner'; import { URLCombiner } from '../../url-combiner/url-combiner';
import { hasValue, isEmpty, isNotEmpty, hasValueOperator } from '../../../shared /empty.util'; import { hasValue, hasValueOperator, isNotEmpty } from '../../../shared/empty.ut il';
import { SearchOptions } from '../../../shared/search/search-options.model'; import { SearchOptions } from '../../../shared/search/search-options.model';
import { SearchFilterConfig } from '../../../shared/search/search-filter-config. model'; import { SearchFilterConfig } from '../../../shared/search/search-filter-config. model';
import { SearchResponseParsingService } from '../../data/search-response-parsing .service'; import { SearchResponseParsingService } from '../../data/search-response-parsing .service';
import { SearchObjects } from '../../../shared/search/search-objects.model'; import { SearchObjects } from '../../../shared/search/search-objects.model';
import { FacetValueResponseParsingService } from '../../data/facet-value-respons e-parsing.service'; import { FacetValueResponseParsingService } from '../../data/facet-value-respons e-parsing.service';
import { FacetConfigResponseParsingService } from '../../data/facet-config-respo nse-parsing.service'; import { FacetConfigResponseParsingService } from '../../data/facet-config-respo nse-parsing.service';
import { PaginatedSearchOptions } from '../../../shared/search/paginated-search- options.model'; import { PaginatedSearchOptions } from '../../../shared/search/paginated-search- options.model';
import { Community } from '../community.model';
import { CommunityDataService } from '../../data/community-data.service'; import { CommunityDataService } from '../../data/community-data.service';
import { ViewMode } from '../view-mode.model'; import { ViewMode } from '../view-mode.model';
import { DSpaceObjectDataService } from '../../data/dspace-object-data.service'; import { DSpaceObjectDataService } from '../../data/dspace-object-data.service';
import { RemoteDataBuildService } from '../../cache/builders/remote-data-build.s ervice'; import { RemoteDataBuildService } from '../../cache/builders/remote-data-build.s ervice';
import { import { getFirstCompletedRemoteData, getRemoteDataPayload } from '../operators'
getFirstSucceededRemoteData, ;
getFirstCompletedRemoteData,
getRemoteDataPayload
} from '../operators';
import { RouteService } from '../../services/route.service'; import { RouteService } from '../../services/route.service';
import { SearchResult } from '../../../shared/search/search-result.model'; import { SearchResult } from '../../../shared/search/search-result.model';
import { ListableObject } from '../../../shared/object-collection/shared/listabl e-object.model'; import { ListableObject } from '../../../shared/object-collection/shared/listabl e-object.model';
import { getSearchResultFor } from '../../../shared/search/search-result-element -decorator'; import { getSearchResultFor } from '../../../shared/search/search-result-element -decorator';
import { FacetConfigResponse } from '../../../shared/search/facet-config-respons e.model'; import { FacetConfigResponse } from '../../../shared/search/facet-config-respons e.model';
import { FacetValues } from '../../../shared/search/facet-values.model'; import { FacetValues } from '../../../shared/search/facet-values.model';
import { SearchConfig } from './search-filters/search-config.model'; import { SearchConfig } from './search-filters/search-config.model';
import { PaginationService } from '../../pagination/pagination.service'; import { PaginationService } from '../../pagination/pagination.service';
import { SearchConfigurationService } from './search-configuration.service'; import { SearchConfigurationService } from './search-configuration.service';
import { PaginationComponentOptions } from '../../../shared/pagination/paginatio n-component-options.model'; import { PaginationComponentOptions } from '../../../shared/pagination/paginatio n-component-options.model';
skipping to change at line 399 skipping to change at line 394
getResponseParser(): GenericConstructor<ResponseParsingService> { getResponseParser(): GenericConstructor<ResponseParsingService> {
return FacetValueResponseParsingService; return FacetValueResponseParsingService;
} }
}); });
this.requestService.send(request, true); this.requestService.send(request, true);
return this.rdb.buildFromHref(href); return this.rdb.buildFromHref(href);
} }
/** /**
* Request a list of DSpaceObjects that can be used as a scope, based on the c
urrent scope
* @param {string} scopeId UUID of the current scope, if the scope is empty, t
he repository wide scopes will be returned
* @returns {Observable<DSpaceObject[]>} Emits a list of DSpaceObjects which r
epresent possible scopes
*/
getScopes(scopeId?: string): Observable<DSpaceObject[]> {
if (isEmpty(scopeId)) {
const top: Observable<Community[]> = this.communityService.findTop({ eleme
ntsPerPage: 9999 }).pipe(
getFirstSucceededRemoteData(),
map(
(communities: RemoteData<PaginatedList<Community>>) => communities.pay
load.page
)
);
return top;
}
const scopeObject: Observable<RemoteData<DSpaceObject>> = this.dspaceObjectS
ervice.findById(scopeId).pipe(getFirstSucceededRemoteData());
const scopeList: Observable<DSpaceObject[]> = scopeObject.pipe(
switchMap((dsoRD: RemoteData<DSpaceObject>) => {
if ((dsoRD.payload as any).type === Community.type.value) {
const community: Community = dsoRD.payload as Community;
this.linkService.resolveLinks(community, followLink('subcommunities'
), followLink('collections'));
return observableCombineLatest([
community.subcommunities.pipe(getFirstCompletedRemoteData()),
community.collections.pipe(getFirstCompletedRemoteData())
]).pipe(
map(([subCommunities, collections]) => {
/*if this is a community, we also need to show the direct childr
en*/
return [community, ...subCommunities.payload.page, ...collection
s.payload.page];
})
);
} else {
return observableOf([dsoRD.payload]);
}
}
));
return scopeList;
}
/**
* Requests the current view mode based on the current URL * Requests the current view mode based on the current URL
* @returns {Observable<ViewMode>} The current view mode * @returns {Observable<ViewMode>} The current view mode
*/ */
getViewMode(): Observable<ViewMode> { getViewMode(): Observable<ViewMode> {
return this.routeService.getQueryParamMap().pipe(map((params) => { return this.routeService.getQueryParamMap().pipe(map((params) => {
if (isNotEmpty(params.get('view')) && hasValue(params.get('view'))) { if (isNotEmpty(params.get('view')) && hasValue(params.get('view'))) {
return params.get('view'); return params.get('view');
} else { } else {
return ViewMode.ListElement; return ViewMode.ListElement;
} }
 End of changes. 6 change blocks. 
60 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)