Skip to content
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

Initial entities PR #315

Merged
merged 97 commits into from Dec 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
06d2ac7
added custom item page fields for Projects, OrgUnits and People
May 28, 2018
26098c6
Throw an error when there are multiple components to render the same …
artlowel May 29, 2018
7db32b2
refactoring
May 29, 2018
5fba750
Merge branch 'pr/271' into entities-w2p-51847
May 29, 2018
e582f56
Merge branch 'pr/271' into entities-w2p-51847
May 29, 2018
4ca8e84
Merge branch 'pr/271' into entities-w2p-51847
May 29, 2018
5149c48
first version of relationships - too resource intensive
May 29, 2018
82977ce
optimized and refactored
artlowel May 30, 2018
f1b3557
refactor
artlowel May 30, 2018
e5fc17d
w2p 51849 - display entities as list results
May 30, 2018
8423261
w2p 51851 - finished relation display on entity pages
May 30, 2018
f50e0ed
52213: Item lists: displayed metadata journal-types
Atmire-Kristof May 31, 2018
c99d05c
52211: Item display regular metadata journal-types
Atmire-Kristof May 31, 2018
34dbc24
52212: Item display relations journal-types
Atmire-Kristof May 31, 2018
1749194
Merge branch 'w2p-52212_Item-display-relations' into 'entities-or2018'
benbosman May 31, 2018
733ca64
fix for entity page changes when going back/forth using browser
LotteHofstede May 31, 2018
691b466
52425: Publication - JournalIssue relation
Atmire-Kristof Jun 1, 2018
9012688
fixed with subject instead of changedetection hack
LotteHofstede Jun 1, 2018
1805c76
Merge branch 'entity-page-change-fix' into entities-or2018
LotteHofstede Jun 1, 2018
01ab627
Merge branch 'w2p-52425_Item-display-publication-journalIssue-relatio…
benbosman Jun 1, 2018
8ab6eb6
item page reload fix
LotteHofstede Jun 1, 2018
971cf0e
Merge branch 'entity-page-change-fix' into entities-or2018
LotteHofstede Jun 1, 2018
f1a8517
clean up after fix
LotteHofstede Jun 1, 2018
e084344
Merge branch 'entity-page-change-fix' into entities-or2018
LotteHofstede Jun 1, 2018
8ea8f11
52935: entity filter messages
LotteHofstede Jun 18, 2018
d4c00db
Fixed typo that broke AoT build
LotteHofstede Jun 18, 2018
bbd64c9
Merge branch 'entities-w2p-51851-add-relationships' into entities-or2018
LotteHofstede Jun 18, 2018
a5d6e63
fixed another typo to fix AoT build..
LotteHofstede Jun 18, 2018
9154076
Merge branch 'entities-w2p-51851-add-relationships' into entities-or2018
LotteHofstede Jun 18, 2018
b06629c
53029: start of filtered discovery pages
LotteHofstede Jun 29, 2018
1231d3e
53029: almost finished filtered discovery pages
LotteHofstede Jul 3, 2018
d06e8d9
small fixes
LotteHofstede Jul 4, 2018
cef2ea8
finished entity search endpoints
LotteHofstede Jul 6, 2018
b68ed37
53029: removed console logs and small bugs
LotteHofstede Jul 6, 2018
132d979
Merge branch 'w2p-53029_filtered-discovery-pages-entities' into 'enti…
benbosman Aug 21, 2018
46daefd
55407: updated home page
LotteHofstede Aug 27, 2018
addea8b
Merge branch 'master' into entities-master
Atmire-Kristof Sep 17, 2018
de2499b
55558: Small conflict fixes - intermediate
Atmire-Kristof Sep 17, 2018
20520ea
55558: Collection-page fix and search reponse parsing fix
Atmire-Kristof Sep 18, 2018
81d8940
55558: Test error fix
Atmire-Kristof Sep 18, 2018
363e145
55558: RouteService tests fix
Atmire-Kristof Sep 18, 2018
66ae2fe
55558: Full item page buttons on all entity type item-pages
Atmire-Kristof Sep 18, 2018
d8ce01b
55647: Intermediate FixedFilter fixes
Atmire-Kristof Sep 18, 2018
8e3e826
55647: FixedFilter fixed
Atmire-Kristof Sep 19, 2018
4af12c2
55647: Related publications on person pages
Atmire-Kristof Sep 19, 2018
278a664
Merge branch 'w2p-55558_Entities-full-item-pages' into entities-master
Atmire-Kristof Sep 20, 2018
41c8577
add missing filterservice to SearchConfigurationService spec
Sep 24, 2018
193d751
55647: Feedback 20/09
Atmire-Kristof Sep 24, 2018
46eb9fa
55725: item page bug fix
LotteHofstede Sep 25, 2018
5067793
removed unnecessary injectable annotation
LotteHofstede Sep 25, 2018
35937a9
Merge branch 'w2p-55647_Related-publications-on-Person-pages' into en…
Sep 25, 2018
796b9b6
Merge branch 'entities-or2018' into entities-master
Atmire-Kristof Oct 3, 2018
3a23b70
Merge branch 'master' into entities-master
Atmire-Kristof Oct 10, 2018
624fe2d
Merge branch 'w2p-55962_hide-metadata-labels-without-value' into enti…
antoine-atmire Oct 10, 2018
651b84b
Merge branch 'master' into entities-master
Atmire-Kristof Oct 19, 2018
26b0758
56434: Fixed existing tests and added entity-list-element component t…
Atmire-Kristof Oct 19, 2018
eab6698
56434: Entity-page-fields component tests
Atmire-Kristof Oct 22, 2018
b8a9fe0
56434: JournalPageFieldsComponent tests
Atmire-Kristof Oct 22, 2018
221e20f
56434: ItemPageFieldComponent tests
Atmire-Kristof Oct 22, 2018
57ba31e
56434: metadata-values component tests
Atmire-Kristof Oct 23, 2018
a66007c
56434: SearchFixedFilterService tests
Atmire-Kristof Oct 23, 2018
7856738
56434: FilteredSearchPageComponent tests
Atmire-Kristof Oct 23, 2018
33eb59a
56434: SearchFilterService added tests
Atmire-Kristof Oct 23, 2018
cc369bf
56434: SearchResultsComponent and SearchConfigurationService test add…
Atmire-Kristof Oct 23, 2018
028a2b5
56434: EntityTypeSwitcherComponent test
Atmire-Kristof Oct 23, 2018
39e1b0f
56434: Docs for all entity-list-element and entity-page-fields compon…
Atmire-Kristof Oct 23, 2018
4d24802
56434: property docs for entity-page-fields components
Atmire-Kristof Oct 24, 2018
e4eee7c
56434: Docs for all item-page-metadata-field, related-entities, item-…
Atmire-Kristof Oct 24, 2018
29e60f2
56434: docs for search-filter, search-fixed-filter and search-configu…
Atmire-Kristof Oct 24, 2018
7914e1c
56434: docs for entity-type-switcher
Atmire-Kristof Oct 24, 2018
c1eab40
add support for paginated properties on dspace objects
Oct 24, 2018
2d2d1da
56946: Added tests for toPaginatedList in remote-data-build service
Atmire-Kristof Oct 24, 2018
d1db0d4
Merge branch 'support-paginated-dso-properties' into entities-master
Atmire-Kristof Oct 24, 2018
9918d95
56434: search-response parsing bug fix
Atmire-Kristof Oct 24, 2018
b2ca67c
Merge branch 'entities-master' into w2p-56434_PR-preparations
Atmire-Kristof Oct 24, 2018
efcdc67
56434: Small TSLint fix
Atmire-Kristof Oct 24, 2018
b70a58d
56434: EntityPageFields component tests refactoring
Atmire-Kristof Oct 26, 2018
5d8c635
56434: FullItemPageComponent tests and improved coverage
Atmire-Kristof Oct 26, 2018
e39879b
56434: e2e test fix
Atmire-Kristof Oct 26, 2018
1126af6
56434: By.css call by tag instead of class refactoring
Atmire-Kristof Oct 26, 2018
ec61240
Default REST API server set to dspace7-entities.atmire.com for testin…
Atmire-Kristof Nov 8, 2018
626b9fe
57557: reset homepage and fix collection sorting
Atmire-Kristof Nov 22, 2018
ba92882
57557: Refactored EntitySearchResultComponent
Atmire-Kristof Nov 22, 2018
6d69c7d
57557: Generic publishers in spec files
Atmire-Kristof Nov 22, 2018
7b6665d
57557: Added missing spec files
Atmire-Kristof Nov 22, 2018
3f98fed
57557: Added JSDocs
Atmire-Kristof Nov 23, 2018
19033e6
57557: Fixed/Added some more JSDocs
Atmire-Kristof Nov 26, 2018
1ba7d1e
57557: Added leftPlace and rightPlace to Relationship + JSDocs
Atmire-Kristof Nov 26, 2018
3988b7a
57557: Added JSDocs and Specs for EntityPageFieldsComponent operators
Atmire-Kristof Nov 26, 2018
d32ec11
57557: Sort direction on collection page reverted to DESC
Atmire-Kristof Nov 28, 2018
69aaa18
57557: Renamed EntityPageFieldsComponents to EntityComponents
Atmire-Kristof Nov 28, 2018
c5eb4b7
add link to getBitstreamsByBundleName PR
Nov 29, 2018
9c3f226
Merge branch 'master' into configurable_entities
LotteHofstede Dec 10, 2018
a7bebb1
upgrade to angular 6
LotteHofstede Dec 10, 2018
6d44381
angular 6 upgrade
LotteHofstede Dec 10, 2018
5ed2b75
fix an issue where an empty bitstream page would cause an error
artlowel Dec 12, 2018
593dcf7
fix an issue where metadata-view-elements containing only images woul…
artlowel Dec 12, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions config/environment.default.js
Expand Up @@ -10,10 +10,10 @@ module.exports = {
// The REST API server settings.
rest: {
ssl: true,
host: 'dspace7.4science.it',
host: 'dspace7-entities.atmire.com',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the testing purpose, but I think this default file should be stuck to more default configurations like localhost.

Copy link
Member

@tdonohue tdonohue Nov 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paulo-graca : I agree for the final release. However, for the ongoing development of the Angular UI, we've decided to default it to point at our public REST API demo site. That makes PRs and code much easier to test because we don't require testers install the REST API locally (or figure out how to change this setting manually).

So, the plan is that the final DSpace 7 release will have this set to localhost. However, until then, we will keep it set to the public demo site for easy testing/development.

port: 443,
// NOTE: Space is capitalized because 'namespace' is a reserved string in TypeScript
nameSpace: '/dspace-spring-rest/api'
nameSpace: '/rest/api'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like the comment I did in Dspace API PR (), in order for this to work by default, you need to change this setting to "spring-rest"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paulo-graca : Again, I agree for the final release we'll want this set to the name of the REST API webapp. However, again (as commented above) for testing purposes we are setting this to the path of the current REST API demo site by default.

},
// Caching settings
cache: {
Expand Down
4 changes: 2 additions & 2 deletions e2e/app.e2e-spec.ts
Expand Up @@ -12,8 +12,8 @@ describe('protractor App', () => {
expect<any>(page.getPageTitleText()).toEqual('DSpace Angular :: Home');
});

it('should display header "Welcome to DSpace"', () => {
it('should contain a news section', () => {
page.navigateTo();
expect<any>(page.getFirstHeaderText()).toEqual('Welcome to DSpace');
expect<any>(page.getHomePageNewsText()).toBeDefined();
});
});
8 changes: 2 additions & 6 deletions e2e/app.po.ts
Expand Up @@ -9,11 +9,7 @@ export class ProtractorPage {
return browser.getTitle();
}

getFirstPText() {
return element(by.xpath('//p[1]')).getText();
}

getFirstHeaderText() {
return element(by.xpath('//h1[1]')).getText();
getHomePageNewsText() {
return element(by.xpath('//ds-home-news')).getText();
}
}
95 changes: 93 additions & 2 deletions resources/i18n/en.json
Expand Up @@ -26,7 +26,7 @@
},
"item": {
"page": {
"author": "Author",
"author": "Authors",
"abstract": "Abstract",
"date": "Date",
"uri": "URI",
Expand All @@ -45,6 +45,74 @@
}
}
},
"relationships": {
"isPublicationOf": "Publications",
"isProjectOf": "Projects",
"isOrgUnitOf": "Org Units",
"isAuthorOf": "Authors",
"isPersonOf": "Authors",
"isJournalOf": "Journals",
"isSingleJournalOf": "Journal",
"isVolumeOf": "Volumes",
"isSingleVolumeOf": "Volume",
"isIssueOf": "Issues",
"isJournalIssueOf": "Journal Issue",
"isPublicationOfJournalIssue": "Articles"
},
"person": {
"page": {
"jobtitle": "Job Title",
"lastname": "Last Name",
"firstname": "First Name",
"email": "Email Address",
"orcid": "ORCID",
"birthdate": "Birth Date",
"staffid": "Staff ID",
"link": {
"full": "Show all metadata"
}
}
},
"project": {
"page": {
"status": "Status",
"id": "ID",
"expectedcompletion": "Expected Completion",
"description": "Description",
"keyword": "Keywords"
}
},
"orgunit": {
"page": {
"dateestablished": "Date established",
"city": "City",
"country": "Country",
"id": "ID",
"description": "Description"
}
},
"journal": {
"page": {
"issn": "ISSN",
"publisher": "Publisher",
"description": "Description"
}
},
"journalvolume": {
"page": {
"volume": "Volume",
"issuedate": "Issue Date",
"description": "Description"
}
},
"journalissue": {
"page": {
"number": "Number",
"issuedate": "Issue Date",
"description": "Description",
"keyword": "Keywords"
}
},
"nav": {
"home": "Home",
"login": "Log In",
Expand Down Expand Up @@ -84,6 +152,24 @@
}
},
"search": {
"journal": {
"title": "DSpace Angular :: Journal Search",
"results": {
"head": "Journal Search Results"
}
},
"person": {
"title": "DSpace Angular :: Person Search",
"results": {
"head": "Person Search Results"
}
},
"publication": {
"title": "DSpace Angular :: Publication Search",
"results": {
"head": "Publication Search Results"
}
},
"title": "DSpace Angular :: Search",
"description": "",
"form": {
Expand Down Expand Up @@ -120,7 +206,8 @@
"f.dateIssued.min": "Start date",
"f.dateIssued.max": "End date",
"f.subject": "Subject",
"f.has_content_in_original_bundle": "Has files"
"f.has_content_in_original_bundle": "Has files",
"f.entityType": "Entity Type"
},
"filter": {
"show-more": "Show more",
Expand Down Expand Up @@ -148,6 +235,10 @@
},
"has_content_in_original_bundle": {
"head": "Has files"
},
"entityType": {
"placeholder": "Entity Type",
"head": "Entity Type"
}
}
}
Expand Down
Binary file added resources/images/orgunit-placeholder.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/images/person-placeholder.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/images/project-placeholder.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 22 additions & 13 deletions src/app/+collection-page/collection-page.component.ts
Expand Up @@ -3,6 +3,7 @@ import { ActivatedRoute } from '@angular/router';
import { Observable, Subscription } from 'rxjs';
import { SortDirection, SortOptions } from '../core/cache/models/sort-options.model';
import { CollectionDataService } from '../core/data/collection-data.service';
import { ItemDataService } from '../core/data/item-data.service';
import { PaginatedList } from '../core/data/paginated-list';
import { RemoteData } from '../core/data/remote-data';

