diff --git a/docker/docker-compose-ci.yml b/docker/docker-compose-ci.yml index d2d02f0a55..18fa152c9d 100644 --- a/docker/docker-compose-ci.yml +++ b/docker/docker-compose-ci.yml @@ -64,7 +64,7 @@ services: dspacesolr: container_name: dspacesolr # Uses official Solr image at https://hub.docker.com/_/solr/ - image: solr:8.8 + image: solr:8.11-slim # Needs main 'dspace' container to start first to guarantee access to solr_configs depends_on: - dspace diff --git a/docker/docker-compose-rest.yml b/docker/docker-compose-rest.yml index 370ccbbdf1..3534682afc 100644 --- a/docker/docker-compose-rest.yml +++ b/docker/docker-compose-rest.yml @@ -62,7 +62,7 @@ services: dspacesolr: container_name: dspacesolr # Uses official Solr image at https://hub.docker.com/_/solr/ - image: solr:8.8 + image: solr:8.11-slim # Needs main 'dspace' container to start first to guarantee access to solr_configs depends_on: - dspace diff --git a/src/app/admin/admin-search-page/admin-search.module.ts b/src/app/admin/admin-search-page/admin-search.module.ts index 0b3b7df9bb..ecf8d8a2d2 100644 --- a/src/app/admin/admin-search-page/admin-search.module.ts +++ b/src/app/admin/admin-search-page/admin-search.module.ts @@ -36,7 +36,7 @@ const ENTRY_COMPONENTS = [ export class AdminSearchModule { /** * NOTE: this method allows to resolve issue with components that using a custom decorator - * which are not loaded during CSR otherwise + * which are not loaded during SSR otherwise */ static withEntryComponents() { return { diff --git a/src/app/admin/admin-workflow-page/admin-workflow.module.ts b/src/app/admin/admin-workflow-page/admin-workflow.module.ts index 4715ae16f4..02e5e01023 100644 --- a/src/app/admin/admin-workflow-page/admin-workflow.module.ts +++ b/src/app/admin/admin-workflow-page/admin-workflow.module.ts @@ -28,7 +28,7 @@ const ENTRY_COMPONENTS = [ export class AdminWorkflowModuleModule { /** * NOTE: this method allows to resolve issue with components that using a custom decorator - * which are not loaded during CSR otherwise + * which are not loaded during SSR otherwise */ static withEntryComponents() { return { diff --git a/src/app/admin/admin.module.ts b/src/app/admin/admin.module.ts index 25cdd67dcf..6c756dd851 100644 --- a/src/app/admin/admin.module.ts +++ b/src/app/admin/admin.module.ts @@ -34,7 +34,7 @@ const ENTRY_COMPONENTS = [ export class AdminModule { /** * NOTE: this method allows to resolve issue with components that using a custom decorator - * which are not loaded during CSR otherwise + * which are not loaded during SSR otherwise */ static withEntryComponents() { return { diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 4a9810e4da..88f7791b1b 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -218,7 +218,6 @@ import { ServerCheckGuard } from './core/server-check/server-check.guard'; } ], { onSameUrlNavigation: 'reload', - relativeLinkResolution: 'legacy' }) ], exports: [RouterModule], diff --git a/src/app/browse-by/browse-by.module.ts b/src/app/browse-by/browse-by.module.ts index 2d3618aae6..cd44e52b81 100644 --- a/src/app/browse-by/browse-by.module.ts +++ b/src/app/browse-by/browse-by.module.ts @@ -31,7 +31,7 @@ const ENTRY_COMPONENTS = [ export class BrowseByModule { /** * NOTE: this method allows to resolve issue with components that using a custom decorator - * which are not loaded during CSR otherwise + * which are not loaded during SSR otherwise */ static withEntryComponents() { return { diff --git a/src/app/entity-groups/journal-entities/journal-entities.module.ts b/src/app/entity-groups/journal-entities/journal-entities.module.ts index e23a729d6a..dc88490eac 100644 --- a/src/app/entity-groups/journal-entities/journal-entities.module.ts +++ b/src/app/entity-groups/journal-entities/journal-entities.module.ts @@ -54,7 +54,7 @@ const ENTRY_COMPONENTS = [ export class JournalEntitiesModule { /** * NOTE: this method allows to resolve issue with components that using a custom decorator - * which are not loaded during CSR otherwise + * which are not loaded during SSR otherwise */ static withEntryComponents() { return { diff --git a/src/app/entity-groups/research-entities/research-entities.module.ts b/src/app/entity-groups/research-entities/research-entities.module.ts index 2e91a6f1e7..c9d6c2d5b6 100644 --- a/src/app/entity-groups/research-entities/research-entities.module.ts +++ b/src/app/entity-groups/research-entities/research-entities.module.ts @@ -74,7 +74,7 @@ const COMPONENTS = [ export class ResearchEntitiesModule { /** * NOTE: this method allows to resolve issue with components that using a custom decorator - * which are not loaded during CSR otherwise + * which are not loaded during SSR otherwise */ static withEntryComponents() { return { diff --git a/src/app/item-page/item-page.module.ts b/src/app/item-page/item-page.module.ts index 2e3e248692..80cb1f61a2 100644 --- a/src/app/item-page/item-page.module.ts +++ b/src/app/item-page/item-page.module.ts @@ -33,7 +33,7 @@ import { NgxGalleryModule } from '@kolkov/ngx-gallery'; import { MiradorViewerComponent } from './mirador-viewer/mirador-viewer.component'; import { VersionPageComponent } from './version-page/version-page/version-page.component'; import { VersionedItemComponent } from './simple/item-types/versioned-item/versioned-item.component'; -import { ThemedFileSectionComponent} from './simple/field-components/file-section/themed-file-section.component'; +import { ThemedFileSectionComponent } from './simple/field-components/file-section/themed-file-section.component'; const ENTRY_COMPONENTS = [ @@ -91,7 +91,7 @@ const DECLARATIONS = [ export class ItemPageModule { /** * NOTE: this method allows to resolve issue with components that using a custom decorator - * which are not loaded during CSR otherwise + * which are not loaded during SSR otherwise */ static withEntryComponents() { return { diff --git a/src/app/my-dspace-page/my-dspace-page.component.html b/src/app/my-dspace-page/my-dspace-page.component.html index 4aadb16255..5a15abcc08 100644 --- a/src/app/my-dspace-page/my-dspace-page.component.html +++ b/src/app/my-dspace-page/my-dspace-page.component.html @@ -4,7 +4,7 @@ = new InjectionToken('searchConfigurationService'); @@ -111,8 +111,7 @@ export class MyDSpacePageComponent implements OnInit { constructor(private service: SearchService, private sidebarService: SidebarService, private windowService: HostWindowService, - @Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: MyDSpaceConfigurationService, - private routeService: RouteService) { + @Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: MyDSpaceConfigurationService) { this.isXsOrSm$ = this.windowService.isXsOrSm(); this.service.setServiceOptions(MyDSpaceResponseParsingService, MyDSpaceRequest); } @@ -134,8 +133,8 @@ export class MyDSpacePageComponent implements OnInit { this.searchOptions$ = this.searchConfigService.paginatedSearchOptions; this.sub = this.searchOptions$.pipe( tap(() => this.resultsRD$.next(null)), - switchMap((options: PaginatedSearchOptions) => this.service.search(options).pipe(getFirstSucceededRemoteData()))) - .subscribe((results) => { + switchMap((options: PaginatedSearchOptions) => this.service.search(options).pipe(getFirstCompletedRemoteData()))) + .subscribe((results: RemoteData>) => { this.resultsRD$.next(results); }); diff --git a/src/app/my-dspace-page/my-dspace-results/my-dspace-results.component.html b/src/app/my-dspace-page/my-dspace-results/my-dspace-results.component.html index 2710285f0d..67b13cc49c 100644 --- a/src/app/my-dspace-page/my-dspace-results/my-dspace-results.component.html +++ b/src/app/my-dspace-page/my-dspace-results/my-dspace-results.component.html @@ -10,5 +10,5 @@ - +

