From 9c3e3d9c29189b667d49473456e2e5d74ce099f2 Mon Sep 17 00:00:00 2001 From: Alexandre Vryghem Date: Wed, 22 Nov 2023 14:51:17 +0100 Subject: [PATCH] 108608: Created new ScopeSelectorModal & ScopeSelectorModalCurrent context --- src/app/core/shared/context.model.ts | 2 ++ ...issue-sidebar-search-list-element.component.ts | 2 ++ ...olume-sidebar-search-list-element.component.ts | 2 ++ ...urnal-sidebar-search-list-element.component.ts | 2 ++ ...-unit-sidebar-search-list-element.component.ts | 2 ++ ...erson-sidebar-search-list-element.component.ts | 2 ++ ...oject-sidebar-search-list-element.component.ts | 2 ++ .../dso-selector/dso-selector.component.ts | 15 ++++++++++++++- ...ction-sidebar-search-list-element.component.ts | 2 ++ ...unity-sidebar-search-list-element.component.ts | 2 ++ ...ation-sidebar-search-list-element.component.ts | 4 ++-- .../scope-selector-modal.component.html | 4 +++- .../scope-selector-modal.component.ts | 4 ++++ 13 files changed, 41 insertions(+), 4 deletions(-) diff --git a/src/app/core/shared/context.model.ts b/src/app/core/shared/context.model.ts index 126896e3e12..18d40d9cb61 100644 --- a/src/app/core/shared/context.model.ts +++ b/src/app/core/shared/context.model.ts @@ -15,4 +15,6 @@ export enum Context { AdminWorkflowSearch = 'adminWorkflowSearch', SideBarSearchModal = 'sideBarSearchModal', SideBarSearchModalCurrent = 'sideBarSearchModalCurrent', + ScopeSelectorModal = 'scopeSelectorModal', + ScopeSelectorModalCurrent = 'scopeSelectorModalCurrent', } diff --git a/src/app/entity-groups/journal-entities/item-list-elements/sidebar-search-list-elements/journal-issue/journal-issue-sidebar-search-list-element.component.ts b/src/app/entity-groups/journal-entities/item-list-elements/sidebar-search-list-elements/journal-issue/journal-issue-sidebar-search-list-element.component.ts index 84764e9e600..733cadf0c57 100644 --- a/src/app/entity-groups/journal-entities/item-list-elements/sidebar-search-list-elements/journal-issue/journal-issue-sidebar-search-list-element.component.ts +++ b/src/app/entity-groups/journal-entities/item-list-elements/sidebar-search-list-elements/journal-issue/journal-issue-sidebar-search-list-element.component.ts @@ -9,6 +9,8 @@ import { isNotEmpty } from '../../../../../shared/empty.util'; @listableObjectComponent('JournalIssueSearchResult', ViewMode.ListElement, Context.SideBarSearchModal) @listableObjectComponent('JournalIssueSearchResult', ViewMode.ListElement, Context.SideBarSearchModalCurrent) +@listableObjectComponent('JournalIssueSearchResult', ViewMode.ListElement, Context.ScopeSelectorModal) +@listableObjectComponent('JournalIssueSearchResult', ViewMode.ListElement, Context.ScopeSelectorModalCurrent) @Component({ selector: 'ds-journal-issue-sidebar-search-list-element', templateUrl: '../../../../../shared/object-list/sidebar-search-list-element/sidebar-search-list-element.component.html' diff --git a/src/app/entity-groups/journal-entities/item-list-elements/sidebar-search-list-elements/journal-volume/journal-volume-sidebar-search-list-element.component.ts b/src/app/entity-groups/journal-entities/item-list-elements/sidebar-search-list-elements/journal-volume/journal-volume-sidebar-search-list-element.component.ts index 7af5487f402..cebb3c15420 100644 --- a/src/app/entity-groups/journal-entities/item-list-elements/sidebar-search-list-elements/journal-volume/journal-volume-sidebar-search-list-element.component.ts +++ b/src/app/entity-groups/journal-entities/item-list-elements/sidebar-search-list-elements/journal-volume/journal-volume-sidebar-search-list-element.component.ts @@ -9,6 +9,8 @@ import { isNotEmpty } from '../../../../../shared/empty.util'; @listableObjectComponent('JournalVolumeSearchResult', ViewMode.ListElement, Context.SideBarSearchModal) @listableObjectComponent('JournalVolumeSearchResult', ViewMode.ListElement, Context.SideBarSearchModalCurrent) +@listableObjectComponent('JournalVolumeSearchResult', ViewMode.ListElement, Context.ScopeSelectorModal) +@listableObjectComponent('JournalVolumeSearchResult', ViewMode.ListElement, Context.ScopeSelectorModalCurrent) @Component({ selector: 'ds-journal-volume-sidebar-search-list-element', templateUrl: '../../../../../shared/object-list/sidebar-search-list-element/sidebar-search-list-element.component.html' diff --git a/src/app/entity-groups/journal-entities/item-list-elements/sidebar-search-list-elements/journal/journal-sidebar-search-list-element.component.ts b/src/app/entity-groups/journal-entities/item-list-elements/sidebar-search-list-elements/journal/journal-sidebar-search-list-element.component.ts index 4a26b293d9b..a3cdaf24a37 100644 --- a/src/app/entity-groups/journal-entities/item-list-elements/sidebar-search-list-elements/journal/journal-sidebar-search-list-element.component.ts +++ b/src/app/entity-groups/journal-entities/item-list-elements/sidebar-search-list-elements/journal/journal-sidebar-search-list-element.component.ts @@ -9,6 +9,8 @@ import { isNotEmpty } from '../../../../../shared/empty.util'; @listableObjectComponent('JournalSearchResult', ViewMode.ListElement, Context.SideBarSearchModal) @listableObjectComponent('JournalSearchResult', ViewMode.ListElement, Context.SideBarSearchModalCurrent) +@listableObjectComponent('JournalSearchResult', ViewMode.ListElement, Context.ScopeSelectorModal) +@listableObjectComponent('JournalSearchResult', ViewMode.ListElement, Context.ScopeSelectorModalCurrent) @Component({ selector: 'ds-journal-sidebar-search-list-element', templateUrl: '../../../../../shared/object-list/sidebar-search-list-element/sidebar-search-list-element.component.html' diff --git a/src/app/entity-groups/research-entities/item-list-elements/sidebar-search-list-elements/org-unit/org-unit-sidebar-search-list-element.component.ts b/src/app/entity-groups/research-entities/item-list-elements/sidebar-search-list-elements/org-unit/org-unit-sidebar-search-list-element.component.ts index 17e9790593d..2e1d88bf03d 100644 --- a/src/app/entity-groups/research-entities/item-list-elements/sidebar-search-list-elements/org-unit/org-unit-sidebar-search-list-element.component.ts +++ b/src/app/entity-groups/research-entities/item-list-elements/sidebar-search-list-elements/org-unit/org-unit-sidebar-search-list-element.component.ts @@ -8,6 +8,8 @@ import { Item } from '../../../../../core/shared/item.model'; @listableObjectComponent('OrgUnitSearchResult', ViewMode.ListElement, Context.SideBarSearchModal) @listableObjectComponent('OrgUnitSearchResult', ViewMode.ListElement, Context.SideBarSearchModalCurrent) +@listableObjectComponent('OrgUnitSearchResult', ViewMode.ListElement, Context.ScopeSelectorModal) +@listableObjectComponent('OrgUnitSearchResult', ViewMode.ListElement, Context.ScopeSelectorModalCurrent) @Component({ selector: 'ds-org-unit-sidebar-search-list-element', templateUrl: '../../../../../shared/object-list/sidebar-search-list-element/sidebar-search-list-element.component.html' diff --git a/src/app/entity-groups/research-entities/item-list-elements/sidebar-search-list-elements/person/person-sidebar-search-list-element.component.ts b/src/app/entity-groups/research-entities/item-list-elements/sidebar-search-list-elements/person/person-sidebar-search-list-element.component.ts index 281f22ddb43..2d56d794388 100644 --- a/src/app/entity-groups/research-entities/item-list-elements/sidebar-search-list-elements/person/person-sidebar-search-list-element.component.ts +++ b/src/app/entity-groups/research-entities/item-list-elements/sidebar-search-list-elements/person/person-sidebar-search-list-element.component.ts @@ -13,6 +13,8 @@ import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service @listableObjectComponent('PersonSearchResult', ViewMode.ListElement, Context.SideBarSearchModal) @listableObjectComponent('PersonSearchResult', ViewMode.ListElement, Context.SideBarSearchModalCurrent) +@listableObjectComponent('PersonSearchResult', ViewMode.ListElement, Context.ScopeSelectorModal) +@listableObjectComponent('PersonSearchResult', ViewMode.ListElement, Context.ScopeSelectorModalCurrent) @Component({ selector: 'ds-person-sidebar-search-list-element', templateUrl: '../../../../../shared/object-list/sidebar-search-list-element/sidebar-search-list-element.component.html' diff --git a/src/app/entity-groups/research-entities/item-list-elements/sidebar-search-list-elements/project/project-sidebar-search-list-element.component.ts b/src/app/entity-groups/research-entities/item-list-elements/sidebar-search-list-elements/project/project-sidebar-search-list-element.component.ts index 6fbb9d26fc0..233216f2064 100644 --- a/src/app/entity-groups/research-entities/item-list-elements/sidebar-search-list-elements/project/project-sidebar-search-list-element.component.ts +++ b/src/app/entity-groups/research-entities/item-list-elements/sidebar-search-list-elements/project/project-sidebar-search-list-element.component.ts @@ -8,6 +8,8 @@ import { Item } from '../../../../../core/shared/item.model'; @listableObjectComponent('ProjectSearchResult', ViewMode.ListElement, Context.SideBarSearchModal) @listableObjectComponent('ProjectSearchResult', ViewMode.ListElement, Context.SideBarSearchModalCurrent) +@listableObjectComponent('ProjectSearchResult', ViewMode.ListElement, Context.ScopeSelectorModal) +@listableObjectComponent('ProjectSearchResult', ViewMode.ListElement, Context.ScopeSelectorModalCurrent) @Component({ selector: 'ds-project-sidebar-search-list-element', templateUrl: '../../../../../shared/object-list/sidebar-search-list-element/sidebar-search-list-element.component.html' diff --git a/src/app/shared/dso-selector/dso-selector/dso-selector.component.ts b/src/app/shared/dso-selector/dso-selector/dso-selector.component.ts index 82ad095cd43..64ee2278c68 100644 --- a/src/app/shared/dso-selector/dso-selector/dso-selector.component.ts +++ b/src/app/shared/dso-selector/dso-selector/dso-selector.component.ts @@ -50,6 +50,12 @@ export class DSOSelectorComponent implements OnInit, OnDestroy { * The view mode of the listed objects */ viewMode = ViewMode.ListElement; + + /** + * The current context + */ + @Input() context: Context; + /** * The initially selected DSO's uuid */ @@ -243,7 +249,14 @@ export class DSOSelectorComponent implements OnInit, OnDestroy { /** * Get the context for element with the given id */ - getContext(id: string) { + getContext(id: string): Context { + if (this.context === Context.ScopeSelectorModal) { + if (id === this.currentDSOId) { + return Context.ScopeSelectorModalCurrent; + } else { + return Context.ScopeSelectorModal; + } + } if (id === this.currentDSOId) { return Context.SideBarSearchModalCurrent; } else { diff --git a/src/app/shared/object-list/sidebar-search-list-element/collection/collection-sidebar-search-list-element.component.ts b/src/app/shared/object-list/sidebar-search-list-element/collection/collection-sidebar-search-list-element.component.ts index 13703240f43..b94b3766c3b 100644 --- a/src/app/shared/object-list/sidebar-search-list-element/collection/collection-sidebar-search-list-element.component.ts +++ b/src/app/shared/object-list/sidebar-search-list-element/collection/collection-sidebar-search-list-element.component.ts @@ -8,6 +8,8 @@ import { SidebarSearchListElementComponent } from '../sidebar-search-list-elemen @listableObjectComponent(CollectionSearchResult, ViewMode.ListElement, Context.SideBarSearchModal) @listableObjectComponent(CollectionSearchResult, ViewMode.ListElement, Context.SideBarSearchModalCurrent) +@listableObjectComponent(CollectionSearchResult, ViewMode.ListElement, Context.ScopeSelectorModal) +@listableObjectComponent(CollectionSearchResult, ViewMode.ListElement, Context.ScopeSelectorModalCurrent) @Component({ selector: 'ds-collection-sidebar-search-list-element', templateUrl: '../sidebar-search-list-element.component.html' diff --git a/src/app/shared/object-list/sidebar-search-list-element/community/community-sidebar-search-list-element.component.ts b/src/app/shared/object-list/sidebar-search-list-element/community/community-sidebar-search-list-element.component.ts index 14c8ec09cd7..b50e2c69804 100644 --- a/src/app/shared/object-list/sidebar-search-list-element/community/community-sidebar-search-list-element.component.ts +++ b/src/app/shared/object-list/sidebar-search-list-element/community/community-sidebar-search-list-element.component.ts @@ -8,6 +8,8 @@ import { Community } from '../../../../core/shared/community.model'; @listableObjectComponent(CommunitySearchResult, ViewMode.ListElement, Context.SideBarSearchModal) @listableObjectComponent(CommunitySearchResult, ViewMode.ListElement, Context.SideBarSearchModalCurrent) +@listableObjectComponent(CommunitySearchResult, ViewMode.ListElement, Context.ScopeSelectorModal) +@listableObjectComponent(CommunitySearchResult, ViewMode.ListElement, Context.ScopeSelectorModalCurrent) @Component({ selector: 'ds-collection-sidebar-search-list-element', templateUrl: '../sidebar-search-list-element.component.html' diff --git a/src/app/shared/object-list/sidebar-search-list-element/item-types/publication/publication-sidebar-search-list-element.component.ts b/src/app/shared/object-list/sidebar-search-list-element/item-types/publication/publication-sidebar-search-list-element.component.ts index 0822accc501..f77263df400 100644 --- a/src/app/shared/object-list/sidebar-search-list-element/item-types/publication/publication-sidebar-search-list-element.component.ts +++ b/src/app/shared/object-list/sidebar-search-list-element/item-types/publication/publication-sidebar-search-list-element.component.ts @@ -8,8 +8,8 @@ import { SidebarSearchListElementComponent } from '../../sidebar-search-list-ele @listableObjectComponent('PublicationSearchResult', ViewMode.ListElement, Context.SideBarSearchModal) @listableObjectComponent('PublicationSearchResult', ViewMode.ListElement, Context.SideBarSearchModalCurrent) -@listableObjectComponent(ItemSearchResult, ViewMode.ListElement, Context.SideBarSearchModal) -@listableObjectComponent(ItemSearchResult, ViewMode.ListElement, Context.SideBarSearchModalCurrent) +@listableObjectComponent(ItemSearchResult, ViewMode.ListElement, Context.ScopeSelectorModal) +@listableObjectComponent(ItemSearchResult, ViewMode.ListElement, Context.ScopeSelectorModalCurrent) @Component({ selector: 'ds-publication-sidebar-search-list-element', templateUrl: '../../sidebar-search-list-element.component.html' diff --git a/src/app/shared/search-form/scope-selector-modal/scope-selector-modal.component.html b/src/app/shared/search-form/scope-selector-modal/scope-selector-modal.component.html index bf5c15e9637..2d8763383bf 100644 --- a/src/app/shared/search-form/scope-selector-modal/scope-selector-modal.component.html +++ b/src/app/shared/search-form/scope-selector-modal/scope-selector-modal.component.html @@ -14,6 +14,8 @@

{{'dso-selector.' + action + '.' + objectType.toString().toLowerCase() + '.input-header' | translate}}
- + + diff --git a/src/app/shared/search-form/scope-selector-modal/scope-selector-modal.component.ts b/src/app/shared/search-form/scope-selector-modal/scope-selector-modal.component.ts index 86c30102875..e610d997c7a 100644 --- a/src/app/shared/search-form/scope-selector-modal/scope-selector-modal.component.ts +++ b/src/app/shared/search-form/scope-selector-modal/scope-selector-modal.component.ts @@ -4,6 +4,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { DSpaceObjectType } from '../../../core/shared/dspace-object-type.model'; import { DSOSelectorModalWrapperComponent, SelectorActionType } from '../../dso-selector/modal-wrappers/dso-selector-modal-wrapper.component'; import { DSpaceObject } from '../../../core/shared/dspace-object.model'; +import { Context } from '../../../core/shared/context.model'; /** * Component to wrap a button - to select the entire repository - @@ -17,6 +18,9 @@ import { DSpaceObject } from '../../../core/shared/dspace-object.model'; templateUrl: './scope-selector-modal.component.html', }) export class ScopeSelectorModalComponent extends DSOSelectorModalWrapperComponent implements OnInit { + + readonly Context = Context; + objectType = DSpaceObjectType.COMMUNITY; /** * The types of DSO that can be selected from this list