mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33:04 +00:00
Merge pull request #2177 from alexandrevryghem/fix-metadata-fields-containing-dots_contribute-main
Added input validation for new metadata field submissions & fixed some other small bugs
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing';
|
import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing';
|
||||||
|
|
||||||
import { MetadataSchemaFormComponent } from './metadata-schema-form.component';
|
import { MetadataSchemaFormComponent } from './metadata-schema-form.component';
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
@@ -29,14 +28,16 @@ describe('MetadataSchemaFormComponent', () => {
|
|||||||
createFormGroup: () => {
|
createFormGroup: () => {
|
||||||
return {
|
return {
|
||||||
patchValue: () => {
|
patchValue: () => {
|
||||||
}
|
},
|
||||||
|
reset(_value?: any, _options?: { onlySelf?: boolean; emitEvent?: boolean; }): void {
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
/* eslint-enable no-empty, @typescript-eslint/no-empty-function */
|
/* eslint-enable no-empty, @typescript-eslint/no-empty-function */
|
||||||
|
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
TestBed.configureTestingModule({
|
return TestBed.configureTestingModule({
|
||||||
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule],
|
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule],
|
||||||
declarations: [MetadataSchemaFormComponent, EnumKeysPipe],
|
declarations: [MetadataSchemaFormComponent, EnumKeysPipe],
|
||||||
providers: [
|
providers: [
|
||||||
@@ -64,7 +65,7 @@ describe('MetadataSchemaFormComponent', () => {
|
|||||||
const expected = Object.assign(new MetadataSchema(), {
|
const expected = Object.assign(new MetadataSchema(), {
|
||||||
namespace: namespace,
|
namespace: namespace,
|
||||||
prefix: prefix
|
prefix: prefix
|
||||||
});
|
} as MetadataSchema);
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyOn(component.submitForm, 'emit');
|
spyOn(component.submitForm, 'emit');
|
||||||
@@ -79,11 +80,10 @@ describe('MetadataSchemaFormComponent', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should emit a new schema using the correct values', waitForAsync(() => {
|
it('should emit a new schema using the correct values', async () => {
|
||||||
fixture.whenStable().then(() => {
|
await fixture.whenStable();
|
||||||
expect(component.submitForm.emit).toHaveBeenCalledWith(expected);
|
expect(component.submitForm.emit).toHaveBeenCalledWith(expected);
|
||||||
});
|
});
|
||||||
}));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('with an active schema', () => {
|
describe('with an active schema', () => {
|
||||||
@@ -91,7 +91,7 @@ describe('MetadataSchemaFormComponent', () => {
|
|||||||
id: 1,
|
id: 1,
|
||||||
namespace: namespace,
|
namespace: namespace,
|
||||||
prefix: prefix
|
prefix: prefix
|
||||||
});
|
} as MetadataSchema);
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyOn(registryService, 'getActiveMetadataSchema').and.returnValue(observableOf(expectedWithId));
|
spyOn(registryService, 'getActiveMetadataSchema').and.returnValue(observableOf(expectedWithId));
|
||||||
@@ -99,11 +99,10 @@ describe('MetadataSchemaFormComponent', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should edit the existing schema using the correct values', waitForAsync(() => {
|
it('should edit the existing schema using the correct values', async () => {
|
||||||
fixture.whenStable().then(() => {
|
await fixture.whenStable();
|
||||||
expect(component.submitForm.emit).toHaveBeenCalledWith(expectedWithId);
|
expect(component.submitForm.emit).toHaveBeenCalledWith(expectedWithId);
|
||||||
});
|
});
|
||||||
}));
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -77,19 +77,24 @@ export class MetadataSchemaFormComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
combineLatest(
|
combineLatest([
|
||||||
this.translateService.get(`${this.messagePrefix}.name`),
|
this.translateService.get(`${this.messagePrefix}.name`),
|
||||||
this.translateService.get(`${this.messagePrefix}.namespace`)
|
this.translateService.get(`${this.messagePrefix}.namespace`)
|
||||||
).subscribe(([name, namespace]) => {
|
]).subscribe(([name, namespace]) => {
|
||||||
this.name = new DynamicInputModel({
|
this.name = new DynamicInputModel({
|
||||||
id: 'name',
|
id: 'name',
|
||||||
label: name,
|
label: name,
|
||||||
name: 'name',
|
name: 'name',
|
||||||
validators: {
|
validators: {
|
||||||
required: null,
|
required: null,
|
||||||
pattern: '^[^ ,_]{1,32}$'
|
pattern: '^[^. ,]*$',
|
||||||
|
maxLength: 32,
|
||||||
},
|
},
|
||||||
required: true,
|
required: true,
|
||||||
|
errorMessages: {
|
||||||
|
pattern: 'error.validation.metadata.name.invalid-pattern',
|
||||||
|
maxLength: 'error.validation.metadata.name.max-length',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
this.namespace = new DynamicInputModel({
|
this.namespace = new DynamicInputModel({
|
||||||
id: 'namespace',
|
id: 'namespace',
|
||||||
@@ -97,8 +102,12 @@ export class MetadataSchemaFormComponent implements OnInit, OnDestroy {
|
|||||||
name: 'namespace',
|
name: 'namespace',
|
||||||
validators: {
|
validators: {
|
||||||
required: null,
|
required: null,
|
||||||
|
maxLength: 256,
|
||||||
},
|
},
|
||||||
required: true,
|
required: true,
|
||||||
|
errorMessages: {
|
||||||
|
maxLength: 'error.validation.metadata.namespace.max-length',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
this.formModel = [
|
this.formModel = [
|
||||||
new DynamicFormGroupModel(
|
new DynamicFormGroupModel(
|
||||||
@@ -108,13 +117,18 @@ export class MetadataSchemaFormComponent implements OnInit, OnDestroy {
|
|||||||
})
|
})
|
||||||
];
|
];
|
||||||
this.formGroup = this.formBuilderService.createFormGroup(this.formModel);
|
this.formGroup = this.formBuilderService.createFormGroup(this.formModel);
|
||||||
this.registryService.getActiveMetadataSchema().subscribe((schema) => {
|
this.registryService.getActiveMetadataSchema().subscribe((schema: MetadataSchema) => {
|
||||||
this.formGroup.patchValue({
|
if (schema == null) {
|
||||||
metadatadataschemagroup:{
|
this.clearFields();
|
||||||
name: schema != null ? schema.prefix : '',
|
} else {
|
||||||
namespace: schema != null ? schema.namespace : ''
|
this.formGroup.patchValue({
|
||||||
}
|
metadatadataschemagroup: {
|
||||||
});
|
name: schema.prefix,
|
||||||
|
namespace: schema.namespace,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
this.name.disabled = true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -132,10 +146,10 @@ export class MetadataSchemaFormComponent implements OnInit, OnDestroy {
|
|||||||
* When the schema has no id attached -> Create new schema
|
* When the schema has no id attached -> Create new schema
|
||||||
* Emit the updated/created schema using the EventEmitter submitForm
|
* Emit the updated/created schema using the EventEmitter submitForm
|
||||||
*/
|
*/
|
||||||
onSubmit() {
|
onSubmit(): void {
|
||||||
this.registryService.clearMetadataSchemaRequests().subscribe();
|
this.registryService.clearMetadataSchemaRequests().subscribe();
|
||||||
this.registryService.getActiveMetadataSchema().pipe(take(1)).subscribe(
|
this.registryService.getActiveMetadataSchema().pipe(take(1)).subscribe(
|
||||||
(schema) => {
|
(schema: MetadataSchema) => {
|
||||||
const values = {
|
const values = {
|
||||||
prefix: this.name.value,
|
prefix: this.name.value,
|
||||||
namespace: this.namespace.value
|
namespace: this.namespace.value
|
||||||
@@ -147,9 +161,9 @@ export class MetadataSchemaFormComponent implements OnInit, OnDestroy {
|
|||||||
} else {
|
} else {
|
||||||
this.registryService.createOrUpdateMetadataSchema(Object.assign(new MetadataSchema(), schema, {
|
this.registryService.createOrUpdateMetadataSchema(Object.assign(new MetadataSchema(), schema, {
|
||||||
id: schema.id,
|
id: schema.id,
|
||||||
prefix: (values.prefix ? values.prefix : schema.prefix),
|
prefix: schema.prefix,
|
||||||
namespace: (values.namespace ? values.namespace : schema.namespace)
|
namespace: values.namespace,
|
||||||
})).subscribe((updatedSchema) => {
|
})).subscribe((updatedSchema: MetadataSchema) => {
|
||||||
this.submitForm.emit(updatedSchema);
|
this.submitForm.emit(updatedSchema);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -162,13 +176,9 @@ export class MetadataSchemaFormComponent implements OnInit, OnDestroy {
|
|||||||
/**
|
/**
|
||||||
* Reset all input-fields to be empty
|
* Reset all input-fields to be empty
|
||||||
*/
|
*/
|
||||||
clearFields() {
|
clearFields(): void {
|
||||||
this.formGroup.patchValue({
|
this.formGroup.reset('metadatadataschemagroup');
|
||||||
metadatadataschemagroup:{
|
this.name.disabled = false;
|
||||||
prefix: '',
|
|
||||||
namespace: ''
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -39,14 +39,16 @@ describe('MetadataFieldFormComponent', () => {
|
|||||||
createFormGroup: () => {
|
createFormGroup: () => {
|
||||||
return {
|
return {
|
||||||
patchValue: () => {
|
patchValue: () => {
|
||||||
}
|
},
|
||||||
|
reset(_value?: any, _options?: { onlySelf?: boolean; emitEvent?: boolean; }): void {
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
/* eslint-enable no-empty, @typescript-eslint/no-empty-function */
|
/* eslint-enable no-empty, @typescript-eslint/no-empty-function */
|
||||||
|
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
TestBed.configureTestingModule({
|
return TestBed.configureTestingModule({
|
||||||
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule],
|
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule],
|
||||||
declarations: [MetadataFieldFormComponent, EnumKeysPipe],
|
declarations: [MetadataFieldFormComponent, EnumKeysPipe],
|
||||||
providers: [
|
providers: [
|
||||||
@@ -98,11 +100,10 @@ describe('MetadataFieldFormComponent', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should emit a new field using the correct values', waitForAsync(() => {
|
it('should emit a new field using the correct values', async () => {
|
||||||
fixture.whenStable().then(() => {
|
await fixture.whenStable();
|
||||||
expect(component.submitForm.emit).toHaveBeenCalledWith(expected);
|
expect(component.submitForm.emit).toHaveBeenCalledWith(expected);
|
||||||
});
|
});
|
||||||
}));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('with an active field', () => {
|
describe('with an active field', () => {
|
||||||
@@ -120,11 +121,10 @@ describe('MetadataFieldFormComponent', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should edit the existing field using the correct values', waitForAsync(() => {
|
it('should edit the existing field using the correct values', async () => {
|
||||||
fixture.whenStable().then(() => {
|
await fixture.whenStable();
|
||||||
expect(component.submitForm.emit).toHaveBeenCalledWith(expectedWithId);
|
expect(component.submitForm.emit).toHaveBeenCalledWith(expectedWithId);
|
||||||
});
|
});
|
||||||
}));
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -98,25 +98,39 @@ export class MetadataFieldFormComponent implements OnInit, OnDestroy {
|
|||||||
* Initialize the component, setting up the necessary Models for the dynamic form
|
* Initialize the component, setting up the necessary Models for the dynamic form
|
||||||
*/
|
*/
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
combineLatest(
|
combineLatest([
|
||||||
this.translateService.get(`${this.messagePrefix}.element`),
|
this.translateService.get(`${this.messagePrefix}.element`),
|
||||||
this.translateService.get(`${this.messagePrefix}.qualifier`),
|
this.translateService.get(`${this.messagePrefix}.qualifier`),
|
||||||
this.translateService.get(`${this.messagePrefix}.scopenote`)
|
this.translateService.get(`${this.messagePrefix}.scopenote`)
|
||||||
).subscribe(([element, qualifier, scopenote]) => {
|
]).subscribe(([element, qualifier, scopenote]) => {
|
||||||
this.element = new DynamicInputModel({
|
this.element = new DynamicInputModel({
|
||||||
id: 'element',
|
id: 'element',
|
||||||
label: element,
|
label: element,
|
||||||
name: 'element',
|
name: 'element',
|
||||||
validators: {
|
validators: {
|
||||||
required: null,
|
required: null,
|
||||||
|
pattern: '^[^. ,]*$',
|
||||||
|
maxLength: 64,
|
||||||
},
|
},
|
||||||
required: true,
|
required: true,
|
||||||
|
errorMessages: {
|
||||||
|
pattern: 'error.validation.metadata.element.invalid-pattern',
|
||||||
|
maxLength: 'error.validation.metadata.element.max-length',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
this.qualifier = new DynamicInputModel({
|
this.qualifier = new DynamicInputModel({
|
||||||
id: 'qualifier',
|
id: 'qualifier',
|
||||||
label: qualifier,
|
label: qualifier,
|
||||||
name: 'qualifier',
|
name: 'qualifier',
|
||||||
|
validators: {
|
||||||
|
pattern: '^[^. ,]*$',
|
||||||
|
maxLength: 64,
|
||||||
|
},
|
||||||
required: false,
|
required: false,
|
||||||
|
errorMessages: {
|
||||||
|
pattern: 'error.validation.metadata.qualifier.invalid-pattern',
|
||||||
|
maxLength: 'error.validation.metadata.qualifier.max-length',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
this.scopeNote = new DynamicInputModel({
|
this.scopeNote = new DynamicInputModel({
|
||||||
id: 'scopeNote',
|
id: 'scopeNote',
|
||||||
@@ -132,14 +146,20 @@ export class MetadataFieldFormComponent implements OnInit, OnDestroy {
|
|||||||
})
|
})
|
||||||
];
|
];
|
||||||
this.formGroup = this.formBuilderService.createFormGroup(this.formModel);
|
this.formGroup = this.formBuilderService.createFormGroup(this.formModel);
|
||||||
this.registryService.getActiveMetadataField().subscribe((field) => {
|
this.registryService.getActiveMetadataField().subscribe((field: MetadataField): void => {
|
||||||
this.formGroup.patchValue({
|
if (field == null) {
|
||||||
metadatadatafieldgroup: {
|
this.clearFields();
|
||||||
element: field != null ? field.element : '',
|
} else {
|
||||||
qualifier: field != null ? field.qualifier : '',
|
this.formGroup.patchValue({
|
||||||
scopeNote: field != null ? field.scopeNote : ''
|
metadatadatafieldgroup: {
|
||||||
}
|
element: field.element,
|
||||||
});
|
qualifier: field.qualifier,
|
||||||
|
scopeNote: field.scopeNote,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
this.element.disabled = true;
|
||||||
|
this.qualifier.disabled = true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -157,25 +177,24 @@ export class MetadataFieldFormComponent implements OnInit, OnDestroy {
|
|||||||
* When the field has no id attached -> Create new field
|
* When the field has no id attached -> Create new field
|
||||||
* Emit the updated/created field using the EventEmitter submitForm
|
* Emit the updated/created field using the EventEmitter submitForm
|
||||||
*/
|
*/
|
||||||
onSubmit() {
|
onSubmit(): void {
|
||||||
this.registryService.getActiveMetadataField().pipe(take(1)).subscribe(
|
this.registryService.getActiveMetadataField().pipe(take(1)).subscribe(
|
||||||
(field) => {
|
(field: MetadataField) => {
|
||||||
const values = {
|
|
||||||
element: this.element.value,
|
|
||||||
qualifier: this.qualifier.value,
|
|
||||||
scopeNote: this.scopeNote.value
|
|
||||||
};
|
|
||||||
if (field == null) {
|
if (field == null) {
|
||||||
this.registryService.createMetadataField(Object.assign(new MetadataField(), values), this.metadataSchema).subscribe((newField) => {
|
this.registryService.createMetadataField(Object.assign(new MetadataField(), {
|
||||||
|
element: this.element.value,
|
||||||
|
qualifier: this.qualifier.value,
|
||||||
|
scopeNote: this.scopeNote.value,
|
||||||
|
}), this.metadataSchema).subscribe((newField: MetadataField) => {
|
||||||
this.submitForm.emit(newField);
|
this.submitForm.emit(newField);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.registryService.updateMetadataField(Object.assign(new MetadataField(), field, {
|
this.registryService.updateMetadataField(Object.assign(new MetadataField(), field, {
|
||||||
id: field.id,
|
id: field.id,
|
||||||
element: (values.element ? values.element : field.element),
|
element: field.element,
|
||||||
qualifier: (values.qualifier ? values.qualifier : field.qualifier),
|
qualifier: field.qualifier,
|
||||||
scopeNote: (values.scopeNote ? values.scopeNote : field.scopeNote)
|
scopeNote: this.scopeNote.value,
|
||||||
})).subscribe((updatedField) => {
|
})).subscribe((updatedField: MetadataField) => {
|
||||||
this.submitForm.emit(updatedField);
|
this.submitForm.emit(updatedField);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -188,14 +207,10 @@ export class MetadataFieldFormComponent implements OnInit, OnDestroy {
|
|||||||
/**
|
/**
|
||||||
* Reset all input-fields to be empty
|
* Reset all input-fields to be empty
|
||||||
*/
|
*/
|
||||||
clearFields() {
|
clearFields(): void {
|
||||||
this.formGroup.patchValue({
|
this.formGroup.reset('metadatadatafieldgroup');
|
||||||
metadatadatafieldgroup: {
|
this.element.disabled = false;
|
||||||
element: '',
|
this.qualifier.disabled = false;
|
||||||
qualifier: '',
|
|
||||||
scopeNote: ''
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -12,6 +12,7 @@ import { createPaginatedList } from '../../../shared/testing/utils.test';
|
|||||||
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
|
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
|
||||||
|
|
||||||
describe('MetadataFieldSelectorComponent', () => {
|
describe('MetadataFieldSelectorComponent', () => {
|
||||||
let component: MetadataFieldSelectorComponent;
|
let component: MetadataFieldSelectorComponent;
|
||||||
@@ -79,7 +80,7 @@ describe('MetadataFieldSelectorComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should query the registry service for metadata fields and include the schema', () => {
|
it('should query the registry service for metadata fields and include the schema', () => {
|
||||||
expect(registryService.queryMetadataFields).toHaveBeenCalledWith(query, null, true, false, followLink('schema'));
|
expect(registryService.queryMetadataFields).toHaveBeenCalledWith(query, { elementsPerPage: 10, sort: new SortOptions('fieldName', SortDirection.ASC) }, true, false, followLink('schema'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -9,10 +9,11 @@ import {
|
|||||||
Output,
|
Output,
|
||||||
ViewChild
|
ViewChild
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { switchMap, debounceTime, distinctUntilChanged, map, tap, take } from 'rxjs/operators';
|
import { debounceTime, distinctUntilChanged, map, switchMap, take, tap } from 'rxjs/operators';
|
||||||
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
||||||
import {
|
import {
|
||||||
getAllSucceededRemoteData, getFirstCompletedRemoteData,
|
getAllSucceededRemoteData,
|
||||||
|
getFirstCompletedRemoteData,
|
||||||
metadataFieldsToString
|
metadataFieldsToString
|
||||||
} from '../../../core/shared/operators';
|
} from '../../../core/shared/operators';
|
||||||
import { Observable } from 'rxjs/internal/Observable';
|
import { Observable } from 'rxjs/internal/Observable';
|
||||||
@@ -24,6 +25,7 @@ import { Subscription } from 'rxjs/internal/Subscription';
|
|||||||
import { of } from 'rxjs/internal/observable/of';
|
import { of } from 'rxjs/internal/observable/of';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-metadata-field-selector',
|
selector: 'ds-metadata-field-selector',
|
||||||
@@ -127,7 +129,7 @@ export class MetadataFieldSelectorComponent implements OnInit, OnDestroy, AfterV
|
|||||||
switchMap((query: string) => {
|
switchMap((query: string) => {
|
||||||
this.showInvalid = false;
|
this.showInvalid = false;
|
||||||
if (query !== null) {
|
if (query !== null) {
|
||||||
return this.registryService.queryMetadataFields(query, null, true, false, followLink('schema')).pipe(
|
return this.registryService.queryMetadataFields(query, { elementsPerPage: 10, sort: new SortOptions('fieldName', SortDirection.ASC) }, true, false, followLink('schema')).pipe(
|
||||||
getAllSucceededRemoteData(),
|
getAllSucceededRemoteData(),
|
||||||
metadataFieldsToString(),
|
metadataFieldsToString(),
|
||||||
);
|
);
|
||||||
|
@@ -1628,6 +1628,19 @@
|
|||||||
|
|
||||||
"error.validation.groupExists": "This group already exists",
|
"error.validation.groupExists": "This group already exists",
|
||||||
|
|
||||||
|
"error.validation.metadata.name.invalid-pattern": "This field cannot contain dots, commas or spaces. Please use the Element & Qualifier fields instead",
|
||||||
|
|
||||||
|
"error.validation.metadata.name.max-length": "This field may not contain more than 32 characters",
|
||||||
|
|
||||||
|
"error.validation.metadata.namespace.max-length": "This field may not contain more than 256 characters",
|
||||||
|
|
||||||
|
"error.validation.metadata.element.invalid-pattern": "This field cannot contain dots, commas or spaces. Please use the Qualifier field instead",
|
||||||
|
|
||||||
|
"error.validation.metadata.element.max-length": "This field may not contain more than 64 characters",
|
||||||
|
|
||||||
|
"error.validation.metadata.qualifier.invalid-pattern": "This field cannot contain dots, commas or spaces",
|
||||||
|
|
||||||
|
"error.validation.metadata.qualifier.max-length": "This field may not contain more than 64 characters",
|
||||||
|
|
||||||
"feed.description": "Syndication feed",
|
"feed.description": "Syndication feed",
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user