mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-10 11:33:04 +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:
|
markdown:
|
||||||
enabled: false
|
enabled: false
|
||||||
mathjax: 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:
|
rest:
|
||||||
ssl: true
|
ssl: false
|
||||||
host: api7.dspace.org
|
host: localhost
|
||||||
port: 443
|
port: 9090
|
||||||
nameSpace: /server
|
nameSpace: /server
|
||||||
|
@@ -227,6 +227,8 @@ export class DSOSelectorComponent implements OnInit, OnDestroy {
|
|||||||
* @param useCache Whether or not to use the cache
|
* @param useCache Whether or not to use the cache
|
||||||
*/
|
*/
|
||||||
search(query: string, page: number, useCache: boolean = true): Observable<RemoteData<PaginatedList<SearchResult<DSpaceObject>>>> {
|
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(
|
return this.searchService.search(
|
||||||
new PaginatedSearchOptions({
|
new PaginatedSearchOptions({
|
||||||
query: query,
|
query: query,
|
||||||
@@ -234,7 +236,7 @@ export class DSOSelectorComponent implements OnInit, OnDestroy {
|
|||||||
pagination: Object.assign({}, this.defaultPagination, {
|
pagination: Object.assign({}, this.defaultPagination, {
|
||||||
currentPage: page
|
currentPage: page
|
||||||
}),
|
}),
|
||||||
sort: this.sort
|
sort: efectiveSort
|
||||||
}),
|
}),
|
||||||
null,
|
null,
|
||||||
useCache,
|
useCache,
|
||||||
|
@@ -12,7 +12,6 @@ import {
|
|||||||
getCommunityCreateRoute,
|
getCommunityCreateRoute,
|
||||||
COMMUNITY_PARENT_PARAMETER
|
COMMUNITY_PARENT_PARAMETER
|
||||||
} from '../../../../community-page/community-page-routing-paths';
|
} 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 -
|
* Component to wrap a button - for top communities -
|
||||||
@@ -31,11 +30,6 @@ export class CreateCommunityParentSelectorComponent extends DSOSelectorModalWrap
|
|||||||
selectorTypes = [DSpaceObjectType.COMMUNITY];
|
selectorTypes = [DSpaceObjectType.COMMUNITY];
|
||||||
action = SelectorActionType.CREATE;
|
action = SelectorActionType.CREATE;
|
||||||
|
|
||||||
/**
|
|
||||||
* Default DSO ordering
|
|
||||||
*/
|
|
||||||
defaultSort = new SortOptions('dc.title', SortDirection.ASC);
|
|
||||||
|
|
||||||
constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute, private router: Router) {
|
constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute, private router: Router) {
|
||||||
super(activeModal, route);
|
super(activeModal, route);
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,8 @@ import { RemoteData } from '../../../core/data/remote-data';
|
|||||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { DSpaceObjectType } from '../../../core/shared/dspace-object-type.model';
|
import { DSpaceObjectType } from '../../../core/shared/dspace-object-type.model';
|
||||||
import { hasValue, isNotEmpty } from '../../empty.util';
|
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 {
|
export enum SelectorActionType {
|
||||||
CREATE = 'create',
|
CREATE = 'create',
|
||||||
@@ -53,7 +54,7 @@ export abstract class DSOSelectorModalWrapperComponent implements OnInit {
|
|||||||
/**
|
/**
|
||||||
* Default DSO ordering
|
* 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) {
|
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 { DSpaceObjectType } from '../../../core/shared/dspace-object-type.model';
|
||||||
import { DSOSelectorModalWrapperComponent, SelectorActionType } from '../../dso-selector/modal-wrappers/dso-selector-modal-wrapper.component';
|
import { DSOSelectorModalWrapperComponent, SelectorActionType } from '../../dso-selector/modal-wrappers/dso-selector-modal-wrapper.component';
|
||||||
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
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 -
|
* Component to wrap a button - to select the entire repository -
|
||||||
* and a list of parent communities - for scope selection
|
* and a list of parent communities - for scope selection
|
||||||
@@ -33,11 +33,6 @@ export class ScopeSelectorModalComponent extends DSOSelectorModalWrapperComponen
|
|||||||
*/
|
*/
|
||||||
scopeChange = new EventEmitter<DSpaceObject>();
|
scopeChange = new EventEmitter<DSpaceObject>();
|
||||||
|
|
||||||
/**
|
|
||||||
* Default DSO ordering
|
|
||||||
*/
|
|
||||||
defaultSort = new SortOptions('dc.title', SortDirection.ASC);
|
|
||||||
|
|
||||||
constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute) {
|
constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute) {
|
||||||
super(activeModal, route);
|
super(activeModal, route);
|
||||||
}
|
}
|
||||||
|
@@ -20,6 +20,7 @@ import { InfoConfig } from './info-config.interface';
|
|||||||
import { CommunityListConfig } from './community-list-config.interface';
|
import { CommunityListConfig } from './community-list-config.interface';
|
||||||
import { HomeConfig } from './homepage-config.interface';
|
import { HomeConfig } from './homepage-config.interface';
|
||||||
import { MarkdownConfig } from './markdown-config.interface';
|
import { MarkdownConfig } from './markdown-config.interface';
|
||||||
|
import { DiscoverySortConfig } from './discovery-sort.config';
|
||||||
|
|
||||||
interface AppConfig extends Config {
|
interface AppConfig extends Config {
|
||||||
ui: UIServerConfig;
|
ui: UIServerConfig;
|
||||||
@@ -44,6 +45,7 @@ interface AppConfig extends Config {
|
|||||||
actuators: ActuatorsConfig
|
actuators: ActuatorsConfig
|
||||||
info: InfoConfig;
|
info: InfoConfig;
|
||||||
markdown: MarkdownConfig;
|
markdown: MarkdownConfig;
|
||||||
|
collectionSelectionSort: DiscoverySortConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -20,6 +20,7 @@ import { InfoConfig } from './info-config.interface';
|
|||||||
import { CommunityListConfig } from './community-list-config.interface';
|
import { CommunityListConfig } from './community-list-config.interface';
|
||||||
import { HomeConfig } from './homepage-config.interface';
|
import { HomeConfig } from './homepage-config.interface';
|
||||||
import { MarkdownConfig } from './markdown-config.interface';
|
import { MarkdownConfig } from './markdown-config.interface';
|
||||||
|
import { DiscoverySortConfig } from './discovery-sort.config';
|
||||||
|
|
||||||
export class DefaultAppConfig implements AppConfig {
|
export class DefaultAppConfig implements AppConfig {
|
||||||
production = false;
|
production = false;
|
||||||
@@ -385,4 +386,10 @@ export class DefaultAppConfig implements AppConfig {
|
|||||||
enabled: false,
|
enabled: false,
|
||||||
mathjax: 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,
|
enabled: false,
|
||||||
mathjax: false,
|
mathjax: false,
|
||||||
},
|
},
|
||||||
|
collectionSelectionSort: {
|
||||||
|
sortMetadata:"dc.title",
|
||||||
|
sortDirection:"ASC",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user