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