mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
8408 - sort ordering is parametrized and used only when no text query is send.
This commit is contained in:
@@ -310,3 +310,8 @@ info:
|
||||
markdown:
|
||||
enabled: false
|
||||
mathjax: false
|
||||
|
||||
# Default collection/community sorting order at Advanced search, Create/update community and collection when there are not a query.
|
||||
collectionSelectionSort:
|
||||
sortMetadata: "dc.title"
|
||||
sortDirection: "ASC"
|
@@ -1,5 +1,5 @@
|
||||
rest:
|
||||
ssl: true
|
||||
host: api7.dspace.org
|
||||
port: 443
|
||||
ssl: false
|
||||
host: localhost
|
||||
port: 9090
|
||||
nameSpace: /server
|
||||
|
@@ -227,6 +227,8 @@ export class DSOSelectorComponent implements OnInit, OnDestroy {
|
||||
* @param useCache Whether or not to use the cache
|
||||
*/
|
||||
search(query: string, page: number, useCache: boolean = true): Observable<RemoteData<PaginatedList<SearchResult<DSpaceObject>>>> {
|
||||
// default sort is only used when there is not query
|
||||
var efectiveSort=query?null:this.sort;
|
||||
return this.searchService.search(
|
||||
new PaginatedSearchOptions({
|
||||
query: query,
|
||||
@@ -234,7 +236,7 @@ export class DSOSelectorComponent implements OnInit, OnDestroy {
|
||||
pagination: Object.assign({}, this.defaultPagination, {
|
||||
currentPage: page
|
||||
}),
|
||||
sort: this.sort
|
||||
sort: efectiveSort
|
||||
}),
|
||||
null,
|
||||
useCache,
|
||||
|
@@ -12,7 +12,6 @@ import {
|
||||
getCommunityCreateRoute,
|
||||
COMMUNITY_PARENT_PARAMETER
|
||||
} from '../../../../community-page/community-page-routing-paths';
|
||||
import {SortDirection, SortOptions} from '../../../../core/cache/models/sort-options.model';
|
||||
|
||||
/**
|
||||
* Component to wrap a button - for top communities -
|
||||
@@ -31,11 +30,6 @@ export class CreateCommunityParentSelectorComponent extends DSOSelectorModalWrap
|
||||
selectorTypes = [DSpaceObjectType.COMMUNITY];
|
||||
action = SelectorActionType.CREATE;
|
||||
|
||||
/**
|
||||
* Default DSO ordering
|
||||
*/
|
||||
defaultSort = new SortOptions('dc.title', SortDirection.ASC);
|
||||
|
||||
constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute, private router: Router) {
|
||||
super(activeModal, route);
|
||||
}
|
||||
|
@@ -5,7 +5,8 @@ import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { DSpaceObjectType } from '../../../core/shared/dspace-object-type.model';
|
||||
import { hasValue, isNotEmpty } from '../../empty.util';
|
||||
import {SortDirection, SortOptions} from '../../../core/cache/models/sort-options.model';
|
||||
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
|
||||
import { environment } from '../../../../environments/environment';
|
||||
|
||||
export enum SelectorActionType {
|
||||
CREATE = 'create',
|
||||
@@ -53,7 +54,7 @@ export abstract class DSOSelectorModalWrapperComponent implements OnInit {
|
||||
/**
|
||||
* Default DSO ordering
|
||||
*/
|
||||
defaultSort = new SortOptions('dc.title', SortDirection.ASC);
|
||||
defaultSort = new SortOptions(environment.collectionSelectionSort.sortMetadata, environment.collectionSelectionSort.sortDirection as SortDirection);
|
||||
|
||||
constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute) {
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { DSpaceObjectType } from '../../../core/shared/dspace-object-type.model';
|
||||
import { DSOSelectorModalWrapperComponent, SelectorActionType } from '../../dso-selector/modal-wrappers/dso-selector-modal-wrapper.component';
|
||||
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
||||
import {SortDirection, SortOptions} from '../../../core/cache/models/sort-options.model';
|
||||
|
||||
/**
|
||||
* Component to wrap a button - to select the entire repository -
|
||||
* and a list of parent communities - for scope selection
|
||||
@@ -33,11 +33,6 @@ export class ScopeSelectorModalComponent extends DSOSelectorModalWrapperComponen
|
||||
*/
|
||||
scopeChange = new EventEmitter<DSpaceObject>();
|
||||
|
||||
/**
|
||||
* Default DSO ordering
|
||||
*/
|
||||
defaultSort = new SortOptions('dc.title', SortDirection.ASC);
|
||||
|
||||
constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute) {
|
||||
super(activeModal, route);
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@ import { InfoConfig } from './info-config.interface';
|
||||
import { CommunityListConfig } from './community-list-config.interface';
|
||||
import { HomeConfig } from './homepage-config.interface';
|
||||
import { MarkdownConfig } from './markdown-config.interface';
|
||||
import { DiscoverySortConfig } from './discovery-sort.config';
|
||||
|
||||
interface AppConfig extends Config {
|
||||
ui: UIServerConfig;
|
||||
@@ -44,6 +45,7 @@ interface AppConfig extends Config {
|
||||
actuators: ActuatorsConfig
|
||||
info: InfoConfig;
|
||||
markdown: MarkdownConfig;
|
||||
collectionSelectionSort: DiscoverySortConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -20,6 +20,7 @@ import { InfoConfig } from './info-config.interface';
|
||||
import { CommunityListConfig } from './community-list-config.interface';
|
||||
import { HomeConfig } from './homepage-config.interface';
|
||||
import { MarkdownConfig } from './markdown-config.interface';
|
||||
import { DiscoverySortConfig } from './discovery-sort.config';
|
||||
|
||||
export class DefaultAppConfig implements AppConfig {
|
||||
production = false;
|
||||
@@ -385,4 +386,10 @@ export class DefaultAppConfig implements AppConfig {
|
||||
enabled: false,
|
||||
mathjax: false,
|
||||
};
|
||||
|
||||
// Configuration that determines the metadata sorting of community and collection edition and creation when there are not a search query.
|
||||
collectionSelectionSort: DiscoverySortConfig = {
|
||||
sortMetadata:"dc.title",
|
||||
sortDirection:"ASC",
|
||||
};
|
||||
}
|
||||
|
14
src/config/discovery-sort.config.ts
Normal file
14
src/config/discovery-sort.config.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Config } from './config.interface';
|
||||
|
||||
/**
|
||||
* Config that determines a metadata sorting config.
|
||||
* It's created mainly to sort by metadata community and collection edition and creation
|
||||
*/
|
||||
export class DiscoverySortConfig implements Config {
|
||||
|
||||
public sortMetadata: string;
|
||||
/**
|
||||
* ASC / DESC values expected
|
||||
*/
|
||||
public sortDirection: string;
|
||||
}
|
@@ -283,4 +283,8 @@ export const environment: BuildConfig = {
|
||||
enabled: false,
|
||||
mathjax: false,
|
||||
},
|
||||
collectionSelectionSort: {
|
||||
sortMetadata:"dc.title",
|
||||
sortDirection:"ASC",
|
||||
},
|
||||
};
|
||||
|
Reference in New Issue
Block a user