From c3d71cbdd615ff707482852fd3d76f688950e1f1 Mon Sep 17 00:00:00 2001 From: Kristof De Langhe Date: Wed, 11 Jan 2023 14:18:20 +0100 Subject: [PATCH 01/20] 98422: Themed ItemStatusComponent and EditBitstreamPageComponent --- .../bitstream-page-routing.module.ts | 4 ++-- .../bitstream-page/bitstream-page.module.ts | 4 +++- .../themed-edit-bitstream-page.component.ts | 22 ++++++++++++++++++ .../edit-item-page/edit-item-page.module.ts | 2 ++ .../edit-item-page.routing.module.ts | 4 ++-- .../themed-item-status.component.ts | 23 +++++++++++++++++++ .../edit-bitstream-page.component.html | 0 .../edit-bitstream-page.component.scss | 0 .../edit-bitstream-page.component.ts | 13 +++++++++++ .../item-status/item-status.component.html | 0 .../item-status/item-status.component.ts | 16 +++++++++++++ src/themes/custom/theme.module.ts | 6 ++++- 12 files changed, 88 insertions(+), 6 deletions(-) create mode 100644 src/app/bitstream-page/edit-bitstream-page/themed-edit-bitstream-page.component.ts create mode 100644 src/app/item-page/edit-item-page/item-status/themed-item-status.component.ts create mode 100644 src/themes/custom/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.html create mode 100644 src/themes/custom/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.scss create mode 100644 src/themes/custom/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts create mode 100644 src/themes/custom/app/item-page/edit-item-page/item-status/item-status.component.html create mode 100644 src/themes/custom/app/item-page/edit-item-page/item-status/item-status.component.ts diff --git a/src/app/bitstream-page/bitstream-page-routing.module.ts b/src/app/bitstream-page/bitstream-page-routing.module.ts index 27b9db9a05..bab5e91467 100644 --- a/src/app/bitstream-page/bitstream-page-routing.module.ts +++ b/src/app/bitstream-page/bitstream-page-routing.module.ts @@ -1,6 +1,5 @@ import { NgModule } from '@angular/core'; import { RouterModule } from '@angular/router'; -import { EditBitstreamPageComponent } from './edit-bitstream-page/edit-bitstream-page.component'; import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; import { BitstreamPageResolver } from './bitstream-page.resolver'; import { BitstreamDownloadPageComponent } from '../shared/bitstream-download-page/bitstream-download-page.component'; @@ -10,6 +9,7 @@ import { ResourcePolicyResolver } from '../shared/resource-policies/resolvers/re import { ResourcePolicyEditComponent } from '../shared/resource-policies/edit/resource-policy-edit.component'; import { BitstreamAuthorizationsComponent } from './bitstream-authorizations/bitstream-authorizations.component'; import { LegacyBitstreamUrlResolver } from './legacy-bitstream-url.resolver'; +import { ThemedEditBitstreamPageComponent } from './edit-bitstream-page/themed-edit-bitstream-page.component'; const EDIT_BITSTREAM_PATH = ':id/edit'; const EDIT_BITSTREAM_AUTHORIZATIONS_PATH = ':id/authorizations'; @@ -46,7 +46,7 @@ const EDIT_BITSTREAM_AUTHORIZATIONS_PATH = ':id/authorizations'; }, { path: EDIT_BITSTREAM_PATH, - component: EditBitstreamPageComponent, + component: ThemedEditBitstreamPageComponent, resolve: { bitstream: BitstreamPageResolver }, diff --git a/src/app/bitstream-page/bitstream-page.module.ts b/src/app/bitstream-page/bitstream-page.module.ts index d168a06db2..ea8ed510e1 100644 --- a/src/app/bitstream-page/bitstream-page.module.ts +++ b/src/app/bitstream-page/bitstream-page.module.ts @@ -6,6 +6,7 @@ import { BitstreamPageRoutingModule } from './bitstream-page-routing.module'; import { BitstreamAuthorizationsComponent } from './bitstream-authorizations/bitstream-authorizations.component'; import { FormModule } from '../shared/form/form.module'; import { ResourcePoliciesModule } from '../shared/resource-policies/resource-policies.module'; +import { ThemedEditBitstreamPageComponent } from './edit-bitstream-page/themed-edit-bitstream-page.component'; /** * This module handles all components that are necessary for Bitstream related pages @@ -20,7 +21,8 @@ import { ResourcePoliciesModule } from '../shared/resource-policies/resource-pol ], declarations: [ BitstreamAuthorizationsComponent, - EditBitstreamPageComponent + EditBitstreamPageComponent, + ThemedEditBitstreamPageComponent, ] }) export class BitstreamPageModule { diff --git a/src/app/bitstream-page/edit-bitstream-page/themed-edit-bitstream-page.component.ts b/src/app/bitstream-page/edit-bitstream-page/themed-edit-bitstream-page.component.ts new file mode 100644 index 0000000000..dcca28a495 --- /dev/null +++ b/src/app/bitstream-page/edit-bitstream-page/themed-edit-bitstream-page.component.ts @@ -0,0 +1,22 @@ +import { Component } from '@angular/core'; +import { EditBitstreamPageComponent } from './edit-bitstream-page.component'; +import { ThemedComponent } from '../../shared/theme-support/themed.component'; + +@Component({ + selector: 'ds-themed-edit-bitstream-page', + styleUrls: [], + templateUrl: '../../shared/theme-support/themed.component.html', +}) +export class ThemedEditBitstreamPageComponent extends ThemedComponent { + protected getComponentName(): string { + return 'EditBitstreamPageComponent'; + } + + protected importThemedComponent(themeName: string): Promise { + return import(`../../../themes/${themeName}/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component`); + } + + protected importUnthemedComponent(): Promise { + return import('./edit-bitstream-page.component'); + } +} diff --git a/src/app/item-page/edit-item-page/edit-item-page.module.ts b/src/app/item-page/edit-item-page/edit-item-page.module.ts index 97901bd7c8..e033919dba 100644 --- a/src/app/item-page/edit-item-page/edit-item-page.module.ts +++ b/src/app/item-page/edit-item-page/edit-item-page.module.ts @@ -35,6 +35,7 @@ import { ItemVersionHistoryComponent } from './item-version-history/item-version import { ItemAuthorizationsComponent } from './item-authorizations/item-authorizations.component'; import { ObjectValuesPipe } from '../../shared/utils/object-values-pipe'; import { ResourcePoliciesModule } from '../../shared/resource-policies/resource-policies.module'; +import { ThemedItemStatusComponent } from './item-status/themed-item-status.component'; /** @@ -61,6 +62,7 @@ import { ResourcePoliciesModule } from '../../shared/resource-policies/resource- ItemPublicComponent, ItemDeleteComponent, ItemStatusComponent, + ThemedItemStatusComponent, ItemMetadataComponent, ItemRelationshipsComponent, ItemBitstreamsComponent, diff --git a/src/app/item-page/edit-item-page/edit-item-page.routing.module.ts b/src/app/item-page/edit-item-page/edit-item-page.routing.module.ts index 2535e42216..6deffe47a8 100644 --- a/src/app/item-page/edit-item-page/edit-item-page.routing.module.ts +++ b/src/app/item-page/edit-item-page/edit-item-page.routing.module.ts @@ -6,7 +6,6 @@ import { ItemReinstateComponent } from './item-reinstate/item-reinstate.componen import { ItemPrivateComponent } from './item-private/item-private.component'; import { ItemPublicComponent } from './item-public/item-public.component'; import { ItemDeleteComponent } from './item-delete/item-delete.component'; -import { ItemStatusComponent } from './item-status/item-status.component'; import { ItemMetadataComponent } from './item-metadata/item-metadata.component'; import { ItemBitstreamsComponent } from './item-bitstreams/item-bitstreams.component'; import { ItemCollectionMapperComponent } from './item-collection-mapper/item-collection-mapper.component'; @@ -38,6 +37,7 @@ import { ItemPageBitstreamsGuard } from './item-page-bitstreams.guard'; import { ItemPageRelationshipsGuard } from './item-page-relationships.guard'; import { ItemPageVersionHistoryGuard } from './item-page-version-history.guard'; import { ItemPageCollectionMapperGuard } from './item-page-collection-mapper.guard'; +import { ThemedItemPageComponent } from '../simple/themed-item-page.component'; /** * Routing module that handles the routing for the Edit Item page administrator functionality @@ -63,7 +63,7 @@ import { ItemPageCollectionMapperGuard } from './item-page-collection-mapper.gua }, { path: 'status', - component: ItemStatusComponent, + component: ThemedItemPageComponent, data: { title: 'item.edit.tabs.status.title', showBreadcrumbs: true }, canActivate: [ItemPageStatusGuard] }, diff --git a/src/app/item-page/edit-item-page/item-status/themed-item-status.component.ts b/src/app/item-page/edit-item-page/item-status/themed-item-status.component.ts new file mode 100644 index 0000000000..eac5a53702 --- /dev/null +++ b/src/app/item-page/edit-item-page/item-status/themed-item-status.component.ts @@ -0,0 +1,23 @@ +import { Component } from '@angular/core'; +import { ThemedComponent } from '../../../shared/theme-support/themed.component'; +import { ItemStatusComponent } from './item-status.component'; + +@Component({ + selector: 'ds-themed-item-status', + styleUrls: [], + templateUrl: '../../../shared/theme-support/themed.component.html', +}) +export class ThemedItemStatusComponent extends ThemedComponent { + protected getComponentName(): string { + return 'ItemStatusComponent'; + } + + protected importThemedComponent(themeName: string): Promise { + return import(`../../../../themes/${themeName}/app/item-page/edit-item-page/item-status/item-status.component`); + } + + protected importUnthemedComponent(): Promise { + return import('./item-status.component'); + } + +} diff --git a/src/themes/custom/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.html b/src/themes/custom/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/themes/custom/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.scss b/src/themes/custom/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.scss new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/themes/custom/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts b/src/themes/custom/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts new file mode 100644 index 0000000000..f8ca14addb --- /dev/null +++ b/src/themes/custom/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts @@ -0,0 +1,13 @@ +import { EditBitstreamPageComponent as BaseComponent } from '../../../../../app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component'; +import { ChangeDetectionStrategy, Component } from '@angular/core'; + +@Component({ + selector: 'ds-edit-bitstream-page', + // styleUrls: ['./edit-bitstream-page.component.scss'], + styleUrls: ['../../../../../app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.scss'], + // templateUrl: './edit-bitstream-page.component.html', + templateUrl: '../../../../../app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.html', + changeDetection: ChangeDetectionStrategy.OnPush +}) +export class EditBitstreamPageComponent extends BaseComponent { +} diff --git a/src/themes/custom/app/item-page/edit-item-page/item-status/item-status.component.html b/src/themes/custom/app/item-page/edit-item-page/item-status/item-status.component.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/themes/custom/app/item-page/edit-item-page/item-status/item-status.component.ts b/src/themes/custom/app/item-page/edit-item-page/item-status/item-status.component.ts new file mode 100644 index 0000000000..95acec2275 --- /dev/null +++ b/src/themes/custom/app/item-page/edit-item-page/item-status/item-status.component.ts @@ -0,0 +1,16 @@ +import { ChangeDetectionStrategy, Component } from '@angular/core'; +import { fadeIn, fadeInOut } from '../../../../../../app/shared/animations/fade'; +import { ItemStatusComponent as BaseComponent } from '../../../../../../app/item-page/edit-item-page/item-status/item-status.component'; + +@Component({ + selector: 'ds-item-status', + // templateUrl: './item-status.component.html', + templateUrl: '../../../../../../app/item-page/edit-item-page/item-status/item-status.component.html', + changeDetection: ChangeDetectionStrategy.Default, + animations: [ + fadeIn, + fadeInOut + ] +}) +export class ItemStatusComponent extends BaseComponent { +} diff --git a/src/themes/custom/theme.module.ts b/src/themes/custom/theme.module.ts index e2e97b9087..ab69e86a8e 100644 --- a/src/themes/custom/theme.module.ts +++ b/src/themes/custom/theme.module.ts @@ -84,6 +84,8 @@ import { SearchModule } from '../../app/shared/search/search.module'; import { ResourcePoliciesModule } from '../../app/shared/resource-policies/resource-policies.module'; import { ComcolModule } from '../../app/shared/comcol/comcol.module'; import { FeedbackComponent } from './app/info/feedback/feedback.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'; const DECLARATIONS = [ FileSectionComponent, @@ -126,7 +128,9 @@ const DECLARATIONS = [ NavbarComponent, HeaderNavbarWrapperComponent, BreadcrumbsComponent, - FeedbackComponent + FeedbackComponent, + ItemStatusComponent, + EditBitstreamPageComponent, ]; @NgModule({ From de7fcb30da5711b73bd9d88c37923de913aacdc6 Mon Sep 17 00:00:00 2001 From: Kristof De Langhe Date: Wed, 11 Jan 2023 14:49:21 +0100 Subject: [PATCH 02/20] 98422: Themed component import fixes --- src/app/item-page/edit-item-page/edit-item-page.module.ts | 3 ++- .../item-page/edit-item-page/edit-item-page.routing.module.ts | 3 ++- src/themes/custom/theme.module.ts | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/app/item-page/edit-item-page/edit-item-page.module.ts b/src/app/item-page/edit-item-page/edit-item-page.module.ts index e033919dba..8ef9c9f82f 100644 --- a/src/app/item-page/edit-item-page/edit-item-page.module.ts +++ b/src/app/item-page/edit-item-page/edit-item-page.module.ts @@ -85,7 +85,8 @@ import { ThemedItemStatusComponent } from './item-status/themed-item-status.comp ObjectValuesPipe ], exports: [ - ItemMetadataComponent + ItemMetadataComponent, + ItemOperationComponent, ] }) export class EditItemPageModule { diff --git a/src/app/item-page/edit-item-page/edit-item-page.routing.module.ts b/src/app/item-page/edit-item-page/edit-item-page.routing.module.ts index 6deffe47a8..0221043d55 100644 --- a/src/app/item-page/edit-item-page/edit-item-page.routing.module.ts +++ b/src/app/item-page/edit-item-page/edit-item-page.routing.module.ts @@ -38,6 +38,7 @@ import { ItemPageRelationshipsGuard } from './item-page-relationships.guard'; import { ItemPageVersionHistoryGuard } from './item-page-version-history.guard'; import { ItemPageCollectionMapperGuard } from './item-page-collection-mapper.guard'; import { ThemedItemPageComponent } from '../simple/themed-item-page.component'; +import { ThemedItemStatusComponent } from './item-status/themed-item-status.component'; /** * Routing module that handles the routing for the Edit Item page administrator functionality @@ -63,7 +64,7 @@ import { ThemedItemPageComponent } from '../simple/themed-item-page.component'; }, { path: 'status', - component: ThemedItemPageComponent, + component: ThemedItemStatusComponent, data: { title: 'item.edit.tabs.status.title', showBreadcrumbs: true }, canActivate: [ItemPageStatusGuard] }, diff --git a/src/themes/custom/theme.module.ts b/src/themes/custom/theme.module.ts index ab69e86a8e..964909b3c1 100644 --- a/src/themes/custom/theme.module.ts +++ b/src/themes/custom/theme.module.ts @@ -86,6 +86,7 @@ import { ComcolModule } from '../../app/shared/comcol/comcol.module'; import { FeedbackComponent } from './app/info/feedback/feedback.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'; const DECLARATIONS = [ FileSectionComponent, @@ -180,7 +181,8 @@ const DECLARATIONS = [ SearchModule, FormsModule, ResourcePoliciesModule, - ComcolModule + ComcolModule, + FormModule, ], declarations: DECLARATIONS }) From 4ba64fdfcc5b2a7ac6c291b712f14b3623d104d8 Mon Sep 17 00:00:00 2001 From: Kristof De Langhe Date: Wed, 11 Jan 2023 14:55:16 +0100 Subject: [PATCH 03/20] 98422: Remove unused import --- .../item-page/edit-item-page/edit-item-page.routing.module.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/app/item-page/edit-item-page/edit-item-page.routing.module.ts b/src/app/item-page/edit-item-page/edit-item-page.routing.module.ts index 0221043d55..bc8b614643 100644 --- a/src/app/item-page/edit-item-page/edit-item-page.routing.module.ts +++ b/src/app/item-page/edit-item-page/edit-item-page.routing.module.ts @@ -37,7 +37,6 @@ import { ItemPageBitstreamsGuard } from './item-page-bitstreams.guard'; import { ItemPageRelationshipsGuard } from './item-page-relationships.guard'; import { ItemPageVersionHistoryGuard } from './item-page-version-history.guard'; import { ItemPageCollectionMapperGuard } from './item-page-collection-mapper.guard'; -import { ThemedItemPageComponent } from '../simple/themed-item-page.component'; import { ThemedItemStatusComponent } from './item-status/themed-item-status.component'; /** From 4f83eaa53d0df45b01d9465512d8435a42fe65d4 Mon Sep 17 00:00:00 2001 From: "Mark H. Wood" Date: Fri, 21 Apr 2023 09:47:18 -0400 Subject: [PATCH 04/20] 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 05/20] 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 681ee6f81600f46d7c64364b06e7f6197d182cd3 Mon Sep 17 00:00:00 2001 From: Alisa Ismailati Date: Tue, 9 May 2023 17:27:06 +0200 Subject: [PATCH 06/20] [DURACOM-145] Handled collection step on a submission form --- .../submission-form-collection.component.html | 2 +- ...bmission-form-collection.component.spec.ts | 6 +++ .../submission-form-collection.component.ts | 5 ++ .../form/submission-form.component.html | 3 ++ .../form/submission-form.component.spec.ts | 27 +++++++++++ .../form/submission-form.component.ts | 46 ++++++++++++++++++- src/app/submission/sections/sections-type.ts | 1 + .../submission/sections/visibility-type.ts | 4 ++ 8 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 src/app/submission/sections/visibility-type.ts diff --git a/src/app/submission/form/collection/submission-form-collection.component.html b/src/app/submission/form/collection/submission-form-collection.component.html index c1227eeccc..a78d737640 100644 --- a/src/app/submission/form/collection/submission-form-collection.component.html +++ b/src/app/submission/form/collection/submission-form-collection.component.html @@ -25,7 +25,7 @@ class="btn btn-outline-primary" (blur)="onClose()" (click)="onClose()" - [disabled]="(processingChange$ | async) || collectionModifiable == false" + [disabled]="(processingChange$ | async) || collectionModifiable == false || isReadonly" ngbDropdownToggle> {{ selectedCollectionName$ | async }} diff --git a/src/app/submission/form/collection/submission-form-collection.component.spec.ts b/src/app/submission/form/collection/submission-form-collection.component.spec.ts index 5b9946e1a4..a277e50286 100644 --- a/src/app/submission/form/collection/submission-form-collection.component.spec.ts +++ b/src/app/submission/form/collection/submission-form-collection.component.spec.ts @@ -249,6 +249,12 @@ describe('SubmissionFormCollectionComponent Component', () => { expect(dropDown).toBeFalsy(); }); + it('the dropdown button should be disabled when isReadonly is true', () => { + comp.isReadonly = true; + fixture.detectChanges(); + expect(dropdowBtn.nativeNode.attributes.disabled).toBeDefined(); + }); + it('should be simulated when the drop-down menu is closed', () => { spyOn(comp, 'onClose'); comp.onClose(); diff --git a/src/app/submission/form/collection/submission-form-collection.component.ts b/src/app/submission/form/collection/submission-form-collection.component.ts index 4eac4c506a..70a4cebf45 100644 --- a/src/app/submission/form/collection/submission-form-collection.component.ts +++ b/src/app/submission/form/collection/submission-form-collection.component.ts @@ -64,6 +64,11 @@ export class SubmissionFormCollectionComponent implements OnChanges, OnInit { */ @Input() submissionId; + /** + * Flag to indicate if the submission dropdown is read only + */ + @Input() isReadonly = false; + /** * An event fired when a different collection is selected. * Event's payload equals to new SubmissionObject. diff --git a/src/app/submission/form/submission-form.component.html b/src/app/submission/form/submission-form.component.html index f75af08f8e..4a916cfe23 100644 --- a/src/app/submission/form/submission-form.component.html +++ b/src/app/submission/form/submission-form.component.html @@ -8,12 +8,15 @@
+ +
{ @@ -156,6 +157,32 @@ describe('SubmissionFormComponent Component', () => { done(); }); + it('should return the visibility object of the collection section', () => { + comp.submissionDefinition = submissionDefinition; + fixture.detectChanges(); + const result = compAsAny.getCollectionVisibility(); + expect(result).toEqual({ + main: VisibilityType.HIDDEN, + other: VisibilityType.HIDDEN, + }); + }); + + it('should return true if collection section visibility is hidden', () => { + comp.submissionDefinition = submissionDefinition; + fixture.detectChanges(); + expect(comp.isSectionHidden).toBe(true); + }); + + it('should return false for isSectionReadonly when collection section visibility is not READONLY', () => { + const visibility = { + main: VisibilityType.READONLY, + other: VisibilityType.READONLY, + }; + comp.submissionDefinition = Object.assign({}, submissionDefinition, { visibility: visibility }); + fixture.detectChanges(); + expect(comp.isSectionReadonly).toBe(false); + }); + it('should update properly on collection change', (done) => { comp.collectionId = collectionId; comp.submissionId = submissionId; diff --git a/src/app/submission/form/submission-form.component.ts b/src/app/submission/form/submission-form.component.ts index 0e17e128bc..216aefcfc3 100644 --- a/src/app/submission/form/submission-form.component.ts +++ b/src/app/submission/form/submission-form.component.ts @@ -9,7 +9,7 @@ import { HALEndpointService } from '../../core/shared/hal-endpoint.service'; import { SubmissionObject } from '../../core/submission/models/submission-object.model'; import { WorkspaceitemSectionsObject } from '../../core/submission/models/workspaceitem-sections.model'; -import { hasValue, isNotEmpty } from '../../shared/empty.util'; +import { hasValue, isNotEmpty, isNotUndefined } from '../../shared/empty.util'; import { UploaderOptions } from '../../shared/upload/uploader/uploader-options.model'; import { SubmissionObjectEntry } from '../objects/submission-objects.reducer'; import { SectionDataObject } from '../sections/models/section-data.model'; @@ -18,6 +18,10 @@ import { Item } from '../../core/shared/item.model'; import { SectionsType } from '../sections/sections-type'; import { SectionsService } from '../sections/sections.service'; import { SubmissionError } from '../objects/submission-error.model'; +import { SubmissionSectionVisibility } from './../../core/config/models/config-submission-section.model'; +import { SubmissionSectionModel } from './../../core/config/models/config-submission-section.model'; +import { VisibilityType } from '../sections/visibility-type'; +import isEqual from 'lodash/isEqual'; /** * This component represents the submission form. @@ -188,6 +192,42 @@ export class SubmissionFormComponent implements OnChanges, OnDestroy { } } + /** + * Returns the visibility object of the collection section + */ + private getCollectionVisibility(): SubmissionSectionVisibility { + const submissionSectionModel: SubmissionSectionModel = + this.submissionDefinition.sections.page.find( + (section) => isEqual(section.sectionType, SectionsType.Collection) + ); + + return isNotUndefined(submissionSectionModel.visibility) ? submissionSectionModel.visibility : null; + } + + /** + * Getter to see if the collection section visibility is hidden + */ + get isSectionHidden(): boolean { + const visibility = this.getCollectionVisibility(); + return ( + hasValue(visibility) && + isEqual(visibility.main, VisibilityType.HIDDEN) && + isEqual(visibility.other, VisibilityType.HIDDEN) + ); + } + + /** + * Getter to see if the collection section visibility is readonly + */ + get isSectionReadonly(): boolean { + const visibility = this.getCollectionVisibility(); + return ( + hasValue(visibility) && + isEqual(visibility.main, VisibilityType.READONLY) && + isEqual(visibility.other, VisibilityType.READONLY) + ); + } + /** * Unsubscribe from all subscriptions, destroy instance variables * and reset submission state @@ -239,6 +279,8 @@ export class SubmissionFormComponent implements OnChanges, OnDestroy { protected getSectionsList(): Observable { return this.submissionService.getSubmissionSections(this.submissionId).pipe( filter((sections: SectionDataObject[]) => isNotEmpty(sections)), - map((sections: SectionDataObject[]) => sections)); + map((sections: SectionDataObject[]) => + sections.filter((section: SectionDataObject) => !isEqual(section.sectionType,SectionsType.Collection))), + ); } } diff --git a/src/app/submission/sections/sections-type.ts b/src/app/submission/sections/sections-type.ts index 6fb7380822..6bca8a7252 100644 --- a/src/app/submission/sections/sections-type.ts +++ b/src/app/submission/sections/sections-type.ts @@ -8,4 +8,5 @@ export enum SectionsType { AccessesCondition = 'accessCondition', SherpaPolicies = 'sherpaPolicy', Identifiers = 'identifiers', + Collection = 'collection', } diff --git a/src/app/submission/sections/visibility-type.ts b/src/app/submission/sections/visibility-type.ts new file mode 100644 index 0000000000..b2e167285c --- /dev/null +++ b/src/app/submission/sections/visibility-type.ts @@ -0,0 +1,4 @@ +export enum VisibilityType { + HIDDEN = 'HIDDEN', + READONLY = 'READONLY', +} From 9a8dfc229f0940b2242c577dc5769e50f79aed62 Mon Sep 17 00:00:00 2001 From: Adam Doan Date: Fri, 12 May 2023 13:04:43 +0000 Subject: [PATCH 07/20] 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 9ca04b4b63f3fd50f3a3044d2fc77cd59f49a541 Mon Sep 17 00:00:00 2001 From: Alisa Ismailati Date: Tue, 9 May 2023 17:27:06 +0200 Subject: [PATCH 09/20] [DURACOM-145] Handled collection step on a submission form --- .../submission-form-collection.component.html | 2 +- ...bmission-form-collection.component.spec.ts | 6 +++ .../submission-form-collection.component.ts | 5 ++ .../form/submission-form.component.html | 3 ++ .../form/submission-form.component.spec.ts | 27 +++++++++++ .../form/submission-form.component.ts | 46 ++++++++++++++++++- src/app/submission/sections/sections-type.ts | 1 + .../submission/sections/visibility-type.ts | 4 ++ 8 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 src/app/submission/sections/visibility-type.ts diff --git a/src/app/submission/form/collection/submission-form-collection.component.html b/src/app/submission/form/collection/submission-form-collection.component.html index c1227eeccc..a78d737640 100644 --- a/src/app/submission/form/collection/submission-form-collection.component.html +++ b/src/app/submission/form/collection/submission-form-collection.component.html @@ -25,7 +25,7 @@ class="btn btn-outline-primary" (blur)="onClose()" (click)="onClose()" - [disabled]="(processingChange$ | async) || collectionModifiable == false" + [disabled]="(processingChange$ | async) || collectionModifiable == false || isReadonly" ngbDropdownToggle> {{ selectedCollectionName$ | async }} diff --git a/src/app/submission/form/collection/submission-form-collection.component.spec.ts b/src/app/submission/form/collection/submission-form-collection.component.spec.ts index 5b9946e1a4..a277e50286 100644 --- a/src/app/submission/form/collection/submission-form-collection.component.spec.ts +++ b/src/app/submission/form/collection/submission-form-collection.component.spec.ts @@ -249,6 +249,12 @@ describe('SubmissionFormCollectionComponent Component', () => { expect(dropDown).toBeFalsy(); }); + it('the dropdown button should be disabled when isReadonly is true', () => { + comp.isReadonly = true; + fixture.detectChanges(); + expect(dropdowBtn.nativeNode.attributes.disabled).toBeDefined(); + }); + it('should be simulated when the drop-down menu is closed', () => { spyOn(comp, 'onClose'); comp.onClose(); diff --git a/src/app/submission/form/collection/submission-form-collection.component.ts b/src/app/submission/form/collection/submission-form-collection.component.ts index 4eac4c506a..70a4cebf45 100644 --- a/src/app/submission/form/collection/submission-form-collection.component.ts +++ b/src/app/submission/form/collection/submission-form-collection.component.ts @@ -64,6 +64,11 @@ export class SubmissionFormCollectionComponent implements OnChanges, OnInit { */ @Input() submissionId; + /** + * Flag to indicate if the submission dropdown is read only + */ + @Input() isReadonly = false; + /** * An event fired when a different collection is selected. * Event's payload equals to new SubmissionObject. diff --git a/src/app/submission/form/submission-form.component.html b/src/app/submission/form/submission-form.component.html index f75af08f8e..4a916cfe23 100644 --- a/src/app/submission/form/submission-form.component.html +++ b/src/app/submission/form/submission-form.component.html @@ -8,12 +8,15 @@
+ +
{ @@ -156,6 +157,32 @@ describe('SubmissionFormComponent Component', () => { done(); }); + it('should return the visibility object of the collection section', () => { + comp.submissionDefinition = submissionDefinition; + fixture.detectChanges(); + const result = compAsAny.getCollectionVisibility(); + expect(result).toEqual({ + main: VisibilityType.HIDDEN, + other: VisibilityType.HIDDEN, + }); + }); + + it('should return true if collection section visibility is hidden', () => { + comp.submissionDefinition = submissionDefinition; + fixture.detectChanges(); + expect(comp.isSectionHidden).toBe(true); + }); + + it('should return false for isSectionReadonly when collection section visibility is not READONLY', () => { + const visibility = { + main: VisibilityType.READONLY, + other: VisibilityType.READONLY, + }; + comp.submissionDefinition = Object.assign({}, submissionDefinition, { visibility: visibility }); + fixture.detectChanges(); + expect(comp.isSectionReadonly).toBe(false); + }); + it('should update properly on collection change', (done) => { comp.collectionId = collectionId; comp.submissionId = submissionId; diff --git a/src/app/submission/form/submission-form.component.ts b/src/app/submission/form/submission-form.component.ts index 0e17e128bc..216aefcfc3 100644 --- a/src/app/submission/form/submission-form.component.ts +++ b/src/app/submission/form/submission-form.component.ts @@ -9,7 +9,7 @@ import { HALEndpointService } from '../../core/shared/hal-endpoint.service'; import { SubmissionObject } from '../../core/submission/models/submission-object.model'; import { WorkspaceitemSectionsObject } from '../../core/submission/models/workspaceitem-sections.model'; -import { hasValue, isNotEmpty } from '../../shared/empty.util'; +import { hasValue, isNotEmpty, isNotUndefined } from '../../shared/empty.util'; import { UploaderOptions } from '../../shared/upload/uploader/uploader-options.model'; import { SubmissionObjectEntry } from '../objects/submission-objects.reducer'; import { SectionDataObject } from '../sections/models/section-data.model'; @@ -18,6 +18,10 @@ import { Item } from '../../core/shared/item.model'; import { SectionsType } from '../sections/sections-type'; import { SectionsService } from '../sections/sections.service'; import { SubmissionError } from '../objects/submission-error.model'; +import { SubmissionSectionVisibility } from './../../core/config/models/config-submission-section.model'; +import { SubmissionSectionModel } from './../../core/config/models/config-submission-section.model'; +import { VisibilityType } from '../sections/visibility-type'; +import isEqual from 'lodash/isEqual'; /** * This component represents the submission form. @@ -188,6 +192,42 @@ export class SubmissionFormComponent implements OnChanges, OnDestroy { } } + /** + * Returns the visibility object of the collection section + */ + private getCollectionVisibility(): SubmissionSectionVisibility { + const submissionSectionModel: SubmissionSectionModel = + this.submissionDefinition.sections.page.find( + (section) => isEqual(section.sectionType, SectionsType.Collection) + ); + + return isNotUndefined(submissionSectionModel.visibility) ? submissionSectionModel.visibility : null; + } + + /** + * Getter to see if the collection section visibility is hidden + */ + get isSectionHidden(): boolean { + const visibility = this.getCollectionVisibility(); + return ( + hasValue(visibility) && + isEqual(visibility.main, VisibilityType.HIDDEN) && + isEqual(visibility.other, VisibilityType.HIDDEN) + ); + } + + /** + * Getter to see if the collection section visibility is readonly + */ + get isSectionReadonly(): boolean { + const visibility = this.getCollectionVisibility(); + return ( + hasValue(visibility) && + isEqual(visibility.main, VisibilityType.READONLY) && + isEqual(visibility.other, VisibilityType.READONLY) + ); + } + /** * Unsubscribe from all subscriptions, destroy instance variables * and reset submission state @@ -239,6 +279,8 @@ export class SubmissionFormComponent implements OnChanges, OnDestroy { protected getSectionsList(): Observable { return this.submissionService.getSubmissionSections(this.submissionId).pipe( filter((sections: SectionDataObject[]) => isNotEmpty(sections)), - map((sections: SectionDataObject[]) => sections)); + map((sections: SectionDataObject[]) => + sections.filter((section: SectionDataObject) => !isEqual(section.sectionType,SectionsType.Collection))), + ); } } diff --git a/src/app/submission/sections/sections-type.ts b/src/app/submission/sections/sections-type.ts index 6fb7380822..6bca8a7252 100644 --- a/src/app/submission/sections/sections-type.ts +++ b/src/app/submission/sections/sections-type.ts @@ -8,4 +8,5 @@ export enum SectionsType { AccessesCondition = 'accessCondition', SherpaPolicies = 'sherpaPolicy', Identifiers = 'identifiers', + Collection = 'collection', } diff --git a/src/app/submission/sections/visibility-type.ts b/src/app/submission/sections/visibility-type.ts new file mode 100644 index 0000000000..b2e167285c --- /dev/null +++ b/src/app/submission/sections/visibility-type.ts @@ -0,0 +1,4 @@ +export enum VisibilityType { + HIDDEN = 'HIDDEN', + READONLY = 'READONLY', +} From 8e25a02fdea46782ae6079003aceb689136d1aad Mon Sep 17 00:00:00 2001 From: Alisa Ismailati Date: Fri, 12 May 2023 15:38:58 +0200 Subject: [PATCH 10/20] [DURACOM-145] Fixed e2e failing tests --- cypress/e2e/my-dspace.cy.ts | 13 +++++++++++-- cypress/e2e/submission.cy.ts | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/my-dspace.cy.ts b/cypress/e2e/my-dspace.cy.ts index 79786c298a..277146fbc5 100644 --- a/cypress/e2e/my-dspace.cy.ts +++ b/cypress/e2e/my-dspace.cy.ts @@ -88,8 +88,17 @@ describe('My DSpace page', () => { // The Submission edit form tag should be visible cy.get('ds-submission-edit').should('be.visible'); - // A Collection menu button should exist & its value should be the selected collection - cy.get('#collectionControlsMenuButton span').should('have.text', TEST_SUBMIT_COLLECTION_NAME); + // A Collection menu button should exist(based on collection visibility) & its value should be the selected collection + cy.get('#collectionControlsMenuButton span') + .should(($span) => { + if ($span.length > 0) { + // If the element exists in the DOM (it's visible or read-only) + expect($span).to.have.text(TEST_SUBMIT_COLLECTION_NAME); + } else { + // If the element doesn't exist in the DOM, the length will be 0 + expect($span).to.have.length(0); + } + }); // Now that we've created a submission, we'll test that we can go back and Edit it. // Get our Submission URL, to parse out the ID of this new submission diff --git a/cypress/e2e/submission.cy.ts b/cypress/e2e/submission.cy.ts index ed10b2d13a..0a956c2614 100644 --- a/cypress/e2e/submission.cy.ts +++ b/cypress/e2e/submission.cy.ts @@ -16,8 +16,17 @@ describe('New Submission page', () => { // The Submission edit form tag should be visible cy.get('ds-submission-edit').should('be.visible'); - // A Collection menu button should exist & it's value should be the selected collection - cy.get('#collectionControlsMenuButton span').should('have.text', TEST_SUBMIT_COLLECTION_NAME); + // A Collection menu button should exist(if it's visible or read-only) & it's value should be the selected collection + cy.get('#collectionControlsMenuButton span') + .should(($span) => { + if ($span.length > 0) { + // If the element exists in the DOM (it's visible or read-only) + expect($span).to.have.text(TEST_SUBMIT_COLLECTION_NAME); + } else { + // If the element doesn't exist in the DOM, the length will be 0 + expect($span).to.have.length(0); + } + }); // 4 sections should be visible by default cy.get('div#section_traditionalpageone').should('be.visible'); From aee6060fef4864b42a0b882350a8d8e70e93f51d Mon Sep 17 00:00:00 2001 From: Alisa Ismailati Date: Mon, 15 May 2023 11:12:50 +0200 Subject: [PATCH 11/20] Revert "[DURACOM-145] Fixed e2e failing tests" This reverts commit b9c7391b1452e9a79d9c5615595b08cd7ac8b14c. --- cypress/e2e/my-dspace.cy.ts | 13 ++----------- cypress/e2e/submission.cy.ts | 13 ++----------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/cypress/e2e/my-dspace.cy.ts b/cypress/e2e/my-dspace.cy.ts index 277146fbc5..79786c298a 100644 --- a/cypress/e2e/my-dspace.cy.ts +++ b/cypress/e2e/my-dspace.cy.ts @@ -88,17 +88,8 @@ describe('My DSpace page', () => { // The Submission edit form tag should be visible cy.get('ds-submission-edit').should('be.visible'); - // A Collection menu button should exist(based on collection visibility) & its value should be the selected collection - cy.get('#collectionControlsMenuButton span') - .should(($span) => { - if ($span.length > 0) { - // If the element exists in the DOM (it's visible or read-only) - expect($span).to.have.text(TEST_SUBMIT_COLLECTION_NAME); - } else { - // If the element doesn't exist in the DOM, the length will be 0 - expect($span).to.have.length(0); - } - }); + // A Collection menu button should exist & its value should be the selected collection + cy.get('#collectionControlsMenuButton span').should('have.text', TEST_SUBMIT_COLLECTION_NAME); // Now that we've created a submission, we'll test that we can go back and Edit it. // Get our Submission URL, to parse out the ID of this new submission diff --git a/cypress/e2e/submission.cy.ts b/cypress/e2e/submission.cy.ts index 0a956c2614..ed10b2d13a 100644 --- a/cypress/e2e/submission.cy.ts +++ b/cypress/e2e/submission.cy.ts @@ -16,17 +16,8 @@ describe('New Submission page', () => { // The Submission edit form tag should be visible cy.get('ds-submission-edit').should('be.visible'); - // A Collection menu button should exist(if it's visible or read-only) & it's value should be the selected collection - cy.get('#collectionControlsMenuButton span') - .should(($span) => { - if ($span.length > 0) { - // If the element exists in the DOM (it's visible or read-only) - expect($span).to.have.text(TEST_SUBMIT_COLLECTION_NAME); - } else { - // If the element doesn't exist in the DOM, the length will be 0 - expect($span).to.have.length(0); - } - }); + // A Collection menu button should exist & it's value should be the selected collection + cy.get('#collectionControlsMenuButton span').should('have.text', TEST_SUBMIT_COLLECTION_NAME); // 4 sections should be visible by default cy.get('div#section_traditionalpageone').should('be.visible'); From d54754f78a5c352fb1fa7eb6b5b41f499cfc0a82 Mon Sep 17 00:00:00 2001 From: "Mark H. Wood" Date: Fri, 19 May 2023 13:36:04 -0400 Subject: [PATCH 12/20] 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 13/20] 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 edeea00c75d7a26fcf300aafcb8d813e40cf76af Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Fri, 19 May 2023 16:02:30 -0500 Subject: [PATCH 14/20] Fix several "potentially unsafe external link" warnings --- .../context-help-wrapper/context-help-wrapper.component.html | 2 +- .../publication-information.component.html | 4 ++-- .../publisher-policy/publisher-policy.component.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/shared/context-help-wrapper/context-help-wrapper.component.html b/src/app/shared/context-help-wrapper/context-help-wrapper.component.html index b031d0f42d..083b8163ff 100644 --- a/src/app/shared/context-help-wrapper/context-help-wrapper.component.html +++ b/src/app/shared/context-help-wrapper/context-help-wrapper.component.html @@ -2,7 +2,7 @@
- {{elem.text}} + {{elem.text}} {{ elem }} diff --git a/src/app/submission/sections/sherpa-policies/publication-information/publication-information.component.html b/src/app/submission/sections/sherpa-policies/publication-information/publication-information.component.html index 3c35da8f08..534b95397e 100644 --- a/src/app/submission/sections/sherpa-policies/publication-information/publication-information.component.html +++ b/src/app/submission/sections/sherpa-policies/publication-information/publication-information.component.html @@ -23,7 +23,7 @@

- + {{journal.url}}

@@ -35,7 +35,7 @@

- + {{publisher.name}}

diff --git a/src/app/submission/sections/sherpa-policies/publisher-policy/publisher-policy.component.html b/src/app/submission/sections/sherpa-policies/publisher-policy/publisher-policy.component.html index 87370cf7e3..96e42202b3 100644 --- a/src/app/submission/sections/sherpa-policies/publisher-policy/publisher-policy.component.html +++ b/src/app/submission/sections/sherpa-policies/publisher-policy/publisher-policy.component.html @@ -8,7 +8,7 @@

From 8a93bef98c5db3ba35e00318b1beec2c1ccbec88 Mon Sep 17 00:00:00 2001 From: "Mark H. Wood" Date: Tue, 23 May 2023 13:06:12 -0400 Subject: [PATCH 15/20] 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 16/20] 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 17/20] 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 86e1333025a26af288d44b213d1746c335da8930 Mon Sep 17 00:00:00 2001 From: Michael Spalti Date: Fri, 5 May 2023 11:50:45 -0700 Subject: [PATCH 18/20] Possible fix for browse-by-date links --- src/app/shared/starts-with/date/starts-with-date.component.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/app/shared/starts-with/date/starts-with-date.component.ts b/src/app/shared/starts-with/date/starts-with-date.component.ts index d65d12b413..89d9361b6a 100644 --- a/src/app/shared/starts-with/date/starts-with-date.component.ts +++ b/src/app/shared/starts-with/date/starts-with-date.component.ts @@ -131,7 +131,6 @@ export class StartsWithDateComponent extends StartsWithAbstractComponent { } else { this.startsWithYear = +startsWith; } - this.setStartsWithParam(false); } /** From 8e450402af8ea6af0d038d04af666bdd0b560600 Mon Sep 17 00:00:00 2001 From: Michael Spalti Date: Thu, 1 Jun 2023 08:46:25 -0700 Subject: [PATCH 19/20] Removed unnecessary route navigation. --- src/app/shared/starts-with/starts-with-abstract.component.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/app/shared/starts-with/starts-with-abstract.component.ts b/src/app/shared/starts-with/starts-with-abstract.component.ts index 26140dcc6d..ad9c56c970 100644 --- a/src/app/shared/starts-with/starts-with-abstract.component.ts +++ b/src/app/shared/starts-with/starts-with-abstract.component.ts @@ -70,7 +70,6 @@ export abstract class StartsWithAbstractComponent implements OnInit, OnDestroy { */ setStartsWith(startsWith: string) { this.startsWith = startsWith; - this.setStartsWithParam(false); } /** From da245b88b8bce2bce566b745c7120a816b713dac Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Fri, 2 Jun 2023 12:59:20 +0300 Subject: [PATCH 20/20] 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",