Initial work on browse with thumbs.

This commit is contained in:
Michael Spalti
2022-08-18 12:53:19 -07:00
parent aafe3543d8
commit 56c8c8c370
6 changed files with 49 additions and 17 deletions

View File

@@ -28,6 +28,7 @@ import { AuthorizationDataService } from '../core/data/feature-authorization/aut
import { FeatureID } from '../core/data/feature-authorization/feature-id'; import { FeatureID } from '../core/data/feature-authorization/feature-id';
import { getCollectionPageRoute } from './collection-page-routing-paths'; import { getCollectionPageRoute } from './collection-page-routing-paths';
import { redirectOn4xx } from '../core/shared/authorized.operators'; import { redirectOn4xx } from '../core/shared/authorized.operators';
import { BROWSE_ITEM_LINKS_TO_FOLLOW } from '../core/browse/browse.service';
@Component({ @Component({
selector: 'ds-collection-page', selector: 'ds-collection-page',
@@ -74,6 +75,7 @@ export class CollectionPageComponent implements OnInit {
this.paginationConfig.pageSize = 5; this.paginationConfig.pageSize = 5;
this.paginationConfig.currentPage = 1; this.paginationConfig.currentPage = 1;
this.sortConfig = new SortOptions('dc.date.accessioned', SortDirection.DESC); this.sortConfig = new SortOptions('dc.date.accessioned', SortDirection.DESC);
} }
ngOnInit(): void { ngOnInit(): void {
@@ -108,7 +110,8 @@ export class CollectionPageComponent implements OnInit {
pagination: currentPagination, pagination: currentPagination,
sort: currentSort, sort: currentSort,
dsoTypes: [DSpaceObjectType.ITEM] dsoTypes: [DSpaceObjectType.ITEM]
})).pipe(toDSpaceObjectListRD()) as Observable<RemoteData<PaginatedList<Item>>>; }), null, true, true, ...BROWSE_ITEM_LINKS_TO_FOLLOW)
.pipe(toDSpaceObjectListRD()) as Observable<RemoteData<PaginatedList<Item>>>;
}), }),
startWith(undefined) // Make sure switching pages shows loading component startWith(undefined) // Make sure switching pages shows loading component
) )

View File

