Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into coar-notify-7
Browse files Browse the repository at this point in the history
  • Loading branch information
frabacche committed Feb 22, 2024
2 parents 58c8dd6 + 1c7f098 commit fbab8ef
Show file tree
Hide file tree
Showing 36 changed files with 315 additions and 242 deletions.
10 changes: 9 additions & 1 deletion config/config.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,17 @@ item:
# settings menu. See pageSizeOptions in 'pagination-component-options.model.ts'.
pageSize: 5

# Community Page Config
community:
# Search tab config
searchSection:
showSidebar: true

# Collection Page Config
collection:
# Search tab config
searchSection:
showSidebar: true
edit:
undoTimeout: 10000 # 10 seconds

Expand Down Expand Up @@ -391,4 +400,3 @@ comcolSelectionSort:
# suggestion:
# - collectionId: 8f7df5ca-f9c2-47a4-81ec-8a6393d6e5af
# source: "openaire"

4 changes: 2 additions & 2 deletions src/app/collection-page/collection-page-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { DSOEditMenuResolver } from '../shared/dso-page/dso-edit-menu.resolver';
import { ComcolBrowseByComponent } from '../shared/comcol/sections/comcol-browse-by/comcol-browse-by.component';
import { BrowseByGuard } from '../browse-by/browse-by-guard';
import { BrowseByI18nBreadcrumbResolver } from '../browse-by/browse-by-i18n-breadcrumb.resolver';
import { CollectionRecentlyAddedComponent } from './sections/recently-added/collection-recently-added.component';
import { ComcolSearchSectionComponent } from '../shared/comcol/sections/comcol-search-section/comcol-search-section.component';

