Skip to content

Commit 153a53f

Browse files
committed
100302: Fix issues with live import
1 parent ca86437 commit 153a53f

4 files changed

Lines changed: 12 additions & 4 deletions

File tree

src/app/submission/import-external/import-external-collection/submission-import-external-collection.component.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
<ds-collection-dropdown [ngClass]="{'d-none': isLoading()}"
1010
(selectionChange)="selectObject($event)"
1111
(searchComplete)="searchComplete()"
12-
(theOnlySelectable)="theOnlySelectable($event)"
1312
[entityType]="entityType">
1413
</ds-collection-dropdown>
1514
</div>

src/app/submission/import-external/import-external-collection/submission-import-external-collection.component.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe('SubmissionImportExternalCollectionComponent test suite', () => {
6464
compAsAny = null;
6565
});
6666

67-
it('should emit from selectedEvent on selectObject', () => {
67+
it('should emit from selectedEvent on selectObject and set loading to true', () => {
6868
spyOn(comp.selectedEvent, 'emit').and.callThrough();
6969

7070
const entry = {
@@ -79,6 +79,7 @@ describe('SubmissionImportExternalCollectionComponent test suite', () => {
7979
comp.selectObject(entry);
8080

8181
expect(comp.selectedEvent.emit).toHaveBeenCalledWith(entry);
82+
expect(comp.loading).toBeTrue();
8283
});
8384

8485
it('should dismiss modal on closeCollectionModal', () => {

src/app/submission/import-external/import-external-collection/submission-import-external-collection.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export class SubmissionImportExternalCollectionComponent {
3838
* This method emits the selected Collection from the 'selectedEvent' variable.
3939
*/
4040
public selectObject(object: CollectionListEntry): void {
41+
this.loading = true;
4142
this.selectedEvent.emit(object);
4243
}
4344

src/app/submission/import-external/submission-import-external.component.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ import { Context } from '../../core/shared/context.model';
1515
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
1616
import { RouteService } from '../../core/services/route.service';
1717
import { createSuccessfulRemoteDataObject } from '../../shared/remote-data.utils';
18-
import { SubmissionImportExternalPreviewComponent } from './import-external-preview/submission-import-external-preview.component';
18+
import {
19+
SubmissionImportExternalPreviewComponent
20+
} from './import-external-preview/submission-import-external-preview.component';
1921
import { fadeIn } from '../../shared/animations/fade';
2022
import { PageInfo } from '../../core/shared/page-info.model';
2123
import { hasValue, isNotEmpty } from '../../shared/empty.util';
@@ -186,12 +188,17 @@ export class SubmissionImportExternalComponent implements OnInit, OnDestroy {
186188
this.retrieveExternalSourcesSub = this.reload$.pipe(
187189
filter((sourceQueryObject: ExternalSourceData) => isNotEmpty(sourceQueryObject.sourceId) && isNotEmpty(sourceQueryObject.query)),
188190
switchMap((sourceQueryObject: ExternalSourceData) => {
191+
const currentEntry = this.entriesRD$.getValue();
192+
let useCache = true;
193+
if (hasValue(currentEntry) && currentEntry.isError) {
194+
useCache = false;
195+
}
189196
const query = sourceQueryObject.query;
190197
this.routeData = sourceQueryObject;
191198
return this.searchConfigService.paginatedSearchOptions.pipe(
192199
tap(() => this.isLoading$.next(true)),
193200
filter((searchOptions) => searchOptions.query === query),
194-
mergeMap((searchOptions) => this.externalService.getExternalSourceEntries(this.routeData.sourceId, searchOptions).pipe(
201+
mergeMap((searchOptions) => this.externalService.getExternalSourceEntries(this.routeData.sourceId, searchOptions, useCache).pipe(
195202
getFinishedRemoteData(),
196203
))
197204
);

0 commit comments

Comments
 (0)