Skip to content

Commit

Permalink
Merge branch 'main' into CST-12109-WITHDRAWN-REINSTATE-requests
Browse files Browse the repository at this point in the history
  • Loading branch information
alisaismailati committed Feb 22, 2024
2 parents c34a49e + 1c7f098 commit 6c73a2e
Show file tree
Hide file tree
Showing 35 changed files with 288 additions and 222 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
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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,21 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit {
if (this.contentType === 'collection') {
comColRoute = getCollectionPageRoute(this.id);
allOptions.push({
id: 'recent_submissions',
label: 'collection.page.browse.recent.head',
id: 'search',
label: 'collection.page.browse.search.head',
routerLink: comColRoute,
});
} else if (this.contentType === 'community') {
comColRoute = getCommunityPageRoute(this.id);
allOptions.push({
id: 'search',
label: 'collection.page.browse.search.head',
routerLink: comColRoute,
});
allOptions.push({
id: 'comcols',
label: 'community.all-lists.head',
routerLink: comColRoute,
routerLink: `${comColRoute}/subcoms-cols`,
});
}

Expand Down
4 changes: 4 additions & 0 deletions src/app/shared/comcol/comcol.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { FormModule } from '../form/form.module';
import { UploadModule } from '../upload/upload.module';
import { ComcolBrowseByComponent } from './sections/comcol-browse-by/comcol-browse-by.component';
import { BrowseByModule } from '../../browse-by/browse-by.module';
import { SearchModule } from '../search/search.module';
import { ComcolSearchSectionComponent } from './sections/comcol-search-section/comcol-search-section.component';

const COMPONENTS = [
ComcolPageContentComponent,
Expand All @@ -33,6 +35,7 @@ const COMPONENTS = [
ComcolRoleComponent,
ThemedComcolPageHandleComponent,
ComcolBrowseByComponent,
ComcolSearchSectionComponent,
];

@NgModule({
Expand All @@ -45,6 +48,7 @@ const COMPONENTS = [
SharedModule,
UploadModule,
BrowseByModule,
SearchModule,
],
exports: [
...COMPONENTS,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<ds-themed-search
[configuration]="(comcol$ | async)?.type"
[showSidebar]="showSidebar$ | async"
[showScopeSelector]="false"
[hideScopeInUrl]="true"
[scope]="(comcol$ | async)?.id">
</ds-themed-search>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ComcolSearchSectionComponent } from './comcol-search-section.component';
import { ActivatedRoute } from '@angular/router';
import { ActivatedRouteStub } from '../../../testing/active-router.stub';
import { APP_CONFIG } from '../../../../../config/app-config.interface';
import { environment } from '../../../../../environments/environment.test';

describe('ComcolSearchSectionComponent', () => {
let component: ComcolSearchSectionComponent;
let fixture: ComponentFixture<ComcolSearchSectionComponent>;

let route: ActivatedRouteStub;

beforeEach(async () => {
route = new ActivatedRouteStub();

await TestBed.configureTestingModule({
declarations: [
ComcolSearchSectionComponent,
],
providers: [
{ provide: APP_CONFIG, useValue: environment },
{ provide: ActivatedRoute, useValue: route },
],
}).compileComponents();

fixture = TestBed.createComponent(ComcolSearchSectionComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Loading

0 comments on commit 6c73a2e

Please sign in to comment.