From 65516b3880352cd7fe04962dbd4ad46fbfa9e9d8 Mon Sep 17 00:00:00 2001 From: Alessandro Martelli Date: Wed, 28 Oct 2020 17:37:42 +0100 Subject: [PATCH 01/16] [CSTPER-222] handle metadata reading for communities and collections --- src/app/core/shared/collection.model.ts | 23 +++++-- src/app/core/shared/community.model.ts | 23 +++++-- .../comcol-page-handle.component.spec.ts | 62 +++++++++++++++++++ .../comcol-page-handle.component.ts | 7 ++- 4 files changed, 100 insertions(+), 15 deletions(-) create mode 100644 src/app/shared/comcol-page-handle/comcol-page-handle.component.spec.ts diff --git a/src/app/core/shared/collection.model.ts b/src/app/core/shared/collection.model.ts index c1464d7d39..1505359cfd 100644 --- a/src/app/core/shared/collection.model.ts +++ b/src/app/core/shared/collection.model.ts @@ -1,4 +1,4 @@ -import { autoserialize, deserialize, inheritSerialization } from 'cerialize'; +import { autoserialize, deserialize, deserializeAs, inheritSerialization } from 'cerialize'; import { Observable } from 'rxjs'; import { link, typedObject } from '../cache/builders/build-decorators'; import { PaginatedList } from '../data/paginated-list'; @@ -15,17 +15,16 @@ import { RESOURCE_POLICY } from '../resource-policy/models/resource-policy.resou import { COMMUNITY } from './community.resource-type'; import { Community } from './community.model'; import { ChildHALResource } from './child-hal-resource.model'; +import { excludeFromEquals } from '../utilities/equals.decorators'; @typedObject @inheritSerialization(DSpaceObject) export class Collection extends DSpaceObject implements ChildHALResource { static type = COLLECTION; - /** - * A string representing the unique handle of this Collection - */ - @autoserialize - handle: string; + @excludeFromEquals + @deserializeAs('handle') + private _handle: string; /** * The {@link HALLink}s for this Collection @@ -75,6 +74,18 @@ export class Collection extends DSpaceObject implements ChildHALResource { @link(COMMUNITY, false) parentCommunity?: Observable>; + /** + * A string representing the unique handle of this Collection + */ + get handle(): string { + const metadataValue = this.firstMetadataValue('dc.identifier.uri'); + return metadataValue ? metadataValue : this._handle; + } + + set handle(value: string) { + this._handle = value; + } + /** * The introductory text of this Collection * Corresponds to the metadata field dc.description diff --git a/src/app/core/shared/community.model.ts b/src/app/core/shared/community.model.ts index 796aaa8ece..06f7b70c01 100644 --- a/src/app/core/shared/community.model.ts +++ b/src/app/core/shared/community.model.ts @@ -1,4 +1,4 @@ -import { autoserialize, deserialize, inheritSerialization } from 'cerialize'; +import { autoserialize, deserialize, deserializeAs, inheritSerialization } from 'cerialize'; import { Observable } from 'rxjs'; import { link, typedObject } from '../cache/builders/build-decorators'; import { PaginatedList } from '../data/paginated-list'; @@ -11,17 +11,16 @@ import { COMMUNITY } from './community.resource-type'; import { DSpaceObject } from './dspace-object.model'; import { HALLink } from './hal-link.model'; import { ChildHALResource } from './child-hal-resource.model'; +import { excludeFromEquals } from '../utilities/equals.decorators'; @typedObject @inheritSerialization(DSpaceObject) export class Community extends DSpaceObject implements ChildHALResource { static type = COMMUNITY; - /** - * A string representing the unique handle of this Community - */ - @autoserialize - handle: string; + @excludeFromEquals + @deserializeAs('handle') + private _handle: string; /** * The {@link HALLink}s for this Community @@ -64,6 +63,18 @@ export class Community extends DSpaceObject implements ChildHALResource { @link(COMMUNITY, false) parentCommunity?: Observable>; + /** + * A string representing the unique handle of this Community + */ + get handle(): string { + const metadataValue = this.firstMetadataValue('dc.identifier.uri'); + return metadataValue ? metadataValue : this._handle; + } + + set handle(value: string) { + this._handle = value; + } + /** * The introductory text of this Community * Corresponds to the metadata field dc.description diff --git a/src/app/shared/comcol-page-handle/comcol-page-handle.component.spec.ts b/src/app/shared/comcol-page-handle/comcol-page-handle.component.spec.ts new file mode 100644 index 0000000000..e059cb7044 --- /dev/null +++ b/src/app/shared/comcol-page-handle/comcol-page-handle.component.spec.ts @@ -0,0 +1,62 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { TranslateModule } from '@ngx-translate/core'; +import { By } from '@angular/platform-browser'; +import { UIURLCombiner } from 'src/app/core/url-combiner/ui-url-combiner'; +import { ComcolPageHandleComponent } from './comcol-page-handle.component'; + +const handleWithProtocol = 'http://localhost:4000/handle/123456789/2'; + +const handleWithoutProtocol = '123456789/2'; +const handleWithoutProtocolUIURLCombined = new UIURLCombiner('/handle/', '123456789/2').toString(); + +describe('ComcolPageHandleComponent', () => { + let component: ComcolPageHandleComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + imports: [TranslateModule.forRoot()], + declarations: [ ComcolPageHandleComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ComcolPageHandleComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); + + it('should be empty if no content is passed', () => { + component.content = undefined; + fixture.detectChanges(); + const div = fixture.debugElement.query(By.css('div')); + expect(div).toBeNull(); + }); + + describe('should create a link pointing the handle', () => { + + it('should use the content if it includes the http protocol', () => { + component.content = handleWithProtocol; + fixture.detectChanges(); + + const link = fixture.debugElement.query(By.css('a')); + expect(link.nativeElement.getAttribute('href')).toBe(handleWithProtocol); + expect(link.nativeElement.innerHTML).toBe(handleWithProtocol); + }); + + it('should combine the base uri to the content if it doesnt include the http protocol', () => { + component.content = handleWithoutProtocol; + fixture.detectChanges(); + const link = fixture.debugElement.query(By.css('a')); + expect(link.nativeElement.getAttribute('href')).toBe(handleWithoutProtocolUIURLCombined); + expect(link.nativeElement.innerHTML).toBe(handleWithoutProtocolUIURLCombined); + }); + + }); + +}); \ No newline at end of file diff --git a/src/app/shared/comcol-page-handle/comcol-page-handle.component.ts b/src/app/shared/comcol-page-handle/comcol-page-handle.component.ts index bf403e9e88..bea3f51e28 100644 --- a/src/app/shared/comcol-page-handle/comcol-page-handle.component.ts +++ b/src/app/shared/comcol-page-handle/comcol-page-handle.component.ts @@ -21,6 +21,7 @@ export class ComcolPageHandleComponent { @Input() content: string; public getHandle(): string { - return new UIURLCombiner('/handle/', this.content).toString(); - } -} + return this.content.includes('http') ? this.content + : new UIURLCombiner('/handle/', this.content).toString(); + }} + From 5c7a111a61ad5415f0c43b15ed855974d3ebeb26 Mon Sep 17 00:00:00 2001 From: Alessandro Martelli Date: Tue, 10 Nov 2020 12:37:38 +0100 Subject: [PATCH 02/16] [CSTPER-222] handle metadata reading for communities and collections --- src/app/core/shared/collection.model.ts | 5 ++--- src/app/core/shared/community.model.ts | 3 +-- .../comcol-page-handle.component.spec.ts | 15 +++------------ .../comcol-page-handle.component.ts | 7 +++---- 4 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/app/core/shared/collection.model.ts b/src/app/core/shared/collection.model.ts index 1505359cfd..3eb9a128d7 100644 --- a/src/app/core/shared/collection.model.ts +++ b/src/app/core/shared/collection.model.ts @@ -78,14 +78,13 @@ export class Collection extends DSpaceObject implements ChildHALResource { * A string representing the unique handle of this Collection */ get handle(): string { - const metadataValue = this.firstMetadataValue('dc.identifier.uri'); - return metadataValue ? metadataValue : this._handle; + return this.firstMetadataValue('dc.identifier.uri'); } set handle(value: string) { this._handle = value; } - + /** * The introductory text of this Collection * Corresponds to the metadata field dc.description diff --git a/src/app/core/shared/community.model.ts b/src/app/core/shared/community.model.ts index 06f7b70c01..4943ff37d9 100644 --- a/src/app/core/shared/community.model.ts +++ b/src/app/core/shared/community.model.ts @@ -67,8 +67,7 @@ export class Community extends DSpaceObject implements ChildHALResource { * A string representing the unique handle of this Community */ get handle(): string { - const metadataValue = this.firstMetadataValue('dc.identifier.uri'); - return metadataValue ? metadataValue : this._handle; + return this.firstMetadataValue('dc.identifier.uri'); } set handle(value: string) { diff --git a/src/app/shared/comcol-page-handle/comcol-page-handle.component.spec.ts b/src/app/shared/comcol-page-handle/comcol-page-handle.component.spec.ts index e059cb7044..9c4c31a8e8 100644 --- a/src/app/shared/comcol-page-handle/comcol-page-handle.component.spec.ts +++ b/src/app/shared/comcol-page-handle/comcol-page-handle.component.spec.ts @@ -39,7 +39,7 @@ describe('ComcolPageHandleComponent', () => { }); describe('should create a link pointing the handle', () => { - + it('should use the content if it includes the http protocol', () => { component.content = handleWithProtocol; fixture.detectChanges(); @@ -48,15 +48,6 @@ describe('ComcolPageHandleComponent', () => { expect(link.nativeElement.getAttribute('href')).toBe(handleWithProtocol); expect(link.nativeElement.innerHTML).toBe(handleWithProtocol); }); - - it('should combine the base uri to the content if it doesnt include the http protocol', () => { - component.content = handleWithoutProtocol; - fixture.detectChanges(); - const link = fixture.debugElement.query(By.css('a')); - expect(link.nativeElement.getAttribute('href')).toBe(handleWithoutProtocolUIURLCombined); - expect(link.nativeElement.innerHTML).toBe(handleWithoutProtocolUIURLCombined); - }); - }); - -}); \ No newline at end of file + +}); diff --git a/src/app/shared/comcol-page-handle/comcol-page-handle.component.ts b/src/app/shared/comcol-page-handle/comcol-page-handle.component.ts index bea3f51e28..53487c872c 100644 --- a/src/app/shared/comcol-page-handle/comcol-page-handle.component.ts +++ b/src/app/shared/comcol-page-handle/comcol-page-handle.component.ts @@ -21,7 +21,6 @@ export class ComcolPageHandleComponent { @Input() content: string; public getHandle(): string { - return this.content.includes('http') ? this.content - : new UIURLCombiner('/handle/', this.content).toString(); - }} - + return this.content; + } +} From fa113babc76c08528f3658495f5863ef4ae6c1fc Mon Sep 17 00:00:00 2001 From: Alessandro Martelli Date: Tue, 10 Nov 2020 13:59:44 +0100 Subject: [PATCH 03/16] [CSTPER-222] handle metadata reading for communities and collections Community and Collection handle tests --- .../collection-curate.component.spec.ts | 2 +- .../community-curate.component.spec.ts | 2 +- src/app/core/shared/collection.model.spec.ts | 31 +++++++++++++++++++ src/app/core/shared/community.model.spec.ts | 31 +++++++++++++++++++ 4 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 src/app/core/shared/collection.model.spec.ts create mode 100644 src/app/core/shared/community.model.spec.ts diff --git a/src/app/+collection-page/edit-collection-page/collection-curate/collection-curate.component.spec.ts b/src/app/+collection-page/edit-collection-page/collection-curate/collection-curate.component.spec.ts index 91c264cd0f..628dd545df 100644 --- a/src/app/+collection-page/edit-collection-page/collection-curate/collection-curate.component.spec.ts +++ b/src/app/+collection-page/edit-collection-page/collection-curate/collection-curate.component.spec.ts @@ -17,7 +17,7 @@ describe('CollectionCurateComponent', () => { let dsoNameService; const collection = Object.assign(new Collection(), { - handle: '123456789/1', metadata: {'dc.title': ['Collection Name']} + metadata: {'dc.title': ['Collection Name'], 'dc.identifier.uri': [ { value: '123456789/1'}]} }); beforeEach(async(() => { diff --git a/src/app/+community-page/edit-community-page/community-curate/community-curate.component.spec.ts b/src/app/+community-page/edit-community-page/community-curate/community-curate.component.spec.ts index 42dc0f08a9..3217fee3c1 100644 --- a/src/app/+community-page/edit-community-page/community-curate/community-curate.component.spec.ts +++ b/src/app/+community-page/edit-community-page/community-curate/community-curate.component.spec.ts @@ -17,7 +17,7 @@ describe('CommunityCurateComponent', () => { let dsoNameService; const community = Object.assign(new Community(), { - handle: '123456789/1', metadata: {'dc.title': ['Community Name']} + metadata: {'dc.title': ['Community Name'], 'dc.identifier.uri': [ { value: '123456789/1'}]} }); beforeEach(async(() => { diff --git a/src/app/core/shared/collection.model.spec.ts b/src/app/core/shared/collection.model.spec.ts new file mode 100644 index 0000000000..6c2f015b5b --- /dev/null +++ b/src/app/core/shared/collection.model.spec.ts @@ -0,0 +1,31 @@ +import {Collection} from './collection.model'; + +fdescribe('Collection', () => { + + fdescribe('Collection handle value', () => { + + let metadataValue; + let handleValue; + + beforeEach(() => { + metadataValue = {'dc.identifier.uri': [ { value: '123456789/1'}]}; + handleValue = '11111111111/1'; + }) + + it('should return the handle value from metadata', () => { + const community = Object.assign(new Collection(), { metadata: metadataValue }); + expect(community.handle).toEqual('123456789/1'); + }); + + it('should return the handle value from metadata even when the handle field is provided', () => { + const community = Object.assign(new Collection(), { handle: handleValue, metadata: metadataValue }); + expect(community.handle).toEqual('123456789/1'); + }); + + it('should return undefined if the handle value from metadata is not present', () => { + const community = Object.assign(new Collection(), { handle: handleValue }); + expect(community.handle).toEqual(undefined); + }); + }); + +}); diff --git a/src/app/core/shared/community.model.spec.ts b/src/app/core/shared/community.model.spec.ts new file mode 100644 index 0000000000..3822509720 --- /dev/null +++ b/src/app/core/shared/community.model.spec.ts @@ -0,0 +1,31 @@ +import {Community} from './community.model'; + +fdescribe('Community', () => { + + fdescribe('Community handle value', () => { + + let metadataValue; + let handleValue; + + beforeEach(() => { + metadataValue = {'dc.identifier.uri': [ { value: '123456789/1'}]}; + handleValue = '11111111111/1'; + }) + + it('should return the handle value from metadata', () => { + const community = Object.assign(new Community(), { metadata: metadataValue }); + expect(community.handle).toEqual('123456789/1'); + }); + + it('should return the handle value from metadata even when the handle field is provided', () => { + const community = Object.assign(new Community(), { handle: handleValue, metadata: metadataValue }); + expect(community.handle).toEqual('123456789/1'); + }); + + it('should return undefined if the handle value from metadata is not present', () => { + const community = Object.assign(new Community(), { handle: handleValue }); + expect(community.handle).toEqual(undefined); + }); + }); + +}); From 4a2fe76ef08de10690a5c1d4277bb9643440771e Mon Sep 17 00:00:00 2001 From: Alessandro Martelli Date: Tue, 10 Nov 2020 14:30:52 +0100 Subject: [PATCH 04/16] [CSTPER-222] handle metadata reading for communities and collections Fixed tests --- src/app/core/shared/collection.model.spec.ts | 4 ++-- src/app/core/shared/community.model.spec.ts | 4 ++-- .../comcol-page-handle.component.spec.ts | 23 ++++++++----------- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/app/core/shared/collection.model.spec.ts b/src/app/core/shared/collection.model.spec.ts index 6c2f015b5b..82e90f05cd 100644 --- a/src/app/core/shared/collection.model.spec.ts +++ b/src/app/core/shared/collection.model.spec.ts @@ -1,8 +1,8 @@ import {Collection} from './collection.model'; -fdescribe('Collection', () => { +describe('Collection', () => { - fdescribe('Collection handle value', () => { + describe('Collection handle value', () => { let metadataValue; let handleValue; diff --git a/src/app/core/shared/community.model.spec.ts b/src/app/core/shared/community.model.spec.ts index 3822509720..1b688c9df9 100644 --- a/src/app/core/shared/community.model.spec.ts +++ b/src/app/core/shared/community.model.spec.ts @@ -1,8 +1,8 @@ import {Community} from './community.model'; -fdescribe('Community', () => { +describe('Community', () => { - fdescribe('Community handle value', () => { + describe('Community handle value', () => { let metadataValue; let handleValue; diff --git a/src/app/shared/comcol-page-handle/comcol-page-handle.component.spec.ts b/src/app/shared/comcol-page-handle/comcol-page-handle.component.spec.ts index 9c4c31a8e8..0fb1b458e1 100644 --- a/src/app/shared/comcol-page-handle/comcol-page-handle.component.spec.ts +++ b/src/app/shared/comcol-page-handle/comcol-page-handle.component.spec.ts @@ -1,15 +1,11 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { By } from '@angular/platform-browser'; -import { UIURLCombiner } from 'src/app/core/url-combiner/ui-url-combiner'; import { ComcolPageHandleComponent } from './comcol-page-handle.component'; -const handleWithProtocol = 'http://localhost:4000/handle/123456789/2'; +const handle = 'http://localhost:4000/handle/123456789/2'; -const handleWithoutProtocol = '123456789/2'; -const handleWithoutProtocolUIURLCombined = new UIURLCombiner('/handle/', '123456789/2').toString(); - -describe('ComcolPageHandleComponent', () => { +fdescribe('ComcolPageHandleComponent', () => { let component: ComcolPageHandleComponent; let fixture: ComponentFixture; @@ -38,16 +34,15 @@ describe('ComcolPageHandleComponent', () => { expect(div).toBeNull(); }); - describe('should create a link pointing the handle', () => { + it('should create a link pointing the handle when present', () => { - it('should use the content if it includes the http protocol', () => { - component.content = handleWithProtocol; - fixture.detectChanges(); + component.content = handle; + fixture.detectChanges(); + + const link = fixture.debugElement.query(By.css('a')); + expect(link.nativeElement.getAttribute('href')).toBe(handle); + expect(link.nativeElement.innerHTML).toBe(handle); - const link = fixture.debugElement.query(By.css('a')); - expect(link.nativeElement.getAttribute('href')).toBe(handleWithProtocol); - expect(link.nativeElement.innerHTML).toBe(handleWithProtocol); - }); }); }); From fa8ecd16a7420bc7b20caf2242b21291a00ba7ac Mon Sep 17 00:00:00 2001 From: Alessandro Martelli Date: Tue, 10 Nov 2020 14:50:46 +0100 Subject: [PATCH 05/16] [CSTPER-222] handle metadata reading for communities and collections Fixed unused imports. --- src/app/core/shared/collection.model.ts | 2 +- src/app/core/shared/community.model.ts | 2 +- .../shared/comcol-page-handle/comcol-page-handle.component.ts | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/app/core/shared/collection.model.ts b/src/app/core/shared/collection.model.ts index 3eb9a128d7..d0033ee7ca 100644 --- a/src/app/core/shared/collection.model.ts +++ b/src/app/core/shared/collection.model.ts @@ -1,4 +1,4 @@ -import { autoserialize, deserialize, deserializeAs, inheritSerialization } from 'cerialize'; +import { deserialize, deserializeAs, inheritSerialization } from 'cerialize'; import { Observable } from 'rxjs'; import { link, typedObject } from '../cache/builders/build-decorators'; import { PaginatedList } from '../data/paginated-list'; diff --git a/src/app/core/shared/community.model.ts b/src/app/core/shared/community.model.ts index 4943ff37d9..1f76cb66de 100644 --- a/src/app/core/shared/community.model.ts +++ b/src/app/core/shared/community.model.ts @@ -1,4 +1,4 @@ -import { autoserialize, deserialize, deserializeAs, inheritSerialization } from 'cerialize'; +import { deserialize, deserializeAs, inheritSerialization } from 'cerialize'; import { Observable } from 'rxjs'; import { link, typedObject } from '../cache/builders/build-decorators'; import { PaginatedList } from '../data/paginated-list'; diff --git a/src/app/shared/comcol-page-handle/comcol-page-handle.component.ts b/src/app/shared/comcol-page-handle/comcol-page-handle.component.ts index 53487c872c..2ce49ebea2 100644 --- a/src/app/shared/comcol-page-handle/comcol-page-handle.component.ts +++ b/src/app/shared/comcol-page-handle/comcol-page-handle.component.ts @@ -1,5 +1,4 @@ import { Component, Injectable, Input } from '@angular/core'; -import { UIURLCombiner } from '../../core/url-combiner/ui-url-combiner'; /** * This component builds a URL from the value of "handle" From 2369892c3ffa85465d10f31d8542c2a420ba0685 Mon Sep 17 00:00:00 2001 From: Alessandro Martelli Date: Wed, 18 Nov 2020 12:08:57 +0100 Subject: [PATCH 06/16] [CSTPER-222] handle metadata reading for communities and collections Removed handle field and the setter from community and collection models. --- src/app/core/shared/collection.model.spec.ts | 9 +-------- src/app/core/shared/collection.model.ts | 11 +---------- src/app/core/shared/community.model.spec.ts | 9 +-------- src/app/core/shared/community.model.ts | 11 +---------- .../comcol-page-handle.component.spec.ts | 2 +- .../export-metadata-selector.component.spec.ts | 18 ++++++++++++++++-- .../search-form/search-form.component.spec.ts | 18 ++++++++++++++---- .../search-results.component.spec.ts | 14 ++++++++++++-- 8 files changed, 47 insertions(+), 45 deletions(-) diff --git a/src/app/core/shared/collection.model.spec.ts b/src/app/core/shared/collection.model.spec.ts index 82e90f05cd..b35fa7415b 100644 --- a/src/app/core/shared/collection.model.spec.ts +++ b/src/app/core/shared/collection.model.spec.ts @@ -5,11 +5,9 @@ describe('Collection', () => { describe('Collection handle value', () => { let metadataValue; - let handleValue; beforeEach(() => { metadataValue = {'dc.identifier.uri': [ { value: '123456789/1'}]}; - handleValue = '11111111111/1'; }) it('should return the handle value from metadata', () => { @@ -17,13 +15,8 @@ describe('Collection', () => { expect(community.handle).toEqual('123456789/1'); }); - it('should return the handle value from metadata even when the handle field is provided', () => { - const community = Object.assign(new Collection(), { handle: handleValue, metadata: metadataValue }); - expect(community.handle).toEqual('123456789/1'); - }); - it('should return undefined if the handle value from metadata is not present', () => { - const community = Object.assign(new Collection(), { handle: handleValue }); + const community = Object.assign(new Collection(), { }); expect(community.handle).toEqual(undefined); }); }); diff --git a/src/app/core/shared/collection.model.ts b/src/app/core/shared/collection.model.ts index d0033ee7ca..a82f0646c5 100644 --- a/src/app/core/shared/collection.model.ts +++ b/src/app/core/shared/collection.model.ts @@ -1,4 +1,4 @@ -import { deserialize, deserializeAs, inheritSerialization } from 'cerialize'; +import { deserialize, inheritSerialization } from 'cerialize'; import { Observable } from 'rxjs'; import { link, typedObject } from '../cache/builders/build-decorators'; import { PaginatedList } from '../data/paginated-list'; @@ -15,17 +15,12 @@ import { RESOURCE_POLICY } from '../resource-policy/models/resource-policy.resou import { COMMUNITY } from './community.resource-type'; import { Community } from './community.model'; import { ChildHALResource } from './child-hal-resource.model'; -import { excludeFromEquals } from '../utilities/equals.decorators'; @typedObject @inheritSerialization(DSpaceObject) export class Collection extends DSpaceObject implements ChildHALResource { static type = COLLECTION; - @excludeFromEquals - @deserializeAs('handle') - private _handle: string; - /** * The {@link HALLink}s for this Collection */ @@ -81,10 +76,6 @@ export class Collection extends DSpaceObject implements ChildHALResource { return this.firstMetadataValue('dc.identifier.uri'); } - set handle(value: string) { - this._handle = value; - } - /** * The introductory text of this Collection * Corresponds to the metadata field dc.description diff --git a/src/app/core/shared/community.model.spec.ts b/src/app/core/shared/community.model.spec.ts index 1b688c9df9..5697686853 100644 --- a/src/app/core/shared/community.model.spec.ts +++ b/src/app/core/shared/community.model.spec.ts @@ -5,11 +5,9 @@ describe('Community', () => { describe('Community handle value', () => { let metadataValue; - let handleValue; beforeEach(() => { metadataValue = {'dc.identifier.uri': [ { value: '123456789/1'}]}; - handleValue = '11111111111/1'; }) it('should return the handle value from metadata', () => { @@ -17,13 +15,8 @@ describe('Community', () => { expect(community.handle).toEqual('123456789/1'); }); - it('should return the handle value from metadata even when the handle field is provided', () => { - const community = Object.assign(new Community(), { handle: handleValue, metadata: metadataValue }); - expect(community.handle).toEqual('123456789/1'); - }); - it('should return undefined if the handle value from metadata is not present', () => { - const community = Object.assign(new Community(), { handle: handleValue }); + const community = Object.assign(new Community(), { }); expect(community.handle).toEqual(undefined); }); }); diff --git a/src/app/core/shared/community.model.ts b/src/app/core/shared/community.model.ts index 1f76cb66de..778696486b 100644 --- a/src/app/core/shared/community.model.ts +++ b/src/app/core/shared/community.model.ts @@ -1,4 +1,4 @@ -import { deserialize, deserializeAs, inheritSerialization } from 'cerialize'; +import { deserialize, inheritSerialization } from 'cerialize'; import { Observable } from 'rxjs'; import { link, typedObject } from '../cache/builders/build-decorators'; import { PaginatedList } from '../data/paginated-list'; @@ -11,17 +11,12 @@ import { COMMUNITY } from './community.resource-type'; import { DSpaceObject } from './dspace-object.model'; import { HALLink } from './hal-link.model'; import { ChildHALResource } from './child-hal-resource.model'; -import { excludeFromEquals } from '../utilities/equals.decorators'; @typedObject @inheritSerialization(DSpaceObject) export class Community extends DSpaceObject implements ChildHALResource { static type = COMMUNITY; - @excludeFromEquals - @deserializeAs('handle') - private _handle: string; - /** * The {@link HALLink}s for this Community */ @@ -70,10 +65,6 @@ export class Community extends DSpaceObject implements ChildHALResource { return this.firstMetadataValue('dc.identifier.uri'); } - set handle(value: string) { - this._handle = value; - } - /** * The introductory text of this Community * Corresponds to the metadata field dc.description diff --git a/src/app/shared/comcol-page-handle/comcol-page-handle.component.spec.ts b/src/app/shared/comcol-page-handle/comcol-page-handle.component.spec.ts index 0fb1b458e1..e3e0c65920 100644 --- a/src/app/shared/comcol-page-handle/comcol-page-handle.component.spec.ts +++ b/src/app/shared/comcol-page-handle/comcol-page-handle.component.spec.ts @@ -5,7 +5,7 @@ import { ComcolPageHandleComponent } from './comcol-page-handle.component'; const handle = 'http://localhost:4000/handle/123456789/2'; -fdescribe('ComcolPageHandleComponent', () => { +describe('ComcolPageHandleComponent', () => { let component: ComcolPageHandleComponent; let fixture: ComponentFixture; diff --git a/src/app/shared/dso-selector/modal-wrappers/export-metadata-selector/export-metadata-selector.component.spec.ts b/src/app/shared/dso-selector/modal-wrappers/export-metadata-selector/export-metadata-selector.component.spec.ts index 40aab2fad5..ef9abbb5ee 100644 --- a/src/app/shared/dso-selector/modal-wrappers/export-metadata-selector/export-metadata-selector.component.spec.ts +++ b/src/app/shared/dso-selector/modal-wrappers/export-metadata-selector/export-metadata-selector.component.spec.ts @@ -53,12 +53,26 @@ describe('ExportMetadataSelectorComponent', () => { const mockCollection: Collection = Object.assign(new Collection(), { id: 'test-collection-1-1', name: 'test-collection-1', - handle: 'fake/test-collection-1', + metadata: { + 'dc.identifier.uri': [ + { + language: null, + value: 'fake/test-collection-1' + } + ] + } }); const mockCommunity = Object.assign(new Community(), { id: 'test-uuid', - handle: 'fake/test-community-1', + metadata: { + 'dc.identifier.uri': [ + { + language: null, + value: 'fake/test-community-1' + } + ] + } }); const itemRD = createSuccessfulRemoteDataObject(mockItem); diff --git a/src/app/shared/search-form/search-form.component.spec.ts b/src/app/shared/search-form/search-form.component.spec.ts index ffd8dd87a2..45339d98d2 100644 --- a/src/app/shared/search-form/search-form.component.spec.ts +++ b/src/app/shared/search-form/search-form.component.spec.ts @@ -109,7 +109,6 @@ describe('SearchFormComponent', () => { export const objects: DSpaceObject[] = [ Object.assign(new Community(), { - handle: '10673/11', logo: { self: { _isScalar: true, @@ -162,12 +161,17 @@ export const objects: DSpaceObject[] = [ language: null, value: 'OR2017 - Demonstration' } - ] + ], + 'dc.identifier.uri': [ + { + language: null, + value: 'http://localhost:4000/handle/10673/11' + } + ], } }), Object.assign(new Community(), { - handle: '10673/1', logo: { self: { _isScalar: true, @@ -220,7 +224,13 @@ export const objects: DSpaceObject[] = [ language: null, value: 'Sample Community' } - ] + ], + 'dc.identifier.uri': [ + { + language: null, + value: 'http://localhost:4000/handle/10673/1' + } + ], } } ) diff --git a/src/app/shared/search/search-results/search-results.component.spec.ts b/src/app/shared/search/search-results/search-results.component.spec.ts index b4586129e2..0386787654 100644 --- a/src/app/shared/search/search-results/search-results.component.spec.ts +++ b/src/app/shared/search/search-results/search-results.component.spec.ts @@ -96,7 +96,6 @@ describe('SearchResultsComponent', () => { export const objects = [ Object.assign(new Community(), { - handle: '10673/11', logo: { self: { _isScalar: true, @@ -149,12 +148,17 @@ export const objects = [ language: null, value: 'OR2017 - Demonstration' } + ], + 'dc.identifier.uri': [ + { + language: null, + value: 'http://localhost:4000/handle/10673/11' + } ] } }), Object.assign(new Community(), { - handle: '10673/1', logo: { self: { _isScalar: true, @@ -207,6 +211,12 @@ export const objects = [ language: null, value: 'Sample Community' } + ], + 'dc.identifier.uri': [ + { + language: null, + value: 'http://localhost:4000/handle/10673/1' + } ] } } From f8076051b485bd834aeacb3146795d18e14a41df Mon Sep 17 00:00:00 2001 From: Corrado Lombardi Date: Mon, 23 Nov 2020 09:14:16 +0100 Subject: [PATCH 07/16] replaced orcidV2 label keys with orcid --- src/assets/i18n/ar.json5 | 12 ++++++------ src/assets/i18n/cs.json5 | 12 ++++++------ src/assets/i18n/de.json5 | 12 ++++++------ src/assets/i18n/en.json5 | 8 ++++---- src/assets/i18n/es.json5 | 12 ++++++------ src/assets/i18n/fi.json5 | 12 ++++++------ src/assets/i18n/fr.json5 | 12 ++++++------ src/assets/i18n/ja.json5 | 12 ++++++------ src/assets/i18n/lv.json5 | 12 ++++++------ src/assets/i18n/nl.json5 | 12 ++++++------ src/assets/i18n/pl.json5 | 12 ++++++------ src/assets/i18n/pt.json5 | 12 ++++++------ src/assets/i18n/sw.json5 | 12 ++++++------ src/assets/i18n/tr.json5 | 12 ++++++------ 14 files changed, 82 insertions(+), 82 deletions(-) diff --git a/src/assets/i18n/ar.json5 b/src/assets/i18n/ar.json5 index d7afa97f08..a2a7042d33 100644 --- a/src/assets/i18n/ar.json5 +++ b/src/assets/i18n/ar.json5 @@ -4210,9 +4210,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.external-source.import-modal.head.lcname": "Importing from LC Name", - // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcidV2": "Importing from ORCID", + // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcid": "Importing from ORCID", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcidV2": "Importing from ORCID", + "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcid": "Importing from ORCID", // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.sherpaJournal": "Importing from Sherpa Journal", // TODO New key - Add a translation @@ -4322,9 +4322,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.search-tab.tab-title.sherpaPublisher": "Sherpa Publishers ({{ count }})", - // "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcidV2": "ORCID ({{ count }})", + // "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcid": "ORCID ({{ count }})", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcidV2": "ORCID ({{ count }})", + "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcid": "ORCID ({{ count }})", // "submission.sections.describe.relationship-lookup.search-tab.tab-title.lcname": "LC Names ({{ count }})", // TODO New key - Add a translation @@ -4402,9 +4402,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.selection-tab.title.sherpaPublisher": "Search Results", - // "submission.sections.describe.relationship-lookup.selection-tab.title.orcidV2": "Search Results", + // "submission.sections.describe.relationship-lookup.selection-tab.title.orcid": "Search Results", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.selection-tab.title.orcidV2": "Search Results", + "submission.sections.describe.relationship-lookup.selection-tab.title.orcid": "Search Results", // "submission.sections.describe.relationship-lookup.selection-tab.title.lcname": "Search Results", // TODO New key - Add a translation diff --git a/src/assets/i18n/cs.json5 b/src/assets/i18n/cs.json5 index 6a41ef7a05..775189bdf8 100644 --- a/src/assets/i18n/cs.json5 +++ b/src/assets/i18n/cs.json5 @@ -4078,9 +4078,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.external-source.import-modal.head.lcname": "Importing from LC Name", - // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcidV2": "Importing from ORCID", + // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcid": "Importing from ORCID", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcidV2": "Importing from ORCID", + "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcid": "Importing from ORCID", // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.sherpaJournal": "Importing from Sherpa Journal", // TODO New key - Add a translation @@ -4190,9 +4190,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.search-tab.tab-title.sherpaPublisher": "Sherpa Publishers ({{ count }})", - // "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcidV2": "ORCID ({{ count }})", + // "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcid": "ORCID ({{ count }})", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcidV2": "ORCID ({{ count }})", + "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcid": "ORCID ({{ count }})", // "submission.sections.describe.relationship-lookup.search-tab.tab-title.lcname": "LC Names ({{ count }})", // TODO New key - Add a translation @@ -4270,9 +4270,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.selection-tab.title.sherpaPublisher": "Search Results", - // "submission.sections.describe.relationship-lookup.selection-tab.title.orcidV2": "Search Results", + // "submission.sections.describe.relationship-lookup.selection-tab.title.orcid": "Search Results", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.selection-tab.title.orcidV2": "Search Results", + "submission.sections.describe.relationship-lookup.selection-tab.title.orcid": "Search Results", // "submission.sections.describe.relationship-lookup.selection-tab.title.lcname": "Search Results", // TODO New key - Add a translation diff --git a/src/assets/i18n/de.json5 b/src/assets/i18n/de.json5 index 56398af537..b68e3d583a 100644 --- a/src/assets/i18n/de.json5 +++ b/src/assets/i18n/de.json5 @@ -3437,8 +3437,8 @@ // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.lcname": "Importing from LC Name", "submission.sections.describe.relationship-lookup.external-source.import-modal.head.lcname": "Von LC Name importieren", - // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcidV2": "Importing from ORCID", - "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcidV2": "Von ORCID importieren", + // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcid": "Importing from ORCID", + "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcid": "Von ORCID importieren", // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.sherpaJournal": "Importing from Sherpa Journal", "submission.sections.describe.relationship-lookup.external-source.import-modal.head.sherpaJournal": "Von Sherpa Zeitschriften importieren", @@ -3521,8 +3521,8 @@ // "submission.sections.describe.relationship-lookup.search-tab.tab-title.sherpaPublisher": "Sherpa Publishers ({{ count }})", "submission.sections.describe.relationship-lookup.search-tab.tab-title.sherpaPublisher": "Sherpa Verlage ({{ count }})", - // "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcidV2": "ORCID ({{ count }})", - "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcidV2": "ORCID ({{ count }})", + // "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcid": "ORCID ({{ count }})", + "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcid": "ORCID ({{ count }})", // "submission.sections.describe.relationship-lookup.search-tab.tab-title.lcname": "LC Names ({{ count }})", "submission.sections.describe.relationship-lookup.search-tab.tab-title.lcname": "LC Namen ({{ count }})", @@ -3581,8 +3581,8 @@ // "submission.sections.describe.relationship-lookup.selection-tab.title.sherpaPublisher": "Search Results", "submission.sections.describe.relationship-lookup.selection-tab.title.sherpaPublisher": "Suchergebnisse", - // "submission.sections.describe.relationship-lookup.selection-tab.title.orcidV2": "Search Results", - "submission.sections.describe.relationship-lookup.selection-tab.title.orcidV2": "Suchergebnisse", + // "submission.sections.describe.relationship-lookup.selection-tab.title.orcid": "Search Results", + "submission.sections.describe.relationship-lookup.selection-tab.title.orcid": "Suchergebnisse", // "submission.sections.describe.relationship-lookup.selection-tab.title.lcname": "Search Results", "submission.sections.describe.relationship-lookup.selection-tab.title.lcname": "Suchergebnisse", diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index f01f5cbff1..c0c2293e10 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -2972,7 +2972,7 @@ "submission.import-external.source.sherpaPublisher": "SHERPA Publishers", - "submission.import-external.source.orcidV2": "ORCID", + "submission.import-external.source.orcid": "ORCID", "submission.import-external.source.pubmed": "Pubmed", @@ -3020,7 +3020,7 @@ "submission.sections.describe.relationship-lookup.external-source.import-modal.head.lcname": "Importing from LC Name", - "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcidV2": "Importing from ORCID", + "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcid": "Importing from ORCID", "submission.sections.describe.relationship-lookup.external-source.import-modal.head.sherpaJournal": "Importing from Sherpa Journal", @@ -3095,7 +3095,7 @@ "submission.sections.describe.relationship-lookup.search-tab.tab-title.sherpaPublisher": "Sherpa Publishers ({{ count }})", - "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcidV2": "ORCID ({{ count }})", + "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcid": "ORCID ({{ count }})", "submission.sections.describe.relationship-lookup.search-tab.tab-title.lcname": "LC Names ({{ count }})", @@ -3179,7 +3179,7 @@ "submission.sections.describe.relationship-lookup.selection-tab.title.sherpaPublisher": "Search Results", - "submission.sections.describe.relationship-lookup.selection-tab.title.orcidV2": "Search Results", + "submission.sections.describe.relationship-lookup.selection-tab.title.orcid": "Search Results", "submission.sections.describe.relationship-lookup.selection-tab.title.orcidv2": "Search Results", diff --git a/src/assets/i18n/es.json5 b/src/assets/i18n/es.json5 index 3e27fb3b04..4eeff3356c 100644 --- a/src/assets/i18n/es.json5 +++ b/src/assets/i18n/es.json5 @@ -3539,9 +3539,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.external-source.import-modal.head.lcname": "Importing from LC Name", - // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcidV2": "Importing from ORCID", + // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcid": "Importing from ORCID", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcidV2": "Importing from ORCID", + "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcid": "Importing from ORCID", // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.sherpaJournal": "Importing from Sherpa Journal", // TODO New key - Add a translation @@ -3651,9 +3651,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.search-tab.tab-title.sherpaPublisher": "Sherpa Publishers ({{ count }})", - // "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcidV2": "ORCID ({{ count }})", + // "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcid": "ORCID ({{ count }})", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcidV2": "ORCID ({{ count }})", + "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcid": "ORCID ({{ count }})", // "submission.sections.describe.relationship-lookup.search-tab.tab-title.lcname": "LC Names ({{ count }})", // TODO New key - Add a translation @@ -3731,9 +3731,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.selection-tab.title.sherpaPublisher": "Search Results", - // "submission.sections.describe.relationship-lookup.selection-tab.title.orcidV2": "Search Results", + // "submission.sections.describe.relationship-lookup.selection-tab.title.orcid": "Search Results", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.selection-tab.title.orcidV2": "Search Results", + "submission.sections.describe.relationship-lookup.selection-tab.title.orcid": "Search Results", // "submission.sections.describe.relationship-lookup.selection-tab.title.lcname": "Search Results", // TODO New key - Add a translation diff --git a/src/assets/i18n/fi.json5 b/src/assets/i18n/fi.json5 index a8556c4684..7253c526a6 100644 --- a/src/assets/i18n/fi.json5 +++ b/src/assets/i18n/fi.json5 @@ -3537,9 +3537,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.external-source.import-modal.head.lcname": "Importing from LC Name", - // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcidV2": "Importing from ORCID", + // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcid": "Importing from ORCID", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcidV2": "Importing from ORCID", + "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcid": "Importing from ORCID", // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.sherpaJournal": "Importing from Sherpa Journal", // TODO New key - Add a translation @@ -3649,9 +3649,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.search-tab.tab-title.sherpaPublisher": "Sherpa Publishers ({{ count }})", - // "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcidV2": "ORCID ({{ count }})", + // "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcid": "ORCID ({{ count }})", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcidV2": "ORCID ({{ count }})", + "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcid": "ORCID ({{ count }})", // "submission.sections.describe.relationship-lookup.search-tab.tab-title.lcname": "LC Names ({{ count }})", // TODO New key - Add a translation @@ -3729,9 +3729,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.selection-tab.title.sherpaPublisher": "Search Results", - // "submission.sections.describe.relationship-lookup.selection-tab.title.orcidV2": "Search Results", + // "submission.sections.describe.relationship-lookup.selection-tab.title.orcid": "Search Results", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.selection-tab.title.orcidV2": "Search Results", + "submission.sections.describe.relationship-lookup.selection-tab.title.orcid": "Search Results", // "submission.sections.describe.relationship-lookup.selection-tab.title.lcname": "Search Results", // TODO New key - Add a translation diff --git a/src/assets/i18n/fr.json5 b/src/assets/i18n/fr.json5 index 24d0726a68..28436e0eb9 100644 --- a/src/assets/i18n/fr.json5 +++ b/src/assets/i18n/fr.json5 @@ -3541,9 +3541,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.external-source.import-modal.head.lcname": "Importing from LC Name", - // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcidV2": "Importing from ORCID", + // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcid": "Importing from ORCID", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcidV2": "Importing from ORCID", + "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcid": "Importing from ORCID", // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.sherpaJournal": "Importing from Sherpa Journal", // TODO New key - Add a translation @@ -3653,9 +3653,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.search-tab.tab-title.sherpaPublisher": "Sherpa Publishers ({{ count }})", - // "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcidV2": "ORCID ({{ count }})", + // "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcid": "ORCID ({{ count }})", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcidV2": "ORCID ({{ count }})", + "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcid": "ORCID ({{ count }})", // "submission.sections.describe.relationship-lookup.search-tab.tab-title.lcname": "LC Names ({{ count }})", // TODO New key - Add a translation @@ -3733,9 +3733,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.selection-tab.title.sherpaPublisher": "Search Results", - // "submission.sections.describe.relationship-lookup.selection-tab.title.orcidV2": "Search Results", + // "submission.sections.describe.relationship-lookup.selection-tab.title.orcid": "Search Results", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.selection-tab.title.orcidV2": "Search Results", + "submission.sections.describe.relationship-lookup.selection-tab.title.orcid": "Search Results", // "submission.sections.describe.relationship-lookup.selection-tab.title.lcname": "Search Results", // TODO New key - Add a translation diff --git a/src/assets/i18n/ja.json5 b/src/assets/i18n/ja.json5 index d7afa97f08..a2a7042d33 100644 --- a/src/assets/i18n/ja.json5 +++ b/src/assets/i18n/ja.json5 @@ -4210,9 +4210,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.external-source.import-modal.head.lcname": "Importing from LC Name", - // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcidV2": "Importing from ORCID", + // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcid": "Importing from ORCID", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcidV2": "Importing from ORCID", + "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcid": "Importing from ORCID", // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.sherpaJournal": "Importing from Sherpa Journal", // TODO New key - Add a translation @@ -4322,9 +4322,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.search-tab.tab-title.sherpaPublisher": "Sherpa Publishers ({{ count }})", - // "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcidV2": "ORCID ({{ count }})", + // "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcid": "ORCID ({{ count }})", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcidV2": "ORCID ({{ count }})", + "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcid": "ORCID ({{ count }})", // "submission.sections.describe.relationship-lookup.search-tab.tab-title.lcname": "LC Names ({{ count }})", // TODO New key - Add a translation @@ -4402,9 +4402,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.selection-tab.title.sherpaPublisher": "Search Results", - // "submission.sections.describe.relationship-lookup.selection-tab.title.orcidV2": "Search Results", + // "submission.sections.describe.relationship-lookup.selection-tab.title.orcid": "Search Results", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.selection-tab.title.orcidV2": "Search Results", + "submission.sections.describe.relationship-lookup.selection-tab.title.orcid": "Search Results", // "submission.sections.describe.relationship-lookup.selection-tab.title.lcname": "Search Results", // TODO New key - Add a translation diff --git a/src/assets/i18n/lv.json5 b/src/assets/i18n/lv.json5 index 4ad07d7ae9..b88db9d93a 100644 --- a/src/assets/i18n/lv.json5 +++ b/src/assets/i18n/lv.json5 @@ -3340,8 +3340,8 @@ // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.lcname": "Importing from LC Name", "submission.sections.describe.relationship-lookup.external-source.import-modal.head.lcname": "Importē no LC Nosaukuma", - // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcidV2": "Importing from ORCID", - "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcidV2": "Importē no ORCID", + // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcid": "Importing from ORCID", + "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcid": "Importē no ORCID", // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.sherpaJournal": "Importing from Sherpa Journal", "submission.sections.describe.relationship-lookup.external-source.import-modal.head.sherpaJournal": "Importē no Sherpa Žurnāla", @@ -3424,8 +3424,8 @@ // "submission.sections.describe.relationship-lookup.search-tab.tab-title.sherpaPublisher": "Sherpa Publishers ({{ count }})", "submission.sections.describe.relationship-lookup.search-tab.tab-title.sherpaPublisher": "Sherpa Izdevēji ({{ count }})", - // "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcidV2": "ORCID ({{ count }})", - "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcidV2": "ORCID ({{ count }})", + // "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcid": "ORCID ({{ count }})", + "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcid": "ORCID ({{ count }})", // "submission.sections.describe.relationship-lookup.search-tab.tab-title.lcname": "LC Names ({{ count }})", "submission.sections.describe.relationship-lookup.search-tab.tab-title.lcname": "LC Nosaukumi ({{ count }})", @@ -3484,8 +3484,8 @@ // "submission.sections.describe.relationship-lookup.selection-tab.title.sherpaPublisher": "Search Results", "submission.sections.describe.relationship-lookup.selection-tab.title.sherpaPublisher": "Meklēšanas rezultāti", - // "submission.sections.describe.relationship-lookup.selection-tab.title.orcidV2": "Search Results", - "submission.sections.describe.relationship-lookup.selection-tab.title.orcidV2": "Meklēšanas rezultāti", + // "submission.sections.describe.relationship-lookup.selection-tab.title.orcid": "Search Results", + "submission.sections.describe.relationship-lookup.selection-tab.title.orcid": "Meklēšanas rezultāti", // "submission.sections.describe.relationship-lookup.selection-tab.title.lcname": "Search Results", "submission.sections.describe.relationship-lookup.selection-tab.title.lcname": "Meklēšanas rezultāti", diff --git a/src/assets/i18n/nl.json5 b/src/assets/i18n/nl.json5 index 4fd9f444e6..2959bccef9 100644 --- a/src/assets/i18n/nl.json5 +++ b/src/assets/i18n/nl.json5 @@ -3536,9 +3536,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.external-source.import-modal.head.lcname": "Importing from LC Name", - // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcidV2": "Importing from ORCID", + // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcid": "Importing from ORCID", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcidV2": "Importing from ORCID", + "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcid": "Importing from ORCID", // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.sherpaJournal": "Importing from Sherpa Journal", // TODO New key - Add a translation @@ -3648,9 +3648,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.search-tab.tab-title.sherpaPublisher": "Sherpa Publishers ({{ count }})", - // "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcidV2": "ORCID ({{ count }})", + // "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcid": "ORCID ({{ count }})", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcidV2": "ORCID ({{ count }})", + "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcid": "ORCID ({{ count }})", // "submission.sections.describe.relationship-lookup.search-tab.tab-title.lcname": "LC Names ({{ count }})", // TODO New key - Add a translation @@ -3728,9 +3728,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.selection-tab.title.sherpaPublisher": "Search Results", - // "submission.sections.describe.relationship-lookup.selection-tab.title.orcidV2": "Search Results", + // "submission.sections.describe.relationship-lookup.selection-tab.title.orcid": "Search Results", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.selection-tab.title.orcidV2": "Search Results", + "submission.sections.describe.relationship-lookup.selection-tab.title.orcid": "Search Results", // "submission.sections.describe.relationship-lookup.selection-tab.title.lcname": "Search Results", // TODO New key - Add a translation diff --git a/src/assets/i18n/pl.json5 b/src/assets/i18n/pl.json5 index d7afa97f08..a2a7042d33 100644 --- a/src/assets/i18n/pl.json5 +++ b/src/assets/i18n/pl.json5 @@ -4210,9 +4210,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.external-source.import-modal.head.lcname": "Importing from LC Name", - // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcidV2": "Importing from ORCID", + // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcid": "Importing from ORCID", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcidV2": "Importing from ORCID", + "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcid": "Importing from ORCID", // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.sherpaJournal": "Importing from Sherpa Journal", // TODO New key - Add a translation @@ -4322,9 +4322,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.search-tab.tab-title.sherpaPublisher": "Sherpa Publishers ({{ count }})", - // "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcidV2": "ORCID ({{ count }})", + // "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcid": "ORCID ({{ count }})", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcidV2": "ORCID ({{ count }})", + "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcid": "ORCID ({{ count }})", // "submission.sections.describe.relationship-lookup.search-tab.tab-title.lcname": "LC Names ({{ count }})", // TODO New key - Add a translation @@ -4402,9 +4402,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.selection-tab.title.sherpaPublisher": "Search Results", - // "submission.sections.describe.relationship-lookup.selection-tab.title.orcidV2": "Search Results", + // "submission.sections.describe.relationship-lookup.selection-tab.title.orcid": "Search Results", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.selection-tab.title.orcidV2": "Search Results", + "submission.sections.describe.relationship-lookup.selection-tab.title.orcid": "Search Results", // "submission.sections.describe.relationship-lookup.selection-tab.title.lcname": "Search Results", // TODO New key - Add a translation diff --git a/src/assets/i18n/pt.json5 b/src/assets/i18n/pt.json5 index da71ddec11..1ebcbd0606 100644 --- a/src/assets/i18n/pt.json5 +++ b/src/assets/i18n/pt.json5 @@ -3536,9 +3536,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.external-source.import-modal.head.lcname": "Importing from LC Name", - // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcidV2": "Importing from ORCID", + // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcid": "Importing from ORCID", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcidV2": "Importing from ORCID", + "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcid": "Importing from ORCID", // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.sherpaJournal": "Importing from Sherpa Journal", // TODO New key - Add a translation @@ -3648,9 +3648,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.search-tab.tab-title.sherpaPublisher": "Sherpa Publishers ({{ count }})", - // "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcidV2": "ORCID ({{ count }})", + // "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcid": "ORCID ({{ count }})", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcidV2": "ORCID ({{ count }})", + "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcid": "ORCID ({{ count }})", // "submission.sections.describe.relationship-lookup.search-tab.tab-title.lcname": "LC Names ({{ count }})", // TODO New key - Add a translation @@ -3728,9 +3728,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.selection-tab.title.sherpaPublisher": "Search Results", - // "submission.sections.describe.relationship-lookup.selection-tab.title.orcidV2": "Search Results", + // "submission.sections.describe.relationship-lookup.selection-tab.title.orcid": "Search Results", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.selection-tab.title.orcidV2": "Search Results", + "submission.sections.describe.relationship-lookup.selection-tab.title.orcid": "Search Results", // "submission.sections.describe.relationship-lookup.selection-tab.title.lcname": "Search Results", // TODO New key - Add a translation diff --git a/src/assets/i18n/sw.json5 b/src/assets/i18n/sw.json5 index d7afa97f08..a2a7042d33 100644 --- a/src/assets/i18n/sw.json5 +++ b/src/assets/i18n/sw.json5 @@ -4210,9 +4210,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.external-source.import-modal.head.lcname": "Importing from LC Name", - // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcidV2": "Importing from ORCID", + // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcid": "Importing from ORCID", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcidV2": "Importing from ORCID", + "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcid": "Importing from ORCID", // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.sherpaJournal": "Importing from Sherpa Journal", // TODO New key - Add a translation @@ -4322,9 +4322,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.search-tab.tab-title.sherpaPublisher": "Sherpa Publishers ({{ count }})", - // "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcidV2": "ORCID ({{ count }})", + // "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcid": "ORCID ({{ count }})", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcidV2": "ORCID ({{ count }})", + "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcid": "ORCID ({{ count }})", // "submission.sections.describe.relationship-lookup.search-tab.tab-title.lcname": "LC Names ({{ count }})", // TODO New key - Add a translation @@ -4402,9 +4402,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.selection-tab.title.sherpaPublisher": "Search Results", - // "submission.sections.describe.relationship-lookup.selection-tab.title.orcidV2": "Search Results", + // "submission.sections.describe.relationship-lookup.selection-tab.title.orcid": "Search Results", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.selection-tab.title.orcidV2": "Search Results", + "submission.sections.describe.relationship-lookup.selection-tab.title.orcid": "Search Results", // "submission.sections.describe.relationship-lookup.selection-tab.title.lcname": "Search Results", // TODO New key - Add a translation diff --git a/src/assets/i18n/tr.json5 b/src/assets/i18n/tr.json5 index d7afa97f08..a2a7042d33 100644 --- a/src/assets/i18n/tr.json5 +++ b/src/assets/i18n/tr.json5 @@ -4210,9 +4210,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.external-source.import-modal.head.lcname": "Importing from LC Name", - // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcidV2": "Importing from ORCID", + // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcid": "Importing from ORCID", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcidV2": "Importing from ORCID", + "submission.sections.describe.relationship-lookup.external-source.import-modal.head.orcid": "Importing from ORCID", // "submission.sections.describe.relationship-lookup.external-source.import-modal.head.sherpaJournal": "Importing from Sherpa Journal", // TODO New key - Add a translation @@ -4322,9 +4322,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.search-tab.tab-title.sherpaPublisher": "Sherpa Publishers ({{ count }})", - // "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcidV2": "ORCID ({{ count }})", + // "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcid": "ORCID ({{ count }})", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcidV2": "ORCID ({{ count }})", + "submission.sections.describe.relationship-lookup.search-tab.tab-title.orcid": "ORCID ({{ count }})", // "submission.sections.describe.relationship-lookup.search-tab.tab-title.lcname": "LC Names ({{ count }})", // TODO New key - Add a translation @@ -4402,9 +4402,9 @@ // TODO New key - Add a translation "submission.sections.describe.relationship-lookup.selection-tab.title.sherpaPublisher": "Search Results", - // "submission.sections.describe.relationship-lookup.selection-tab.title.orcidV2": "Search Results", + // "submission.sections.describe.relationship-lookup.selection-tab.title.orcid": "Search Results", // TODO New key - Add a translation - "submission.sections.describe.relationship-lookup.selection-tab.title.orcidV2": "Search Results", + "submission.sections.describe.relationship-lookup.selection-tab.title.orcid": "Search Results", // "submission.sections.describe.relationship-lookup.selection-tab.title.lcname": "Search Results", // TODO New key - Add a translation From bc0b0a26c99da86c6a1361c2a1d73b3529aa17c9 Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Tue, 24 Nov 2020 10:56:58 -0600 Subject: [PATCH 08/16] Initial GitHub Actions CI settings. Rename docker-compose-travis to docker-compose-ci --- .github/workflows/build.yml | 80 +++++++++++++++++++ ...mpose-travis.yml => docker-compose-ci.yml} | 1 + 2 files changed, 81 insertions(+) create mode 100644 .github/workflows/build.yml rename docker/{docker-compose-travis.yml => docker-compose-ci.yml} (94%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..41986cf2f3 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,80 @@ +# DSpace Continuous Integration/Build via GitHub Actions +# Concepts borrowed from +# https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-nodejs +name: Build + +# Run this Build only for pushes / PRs to main branch +on: [push, pull_request] +# push: +# branches: main +# pull_request: +# branches: main + +jobs: + build: + runs-on: ubuntu-latest + env: + # The ci step will test the dspace-angular code against DSpace REST. + # Direct that step to utilize a DSpace REST service that has been started in docker. + DSPACE_REST_HOST: localhost + DSPACE_REST_PORT: 8080 + DSPACE_REST_NAMESPACE: '/server' + DSPACE_REST_SSL: false + strategy: + # Create a matrix of Node versions to test against (in parallel) + matrix: + node-version: [10.x, 12.x] + # Do NOT exit immediately if one matrix job fails + fail-fast: false + # These are the actual CI steps to perform per job + steps: + # https://github.com/actions/checkout + - name: Checkout codebase + uses: actions/checkout@v2 + # https://github.com/actions/setup-node + - name: Install Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: Install latest Chrome (for e2e tests) + run: | + sudo apt-get update + sudo apt-get --only-upgrade install google-chrome-stable -y + google-chrome --version + # https://github.com/actions/cache/blob/main/examples.md#node---yarn + - name: Get Yarn cache directory + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + - name: Cache Yarn dependencies + uses: actions/cache@v2 + with: + # Cache entire Yarn cache directory (see previous step) + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + # Cache key is hash of yarn.lock. Therefore changes to yarn.lock will invalidate cache + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: ${{ runner.os }}-yarn- + - name: Install Yarn dependencies + run: yarn install --frozen-lockfile + - name: Run lint + run: yarn run lint + - name: Run build + run: yarn run build:prod + - name: Run specs (unit tests) + run: yarn run test:headless + # NOTE: Angular CLI only supports code coverage for specs. See https://github.com/angular/angular-cli/issues/6286 + # Upload coverage reports to Codecov (for Node v12 only) + # https://github.com/codecov/codecov-action + - name: Upload coverage to Codecov.io + uses: codecov/codecov-action@v1 + if: matrix.node-version == '12.x' + # Using docker-compose start backend using CI configuration + # and load assetstore from a cached copy + - name: Start DSpace REST Backend via Docker (for e2e tests) + run: | + docker-compose -f ./docker/docker-compose-ci.yml up -d + docker-compose -f ./docker/cli.yml -f ./docker/cli.assetstore.yml run --rm dspace-cli + docker container ls + - name: Run e2e tests (integration tests) + run: yarn run e2e:ci + - name: Shutdown Docker containers + run: docker-compose -f ./docker/docker-compose-ci.yml down diff --git a/docker/docker-compose-travis.yml b/docker/docker-compose-ci.yml similarity index 94% rename from docker/docker-compose-travis.yml rename to docker/docker-compose-ci.yml index f0f5ef70e8..f440454bb6 100644 --- a/docker/docker-compose-travis.yml +++ b/docker/docker-compose-ci.yml @@ -1,3 +1,4 @@ +# Docker Compose for running the DSpace backend for e2e testing in CI networks: dspacenet: services: From 8d526f0e80f7e717d79e75a3a74ff54994ee998b Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Tue, 24 Nov 2020 16:03:22 -0600 Subject: [PATCH 09/16] Move codecov reports to last step --- .github/workflows/build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 41986cf2f3..d57c941a58 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -61,12 +61,6 @@ jobs: run: yarn run build:prod - name: Run specs (unit tests) run: yarn run test:headless - # NOTE: Angular CLI only supports code coverage for specs. See https://github.com/angular/angular-cli/issues/6286 - # Upload coverage reports to Codecov (for Node v12 only) - # https://github.com/codecov/codecov-action - - name: Upload coverage to Codecov.io - uses: codecov/codecov-action@v1 - if: matrix.node-version == '12.x' # Using docker-compose start backend using CI configuration # and load assetstore from a cached copy - name: Start DSpace REST Backend via Docker (for e2e tests) @@ -78,3 +72,9 @@ jobs: run: yarn run e2e:ci - name: Shutdown Docker containers run: docker-compose -f ./docker/docker-compose-ci.yml down + # NOTE: Angular CLI only supports code coverage for specs. See https://github.com/angular/angular-cli/issues/6286 + # Upload coverage reports to Codecov (for Node v12 only) + # https://github.com/codecov/codecov-action + - name: Upload coverage to Codecov.io + uses: codecov/codecov-action@v1 + if: matrix.node-version == '12.x' From b036c084b71a10423aadca4a3decb888cdc51078 Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Tue, 24 Nov 2020 16:38:07 -0600 Subject: [PATCH 10/16] Try codecov bash uploader to see if it works --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d57c941a58..e4ede2aecc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -76,5 +76,6 @@ jobs: # Upload coverage reports to Codecov (for Node v12 only) # https://github.com/codecov/codecov-action - name: Upload coverage to Codecov.io - uses: codecov/codecov-action@v1 + #uses: codecov/codecov-action@v1 + run: bash <(curl -s https://codecov.io/bash) if: matrix.node-version == '12.x' From e32b435edd5057fb9300d066e7c6f44bc94664df Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Tue, 24 Nov 2020 17:07:49 -0600 Subject: [PATCH 11/16] Remove .travis.yml Minor comment cleanup to build.yml --- .github/workflows/build.yml | 2 -- .travis.yml | 66 ------------------------------------- 2 files changed, 68 deletions(-) delete mode 100644 .travis.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e4ede2aecc..7b6bd26e3a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -74,8 +74,6 @@ jobs: run: docker-compose -f ./docker/docker-compose-ci.yml down # NOTE: Angular CLI only supports code coverage for specs. See https://github.com/angular/angular-cli/issues/6286 # Upload coverage reports to Codecov (for Node v12 only) - # https://github.com/codecov/codecov-action - name: Upload coverage to Codecov.io - #uses: codecov/codecov-action@v1 run: bash <(curl -s https://codecov.io/bash) if: matrix.node-version == '12.x' diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index db3b49ccdf..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,66 +0,0 @@ -os: linux -dist: bionic -language: node_js - -# Enable caching for yarn & node_modules -cache: - yarn: true - -node_js: - - "10" - - "12" - -# Install latest chrome (for e2e headless testing). Run an update if needed. -addons: - apt: - sources: - - google-chrome - packages: - - google-chrome-stable - update: true - -env: - # The ci step will test the dspace-angular code against DSpace REST. - # Direct that step to utilize a DSpace REST service that has been started in docker. - DSPACE_REST_HOST: localhost - DSPACE_REST_PORT: 8080 - DSPACE_REST_NAMESPACE: '/server' - DSPACE_REST_SSL: false - -before_install: - # Check our versions of everything - - echo "Check versions" - - yarn -v - - docker-compose -v - - google-chrome-stable --version - -install: - # Start up a test DSpace 7 REST backend using the entities database dump - - docker-compose -f ./docker/docker-compose-travis.yml up -d - # Use the dspace-cli image to populate the assetstore. Triggers a discovery and oai update - - docker-compose -f ./docker/cli.yml -f ./docker/cli.assetstore.yml run --rm dspace-cli - # Install all local dependencies (retry if initially fails) - - travis_retry yarn install - -before_script: - - echo "Check Docker containers" - - docker container ls - # The following line could be enabled to verify that the rest server is responding. - #- echo "Check REST API available (via Docker)" - #- curl http://localhost:8080/server/ - -script: - # build app and run all tests - - ng lint || travis_terminate 1; - - travis_wait yarn run build:prod || travis_terminate 1; - - yarn test:headless || travis_terminate 1; - - yarn run e2e:ci || travis_terminate 1; - -after_script: - # Shutdown docker after everything runs - - docker-compose -f ./docker/docker-compose-travis.yml down - -# After a successful build and test (see 'script'), send code coverage reports to codecov.io -# NOTE: As there's no need to send coverage multiple times, we only run this for one version of node. -after_success: - - if [ "$TRAVIS_NODE_VERSION" = "12" ]; then bash <(curl -s https://codecov.io/bash); fi From d241d4ea6a5948fd917c2fc8859f8d2d7cae5344 Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Wed, 25 Nov 2020 08:27:25 -0600 Subject: [PATCH 12/16] Revert to checkout@v1 per https://community.codecov.io/t/codecov-status-stuck-at-waiting-for-status-to-be-reported-on-github/341/40 --- .github/workflows/build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7b6bd26e3a..6f5f56584f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,7 +30,7 @@ jobs: steps: # https://github.com/actions/checkout - name: Checkout codebase - uses: actions/checkout@v2 + uses: actions/checkout@v1 # https://github.com/actions/setup-node - name: Install Node.js ${{ matrix.node-version }} uses: actions/setup-node@v1 @@ -74,6 +74,7 @@ jobs: run: docker-compose -f ./docker/docker-compose-ci.yml down # NOTE: Angular CLI only supports code coverage for specs. See https://github.com/angular/angular-cli/issues/6286 # Upload coverage reports to Codecov (for Node v12 only) + # https://github.com/codecov/codecov-action - name: Upload coverage to Codecov.io - run: bash <(curl -s https://codecov.io/bash) + uses: codecov/codecov-action@v1 if: matrix.node-version == '12.x' From 49effd14dfbd470f5e267d0e95d1470cc1c44a4f Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Wed, 25 Nov 2020 08:58:38 -0600 Subject: [PATCH 13/16] Rename job to "tests". Space out steps to make it easier to read. --- .github/workflows/build.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6f5f56584f..3894b445ac 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ on: [push, pull_request] # branches: main jobs: - build: + tests: runs-on: ubuntu-latest env: # The ci step will test the dspace-angular code against DSpace REST. @@ -31,16 +31,19 @@ jobs: # https://github.com/actions/checkout - name: Checkout codebase uses: actions/checkout@v1 + # https://github.com/actions/setup-node - name: Install Node.js ${{ matrix.node-version }} uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} + - name: Install latest Chrome (for e2e tests) run: | sudo apt-get update sudo apt-get --only-upgrade install google-chrome-stable -y google-chrome --version + # https://github.com/actions/cache/blob/main/examples.md#node---yarn - name: Get Yarn cache directory id: yarn-cache-dir-path @@ -53,14 +56,19 @@ jobs: # Cache key is hash of yarn.lock. Therefore changes to yarn.lock will invalidate cache key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: ${{ runner.os }}-yarn- + - name: Install Yarn dependencies run: yarn install --frozen-lockfile + - name: Run lint run: yarn run lint + - name: Run build run: yarn run build:prod + - name: Run specs (unit tests) run: yarn run test:headless + # Using docker-compose start backend using CI configuration # and load assetstore from a cached copy - name: Start DSpace REST Backend via Docker (for e2e tests) @@ -68,10 +76,13 @@ jobs: docker-compose -f ./docker/docker-compose-ci.yml up -d docker-compose -f ./docker/cli.yml -f ./docker/cli.assetstore.yml run --rm dspace-cli docker container ls + - name: Run e2e tests (integration tests) run: yarn run e2e:ci + - name: Shutdown Docker containers run: docker-compose -f ./docker/docker-compose-ci.yml down + # NOTE: Angular CLI only supports code coverage for specs. See https://github.com/angular/angular-cli/issues/6286 # Upload coverage reports to Codecov (for Node v12 only) # https://github.com/codecov/codecov-action From 3f1266e485aad7d4d86697e719117292ed7c17cd Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Wed, 25 Nov 2020 09:26:43 -0600 Subject: [PATCH 14/16] Enable only for main branch pushes or PRs --- .github/workflows/build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3894b445ac..23fd346953 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,11 +4,11 @@ name: Build # Run this Build only for pushes / PRs to main branch -on: [push, pull_request] -# push: -# branches: main -# pull_request: -# branches: main +on: + push: + branches: main + pull_request: + branches: main jobs: tests: From 0bfa425e576a517e66986c3c5f639da37be74af4 Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Wed, 25 Nov 2020 17:08:20 -0600 Subject: [PATCH 15/16] Update build status badge to point to GitHub --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8fec7f404e..4b4c7dc6cf 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.com/DSpace/dspace-angular.svg?branch=main)](https://travis-ci.com/DSpace/dspace-angular) [![Coverage Status](https://codecov.io/gh/DSpace/dspace-angular/branch/main/graph/badge.svg)](https://codecov.io/gh/DSpace/dspace-angular) [![Universal Angular](https://img.shields.io/badge/universal-angular2-brightgreen.svg?style=flat)](https://github.com/angular/universal) +[![Build Status](https://github.com/DSpace/dspace-angular/workflows/Build/badge.svg?branch=main)](https://github.com/DSpace/dspace-angular/actions?query=workflow%3ABuild) [![Coverage Status](https://codecov.io/gh/DSpace/dspace-angular/branch/main/graph/badge.svg)](https://codecov.io/gh/DSpace/dspace-angular) [![Universal Angular](https://img.shields.io/badge/universal-angular2-brightgreen.svg?style=flat)](https://github.com/angular/universal) dspace-angular ============== From 96d7f9c2d70baa5ad560df73968c519140dbd172 Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Mon, 30 Nov 2020 10:12:02 -0600 Subject: [PATCH 16/16] Update build.yml to not limit by branch --- .github/workflows/build.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 23fd346953..5c418704b3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,12 +3,8 @@ # https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-nodejs name: Build -# Run this Build only for pushes / PRs to main branch -on: - push: - branches: main - pull_request: - branches: main +# Run this Build for all pushes / PRs to current branch +on: [push, pull_request] jobs: tests: