mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Merge branch 'refactor-comcol-pages_contribute-7.6' into w2p-122357_browse-performance-fixes_contribute-main
This commit is contained in:
@@ -19,8 +19,8 @@ import {
|
|||||||
Observable,
|
Observable,
|
||||||
} from 'rxjs';
|
} from 'rxjs';
|
||||||
import {
|
import {
|
||||||
|
distinctUntilChanged,
|
||||||
map,
|
map,
|
||||||
take,
|
|
||||||
} from 'rxjs/operators';
|
} from 'rxjs/operators';
|
||||||
import { ThemedBrowseByComponent } from 'src/app/shared/browse-by/themed-browse-by.component';
|
import { ThemedBrowseByComponent } from 'src/app/shared/browse-by/themed-browse-by.component';
|
||||||
|
|
||||||
@@ -38,13 +38,7 @@ import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.serv
|
|||||||
import { RemoteData } from '../../core/data/remote-data';
|
import { RemoteData } from '../../core/data/remote-data';
|
||||||
import { PaginationService } from '../../core/pagination/pagination.service';
|
import { PaginationService } from '../../core/pagination/pagination.service';
|
||||||
import { Item } from '../../core/shared/item.model';
|
import { Item } from '../../core/shared/item.model';
|
||||||
import { ThemedComcolPageBrowseByComponent } from '../../shared/comcol/comcol-page-browse-by/themed-comcol-page-browse-by.component';
|
|
||||||
import { ThemedComcolPageContentComponent } from '../../shared/comcol/comcol-page-content/themed-comcol-page-content.component';
|
|
||||||
import { ThemedComcolPageHandleComponent } from '../../shared/comcol/comcol-page-handle/themed-comcol-page-handle.component';
|
|
||||||
import { ComcolPageHeaderComponent } from '../../shared/comcol/comcol-page-header/comcol-page-header.component';
|
|
||||||
import { ComcolPageLogoComponent } from '../../shared/comcol/comcol-page-logo/comcol-page-logo.component';
|
|
||||||
import { isValidDate } from '../../shared/date.util';
|
import { isValidDate } from '../../shared/date.util';
|
||||||
import { DsoEditMenuComponent } from '../../shared/dso-page/dso-edit-menu/dso-edit-menu.component';
|
|
||||||
import {
|
import {
|
||||||
hasValue,
|
hasValue,
|
||||||
isNotEmpty,
|
isNotEmpty,
|
||||||
@@ -52,7 +46,6 @@ import {
|
|||||||
import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component';
|
import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component';
|
||||||
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
||||||
import { StartsWithType } from '../../shared/starts-with/starts-with-type';
|
import { StartsWithType } from '../../shared/starts-with/starts-with-type';
|
||||||
import { VarDirective } from '../../shared/utils/var.directive';
|
|
||||||
import {
|
import {
|
||||||
BrowseByMetadataComponent,
|
BrowseByMetadataComponent,
|
||||||
browseParamsToOptions,
|
browseParamsToOptions,
|
||||||
@@ -64,15 +57,8 @@ import {
|
|||||||
templateUrl: '../browse-by-metadata/browse-by-metadata.component.html',
|
templateUrl: '../browse-by-metadata/browse-by-metadata.component.html',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [
|
imports: [
|
||||||
VarDirective,
|
|
||||||
AsyncPipe,
|
AsyncPipe,
|
||||||
ComcolPageHeaderComponent,
|
|
||||||
ComcolPageLogoComponent,
|
|
||||||
NgIf,
|
NgIf,
|
||||||
ThemedComcolPageHandleComponent,
|
|
||||||
ThemedComcolPageContentComponent,
|
|
||||||
DsoEditMenuComponent,
|
|
||||||
ThemedComcolPageBrowseByComponent,
|
|
||||||
TranslateModule,
|
TranslateModule,
|
||||||
ThemedLoadingComponent,
|
ThemedLoadingComponent,
|
||||||
ThemedBrowseByComponent,
|
ThemedBrowseByComponent,
|
||||||
@@ -108,18 +94,20 @@ export class BrowseByDateComponent extends BrowseByMetadataComponent implements
|
|||||||
this.startsWithType = StartsWithType.date;
|
this.startsWithType = StartsWithType.date;
|
||||||
this.currentPagination$ = this.paginationService.getCurrentPagination(this.paginationConfig.id, this.paginationConfig);
|
this.currentPagination$ = this.paginationService.getCurrentPagination(this.paginationConfig.id, this.paginationConfig);
|
||||||
this.currentSort$ = this.paginationService.getCurrentSort(this.paginationConfig.id, sortConfig);
|
this.currentSort$ = this.paginationService.getCurrentSort(this.paginationConfig.id, sortConfig);
|
||||||
|
const routeParams$: Observable<Params> = observableCombineLatest([
|
||||||
|
this.route.params,
|
||||||
|
this.route.queryParams,
|
||||||
|
]).pipe(
|
||||||
|
map(([params, queryParams]: [Params, Params]) => Object.assign({}, params, queryParams)),
|
||||||
|
distinctUntilChanged((prev: Params, curr: Params) => prev.id === curr.id && prev.startsWith === curr.startsWith),
|
||||||
|
);
|
||||||
this.subs.push(
|
this.subs.push(
|
||||||
observableCombineLatest(
|
observableCombineLatest([
|
||||||
[ this.route.params.pipe(take(1)),
|
routeParams$,
|
||||||
this.route.queryParams,
|
this.scope$,
|
||||||
this.scope$,
|
this.currentPagination$,
|
||||||
this.currentPagination$,
|
this.currentSort$,
|
||||||
this.currentSort$,
|
]).subscribe(([params, scope, currentPage, currentSort]: [Params, string, PaginationComponentOptions, SortOptions]) => {
|
||||||
]).pipe(
|
|
||||||
map(([routeParams, queryParams, scope, currentPage, currentSort]) => {
|
|
||||||
return [Object.assign({}, routeParams, queryParams), scope, currentPage, currentSort];
|
|
||||||
}),
|
|
||||||
).subscribe(([params, scope, currentPage, currentSort]: [Params, string, PaginationComponentOptions, SortOptions]) => {
|
|
||||||
const metadataKeys = params.browseDefinition ? params.browseDefinition.metadataKeys : this.defaultMetadataKeys;
|
const metadataKeys = params.browseDefinition ? params.browseDefinition.metadataKeys : this.defaultMetadataKeys;
|
||||||
this.browseId = params.id || this.defaultBrowseId;
|
this.browseId = params.id || this.defaultBrowseId;
|
||||||
this.startsWith = +params.startsWith || params.startsWith;
|
this.startsWith = +params.startsWith || params.startsWith;
|
||||||
|
@@ -9,6 +9,7 @@ import {
|
|||||||
OnChanges,
|
OnChanges,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
|
SimpleChanges,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import {
|
import {
|
||||||
ActivatedRoute,
|
ActivatedRoute,
|
||||||
@@ -24,8 +25,8 @@ import {
|
|||||||
Subscription,
|
Subscription,
|
||||||
} from 'rxjs';
|
} from 'rxjs';
|
||||||
import {
|
import {
|
||||||
|
distinctUntilChanged,
|
||||||
map,
|
map,
|
||||||
take,
|
|
||||||
} from 'rxjs/operators';
|
} from 'rxjs/operators';
|
||||||
import { ThemedBrowseByComponent } from 'src/app/shared/browse-by/themed-browse-by.component';
|
import { ThemedBrowseByComponent } from 'src/app/shared/browse-by/themed-browse-by.component';
|
||||||
|
|
||||||
@@ -48,12 +49,6 @@ import { BrowseEntry } from '../../core/shared/browse-entry.model';
|
|||||||
import { Context } from '../../core/shared/context.model';
|
import { Context } from '../../core/shared/context.model';
|
||||||
import { Item } from '../../core/shared/item.model';
|
import { Item } from '../../core/shared/item.model';
|
||||||
import { getFirstSucceededRemoteData } from '../../core/shared/operators';
|
import { getFirstSucceededRemoteData } from '../../core/shared/operators';
|
||||||
import { ThemedComcolPageBrowseByComponent } from '../../shared/comcol/comcol-page-browse-by/themed-comcol-page-browse-by.component';
|
|
||||||
import { ThemedComcolPageContentComponent } from '../../shared/comcol/comcol-page-content/themed-comcol-page-content.component';
|
|
||||||
import { ThemedComcolPageHandleComponent } from '../../shared/comcol/comcol-page-handle/themed-comcol-page-handle.component';
|
|
||||||
import { ComcolPageHeaderComponent } from '../../shared/comcol/comcol-page-header/comcol-page-header.component';
|
|
||||||
import { ComcolPageLogoComponent } from '../../shared/comcol/comcol-page-logo/comcol-page-logo.component';
|
|
||||||
import { DsoEditMenuComponent } from '../../shared/dso-page/dso-edit-menu/dso-edit-menu.component';
|
|
||||||
import {
|
import {
|
||||||
hasValue,
|
hasValue,
|
||||||
isNotEmpty,
|
isNotEmpty,
|
||||||
@@ -61,7 +56,6 @@ import {
|
|||||||
import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component';
|
import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component';
|
||||||
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
||||||
import { StartsWithType } from '../../shared/starts-with/starts-with-type';
|
import { StartsWithType } from '../../shared/starts-with/starts-with-type';
|
||||||
import { VarDirective } from '../../shared/utils/var.directive';
|
|
||||||
import { BrowseByDataType } from '../browse-by-switcher/browse-by-data-type';
|
import { BrowseByDataType } from '../browse-by-switcher/browse-by-data-type';
|
||||||
|
|
||||||
export const BBM_PAGINATION_ID = 'bbm';
|
export const BBM_PAGINATION_ID = 'bbm';
|
||||||
@@ -71,15 +65,8 @@ export const BBM_PAGINATION_ID = 'bbm';
|
|||||||
styleUrls: ['./browse-by-metadata.component.scss'],
|
styleUrls: ['./browse-by-metadata.component.scss'],
|
||||||
templateUrl: './browse-by-metadata.component.html',
|
templateUrl: './browse-by-metadata.component.html',
|
||||||
imports: [
|
imports: [
|
||||||
VarDirective,
|
|
||||||
AsyncPipe,
|
AsyncPipe,
|
||||||
ComcolPageHeaderComponent,
|
|
||||||
ComcolPageLogoComponent,
|
|
||||||
NgIf,
|
NgIf,
|
||||||
ThemedComcolPageHandleComponent,
|
|
||||||
ThemedComcolPageContentComponent,
|
|
||||||
DsoEditMenuComponent,
|
|
||||||
ThemedComcolPageBrowseByComponent,
|
|
||||||
TranslateModule,
|
TranslateModule,
|
||||||
ThemedLoadingComponent,
|
ThemedLoadingComponent,
|
||||||
ThemedBrowseByComponent,
|
ThemedBrowseByComponent,
|
||||||
@@ -215,21 +202,22 @@ export class BrowseByMetadataComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
|
||||||
const sortConfig = new SortOptions('default', SortDirection.ASC);
|
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.currentPagination$ = this.paginationService.getCurrentPagination(this.paginationConfig.id, this.paginationConfig);
|
||||||
this.currentSort$ = this.paginationService.getCurrentSort(this.paginationConfig.id, sortConfig);
|
this.currentSort$ = this.paginationService.getCurrentSort(this.paginationConfig.id, sortConfig);
|
||||||
|
const routeParams$: Observable<Params> = observableCombineLatest([
|
||||||
|
this.route.params,
|
||||||
|
this.route.queryParams,
|
||||||
|
]).pipe(
|
||||||
|
map(([params, queryParams]: [Params, Params]) => Object.assign({}, params, queryParams)),
|
||||||
|
distinctUntilChanged((prev: Params, curr: Params) => prev.id === curr.id && prev.authority === curr.authority && prev.value === curr.value && prev.startsWith === curr.startsWith),
|
||||||
|
);
|
||||||
this.subs.push(
|
this.subs.push(
|
||||||
observableCombineLatest(
|
observableCombineLatest([
|
||||||
[ this.route.params.pipe(take(1)),
|
routeParams$,
|
||||||
this.route.queryParams,
|
this.scope$,
|
||||||
this.scope$,
|
this.currentPagination$,
|
||||||
this.currentPagination$,
|
this.currentSort$,
|
||||||
this.currentSort$,
|
]).subscribe(([params, scope, currentPage, currentSort]: [Params, string, PaginationComponentOptions, SortOptions]) => {
|
||||||
]).pipe(
|
|
||||||
map(([routeParams, queryParams, scope, currentPage, currentSort]) => {
|
|
||||||
return [Object.assign({}, routeParams, queryParams), scope, currentPage, currentSort];
|
|
||||||
}),
|
|
||||||
).subscribe(([params, scope, currentPage, currentSort]: [Params, string, PaginationComponentOptions, SortOptions]) => {
|
|
||||||
this.browseId = params.id || this.defaultBrowseId;
|
this.browseId = params.id || this.defaultBrowseId;
|
||||||
this.authority = params.authority;
|
this.authority = params.authority;
|
||||||
|
|
||||||
@@ -257,8 +245,10 @@ export class BrowseByMetadataComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(): void {
|
ngOnChanges(changes: SimpleChanges): void {
|
||||||
this.scope$.next(this.scope);
|
if (hasValue(changes.scope)) {
|
||||||
|
this.scope$.next(this.scope);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -8,10 +8,13 @@ import {
|
|||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { Params } from '@angular/router';
|
import { Params } from '@angular/router';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { combineLatest as observableCombineLatest } from 'rxjs';
|
|
||||||
import {
|
import {
|
||||||
|
combineLatest as observableCombineLatest,
|
||||||
|
Observable,
|
||||||
|
} from 'rxjs';
|
||||||
|
import {
|
||||||
|
distinctUntilChanged,
|
||||||
map,
|
map,
|
||||||
take,
|
|
||||||
} from 'rxjs/operators';
|
} from 'rxjs/operators';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -19,15 +22,8 @@ import {
|
|||||||
SortOptions,
|
SortOptions,
|
||||||
} from '../../core/cache/models/sort-options.model';
|
} from '../../core/cache/models/sort-options.model';
|
||||||
import { ThemedBrowseByComponent } from '../../shared/browse-by/themed-browse-by.component';
|
import { ThemedBrowseByComponent } from '../../shared/browse-by/themed-browse-by.component';
|
||||||
import { ThemedComcolPageBrowseByComponent } from '../../shared/comcol/comcol-page-browse-by/themed-comcol-page-browse-by.component';
|
|
||||||
import { ThemedComcolPageContentComponent } from '../../shared/comcol/comcol-page-content/themed-comcol-page-content.component';
|
|
||||||
import { ThemedComcolPageHandleComponent } from '../../shared/comcol/comcol-page-handle/themed-comcol-page-handle.component';
|
|
||||||
import { ComcolPageHeaderComponent } from '../../shared/comcol/comcol-page-header/comcol-page-header.component';
|
|
||||||
import { ComcolPageLogoComponent } from '../../shared/comcol/comcol-page-logo/comcol-page-logo.component';
|
|
||||||
import { DsoEditMenuComponent } from '../../shared/dso-page/dso-edit-menu/dso-edit-menu.component';
|
|
||||||
import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component';
|
import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component';
|
||||||
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
||||||
import { VarDirective } from '../../shared/utils/var.directive';
|
|
||||||
import {
|
import {
|
||||||
BrowseByMetadataComponent,
|
BrowseByMetadataComponent,
|
||||||
browseParamsToOptions,
|
browseParamsToOptions,
|
||||||
@@ -39,15 +35,8 @@ import {
|
|||||||
templateUrl: '../browse-by-metadata/browse-by-metadata.component.html',
|
templateUrl: '../browse-by-metadata/browse-by-metadata.component.html',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [
|
imports: [
|
||||||
VarDirective,
|
|
||||||
AsyncPipe,
|
AsyncPipe,
|
||||||
ComcolPageHeaderComponent,
|
|
||||||
ComcolPageLogoComponent,
|
|
||||||
NgIf,
|
NgIf,
|
||||||
ThemedComcolPageHandleComponent,
|
|
||||||
ThemedComcolPageContentComponent,
|
|
||||||
DsoEditMenuComponent,
|
|
||||||
ThemedComcolPageBrowseByComponent,
|
|
||||||
TranslateModule,
|
TranslateModule,
|
||||||
ThemedLoadingComponent,
|
ThemedLoadingComponent,
|
||||||
ThemedBrowseByComponent,
|
ThemedBrowseByComponent,
|
||||||
@@ -62,18 +51,20 @@ export class BrowseByTitleComponent extends BrowseByMetadataComponent implements
|
|||||||
const sortConfig = new SortOptions('dc.title', SortDirection.ASC);
|
const sortConfig = new SortOptions('dc.title', SortDirection.ASC);
|
||||||
this.currentPagination$ = this.paginationService.getCurrentPagination(this.paginationConfig.id, this.paginationConfig);
|
this.currentPagination$ = this.paginationService.getCurrentPagination(this.paginationConfig.id, this.paginationConfig);
|
||||||
this.currentSort$ = this.paginationService.getCurrentSort(this.paginationConfig.id, sortConfig);
|
this.currentSort$ = this.paginationService.getCurrentSort(this.paginationConfig.id, sortConfig);
|
||||||
|
const routeParams$: Observable<Params> = observableCombineLatest([
|
||||||
|
this.route.params,
|
||||||
|
this.route.queryParams,
|
||||||
|
]).pipe(
|
||||||
|
map(([params, queryParams]: [Params, Params]) => Object.assign({}, params, queryParams)),
|
||||||
|
distinctUntilChanged((prev: Params, curr: Params) => prev.id === curr.id && prev.startsWith === curr.startsWith),
|
||||||
|
);
|
||||||
this.subs.push(
|
this.subs.push(
|
||||||
observableCombineLatest(
|
observableCombineLatest([
|
||||||
[ this.route.params.pipe(take(1)),
|
routeParams$,
|
||||||
this.route.queryParams,
|
this.scope$,
|
||||||
this.scope$,
|
this.currentPagination$,
|
||||||
this.currentPagination$,
|
this.currentSort$,
|
||||||
this.currentSort$,
|
]).subscribe(([params, scope, currentPage, currentSort]: [Params, string, PaginationComponentOptions, SortOptions]) => {
|
||||||
]).pipe(
|
|
||||||
map(([routeParams, queryParams, scope, currentPage, currentSort]) => {
|
|
||||||
return [Object.assign({}, routeParams, queryParams), scope, currentPage, currentSort];
|
|
||||||
}),
|
|
||||||
).subscribe(([params, scope, currentPage, currentSort]: [Params, string, PaginationComponentOptions, SortOptions]) => {
|
|
||||||
this.startsWith = +params.startsWith || params.startsWith;
|
this.startsWith = +params.startsWith || params.startsWith;
|
||||||
this.browseId = params.id || this.defaultBrowseId;
|
this.browseId = params.id || this.defaultBrowseId;
|
||||||
this.updatePageWithItems(browseParamsToOptions(params, scope, currentPage, currentSort, this.browseId, this.fetchThumbnails), undefined, undefined);
|
this.updatePageWithItems(browseParamsToOptions(params, scope, currentPage, currentSort, this.browseId, this.fetchThumbnails), undefined, undefined);
|
||||||
|
Reference in New Issue
Block a user