Skip to content

entity-dropdown loading authorized import searchlist #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: dspace-cris-2023_02_x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
class="dropdown-menu"
id="entityControlsDropdownMenu"
aria-labelledby="dropdownSubmission">
<ds-entity-dropdown [isSubmission]="false" (selectionChange)="openDialog($event)"></ds-entity-dropdown>
<ds-entity-dropdown [isSubmission]="true" (selectionChange)="openDialog($event)"></ds-entity-dropdown>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
class="dropdown-menu"
id="importControlsDropdownMenu"
aria-labelledby="dropdownImport">
<ds-entity-dropdown [isSubmission]="false" (selectionChange)="openPage($event)"></ds-entity-dropdown>
<ds-entity-dropdown [isSubmission]="false" [isExternalImport]="true" (selectionChange)="openPage($event)"></ds-entity-dropdown>
</div>
</div>
25 changes: 21 additions & 4 deletions src/app/shared/entity-dropdown/entity-dropdown.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
ChangeDetectorRef,
Component,
ElementRef,
EventEmitter,
HostListener,
Input,
Expand Down Expand Up @@ -58,6 +57,12 @@ export class EntityDropdownComponent implements OnInit, OnDestroy {
*/
@Input() isSubmission: boolean;

/**
* TRUE if the parent operation is a 'Import metadata from an external source' operation, FALSE otherwise (eg.: is an 'Export Item' operation).
*/
@Input() isExternalImport = false;


/**
* The entity to output to the parent component
*/
Expand Down Expand Up @@ -90,13 +95,11 @@ export class EntityDropdownComponent implements OnInit, OnDestroy {
* @param {ChangeDetectorRef} changeDetectorRef
* @param {EntityTypeDataService} entityTypeService
* @param {ItemExportFormatService} itemExportFormatService
* @param {ElementRef} el
*/
constructor(
private changeDetectorRef: ChangeDetectorRef,
private entityTypeService: EntityTypeDataService,
private itemExportFormatService: ItemExportFormatService,
private el: ElementRef
) { }

/**
Expand Down Expand Up @@ -175,7 +178,21 @@ export class EntityDropdownComponent implements OnInit, OnDestroy {
}
})
);
} else {
} else if (this.isExternalImport) {
const findOptions: FindListOptions = {
elementsPerPage: 10,
currentPage: page
};
searchListEntity$ = this.entityTypeService.getAllAuthorizedRelationshipTypeImport(findOptions)
.pipe(
getFirstSucceededRemoteWithNotEmptyData(),
tap(entityType => {
if ((this.searchListEntity.length + findOptions.elementsPerPage) >= entityType.payload.totalElements) {
this.hasNextPage = false;
}
})
);
} else {
searchListEntity$ =
this.itemExportFormatService.byEntityTypeAndMolteplicity(null, ItemExportFormatMolteplicity.MULTIPLE)
.pipe(
Expand Down