mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
63669: InputModels array for easier iteration
This commit is contained in:
@@ -122,6 +122,11 @@ export class CollectionSourceComponent extends AbstractTrackableComponent implem
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* All input models in a simple array for easier iterations
|
||||||
|
*/
|
||||||
|
inputModels = [this.providerModel, this.setModel, this.formatModel, this.harvestModel];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The dynamic form fields used for editing the content source of a collection
|
* The dynamic form fields used for editing the content source of a collection
|
||||||
* @type {(DynamicInputModel | DynamicTextAreaModel)[]}
|
* @type {(DynamicInputModel | DynamicTextAreaModel)[]}
|
||||||
@@ -269,16 +274,10 @@ export class CollectionSourceComponent extends AbstractTrackableComponent implem
|
|||||||
* Used the update translations of errors and labels on init and on language change
|
* Used the update translations of errors and labels on init and on language change
|
||||||
*/
|
*/
|
||||||
private updateFieldTranslations() {
|
private updateFieldTranslations() {
|
||||||
this.formModel.forEach(
|
this.inputModels.forEach(
|
||||||
(fieldModel: DynamicFormControlModel) => {
|
(fieldModel: DynamicFormControlModel) => {
|
||||||
if (fieldModel instanceof DynamicFormGroupModel) {
|
|
||||||
fieldModel.group.forEach((childModel: DynamicFormControlModel) => {
|
|
||||||
this.updateFieldTranslation(childModel);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.updateFieldTranslation(fieldModel);
|
this.updateFieldTranslation(fieldModel);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -347,15 +346,9 @@ export class CollectionSourceComponent extends AbstractTrackableComponent implem
|
|||||||
* Loop over all inputs and update the Content Source with their value
|
* Loop over all inputs and update the Content Source with their value
|
||||||
*/
|
*/
|
||||||
updateContentSource() {
|
updateContentSource() {
|
||||||
this.formModel.forEach(
|
this.inputModels.forEach(
|
||||||
(fieldModel: DynamicFormGroupModel | DynamicInputModel) => {
|
(fieldModel: DynamicInputModel) => {
|
||||||
if (fieldModel instanceof DynamicFormGroupModel) {
|
this.updateContentSourceField(fieldModel)
|
||||||
fieldModel.group.forEach((childModel: DynamicInputModel) => {
|
|
||||||
this.updateContentSourceField(childModel);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.updateContentSourceField(fieldModel);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
this.saveFieldUpdate();
|
this.saveFieldUpdate();
|
||||||
|
Reference in New Issue
Block a user