Skip to content

Commit

Permalink
revert (maybe) unneeded
Browse files Browse the repository at this point in the history
  • Loading branch information
Jens Vannerum committed Dec 16, 2024
1 parent b93d4e7 commit c97a3cc
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 27 deletions.
12 changes: 5 additions & 7 deletions src/app/browse-by/browse-by-date/browse-by-date.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ export class BrowseByDateComponent extends BrowseByMetadataComponent implements
}

ngOnInit(): void {
console.log('BrowseByDateComponent ngOnInit called');

const sortConfig = new SortOptions('default', SortDirection.ASC);
this.startsWithType = StartsWithType.date;
// include the thumbnail configuration in browse search options
Expand All @@ -113,11 +111,11 @@ export class BrowseByDateComponent extends BrowseByMetadataComponent implements
this.subs.push(
observableCombineLatest(
[ this.route.params,
this.route.queryParams.pipe(take(1), tap((x) => console.log('BrowseByDateComponent this.route.queryParams', x))),
this.scope$.pipe(tap((x) => console.log('BrowseByDateComponent this.scope$', x))),
this.route.data.pipe(tap((x) => console.log('BrowseByDateComponent this.route.data', x))),
this.currentPagination$.pipe(tap((x) => console.log('BrowseByDateComponent this.currentPagination$', x))),
this.currentSort$.pipe(tap((x) => console.log('BrowseByDateComponent this.currentSort$', x))),
this.route.queryParams.pipe(take(1)),
this.scope$,
this.route.data,
this.currentPagination$,
this.currentSort$,
]).pipe(
map(([routeParams, queryParams, scope, data, currentPage, currentSort]) => {
return [Object.assign({}, routeParams, queryParams, data), scope, currentPage, currentSort];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,19 +210,18 @@ export class BrowseByMetadataComponent implements OnInit, OnChanges, OnDestroy {


ngOnInit(): void {
console.log('BrowseByMetadataComponent ngOnInit called');

const sortConfig = new SortOptions('default', SortDirection.ASC);
this.updatePage(getBrowseSearchOptions(this.defaultBrowseId, this.paginationConfig, sortConfig));
this.currentPagination$ = this.paginationService.getCurrentPagination(this.paginationConfig.id, this.paginationConfig);
this.currentSort$ = this.paginationService.getCurrentSort(this.paginationConfig.id, sortConfig);
this.subs.push(
observableCombineLatest(
[ this.route.params.pipe(take(1), tap((x) => console.log('BrowseByMetadataComponent this.route.params', x))),
this.route.queryParams.pipe(tap((x) => console.log('BrowseByMetadataComponent this.route.queryParams', x))),
this.scope$.pipe(tap((x) => console.log('BrowseByMetadataComponent this.route.queryParams', x))),
this.currentPagination$.pipe(tap((x) => console.log('BrowseByMetadataComponent this.route.queryParams', x))),
this.currentSort$.pipe(tap((x) => console.log('BrowseByMetadataComponent this.route.queryParams', x))),
[ this.route.params.pipe(take(1)),
this.route.queryParams,
this.scope$,
this.currentPagination$,
this.currentSort$,
]).pipe(
map(([routeParams, queryParams, scope, currentPage, currentSort]) => {
return [Object.assign({}, routeParams, queryParams), scope, currentPage, currentSort];
Expand Down
7 changes: 3 additions & 4 deletions src/app/browse-by/browse-by-page/browse-by-page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Observable } from 'rxjs';
import { map, tap, distinctUntilChanged } from 'rxjs/operators';
import { map } from 'rxjs/operators';

import { BrowseDefinition } from '../../core/shared/browse-definition.model';
import { BrowseByDataType } from '../browse-by-switcher/browse-by-data-type';
Expand All @@ -23,7 +23,7 @@ import { BrowseBySwitcherComponent } from '../browse-by-switcher/browse-by-switc
})
export class BrowseByPageComponent implements OnInit {

browseByType$: Observable<{type: BrowseByDataType }>;
browseByType$: Observable<BrowseByDataType>;

constructor(
protected route: ActivatedRoute,
Expand All @@ -35,8 +35,7 @@ export class BrowseByPageComponent implements OnInit {
*/
ngOnInit(): void {
this.browseByType$ = this.route.data.pipe(
map((data: { browseDefinition: BrowseDefinition }) => ({ type: data.browseDefinition.getRenderType() })),
tap((x) => console.log('BrowseByPageComponent browseByType$ =', x)),
map((data: { browseDefinition: BrowseDefinition }) => data.browseDefinition.getRenderType()),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
} from '@angular/common';
import {
Component,
Input, SimpleChanges,
Input,
} from '@angular/core';

import { Context } from '../../core/shared/context.model';
Expand All @@ -24,7 +24,7 @@ export class BrowseBySwitcherComponent extends AbstractComponentLoaderComponent<

@Input() context: Context;

@Input() browseByType: { type: BrowseByDataType };
@Input() browseByType: BrowseByDataType;

@Input() displayTitle: boolean;

Expand All @@ -43,7 +43,7 @@ export class BrowseBySwitcherComponent extends AbstractComponentLoaderComponent<
];

public getComponent(): GenericConstructor<Component> {
return getComponentByBrowseByType(this.browseByType.type, this.context, this.themeService.getThemeName());
return getComponentByBrowseByType(this.browseByType, this.context, this.themeService.getThemeName());
}

}
12 changes: 5 additions & 7 deletions src/app/browse-by/browse-by-title/browse-by-title.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,20 @@ import {
export class BrowseByTitleComponent extends BrowseByMetadataComponent implements OnInit {

ngOnInit(): void {
console.log('BrowseByTitleComponent ngOnInit called');
const sortConfig = new SortOptions('dc.title', SortDirection.ASC);
// include the thumbnail configuration in browse search options
this.updatePage(getBrowseSearchOptions(this.defaultBrowseId, this.paginationConfig, sortConfig, this.fetchThumbnails));
this.currentPagination$ = this.paginationService.getCurrentPagination(this.paginationConfig.id, this.paginationConfig);
this.currentSort$ = this.paginationService.getCurrentSort(this.paginationConfig.id, sortConfig);
this.subs.push(
observableCombineLatest(
[ this.route.params.pipe(take(1), tap((x) => console.log('BrowseByTitleComponent this.route.params', x))),
this.route.queryParams.pipe(tap((x) => console.log('BrowseByTitleComponent this.route.queryParams', x))),
this.scope$.pipe(tap((x) => console.log('BrowseByTitleComponent this.route.queryParams', x))),
this.currentPagination$.pipe(tap((x) => console.log('BrowseByTitleComponent this.route.queryParams', x))),
this.currentSort$.pipe(tap((x) => console.log('BrowseByTitleComponent this.route.queryParams', x))),
[ this.route.params.pipe(take(1)),
this.route.queryParams,
this.scope$,
this.currentPagination$,
this.currentSort$,
]).pipe(
map(([routeParams, queryParams, scope, currentPage, currentSort]) => {
console.log('BrowseByTitleComponent', [routeParams, queryParams, scope, currentPage, currentSort]);
return [Object.assign({}, routeParams, queryParams), scope, currentPage, currentSort];
}),
).subscribe(([params, scope, currentPage, currentSort]: [Params, string, PaginationComponentOptions, SortOptions]) => {
Expand Down

0 comments on commit c97a3cc

Please sign in to comment.