@NgModule({
imports: [
Expand Down Expand Up @@ -73,7 +73,7 @@ import { CollectionRecentlyAddedComponent } from './sections/recently-added/coll
{
path: '',
pathMatch: 'full',
component: CollectionRecentlyAddedComponent,
component: ComcolSearchSectionComponent,
},
{
path: 'browse/:id',
Expand Down
2 changes: 0 additions & 2 deletions src/app/collection-page/collection-page.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { ComcolModule } from '../shared/comcol/comcol.module';
import { DsoSharedModule } from '../dso-shared/dso-shared.module';
import { DsoPageModule } from '../shared/dso-page/dso-page.module';
import { BrowseByPageModule } from '../browse-by/browse-by-page.module';
import { CollectionRecentlyAddedComponent } from './sections/recently-added/collection-recently-added.component';

const DECLARATIONS = [
CollectionPageComponent,
Expand All @@ -29,7 +28,6 @@ const DECLARATIONS = [
EditItemTemplatePageComponent,
ThemedEditItemTemplatePageComponent,
CollectionItemMapperComponent,
CollectionRecentlyAddedComponent,
];

@NgModule({
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

11 changes: 11 additions & 0 deletions src/app/community-page/community-page-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import { SubComColSectionComponent } from './sections/sub-com-col-section/sub-co
import { BrowseByI18nBreadcrumbResolver } from '../browse-by/browse-by-i18n-breadcrumb.resolver';
import { BrowseByGuard } from '../browse-by/browse-by-guard';
import { ComcolBrowseByComponent } from '../shared/comcol/sections/comcol-browse-by/comcol-browse-by.component';
import { ComcolSearchSectionComponent } from '../shared/comcol/sections/comcol-search-section/comcol-search-section.component';
import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';

@NgModule({
imports: [
Expand Down Expand Up @@ -56,7 +58,16 @@ import { ComcolBrowseByComponent } from '../shared/comcol/sections/comcol-browse
{
path: '',
pathMatch: 'full',
component: ComcolSearchSectionComponent,
},
{
path: 'subcoms-cols',
pathMatch: 'full',
component: SubComColSectionComponent,
resolve: {
breadcrumb: I18nBreadcrumbResolver,
},
data: { breadcrumbKey: 'community.subcoms-cols' },
},
{
path: 'browse/:id',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe('SubComColSectionComponent', () => {

beforeEach(async () => {
activatedRoute = new ActivatedRouteStub();
activatedRoute.parent = new ActivatedRouteStub();

await TestBed.configureTestingModule({
declarations: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class SubComColSectionComponent implements OnInit {
}

ngOnInit(): void {
this.community$ = this.route.data.pipe(
this.community$ = this.route.parent.data.pipe(
map((data: Data) => (data.dso as RemoteData<Community>).payload),
);
}
Expand Down
49 changes: 29 additions & 20 deletions src/app/notifications/suggestions.service.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,36 @@
import { Injectable } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';

import { of, forkJoin, Observable } from 'rxjs';
import { catchError, map, mergeMap, take } from 'rxjs/operators';

import { SortDirection, SortOptions } from '../core/cache/models/sort-options.model';
import { FindListOptions } from '../core/data/find-list-options.model';
import { PaginatedList } from '../core/data/paginated-list.model';
import { RemoteData } from '../core/data/remote-data';
import { SuggestionTarget } from '../core/notifications/models/suggestion-target.model';
import { SuggestionsDataService } from '../core/notifications/suggestions-data.service';
import { SuggestionTargetDataService } from '../core/notifications/target/suggestion-target-data.service';
import { ResearcherProfileDataService } from '../core/profile/researcher-profile-data.service';
import { NoContent } from '../core/shared/NoContent.model';
import { getFirstSucceededRemoteListPayload, getFirstSucceededRemoteDataPayload, getAllSucceededRemoteDataPayload, getFinishedRemoteData } from '../core/shared/operators';
import { getSuggestionPageRoute } from '../suggestions-page/suggestions-page-routing-paths';
import { environment } from '../../environments/environment';
import { SuggestionConfig } from '../../config/suggestion-config.interfaces';
import { Suggestion } from '../core/notifications/models/suggestion.model';
import { ResearcherProfile } from '../core/profile/model/researcher-profile.model';
import { PaginatedList } from '../core/data/paginated-list.model';
import { SuggestionTarget } from '../core/suggestion-notifications/models/suggestion-target.model';
import { hasValue, isNotEmpty } from '../shared/empty.util';
import { ResearcherProfile } from '../core/profile/model/researcher-profile.model';
import {
getAllSucceededRemoteDataPayload,
getFinishedRemoteData, getFirstCompletedRemoteData,
getFirstSucceededRemoteDataPayload,
getFirstSucceededRemoteListPayload
} from '../core/shared/operators';
import { Suggestion } from '../core/suggestion-notifications/models/suggestion.model';
import { WorkspaceitemDataService } from '../core/submission/workspaceitem-data.service';
import { TranslateService } from '@ngx-translate/core';
import { NoContent } from '../core/shared/NoContent.model';
import { environment } from '../../environments/environment';
import { WorkspaceItem } from '../core/submission/models/workspaceitem.model';

import {FindListOptions} from '../core/data/find-list-options.model';
import {SuggestionConfig} from '../../config/suggestion-config.interfaces';
import { ResearcherProfileDataService } from '../core/profile/researcher-profile-data.service';
import {
SuggestionTargetDataService
} from '../core/suggestion-notifications/target/suggestion-target-data.service';
import {
SuggestionsDataService
} from '../core/suggestion-notifications/suggestions-data.service';
import { getSuggestionPageRoute } from '../suggestions-page/suggestions-page-routing-paths';

/**
* useful for multiple approvals and ignores operation
Expand Down Expand Up @@ -146,10 +155,10 @@ export class SuggestionsService {
*/
public retrieveCurrentUserSuggestions(userUuid: string): Observable<SuggestionTarget[]> {
return this.researcherProfileService.findById(userUuid, true).pipe(
getFirstSucceededRemoteDataPayload(),
mergeMap((profile: ResearcherProfile) => {
if (isNotEmpty(profile)) {
return this.researcherProfileService.findRelatedItemId(profile).pipe(
getFirstCompletedRemoteData(),
mergeMap((profile: RemoteData<ResearcherProfile> ) => {
if (isNotEmpty(profile) && profile.hasSucceeded && isNotEmpty(profile.payload)) {
return this.researcherProfileService.findRelatedItemId(profile.payload).pipe(
mergeMap((itemId: string) => {
return this.suggestionsDataService.getTargetsByUser(itemId).pipe(
getFirstSucceededRemoteListPayload()
Expand All @@ -160,7 +169,7 @@ export class SuggestionsService {
return of([]);
}
}),
take(1)
catchError(() => of([]))
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/search-navbar/search-navbar.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('SearchNavbarComponent', () => {
fixture.detectChanges();
}));
it('to search page with empty query', () => {
const extras: NavigationExtras = { queryParams: { query: '' }, queryParamsHandling: 'merge' };
const extras: NavigationExtras = { queryParams: { query: '' } };
expect(component.onSubmit).toHaveBeenCalledWith({ query: '' });
expect(router.navigate).toHaveBeenCalledWith(['search'], extras);
});
Expand All @@ -113,7 +113,7 @@ describe('SearchNavbarComponent', () => {
fixture.detectChanges();
}));
it('to search page with query', async () => {
const extras: NavigationExtras = { queryParams: { query: 'test' }, queryParamsHandling: 'merge' };
const extras: NavigationExtras = { queryParams: { query: 'test' } };
expect(component.onSubmit).toHaveBeenCalledWith({ query: 'test' });

expect(router.navigate).toHaveBeenCalledWith(['search'], extras);
Expand Down
3 changes: 1 addition & 2 deletions src/app/search-navbar/search-navbar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ export class SearchNavbarComponent {
this.searchForm.reset();

this.router.navigate(linkToNavigateTo, {
queryParams: queryParams,
queryParamsHandling: 'merge'
queryParams: queryParams
});
}
}
7 changes: 5 additions & 2 deletions src/app/search-page/configuration-search-page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { SearchConfigurationService } from '../core/shared/search/search-configu
import { RouteService } from '../core/services/route.service';
import { SearchService } from '../core/shared/search/search.service';
import { Router } from '@angular/router';
import { APP_CONFIG, AppConfig } from '../../config/app-config.interface';

/**
* This component renders a search page using a configuration as input.
Expand All @@ -32,7 +33,9 @@ export class ConfigurationSearchPageComponent extends SearchComponent {
protected windowService: HostWindowService,
@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService,
protected routeService: RouteService,
protected router: Router) {
super(service, sidebarService, windowService, searchConfigService, routeService, router);
protected router: Router,
@Inject(APP_CONFIG) protected appConfig: AppConfig,
) {
super(service, sidebarService, windowService, searchConfigService, routeService, router, appConfig);
}
}
Loading

0 comments on commit fbab8ef

Please sign in to comment.