mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-10 11:33:04 +00:00
Merge branch 'w2p-112970_added-missing-breadcrumbs_contribute-7.4' into main
This commit is contained in:
@@ -4,6 +4,7 @@ import { BrowseByGuard } from '../browse-by/browse-by-guard';
|
|||||||
import { BrowseByI18nBreadcrumbResolver } from '../browse-by/browse-by-i18n-breadcrumb.resolver';
|
import { BrowseByI18nBreadcrumbResolver } from '../browse-by/browse-by-i18n-breadcrumb.resolver';
|
||||||
import { AuthenticatedGuard } from '../core/auth/authenticated.guard';
|
import { AuthenticatedGuard } from '../core/auth/authenticated.guard';
|
||||||
import { CollectionBreadcrumbResolver } from '../core/breadcrumbs/collection-breadcrumb.resolver';
|
import { CollectionBreadcrumbResolver } from '../core/breadcrumbs/collection-breadcrumb.resolver';
|
||||||
|
import { CommunityBreadcrumbResolver } from '../core/breadcrumbs/community-breadcrumb.resolver';
|
||||||
import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
|
import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||||
import { ComcolBrowseByComponent } from '../shared/comcol/sections/comcol-browse-by/comcol-browse-by.component';
|
import { ComcolBrowseByComponent } from '../shared/comcol/sections/comcol-browse-by/comcol-browse-by.component';
|
||||||
import { ComcolSearchSectionComponent } from '../shared/comcol/sections/comcol-search-section/comcol-search-section.component';
|
import { ComcolSearchSectionComponent } from '../shared/comcol/sections/comcol-search-section/comcol-search-section.component';
|
||||||
@@ -24,12 +25,28 @@ import { ItemTemplatePageResolver } from './edit-item-template-page/item-templat
|
|||||||
import { ThemedEditItemTemplatePageComponent } from './edit-item-template-page/themed-edit-item-template-page.component';
|
import { ThemedEditItemTemplatePageComponent } from './edit-item-template-page/themed-edit-item-template-page.component';
|
||||||
import { ThemedCollectionPageComponent } from './themed-collection-page.component';
|
import { ThemedCollectionPageComponent } from './themed-collection-page.component';
|
||||||
|
|
||||||
|
|
||||||
export const ROUTES: Route[] = [
|
export const ROUTES: Route[] = [
|
||||||
{
|
{
|
||||||
path: COLLECTION_CREATE_PATH,
|
path: COLLECTION_CREATE_PATH,
|
||||||
component: CreateCollectionPageComponent,
|
|
||||||
canActivate: [AuthenticatedGuard, CreateCollectionPageGuard],
|
canActivate: [AuthenticatedGuard, CreateCollectionPageGuard],
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: CreateCollectionPageComponent,
|
||||||
|
resolve: {
|
||||||
|
breadcrumb: I18nBreadcrumbResolver,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
breadcrumbKey: 'collection.create',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
data: {
|
||||||
|
breadcrumbQueryParam: 'parent',
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
breadcrumb: CommunityBreadcrumbResolver,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ':id',
|
path: ':id',
|
||||||
|
@@ -25,8 +25,25 @@ import { ThemedCommunityPageComponent } from './themed-community-page.component'
|
|||||||
export const ROUTES: Route[] = [
|
export const ROUTES: Route[] = [
|
||||||
{
|
{
|
||||||
path: COMMUNITY_CREATE_PATH,
|
path: COMMUNITY_CREATE_PATH,
|
||||||
component: CreateCommunityPageComponent,
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: CreateCommunityPageComponent,
|
||||||
|
resolve: {
|
||||||
|
breadcrumb: I18nBreadcrumbResolver,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
breadcrumbKey: 'community.create',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
canActivate: [AuthenticatedGuard, CreateCommunityPageGuard],
|
canActivate: [AuthenticatedGuard, CreateCommunityPageGuard],
|
||||||
|
data: {
|
||||||
|
breadcrumbQueryParam: 'parent',
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
breadcrumb: CommunityBreadcrumbResolver,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ':id',
|
path: ':id',
|
||||||
|
@@ -1,6 +1,13 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
import {
|
||||||
|
ActivatedRouteSnapshot,
|
||||||
|
RouterStateSnapshot,
|
||||||
|
} from '@angular/router';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
import { BreadcrumbConfig } from '../../breadcrumbs/breadcrumb/breadcrumb-config.model';
|
||||||
import { COMMUNITY_PAGE_LINKS_TO_FOLLOW } from '../../community-page/community-page.resolver';
|
import { COMMUNITY_PAGE_LINKS_TO_FOLLOW } from '../../community-page/community-page.resolver';
|
||||||
|
import { hasValue } from '../../shared/empty.util';
|
||||||
import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||||
import { CommunityDataService } from '../data/community-data.service';
|
import { CommunityDataService } from '../data/community-data.service';
|
||||||
import { Community } from '../shared/community.model';
|
import { Community } from '../shared/community.model';
|
||||||
@@ -18,6 +25,23 @@ export class CommunityBreadcrumbResolver extends DSOBreadcrumbResolver<Community
|
|||||||
super(breadcrumbService, dataService);
|
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
|
* 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
|
* The self links defined in this list are expected to be requested somewhere in the near future
|
||||||
|
@@ -19,7 +19,10 @@ describe('DSOBreadcrumbResolver', () => {
|
|||||||
uuid = '1234-65487-12354-1235';
|
uuid = '1234-65487-12354-1235';
|
||||||
breadcrumbUrl = '/collections/' + uuid;
|
breadcrumbUrl = '/collections/' + uuid;
|
||||||
currentUrl = breadcrumbUrl + '/edit';
|
currentUrl = breadcrumbUrl + '/edit';
|
||||||
testCollection = Object.assign(new Collection(), { uuid });
|
testCollection = Object.assign(new Collection(), {
|
||||||
|
uuid: uuid,
|
||||||
|
type: 'collection',
|
||||||
|
});
|
||||||
dsoBreadcrumbService = {};
|
dsoBreadcrumbService = {};
|
||||||
collectionService = {
|
collectionService = {
|
||||||
findById: (id: string) => createSuccessfulRemoteDataObject$(testCollection),
|
findById: (id: string) => createSuccessfulRemoteDataObject$(testCollection),
|
||||||
|
@@ -7,6 +7,7 @@ import {
|
|||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { getDSORoute } from '../../app-routing-paths';
|
||||||
import { BreadcrumbConfig } from '../../breadcrumbs/breadcrumb/breadcrumb-config.model';
|
import { BreadcrumbConfig } from '../../breadcrumbs/breadcrumb/breadcrumb-config.model';
|
||||||
import { hasValue } from '../../shared/empty.util';
|
import { hasValue } from '../../shared/empty.util';
|
||||||
import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||||
@@ -39,15 +40,22 @@ export abstract class DSOBreadcrumbResolver<T extends ChildHALResource & DSpaceO
|
|||||||
* @returns BreadcrumbConfig object
|
* @returns BreadcrumbConfig object
|
||||||
*/
|
*/
|
||||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<BreadcrumbConfig<T>> {
|
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(
|
return this.dataService.findById(uuid, true, false, ...this.followLinks).pipe(
|
||||||
getFirstCompletedRemoteData(),
|
getFirstCompletedRemoteData(),
|
||||||
getRemoteDataPayload(),
|
getRemoteDataPayload(),
|
||||||
map((object: T) => {
|
map((object: T) => {
|
||||||
if (hasValue(object)) {
|
if (hasValue(object)) {
|
||||||
const fullPath = state.url;
|
return { provider: this.breadcrumbService, key: object, url: getDSORoute(object) };
|
||||||
const url = fullPath.substr(0, fullPath.indexOf(uuid)) + uuid;
|
|
||||||
return { provider: this.breadcrumbService, key: object, url: url };
|
|
||||||
} else {
|
} else {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,17 @@
|
|||||||
|
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'),
|
||||||
|
];
|
@@ -4,14 +4,13 @@ import {
|
|||||||
Resolve,
|
Resolve,
|
||||||
RouterStateSnapshot,
|
RouterStateSnapshot,
|
||||||
} from '@angular/router';
|
} from '@angular/router';
|
||||||
import { Store } from '@ngrx/store';
|
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { switchMap } from 'rxjs/operators';
|
import { switchMap } from 'rxjs/operators';
|
||||||
|
|
||||||
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
|
||||||
import { IdentifiableDataService } from '../../data/base/identifiable-data.service';
|
import { IdentifiableDataService } from '../../data/base/identifiable-data.service';
|
||||||
import { RemoteData } from '../../data/remote-data';
|
import { RemoteData } from '../../data/remote-data';
|
||||||
import { getFirstCompletedRemoteData } from '../../shared/operators';
|
import { getFirstCompletedRemoteData } from '../../shared/operators';
|
||||||
|
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
|
* This class represents a resolver that requests a specific item before the route is activated
|
||||||
@@ -19,23 +18,22 @@ import { getFirstCompletedRemoteData } from '../../shared/operators';
|
|||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class SubmissionObjectResolver<T> implements Resolve<RemoteData<T>> {
|
export class SubmissionObjectResolver<T> implements Resolve<RemoteData<T>> {
|
||||||
constructor(
|
constructor(
|
||||||
protected dataService: IdentifiableDataService<any>,
|
protected dataService: IdentifiableDataService<any>,
|
||||||
protected store: Store<any>,
|
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method for resolving an item based on the parameters in the current route
|
* Method for resolving an item based on the parameters in the current route
|
||||||
* @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot
|
* @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot
|
||||||
* @param {RouterStateSnapshot} state The current RouterStateSnapshot
|
* @param {RouterStateSnapshot} state The current RouterStateSnapshot
|
||||||
* @returns Observable<<RemoteData<Item>> Emits the found item based on the parameters in the current route,
|
* @returns Observable<<RemoteData<Item>> Emits the found item based on the parameters in the current route,
|
||||||
* or an error if something went wrong
|
* or an error if something went wrong
|
||||||
*/
|
*/
|
||||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<RemoteData<T>> {
|
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<RemoteData<T>> {
|
||||||
const itemRD$ = this.dataService.findById(route.params.id,
|
const itemRD$ = this.dataService.findById(route.params.id,
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
followLink('item'),
|
...SUBMISSION_LINKS_TO_FOLLOW,
|
||||||
).pipe(
|
).pipe(
|
||||||
getFirstCompletedRemoteData(),
|
getFirstCompletedRemoteData(),
|
||||||
switchMap((wfiRD: RemoteData<any>) => wfiRD.payload.item as Observable<RemoteData<T>>),
|
switchMap((wfiRD: RemoteData<any>) => wfiRD.payload.item as Observable<RemoteData<T>>),
|
||||||
|
@@ -0,0 +1,51 @@
|
|||||||
|
import {
|
||||||
|
ActivatedRouteSnapshot,
|
||||||
|
Resolve,
|
||||||
|
RouterStateSnapshot,
|
||||||
|
} from '@angular/router';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { BreadcrumbConfig } from '../../../breadcrumbs/breadcrumb/breadcrumb-config.model';
|
||||||
|
import { IdentifiableDataService } from '../../data/base/identifiable-data.service';
|
||||||
|
import {
|
||||||
|
getFirstCompletedRemoteData,
|
||||||
|
getRemoteDataPayload,
|
||||||
|
} from '../../shared/operators';
|
||||||
|
import { SubmissionObject } from '../models/submission-object.model';
|
||||||
|
import { SubmissionParentBreadcrumbsService } from '../submission-parent-breadcrumb.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
|
||||||
|
*/
|
||||||
|
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,70 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import {
|
||||||
|
combineLatest,
|
||||||
|
Observable,
|
||||||
|
of as observableOf,
|
||||||
|
switchMap,
|
||||||
|
} from 'rxjs';
|
||||||
|
|
||||||
|
import { getDSORoute } from '../../app-routing-paths';
|
||||||
|
import { Breadcrumb } from '../../breadcrumbs/breadcrumb/breadcrumb.model';
|
||||||
|
import { hasValue } from '../../shared/empty.util';
|
||||||
|
import { SubmissionService } from '../../submission/submission.service';
|
||||||
|
import { BreadcrumbsProviderService } from '../breadcrumbs/breadcrumbsProviderService';
|
||||||
|
import { DSOBreadcrumbsService } from '../breadcrumbs/dso-breadcrumbs.service';
|
||||||
|
import { DSONameService } from '../breadcrumbs/dso-name.service';
|
||||||
|
import { CollectionDataService } from '../data/collection-data.service';
|
||||||
|
import { RemoteData } from '../data/remote-data';
|
||||||
|
import { Collection } from '../shared/collection.model';
|
||||||
|
import {
|
||||||
|
getFirstCompletedRemoteData,
|
||||||
|
getRemoteDataPayload,
|
||||||
|
} from '../shared/operators';
|
||||||
|
import { SubmissionObject } from './models/submission-object.model';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Service to calculate the parent {@link DSpaceObject} breadcrumbs for a {@link SubmissionObject}
|
||||||
|
*/
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root',
|
||||||
|
})
|
||||||
|
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))),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -1,7 +1,12 @@
|
|||||||
import { HttpHeaders } from '@angular/common/http';
|
import { HttpHeaders } from '@angular/common/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { Store } from '@ngrx/store';
|
import {
|
||||||
|
createSelector,
|
||||||
|
MemoizedSelector,
|
||||||
|
select,
|
||||||
|
Store,
|
||||||
|
} from '@ngrx/store';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import {
|
import {
|
||||||
Observable,
|
Observable,
|
||||||
@@ -71,6 +76,20 @@ import {
|
|||||||
SubmissionState,
|
SubmissionState,
|
||||||
} from './submission.reducers';
|
} from './submission.reducers';
|
||||||
|
|
||||||
|
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.
|
* A service that provides methods used in submission process.
|
||||||
*/
|
*/
|
||||||
@@ -120,10 +139,19 @@ export class SubmissionService {
|
|||||||
* @param collectionId
|
* @param collectionId
|
||||||
* The collection id
|
* The collection id
|
||||||
*/
|
*/
|
||||||
changeSubmissionCollection(submissionId, collectionId) {
|
changeSubmissionCollection(submissionId: string, collectionId: string): void {
|
||||||
this.store.dispatch(new ChangeSubmissionCollectionAction(submissionId, collectionId));
|
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
|
* Perform a REST call to create a new workspaceitem and return response
|
||||||
*
|
*
|
||||||
|
@@ -0,0 +1,25 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Resolve } from '@angular/router';
|
||||||
|
|
||||||
|
import { BreadcrumbConfig } from '../breadcrumbs/breadcrumb/breadcrumb-config.model';
|
||||||
|
import { SubmissionObject } from '../core/submission/models/submission-object.model';
|
||||||
|
import { SubmissionParentBreadcrumbResolver } from '../core/submission/resolver/submission-parent-breadcrumb.resolver';
|
||||||
|
import { SubmissionParentBreadcrumbsService } from '../core/submission/submission-parent-breadcrumb.service';
|
||||||
|
import { WorkflowItemDataService } from '../core/submission/workflowitem-data.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class represents a resolver that retrieves the breadcrumbs of the workflow item
|
||||||
|
*/
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root',
|
||||||
|
})
|
||||||
|
export class ItemFromWorkflowBreadcrumbResolver extends SubmissionParentBreadcrumbResolver implements Resolve<BreadcrumbConfig<SubmissionObject>> {
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
protected dataService: WorkflowItemDataService,
|
||||||
|
protected breadcrumbService: SubmissionParentBreadcrumbsService,
|
||||||
|
) {
|
||||||
|
super(dataService, breadcrumbService);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -20,7 +20,7 @@ describe('ItemFromWorkflowResolver', () => {
|
|||||||
wfiService = {
|
wfiService = {
|
||||||
findById: (id: string) => createSuccessfulRemoteDataObject$(wfi),
|
findById: (id: string) => createSuccessfulRemoteDataObject$(wfi),
|
||||||
} as any;
|
} 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) => {
|
it('should resolve a an item from from the workflow item with the correct id', (done) => {
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Resolve } from '@angular/router';
|
import { Resolve } from '@angular/router';
|
||||||
import { Store } from '@ngrx/store';
|
|
||||||
|
|
||||||
import { RemoteData } from '../core/data/remote-data';
|
import { RemoteData } from '../core/data/remote-data';
|
||||||
import { Item } from '../core/shared/item.model';
|
import { Item } from '../core/shared/item.model';
|
||||||
@@ -11,12 +10,12 @@ import { WorkflowItemDataService } from '../core/submission/workflowitem-data.se
|
|||||||
* This class represents a resolver that requests a specific item before the route is activated
|
* This class represents a resolver that requests a specific item before the route is activated
|
||||||
*/
|
*/
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class ItemFromWorkflowResolver extends SubmissionObjectResolver<Item> implements Resolve<RemoteData<Item>> {
|
export class ItemFromWorkflowResolver extends SubmissionObjectResolver<Item> implements Resolve<RemoteData<Item>> {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private workflowItemService: WorkflowItemDataService,
|
protected dataService: WorkflowItemDataService,
|
||||||
protected store: Store<any>,
|
|
||||||
) {
|
) {
|
||||||
super(workflowItemService, store);
|
super(dataService);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -6,6 +6,7 @@ import { ThemedFullItemPageComponent } from '../item-page/full/themed-full-item-
|
|||||||
import { ThemedSubmissionEditComponent } from '../submission/edit/themed-submission-edit.component';
|
import { ThemedSubmissionEditComponent } from '../submission/edit/themed-submission-edit.component';
|
||||||
import { AdvancedWorkflowActionPageComponent } from './advanced-workflow-action/advanced-workflow-action-page/advanced-workflow-action-page.component';
|
import { AdvancedWorkflowActionPageComponent } from './advanced-workflow-action/advanced-workflow-action-page/advanced-workflow-action-page.component';
|
||||||
import { ItemFromWorkflowResolver } from './item-from-workflow.resolver';
|
import { ItemFromWorkflowResolver } from './item-from-workflow.resolver';
|
||||||
|
import { ItemFromWorkflowBreadcrumbResolver } from './item-from-workflow-breadcrumb.resolver';
|
||||||
import { ThemedWorkflowItemDeleteComponent } from './workflow-item-delete/themed-workflow-item-delete.component';
|
import { ThemedWorkflowItemDeleteComponent } from './workflow-item-delete/themed-workflow-item-delete.component';
|
||||||
import { WorkflowItemPageResolver } from './workflow-item-page.resolver';
|
import { WorkflowItemPageResolver } from './workflow-item-page.resolver';
|
||||||
import { ThemedWorkflowItemSendBackComponent } from './workflow-item-send-back/themed-workflow-item-send-back.component';
|
import { ThemedWorkflowItemSendBackComponent } from './workflow-item-send-back/themed-workflow-item-send-back.component';
|
||||||
@@ -20,7 +21,10 @@ import {
|
|||||||
export const ROUTES: Routes = [
|
export const ROUTES: Routes = [
|
||||||
{
|
{
|
||||||
path: ':id',
|
path: ':id',
|
||||||
resolve: { wfi: WorkflowItemPageResolver },
|
resolve: {
|
||||||
|
breadcrumb: ItemFromWorkflowBreadcrumbResolver,
|
||||||
|
wfi: WorkflowItemPageResolver,
|
||||||
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
canActivate: [AuthenticatedGuard],
|
canActivate: [AuthenticatedGuard],
|
||||||
|
@@ -0,0 +1,25 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Resolve } from '@angular/router';
|
||||||
|
|
||||||
|
import { BreadcrumbConfig } from '../breadcrumbs/breadcrumb/breadcrumb-config.model';
|
||||||
|
import { SubmissionObject } from '../core/submission/models/submission-object.model';
|
||||||
|
import { SubmissionParentBreadcrumbResolver } from '../core/submission/resolver/submission-parent-breadcrumb.resolver';
|
||||||
|
import { SubmissionParentBreadcrumbsService } from '../core/submission/submission-parent-breadcrumb.service';
|
||||||
|
import { WorkspaceitemDataService } from '../core/submission/workspaceitem-data.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class represents a resolver that retrieves the breadcrumbs of the workspace item
|
||||||
|
*/
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root',
|
||||||
|
})
|
||||||
|
export class ItemFromWorkspaceBreadcrumbResolver extends SubmissionParentBreadcrumbResolver implements Resolve<BreadcrumbConfig<SubmissionObject>> {
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
protected dataService: WorkspaceitemDataService,
|
||||||
|
protected breadcrumbService: SubmissionParentBreadcrumbsService,
|
||||||
|
) {
|
||||||
|
super(dataService, breadcrumbService);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -20,7 +20,7 @@ describe('ItemFromWorkspaceResolver', () => {
|
|||||||
wfiService = {
|
wfiService = {
|
||||||
findById: (id: string) => createSuccessfulRemoteDataObject$(wfi),
|
findById: (id: string) => createSuccessfulRemoteDataObject$(wfi),
|
||||||
} as any;
|
} 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) => {
|
it('should resolve a an item from from the workflow item with the correct id', (done) => {
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Resolve } from '@angular/router';
|
import { Resolve } from '@angular/router';
|
||||||
import { Store } from '@ngrx/store';
|
|
||||||
|
|
||||||
import { RemoteData } from '../core/data/remote-data';
|
import { RemoteData } from '../core/data/remote-data';
|
||||||
import { Item } from '../core/shared/item.model';
|
import { Item } from '../core/shared/item.model';
|
||||||
@@ -11,12 +10,12 @@ import { WorkspaceitemDataService } from '../core/submission/workspaceitem-data.
|
|||||||
* This class represents a resolver that requests a specific item before the route is activated
|
* This class represents a resolver that requests a specific item before the route is activated
|
||||||
*/
|
*/
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class ItemFromWorkspaceResolver extends SubmissionObjectResolver<Item> implements Resolve<RemoteData<Item>> {
|
export class ItemFromWorkspaceResolver extends SubmissionObjectResolver<Item> implements Resolve<RemoteData<Item>> {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private workspaceItemService: WorkspaceitemDataService,
|
protected dataService: WorkspaceitemDataService,
|
||||||
protected store: Store<any>,
|
|
||||||
) {
|
) {
|
||||||
super(workspaceItemService, store);
|
super(dataService);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -5,6 +5,7 @@ import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.reso
|
|||||||
import { ThemedFullItemPageComponent } from '../item-page/full/themed-full-item-page.component';
|
import { ThemedFullItemPageComponent } from '../item-page/full/themed-full-item-page.component';
|
||||||
import { ThemedSubmissionEditComponent } from '../submission/edit/themed-submission-edit.component';
|
import { ThemedSubmissionEditComponent } from '../submission/edit/themed-submission-edit.component';
|
||||||
import { ItemFromWorkspaceResolver } from './item-from-workspace.resolver';
|
import { ItemFromWorkspaceResolver } from './item-from-workspace.resolver';
|
||||||
|
import { ItemFromWorkspaceBreadcrumbResolver } from './item-from-workspace-breadcrumb.resolver';
|
||||||
import { WorkspaceItemPageResolver } from './workspace-item-page.resolver';
|
import { WorkspaceItemPageResolver } from './workspace-item-page.resolver';
|
||||||
import { ThemedWorkspaceItemsDeletePageComponent } from './workspaceitems-delete-page/themed-workspaceitems-delete-page.component';
|
import { ThemedWorkspaceItemsDeletePageComponent } from './workspaceitems-delete-page/themed-workspaceitems-delete-page.component';
|
||||||
import { WorkspaceItemsDeletePageComponent } from './workspaceitems-delete-page/workspaceitems-delete-page.component';
|
import { WorkspaceItemsDeletePageComponent } from './workspaceitems-delete-page/workspaceitems-delete-page.component';
|
||||||
@@ -16,7 +17,10 @@ export const ROUTES: Route[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ':id',
|
path: ':id',
|
||||||
resolve: { wsi: WorkspaceItemPageResolver },
|
resolve: {
|
||||||
|
breadcrumb: ItemFromWorkspaceBreadcrumbResolver,
|
||||||
|
wsi: WorkspaceItemPageResolver,
|
||||||
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
canActivate: [AuthenticatedGuard],
|
canActivate: [AuthenticatedGuard],
|
||||||
|
@@ -1108,6 +1108,8 @@
|
|||||||
|
|
||||||
"claimed-declined-task-search-result-list-element.title": "Declined, sent back to Review Manager's workflow",
|
"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.browse.logo": "Browse for a collection logo",
|
||||||
|
|
||||||
"collection.create.head": "Create a Collection",
|
"collection.create.head": "Create a Collection",
|
||||||
@@ -1398,6 +1400,8 @@
|
|||||||
|
|
||||||
"community.subcoms-cols.breadcrumbs": "Subcommunities and Collections",
|
"community.subcoms-cols.breadcrumbs": "Subcommunities and Collections",
|
||||||
|
|
||||||
|
"community.create.breadcrumbs": "Create Community",
|
||||||
|
|
||||||
"community.create.head": "Create a Community",
|
"community.create.head": "Create a Community",
|
||||||
|
|
||||||
"community.create.notifications.success": "Successfully created the Community",
|
"community.create.notifications.success": "Successfully created the Community",
|
||||||
|
Reference in New Issue
Block a user