From 4f83eaa53d0df45b01d9465512d8435a42fe65d4 Mon Sep 17 00:00:00 2001 From: "Mark H. Wood" Date: Fri, 21 Apr 2023 09:47:18 -0400 Subject: [PATCH 01/10] Tidy up interface declarations. --- .../sections/upload/file/section-upload-file.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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..fb6f499833 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,4 @@ -import { ChangeDetectorRef, Component, Input, OnChanges, OnInit, ViewChild } from '@angular/core'; +import { ChangeDetectorRef, Component, Input, OnChanges, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { BehaviorSubject, Subscription } from 'rxjs'; import { filter } from 'rxjs/operators'; @@ -27,7 +27,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 From 6adc9a1742b24bcf22da14bf73aad53161e97098 Mon Sep 17 00:00:00 2001 From: "Mark H. Wood" Date: Fri, 21 Apr 2023 09:55:18 -0400 Subject: [PATCH 02/10] Make theme-able. --- .../themed-section-upload-file.component.ts | 93 +++++++++++++++++++ .../upload/section-upload.component.html | 4 +- src/app/submission/submission.module.ts | 2 + 3 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 src/app/submission/sections/upload/file/themed-section-upload-file.component.ts 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({ From 9a8dfc229f0940b2242c577dc5769e50f79aed62 Mon Sep 17 00:00:00 2001 From: Adam Doan Date: Fri, 12 May 2023 13:04:43 +0000 Subject: [PATCH 03/10] Add filter name to search filter button aria-label. --- .../search-filters/search-filter/search-filter.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index 375fc3856a..9f0684fbf3 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -849,6 +849,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 }}", From d54754f78a5c352fb1fa7eb6b5b41f499cfc0a82 Mon Sep 17 00:00:00 2001 From: "Mark H. Wood" Date: Fri, 19 May 2023 13:36:04 -0400 Subject: [PATCH 05/10] Conform to expected ngOnChanges signature; tidy up. --- .../file/section-upload-file.component.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) 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 fb6f499833..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, OnDestroy, 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'; @@ -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; } From 055ed9ba6eb9db49ec3a6e7335936087f9cc2a4d Mon Sep 17 00:00:00 2001 From: "Mark H. Wood" Date: Fri, 19 May 2023 14:00:21 -0400 Subject: [PATCH 06/10] Fix spec broken by signature change. --- .../sections/upload/file/section-upload-file.component.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); }); From 8a93bef98c5db3ba35e00318b1beec2c1ccbec88 Mon Sep 17 00:00:00 2001 From: "Mark H. Wood" Date: Tue, 23 May 2023 13:06:12 -0400 Subject: [PATCH 07/10] Supply a customizable themed version. --- .../file/section-upload-file.component.html | 52 +++++++++++ .../file/section-upload-file.component.scss | 0 .../file/section-upload-file.component.ts | 89 +++++++++++++++++++ src/themes/custom/lazy-theme.module.ts | 2 + 4 files changed, 143 insertions(+) create mode 100644 src/themes/custom/app/submission/sections/upload/file/section-upload-file.component.html create mode 100644 src/themes/custom/app/submission/sections/upload/file/section-upload-file.component.scss create mode 100644 src/themes/custom/app/submission/sections/upload/file/section-upload-file.component.ts 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..8999853d72 --- /dev/null +++ b/src/themes/custom/app/submission/sections/upload/file/section-upload-file.component.html @@ -0,0 +1,52 @@ + +
+
+ + +
+
+
+

{{fileName}} ({{fileData?.sizeBytes | dsFileSize}})

+
+
+ + + + + + + +
+
+ +
+
+
+ + + + + + 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..00431cbbe2 --- /dev/null +++ b/src/themes/custom/app/submission/sections/upload/file/section-upload-file.component.ts @@ -0,0 +1,89 @@ +import { + Component, Input, ViewChild +} from '@angular/core'; + +import { + SubmissionFormsModel +} from 'src/app/core/config/models/config-submission-forms.model'; +import { + SubmissionSectionUploadFileEditComponent +} from 'src/app/submission/sections/upload/file/edit/section-upload-file-edit.component'; +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 { + + /** + * 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; + + /** + * The [[SubmissionSectionUploadFileEditComponent]] reference + * @type {SubmissionSectionUploadFileEditComponent} + */ + @ViewChild(SubmissionSectionUploadFileEditComponent) fileEditComp: SubmissionSectionUploadFileEditComponent; +} diff --git a/src/themes/custom/lazy-theme.module.ts b/src/themes/custom/lazy-theme.module.ts index adf3a888c1..6f442eafcc 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'; const DECLARATIONS = [ FileSectionComponent, @@ -217,6 +218,7 @@ const DECLARATIONS = [ MediaViewerVideoComponent, WorkspaceItemsDeletePageComponent, ThumbnailComponent, + SubmissionSectionUploadFileComponent, ]; @NgModule({ From 8e6268ff84b13b70b0fbfa8c7e36aec5add815ce Mon Sep 17 00:00:00 2001 From: "Mark H. Wood" Date: Thu, 1 Jun 2023 12:16:29 -0400 Subject: [PATCH 08/10] We want an empty template, since not yet used. --- .../file/section-upload-file.component.html | 52 ------------------- 1 file changed, 52 deletions(-) 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 index 8999853d72..e69de29bb2 100644 --- 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 @@ -1,52 +0,0 @@ - -
-
- - -
-
-
-

{{fileName}} ({{fileData?.sizeBytes | dsFileSize}})

-
-
- - - - - - - -
-
- -
-
-
- - - - - - From 97673471f7aadee954bf4a06cd9038c40d1f8a53 Mon Sep 17 00:00:00 2001 From: "Mark H. Wood" Date: Thu, 1 Jun 2023 12:20:59 -0400 Subject: [PATCH 09/10] Remove inherited input declarations. --- .../file/section-upload-file.component.ts | 73 +------------------ 1 file changed, 1 insertion(+), 72 deletions(-) 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 index 00431cbbe2..369af4e36c 100644 --- 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 @@ -1,13 +1,4 @@ -import { - Component, Input, ViewChild -} from '@angular/core'; - -import { - SubmissionFormsModel -} from 'src/app/core/config/models/config-submission-forms.model'; -import { - SubmissionSectionUploadFileEditComponent -} from 'src/app/submission/sections/upload/file/edit/section-upload-file-edit.component'; +import { Component } from '@angular/core'; import { SubmissionSectionUploadFileComponent as BaseComponent } from 'src/app/submission/sections/upload/file/section-upload-file.component'; @@ -24,66 +15,4 @@ import { }) export class SubmissionSectionUploadFileComponent extends BaseComponent { - - /** - * 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; - - /** - * The [[SubmissionSectionUploadFileEditComponent]] reference - * @type {SubmissionSectionUploadFileEditComponent} - */ - @ViewChild(SubmissionSectionUploadFileEditComponent) fileEditComp: SubmissionSectionUploadFileEditComponent; } From da245b88b8bce2bce566b745c7120a816b713dac Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Fri, 2 Jun 2023 12:59:20 +0300 Subject: [PATCH 10/10] src/assets/i18n: fix English permission string The current message is not correct English. Note, there seems to be a mix of "don't" and "do not" language. Perhaps we should harmonize that eventually. --- src/assets/i18n/en.json5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index 93418dc189..b1959c5f95 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -4061,7 +4061,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",