mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-10 19:43:04 +00:00
add new dependencies for facets filters isolation
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, InjectionToken, OnInit } from '@angular/core';
|
||||
import { SearchService } from '../../core/shared/search/search.service';
|
||||
import { environment } from '../../../environments/environment';
|
||||
import { PaginatedSearchOptions } from '../../shared/search/models/paginated-search-options.model';
|
||||
@@ -9,11 +9,32 @@ import { map } from 'rxjs/operators';
|
||||
import { SearchObjects } from '../../shared/search/models/search-objects.model';
|
||||
import { AdminNotifyMetricsBox, AdminNotifyMetricsRow } from './admin-notify-metrics/admin-notify-metrics.model';
|
||||
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
||||
import { FILTER_CONFIG, SearchFilterService } from "../../core/shared/search/search-filter.service";
|
||||
import { SEARCH_CONFIG_SERVICE } from "../../my-dspace-page/my-dspace-page.component";
|
||||
import { AdminNotifySearchConfigurationService } from "./config/admin-notify-search-configuration.service";
|
||||
import { AdminNotifySearchFilterService } from "./config/admin-notify-filter-service";
|
||||
import { AdminNotifySearchFilterConfig } from "./config/admin-notify-search-filter-config";
|
||||
|
||||
export const FILTER_SEARCH: InjectionToken<SearchFilterService> = new InjectionToken<SearchFilterService>('searchFilterService');
|
||||
|
||||
@Component({
|
||||
selector: 'ds-admin-notify-dashboard',
|
||||
templateUrl: './admin-notify-dashboard.component.html',
|
||||
styleUrls: ['./admin-notify-dashboard.component.scss'],
|
||||
providers: [
|
||||
{
|
||||
provide: SEARCH_CONFIG_SERVICE,
|
||||
useClass: AdminNotifySearchConfigurationService
|
||||
},
|
||||
{
|
||||
provide: FILTER_SEARCH,
|
||||
useClass: AdminNotifySearchFilterService
|
||||
},
|
||||
{
|
||||
provide: FILTER_CONFIG,
|
||||
useClass: AdminNotifySearchFilterConfig
|
||||
}
|
||||
]
|
||||
})
|
||||
export class AdminNotifyDashboardComponent implements OnInit{
|
||||
|
||||
|
@@ -1,7 +1,12 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
||||
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
||||
import { Context } from '../../../../core/shared/context.model';
|
||||
import { AdminNotifySearchConfigurationService } from "../../config/admin-notify-search-configuration.service";
|
||||
import { FILTER_SEARCH } from "../../admin-notify-dashboard.component";
|
||||
import { AdminNotifySearchFilterService } from "../../config/admin-notify-filter-service";
|
||||
import { FILTER_CONFIG } from "../../../../core/shared/search/search-filter.service";
|
||||
import { AdminNotifySearchFilterConfig } from "../../config/admin-notify-search-filter-config";
|
||||
|
||||
|
||||
@Component({
|
||||
@@ -11,10 +16,26 @@ import { Context } from '../../../../core/shared/context.model';
|
||||
providers: [
|
||||
{
|
||||
provide: SEARCH_CONFIG_SERVICE,
|
||||
useClass: SearchConfigurationService
|
||||
useClass: AdminNotifySearchConfigurationService
|
||||
},
|
||||
{
|
||||
provide: FILTER_SEARCH,
|
||||
useClass: AdminNotifySearchFilterService
|
||||
},
|
||||
{
|
||||
provide: FILTER_CONFIG,
|
||||
useClass: AdminNotifySearchFilterConfig
|
||||
}
|
||||
]
|
||||
})
|
||||
export class AdminNotifyIncomingComponent {
|
||||
protected readonly context = Context.CoarNotify;
|
||||
constructor(@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: AdminNotifySearchConfigurationService,
|
||||
@Inject(FILTER_SEARCH) public searchFilterService: AdminNotifySearchFilterService,
|
||||
@Inject(FILTER_CONFIG) public filterConfig: AdminNotifySearchFilterConfig) {
|
||||
const incomingPrefix = 'incoming.f'
|
||||
this.searchConfigService.setParamPrefix(incomingPrefix);
|
||||
this.searchFilterService.setParamPrefix(incomingPrefix);
|
||||
this.filterConfig.paramNamePrefix = incomingPrefix;
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,11 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
||||
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
||||
import { Context } from '../../../../core/shared/context.model';
|
||||
import { AdminNotifySearchConfigurationService } from "../../config/admin-notify-search-configuration.service";
|
||||
import { FILTER_SEARCH } from "../../admin-notify-dashboard.component";
|
||||
import { AdminNotifySearchFilterService } from "../../config/admin-notify-filter-service";
|
||||
import { FILTER_CONFIG } from "../../../../core/shared/search/search-filter.service";
|
||||
import { AdminNotifySearchFilterConfig } from "../../config/admin-notify-search-filter-config";
|
||||
|
||||
|
||||
@Component({
|
||||
@@ -11,10 +15,27 @@ import { Context } from '../../../../core/shared/context.model';
|
||||
providers: [
|
||||
{
|
||||
provide: SEARCH_CONFIG_SERVICE,
|
||||
useClass: SearchConfigurationService
|
||||
useClass: AdminNotifySearchConfigurationService
|
||||
},
|
||||
{
|
||||
provide: FILTER_SEARCH,
|
||||
useClass: AdminNotifySearchFilterService
|
||||
},
|
||||
{
|
||||
provide: FILTER_CONFIG,
|
||||
useClass: AdminNotifySearchFilterConfig
|
||||
}
|
||||
]
|
||||
})
|
||||
export class AdminNotifyOutgoingComponent {
|
||||
protected readonly context = Context.CoarNotify;
|
||||
|
||||
constructor(@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: AdminNotifySearchConfigurationService,
|
||||
@Inject(FILTER_SEARCH) public searchFilterService: AdminNotifySearchFilterService,
|
||||
@Inject(FILTER_CONFIG) public filterConfig: AdminNotifySearchFilterConfig) {
|
||||
const outgoingPrefix = 'outgoing.f'
|
||||
this.searchConfigService.setParamPrefix(outgoingPrefix);
|
||||
this.searchFilterService.setParamPrefix(outgoingPrefix);
|
||||
this.filterConfig.paramNamePrefix = outgoingPrefix;
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<div class="d-flex bg-light w-100 align-items-center">
|
||||
<div class="p-2">{{indexableObject.queueTimeout}}</div>
|
||||
<div class="p-2">{{indexableObject.source}}</div>
|
||||
<div class="p-2">{{indexableObject.target}}</div>
|
||||
<div class="p-2">{{indexableObject.coarNotifyType}}</div>
|
||||
<div class="p-2">{{indexableObject.queueStatusLabel}}</div>
|
||||
<div class="p-2 text-truncate">{{indexableObject.queueTimeout ?? 'n/a'}}</div>
|
||||
<div class="p-2 text-truncate">{{indexableObject.source ?? 'n/a'}}</div>
|
||||
<div class="p-2 text-truncate">{{indexableObject.target ?? 'n/a'}}</div>
|
||||
<div class="p-2 text-truncate">{{indexableObject.coarNotifyType ?? 'n/a'}}</div>
|
||||
<div class="p-2 text-truncate">{{indexableObject.queueStatusLabel ?? 'n/a'}}</div>
|
||||
</div>
|
||||
|
@@ -0,0 +1,35 @@
|
||||
import { typedObject } from '../../../core/cache/builders/build-decorators';
|
||||
import { excludeFromEquals } from '../../../core/utilities/equals.decorators';
|
||||
import { deserialize } from 'cerialize';
|
||||
import { HALLink } from '../../../core/shared/hal-link.model';
|
||||
import { CacheableObject } from '../../../core/cache/cacheable-object.model';
|
||||
import { AdminNotifySearchFilterConfig } from "./admin-notify-search-filter-config";
|
||||
import { FACET_CONFIG_RESPONSE } from "../../../shared/search/models/types/facet-config-response.resouce-type";
|
||||
|
||||
/**
|
||||
* The response from the discover/facets endpoint
|
||||
*/
|
||||
@typedObject
|
||||
export class AdminNotifyFacetConfigResponse implements CacheableObject {
|
||||
static type = FACET_CONFIG_RESPONSE;
|
||||
|
||||
/**
|
||||
* The object type,
|
||||
* hardcoded because rest doesn't a unique one.
|
||||
*/
|
||||
@excludeFromEquals
|
||||
type = FACET_CONFIG_RESPONSE;
|
||||
|
||||
/**
|
||||
* the filters in this response
|
||||
*/
|
||||
filters: AdminNotifySearchFilterConfig[];
|
||||
|
||||
/**
|
||||
* The {@link HALLink}s for this SearchFilterConfig
|
||||
*/
|
||||
@deserialize
|
||||
_links: {
|
||||
self: HALLink;
|
||||
};
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { FacetConfigResponseParsingService } from "../../../core/data/facet-config-response-parsing.service";
|
||||
import { RestRequest } from "../../../core/data/rest-request.model";
|
||||
import { RawRestResponse } from "../../../core/dspace-rest/raw-rest-response.model";
|
||||
import { ParsedResponse } from "../../../core/cache/response.models";
|
||||
import { DSpaceSerializer } from "../../../core/dspace-rest/dspace.serializer";
|
||||
import { AdminNotifySearchFilterConfig } from "./admin-notify-search-filter-config";
|
||||
import { FacetConfigResponse } from "../../../shared/search/models/facet-config-response.model";
|
||||
|
||||
@Injectable()
|
||||
export class AdminNotifyFacetResponseParsingService extends FacetConfigResponseParsingService {
|
||||
parse(request: RestRequest, data: RawRestResponse): ParsedResponse {
|
||||
|
||||
const config = data.payload._embedded.facets;
|
||||
const serializer = new DSpaceSerializer(AdminNotifySearchFilterConfig);
|
||||
const filters = serializer.deserializeArray(config);
|
||||
|
||||
const _links = {
|
||||
self: data.payload._links.self
|
||||
};
|
||||
|
||||
// fill in the missing links section
|
||||
filters.forEach((filterConfig: AdminNotifySearchFilterConfig) => {
|
||||
_links[filterConfig.name] = {
|
||||
href: filterConfig._links.self.href
|
||||
};
|
||||
});
|
||||
|
||||
const facetConfigResponse = Object.assign(new FacetConfigResponse(), {
|
||||
filters,
|
||||
_links
|
||||
});
|
||||
|
||||
this.addToObjectCache(facetConfigResponse, request, data);
|
||||
|
||||
return new ParsedResponse(data.statusCode, facetConfigResponse._links.self);
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
import { Inject, Injectable } from "@angular/core";
|
||||
import { FILTER_CONFIG, SearchFilterService } from "../../../core/shared/search/search-filter.service";
|
||||
import { Store } from "@ngrx/store";
|
||||
import { SearchFiltersState } from "../../../shared/search/search-filters/search-filter/search-filter.reducer";
|
||||
import { RouteService } from "../../../core/services/route.service";
|
||||
import { SearchFilterConfig } from "../../../shared/search/models/search-filter-config.model";
|
||||
|
||||
|
||||
/**
|
||||
* Service that performs all actions that have to do with search filters and facets
|
||||
*/
|
||||
@Injectable()
|
||||
export class AdminNotifySearchFilterService extends SearchFilterService {
|
||||
|
||||
public filterPrefix: string;
|
||||
constructor(protected store: Store<SearchFiltersState>,
|
||||
protected routeService: RouteService) {
|
||||
super(store, routeService)
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the current active filters from the query parameters
|
||||
* @returns {Observable<Params>}
|
||||
*/
|
||||
getCurrentFilters() {
|
||||
return this.routeService.getQueryParamsWithPrefix(`${this.filterPrefix}.`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set prefix to be used for route filters
|
||||
* @param prefix
|
||||
*/
|
||||
setParamPrefix(prefix: string) : void {
|
||||
this.filterPrefix = prefix;
|
||||
}
|
||||
}
|
@@ -0,0 +1,149 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRoute, Params } from '@angular/router';
|
||||
import { combineLatest, Observable } from 'rxjs';
|
||||
import { first, map, take } from 'rxjs/operators';
|
||||
import { SearchConfigurationService } from "../../../core/shared/search/search-configuration.service";
|
||||
import { RouteService } from "../../../core/services/route.service";
|
||||
import { LinkService } from "../../../core/cache/builders/link.service";
|
||||
import { HALEndpointService } from "../../../core/shared/hal-endpoint.service";
|
||||
import { RequestService } from "../../../core/data/request.service";
|
||||
import { RemoteDataBuildService } from "../../../core/cache/builders/remote-data-build.service";
|
||||
import { PaginationService } from "../../../core/pagination/pagination.service";
|
||||
import { DspaceRestResponseParsingService } from "../../../core/data/dspace-rest-response-parsing.service";
|
||||
import { RemoteData } from "../../../core/data/remote-data";
|
||||
import { SearchFilterConfig } from "../../../shared/search/models/search-filter-config.model";
|
||||
import { GetRequest } from "../../../core/data/request.models";
|
||||
import { GenericConstructor } from "../../../core/shared/generic-constructor";
|
||||
import { ResponseParsingService } from "../../../core/data/parsing.service";
|
||||
import { FacetConfigResponseParsingService } from "../../../core/data/facet-config-response-parsing.service";
|
||||
import { FacetConfigResponse } from "../../../shared/search/models/facet-config-response.model";
|
||||
import { hasNoValue, isNotEmpty } from "../../../shared/empty.util";
|
||||
import { AdminNotifyFacetResponseParsingService } from "./admin-notify-facet-response-parsing.service";
|
||||
import { AdminNotifySearchFilterConfig } from "./admin-notify-search-filter-config";
|
||||
import { AdminNotifyFacetConfigResponse } from "./admin-notify-facet-config-response.model";
|
||||
import { SearchFilter } from "../../../shared/search/models/search-filter.model";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Service that performs all actions that have to do with the current admin notify configuration
|
||||
*/
|
||||
@Injectable()
|
||||
export class AdminNotifySearchConfigurationService extends SearchConfigurationService {
|
||||
|
||||
public paramPrefix: string;
|
||||
/**
|
||||
* Initialize class
|
||||
*
|
||||
* @param {RouteService} routeService
|
||||
* @param {PaginationService} paginationService
|
||||
* @param {ActivatedRoute} route
|
||||
* @param linkService
|
||||
* @param halService
|
||||
* @param requestService
|
||||
* @param rdb
|
||||
*/
|
||||
constructor(protected routeService: RouteService,
|
||||
protected paginationService: PaginationService,
|
||||
protected route: ActivatedRoute,
|
||||
protected linkService: LinkService,
|
||||
protected halService: HALEndpointService,
|
||||
protected requestService: RequestService,
|
||||
protected rdb: RemoteDataBuildService) {
|
||||
super(routeService, paginationService, route, linkService, halService, requestService, rdb);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Observable<Params>} Emits the current active filters with their values as they are displayed in the frontend URL
|
||||
*/
|
||||
getCurrentFrontendFilters(): Observable<Params> {
|
||||
return this.routeService.getQueryParamsWithPrefix(`${this.paramPrefix}.`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set prefix to be used for route filters
|
||||
* @param prefix
|
||||
*/
|
||||
setParamPrefix(prefix: string) : void {
|
||||
this.paramPrefix = prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request the filter configuration for a given scope or the whole repository
|
||||
* @param {string} scope UUID of the object for which config the filter config is requested, when no scope is provided the configuration for the whole repository is loaded
|
||||
* @param {string} configurationName the name of the configuration
|
||||
* @returns {Observable<RemoteData<SearchFilterConfig[]>>} The found filter configuration
|
||||
*/
|
||||
getConfig(scope?: string, configurationName?: string): Observable<RemoteData<AdminNotifySearchFilterConfig[]>> {
|
||||
const href$ = this.halService.getEndpoint(this.facetLinkPathPrefix).pipe(
|
||||
map((url: string) => this.getConfigUrl(url, scope, configurationName)),
|
||||
);
|
||||
|
||||
href$.pipe(take(1)).subscribe((url: string) => {
|
||||
let request = new GetRequest(this.requestService.generateRequestId(), url);
|
||||
request = Object.assign(request, {
|
||||
getResponseParser(): GenericConstructor<ResponseParsingService> {
|
||||
return AdminNotifyFacetResponseParsingService;
|
||||
}
|
||||
});
|
||||
this.requestService.send(request, true);
|
||||
});
|
||||
|
||||
return this.rdb.buildFromHref(href$).pipe(
|
||||
map((rd: RemoteData<AdminNotifyFacetConfigResponse>) => {
|
||||
if (rd.hasSucceeded) {
|
||||
let filters: AdminNotifySearchFilterConfig[];
|
||||
if (isNotEmpty(rd.payload.filters)) {
|
||||
filters = rd.payload.filters
|
||||
.map((filter: any) => Object.assign(new AdminNotifySearchFilterConfig(), filter));
|
||||
filters.forEach(filter => filter.namePrefix = this.paramPrefix);
|
||||
} else {
|
||||
filters = [];
|
||||
}
|
||||
|
||||
return new RemoteData(
|
||||
rd.timeCompleted,
|
||||
rd.msToLive,
|
||||
rd.lastUpdated,
|
||||
rd.state,
|
||||
rd.errorMessage,
|
||||
filters,
|
||||
rd.statusCode,
|
||||
);
|
||||
} else {
|
||||
return rd as any as RemoteData<AdminNotifySearchFilterConfig[]>;
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Observable<Params>} Emits the current active filters with their values as they are sent to the backend
|
||||
*/
|
||||
getCurrentFilters(): Observable<SearchFilter[]> {
|
||||
return this.getCurrentFrontendFilters().pipe(map((filterParams) => {
|
||||
if (isNotEmpty(filterParams)) {
|
||||
const filters = [];
|
||||
Object.keys(filterParams).forEach((key) => {
|
||||
// we add one to keep in account the point at the end of the prefix and set back the prefix f.
|
||||
const updatedKey = `f.${key.substring(this.paramPrefix.length + 1, key.length)}`;
|
||||
|
||||
delete Object.assign(filterParams, {[updatedKey]: filterParams[key] })[key];
|
||||
key = updatedKey;
|
||||
if (key.endsWith('.min') || key.endsWith('.max')) {
|
||||
const realKey = key.slice(0, -4);
|
||||
if (hasNoValue(filters.find((f) => f.key === realKey))) {
|
||||
const min = filterParams[realKey + '.min'] ? filterParams[realKey + '.min'][0] : '*';
|
||||
const max = filterParams[realKey + '.max'] ? filterParams[realKey + '.max'][0] : '*';
|
||||
filters.push(new SearchFilter(realKey, ['[' + min + ' TO ' + max + ']'], 'equals'));
|
||||
}
|
||||
} else {
|
||||
filters.push(new SearchFilter(key, filterParams[key]));
|
||||
}
|
||||
});
|
||||
return filters;
|
||||
}
|
||||
return [];
|
||||
}));
|
||||
}
|
||||
}
|
@@ -0,0 +1,90 @@
|
||||
import { typedObject } from '../../../core/cache/builders/build-decorators';
|
||||
import { SearchFilterConfig } from "../../../shared/search/models/search-filter-config.model";
|
||||
import { autoserialize, autoserializeAs, deserialize } from "cerialize";
|
||||
import { HALLink } from "../../../core/shared/hal-link.model";
|
||||
import { excludeFromEquals } from "../../../core/utilities/equals.decorators";
|
||||
import { SEARCH_FILTER_CONFIG } from "../../../shared/search/models/types/search-filter-config.resource-type";
|
||||
import { FilterType } from "../../../shared/search/models/filter-type.model";
|
||||
|
||||
/**
|
||||
* The configuration for a search filter
|
||||
*/
|
||||
@typedObject
|
||||
export class AdminNotifySearchFilterConfig implements SearchFilterConfig {
|
||||
@autoserialize
|
||||
namePrefix: string;
|
||||
|
||||
static type = SEARCH_FILTER_CONFIG;
|
||||
|
||||
/**
|
||||
* The object type,
|
||||
* hardcoded because rest doesn't set one.
|
||||
*/
|
||||
@excludeFromEquals
|
||||
type = SEARCH_FILTER_CONFIG;
|
||||
|
||||
/**
|
||||
* The name of this filter
|
||||
*/
|
||||
@autoserialize
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* The FilterType of this filter
|
||||
*/
|
||||
@autoserializeAs(String, 'facetType')
|
||||
filterType: FilterType;
|
||||
|
||||
/**
|
||||
* True if the filter has facets
|
||||
*/
|
||||
@autoserialize
|
||||
hasFacets: boolean;
|
||||
|
||||
/**
|
||||
* @type {number} The page size used for this facet
|
||||
*/
|
||||
@autoserializeAs(String, 'facetLimit')
|
||||
pageSize = 5;
|
||||
|
||||
/**
|
||||
* Defines if the item facet is collapsed by default or not on the search page
|
||||
*/
|
||||
@autoserialize
|
||||
isOpenByDefault: boolean;
|
||||
|
||||
/**
|
||||
* Minimum value possible for this facet in the repository
|
||||
*/
|
||||
@autoserialize
|
||||
maxValue: string;
|
||||
|
||||
/**
|
||||
* Maximum value possible for this facet in the repository
|
||||
*/
|
||||
@autoserialize
|
||||
minValue: string;
|
||||
|
||||
/**
|
||||
* The {@link HALLink}s for this SearchFilterConfig
|
||||
*/
|
||||
@deserialize
|
||||
_links: {
|
||||
self: HALLink;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set prefix to be used for route filters
|
||||
* @param namePrefix
|
||||
*/
|
||||
set paramNamePrefix(namePrefix: string) {
|
||||
this.namePrefix = namePrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of this configuration that can be used in a url
|
||||
* @returns Parameter name
|
||||
*/
|
||||
get paramName(): string {
|
||||
return `${this.namePrefix}.${this.name}`;
|
||||
}}
|
@@ -198,6 +198,11 @@ import { SubmissionCoarNotifyConfig } from '../submission/sections/section-coar-
|
||||
import { NotifyRequestsStatus } from '../item-page/simple/notify-requests-status/notify-requests-status.model';
|
||||
import { NotifyRequestsStatusDataService } from './data/notify-services-status-data.service';
|
||||
import { AdminNotifyMessage } from '../admin/admin-notify-dashboard/models/admin-notify-message.model';
|
||||
import {
|
||||
AdminNotifyFacetResponseParsingService
|
||||
} from "../admin/admin-notify-dashboard/config/admin-notify-facet-response-parsing.service";
|
||||
import { FILTER_SEARCH } from "../admin/admin-notify-dashboard/admin-notify-dashboard.component";
|
||||
import { AdminNotifySearchFilterService } from "../admin/admin-notify-dashboard/config/admin-notify-filter-service";
|
||||
|
||||
|
||||
/**
|
||||
@@ -230,6 +235,10 @@ const PROVIDERS = [
|
||||
DSOResponseParsingService,
|
||||
{ provide: MOCK_RESPONSE_MAP, useValue: mockResponseMap },
|
||||
{ provide: DspaceRestService, useFactory: restServiceFactory, deps: [MOCK_RESPONSE_MAP, HttpClient] },
|
||||
{
|
||||
provide: FILTER_SEARCH,
|
||||
useClass: SearchFilterService
|
||||
},
|
||||
EPersonDataService,
|
||||
LinkHeadService,
|
||||
HALEndpointService,
|
||||
@@ -245,6 +254,7 @@ const PROVIDERS = [
|
||||
EndpointMapResponseParsingService,
|
||||
FacetValueResponseParsingService,
|
||||
FacetConfigResponseParsingService,
|
||||
AdminNotifyFacetResponseParsingService,
|
||||
DebugResponseParsingService,
|
||||
SearchResponseParsingService,
|
||||
MyDSpaceResponseParsingService,
|
||||
@@ -284,7 +294,7 @@ const PROVIDERS = [
|
||||
SearchService,
|
||||
SidebarService,
|
||||
SearchFilterService,
|
||||
SearchFilterService,
|
||||
AdminNotifySearchFilterService,
|
||||
SearchConfigurationService,
|
||||
SelectableListService,
|
||||
RelationshipTypeDataService,
|
||||
|
@@ -44,7 +44,7 @@ export class SearchConfigurationService implements OnDestroy {
|
||||
/**
|
||||
* Endpoint link path for retrieving facet config incl values
|
||||
*/
|
||||
private facetLinkPathPrefix = 'discover/facets/';
|
||||
protected facetLinkPathPrefix = 'discover/facets/';
|
||||
|
||||
/**
|
||||
* Default pagination id
|
||||
@@ -463,7 +463,7 @@ export class SearchConfigurationService implements OnDestroy {
|
||||
return this.rdb.buildFromHref(href$);
|
||||
}
|
||||
|
||||
private getConfigUrl(url: string, scope?: string, configurationName?: string) {
|
||||
protected getConfigUrl(url: string, scope?: string, configurationName?: string) {
|
||||
const args: string[] = [];
|
||||
|
||||
if (isNotEmpty(scope)) {
|
||||
|
@@ -34,8 +34,8 @@ export const REFRESH_FILTER: InjectionToken<BehaviorSubject<any>> = new Injectio
|
||||
@Injectable()
|
||||
export class SearchFilterService {
|
||||
|
||||
constructor(private store: Store<SearchFiltersState>,
|
||||
private routeService: RouteService) {
|
||||
constructor(protected store: Store<SearchFiltersState>,
|
||||
protected routeService: RouteService) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -162,7 +162,6 @@ export class SearchService implements OnDestroy {
|
||||
getResponseParser: getResponseParserFn,
|
||||
searchOptions: searchOptions
|
||||
});
|
||||
|
||||
this.requestService.send(request, useCachedVersionIfAvailable);
|
||||
});
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { combineLatest as observableCombineLatest, Observable, Subscription } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
|
||||
import { Component, Inject, Input, OnDestroy, OnInit } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { FacetValue } from '../../../../models/facet-value.model';
|
||||
import { SearchFilterConfig } from '../../../../models/search-filter-config.model';
|
||||
@@ -11,6 +11,7 @@ import { hasValue } from '../../../../../empty.util';
|
||||
import { currentPath } from '../../../../../utils/route.utils';
|
||||
import { getFacetValueForType } from '../../../../search.utils';
|
||||
import { PaginationService } from '../../../../../../core/pagination/pagination.service';
|
||||
import { FILTER_SEARCH } from "../../../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component";
|
||||
|
||||
@Component({
|
||||
selector: 'ds-search-facet-option',
|
||||
@@ -64,7 +65,7 @@ export class SearchFacetOptionComponent implements OnInit, OnDestroy {
|
||||
paginationId: string;
|
||||
|
||||
constructor(protected searchService: SearchService,
|
||||
protected filterService: SearchFilterService,
|
||||
@Inject(FILTER_SEARCH) protected filterService: SearchFilterService,
|
||||
protected searchConfigService: SearchConfigurationService,
|
||||
protected router: Router,
|
||||
protected paginationService: PaginationService
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
|
||||
import { Component, Inject, Input, OnDestroy, OnInit } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { FacetValue } from '../../../../models/facet-value.model';
|
||||
import { SearchFilterConfig } from '../../../../models/search-filter-config.model';
|
||||
@@ -14,6 +14,7 @@ import { SearchConfigurationService } from '../../../../../../core/shared/search
|
||||
import { hasValue } from '../../../../../empty.util';
|
||||
import { currentPath } from '../../../../../utils/route.utils';
|
||||
import { PaginationService } from '../../../../../../core/pagination/pagination.service';
|
||||
import { FILTER_SEARCH } from "../../../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component";
|
||||
|
||||
const rangeDelimiter = '-';
|
||||
|
||||
@@ -64,7 +65,7 @@ export class SearchFacetRangeOptionComponent implements OnInit, OnDestroy {
|
||||
searchLink: string;
|
||||
|
||||
constructor(protected searchService: SearchService,
|
||||
protected filterService: SearchFilterService,
|
||||
@Inject(FILTER_SEARCH) protected filterService: SearchFilterService,
|
||||
protected searchConfigService: SearchConfigurationService,
|
||||
protected router: Router,
|
||||
protected paginationService: PaginationService
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { combineLatest as observableCombineLatest, Observable, Subscription } from 'rxjs';
|
||||
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
|
||||
import { Component, Inject, Input, OnDestroy, OnInit } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { SearchFilterConfig } from '../../../../models/search-filter-config.model';
|
||||
import { SearchService } from '../../../../../../core/shared/search/search.service';
|
||||
@@ -10,6 +10,7 @@ import { FacetValue } from '../../../../models/facet-value.model';
|
||||
import { currentPath } from '../../../../../utils/route.utils';
|
||||
import { getFacetValueForType } from '../../../../search.utils';
|
||||
import { PaginationService } from '../../../../../../core/pagination/pagination.service';
|
||||
import { FILTER_SEARCH } from "../../../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component";
|
||||
|
||||
@Component({
|
||||
selector: 'ds-search-facet-selected-option',
|
||||
@@ -57,7 +58,7 @@ export class SearchFacetSelectedOptionComponent implements OnInit, OnDestroy {
|
||||
searchLink: string;
|
||||
|
||||
constructor(protected searchService: SearchService,
|
||||
protected filterService: SearchFilterService,
|
||||
@Inject(FILTER_SEARCH) protected filterService: SearchFilterService,
|
||||
protected searchConfigService: SearchConfigurationService,
|
||||
protected router: Router,
|
||||
protected paginationService: PaginationService
|
||||
|
@@ -35,6 +35,7 @@ import { currentPath } from '../../../../utils/route.utils';
|
||||
import { getFacetValueForType, stripOperatorFromFilterValue } from '../../../search.utils';
|
||||
import { createPendingRemoteDataObject } from '../../../../remote-data.utils';
|
||||
import { FacetValues } from '../../../models/facet-values.model';
|
||||
import { FILTER_SEARCH } from "../../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component";
|
||||
|
||||
@Component({
|
||||
selector: 'ds-search-facet-filter',
|
||||
@@ -98,7 +99,7 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
|
||||
currentUrl: string;
|
||||
|
||||
constructor(protected searchService: SearchService,
|
||||
protected filterService: SearchFilterService,
|
||||
@Inject(FILTER_SEARCH) protected filterService: SearchFilterService,
|
||||
protected rdbs: RemoteDataBuildService,
|
||||
protected router: Router,
|
||||
@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService,
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { Component, Inject, Input, OnInit } from '@angular/core';
|
||||
import { Component, Inject, Input, OnInit, Optional } from '@angular/core';
|
||||
|
||||
import { BehaviorSubject, Observable, of as observableOf } from 'rxjs';
|
||||
import { filter, map, startWith, switchMap, take } from 'rxjs/operators';
|
||||
@@ -11,6 +11,7 @@ import { SearchService } from '../../../../core/shared/search/search.service';
|
||||
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
||||
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
||||
import { SequenceService } from '../../../../core/shared/sequence.service';
|
||||
import { FILTER_SEARCH } from "../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component";
|
||||
|
||||
@Component({
|
||||
selector: 'ds-search-filter',
|
||||
@@ -71,7 +72,7 @@ export class SearchFilterComponent implements OnInit {
|
||||
private readonly sequenceId: number;
|
||||
|
||||
constructor(
|
||||
private filterService: SearchFilterService,
|
||||
@Inject(FILTER_SEARCH) private filterService: SearchFilterService,
|
||||
private searchService: SearchService,
|
||||
@Inject(SEARCH_CONFIG_SERVICE) private searchConfigService: SearchConfigurationService,
|
||||
private sequenceService: SequenceService,
|
||||
|
@@ -26,6 +26,7 @@ import { PageInfo } from '../../../../../core/shared/page-info.model';
|
||||
import { environment } from '../../../../../../environments/environment';
|
||||
import { addOperatorToFilterValue } from '../../../search.utils';
|
||||
import { VocabularyTreeviewModalComponent } from '../../../../form/vocabulary-treeview-modal/vocabulary-treeview-modal.component';
|
||||
import { FILTER_SEARCH } from "../../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component";
|
||||
|
||||
@Component({
|
||||
selector: 'ds-search-hierarchy-filter',
|
||||
@@ -41,7 +42,7 @@ import { VocabularyTreeviewModalComponent } from '../../../../form/vocabulary-tr
|
||||
export class SearchHierarchyFilterComponent extends SearchFacetFilterComponent implements OnInit {
|
||||
|
||||
constructor(protected searchService: SearchService,
|
||||
protected filterService: SearchFilterService,
|
||||
@Inject(FILTER_SEARCH) protected filterService: SearchFilterService,
|
||||
protected rdbs: RemoteDataBuildService,
|
||||
protected router: Router,
|
||||
protected modalService: NgbModal,
|
||||
|
@@ -21,6 +21,7 @@ import { SearchConfigurationService } from '../../../../../core/shared/search/se
|
||||
import { RouteService } from '../../../../../core/services/route.service';
|
||||
import { hasValue } from '../../../../empty.util';
|
||||
import { yearFromString } from 'src/app/shared/date.util';
|
||||
import { FILTER_SEARCH } from "../../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component";
|
||||
|
||||
/**
|
||||
* The suffix for a range filters' minimum in the frontend URL
|
||||
@@ -92,7 +93,7 @@ export class SearchRangeFilterComponent extends SearchFacetFilterComponent imple
|
||||
keyboardControl: boolean;
|
||||
|
||||
constructor(protected searchService: SearchService,
|
||||
protected filterService: SearchFilterService,
|
||||
@Inject(FILTER_SEARCH) protected filterService: SearchFilterService,
|
||||
protected router: Router,
|
||||
protected rdbs: RemoteDataBuildService,
|
||||
private translateService: TranslateService,
|
||||
|
@@ -12,6 +12,7 @@ import { SearchFilterService } from '../../../core/shared/search/search-filter.s
|
||||
import { SEARCH_CONFIG_SERVICE } from '../../../my-dspace-page/my-dspace-page.component';
|
||||
import { currentPath } from '../../utils/route.utils';
|
||||
import { hasValue } from '../../empty.util';
|
||||
import { FILTER_SEARCH } from "../../../admin/admin-notify-dashboard/admin-notify-dashboard.component";
|
||||
|
||||
@Component({
|
||||
selector: 'ds-search-filters',
|
||||
@@ -71,7 +72,7 @@ export class SearchFiltersComponent implements OnInit, OnDestroy {
|
||||
*/
|
||||
constructor(
|
||||
private searchService: SearchService,
|
||||
private filterService: SearchFilterService,
|
||||
@Inject(FILTER_SEARCH) protected filterService: SearchFilterService,
|
||||
private router: Router,
|
||||
@Inject(SEARCH_CONFIG_SERVICE) private searchConfigService: SearchConfigurationService) {
|
||||
}
|
||||
|
Reference in New Issue
Block a user