Skip to content

Commit

Permalink
Merge branch 'w2p-108608_created-search-scope-selector_contribute-7.2…
Browse files Browse the repository at this point in the history
…' into w2p-108608_created-search-scope-selector_contribute-main

# Conflicts:
#	src/app/core/shared/context.model.ts
#	src/app/shared/search-form/scope-selector-modal/scope-selector-modal.component.html
#	src/app/shared/search-form/scope-selector-modal/scope-selector-modal.component.ts
  • Loading branch information
alexandrevryghem committed Nov 22, 2023
2 parents 4f340d8 + 9c3e3d9 commit 30aa34d
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/app/core/shared/context.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export enum Context {
SideBarSearchModal = 'sideBarSearchModal',
SideBarSearchModalCurrent = 'sideBarSearchModalCurrent',

ScopeSelectorModal = 'scopeSelectorModal',
ScopeSelectorModalCurrent = 'scopeSelectorModalCurrent',

/** The MyDSpace* Context values below are used for badge display in MyDSpace. */
MyDSpaceArchived = 'mydspaceArchived',
MyDSpaceWorkspace = 'mydspaceWorkspace',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,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
*/
Expand Down Expand Up @@ -266,7 +272,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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ <h3 class="position-relative py-1 my-3 font-weight-normal">
</h3>

<h5 class="px-2">{{'dso-selector.' + action + '.' + objectType.toString().toLowerCase() + '.input-header' | translate}}</h5>
<ds-dso-selector [currentDSOId]="dsoRD?.payload.uuid" [types]="selectorTypes" [sort]="defaultSort" (onSelect)="selectObject($event)"></ds-dso-selector>
<ds-dso-selector [context]="Context.ScopeSelectorModal" [currentDSOId]="dsoRD?.payload.uuid"
[types]="selectorTypes" [sort]="defaultSort" (onSelect)="selectObject($event)">
</ds-dso-selector>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { DSOSelectorModalWrapperComponent, SelectorActionType } from '../../dso-
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
import { environment } from '../../../../environments/environment';
import { Context } from '../../../core/shared/context.model';

/**
* Component to wrap a button - to select the entire repository -
Expand All @@ -19,6 +20,9 @@ import { environment } from '../../../../environments/environment';
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
Expand Down

0 comments on commit 30aa34d

Please sign in to comment.