mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 02:24:11 +00:00
Fix hardcoded submission section IDs
This commit is contained in:
@@ -13,6 +13,7 @@ import { UploaderOptions } from '../../../shared/uploader/uploader-options.model
|
||||
import parseSectionErrors from '../../utils/parseSectionErrors';
|
||||
import { SubmissionJsonPatchOperationsService } from '../../../core/submission/submission-json-patch-operations.service';
|
||||
import { WorkspaceItem } from '../../../core/submission/models/workspaceitem.model';
|
||||
import { SectionsType } from '../../sections/sections-type';
|
||||
|
||||
/**
|
||||
* This component represents the drop zone that provides to add files to the submission.
|
||||
@@ -35,12 +36,6 @@ export class SubmissionUploadFilesComponent implements OnChanges {
|
||||
*/
|
||||
@Input() submissionId: string;
|
||||
|
||||
/**
|
||||
* The upload section id
|
||||
* @type {string}
|
||||
*/
|
||||
@Input() sectionId: string;
|
||||
|
||||
/**
|
||||
* The uploader configuration options
|
||||
* @type {UploaderOptions}
|
||||
@@ -110,7 +105,7 @@ export class SubmissionUploadFilesComponent implements OnChanges {
|
||||
* Check if upload functionality is enabled
|
||||
*/
|
||||
ngOnChanges() {
|
||||
this.uploadEnabled = this.sectionService.isSectionAvailable(this.submissionId, this.sectionId);
|
||||
this.uploadEnabled = this.sectionService.isSectionTypeAvailable(this.submissionId, SectionsType.Upload);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -136,14 +131,16 @@ export class SubmissionUploadFilesComponent implements OnChanges {
|
||||
.forEach((sectionId) => {
|
||||
const sectionData = normalizeSectionData(sections[sectionId]);
|
||||
const sectionErrors = errorsList[sectionId];
|
||||
if (sectionId === 'upload') {
|
||||
// Look for errors on upload
|
||||
if ((isEmpty(sectionErrors))) {
|
||||
this.notificationsService.success(null, this.translate.get('submission.sections.upload.upload-successful'));
|
||||
} else {
|
||||
this.notificationsService.error(null, this.translate.get('submission.sections.upload.upload-failed'));
|
||||
this.sectionService.isSectionType(this.submissionId, sectionId, SectionsType.Upload).subscribe((isUpload) => {
|
||||
if (isUpload) {
|
||||
// Look for errors on upload
|
||||
if ((isEmpty(sectionErrors))) {
|
||||
this.notificationsService.success(null, this.translate.get('submission.sections.upload.upload-successful'));
|
||||
} else {
|
||||
this.notificationsService.error(null, this.translate.get('submission.sections.upload.upload-failed'));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
this.sectionService.updateSectionData(this.submissionId, sectionId, sectionData, sectionErrors);
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user