{{'mydspace.results.no-results' | translate}}

diff --git a/src/app/my-dspace-page/my-dspace-results/my-dspace-results.component.spec.ts b/src/app/my-dspace-page/my-dspace-results/my-dspace-results.component.spec.ts index 29a2e593de..5b069f4ddb 100644 --- a/src/app/my-dspace-page/my-dspace-results/my-dspace-results.component.spec.ts +++ b/src/app/my-dspace-page/my-dspace-results/my-dspace-results.component.spec.ts @@ -40,9 +40,19 @@ describe('MyDSpaceResultsComponent', () => { expect(fixture.debugElement.query(By.css('a'))).toBeNull(); }); - it('should display error message if error is != 400', () => { - (comp as any).searchResults = { hasFailed: true, error: { statusCode: 500 } }; + it('should display error message if error is 500', () => { + (comp as any).searchResults = { hasFailed: true, statusCode: 500 }; fixture.detectChanges(); + expect(comp.showError()).toBeTrue(); + expect(comp.errorMessageLabel()).toBe('error.search-results'); + expect(fixture.debugElement.query(By.css('ds-error'))).not.toBeNull(); + }); + + it('should display error message if error is 422', () => { + (comp as any).searchResults = { hasFailed: true, statusCode: 422 }; + fixture.detectChanges(); + expect(comp.showError()).toBeTrue(); + expect(comp.errorMessageLabel()).toBe('error.invalid-search-query'); expect(fixture.debugElement.query(By.css('ds-error'))).not.toBeNull(); }); diff --git a/src/app/my-dspace-page/my-dspace-results/my-dspace-results.component.ts b/src/app/my-dspace-page/my-dspace-results/my-dspace-results.component.ts index 32b6d9c9f7..77f27e9d42 100644 --- a/src/app/my-dspace-page/my-dspace-results/my-dspace-results.component.ts +++ b/src/app/my-dspace-page/my-dspace-results/my-dspace-results.component.ts @@ -58,4 +58,12 @@ export class MyDSpaceResultsComponent { isLoading() { return !this.searchResults || isEmpty(this.searchResults) || this.searchResults.isLoading; } + + showError(): boolean { + return this.searchResults?.hasFailed && (!this.searchResults?.errorMessage || this.searchResults?.statusCode !== 400); + } + + errorMessageLabel(): string { + return (this.searchResults?.statusCode === 422) ? 'error.invalid-search-query' : 'error.search-results'; + } } diff --git a/src/app/my-dspace-page/my-dspace-search.module.ts b/src/app/my-dspace-page/my-dspace-search.module.ts index a97f2207e7..67a4f0818e 100644 --- a/src/app/my-dspace-page/my-dspace-search.module.ts +++ b/src/app/my-dspace-page/my-dspace-search.module.ts @@ -50,7 +50,7 @@ const ENTRY_COMPONENTS = [ export class MyDspaceSearchModule { /** * NOTE: this method allows to resolve issue with components that using a custom decorator - * which are not loaded during CSR otherwise + * which are not loaded during SSR otherwise */ static withEntryComponents() { return { diff --git a/src/app/navbar/navbar.module.ts b/src/app/navbar/navbar.module.ts index 6591cd3453..c84e732fd5 100644 --- a/src/app/navbar/navbar.module.ts +++ b/src/app/navbar/navbar.module.ts @@ -58,7 +58,7 @@ const ENTRY_COMPONENTS = [ export class NavbarModule { /** * NOTE: this method allows to resolve issue with components that using a custom decorator - * which are not loaded during CSR otherwise + * which are not loaded during SSR otherwise */ static withEntryComponents() { return { diff --git a/src/app/search-page/search.component.ts b/src/app/search-page/search.component.ts index 8be21af552..2972175bdf 100644 --- a/src/app/search-page/search.component.ts +++ b/src/app/search-page/search.component.ts @@ -8,7 +8,7 @@ import { pushInOut } from '../shared/animations/push'; import { HostWindowService } from '../shared/host-window.service'; import { SidebarService } from '../shared/sidebar/sidebar.service'; import { hasValue, isEmpty } from '../shared/empty.util'; -import { getFirstSucceededRemoteData } from '../core/shared/operators'; +import { getFirstCompletedRemoteData } from '../core/shared/operators'; import { RouteService } from '../core/services/route.service'; import { SEARCH_CONFIG_SERVICE } from '../my-dspace-page/my-dspace-page.component'; import { PaginatedSearchOptions } from '../shared/search/paginated-search-options.model'; @@ -126,12 +126,12 @@ export class SearchComponent implements OnInit { this.searchOptions$ = this.getSearchOptions(); this.sub = this.searchOptions$.pipe( switchMap((options) => this.service.search( - options, undefined, true, true, followLink('thumbnail', { isOptional: true }) - ).pipe(getFirstSucceededRemoteData(), startWith(undefined)) + options, undefined, false, true, followLink('thumbnail', { isOptional: true }) + ).pipe(getFirstCompletedRemoteData(), startWith(undefined)) ) ).subscribe((results) => { - this.resultsRD$.next(results); - }); + this.resultsRD$.next(results); + }); if (isEmpty(this.configuration$)) { this.configuration$ = this.searchConfigService.getCurrentConfiguration('default'); diff --git a/src/app/shared/error/error.component.html b/src/app/shared/error/error.component.html index d41760e258..157c47f2cd 100644 --- a/src/app/shared/error/error.component.html +++ b/src/app/shared/error/error.component.html @@ -1,3 +1,4 @@ -
- -
+ + + + diff --git a/src/app/shared/error/error.component.spec.ts b/src/app/shared/error/error.component.spec.ts index d3e3e80c07..f8483ac7aa 100644 --- a/src/app/shared/error/error.component.spec.ts +++ b/src/app/shared/error/error.component.spec.ts @@ -36,7 +36,7 @@ describe('ErrorComponent (inline template)', () => { comp = fixture.componentInstance; // ErrorComponent test instance // query for the message