From 97ce951bd8bd06c519670acbc81ae63cd47d3368 Mon Sep 17 00:00:00 2001 From: jonas-atmire Date: Wed, 5 Aug 2020 11:01:56 +0200 Subject: [PATCH 01/13] FollowLink addition to bitstream/bundle models --- src/app/+bitstream-page/bitstream-page.resolver.ts | 13 ++++++++++++- src/app/core/shared/bitstream.model.ts | 8 ++++++++ src/app/core/shared/bundle.model.ts | 10 ++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/app/+bitstream-page/bitstream-page.resolver.ts b/src/app/+bitstream-page/bitstream-page.resolver.ts index 8e9f64fcc1..74cf54fb3a 100644 --- a/src/app/+bitstream-page/bitstream-page.resolver.ts +++ b/src/app/+bitstream-page/bitstream-page.resolver.ts @@ -6,6 +6,7 @@ import { find } from 'rxjs/operators'; import { hasValue } from '../shared/empty.util'; import { Bitstream } from '../core/shared/bitstream.model'; import { BitstreamDataService } from '../core/data/bitstream-data.service'; +import {followLink, FollowLinkConfig} from "../shared/utils/follow-link-config.model"; /** * This class represents a resolver that requests a specific bitstream before the route is activated @@ -23,9 +24,19 @@ export class BitstreamPageResolver implements Resolve> { * or an error if something went wrong */ resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable> { - return this.bitstreamService.findById(route.params.id) + return this.bitstreamService.findById(route.params.id, ...this.followLinks) .pipe( find((RD) => hasValue(RD.error) || RD.hasSucceeded), ); } + /** + * 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(): Array> { + return [ + followLink('bundle', undefined, true, followLink('item')) + ]; + } } diff --git a/src/app/core/shared/bitstream.model.ts b/src/app/core/shared/bitstream.model.ts index ab9d1548b7..314818b482 100644 --- a/src/app/core/shared/bitstream.model.ts +++ b/src/app/core/shared/bitstream.model.ts @@ -8,6 +8,8 @@ import { BITSTREAM } from './bitstream.resource-type'; import { DSpaceObject } from './dspace-object.model'; import { HALLink } from './hal-link.model'; import { HALResource } from './hal-resource.model'; +import {BUNDLE} from './bundle.resource-type'; +import {Bundle} from './bundle.model'; @typedObject @inheritSerialization(DSpaceObject) @@ -57,4 +59,10 @@ export class Bitstream extends DSpaceObject implements HALResource { @link(BITSTREAM_FORMAT, false, 'format') format?: Observable>; + /** + * The owning bundle for this Bitstream + * Will be undefined unless the bundle{@link HALLink} has been resolved. + */ + @link(BUNDLE) + bundle?: Observable>; } diff --git a/src/app/core/shared/bundle.model.ts b/src/app/core/shared/bundle.model.ts index 1e5c14d486..c84b1f691f 100644 --- a/src/app/core/shared/bundle.model.ts +++ b/src/app/core/shared/bundle.model.ts @@ -10,6 +10,8 @@ import { RemoteData } from '../data/remote-data'; import { PaginatedList } from '../data/paginated-list'; import { BITSTREAM } from './bitstream.resource-type'; import { Bitstream } from './bitstream.model'; +import {ITEM} from './item.resource-type'; +import {Item} from './item.model'; @typedObject @inheritSerialization(DSpaceObject) @@ -24,6 +26,7 @@ export class Bundle extends DSpaceObject { self: HALLink; primaryBitstream: HALLink; bitstreams: HALLink; + item: HALLink; }; /** @@ -39,4 +42,11 @@ export class Bundle extends DSpaceObject { */ @link(BITSTREAM, true) bitstreams?: Observable>>; + + /** + * The owning item for this Bundle + * Will be undefined unless the Item{@link HALLink} has been resolved. + */ + @link(ITEM) + item?: Observable>; } From 82587b5ff841ae8571bcbe650675da23ac6b0997 Mon Sep 17 00:00:00 2001 From: jonas-atmire Date: Wed, 5 Aug 2020 11:14:21 +0200 Subject: [PATCH 02/13] Move followLink for format to bitstream-page.resolver --- src/app/+bitstream-page/bitstream-page.resolver.ts | 3 ++- .../edit-bitstream-page/edit-bitstream-page.component.ts | 7 +------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/app/+bitstream-page/bitstream-page.resolver.ts b/src/app/+bitstream-page/bitstream-page.resolver.ts index 74cf54fb3a..a47183e049 100644 --- a/src/app/+bitstream-page/bitstream-page.resolver.ts +++ b/src/app/+bitstream-page/bitstream-page.resolver.ts @@ -36,7 +36,8 @@ export class BitstreamPageResolver implements Resolve> { */ get followLinks(): Array> { return [ - followLink('bundle', undefined, true, followLink('item')) + followLink('bundle', undefined, true, followLink('item')), + followLink('format') ]; } } diff --git a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts index cce6932cd1..66569dd363 100644 --- a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts +++ b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts @@ -299,12 +299,7 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy { const bitstream$ = this.bitstreamRD$.pipe( getSucceededRemoteData(), - getRemoteDataPayload(), - switchMap((bitstream: Bitstream) => this.bitstreamService.findById(bitstream.id, followLink('format')).pipe( - getAllSucceededRemoteData(), - getRemoteDataPayload(), - filter((bs: Bitstream) => hasValue(bs))) - ) + getRemoteDataPayload() ); const allFormats$ = this.bitstreamFormatsRD$.pipe( From e78a1ee63e634bb14392eeab1fe0f566a0f719c7 Mon Sep 17 00:00:00 2001 From: jonas-atmire Date: Fri, 7 Aug 2020 09:51:33 +0200 Subject: [PATCH 03/13] Routing back to the item page from bitstream edit --- .../edit-bitstream-page.component.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts index 66569dd363..9e6b0babac 100644 --- a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts +++ b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts @@ -1,7 +1,7 @@ import { ChangeDetectionStrategy, Component, OnDestroy, OnInit } from '@angular/core'; import { Bitstream } from '../../core/shared/bitstream.model'; import { ActivatedRoute, Router } from '@angular/router'; -import { filter, map, switchMap } from 'rxjs/operators'; +import {filter, map, mergeMap, switchMap} from 'rxjs/operators'; import { combineLatest as observableCombineLatest, of as observableOf } from 'rxjs'; import { Subscription } from 'rxjs/internal/Subscription'; import { @@ -36,7 +36,9 @@ import { Observable } from 'rxjs/internal/Observable'; import { RemoteData } from '../../core/data/remote-data'; import { PaginatedList } from '../../core/data/paginated-list'; import { followLink } from '../../shared/utils/follow-link-config.model'; -import { getItemEditPath } from '../../+item-page/item-page-routing.module'; +import {getItemEditPath, getItemPageRoute} from '../../+item-page/item-page-routing.module'; +import {Bundle} from "../../core/shared/bundle.model"; +import {Item} from "../../core/shared/item.model"; @Component({ selector: 'ds-edit-bitstream-page', @@ -503,7 +505,11 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy { if (hasValue(this.itemId)) { this.router.navigate([getItemEditPath(this.itemId), 'bitstreams']); } else { - this.location.back(); + this.bitstream.bundle.pipe(getFirstSucceededRemoteDataPayload(), + mergeMap((bundle: Bundle) => bundle.item.pipe(getFirstSucceededRemoteDataPayload(), map((item: Item) => item.uuid)))) + .subscribe((item) => { + this.router.navigate(([getItemPageRoute(item)])); + }); } } From 11d81d8afc82f4a230ed4c877eac178e7421ac96 Mon Sep 17 00:00:00 2001 From: jonas-atmire Date: Fri, 21 Aug 2020 09:30:06 +0200 Subject: [PATCH 04/13] Initial tests added (Still failing) --- .../edit-bitstream-page.component.spec.ts | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts index c802622dc4..4ed733d7d6 100644 --- a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts +++ b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts @@ -4,7 +4,7 @@ import { TranslateModule } from '@ngx-translate/core'; import { RouterTestingModule } from '@angular/router/testing'; import { RemoteData } from '../../core/data/remote-data'; import { of as observableOf } from 'rxjs/internal/observable/of'; -import { ActivatedRoute } from '@angular/router'; +import {ActivatedRoute, Router} from '@angular/router'; import { DynamicFormControlModel, DynamicFormService } from '@ng-dynamic-forms/core'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { BitstreamDataService } from '../../core/data/bitstream-data.service'; @@ -22,6 +22,12 @@ import { PageInfo } from '../../core/shared/page-info.model'; import { FileSizePipe } from '../../shared/utils/file-size-pipe'; import { RestResponse } from '../../core/cache/response.models'; import { VarDirective } from '../../shared/utils/var.directive'; +import { + createFailedRemoteDataObject$, + createSuccessfulRemoteDataObject$ +} from "../../shared/remote-data.utils"; +import {getItemPageRoute} from "../../+item-page/item-page-routing.module"; +import {RouterStub} from "../../shared/testing/router.stub"; const infoNotification: INotification = new Notification('id', NotificationType.Info, 'info'); const warningNotification: INotification = new Notification('id', NotificationType.Warning, 'warning'); @@ -34,6 +40,8 @@ let bitstreamFormatService: BitstreamFormatDataService; let bitstream: Bitstream; let selectedFormat: BitstreamFormat; let allFormats: BitstreamFormat[]; +let router: Router; +let routerStub; describe('EditBitstreamPageComponent', () => { let comp: EditBitstreamPageComponent; @@ -105,7 +113,12 @@ describe('EditBitstreamPageComponent', () => { format: observableOf(new RemoteData(false, false, true, null, selectedFormat)), _links: { self: 'bitstream-selflink' - } + }, + bundle: createFailedRemoteDataObject$({ + item: createSuccessfulRemoteDataObject$({ + uuid: 'some-uuid' + }) + }) }); bitstreamService = jasmine.createSpyObj('bitstreamService', { findById: observableOf(new RemoteData(false, false, true, null, bitstream)), @@ -118,6 +131,10 @@ describe('EditBitstreamPageComponent', () => { findAll: observableOf(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), allFormats))) }); + const itemPageUrl = `fake-url/some-uuid`; + routerStub = Object.assign(new RouterStub(), { + url: `${itemPageUrl}` + }); TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), RouterTestingModule], declarations: [EditBitstreamPageComponent, FileSizePipe, VarDirective], @@ -127,6 +144,7 @@ describe('EditBitstreamPageComponent', () => { { provide: ActivatedRoute, useValue: { data: observableOf({ bitstream: new RemoteData(false, false, true, null, bitstream) }), snapshot: { queryParams: {} } } }, { provide: BitstreamDataService, useValue: bitstreamService }, { provide: BitstreamFormatDataService, useValue: bitstreamFormatService }, + { provide: Router, useValue: routerStub }, ChangeDetectorRef ], schemas: [NO_ERRORS_SCHEMA] @@ -138,6 +156,7 @@ describe('EditBitstreamPageComponent', () => { fixture = TestBed.createComponent(EditBitstreamPageComponent); comp = fixture.componentInstance; fixture.detectChanges(); + router = (comp as any).router; }); describe('on startup', () => { @@ -213,4 +232,11 @@ describe('EditBitstreamPageComponent', () => { }); }); }); + describe('when the cancel button is clicked', () => { + it('should redirect to the item page', () => { + comp.onCancel(); + spyOn(routerStub, 'navigate'); + expect(routerStub.navigate).toHaveBeenCalledWith([getItemPageRoute('some-uuid')]); + }); + }); }); From 95de75dbf924b84a904bd837351a3f0012329357 Mon Sep 17 00:00:00 2001 From: jonas-atmire Date: Fri, 21 Aug 2020 11:28:16 +0200 Subject: [PATCH 05/13] Failing test fixing + additional tests for the call that handles the actual navigation routing --- .../edit-bitstream-page.component.spec.ts | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts index 4ed733d7d6..722b7c8833 100644 --- a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts +++ b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts @@ -23,11 +23,10 @@ import { FileSizePipe } from '../../shared/utils/file-size-pipe'; import { RestResponse } from '../../core/cache/response.models'; import { VarDirective } from '../../shared/utils/var.directive'; import { - createFailedRemoteDataObject$, createSuccessfulRemoteDataObject$ } from "../../shared/remote-data.utils"; -import {getItemPageRoute} from "../../+item-page/item-page-routing.module"; import {RouterStub} from "../../shared/testing/router.stub"; +import {getItemEditPath, getItemPageRoute} from "../../+item-page/item-page-routing.module"; const infoNotification: INotification = new Notification('id', NotificationType.Info, 'info'); const warningNotification: INotification = new Notification('id', NotificationType.Warning, 'warning'); @@ -114,7 +113,7 @@ describe('EditBitstreamPageComponent', () => { _links: { self: 'bitstream-selflink' }, - bundle: createFailedRemoteDataObject$({ + bundle: createSuccessfulRemoteDataObject$({ item: createSuccessfulRemoteDataObject$({ uuid: 'some-uuid' }) @@ -233,9 +232,23 @@ describe('EditBitstreamPageComponent', () => { }); }); describe('when the cancel button is clicked', () => { - it('should redirect to the item page', () => { + it('should call navigateToItemEditBitstreams method', () => { + spyOn(comp, 'navigateToItemEditBitstreams'); comp.onCancel(); - spyOn(routerStub, 'navigate'); + expect(comp.navigateToItemEditBitstreams).toHaveBeenCalled(); + }); + }); + describe('when navigateToItemEditBitstreams is called, and the component has an itemId', () => { + it('should redirect to the item edit path bitstream page', () => { + comp.itemId = 'some-uuid' + comp.navigateToItemEditBitstreams(); + expect(routerStub.navigate).toHaveBeenCalledWith([getItemEditPath('some-uuid'), 'bitstreams']); + }); + }); + describe('when navigateToItemEditBitstreams is called, and the component does not have an itemId', () => { + it('should redirect to the item page', () => { + comp.itemId = undefined; + comp.navigateToItemEditBitstreams(); expect(routerStub.navigate).toHaveBeenCalledWith([getItemPageRoute('some-uuid')]); }); }); From dddf8df2b2fbb068c954571dfeb25a00406d21b2 Mon Sep 17 00:00:00 2001 From: jonas-atmire Date: Fri, 25 Sep 2020 11:38:11 +0200 Subject: [PATCH 06/13] Merge conflict fixes --- .../edit-bitstream-page/edit-bitstream-page.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts index 6f0a60c554..7f002478fe 100644 --- a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts +++ b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts @@ -16,6 +16,7 @@ import { import { FormGroup } from '@angular/forms'; import { TranslateService } from '@ngx-translate/core'; import { DynamicCustomSwitchModel } from '../../shared/form/builder/ds-dynamic-form-ui/models/custom-switch/custom-switch.model'; +import { cloneDeep } from 'lodash'; import { BitstreamDataService } from '../../core/data/bitstream-data.service'; import { getAllSucceededRemoteDataPayload, @@ -34,8 +35,7 @@ import { Location } from '@angular/common'; import { Observable } from 'rxjs/internal/Observable'; import { RemoteData } from '../../core/data/remote-data'; import { PaginatedList } from '../../core/data/paginated-list'; -import {getItemEditPath, getItemPageRoute} from '../../+item-page/item-page-routing.module'; -import { getItemEditRoute } from '../../+item-page/item-page-routing-paths'; +import { getItemEditRoute, getItemPageRoute } from '../../+item-page/item-page-routing-paths'; import {Bundle} from '../../core/shared/bundle.model'; import {Item} from '../../core/shared/item.model'; From 988079caed77eaf1eb4aa29e766336fd37d87ce2 Mon Sep 17 00:00:00 2001 From: jonas-atmire Date: Wed, 30 Sep 2020 12:34:03 +0200 Subject: [PATCH 07/13] Merge conflict fixes --- .../edit-bitstream-page.component.spec.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts index 722b7c8833..d7349894a9 100644 --- a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts +++ b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts @@ -24,9 +24,9 @@ import { RestResponse } from '../../core/cache/response.models'; import { VarDirective } from '../../shared/utils/var.directive'; import { createSuccessfulRemoteDataObject$ -} from "../../shared/remote-data.utils"; -import {RouterStub} from "../../shared/testing/router.stub"; -import {getItemEditPath, getItemPageRoute} from "../../+item-page/item-page-routing.module"; +} from '../../shared/remote-data.utils'; +import {RouterStub} from '../../shared/testing/router.stub'; +import { getItemEditRoute, getItemPageRoute } from '../../+item-page/item-page-routing-paths'; const infoNotification: INotification = new Notification('id', NotificationType.Info, 'info'); const warningNotification: INotification = new Notification('id', NotificationType.Warning, 'warning'); @@ -242,7 +242,7 @@ describe('EditBitstreamPageComponent', () => { it('should redirect to the item edit path bitstream page', () => { comp.itemId = 'some-uuid' comp.navigateToItemEditBitstreams(); - expect(routerStub.navigate).toHaveBeenCalledWith([getItemEditPath('some-uuid'), 'bitstreams']); + expect(routerStub.navigate).toHaveBeenCalledWith([getItemEditRoute('some-uuid'), 'bitstreams']); }); }); describe('when navigateToItemEditBitstreams is called, and the component does not have an itemId', () => { From aa757cfe231dc62552c8903cff1856549a639362 Mon Sep 17 00:00:00 2001 From: jonas-atmire Date: Wed, 30 Sep 2020 13:04:34 +0200 Subject: [PATCH 08/13] Redirecting to item edit page on the bitstream tab, instead of the item viewing page --- .../edit-bitstream-page.component.spec.ts | 18 +++++++++--------- .../edit-bitstream-page.component.ts | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts index d7349894a9..d35f2d5c21 100644 --- a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts +++ b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts @@ -239,17 +239,17 @@ describe('EditBitstreamPageComponent', () => { }); }); describe('when navigateToItemEditBitstreams is called, and the component has an itemId', () => { - it('should redirect to the item edit path bitstream page', () => { - comp.itemId = 'some-uuid' + it('should redirect to the item edit page on the bitstreams tab with the itemId from the component', () => { + comp.itemId = 'some-uuid1' + comp.navigateToItemEditBitstreams(); + expect(routerStub.navigate).toHaveBeenCalledWith([getItemEditRoute('some-uuid1'), 'bitstreams']); + }); + }); + describe('when navigateToItemEditBitstreams is called, and the component does not have an itemId', () => { + it('should redirect to the item edit page on the bitstreams tab with the itemId from the bundle links ', () => { + comp.itemId = undefined; comp.navigateToItemEditBitstreams(); expect(routerStub.navigate).toHaveBeenCalledWith([getItemEditRoute('some-uuid'), 'bitstreams']); }); }); - describe('when navigateToItemEditBitstreams is called, and the component does not have an itemId', () => { - it('should redirect to the item page', () => { - comp.itemId = undefined; - comp.navigateToItemEditBitstreams(); - expect(routerStub.navigate).toHaveBeenCalledWith([getItemPageRoute('some-uuid')]); - }); - }); }); diff --git a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts index 7f002478fe..a8bb321087 100644 --- a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts +++ b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts @@ -507,7 +507,7 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy { this.bitstream.bundle.pipe(getFirstSucceededRemoteDataPayload(), mergeMap((bundle: Bundle) => bundle.item.pipe(getFirstSucceededRemoteDataPayload(), map((item: Item) => item.uuid)))) .subscribe((item) => { - this.router.navigate(([getItemPageRoute(item)])); + this.router.navigate(([getItemEditRoute(item), 'bitstreams'])); }); } } From ce553e3272bd20cc5b92961fa29ccced0b66542f Mon Sep 17 00:00:00 2001 From: jonas-atmire Date: Thu, 1 Oct 2020 09:09:05 +0200 Subject: [PATCH 09/13] Fixing lint error(s) --- src/app/+bitstream-page/bitstream-page.resolver.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/+bitstream-page/bitstream-page.resolver.ts b/src/app/+bitstream-page/bitstream-page.resolver.ts index a47183e049..9c85688c39 100644 --- a/src/app/+bitstream-page/bitstream-page.resolver.ts +++ b/src/app/+bitstream-page/bitstream-page.resolver.ts @@ -6,7 +6,7 @@ import { find } from 'rxjs/operators'; import { hasValue } from '../shared/empty.util'; import { Bitstream } from '../core/shared/bitstream.model'; 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'; /** * This class represents a resolver that requests a specific bitstream before the route is activated From a45bc349cc81760eb19f20228c2929ec52b56da7 Mon Sep 17 00:00:00 2001 From: jonas-atmire Date: Thu, 1 Oct 2020 09:11:25 +0200 Subject: [PATCH 10/13] Small doc update --- .../edit-bitstream-page/edit-bitstream-page.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts index a8bb321087..cd4e47cd18 100644 --- a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts +++ b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts @@ -497,8 +497,8 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy { } /** - * When the item ID is present, navigate back to the item's edit bitstreams page, otherwise go back to the previous - * page the user came from + * When the item ID is present, navigate back to the item's edit bitstreams page, + * otherwise retrieve the item ID based on the owning bundle's link */ navigateToItemEditBitstreams() { if (hasValue(this.itemId)) { From be2bfbe066f8c4035b5ddf6951b5d2f5b84de557 Mon Sep 17 00:00:00 2001 From: jonas-atmire Date: Thu, 1 Oct 2020 09:33:38 +0200 Subject: [PATCH 11/13] Fixing LGTM - Unused imports --- .../edit-bitstream-page/edit-bitstream-page.component.spec.ts | 2 +- .../edit-bitstream-page/edit-bitstream-page.component.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts index d35f2d5c21..ce46c2a7b3 100644 --- a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts +++ b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts @@ -26,7 +26,7 @@ import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils'; import {RouterStub} from '../../shared/testing/router.stub'; -import { getItemEditRoute, getItemPageRoute } from '../../+item-page/item-page-routing-paths'; +import { getItemEditRoute } from '../../+item-page/item-page-routing-paths'; const infoNotification: INotification = new Notification('id', NotificationType.Info, 'info'); const warningNotification: INotification = new Notification('id', NotificationType.Warning, 'warning'); diff --git a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts index cd4e47cd18..ad64739dac 100644 --- a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts +++ b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts @@ -35,7 +35,7 @@ import { Location } from '@angular/common'; import { Observable } from 'rxjs/internal/Observable'; import { RemoteData } from '../../core/data/remote-data'; import { PaginatedList } from '../../core/data/paginated-list'; -import { getItemEditRoute, getItemPageRoute } from '../../+item-page/item-page-routing-paths'; +import { getItemEditRoute } from '../../+item-page/item-page-routing-paths'; import {Bundle} from '../../core/shared/bundle.model'; import {Item} from '../../core/shared/item.model'; From 1dcfb729a827e867f8f0120f2bb223a7cee7b5be Mon Sep 17 00:00:00 2001 From: Art Lowel Date: Wed, 21 Oct 2020 10:23:56 +0200 Subject: [PATCH 12/13] fix issue where item search results would always have a shadow, instead of only when they're focused --- .../search-result-grid-element.component.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/app/shared/object-grid/search-result-grid-element/search-result-grid-element.component.ts b/src/app/shared/object-grid/search-result-grid-element/search-result-grid-element.component.ts index dc05f78e40..c8c413a81b 100644 --- a/src/app/shared/object-grid/search-result-grid-element/search-result-grid-element.component.ts +++ b/src/app/shared/object-grid/search-result-grid-element/search-result-grid-element.component.ts @@ -32,9 +32,6 @@ export class SearchResultGridElementComponent, K exten protected bitstreamDataService: BitstreamDataService ) { super(); - if (hasValue(this.object)) { - this.isCollapsed$ = this.isCollapsed(); - } } /** @@ -43,6 +40,7 @@ export class SearchResultGridElementComponent, K exten ngOnInit(): void { if (hasValue(this.object)) { this.dso = this.object.indexableObject; + this.isCollapsed$ = this.isCollapsed(); } } From c4687116e5c237a5daf4523ccd5835381e9c4399 Mon Sep 17 00:00:00 2001 From: Art Lowel Date: Wed, 21 Oct 2020 11:35:05 +0200 Subject: [PATCH 13/13] add isCollapsed to mock TruncatableService --- ...arch-result-admin-workflow-grid-element.component.spec.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/+admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-grid-element/workflow-item/workflow-item-search-result-admin-workflow-grid-element.component.spec.ts b/src/app/+admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-grid-element/workflow-item/workflow-item-search-result-admin-workflow-grid-element.component.spec.ts index 2f3f88fa70..6436f2d873 100644 --- a/src/app/+admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-grid-element/workflow-item/workflow-item-search-result-admin-workflow-grid-element.component.spec.ts +++ b/src/app/+admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-grid-element/workflow-item/workflow-item-search-result-admin-workflow-grid-element.component.spec.ts @@ -18,6 +18,7 @@ import { WorkflowItemSearchResult } from '../../../../../shared/object-collectio import { BitstreamDataService } from '../../../../../core/data/bitstream-data.service'; import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/remote-data.utils'; import { getMockLinkService } from '../../../../../shared/mocks/link-service.mock'; +import { of as observableOf } from 'rxjs'; describe('WorkflowItemAdminWorkflowGridElementComponent', () => { let component: WorkflowItemSearchResultAdminWorkflowGridElementComponent; @@ -50,7 +51,9 @@ describe('WorkflowItemAdminWorkflowGridElementComponent', () => { ], providers: [ { provide: LinkService, useValue: linkService }, - { provide: TruncatableService, useValue: {} }, + { provide: TruncatableService, useValue: { + isCollapsed: () => observableOf(true), + } }, { provide: BitstreamDataService, useValue: {} }, ], schemas: [NO_ERRORS_SCHEMA]