forked from 4Science/dspace-angular
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/dspace-cris-2023_02_x' into task…
…/dspace-cris-2023_02_x/LM-46
- Loading branch information
Showing
96 changed files
with
897 additions
and
328 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/app/core/rest-property/forgot-password-check-guard.guard.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { ActivatedRouteSnapshot, Router, RouterStateSnapshot } from '@angular/router'; | ||
import { Observable, of } from 'rxjs'; | ||
import { AuthorizationDataService } from '../data/feature-authorization/authorization-data.service'; | ||
import { FeatureID } from '../data/feature-authorization/feature-id'; | ||
import { | ||
SingleFeatureAuthorizationGuard | ||
} from '../data/feature-authorization/feature-authorization-guard/single-feature-authorization.guard'; | ||
import { AuthService } from '../auth/auth.service'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
/** | ||
* Guard that checks if the forgot-password feature is enabled | ||
*/ | ||
export class ForgotPasswordCheckGuard extends SingleFeatureAuthorizationGuard { | ||
|
||
constructor( | ||
protected readonly authorizationService: AuthorizationDataService, | ||
protected readonly router: Router, | ||
protected readonly authService: AuthService | ||
) { | ||
super(authorizationService, router, authService); | ||
} | ||
|
||
getFeatureID(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<FeatureID> { | ||
return of(FeatureID.EPersonForgotPassword); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
src/app/shared/browse-most-elements/abstract-browse-elements.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { followLink } from '../utils/follow-link-config.model'; | ||
import { CollectionElementLinkType } from '../object-collection/collection-element-link.type'; | ||
import { TopSection } from '../../core/layout/models/section.model'; | ||
import { Component, Input, OnChanges, OnInit, PLATFORM_ID, inject } from '@angular/core'; | ||
import { isPlatformServer } from '@angular/common'; | ||
|
||
import { SearchService } from '../../core/shared/search/search.service'; | ||
import { PaginatedSearchOptions } from '../search/models/paginated-search-options.model'; | ||
import { DSpaceObject } from '../../core/shared/dspace-object.model'; | ||
import { SearchResult } from '../search/models/search-result.model'; | ||
import { Context } from '../../core/shared/context.model'; | ||
import { RemoteData } from '../../core/data/remote-data'; | ||
import { PaginatedList } from '../../core/data/paginated-list.model'; | ||
import { | ||
getAllCompletedRemoteData, | ||
getPaginatedListPayload, | ||
getRemoteDataPayload, | ||
toDSpaceObjectListRD, | ||
} from '../../core/shared/operators'; | ||
import { APP_CONFIG } from '../../../config/app-config.interface'; | ||
import { BehaviorSubject, Observable, mergeMap } from 'rxjs'; | ||
import { Item } from '../../core/shared/item.model'; | ||
import { getItemPageRoute } from '../../item-page/item-page-routing-paths'; | ||
|
||
@Component({ | ||
template: '' | ||
}) | ||
export abstract class AbstractBrowseElementsComponent implements OnInit, OnChanges { | ||
|
||
protected readonly appConfig = inject(APP_CONFIG); | ||
protected readonly platformId = inject(PLATFORM_ID); | ||
protected readonly searchService = inject(SearchService); | ||
|
||
protected followThumbnailLink: boolean; // to be overridden | ||
|
||
@Input() paginatedSearchOptions: PaginatedSearchOptions; | ||
|
||
@Input() context: Context; | ||
|
||
@Input() topSection: TopSection; | ||
|
||
public collectionElementLinkTypeEnum = CollectionElementLinkType; | ||
|
||
paginatedSearchOptionsBS: BehaviorSubject<PaginatedSearchOptions>; | ||
|
||
searchResults$: Observable<RemoteData<PaginatedList<SearchResult<DSpaceObject>>>>; | ||
|
||
searchResultArray$: Observable<DSpaceObject[]>; | ||
|
||
ngOnChanges() { | ||
if (isPlatformServer(this.platformId)) { | ||
return; | ||
} | ||
this.paginatedSearchOptionsBS?.next(this.paginatedSearchOptions); | ||
} | ||
|
||
ngOnInit() { | ||
const followLinks = this.followThumbnailLink ? [followLink('thumbnail')] : []; | ||
this.paginatedSearchOptionsBS = new BehaviorSubject<PaginatedSearchOptions>(this.paginatedSearchOptions); | ||
this.searchResults$ = this.paginatedSearchOptionsBS.asObservable().pipe( | ||
mergeMap((paginatedSearchOptions) => | ||
this.searchService.search(paginatedSearchOptions, null, true, true, ...followLinks), | ||
), | ||
getAllCompletedRemoteData(), | ||
); | ||
|
||
this.searchResultArray$ = this.searchResults$.pipe( | ||
toDSpaceObjectListRD(), | ||
getRemoteDataPayload(), | ||
getPaginatedListPayload(), | ||
); | ||
} | ||
|
||
getItemPageRoute(item: DSpaceObject | Item) { | ||
return getItemPageRoute(item as Item); | ||
} | ||
} |
31 changes: 13 additions & 18 deletions
31
src/app/shared/browse-most-elements/browse-most-elements.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,14 @@ | ||
<div class="m-2"> | ||
<ng-container *ngIf="searchResults"> | ||
<ul *ngIf="searchResults?.hasSucceeded" class="list-unstyled"> | ||
<li *ngFor="let object of searchResults?.payload?.page; let i = index; let last = last" class="mt-4 mb-4 d-flex" [class.border-bottom]="true && !last"> | ||
<ds-listable-object-component-loader [context]="context" | ||
[index]="i" | ||
[listID]="paginatedSearchOptions.configuration" | ||
[object]="object" | ||
[showMetrics]="showMetrics" | ||
[showThumbnails]="showThumbnails" | ||
[viewMode]="paginatedSearchOptions.view"></ds-listable-object-component-loader> | ||
</li> | ||
</ul> | ||
<div *ngIf="searchResults?.hasFailed"> | ||
{{ 'remote.error' | translate }} | ||
</div> | ||
</ng-container> | ||
<ds-loading *ngIf="!searchResults"></ds-loading> | ||
<div [ngSwitch]="(sectionTemplateType | lowercase)"> | ||
|
||
<ng-container *ngSwitchDefault> | ||
<ds-themed-default-browse-elements | ||
[showMetrics]="showMetrics" | ||
[showThumbnails]="topSection.showThumbnails" | ||
[topSection]="topSection" | ||
[showLabel]="showLabel" | ||
[paginatedSearchOptions]="paginatedSearchOptionsBS.asObservable() | async" | ||
[context]="context" | ||
></ds-themed-default-browse-elements> | ||
</ng-container> | ||
|
||
</div> |
Oops, something went wrong.