Expand All @@ -15,7 +16,7 @@ import { Item } from '../core/shared/item.model';
import { fadeIn, fadeInOut } from '../shared/animations/fade';
import { hasValue, isNotEmpty } from '../shared/empty.util';
import { PaginationComponentOptions } from '../shared/pagination/pagination-component-options.model';
import { filter, flatMap, map } from 'rxjs/operators';
import { combineLatest, filter, first, flatMap, map } from 'rxjs/operators';
import { SearchService } from '../+search-page/search-service/search.service';
import { PaginatedSearchOptions } from '../+search-page/paginated-search-options.model';
import { toDSpaceObjectListRD } from '../core/shared/operators';
Expand All @@ -42,7 +43,7 @@ export class CollectionPageComponent implements OnInit, OnDestroy {

constructor(
private collectionDataService: CollectionDataService,
private searchService: SearchService,
private itemDataService: ItemDataService,
private metadata: MetadataService,
private route: ActivatedRoute
) {
Expand All @@ -55,7 +56,8 @@ export class CollectionPageComponent implements OnInit, OnDestroy {

ngOnInit(): void {
this.collectionRD$ = this.route.data.pipe(
map((data) => data.collection)
map((data) => data.collection),
first()
);
this.logoRD$ = this.collectionRD$.pipe(
map((rd: RemoteData<Collection>) => rd.payload),
Expand All @@ -67,26 +69,33 @@ export class CollectionPageComponent implements OnInit, OnDestroy {
this.metadata.processRemoteData(this.collectionRD$);
const page = +params.page || this.paginationConfig.currentPage;
const pageSize = +params.pageSize || this.paginationConfig.pageSize;
const sortDirection = +params.page || this.sortConfig.direction;
const pagination = Object.assign({},
this.paginationConfig,
{ currentPage: page, pageSize: pageSize }
);
this.updatePage({
pagination: pagination,
sort: this.sortConfig
const sort = Object.assign({},
this.sortConfig,
{ direction: sortDirection, field: params.sortField }
);
this.collectionRD$.subscribe((rd: RemoteData<Collection>) => {
this.collectionId = rd.payload.id;
this.updatePage({
pagination: pagination,
sort: sort
});
});
})
);
}

updatePage(searchOptions) {
this.itemRD$ = this.searchService.search(
new PaginatedSearchOptions({
scope: this.collectionId,
pagination: searchOptions.pagination,
sort: searchOptions.sort,
dsoType: DSpaceObjectType.ITEM
})).pipe(toDSpaceObjectListRD()) as Observable<RemoteData<PaginatedList<Item>>>;
this.itemRD$ = this.itemDataService.findAll({
scopeID: this.collectionId,
currentPage: searchOptions.pagination.currentPage,
elementsPerPage: searchOptions.pagination.pageSize,
sort: searchOptions.sort
});
}

ngOnDestroy(): void {
Expand Down
6 changes: 4 additions & 2 deletions src/app/+collection-page/collection-page.module.ts
Expand Up @@ -5,17 +5,19 @@ import { SharedModule } from '../shared/shared.module';

import { CollectionPageComponent } from './collection-page.component';
import { CollectionPageRoutingModule } from './collection-page-routing.module';
import { SearchPageModule } from '../+search-page/search-page.module';
import { SearchService } from '../+search-page/search-service/search.service';

@NgModule({
imports: [
CommonModule,
SharedModule,
SearchPageModule,
CollectionPageRoutingModule
],
declarations: [
CollectionPageComponent,
],
providers: [
SearchService
]
})
export class CollectionPageModule {
Expand Down
@@ -1,4 +1,4 @@
<div class="simple-view-element" [class.d-none]="content.textContent.trim().length === 0">
<div class="simple-view-element" [class.d-none]="content.textContent.trim().length === 0 && hasNoValue(content.querySelector('img'))">
<h5 class="simple-view-element-header" *ngIf="label">{{ label }}</h5>
<div #content class="simple-view-element-body">
<ng-content></ng-content>
Expand Down
@@ -1,26 +1,49 @@
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { Component, DebugElement } from '@angular/core';
import { Component } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { MetadataFieldWrapperComponent } from './metadata-field-wrapper.component';

/* tslint:disable:max-classes-per-file */
@Component({
selector: 'ds-component-with-content',
selector: 'ds-component-without-content',
template: '<ds-metadata-field-wrapper [label]="\'test label\'">\n' +
' <div class="my-content">\n' +
'</ds-metadata-field-wrapper>'
})
class NoContentComponent {}

@Component({
selector: 'ds-component-with-empty-spans',
template: '<ds-metadata-field-wrapper [label]="\'test label\'">\n' +
' <span></span>\n' +
' <span></span>\n' +
' </div>\n' +
'</ds-metadata-field-wrapper>'
})
class ContentComponent {}
class SpanContentComponent {}

@Component({
selector: 'ds-component-with-text',
template: '<ds-metadata-field-wrapper [label]="\'test label\'">\n' +
' <span>The quick brown fox jumps over the lazy dog</span>\n' +
'</ds-metadata-field-wrapper>'
})
class TextContentComponent {}

@Component({
selector: 'ds-component-with-image',
template: '<ds-metadata-field-wrapper [label]="\'test label\'">\n' +
' <img src="https://some/image.png" alt="an alt text">\n' +
'</ds-metadata-field-wrapper>'
})
class ImgContentComponent {}
/* tslint:enable:max-classes-per-file */

describe('MetadataFieldWrapperComponent', () => {
let component: MetadataFieldWrapperComponent;
let fixture: ComponentFixture<MetadataFieldWrapperComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [MetadataFieldWrapperComponent, ContentComponent]
declarations: [MetadataFieldWrapperComponent, NoContentComponent, SpanContentComponent, TextContentComponent, ImgContentComponent]
}).compileComponents();
}));

Expand All @@ -30,35 +53,40 @@ describe('MetadataFieldWrapperComponent', () => {
});

const wrapperSelector = '.simple-view-element';
const labelSelector = '.simple-view-element-header';
const contentSelector = '.my-content';

it('should create', () => {
expect(component).toBeDefined();
});

it('should not show the component when there is no content', () => {
component.label = 'test label';
fixture.detectChanges();
const parentNative = fixture.nativeElement;
const parentFixture = TestBed.createComponent(NoContentComponent);
parentFixture.detectChanges();
const parentNative = parentFixture.nativeElement;
const nativeWrapper = parentNative.querySelector(wrapperSelector);
expect(nativeWrapper.classList.contains('d-none')).toBe(true);
});

it('should not show the component when there is DOM content but no text', () => {
const parentFixture = TestBed.createComponent(ContentComponent);
it('should not show the component when there is DOM content but not text or an image', () => {
const parentFixture = TestBed.createComponent(SpanContentComponent);
parentFixture.detectChanges();
const parentNative = parentFixture.nativeElement;
const nativeWrapper = parentNative.querySelector(wrapperSelector);
expect(nativeWrapper.classList.contains('d-none')).toBe(true);
});

it('should show the component when there is text content', () => {
const parentFixture = TestBed.createComponent(ContentComponent);
const parentFixture = TestBed.createComponent(TextContentComponent);
parentFixture.detectChanges();
const parentNative = parentFixture.nativeElement;
const nativeWrapper = parentNative.querySelector(wrapperSelector);
parentFixture.detectChanges();
expect(nativeWrapper.classList.contains('d-none')).toBe(false);
});

it('should show the component when there is img content', () => {
const parentFixture = TestBed.createComponent(ImgContentComponent);
parentFixture.detectChanges();
const parentNative = parentFixture.nativeElement;
const nativeContent = parentNative.querySelector(contentSelector);
nativeContent.textContent = 'lorem ipsum';
const nativeWrapper = parentNative.querySelector(wrapperSelector);
parentFixture.detectChanges();
expect(nativeWrapper.classList.contains('d-none')).toBe(false);
Expand Down