-
Notifications
You must be signed in to change notification settings - Fork 418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Item-Collection mapper #348
Merged
Merged
Changes from 105 commits
Commits
Show all changes
104 commits
Select commit
Hold shift + click to select a range
6b986c8
55693: Item mapper page + ItemSelectComponent
Atmire-Kristof 315b6a9
55693: Intermediate commit
Atmire-Kristof 3dc0906
55693: Tabset
Atmire-Kristof 9440401
55693: Fixed scope being passed between tabs
Atmire-Kristof 5040d23
55693: (incomplete) store interraction for selecting items
Atmire-Kristof 09a84ed
55693: Working store interaction for selecting items
Atmire-Kristof ce134bb
55693: emit only once and reset selected items + notification
Atmire-Kristof 4731da8
55693: Intermediate Commit
Atmire-Kristof 6f64b94
Merge branch 'Authentication-issue-fix' into w2p-55693_Item-mapping-t…
Atmire-Kristof 7b74d9c
55693: Notifications on success/failure and small refactoring
Atmire-Kristof ba8be3f
55693: Temporary pagination fix (remove url params on tab change)
Atmire-Kristof 0a8a6bb
55693: Messages improvement
Atmire-Kristof e1c734e
55693: CollectionItemMapperComponent test intermediate
Atmire-Kristof 44caed8
Merge branch 'master' into w2p-55693_Item-mapping-to-collections
Atmire-Kristof 95b4635
55693: CollectionItemMapperComponent tests
Atmire-Kristof c3add84
55693: ItemSelectComponent tests intermediate + ItemSelectServiceStub
Atmire-Kristof 8b99ea4
ItemSelectComponent tests
Atmire-Kristof 7934b87
55693: ItemSelectService tests
Atmire-Kristof 199e6c7
55693: Empty ItemSelectReducer test file
Atmire-Kristof 5f56d59
55693: ItemSelectReducer tests
Atmire-Kristof 24f6f98
55693: Authentication Guard and TSDocs
Atmire-Kristof ba4d286
55946: Start of Edit Item Page
Atmire-Kristof 3a809cc
55946: Finished edit-item-page and start of collection mapper
Atmire-Kristof 6bc4d06
55946: Intermediate commit
Atmire-Kristof c25340f
erge branch 'w2p-55946_Item-mapping-on-item-level-old' into w2p-55946…
Atmire-Kristof 7021527
55946: Fixed api calls for fetching collections with/without item
Atmire-Kristof c4203f2
55946: Refactored item-select to object-select to allow for easier im…
Atmire-Kristof 0b3b5d3
55946: Refactoring of object-select and collection-select component
Atmire-Kristof 0cf91fb
55946: Removal of unnecessary scss files and test fixes
Atmire-Kristof dd38e61
55946: Functional item-collection-mapper
Atmire-Kristof 378fbe8
55946: Functionality for removing mappings
Atmire-Kristof 497f089
55946: Improvement on mapping by excluding already existing mapped co…
Atmire-Kristof 8f0d7b6
55946: ItemCollectionMapperComponent tests
Atmire-Kristof fc96700
55946: Fixed search query not working
Atmire-Kristof 3d9e4a6
55693: Mapped items using new REST endpoint + item-select component
Atmire-Kristof dd36913
55693: Functionality for removing mappings
Atmire-Kristof 9902209
55946: Small import fix
Atmire-Kristof 0d89eb6
55693: TODO location query
Atmire-Kristof 7bd8fae
55693: Fixed getMappedItems to use object cache instead of response
Atmire-Kristof 2a4eebc
Merge branch 'w2p-55693_Item-mapping-to-collections' into w2p-55946_I…
Atmire-Kristof 469b424
55693: Map tab excludes already mapped items
Atmire-Kristof 31fe5ef
Merge branch 'w2p-55693_Item-mapping-to-collections' into w2p-55946_I…
Atmire-Kristof e61467b
55693: JSDocs and Test fixes
Atmire-Kristof 512b678
Merge branch 'w2p-55693_Item-mapping-to-collections' into w2p-55946_I…
Atmire-Kristof b11a168
55946: CollectionItemMapper test fixes after merge
Atmire-Kristof 0806315
55946: object-select store lists intermediate commit
Atmire-Kristof 8d396f3
55946: Multi-list object select support
Atmire-Kristof 904ee2c
55693: Search box inside Map tab
Atmire-Kristof 1c013bc
Merge branch 'w2p-55693_Item-mapping-to-collections' into w2p-55946_I…
Atmire-Kristof 3e75bc5
55946: Search box inside Map tab on item-level
Atmire-Kristof 44d18d2
55946: Exclude already mapped collections from Map tab
Atmire-Kristof 7f0e798
Merge branch 'response-cache-refactoring' into w2p-55946_Item-mapping…
Atmire-Kristof aa172b6
55946: Changes to comply to the new response cache features
Atmire-Kristof e275fe5
55946: Remove href-to-uuid index cache on mapping
Atmire-Kristof 4307cb0
55946: Clear data/request attached to the hrefs deleted from index
Atmire-Kristof 55e37a6
55946: discovery requests reset and reload and list updates
Atmire-Kristof 2053078
55946: Dynamic reloading of item mapper on item-level
Atmire-Kristof 930af49
55946: Fixed tests and added JSDocs
Atmire-Kristof 32db97e
55946: Spec file fixes
Atmire-Kristof 791325f
55946: TSLint fixes
Atmire-Kristof 0193893
Merge branch 'response-cache-refactoring' into w2p-55946_Item-mapping…
Atmire-Kristof 8bbc89d
Merge branch 'response-cache-refactoring' into w2p-55946_Item-mapping…
Atmire-Kristof c242ba0
Merge branch 'response-cache-refactoring' into w2p-55946_Item-mapping…
Atmire-Kristof 90b4a0b
55946: Fixed imports and declarations on ItemCollectionMapperComponen…
Atmire-Kristof 1f19324
55946: fdescribe to describe
Atmire-Kristof f2bfdbc
55946: Prevent list update from calling mapper over and over
Atmire-Kristof 69f4846
55946: Removed console log
Atmire-Kristof 13c1a55
55946: Remove TODOs (fixed)
Atmire-Kristof 6e7024e
Merge branch 'master' into w2p-55946_Item-mapping-on-item-level
Atmire-Kristof aeba5d6
55946: Destroy on hide to prevent pagination issues
Atmire-Kristof eb7b4cb
55946: Destroy on hide to prevent pagination issues 2
Atmire-Kristof 532cd4d
Merge branch 'master' into w2p-55946_Item-mapping-on-item-level
Atmire-Kristof 0b164b3
remove unused 'first' imports
artlowel 04ad79e
remove exportToZip config property that was added accidentally
artlowel ff924ab
fix a typo in a comment
artlowel 47294d3
Merge branch 'master' into Item-Collection_Mapper
Atmire-Kristof 41e14e1
Merge branch 'master' into w2p-62589_Item-mapper-update
Atmire-Kristof 2b1fd76
62589: Fixed order of imports messing with routes
Atmire-Kristof 045b87c
62589: Post-Merge Tests and error fixes
Atmire-Kristof 28fe62f
62589: Fix mappedCollections endpoint
Atmire-Kristof df730ef
62589: Provider and POST item-collection mapping fix
Atmire-Kristof acf83f6
62589: Test provider fix
Atmire-Kristof 3868b0a
Merge branch 'master' into w2p-62589_Item-mapper-update
Atmire-Kristof cc389e1
Merge branch 'master' into w2p-62589_Item-mapper-update
Atmire-Kristof 2f0a5a4
Merge branch 'master' into w2p-62589_Item-mapper-update
Atmire-Kristof 26e2506
62589: PR Feedback
Atmire-Kristof c95fa8f
62589: Refactoring mapping endpoint and methods to mapped + collectio…
Atmire-Kristof 04f57b7
Merge branch 'master' into w2p-62589_Item-mapper-update
Atmire-Kristof 7fe0db7
Merge branch 'master' into w2p-62589_Item-mapper-update
Atmire-Kristof 02b007a
62589: Exclude owning collection + redirect to first tab after mappin…
Atmire-Kristof 8b5a3ac
Merge branch 'master' of https://git.atmire.com/contributions/dspace-…
Atmire-Kristof 1b0b1d7
62589: Fixed import
Atmire-Kristof 683c19b
Merge remote-tracking branch 'atmire/upgrade-travis-image' into w2p-6…
Atmire-Kristof 4f6c3c0
Merge branch 'master' into w2p-62589_Item-mapper-update
Atmire-Kristof 647bfb4
62589: Import fix
Atmire-Kristof a87dc89
Merge branch 'master' into w2p-62589_Item-mapper-update
Atmire-Kristof f83e31a
Merge remote-tracking branch 'dspace/master' into w2p-62589_Item-mapp…
Atmire-Kristof 145ed34
62589: Feedback improvements and fixes
Atmire-Kristof a2fb8a3
62589: Added tests for more coverage
Atmire-Kristof 3c8e35e
Merge branch 'master' into w2p-62589_Item-mapper-update
Atmire-Kristof b8a466d
62589: Loading components for item and collection select lists
Atmire-Kristof 8652c4b
62589: Fixed test imports
Atmire-Kristof 5b776b6
62589: Review 03-10-2019 Changes and fixes
Atmire-Kristof f7bd30c
62589: Item-Mapper Requests responseMsToLive to 10s
Atmire-Kristof File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-12"> | ||
<h2>{{'collection.item-mapper.head' | translate}}</h2> | ||
<p [innerHTML]="'collection.item-mapper.collection' | translate:{ name: (collectionRD$ | async)?.payload?.name }" id="collection-name"></p> | ||
<p>{{'collection.item-mapper.description' | translate}}</p> | ||
|
||
<ngb-tabset (tabChange)="tabChange($event)" [destroyOnHide]="true"> | ||
<ngb-tab title="{{'collection.item-mapper.tabs.browse' | translate}}"> | ||
<ng-template ngbTabContent> | ||
<div class="mt-2"> | ||
<ds-item-select class="mt-2" | ||
[key]="'browse'" | ||
[dsoRD$]="collectionItemsRD$" | ||
[paginationOptions]="(searchOptions$ | async)?.pagination" | ||
[confirmButton]="'collection.item-mapper.remove'" | ||
[hideCollection]="true" | ||
(confirm)="mapItems($event, true)"></ds-item-select> | ||
</div> | ||
</ng-template> | ||
</ngb-tab> | ||
<ngb-tab title="{{'collection.item-mapper.tabs.map' | translate}}"> | ||
<ng-template ngbTabContent> | ||
<div class="row mt-2"> | ||
<div class="col-12 col-lg-6"> | ||
<ds-search-form id="search-form" | ||
[query]="(searchOptions$ | async)?.query" | ||
[scope]="(searchOptions$ | async)?.scope" | ||
[currentUrl]="getCurrentUrl()"> | ||
</ds-search-form> | ||
</div> | ||
</div> | ||
|
||
<div> | ||
<ds-item-select class="mt-2" | ||
[key]="'map'" | ||
[dsoRD$]="mappingItemsRD$" | ||
[paginationOptions]="(searchOptions$ | async)?.pagination" | ||
[confirmButton]="'collection.item-mapper.confirm'" | ||
(confirm)="mapItems($event)"></ds-item-select> | ||
</div> | ||
</ng-template> | ||
</ngb-tab> | ||
</ngb-tabset> | ||
|
||
<button [routerLink]="['/collections/', (collectionRD$ | async)?.payload?.id]" class="btn btn-outline-secondary">{{'collection.item-mapper.return' | translate}}</button> | ||
</div> | ||
</div> | ||
</div> |
1 change: 1 addition & 0 deletions
1
src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@import '../../../styles/variables.scss'; |
156 changes: 156 additions & 0 deletions
156
src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
import { CollectionItemMapperComponent } from './collection-item-mapper.component'; | ||
import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; | ||
import { RouterTestingModule } from '@angular/router/testing'; | ||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; | ||
import { CommonModule } from '@angular/common'; | ||
import { TranslateModule, TranslateService } from '@ngx-translate/core'; | ||
import { SearchFormComponent } from '../../shared/search-form/search-form.component'; | ||
import { SearchPageModule } from '../../+search-page/search-page.module'; | ||
import { ObjectCollectionComponent } from '../../shared/object-collection/object-collection.component'; | ||
import { ActivatedRoute, Router } from '@angular/router'; | ||
import { ActivatedRouteStub } from '../../shared/testing/active-router-stub'; | ||
import { RouterStub } from '../../shared/testing/router-stub'; | ||
import { SearchConfigurationService } from '../../+search-page/search-service/search-configuration.service'; | ||
import { SearchService } from '../../+search-page/search-service/search.service'; | ||
import { SearchServiceStub } from '../../shared/testing/search-service-stub'; | ||
import { NotificationsService } from '../../shared/notifications/notifications.service'; | ||
import { NotificationsServiceStub } from '../../shared/testing/notifications-service-stub'; | ||
import { ItemDataService } from '../../core/data/item-data.service'; | ||
import { FormsModule } from '@angular/forms'; | ||
import { SharedModule } from '../../shared/shared.module'; | ||
import { Collection } from '../../core/shared/collection.model'; | ||
import { RemoteData } from '../../core/data/remote-data'; | ||
import { PaginatedSearchOptions } from '../../+search-page/paginated-search-options.model'; | ||
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model'; | ||
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model'; | ||
import { EventEmitter, NgModule } from '@angular/core'; | ||
import { HostWindowService } from '../../shared/host-window.service'; | ||
import { HostWindowServiceStub } from '../../shared/testing/host-window-service-stub'; | ||
import { By } from '@angular/platform-browser'; | ||
import { PaginatedList } from '../../core/data/paginated-list'; | ||
import { PageInfo } from '../../core/shared/page-info.model'; | ||
import { CollectionDataService } from '../../core/data/collection-data.service'; | ||
import { PaginationComponent } from '../../shared/pagination/pagination.component'; | ||
import { EnumKeysPipe } from '../../shared/utils/enum-keys-pipe'; | ||
import { ItemSelectComponent } from '../../shared/object-select/item-select/item-select.component'; | ||
import { ObjectSelectService } from '../../shared/object-select/object-select.service'; | ||
import { ObjectSelectServiceStub } from '../../shared/testing/object-select-service-stub'; | ||
import { VarDirective } from '../../shared/utils/var.directive'; | ||
import { Observable } from 'rxjs/internal/Observable'; | ||
import { of } from 'rxjs/internal/observable/of'; | ||
import { RestResponse } from '../../core/cache/response.models'; | ||
|
||
describe('CollectionItemMapperComponent', () => { | ||
let comp: CollectionItemMapperComponent; | ||
let fixture: ComponentFixture<CollectionItemMapperComponent>; | ||
|
||
let route: ActivatedRoute; | ||
let router: Router; | ||
let searchConfigService: SearchConfigurationService; | ||
let searchService: SearchService; | ||
let notificationsService: NotificationsService; | ||
let itemDataService: ItemDataService; | ||
|
||
const mockCollection: Collection = Object.assign(new Collection(), { | ||
id: 'ce41d451-97ed-4a9c-94a1-7de34f16a9f4', | ||
name: 'test-collection' | ||
}); | ||
const mockCollectionRD: RemoteData<Collection> = new RemoteData<Collection>(false, false, true, null, mockCollection); | ||
const mockSearchOptions = of(new PaginatedSearchOptions({ | ||
pagination: Object.assign(new PaginationComponentOptions(), { | ||
id: 'search-page-configuration', | ||
pageSize: 10, | ||
currentPage: 1 | ||
}), | ||
sort: new SortOptions('dc.title', SortDirection.ASC), | ||
scope: mockCollection.id | ||
})); | ||
const routerStub = Object.assign(new RouterStub(), { | ||
url: 'http://test.url' | ||
}); | ||
const searchConfigServiceStub = { | ||
paginatedSearchOptions: mockSearchOptions | ||
}; | ||
const itemDataServiceStub = { | ||
mapToCollection: () => of(new RestResponse(true, '200')) | ||
}; | ||
const activatedRouteStub = new ActivatedRouteStub({}, { collection: mockCollectionRD }); | ||
const translateServiceStub = { | ||
get: () => of('test-message of collection ' + mockCollection.name), | ||
onLangChange: new EventEmitter(), | ||
onTranslationChange: new EventEmitter(), | ||
onDefaultLangChange: new EventEmitter() | ||
}; | ||
const emptyList = new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), [])); | ||
const searchServiceStub = Object.assign(new SearchServiceStub(), { | ||
search: () => of(emptyList), | ||
/* tslint:disable:no-empty */ | ||
clearDiscoveryRequests: () => {} | ||
/* tslint:enable:no-empty */ | ||
}); | ||
const collectionDataServiceStub = { | ||
getMappedItems: () => of(emptyList), | ||
/* tslint:disable:no-empty */ | ||
clearMappingItemsRequests: () => {} | ||
/* tslint:enable:no-empty */ | ||
}; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [CommonModule, FormsModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule.forRoot()], | ||
declarations: [CollectionItemMapperComponent, ItemSelectComponent, SearchFormComponent, PaginationComponent, EnumKeysPipe, VarDirective], | ||
providers: [ | ||
{ provide: ActivatedRoute, useValue: activatedRouteStub }, | ||
{ provide: Router, useValue: routerStub }, | ||
{ provide: SearchConfigurationService, useValue: searchConfigServiceStub }, | ||
{ provide: SearchService, useValue: searchServiceStub }, | ||
{ provide: NotificationsService, useValue: new NotificationsServiceStub() }, | ||
{ provide: ItemDataService, useValue: itemDataServiceStub }, | ||
{ provide: CollectionDataService, useValue: collectionDataServiceStub }, | ||
{ provide: TranslateService, useValue: translateServiceStub }, | ||
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) }, | ||
{ provide: ObjectSelectService, useValue: new ObjectSelectServiceStub() } | ||
] | ||
}).compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(CollectionItemMapperComponent); | ||
comp = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
route = (comp as any).route; | ||
router = (comp as any).router; | ||
searchConfigService = (comp as any).searchConfigService; | ||
searchService = (comp as any).searchService; | ||
notificationsService = (comp as any).notificationsService; | ||
itemDataService = (comp as any).itemDataService; | ||
}); | ||
|
||
it('should display the correct collection name', () => { | ||
const name: HTMLElement = fixture.debugElement.query(By.css('#collection-name')).nativeElement; | ||
expect(name.innerHTML).toContain(mockCollection.name); | ||
}); | ||
|
||
describe('mapItems', () => { | ||
const ids = ['id1', 'id2', 'id3', 'id4']; | ||
|
||
beforeEach(() => { | ||
spyOn(notificationsService, 'success').and.callThrough(); | ||
spyOn(notificationsService, 'error').and.callThrough(); | ||
}); | ||
|
||
it('should display a success message if at least one mapping was successful', () => { | ||
comp.mapItems(ids); | ||
expect(notificationsService.success).toHaveBeenCalled(); | ||
expect(notificationsService.error).not.toHaveBeenCalled(); | ||
}); | ||
|
||
it('should display an error message if at least one mapping was unsuccessful', () => { | ||
spyOn(itemDataService, 'mapToCollection').and.returnValue(of(new RestResponse(false, '404'))); | ||
comp.mapItems(ids); | ||
expect(notificationsService.success).not.toHaveBeenCalled(); | ||
expect(notificationsService.error).toHaveBeenCalled(); | ||
}); | ||
}); | ||
|
||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unclear to me what these new settings in
environment.default.js
are for. Are these an unrelated change, or maybe local configuration?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR includes the same response cache refactor @LotteHofstede's #349 PR is based on. It adds the ability to cache certain responses for different lengths of time. (e.g. you may want to cache most responses for 15 minutes, but for certain admin features you may want to disable the cache, or cache it a very short time) However the exportToZip config is something that snuck in from an unrelated branch i.e. the export to zip feature that is on hold atm waiting for the scripts and processes work on the REST side. We'll remove it