mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-10 19:43:04 +00:00
Merge remote-tracking branch 'alex-upstream/w2p-130424_impossible-to-add-new-values-for-fields-without-qualifiers_contribute-7.6' into w2p-130424_impossible-to-add-new-values-for-fields-without-qualifiers_contribute-8
This commit is contained in:
@@ -116,6 +116,14 @@ describe('MetadataFieldSelectorComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should sort the fields by name to ensure the one without a qualifier is first', () => {
|
||||||
|
component.mdField = 'dc.relation';
|
||||||
|
|
||||||
|
component.validate();
|
||||||
|
|
||||||
|
expect(registryService.queryMetadataFields).toHaveBeenCalledWith('dc.relation', { elementsPerPage: 10, sort: new SortOptions('fieldName', SortDirection.ASC) }, true, false, followLink('schema'));
|
||||||
|
});
|
||||||
|
|
||||||
describe('when querying the metadata fields returns an error response', () => {
|
describe('when querying the metadata fields returns an error response', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
(registryService.queryMetadataFields as jasmine.Spy).and.returnValue(createFailedRemoteDataObject$('Failed'));
|
(registryService.queryMetadataFields as jasmine.Spy).and.returnValue(createFailedRemoteDataObject$('Failed'));
|
||||||
|
@@ -45,6 +45,7 @@ import {
|
|||||||
SortDirection,
|
SortDirection,
|
||||||
SortOptions,
|
SortOptions,
|
||||||
} from '../../../core/cache/models/sort-options.model';
|
} from '../../../core/cache/models/sort-options.model';
|
||||||
|
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||||
import { RegistryService } from '../../../core/registry/registry.service';
|
import { RegistryService } from '../../../core/registry/registry.service';
|
||||||
import {
|
import {
|
||||||
getAllSucceededRemoteData,
|
getAllSucceededRemoteData,
|
||||||
@@ -129,6 +130,11 @@ export class MetadataFieldSelectorComponent implements OnInit, OnDestroy, AfterV
|
|||||||
*/
|
*/
|
||||||
showInvalid = false;
|
showInvalid = false;
|
||||||
|
|
||||||
|
searchOptions: FindListOptions = {
|
||||||
|
elementsPerPage: 10,
|
||||||
|
sort: new SortOptions('fieldName', SortDirection.ASC),
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subscriptions to unsubscribe from on destroy
|
* Subscriptions to unsubscribe from on destroy
|
||||||
*/
|
*/
|
||||||
@@ -211,7 +217,7 @@ export class MetadataFieldSelectorComponent implements OnInit, OnDestroy, AfterV
|
|||||||
* Upon subscribing to the returned observable, the showInvalid flag is updated accordingly to show the feedback under the input
|
* Upon subscribing to the returned observable, the showInvalid flag is updated accordingly to show the feedback under the input
|
||||||
*/
|
*/
|
||||||
validate(): Observable<boolean> {
|
validate(): Observable<boolean> {
|
||||||
return this.registryService.queryMetadataFields(this.mdField, null, true, false, followLink('schema')).pipe(
|
return this.registryService.queryMetadataFields(this.mdField, this.searchOptions, true, false, followLink('schema')).pipe(
|
||||||
getFirstCompletedRemoteData(),
|
getFirstCompletedRemoteData(),
|
||||||
switchMap((rd) => {
|
switchMap((rd) => {
|
||||||
if (rd.hasSucceeded) {
|
if (rd.hasSucceeded) {
|
||||||
|
Reference in New Issue
Block a user