mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Address feedback
This commit is contained in:
@@ -108,11 +108,14 @@ export class FormService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if form group has an invalid form control
|
||||||
|
* @param formGroup The form group to check
|
||||||
|
*/
|
||||||
public hasValidationErrors(formGroup: FormGroup | FormArray): boolean {
|
public hasValidationErrors(formGroup: FormGroup | FormArray): boolean {
|
||||||
let hasErrors = false;
|
let hasErrors = false;
|
||||||
const fields: string[] = Object.keys(formGroup.controls);
|
const fields: string[] = Object.keys(formGroup.controls);
|
||||||
for (const field of fields) {
|
for (const field of fields) {
|
||||||
// Object.keys(formGroup.controls).forEach((field) => {
|
|
||||||
const control = formGroup.get(field);
|
const control = formGroup.get(field);
|
||||||
if (control instanceof FormControl) {
|
if (control instanceof FormControl) {
|
||||||
hasErrors = !control.valid && control.touched;
|
hasErrors = !control.valid && control.touched;
|
||||||
@@ -122,7 +125,6 @@ export class FormService {
|
|||||||
if (hasErrors) {
|
if (hasErrors) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
return hasErrors;
|
return hasErrors;
|
||||||
}
|
}
|
||||||
|
@@ -162,7 +162,6 @@ export class SubmissionFormComponent implements OnChanges, OnDestroy {
|
|||||||
this.uploadFilesOptions.authToken = this.authService.buildAuthHeader();
|
this.uploadFilesOptions.authToken = this.authService.buildAuthHeader();
|
||||||
this.uploadFilesOptions.url = endpointURL.concat(`/${this.submissionId}`);
|
this.uploadFilesOptions.url = endpointURL.concat(`/${this.submissionId}`);
|
||||||
this.definitionId = this.submissionDefinition.name;
|
this.definitionId = this.submissionDefinition.name;
|
||||||
// const { errors } = item;
|
|
||||||
this.submissionService.dispatchInit(
|
this.submissionService.dispatchInit(
|
||||||
this.collectionId,
|
this.collectionId,
|
||||||
this.submissionId,
|
this.submissionId,
|
||||||
|
@@ -97,12 +97,12 @@ export interface SubmissionSectionObject {
|
|||||||
data: WorkspaceitemSectionDataType;
|
data: WorkspaceitemSectionDataType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of the section's errors to show
|
* The list of the section's errors to show. It contains the error list to display when section is not pristine
|
||||||
*/
|
*/
|
||||||
errorsToShow: SubmissionSectionError[];
|
errorsToShow: SubmissionSectionError[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of the section's errors detected by the server
|
* The list of the section's errors detected by the server. They may not be shown yet if section is pristine
|
||||||
*/
|
*/
|
||||||
serverValidationErrors: SubmissionSectionError[];
|
serverValidationErrors: SubmissionSectionError[];
|
||||||
|
|
||||||
|
@@ -173,6 +173,16 @@ export class SectionsService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of validation errors present in the given section
|
||||||
|
*
|
||||||
|
* @param submissionId
|
||||||
|
* The submission id
|
||||||
|
* @param sectionId
|
||||||
|
* The section id
|
||||||
|
* @param sectionType
|
||||||
|
* The type of section for which retrieve errors
|
||||||
|
*/
|
||||||
getShownSectionErrors(submissionId: string, sectionId: string, sectionType: SectionsType): Observable<SubmissionSectionError[]> {
|
getShownSectionErrors(submissionId: string, sectionId: string, sectionType: SectionsType): Observable<SubmissionSectionError[]> {
|
||||||
let errorsState$: Observable<SubmissionSectionError[]>;
|
let errorsState$: Observable<SubmissionSectionError[]>;
|
||||||
if (sectionType !== SectionsType.SubmissionForm) {
|
if (sectionType !== SectionsType.SubmissionForm) {
|
||||||
@@ -422,9 +432,11 @@ export class SectionsService {
|
|||||||
* @param data
|
* @param data
|
||||||
* The section data
|
* The section data
|
||||||
* @param errorsToShow
|
* @param errorsToShow
|
||||||
* the list of the section's errors to show
|
* The list of the section's errors to show. It contains the error list
|
||||||
|
* to display when section is not pristine
|
||||||
* @param serverValidationErrors
|
* @param serverValidationErrors
|
||||||
* the list of the section errors detected by the server
|
* The list of the section's errors detected by the server.
|
||||||
|
* They may not be shown yet if section is pristine
|
||||||
* @param metadata
|
* @param metadata
|
||||||
* The section metadata
|
* The section metadata
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user