mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
[CST-5676] Breadcrumbs changes
This commit is contained in:
@@ -10,6 +10,7 @@ import { ResourcePolicyResolver } from '../shared/resource-policies/resolvers/re
|
|||||||
import { ResourcePolicyEditComponent } from '../shared/resource-policies/edit/resource-policy-edit.component';
|
import { ResourcePolicyEditComponent } from '../shared/resource-policies/edit/resource-policy-edit.component';
|
||||||
import { BitstreamAuthorizationsComponent } from './bitstream-authorizations/bitstream-authorizations.component';
|
import { BitstreamAuthorizationsComponent } from './bitstream-authorizations/bitstream-authorizations.component';
|
||||||
import { LegacyBitstreamUrlResolver } from './legacy-bitstream-url.resolver';
|
import { LegacyBitstreamUrlResolver } from './legacy-bitstream-url.resolver';
|
||||||
|
import { BitstreamBreadcrumbResolver } from '../core/breadcrumbs/bitstream-breadcrumb.resolver';
|
||||||
|
|
||||||
const EDIT_BITSTREAM_PATH = ':id/edit';
|
const EDIT_BITSTREAM_PATH = ':id/edit';
|
||||||
const EDIT_BITSTREAM_AUTHORIZATIONS_PATH = ':id/authorizations';
|
const EDIT_BITSTREAM_AUTHORIZATIONS_PATH = ':id/authorizations';
|
||||||
@@ -25,7 +26,8 @@ const EDIT_BITSTREAM_AUTHORIZATIONS_PATH = ':id/authorizations';
|
|||||||
path: 'handle/:prefix/:suffix/:filename',
|
path: 'handle/:prefix/:suffix/:filename',
|
||||||
component: BitstreamDownloadPageComponent,
|
component: BitstreamDownloadPageComponent,
|
||||||
resolve: {
|
resolve: {
|
||||||
bitstream: LegacyBitstreamUrlResolver
|
bitstream: LegacyBitstreamUrlResolver,
|
||||||
|
breadcrumb: BitstreamBreadcrumbResolver
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -33,7 +35,8 @@ const EDIT_BITSTREAM_AUTHORIZATIONS_PATH = ':id/authorizations';
|
|||||||
path: ':prefix/:suffix/:sequence_id/:filename',
|
path: ':prefix/:suffix/:sequence_id/:filename',
|
||||||
component: BitstreamDownloadPageComponent,
|
component: BitstreamDownloadPageComponent,
|
||||||
resolve: {
|
resolve: {
|
||||||
bitstream: LegacyBitstreamUrlResolver
|
bitstream: LegacyBitstreamUrlResolver,
|
||||||
|
breadcrumb: BitstreamBreadcrumbResolver
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -41,14 +44,16 @@ const EDIT_BITSTREAM_AUTHORIZATIONS_PATH = ':id/authorizations';
|
|||||||
path: ':id/download',
|
path: ':id/download',
|
||||||
component: BitstreamDownloadPageComponent,
|
component: BitstreamDownloadPageComponent,
|
||||||
resolve: {
|
resolve: {
|
||||||
bitstream: BitstreamPageResolver
|
bitstream: BitstreamPageResolver,
|
||||||
|
breadcrumb: BitstreamBreadcrumbResolver
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: EDIT_BITSTREAM_PATH,
|
path: EDIT_BITSTREAM_PATH,
|
||||||
component: EditBitstreamPageComponent,
|
component: EditBitstreamPageComponent,
|
||||||
resolve: {
|
resolve: {
|
||||||
bitstream: BitstreamPageResolver
|
bitstream: BitstreamPageResolver,
|
||||||
|
breadcrumb: BitstreamBreadcrumbResolver
|
||||||
},
|
},
|
||||||
canActivate: [AuthenticatedGuard]
|
canActivate: [AuthenticatedGuard]
|
||||||
},
|
},
|
||||||
@@ -59,7 +64,8 @@ const EDIT_BITSTREAM_AUTHORIZATIONS_PATH = ':id/authorizations';
|
|||||||
{
|
{
|
||||||
path: 'create',
|
path: 'create',
|
||||||
resolve: {
|
resolve: {
|
||||||
resourcePolicyTarget: ResourcePolicyTargetResolver
|
resourcePolicyTarget: ResourcePolicyTargetResolver,
|
||||||
|
breadcrumb: BitstreamBreadcrumbResolver
|
||||||
},
|
},
|
||||||
component: ResourcePolicyCreateComponent,
|
component: ResourcePolicyCreateComponent,
|
||||||
data: { title: 'resource-policies.create.page.title', showBreadcrumbs: true }
|
data: { title: 'resource-policies.create.page.title', showBreadcrumbs: true }
|
||||||
@@ -67,7 +73,8 @@ const EDIT_BITSTREAM_AUTHORIZATIONS_PATH = ':id/authorizations';
|
|||||||
{
|
{
|
||||||
path: 'edit',
|
path: 'edit',
|
||||||
resolve: {
|
resolve: {
|
||||||
resourcePolicy: ResourcePolicyResolver
|
resourcePolicy: ResourcePolicyResolver,
|
||||||
|
breadcrumb: BitstreamBreadcrumbResolver
|
||||||
},
|
},
|
||||||
component: ResourcePolicyEditComponent,
|
component: ResourcePolicyEditComponent,
|
||||||
data: { title: 'resource-policies.edit.page.title', showBreadcrumbs: true }
|
data: { title: 'resource-policies.edit.page.title', showBreadcrumbs: true }
|
||||||
@@ -75,7 +82,8 @@ const EDIT_BITSTREAM_AUTHORIZATIONS_PATH = ':id/authorizations';
|
|||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
resolve: {
|
resolve: {
|
||||||
bitstream: BitstreamPageResolver
|
bitstream: BitstreamPageResolver,
|
||||||
|
breadcrumb: BitstreamBreadcrumbResolver
|
||||||
},
|
},
|
||||||
component: BitstreamAuthorizationsComponent,
|
component: BitstreamAuthorizationsComponent,
|
||||||
data: { title: 'bitstream.edit.authorizations.title', showBreadcrumbs: true }
|
data: { title: 'bitstream.edit.authorizations.title', showBreadcrumbs: true }
|
||||||
@@ -86,6 +94,7 @@ const EDIT_BITSTREAM_AUTHORIZATIONS_PATH = ':id/authorizations';
|
|||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
BitstreamPageResolver,
|
BitstreamPageResolver,
|
||||||
|
BitstreamBreadcrumbResolver
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class BitstreamPageRoutingModule {
|
export class BitstreamPageRoutingModule {
|
||||||
|
@@ -7,6 +7,19 @@ import { BitstreamDataService } from '../core/data/bitstream-data.service';
|
|||||||
import { followLink, FollowLinkConfig } from '../shared/utils/follow-link-config.model';
|
import { followLink, FollowLinkConfig } from '../shared/utils/follow-link-config.model';
|
||||||
import { getFirstCompletedRemoteData } from '../core/shared/operators';
|
import { getFirstCompletedRemoteData } from '../core/shared/operators';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The self links defined in this list are expected to be requested somewhere in the near future
|
||||||
|
* Requesting them as embeds will limit the number of requests
|
||||||
|
*/
|
||||||
|
export const BITSTREAM_PAGE_LINKS_TO_FOLLOW: FollowLinkConfig<Bitstream>[] = [
|
||||||
|
followLink('format', {},
|
||||||
|
followLink('parentCommunity', {},
|
||||||
|
followLink('parentCommunity'))
|
||||||
|
),
|
||||||
|
followLink('bundle'),
|
||||||
|
followLink('thumbnail')
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents a resolver that requests a specific bitstream before the route is activated
|
* This class represents a resolver that requests a specific bitstream before the route is activated
|
||||||
*/
|
*/
|
||||||
|
28
src/app/core/breadcrumbs/bitstream-breadcrumb.resolver.ts
Normal file
28
src/app/core/breadcrumbs/bitstream-breadcrumb.resolver.ts
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { DSOBreadcrumbsService } from './dso-breadcrumbs.service';
|
||||||
|
import { DSOBreadcrumbResolver } from './dso-breadcrumb.resolver';
|
||||||
|
import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||||
|
import { Bitstream } from '../shared/bitstream.model';
|
||||||
|
import { BitstreamDataService } from '../data/bitstream-data.service';
|
||||||
|
import { BITSTREAM_PAGE_LINKS_TO_FOLLOW } from 'src/app/bitstream-page/bitstream-page.resolver';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The class that resolves the BreadcrumbConfig object for an Item
|
||||||
|
*/
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class BitstreamBreadcrumbResolver extends DSOBreadcrumbResolver<Bitstream> {
|
||||||
|
constructor(protected breadcrumbService: DSOBreadcrumbsService, protected dataService: BitstreamDataService) {
|
||||||
|
super(breadcrumbService, dataService);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method that returns the follow links to already resolve
|
||||||
|
* The self links defined in this list are expected to be requested somewhere in the near future
|
||||||
|
* Requesting them as embeds will limit the number of requests
|
||||||
|
*/
|
||||||
|
get followLinks(): FollowLinkConfig<Bitstream>[] {
|
||||||
|
return BITSTREAM_PAGE_LINKS_TO_FOLLOW;
|
||||||
|
}
|
||||||
|
}
|
@@ -7,13 +7,13 @@ import { BITSTREAM_FORMAT } from './bitstream-format.resource-type';
|
|||||||
import { BITSTREAM } from './bitstream.resource-type';
|
import { BITSTREAM } from './bitstream.resource-type';
|
||||||
import { DSpaceObject } from './dspace-object.model';
|
import { DSpaceObject } from './dspace-object.model';
|
||||||
import { HALLink } from './hal-link.model';
|
import { HALLink } from './hal-link.model';
|
||||||
import { HALResource } from './hal-resource.model';
|
|
||||||
import {BUNDLE} from './bundle.resource-type';
|
import {BUNDLE} from './bundle.resource-type';
|
||||||
import {Bundle} from './bundle.model';
|
import {Bundle} from './bundle.model';
|
||||||
|
import { ChildHALResource } from './child-hal-resource.model';
|
||||||
|
|
||||||
@typedObject
|
@typedObject
|
||||||
@inheritSerialization(DSpaceObject)
|
@inheritSerialization(DSpaceObject)
|
||||||
export class Bitstream extends DSpaceObject implements HALResource {
|
export class Bitstream extends DSpaceObject implements ChildHALResource {
|
||||||
static type = BITSTREAM;
|
static type = BITSTREAM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,4 +66,8 @@ export class Bitstream extends DSpaceObject implements HALResource {
|
|||||||
*/
|
*/
|
||||||
@link(BUNDLE)
|
@link(BUNDLE)
|
||||||
bundle?: Observable<RemoteData<Bundle>>;
|
bundle?: Observable<RemoteData<Bundle>>;
|
||||||
|
|
||||||
|
getParentLinkKey(): keyof this['_links'] {
|
||||||
|
return 'format';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user