Skip to content

Commit cc23e23

Browse files
entity-dropdown loading authorized import searchlist
fixes 4Science#14 and removed unused references/imports
1 parent 87b73d3 commit cc23e23

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

src/app/my-dspace-page/my-dspace-new-submission/my-dspace-new-bulk-import/my-dspace-new-bulk-import.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
class="dropdown-menu"
2323
id="entityControlsDropdownMenu"
2424
aria-labelledby="dropdownSubmission">
25-
<ds-entity-dropdown [isSubmission]="false" (selectionChange)="openDialog($event)"></ds-entity-dropdown>
25+
<ds-entity-dropdown [isSubmission]="true" (selectionChange)="openDialog($event)"></ds-entity-dropdown>
2626
</div>
2727
</div>

src/app/my-dspace-page/my-dspace-new-submission/my-dspace-new-external-dropdown/my-dspace-new-external-dropdown.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020
class="dropdown-menu"
2121
id="importControlsDropdownMenu"
2222
aria-labelledby="dropdownImport">
23-
<ds-entity-dropdown [isSubmission]="false" (selectionChange)="openPage($event)"></ds-entity-dropdown>
23+
<ds-entity-dropdown [isSubmission]="false" [isExternalImport]="true" (selectionChange)="openPage($event)"></ds-entity-dropdown>
2424
</div>
2525
</div>

src/app/shared/entity-dropdown/entity-dropdown.component.ts

+21-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {
22
ChangeDetectorRef,
33
Component,
4-
ElementRef,
54
EventEmitter,
65
HostListener,
76
Input,
@@ -23,7 +22,6 @@ import {
2322
} from '../../core/itemexportformat/item-export-format.service';
2423
import { createSuccessfulRemoteDataObject } from '../remote-data.utils';
2524
import { FindListOptions } from '../../core/data/find-list-options.model';
26-
import { ItemExportFormatMap } from '../../core/itemexportformat/model/item-export-format.model';
2725

2826
@Component({
2927
selector: 'ds-entity-dropdown',
@@ -59,6 +57,12 @@ export class EntityDropdownComponent implements OnInit, OnDestroy {
5957
*/
6058
@Input() isSubmission: boolean;
6159

60+
/**
61+
* TRUE if the parent operation is a 'Import metadata from an external source' operation, FALSE otherwise (eg.: is an 'Export Item' operation).
62+
*/
63+
@Input() isExternalImport = false;
64+
65+
6266
/**
6367
* The entity to output to the parent component
6468
*/
@@ -91,13 +95,11 @@ export class EntityDropdownComponent implements OnInit, OnDestroy {
9195
* @param {ChangeDetectorRef} changeDetectorRef
9296
* @param {EntityTypeDataService} entityTypeService
9397
* @param {ItemExportFormatService} itemExportFormatService
94-
* @param {ElementRef} el
9598
*/
9699
constructor(
97100
private changeDetectorRef: ChangeDetectorRef,
98101
private entityTypeService: EntityTypeDataService,
99102
private itemExportFormatService: ItemExportFormatService,
100-
private el: ElementRef
101103
) { }
102104

103105
/**
@@ -176,7 +178,21 @@ export class EntityDropdownComponent implements OnInit, OnDestroy {
176178
}
177179
})
178180
);
179-
} else {
181+
} else if (this.isExternalImport) {
182+
const findOptions: FindListOptions = {
183+
elementsPerPage: 10,
184+
currentPage: page
185+
};
186+
searchListEntity$ = this.entityTypeService.getAllAuthorizedRelationshipTypeImport(findOptions)
187+
.pipe(
188+
getFirstSucceededRemoteWithNotEmptyData(),
189+
tap(entityType => {
190+
if ((this.searchListEntity.length + findOptions.elementsPerPage) >= entityType.payload.totalElements) {
191+
this.hasNextPage = false;
192+
}
193+
})
194+
);
195+
} else {
180196
searchListEntity$ =
181197
this.itemExportFormatService.byEntityTypeAndMolteplicity(null, ItemExportFormatMolteplicity.MULTIPLE)
182198
.pipe(

0 commit comments

Comments
 (0)