mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-17 06:53:03 +00:00
Merge remote-tracking branch 'alex/w2p-112970_added-missing-breadcrumbs_contribute-7.4' into dspace-7_x
# Conflicts: # src/app/collection-page/collection-page-routing.module.ts # src/app/community-page/community-page-routing.module.ts # src/app/core/core.module.ts # src/app/workflowitems-edit-page/workflowitems-edit-page-routing.module.ts # src/app/workspaceitems-edit-page/workspaceitems-edit-page-routing.module.ts # src/assets/i18n/en.json5
This commit is contained in:
@@ -22,14 +22,33 @@ import { LinkMenuItemModel } from '../shared/menu/menu-item/models/link.model';
|
||||
import { ThemedCollectionPageComponent } from './themed-collection-page.component';
|
||||
import { MenuItemType } from '../shared/menu/menu-item-type.model';
|
||||
import { DSOEditMenuResolver } from '../shared/dso-page/dso-edit-menu.resolver';
|
||||
import { CommunityBreadcrumbResolver } from '../core/breadcrumbs/community-breadcrumb.resolver';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{
|
||||
path: COLLECTION_CREATE_PATH,
|
||||
component: CreateCollectionPageComponent,
|
||||
canActivate: [AuthenticatedGuard, CreateCollectionPageGuard]
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: CreateCollectionPageComponent,
|
||||
resolve: {
|
||||
breadcrumb: I18nBreadcrumbResolver,
|
||||
},
|
||||
data: {
|
||||
breadcrumbKey: 'collection.create',
|
||||
},
|
||||
},
|
||||
],
|
||||
canActivate: [AuthenticatedGuard, CreateCollectionPageGuard],
|
||||
data: {
|
||||
breadcrumbQueryParam: 'parent',
|
||||
},
|
||||
resolve: {
|
||||
breadcrumb: CommunityBreadcrumbResolver,
|
||||
},
|
||||
runGuardsAndResolvers: 'always',
|
||||
},
|
||||
{
|
||||
path: ':id',
|
||||
@@ -94,6 +113,7 @@ import { DSOEditMenuResolver } from '../shared/dso-page/dso-edit-menu.resolver';
|
||||
LinkService,
|
||||
CreateCollectionPageGuard,
|
||||
CollectionPageAdministratorGuard,
|
||||
CommunityBreadcrumbResolver,
|
||||
]
|
||||
})
|
||||
export class CollectionPageRoutingModule {
|
||||
|
@@ -15,14 +15,33 @@ import { LinkMenuItemModel } from '../shared/menu/menu-item/models/link.model';
|
||||
import { ThemedCommunityPageComponent } from './themed-community-page.component';
|
||||
import { MenuItemType } from '../shared/menu/menu-item-type.model';
|
||||
import { DSOEditMenuResolver } from '../shared/dso-page/dso-edit-menu.resolver';
|
||||
import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{
|
||||
path: COMMUNITY_CREATE_PATH,
|
||||
component: CreateCommunityPageComponent,
|
||||
canActivate: [AuthenticatedGuard, CreateCommunityPageGuard]
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: CreateCommunityPageComponent,
|
||||
resolve: {
|
||||
breadcrumb: I18nBreadcrumbResolver,
|
||||
},
|
||||
data: {
|
||||
breadcrumbKey: 'community.create',
|
||||
},
|
||||
}
|
||||
],
|
||||
canActivate: [AuthenticatedGuard, CreateCommunityPageGuard],
|
||||
data: {
|
||||
breadcrumbQueryParam: 'parent',
|
||||
},
|
||||
resolve: {
|
||||
breadcrumb: CommunityBreadcrumbResolver,
|
||||
},
|
||||
runGuardsAndResolvers: 'always',
|
||||
},
|
||||
{
|
||||
path: ':id',
|
||||
|
@@ -5,6 +5,10 @@ import { CommunityDataService } from '../data/community-data.service';
|
||||
import { Community } from '../shared/community.model';
|
||||
import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||
import { COMMUNITY_PAGE_LINKS_TO_FOLLOW } from '../../community-page/community-page.resolver';
|
||||
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
import { BreadcrumbConfig } from '../../breadcrumbs/breadcrumb/breadcrumb-config.model';
|
||||
import { hasValue } from '../../shared/empty.util';
|
||||
|
||||
/**
|
||||
* The class that resolves the BreadcrumbConfig object for a Community
|
||||
@@ -17,6 +21,23 @@ export class CommunityBreadcrumbResolver extends DSOBreadcrumbResolver<Community
|
||||
super(breadcrumbService, dataService);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to retrieve the breadcrumb config by the route id. It is also possible to retrieve the id through the
|
||||
* query parameters. This is done by defining the name of the query parameter in the data section under the property
|
||||
* breadcrumbQueryParam.
|
||||
*
|
||||
* @param route The current {@link ActivatedRouteSnapshot}
|
||||
* @param state The current {@link RouterStateSnapshot}
|
||||
* @returns BreadcrumbConfig object
|
||||
*/
|
||||
override resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<BreadcrumbConfig<Community>> {
|
||||
if (hasValue(route.data.breadcrumbQueryParam) && hasValue(route.queryParams[route.data.breadcrumbQueryParam])) {
|
||||
return this.resolveById(route.queryParams[route.data.breadcrumbQueryParam]);
|
||||
} else {
|
||||
return super.resolve(route, state);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@@ -18,7 +18,10 @@ describe('DSOBreadcrumbResolver', () => {
|
||||
uuid = '1234-65487-12354-1235';
|
||||
breadcrumbUrl = '/collections/' + uuid;
|
||||
currentUrl = breadcrumbUrl + '/edit';
|
||||
testCollection = Object.assign(new Collection(), { uuid });
|
||||
testCollection = Object.assign(new Collection(), {
|
||||
uuid: uuid,
|
||||
type: 'collection',
|
||||
});
|
||||
dsoBreadcrumbService = {};
|
||||
collectionService = {
|
||||
findById: (id: string) => createSuccessfulRemoteDataObject$(testCollection)
|
||||
|
@@ -10,6 +10,7 @@ import { ChildHALResource } from '../shared/child-hal-resource.model';
|
||||
import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||
import { hasValue } from '../../shared/empty.util';
|
||||
import { IdentifiableDataService } from '../data/base/identifiable-data.service';
|
||||
import { getDSORoute } from '../../app-routing-paths';
|
||||
|
||||
/**
|
||||
* The class that resolves the BreadcrumbConfig object for a DSpaceObject
|
||||
@@ -31,15 +32,22 @@ export abstract class DSOBreadcrumbResolver<T extends ChildHALResource & DSpaceO
|
||||
* @returns BreadcrumbConfig object
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<BreadcrumbConfig<T>> {
|
||||
const uuid = route.params.id;
|
||||
return this.resolveById(route.params.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method for resolving a breadcrumb by id
|
||||
*
|
||||
* @param uuid The uuid to resolve
|
||||
* @returns BreadcrumbConfig object
|
||||
*/
|
||||
resolveById(uuid: string): Observable<BreadcrumbConfig<T>> {
|
||||
return this.dataService.findById(uuid, true, false, ...this.followLinks).pipe(
|
||||
getFirstCompletedRemoteData(),
|
||||
getRemoteDataPayload(),
|
||||
map((object: T) => {
|
||||
if (hasValue(object)) {
|
||||
const fullPath = state.url;
|
||||
const url = fullPath.substr(0, fullPath.indexOf(uuid)) + uuid;
|
||||
return { provider: this.breadcrumbService, key: object, url: url };
|
||||
return { provider: this.breadcrumbService, key: object, url: getDSORoute(object) };
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
|
@@ -182,6 +182,7 @@ import { FlatBrowseDefinition } from './shared/flat-browse-definition.model';
|
||||
import { ValueListBrowseDefinition } from './shared/value-list-browse-definition.model';
|
||||
import { NonHierarchicalBrowseDefinition } from './shared/non-hierarchical-browse-definition';
|
||||
import { BulkAccessConditionOptions } from './config/models/bulk-access-condition-options.model';
|
||||
import { SubmissionParentBreadcrumbsService } from './submission/submission-parent-breadcrumb.service';
|
||||
|
||||
/**
|
||||
* When not in production, endpoint responses can be mocked for testing purposes
|
||||
@@ -245,6 +246,7 @@ const PROVIDERS = [
|
||||
NotificationsService,
|
||||
WorkspaceitemDataService,
|
||||
WorkflowItemDataService,
|
||||
SubmissionParentBreadcrumbsService,
|
||||
DSpaceObjectDataService,
|
||||
ConfigurationDataService,
|
||||
DSOChangeAnalyzer,
|
||||
|
@@ -0,0 +1,14 @@
|
||||
import { followLink, FollowLinkConfig } from '../../../shared/utils/follow-link-config.model';
|
||||
import { WorkflowItem } from '../models/workflowitem.model';
|
||||
import { WorkspaceItem } from '../models/workspaceitem.model';
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular dependencies in webpack.
|
||||
*/
|
||||
export const SUBMISSION_LINKS_TO_FOLLOW: FollowLinkConfig<WorkflowItem | WorkspaceItem>[] = [
|
||||
followLink('item'),
|
||||
followLink('collection'),
|
||||
];
|
@@ -1,12 +1,11 @@
|
||||
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { switchMap } from 'rxjs/operators';
|
||||
import { RemoteData } from '../../data/remote-data';
|
||||
import { getFirstCompletedRemoteData } from '../../shared/operators';
|
||||
import { IdentifiableDataService } from '../../data/base/identifiable-data.service';
|
||||
import { SUBMISSION_LINKS_TO_FOLLOW } from './submission-links-to-follow';
|
||||
|
||||
/**
|
||||
* This class represents a resolver that requests a specific item before the route is activated
|
||||
@@ -15,7 +14,6 @@ import { IdentifiableDataService } from '../../data/base/identifiable-data.servi
|
||||
export class SubmissionObjectResolver<T> implements Resolve<RemoteData<T>> {
|
||||
constructor(
|
||||
protected dataService: IdentifiableDataService<any>,
|
||||
protected store: Store<any>,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -30,7 +28,7 @@ export class SubmissionObjectResolver<T> implements Resolve<RemoteData<T>> {
|
||||
const itemRD$ = this.dataService.findById(route.params.id,
|
||||
true,
|
||||
false,
|
||||
followLink('item'),
|
||||
...SUBMISSION_LINKS_TO_FOLLOW,
|
||||
).pipe(
|
||||
getFirstCompletedRemoteData(),
|
||||
switchMap((wfiRD: RemoteData<any>) => wfiRD.payload.item as Observable<RemoteData<T>>),
|
||||
|
@@ -0,0 +1,43 @@
|
||||
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { getFirstCompletedRemoteData, getRemoteDataPayload } from '../../shared/operators';
|
||||
import { IdentifiableDataService } from '../../data/base/identifiable-data.service';
|
||||
import { BreadcrumbConfig } from '../../../breadcrumbs/breadcrumb/breadcrumb-config.model';
|
||||
import { SubmissionParentBreadcrumbsService } from '../submission-parent-breadcrumb.service';
|
||||
import { SUBMISSION_LINKS_TO_FOLLOW } from './submission-links-to-follow';
|
||||
import { SubmissionObject } from '../models/submission-object.model';
|
||||
|
||||
/**
|
||||
* This class represents a resolver that requests a specific item before the route is activated
|
||||
*/
|
||||
export abstract class SubmissionParentBreadcrumbResolver implements Resolve<BreadcrumbConfig<SubmissionObject>> {
|
||||
|
||||
protected constructor(
|
||||
protected dataService: IdentifiableDataService<any>,
|
||||
protected breadcrumbService: SubmissionParentBreadcrumbsService,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Method for resolving an item based on the parameters in the current route
|
||||
* @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot
|
||||
* @param {RouterStateSnapshot} state The current RouterStateSnapshot
|
||||
* @returns Observable<<RemoteData<Item>> Emits the found item based on the parameters in the current route,
|
||||
* or an error if something went wrong
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<BreadcrumbConfig<SubmissionObject>> {
|
||||
return this.dataService.findById(route.params.id,
|
||||
true,
|
||||
false,
|
||||
...SUBMISSION_LINKS_TO_FOLLOW,
|
||||
).pipe(
|
||||
getFirstCompletedRemoteData(),
|
||||
getRemoteDataPayload(),
|
||||
map((submissionObject: SubmissionObject) => ({
|
||||
provider: this.breadcrumbService,
|
||||
key: submissionObject,
|
||||
} as BreadcrumbConfig<SubmissionObject>)),
|
||||
);
|
||||
}
|
||||
}
|
@@ -0,0 +1,59 @@
|
||||
import { BreadcrumbsProviderService } from '../breadcrumbs/breadcrumbsProviderService';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable, switchMap, combineLatest, of as observableOf } from 'rxjs';
|
||||
import { Breadcrumb } from '../../breadcrumbs/breadcrumb/breadcrumb.model';
|
||||
import { getFirstCompletedRemoteData, getRemoteDataPayload } from '../shared/operators';
|
||||
import { Collection } from '../shared/collection.model';
|
||||
import { DSONameService } from '../breadcrumbs/dso-name.service';
|
||||
import { SubmissionObject } from './models/submission-object.model';
|
||||
import { RemoteData } from '../data/remote-data';
|
||||
import { DSOBreadcrumbsService } from '../breadcrumbs/dso-breadcrumbs.service';
|
||||
import { getDSORoute } from '../../app-routing-paths';
|
||||
import { SubmissionService } from '../../submission/submission.service';
|
||||
import { CollectionDataService } from '../data/collection-data.service';
|
||||
import { hasValue } from '../../shared/empty.util';
|
||||
|
||||
/**
|
||||
* Service to calculate the parent {@link DSpaceObject} breadcrumbs for a {@link SubmissionObject}
|
||||
*/
|
||||
@Injectable()
|
||||
export class SubmissionParentBreadcrumbsService implements BreadcrumbsProviderService<SubmissionObject> {
|
||||
|
||||
constructor(
|
||||
protected dsoNameService: DSONameService,
|
||||
protected dsoBreadcrumbsService: DSOBreadcrumbsService,
|
||||
protected submissionService: SubmissionService,
|
||||
protected collectionService: CollectionDataService,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the parent breadcrumb structure for {@link SubmissionObject}s. It also automatically recreates the
|
||||
* parent breadcrumb structure when you change a {@link SubmissionObject}'s by dispatching a
|
||||
* {@link ChangeSubmissionCollectionAction}.
|
||||
*
|
||||
* @param submissionObject The {@link SubmissionObject} for which the parent breadcrumb structure needs to be created
|
||||
*/
|
||||
getBreadcrumbs(submissionObject: SubmissionObject): Observable<Breadcrumb[]> {
|
||||
return combineLatest([
|
||||
(submissionObject.collection as Observable<RemoteData<Collection>>).pipe(
|
||||
getFirstCompletedRemoteData(),
|
||||
getRemoteDataPayload(),
|
||||
),
|
||||
this.submissionService.getSubmissionCollectionId(submissionObject.id),
|
||||
]).pipe(
|
||||
switchMap(([collection, latestCollectionId]: [Collection, string]) => {
|
||||
if (hasValue(latestCollectionId)) {
|
||||
return this.collectionService.findById(latestCollectionId).pipe(
|
||||
getFirstCompletedRemoteData(),
|
||||
getRemoteDataPayload(),
|
||||
);
|
||||
} else {
|
||||
return observableOf(collection);
|
||||
}
|
||||
}),
|
||||
switchMap((collection: Collection) => this.dsoBreadcrumbsService.getBreadcrumbs(collection, getDSORoute(collection))),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@@ -4,7 +4,7 @@ import { Router } from '@angular/router';
|
||||
|
||||
import { Observable, of as observableOf, Subscription, timer as observableTimer } from 'rxjs';
|
||||
import { catchError, concatMap, distinctUntilChanged, filter, find, map, startWith, take, tap } from 'rxjs/operators';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Store, MemoizedSelector, createSelector, select } from '@ngrx/store';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
import { submissionSelector, SubmissionState } from './submission.reducers';
|
||||
@@ -47,6 +47,20 @@ import { SubmissionJsonPatchOperationsService } from '../core/submission/submiss
|
||||
import { SubmissionSectionObject } from './objects/submission-section-object.model';
|
||||
import { SubmissionError } from './objects/submission-error.model';
|
||||
|
||||
function getSubmissionSelector(submissionId: string): MemoizedSelector<SubmissionState, SubmissionObjectEntry> {
|
||||
return createSelector(
|
||||
submissionSelector,
|
||||
(state: SubmissionState) => state.objects[submissionId],
|
||||
);
|
||||
}
|
||||
|
||||
function getSubmissionCollectionIdSelector(submissionId: string): MemoizedSelector<SubmissionState, string> {
|
||||
return createSelector(
|
||||
getSubmissionSelector(submissionId),
|
||||
(submission: SubmissionObjectEntry) => submission?.collection,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* A service that provides methods used in submission process.
|
||||
*/
|
||||
@@ -96,10 +110,19 @@ export class SubmissionService {
|
||||
* @param collectionId
|
||||
* The collection id
|
||||
*/
|
||||
changeSubmissionCollection(submissionId, collectionId) {
|
||||
changeSubmissionCollection(submissionId: string, collectionId: string): void {
|
||||
this.store.dispatch(new ChangeSubmissionCollectionAction(submissionId, collectionId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Listen to collection changes for a certain {@link SubmissionObject}
|
||||
*
|
||||
* @param submissionId The submission id
|
||||
*/
|
||||
getSubmissionCollectionId(submissionId: string): Observable<string> {
|
||||
return this.store.pipe(select(getSubmissionCollectionIdSelector(submissionId)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a REST call to create a new workspaceitem and return response
|
||||
*
|
||||
|
@@ -0,0 +1,22 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Resolve } from '@angular/router';
|
||||
import { WorkflowItemDataService } from '../core/submission/workflowitem-data.service';
|
||||
import { SubmissionParentBreadcrumbResolver } from '../core/submission/resolver/submission-parent-breadcrumb.resolver';
|
||||
import { BreadcrumbConfig } from '../breadcrumbs/breadcrumb/breadcrumb-config.model';
|
||||
import { SubmissionParentBreadcrumbsService } from '../core/submission/submission-parent-breadcrumb.service';
|
||||
import { SubmissionObject } from '../core/submission/models/submission-object.model';
|
||||
|
||||
/**
|
||||
* This class represents a resolver that retrieves the breadcrumbs of the workflow item
|
||||
*/
|
||||
@Injectable()
|
||||
export class ItemFromWorkflowBreadcrumbResolver extends SubmissionParentBreadcrumbResolver implements Resolve<BreadcrumbConfig<SubmissionObject>> {
|
||||
|
||||
constructor(
|
||||
protected dataService: WorkflowItemDataService,
|
||||
protected breadcrumbService: SubmissionParentBreadcrumbsService,
|
||||
) {
|
||||
super(dataService, breadcrumbService);
|
||||
}
|
||||
|
||||
}
|
@@ -19,7 +19,7 @@ describe('ItemFromWorkflowResolver', () => {
|
||||
wfiService = {
|
||||
findById: (id: string) => createSuccessfulRemoteDataObject$(wfi)
|
||||
} as any;
|
||||
resolver = new ItemFromWorkflowResolver(wfiService, null);
|
||||
resolver = new ItemFromWorkflowResolver(wfiService);
|
||||
});
|
||||
|
||||
it('should resolve a an item from from the workflow item with the correct id', (done) => {
|
||||
|
@@ -2,7 +2,6 @@ import { Injectable } from '@angular/core';
|
||||
import { Resolve } from '@angular/router';
|
||||
import { RemoteData } from '../core/data/remote-data';
|
||||
import { Item } from '../core/shared/item.model';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { WorkflowItemDataService } from '../core/submission/workflowitem-data.service';
|
||||
import { SubmissionObjectResolver } from '../core/submission/resolver/submission-object.resolver';
|
||||
|
||||
@@ -10,12 +9,12 @@ import { SubmissionObjectResolver } from '../core/submission/resolver/submission
|
||||
* This class represents a resolver that requests a specific item before the route is activated
|
||||
*/
|
||||
@Injectable()
|
||||
export class ItemFromWorkflowResolver extends SubmissionObjectResolver<Item> implements Resolve<RemoteData<Item>> {
|
||||
export class ItemFromWorkflowResolver extends SubmissionObjectResolver<Item> implements Resolve<RemoteData<Item>> {
|
||||
|
||||
constructor(
|
||||
private workflowItemService: WorkflowItemDataService,
|
||||
protected store: Store<any>
|
||||
protected dataService: WorkflowItemDataService,
|
||||
) {
|
||||
super(workflowItemService, store);
|
||||
super(dataService);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -19,13 +19,17 @@ import { ThemedFullItemPageComponent } from '../item-page/full/themed-full-item-
|
||||
import {
|
||||
AdvancedWorkflowActionPageComponent
|
||||
} from './advanced-workflow-action/advanced-workflow-action-page/advanced-workflow-action-page.component';
|
||||
import { ItemFromWorkflowBreadcrumbResolver } from './item-from-workflow-breadcrumb.resolver';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{
|
||||
path: ':id',
|
||||
resolve: { wfi: WorkflowItemPageResolver },
|
||||
resolve: {
|
||||
breadcrumb: ItemFromWorkflowBreadcrumbResolver,
|
||||
wfi: WorkflowItemPageResolver,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
canActivate: [AuthenticatedGuard],
|
||||
@@ -81,7 +85,11 @@ import {
|
||||
}]
|
||||
)
|
||||
],
|
||||
providers: [WorkflowItemPageResolver, ItemFromWorkflowResolver]
|
||||
providers: [
|
||||
ItemFromWorkflowBreadcrumbResolver,
|
||||
ItemFromWorkflowResolver,
|
||||
WorkflowItemPageResolver,
|
||||
],
|
||||
})
|
||||
/**
|
||||
* This module defines the default component to load when navigating to the workflowitems edit page path.
|
||||
|
@@ -0,0 +1,22 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Resolve } from '@angular/router';
|
||||
import { WorkspaceitemDataService } from '../core/submission/workspaceitem-data.service';
|
||||
import { SubmissionParentBreadcrumbResolver } from '../core/submission/resolver/submission-parent-breadcrumb.resolver';
|
||||
import { BreadcrumbConfig } from '../breadcrumbs/breadcrumb/breadcrumb-config.model';
|
||||
import { SubmissionParentBreadcrumbsService } from '../core/submission/submission-parent-breadcrumb.service';
|
||||
import { SubmissionObject } from '../core/submission/models/submission-object.model';
|
||||
|
||||
/**
|
||||
* This class represents a resolver that retrieves the breadcrumbs of the workspace item
|
||||
*/
|
||||
@Injectable()
|
||||
export class ItemFromWorkspaceBreadcrumbResolver extends SubmissionParentBreadcrumbResolver implements Resolve<BreadcrumbConfig<SubmissionObject>> {
|
||||
|
||||
constructor(
|
||||
protected dataService: WorkspaceitemDataService,
|
||||
protected breadcrumbService: SubmissionParentBreadcrumbsService,
|
||||
) {
|
||||
super(dataService, breadcrumbService);
|
||||
}
|
||||
|
||||
}
|
@@ -19,7 +19,7 @@ describe('ItemFromWorkspaceResolver', () => {
|
||||
wfiService = {
|
||||
findById: (id: string) => createSuccessfulRemoteDataObject$(wfi)
|
||||
} as any;
|
||||
resolver = new ItemFromWorkspaceResolver(wfiService, null);
|
||||
resolver = new ItemFromWorkspaceResolver(wfiService);
|
||||
});
|
||||
|
||||
it('should resolve a an item from from the workflow item with the correct id', (done) => {
|
||||
|
@@ -2,7 +2,6 @@ import { Injectable } from '@angular/core';
|
||||
import { Resolve } from '@angular/router';
|
||||
import { RemoteData } from '../core/data/remote-data';
|
||||
import { Item } from '../core/shared/item.model';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { SubmissionObjectResolver } from '../core/submission/resolver/submission-object.resolver';
|
||||
import { WorkspaceitemDataService } from '../core/submission/workspaceitem-data.service';
|
||||
|
||||
@@ -10,12 +9,12 @@ import { WorkspaceitemDataService } from '../core/submission/workspaceitem-data.
|
||||
* This class represents a resolver that requests a specific item before the route is activated
|
||||
*/
|
||||
@Injectable()
|
||||
export class ItemFromWorkspaceResolver extends SubmissionObjectResolver<Item> implements Resolve<RemoteData<Item>> {
|
||||
constructor(
|
||||
private workspaceItemService: WorkspaceitemDataService,
|
||||
protected store: Store<any>
|
||||
) {
|
||||
super(workspaceItemService, store);
|
||||
}
|
||||
export class ItemFromWorkspaceResolver extends SubmissionObjectResolver<Item> implements Resolve<RemoteData<Item>> {
|
||||
|
||||
constructor(
|
||||
protected dataService: WorkspaceitemDataService,
|
||||
) {
|
||||
super(dataService);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -9,6 +9,7 @@ import { ItemFromWorkspaceResolver } from './item-from-workspace.resolver';
|
||||
import { WorkspaceItemPageResolver } from './workspace-item-page.resolver';
|
||||
import { WorkspaceItemsDeletePageComponent } from './workspaceitems-delete-page/workspaceitems-delete-page.component';
|
||||
import { ThemedWorkspaceItemsDeletePageComponent } from './workspaceitems-delete-page/themed-workspaceitems-delete-page.component';
|
||||
import { ItemFromWorkspaceBreadcrumbResolver } from './item-from-workspace-breadcrumb.resolver';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -16,7 +17,10 @@ import { ThemedWorkspaceItemsDeletePageComponent } from './workspaceitems-delete
|
||||
{ path: '', redirectTo: '/home', pathMatch: 'full' },
|
||||
{
|
||||
path: ':id',
|
||||
resolve: { wsi: WorkspaceItemPageResolver },
|
||||
resolve: {
|
||||
breadcrumb: ItemFromWorkspaceBreadcrumbResolver,
|
||||
wsi: WorkspaceItemPageResolver,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
canActivate: [AuthenticatedGuard],
|
||||
@@ -61,7 +65,11 @@ import { ThemedWorkspaceItemsDeletePageComponent } from './workspaceitems-delete
|
||||
}
|
||||
])
|
||||
],
|
||||
providers: [WorkspaceItemPageResolver, ItemFromWorkspaceResolver]
|
||||
providers: [
|
||||
ItemFromWorkspaceBreadcrumbResolver,
|
||||
ItemFromWorkspaceResolver,
|
||||
WorkspaceItemPageResolver,
|
||||
],
|
||||
})
|
||||
/**
|
||||
* This module defines the default component to load when navigating to the workspaceitems edit page path
|
||||
|
@@ -898,6 +898,8 @@
|
||||
|
||||
"claimed-declined-task-search-result-list-element.title": "Declined, sent back to Review Manager's workflow",
|
||||
|
||||
"collection.create.breadcrumbs": "Create collection",
|
||||
|
||||
"collection.browse.logo": "Browse for a collection logo",
|
||||
|
||||
"collection.create.head": "Create a Collection",
|
||||
@@ -1186,6 +1188,8 @@
|
||||
|
||||
"community.browse.logo": "Browse for a community logo",
|
||||
|
||||
"community.create.breadcrumbs": "Create Community",
|
||||
|
||||
"community.create.head": "Create a Community",
|
||||
|
||||
"community.create.notifications.success": "Successfully created the Community",
|
||||
|
Reference in New Issue
Block a user