diff --git a/src/app/shared/search/search-filters/search-filter/search-filter.component.html b/src/app/shared/search/search-filters/search-filter/search-filter.component.html index 13457cc008..a6fb0021b7 100644 --- a/src/app/shared/search/search-filters/search-filter/search-filter.component.html +++ b/src/app/shared/search/search-filters/search-filter/search-filter.component.html @@ -3,7 +3,7 @@ diff --git a/src/app/submission/sections/upload/file/section-upload-file.component.spec.ts b/src/app/submission/sections/upload/file/section-upload-file.component.spec.ts index 4fea8d3f25..4f62ceef6c 100644 --- a/src/app/submission/sections/upload/file/section-upload-file.component.spec.ts +++ b/src/app/submission/sections/upload/file/section-upload-file.component.spec.ts @@ -175,7 +175,7 @@ describe('SubmissionSectionUploadFileComponent test suite', () => { it('should init file data properly', () => { uploadService.getFileData.and.returnValue(observableOf(fileData)); - comp.ngOnChanges(); + comp.ngOnChanges({}); expect(comp.fileData).toEqual(fileData); }); diff --git a/src/app/submission/sections/upload/file/section-upload-file.component.ts b/src/app/submission/sections/upload/file/section-upload-file.component.ts index a8e05fcf40..26fb9445cb 100644 --- a/src/app/submission/sections/upload/file/section-upload-file.component.ts +++ b/src/app/submission/sections/upload/file/section-upload-file.component.ts @@ -1,4 +1,13 @@ -import { ChangeDetectorRef, Component, Input, OnChanges, OnInit, ViewChild } from '@angular/core'; +import { + ChangeDetectorRef, + Component, + Input, + OnChanges, + OnDestroy, + OnInit, + SimpleChanges, + ViewChild +} from '@angular/core'; import { BehaviorSubject, Subscription } from 'rxjs'; import { filter } from 'rxjs/operators'; @@ -27,7 +36,7 @@ import { NgbModalOptions } from '@ng-bootstrap/ng-bootstrap/modal/modal-config'; styleUrls: ['./section-upload-file.component.scss'], templateUrl: './section-upload-file.component.html', }) -export class SubmissionSectionUploadFileComponent implements OnChanges, OnInit { +export class SubmissionSectionUploadFileComponent implements OnChanges, OnInit, OnDestroy { /** * The list of available access condition @@ -168,13 +177,13 @@ export class SubmissionSectionUploadFileComponent implements OnChanges, OnInit { /** * Retrieve bitstream's metadata */ - ngOnChanges() { + ngOnChanges(changes: SimpleChanges): void { if (this.availableAccessConditionOptions) { // Retrieve file state this.subscriptions.push( this.uploadService - .getFileData(this.submissionId, this.sectionId, this.fileId).pipe( - filter((bitstream) => isNotUndefined(bitstream))) + .getFileData(this.submissionId, this.sectionId, this.fileId) + .pipe(filter((bitstream) => isNotUndefined(bitstream))) .subscribe((bitstream) => { this.fileData = bitstream; } diff --git a/src/app/submission/sections/upload/file/themed-section-upload-file.component.ts b/src/app/submission/sections/upload/file/themed-section-upload-file.component.ts new file mode 100644 index 0000000000..9e0a265c3c --- /dev/null +++ b/src/app/submission/sections/upload/file/themed-section-upload-file.component.ts @@ -0,0 +1,93 @@ +import { Component, Input } from '@angular/core'; +import { SubmissionFormsModel } from 'src/app/core/config/models/config-submission-forms.model'; +import { ThemedComponent } from 'src/app/shared/theme-support/themed.component'; +import { SubmissionSectionUploadFileComponent } from './section-upload-file.component'; + +@Component({ + selector: 'ds-themed-submission-upload-section-file', + styleUrls: [], + templateUrl: '../../../../shared/theme-support/themed.component.html' +}) +export class ThemedSubmissionSectionUploadFileComponent + extends ThemedComponent { + + /** + * The list of available access condition + * @type {Array} + */ + @Input() availableAccessConditionOptions: any[]; + + /** + * The submission id + * @type {string} + */ + @Input() collectionId: string; + + /** + * Define if collection access conditions policy type : + * POLICY_DEFAULT_NO_LIST : is not possible to define additional access group/s for the single file + * POLICY_DEFAULT_WITH_LIST : is possible to define additional access group/s for the single file + * @type {number} + */ + @Input() collectionPolicyType: number; + + /** + * The configuration for the bitstream's metadata form + * @type {SubmissionFormsModel} + */ + @Input() configMetadataForm: SubmissionFormsModel; + + /** + * The bitstream id + * @type {string} + */ + @Input() fileId: string; + + /** + * The bitstream array key + * @type {string} + */ + @Input() fileIndex: string; + + /** + * The bitstream id + * @type {string} + */ + @Input() fileName: string; + + /** + * The section id + * @type {string} + */ + @Input() sectionId: string; + + /** + * The submission id + * @type {string} + */ + @Input() submissionId: string; + + protected inAndOutputNames: (keyof SubmissionSectionUploadFileComponent & keyof this)[] = [ + 'availableAccessConditionOptions', + 'collectionId', + 'collectionPolicyType', + 'configMetadataForm', + 'fileId', + 'fileIndex', + 'fileName', + 'sectionId', + 'submissionId' + ]; + + protected getComponentName(): string { + return 'SubmissionSectionUploadFileComponent'; + } + + protected importThemedComponent(themeName: string): Promise { + return import(`../../../../../themes/${themeName}/app/submission/sections/upload/file/section-upload-file.component`); + } + + protected importUnthemedComponent(): Promise { + return import(`./section-upload-file.component`); + } +} diff --git a/src/app/submission/sections/upload/section-upload.component.html b/src/app/submission/sections/upload/section-upload.component.html index 8a19f66220..b57b454288 100644 --- a/src/app/submission/sections/upload/section-upload.component.html +++ b/src/app/submission/sections/upload/section-upload.component.html @@ -28,7 +28,7 @@ - + [submissionId]="submissionId">

diff --git a/src/app/submission/submission.module.ts b/src/app/submission/submission.module.ts index 91f782225a..cf0ab2b369 100644 --- a/src/app/submission/submission.module.ts +++ b/src/app/submission/submission.module.ts @@ -49,6 +49,7 @@ import { ResearchEntitiesModule } from '../entity-groups/research-entities/resea import { ThemedSubmissionEditComponent } from './edit/themed-submission-edit.component'; import { ThemedSubmissionSubmitComponent } from './submit/themed-submission-submit.component'; import { ThemedSubmissionImportExternalComponent } from './import-external/themed-submission-import-external.component'; +import { ThemedSubmissionSectionUploadFileComponent } from './sections/upload/file/themed-section-upload-file.component'; import { FormModule } from '../shared/form/form.module'; import { NgbAccordionModule, NgbCollapseModule, NgbModalModule } from '@ng-bootstrap/ng-bootstrap'; import { SubmissionSectionAccessesComponent } from './sections/accesses/section-accesses.component'; @@ -104,6 +105,7 @@ const DECLARATIONS = [ PublisherPolicyComponent, PublicationInformationComponent, MetadataInformationComponent, + ThemedSubmissionSectionUploadFileComponent, ]; @NgModule({ diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index b83b52dde4..223c2fce27 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -861,6 +861,8 @@ "browse.startsWith.type_text": "Filter results by typing the first few letters", + "browse.startsWith.input": "Filter", + "browse.title": "Browsing {{ collection }} by {{ field }}{{ startsWith }} {{ value }}", "browse.title.page": "Browsing {{ collection }} by {{ field }} {{ value }}", @@ -4087,7 +4089,7 @@ "submission.general.cancel": "Cancel", - "submission.general.cannot_submit": "You have not the privilege to make a new submission.", + "submission.general.cannot_submit": "You don't have permission to make a new submission.", "submission.general.deposit": "Deposit", diff --git a/src/themes/custom/app/submission/sections/upload/file/section-upload-file.component.html b/src/themes/custom/app/submission/sections/upload/file/section-upload-file.component.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/themes/custom/app/submission/sections/upload/file/section-upload-file.component.scss b/src/themes/custom/app/submission/sections/upload/file/section-upload-file.component.scss new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/themes/custom/app/submission/sections/upload/file/section-upload-file.component.ts b/src/themes/custom/app/submission/sections/upload/file/section-upload-file.component.ts new file mode 100644 index 0000000000..369af4e36c --- /dev/null +++ b/src/themes/custom/app/submission/sections/upload/file/section-upload-file.component.ts @@ -0,0 +1,18 @@ +import { Component } from '@angular/core'; +import { + SubmissionSectionUploadFileComponent as BaseComponent +} from 'src/app/submission/sections/upload/file/section-upload-file.component'; + +/** + * This component represents a single bitstream contained in the submission + */ +@Component({ + selector: 'ds-submission-upload-section-file', + // styleUrls: ['./section-upload-file.component.scss'], + styleUrls: ['../../../../../../../app/submission/sections/upload/file/section-upload-file.component.scss'], + // templateUrl: './section-upload-file.component.html' + templateUrl: '../../../../../../../app/submission/sections/upload/file/section-upload-file.component.html' +}) +export class SubmissionSectionUploadFileComponent + extends BaseComponent { +} diff --git a/src/themes/custom/lazy-theme.module.ts b/src/themes/custom/lazy-theme.module.ts index 96ff93ad43..33a618871b 100644 --- a/src/themes/custom/lazy-theme.module.ts +++ b/src/themes/custom/lazy-theme.module.ts @@ -141,6 +141,7 @@ import { import { NgxGalleryModule } from '@kolkov/ngx-gallery'; import { WorkspaceItemsDeletePageComponent } from './app/workspace-items-delete-page/workspace-items-delete/workspace-items-delete.component'; import { ThumbnailComponent } from './app/thumbnail/thumbnail.component'; +import { SubmissionSectionUploadFileComponent } from './app/submission/sections/upload/file/section-upload-file.component'; import { ItemStatusComponent } from './app/item-page/edit-item-page/item-status/item-status.component'; import { EditBitstreamPageComponent } from './app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component'; import { FormModule } from '../../app/shared/form/form.module'; @@ -220,6 +221,7 @@ const DECLARATIONS = [ MediaViewerVideoComponent, WorkspaceItemsDeletePageComponent, ThumbnailComponent, + SubmissionSectionUploadFileComponent, ItemStatusComponent, EditBitstreamPageComponent, ];