@@ -17,7 +17,7 @@ export const COLLECTION_PAGE_LINKS_TO_FOLLOW: FollowLinkConfig<Collection>[] = [
followLink('parentCommunity', {}, followLink('parentCommunity', {},
followLink('parentCommunity') followLink('parentCommunity')
), ),
followLink('logo') followLink('logo'),
]; ];
/** /**

Binary file not shown.

View File

@@ -21,6 +21,15 @@ import { URLCombiner } from '../url-combiner/url-combiner';
import { BrowseEntrySearchOptions } from './browse-entry-search-options.model'; import { BrowseEntrySearchOptions } from './browse-entry-search-options.model';
import { BrowseDefinitionDataService } from './browse-definition-data.service'; import { BrowseDefinitionDataService } from './browse-definition-data.service';
import { HrefOnlyDataService } from '../data/href-only-data.service'; import { HrefOnlyDataService } from '../data/href-only-data.service';
import { followLink, FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
const BROWSE_ENTRY_LINKS_TO_FOLLOW: FollowLinkConfig<BrowseEntry>[] = [
followLink('thumbnail')
];
export const BROWSE_ITEM_LINKS_TO_FOLLOW: FollowLinkConfig<Item>[] = [
followLink('thumbnail')
];
/** /**
* The service handling all browse requests * The service handling all browse requests
@@ -96,6 +105,11 @@ export class BrowseService {
return href; return href;
}) })
); );
if (options.metadataDefinition == 'title' || options.metadataDefinition == 'dateissued' ) {
return this.hrefOnlyDataService.findAllByHref<BrowseEntry>(href$, {}, null, null, ...BROWSE_ENTRY_LINKS_TO_FOLLOW);
}
return this.hrefOnlyDataService.findAllByHref<BrowseEntry>(href$); return this.hrefOnlyDataService.findAllByHref<BrowseEntry>(href$);
} }
@@ -141,6 +155,9 @@ export class BrowseService {
return href; return href;
}), }),
); );
if (options.metadataDefinition == 'title' || options.metadataDefinition == 'dateissued' || hasValue(filterValue)) {
return this.hrefOnlyDataService.findAllByHref<Item>(href$, {}, null, null, ...BROWSE_ITEM_LINKS_TO_FOLLOW);
}
return this.hrefOnlyDataService.findAllByHref<Item>(href$); return this.hrefOnlyDataService.findAllByHref<Item>(href$);
} }

View File

@@ -51,6 +51,7 @@ export class BrowseEntry extends ListableObject implements TypedObject {
_links: { _links: {
self: HALLink; self: HALLink;
entries: HALLink; entries: HALLink;
thumbnail: HALLink;
}; };
/** /**

View File

@@ -1,15 +1,24 @@
<div class="d-flex"> <div class="row">
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge> <div class="col-md-2">
<ds-access-status-badge [item]="dso" class="pl-1"></ds-access-status-badge>
</div>
<ds-truncatable [id]="dso.id" *ngIf="object !== undefined && object !== null">
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" <a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer"
[routerLink]="[itemPageRoute]" class="lead item-list-title dont-break-out" [routerLink]="[itemPageRoute]" class="lead item-list-title dont-break-out">
[innerHTML]="dsoTitle"></a> <ds-thumbnail [thumbnail]="dso?.thumbnail | async" [limitWidth]="true">
<span *ngIf="linkType == linkTypes.None" class="lead item-list-title dont-break-out" </ds-thumbnail>
[innerHTML]="dsoTitle"></span> </a>
<span class="text-muted"> </div>
<div class="col-md-10">
<div class="d-flex">
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
<ds-access-status-badge [item]="dso" class="pl-1"></ds-access-status-badge>
</div>
<ds-truncatable [id]="dso.id" *ngIf="object !== undefined && object !== null">
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer"
[routerLink]="[itemPageRoute]" class="lead item-list-title dont-break-out"
[innerHTML]="dsoTitle"></a>
<span *ngIf="linkType == linkTypes.None" class="lead item-list-title dont-break-out"
[innerHTML]="dsoTitle"></span>
<span class="text-muted">
<ds-truncatable-part [id]="dso.id" [minLines]="1"> <ds-truncatable-part [id]="dso.id" [minLines]="1">
<ng-container *ngIf="dso.firstMetadataValue('dc.publisher') || dso.firstMetadataValue('dc.date.issued')"> <ng-container *ngIf="dso.firstMetadataValue('dc.publisher') || dso.firstMetadataValue('dc.date.issued')">
(<span *ngIf="dso.firstMetadataValue('dc.publisher')" class="item-list-publisher" [innerHTML]="firstMetadataValue('dc.publisher') + ', '"></span> (<span *ngIf="dso.firstMetadataValue('dc.publisher')" class="item-list-publisher" [innerHTML]="firstMetadataValue('dc.publisher') + ', '"></span>
@@ -23,9 +32,11 @@
</span> </span>
</ds-truncatable-part> </ds-truncatable-part>
</span> </span>
<div *ngIf="dso.firstMetadataValue('dc.description.abstract')" class="item-list-abstract"> <div *ngIf="dso.firstMetadataValue('dc.description.abstract')" class="item-list-abstract">
<ds-truncatable-part [id]="dso.id" [minLines]="3"><span <ds-truncatable-part [id]="dso.id" [minLines]="3"><span
[innerHTML]="firstMetadataValue('dc.description.abstract')"></span> [innerHTML]="firstMetadataValue('dc.description.abstract')"></span>
</ds-truncatable-part> </ds-truncatable-part>
</div> </div>
</ds-truncatable> </ds-truncatable>
</div>
</div>