mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
100302: Fix issues with live import
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
<ds-collection-dropdown [ngClass]="{'d-none': isLoading()}"
|
||||
(selectionChange)="selectObject($event)"
|
||||
(searchComplete)="searchComplete()"
|
||||
(theOnlySelectable)="theOnlySelectable($event)"
|
||||
[entityType]="entityType">
|
||||
</ds-collection-dropdown>
|
||||
</div>
|
||||
|
@@ -64,7 +64,7 @@ describe('SubmissionImportExternalCollectionComponent test suite', () => {
|
||||
compAsAny = null;
|
||||
});
|
||||
|
||||
it('should emit from selectedEvent on selectObject', () => {
|
||||
it('should emit from selectedEvent on selectObject and set loading to true', () => {
|
||||
spyOn(comp.selectedEvent, 'emit').and.callThrough();
|
||||
|
||||
const entry = {
|
||||
@@ -79,6 +79,7 @@ describe('SubmissionImportExternalCollectionComponent test suite', () => {
|
||||
comp.selectObject(entry);
|
||||
|
||||
expect(comp.selectedEvent.emit).toHaveBeenCalledWith(entry);
|
||||
expect(comp.loading).toBeTrue();
|
||||
});
|
||||
|
||||
it('should dismiss modal on closeCollectionModal', () => {
|
||||
|
@@ -38,6 +38,7 @@ export class SubmissionImportExternalCollectionComponent {
|
||||
* This method emits the selected Collection from the 'selectedEvent' variable.
|
||||
*/
|
||||
public selectObject(object: CollectionListEntry): void {
|
||||
this.loading = true;
|
||||
this.selectedEvent.emit(object);
|
||||
}
|
||||
|
||||
|
@@ -15,7 +15,9 @@ import { Context } from '../../core/shared/context.model';
|
||||
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
||||
import { RouteService } from '../../core/services/route.service';
|
||||
import { createSuccessfulRemoteDataObject } from '../../shared/remote-data.utils';
|
||||
import { SubmissionImportExternalPreviewComponent } from './import-external-preview/submission-import-external-preview.component';
|
||||
import {
|
||||
SubmissionImportExternalPreviewComponent
|
||||
} from './import-external-preview/submission-import-external-preview.component';
|
||||
import { fadeIn } from '../../shared/animations/fade';
|
||||
import { PageInfo } from '../../core/shared/page-info.model';
|
||||
import { hasValue, isNotEmpty } from '../../shared/empty.util';
|
||||
@@ -186,12 +188,17 @@ export class SubmissionImportExternalComponent implements OnInit, OnDestroy {
|
||||
this.retrieveExternalSourcesSub = this.reload$.pipe(
|
||||
filter((sourceQueryObject: ExternalSourceData) => isNotEmpty(sourceQueryObject.sourceId) && isNotEmpty(sourceQueryObject.query)),
|
||||
switchMap((sourceQueryObject: ExternalSourceData) => {
|
||||
const currentEntry = this.entriesRD$.getValue();
|
||||
let useCache = true;
|
||||
if (hasValue(currentEntry) && currentEntry.isError) {
|
||||
useCache = false;
|
||||
}
|
||||
const query = sourceQueryObject.query;
|
||||
this.routeData = sourceQueryObject;
|
||||
return this.searchConfigService.paginatedSearchOptions.pipe(
|
||||
tap(() => this.isLoading$.next(true)),
|
||||
filter((searchOptions) => searchOptions.query === query),
|
||||
mergeMap((searchOptions) => this.externalService.getExternalSourceEntries(this.routeData.sourceId, searchOptions).pipe(
|
||||
mergeMap((searchOptions) => this.externalService.getExternalSourceEntries(this.routeData.sourceId, searchOptions, useCache).pipe(
|
||||
getFinishedRemoteData(),
|
||||
))
|
||||
);
|
||||
|
Reference in New Issue
Block a user