From 16bad8256475dd351bd8ee9146a2a3ef2d487813 Mon Sep 17 00:00:00 2001 From: Kristof De Langhe Date: Thu, 6 Jun 2019 18:00:54 +0200 Subject: [PATCH 01/18] 62741: Entities grid templates - publication, orgunit, person, project --- .../orgunit-grid-element.component.html | 33 +++++++++++++++++ .../orgunit-grid-element.component.scss | 0 .../orgunit-grid-element.component.spec.ts | 0 .../orgunit/orgunit-grid-element.component.ts | 14 +++++++ .../person/person-grid-element.component.html | 30 +++++++++++++++ .../person/person-grid-element.component.scss | 0 .../person-grid-element.component.spec.ts | 0 .../person/person-grid-element.component.ts | 14 +++++++ .../project-grid-element.component.html | 25 +++++++++++++ .../project-grid-element.component.scss | 0 .../project-grid-element.component.spec.ts | 0 .../project/project-grid-element.component.ts | 14 +++++++ .../research-entities.module.ts | 8 +++- src/app/shared/items/item-type-decorator.ts | 1 + .../grid-thumbnail.component.html | 3 +- .../grid-thumbnail.component.ts | 18 +++++++-- .../publication-grid-element.component.html | 34 +++++++++++++++++ .../publication-grid-element.component.scss | 0 ...publication-grid-element.component.spec.ts | 0 .../publication-grid-element.component.ts | 15 ++++++++ ...arch-result-grid-element.component.spec.ts | 0 ...em-search-result-grid-element.component.ts | 37 +++++++++++++++++++ ...-search-result-grid-element.component.html | 34 +---------------- ...em-search-result-grid-element.component.ts | 5 ++- .../search-result-grid-element.component.ts | 7 +++- ...em-search-result-list-element.component.ts | 2 +- .../item-type-badge.component.html | 3 ++ .../item-type-badge.component.ts | 10 +++++ ...-search-result-list-element.component.html | 4 +- src/app/shared/shared.module.ts | 8 +++- 30 files changed, 271 insertions(+), 48 deletions(-) create mode 100644 src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.html create mode 100644 src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.scss create mode 100644 src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.spec.ts create mode 100644 src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.ts create mode 100644 src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.html create mode 100644 src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.scss create mode 100644 src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.spec.ts create mode 100644 src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.ts create mode 100644 src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.html create mode 100644 src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.scss create mode 100644 src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.spec.ts create mode 100644 src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.ts create mode 100644 src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.html create mode 100644 src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.scss create mode 100644 src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.spec.ts create mode 100644 src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.ts create mode 100644 src/app/shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component.spec.ts create mode 100644 src/app/shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component.ts create mode 100644 src/app/shared/object-list/item-type-badge/item-type-badge.component.html create mode 100644 src/app/shared/object-list/item-type-badge/item-type-badge.component.ts diff --git a/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.html b/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.html new file mode 100644 index 0000000000..afb7f8da09 --- /dev/null +++ b/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.html @@ -0,0 +1,33 @@ + +
+ +
+ + +
+
+
+ + +

+
+

+ + + +

+

+ + {{dso.firstMetadataValue('orgunit.identifier.country')}} + , + {{dso.firstMetadataValue('orgunit.identifier.city')}} + +

+
+ View +
+
+
+
diff --git a/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.scss b/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.scss new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.spec.ts b/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.spec.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.ts b/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.ts new file mode 100644 index 0000000000..f0c87eb975 --- /dev/null +++ b/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.ts @@ -0,0 +1,14 @@ +import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator'; +import { Component } from '@angular/core'; +import { focusShadow } from '../../../../shared/animations/focus'; +import { TypedItemSearchResultGridElementComponent } from '../../../../shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component'; + +@rendersItemType('OrgUnit', ItemViewMode.Card) +@Component({ + selector: 'ds-orgunit-grid-element', + styleUrls: ['./orgunit-grid-element.component.scss'], + templateUrl: './orgunit-grid-element.component.html', + animations: [focusShadow] +}) +export class OrgunitGridElementComponent extends TypedItemSearchResultGridElementComponent { +} diff --git a/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.html b/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.html new file mode 100644 index 0000000000..05f1eefda1 --- /dev/null +++ b/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.html @@ -0,0 +1,30 @@ + +
+ +
+ + +
+
+
+ + +

+
+ +

+ + + +

+
+ View +
+
+
+
diff --git a/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.scss b/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.scss new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.spec.ts b/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.spec.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.ts b/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.ts new file mode 100644 index 0000000000..3ec17c9ce5 --- /dev/null +++ b/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.ts @@ -0,0 +1,14 @@ +import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator'; +import { Component } from '@angular/core'; +import { TypedItemSearchResultGridElementComponent } from '../../../../shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component'; +import { focusShadow } from '../../../../shared/animations/focus'; + +@rendersItemType('Person', ItemViewMode.Card) +@Component({ + selector: 'ds-person-grid-element', + styleUrls: ['./person-grid-element.component.scss'], + templateUrl: './person-grid-element.component.html', + animations: [focusShadow] +}) +export class PersonGridElementComponent extends TypedItemSearchResultGridElementComponent { +} diff --git a/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.html b/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.html new file mode 100644 index 0000000000..f01f0334d3 --- /dev/null +++ b/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.html @@ -0,0 +1,25 @@ + +
+ +
+ + +
+
+
+ + +

+
+

+ + + +

+
+ View +
+
+
+
diff --git a/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.scss b/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.scss new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.spec.ts b/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.spec.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.ts b/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.ts new file mode 100644 index 0000000000..be246f0fbe --- /dev/null +++ b/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.ts @@ -0,0 +1,14 @@ +import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator'; +import { Component } from '@angular/core'; +import { focusShadow } from '../../../../shared/animations/focus'; +import { TypedItemSearchResultGridElementComponent } from '../../../../shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component'; + +@rendersItemType('Project', ItemViewMode.Card) +@Component({ + selector: 'ds-project-grid-element', + styleUrls: ['./project-grid-element.component.scss'], + templateUrl: './project-grid-element.component.html', + animations: [focusShadow] +}) +export class ProjectGridElementComponent extends TypedItemSearchResultGridElementComponent { +} diff --git a/src/app/entity-groups/research-entities/research-entities.module.ts b/src/app/entity-groups/research-entities/research-entities.module.ts index ba28f174df..099fa2a6a3 100644 --- a/src/app/entity-groups/research-entities/research-entities.module.ts +++ b/src/app/entity-groups/research-entities/research-entities.module.ts @@ -11,6 +11,9 @@ import { PersonMetadataListElementComponent } from './item-list-elements/person/ import { PersonListElementComponent } from './item-list-elements/person/person-list-element.component'; import { ProjectListElementComponent } from './item-list-elements/project/project-list-element.component'; import { TooltipModule } from 'ngx-bootstrap'; +import { PersonGridElementComponent } from './item-grid-elements/person/person-grid-element.component'; +import { OrgunitGridElementComponent } from './item-grid-elements/orgunit/orgunit-grid-element.component'; +import { ProjectGridElementComponent } from './item-grid-elements/project/project-grid-element.component'; const ENTRY_COMPONENTS = [ OrgunitComponent, @@ -20,7 +23,10 @@ const ENTRY_COMPONENTS = [ OrgUnitMetadataListElementComponent, PersonListElementComponent, PersonMetadataListElementComponent, - ProjectListElementComponent + ProjectListElementComponent, + PersonGridElementComponent, + OrgunitGridElementComponent, + ProjectGridElementComponent ]; @NgModule({ diff --git a/src/app/shared/items/item-type-decorator.ts b/src/app/shared/items/item-type-decorator.ts index 2420e71908..3a040ae5bf 100644 --- a/src/app/shared/items/item-type-decorator.ts +++ b/src/app/shared/items/item-type-decorator.ts @@ -3,6 +3,7 @@ import { MetadataRepresentationType } from '../../core/shared/metadata-represent export enum ItemViewMode { Element = 'element', + Card = 'card', Full = 'full', Metadata = 'metadata' } diff --git a/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.html b/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.html index c0c3c1f65f..5b09d09a55 100644 --- a/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.html +++ b/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.html @@ -1,4 +1,3 @@
- - +
diff --git a/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.ts b/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.ts index 8ca93470da..6ae0c2d37e 100644 --- a/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.ts +++ b/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.ts @@ -1,5 +1,6 @@ -import { Component, Input } from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; import { Bitstream } from '../../../core/shared/bitstream.model'; +import { hasValue } from '../../empty.util'; /** * This component renders a given Bitstream as a thumbnail. @@ -12,7 +13,7 @@ import { Bitstream } from '../../../core/shared/bitstream.model'; styleUrls: ['./grid-thumbnail.component.scss'], templateUrl: './grid-thumbnail.component.html' }) -export class GridThumbnailComponent { +export class GridThumbnailComponent implements OnInit { @Input() thumbnail: Bitstream; @@ -21,10 +22,19 @@ export class GridThumbnailComponent { /** * The default 'holder.js' image */ - holderSource = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMjYwIiBoZWlnaHQ9IjE4MCIgdmlld0JveD0iMCAwIDI2MCAxODAiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiPjwhLS0KU291cmNlIFVSTDogaG9sZGVyLmpzLzEwMCV4MTgwL3RleHQ6Tm8gVGh1bWJuYWlsCkNyZWF0ZWQgd2l0aCBIb2xkZXIuanMgMi42LjAuCkxlYXJuIG1vcmUgYXQgaHR0cDovL2hvbGRlcmpzLmNvbQooYykgMjAxMi0yMDE1IEl2YW4gTWFsb3BpbnNreSAtIGh0dHA6Ly9pbXNreS5jbwotLT48ZGVmcz48c3R5bGUgdHlwZT0idGV4dC9jc3MiPjwhW0NEQVRBWyNob2xkZXJfMTVmNzJmMmFlMGIgdGV4dCB7IGZpbGw6I0FBQUFBQTtmb250LXdlaWdodDpib2xkO2ZvbnQtZmFtaWx5OkFyaWFsLCBIZWx2ZXRpY2EsIE9wZW4gU2Fucywgc2Fucy1zZXJpZiwgbW9ub3NwYWNlO2ZvbnQtc2l6ZToxM3B0IH0gXV0+PC9zdHlsZT48L2RlZnM+PGcgaWQ9ImhvbGRlcl8xNWY3MmYyYWUwYiI+PHJlY3Qgd2lkdGg9IjI2MCIgaGVpZ2h0PSIxODAiIGZpbGw9IiNFRUVFRUUiLz48Zz48dGV4dCB4PSI3Mi4yNDIxODc1IiB5PSI5NiI+Tm8gVGh1bWJuYWlsPC90ZXh0PjwvZz48L2c+PC9zdmc+'; + @Input() defaultImage? = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMjYwIiBoZWlnaHQ9IjE4MCIgdmlld0JveD0iMCAwIDI2MCAxODAiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiPjwhLS0KU291cmNlIFVSTDogaG9sZGVyLmpzLzEwMCV4MTgwL3RleHQ6Tm8gVGh1bWJuYWlsCkNyZWF0ZWQgd2l0aCBIb2xkZXIuanMgMi42LjAuCkxlYXJuIG1vcmUgYXQgaHR0cDovL2hvbGRlcmpzLmNvbQooYykgMjAxMi0yMDE1IEl2YW4gTWFsb3BpbnNreSAtIGh0dHA6Ly9pbXNreS5jbwotLT48ZGVmcz48c3R5bGUgdHlwZT0idGV4dC9jc3MiPjwhW0NEQVRBWyNob2xkZXJfMTVmNzJmMmFlMGIgdGV4dCB7IGZpbGw6I0FBQUFBQTtmb250LXdlaWdodDpib2xkO2ZvbnQtZmFtaWx5OkFyaWFsLCBIZWx2ZXRpY2EsIE9wZW4gU2Fucywgc2Fucy1zZXJpZiwgbW9ub3NwYWNlO2ZvbnQtc2l6ZToxM3B0IH0gXV0+PC9zdHlsZT48L2RlZnM+PGcgaWQ9ImhvbGRlcl8xNWY3MmYyYWUwYiI+PHJlY3Qgd2lkdGg9IjI2MCIgaGVpZ2h0PSIxODAiIGZpbGw9IiNFRUVFRUUiLz48Zz48dGV4dCB4PSI3Mi4yNDIxODc1IiB5PSI5NiI+Tm8gVGh1bWJuYWlsPC90ZXh0PjwvZz48L2c+PC9zdmc+'; + src: string; errorHandler(event) { - event.currentTarget.src = this.holderSource; + event.currentTarget.src = this.defaultImage; + } + + ngOnInit(): void { + if (hasValue(this.thumbnail) && this.thumbnail.content) { + this.src = this.thumbnail.content; + } else { + this.src = this.defaultImage + } } } diff --git a/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.html b/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.html new file mode 100644 index 0000000000..b0509eb5df --- /dev/null +++ b/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.html @@ -0,0 +1,34 @@ + +
+ +
+ + +
+
+
+ + +

+
+

+ + {{dso.firstMetadataValue('dc.date.issued')}} + , + + + +

+

+ + + +

+
+ View +
+
+
+
diff --git a/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.scss b/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.scss new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.spec.ts b/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.spec.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.ts b/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.ts new file mode 100644 index 0000000000..18dcccd1d2 --- /dev/null +++ b/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.ts @@ -0,0 +1,15 @@ +import { TypedItemSearchResultGridElementComponent } from '../typed-item-search-result-grid-element.component'; +import { DEFAULT_ITEM_TYPE, ItemViewMode, rendersItemType } from '../../../../items/item-type-decorator'; +import { Component } from '@angular/core'; +import { focusShadow } from '../../../../animations/focus'; + +@rendersItemType('Publication', ItemViewMode.Card) +@rendersItemType(DEFAULT_ITEM_TYPE, ItemViewMode.Card) +@Component({ + selector: 'ds-publication-grid-element', + styleUrls: ['./publication-grid-element.component.scss'], + templateUrl: './publication-grid-element.component.html', + animations: [focusShadow] +}) +export class PublicationGridElementComponent extends TypedItemSearchResultGridElementComponent { +} diff --git a/src/app/shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component.spec.ts b/src/app/shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component.spec.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/app/shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component.ts b/src/app/shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component.ts new file mode 100644 index 0000000000..f4f470c052 --- /dev/null +++ b/src/app/shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component.ts @@ -0,0 +1,37 @@ +import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model'; +import { Item } from '../../../../core/shared/item.model'; +import { SearchResultGridElementComponent } from '../../search-result-grid-element/search-result-grid-element.component'; +import { TruncatableService } from '../../../truncatable/truncatable.service'; +import { Component, Inject } from '@angular/core'; +import { ITEM } from '../../../items/switcher/item-type-switcher.component'; +import { hasValue } from '../../../empty.util'; +import { MetadataMap } from '../../../../core/shared/metadata.models'; + +/** + * A generic component for displaying item grid elements + */ +@Component({ + selector: 'ds-item-search-result-grid-element', + template: '' +}) +export class TypedItemSearchResultGridElementComponent extends SearchResultGridElementComponent { + item: Item; + + constructor( + protected truncatableService: TruncatableService, + @Inject(ITEM) public obj: Item | ItemSearchResult, + ) { + super(undefined, truncatableService); + if (hasValue((obj as any).indexableObject)) { + this.object = obj as ItemSearchResult; + this.dso = this.object.indexableObject; + } else { + this.object = { + indexableObject: obj as Item, + hitHighlights: new MetadataMap() + }; + this.dso = obj as Item; + } + this.item = this.dso; + } +} diff --git a/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.html b/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.html index c7e2f524f3..d433c7acf2 100644 --- a/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.html +++ b/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.html @@ -1,33 +1 @@ - -
- -
- - -
-
-
- -

-
-

- - {{dso.firstMetadataValue('dc.date.issued')}} - , - - - -

-

- - - -

-
- View -
-
-
-
+ diff --git a/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.ts b/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.ts index 30c36b3af9..7bbe41fe60 100644 --- a/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.ts +++ b/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.ts @@ -6,6 +6,7 @@ import { Item } from '../../../../core/shared/item.model'; import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model'; import { SetViewMode } from '../../../view-mode'; import { focusShadow } from '../../../../shared/animations/focus'; +import { ItemViewMode } from '../../../items/item-type-decorator'; @Component({ selector: 'ds-item-search-result-grid-element', @@ -15,4 +16,6 @@ import { focusShadow } from '../../../../shared/animations/focus'; }) @renderElementsFor(ItemSearchResult, SetViewMode.Grid) -export class ItemSearchResultGridElementComponent extends SearchResultGridElementComponent {} +export class ItemSearchResultGridElementComponent extends SearchResultGridElementComponent { + viewMode = ItemViewMode.Card; +} diff --git a/src/app/shared/object-grid/search-result-grid-element/search-result-grid-element.component.ts b/src/app/shared/object-grid/search-result-grid-element/search-result-grid-element.component.ts index 0961dc96ee..5f31d52ae7 100644 --- a/src/app/shared/object-grid/search-result-grid-element/search-result-grid-element.component.ts +++ b/src/app/shared/object-grid/search-result-grid-element/search-result-grid-element.component.ts @@ -7,6 +7,7 @@ import { ListableObject } from '../../object-collection/shared/listable-object.m import { TruncatableService } from '../../truncatable/truncatable.service'; import { Observable } from 'rxjs'; import { Metadata } from '../../../core/shared/metadata.utils'; +import { hasValue } from '../../empty.util'; @Component({ selector: 'ds-search-result-grid-element', @@ -16,9 +17,11 @@ import { Metadata } from '../../../core/shared/metadata.utils'; export class SearchResultGridElementComponent, K extends DSpaceObject> extends AbstractListableElementComponent { dso: K; - public constructor(@Inject('objectElementProvider') public listableObject: ListableObject, private truncatableService: TruncatableService) { + public constructor(@Inject('objectElementProvider') public listableObject: ListableObject, protected truncatableService: TruncatableService) { super(listableObject); - this.dso = this.object.indexableObject; + if (hasValue(this.object)) { + this.dso = this.object.indexableObject; + } } /** diff --git a/src/app/shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component.ts b/src/app/shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component.ts index 7df3ab5681..dd1b5a7e5f 100644 --- a/src/app/shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component.ts +++ b/src/app/shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component.ts @@ -11,7 +11,7 @@ import { MetadataMap } from '../../../../core/shared/metadata.models'; * A generic component for displaying item list elements */ @Component({ - selector: 'ds-item-search-result', + selector: 'ds-item-search-result-list-element', template: '' }) export class TypedItemSearchResultListElementComponent extends SearchResultListElementComponent { diff --git a/src/app/shared/object-list/item-type-badge/item-type-badge.component.html b/src/app/shared/object-list/item-type-badge/item-type-badge.component.html new file mode 100644 index 0000000000..35d7663801 --- /dev/null +++ b/src/app/shared/object-list/item-type-badge/item-type-badge.component.html @@ -0,0 +1,3 @@ +
+ {{ type.toLowerCase() + '.listelement.badge' | translate }} +
diff --git a/src/app/shared/object-list/item-type-badge/item-type-badge.component.ts b/src/app/shared/object-list/item-type-badge/item-type-badge.component.ts new file mode 100644 index 0000000000..53e36a535d --- /dev/null +++ b/src/app/shared/object-list/item-type-badge/item-type-badge.component.ts @@ -0,0 +1,10 @@ +import { Component, Input } from '@angular/core'; +import { ListableObject } from '../../object-collection/shared/listable-object.model'; + +@Component({ + selector: 'ds-item-type-badge', + templateUrl: './item-type-badge.component.html' +}) +export class ItemTypeBadgeComponent { + @Input() object: ListableObject; +} diff --git a/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.html b/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.html index a2617a956f..051a27bde7 100644 --- a/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.html +++ b/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.html @@ -1,4 +1,2 @@ -
- {{ type.toLowerCase() + '.listelement.badge' | translate }} -
+ diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index 816139c8b9..66afb1e41b 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -138,6 +138,9 @@ import { RoleDirective } from './roles/role.directive'; import { UserMenuComponent } from './auth-nav-menu/user-menu/user-menu.component'; import { ClaimedTaskActionsReturnToPoolComponent } from './mydspace-actions/claimed-task/return-to-pool/claimed-task-actions-return-to-pool.component'; import { ItemDetailPreviewFieldComponent } from './object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview-field/item-detail-preview-field.component'; +import { TypedItemSearchResultGridElementComponent } from './object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component'; +import { PublicationGridElementComponent } from './object-grid/item-grid-element/item-types/publication/publication-grid-element.component'; +import { ItemTypeBadgeComponent } from './object-list/item-type-badge/item-type-badge.component'; const MODULES = [ // Do NOT include UniversalModule, HttpModule, or JsonpModule here @@ -256,8 +259,10 @@ const COMPONENTS = [ CollectionSearchResultListElementComponent, ItemSearchResultListElementComponent, TypedItemSearchResultListElementComponent, + TypedItemSearchResultGridElementComponent, ItemTypeSwitcherComponent, - BrowseByComponent + BrowseByComponent, + ItemTypeBadgeComponent ]; const ENTRY_COMPONENTS = [ @@ -275,6 +280,7 @@ const ENTRY_COMPONENTS = [ CommunityGridElementComponent, SearchResultGridElementComponent, PublicationListElementComponent, + PublicationGridElementComponent, BrowseEntryListElementComponent, MyDSpaceResultDetailElementComponent, SearchResultGridElementComponent, From 22ae5a04e7959be8bd32f4aada2ba6a5a3bff23a Mon Sep 17 00:00:00 2001 From: Kristof De Langhe Date: Fri, 7 Jun 2019 12:51:27 +0200 Subject: [PATCH 02/18] 62741: Journal-types grid elements & grid thumbnail fix/improvement --- .../journal-issue-grid-element.component.html | 30 +++++++++++++++++ .../journal-issue-grid-element.component.scss | 0 ...urnal-issue-grid-element.component.spec.ts | 0 .../journal-issue-grid-element.component.ts | 14 ++++++++ ...journal-volume-grid-element.component.html | 30 +++++++++++++++++ ...journal-volume-grid-element.component.scss | 0 ...rnal-volume-grid-element.component.spec.ts | 0 .../journal-volume-grid-element.component.ts | 14 ++++++++ .../journal-grid-element.component.html | 33 +++++++++++++++++++ .../journal-grid-element.component.scss | 0 .../journal-grid-element.component.spec.ts | 0 .../journal/journal-grid-element.component.ts | 14 ++++++++ .../journal-entities.module.ts | 8 ++++- .../orgunit-grid-element.component.html | 2 +- .../person/person-grid-element.component.html | 2 +- .../project-grid-element.component.html | 2 +- .../publication-grid-element.component.html | 2 +- .../object-grid/object-grid.component.scss | 5 +++ 18 files changed, 151 insertions(+), 5 deletions(-) create mode 100644 src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.html create mode 100644 src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.scss create mode 100644 src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.spec.ts create mode 100644 src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.ts create mode 100644 src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.html create mode 100644 src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.scss create mode 100644 src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.spec.ts create mode 100644 src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.ts create mode 100644 src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.html create mode 100644 src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.scss create mode 100644 src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.spec.ts create mode 100644 src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.ts diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.html b/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.html new file mode 100644 index 0000000000..6bd296db48 --- /dev/null +++ b/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.html @@ -0,0 +1,30 @@ + +
+ +
+ + +
+
+
+ + +

+
+

+ + + +

+

+ + + +

+
+ View +
+
+
+
diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.scss b/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.scss new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.spec.ts b/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.spec.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.ts b/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.ts new file mode 100644 index 0000000000..538971bf84 --- /dev/null +++ b/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.ts @@ -0,0 +1,14 @@ +import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator'; +import { Component } from '@angular/core'; +import { focusShadow } from '../../../../shared/animations/focus'; +import { TypedItemSearchResultGridElementComponent } from '../../../../shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component'; + +@rendersItemType('JournalIssue', ItemViewMode.Card) +@Component({ + selector: 'ds-journal-issue-grid-element', + styleUrls: ['./journal-issue-grid-element.component.scss'], + templateUrl: './journal-issue-grid-element.component.html', + animations: [focusShadow] +}) +export class JournalIssueGridElementComponent extends TypedItemSearchResultGridElementComponent { +} diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.html b/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.html new file mode 100644 index 0000000000..e1d3cb5e0a --- /dev/null +++ b/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.html @@ -0,0 +1,30 @@ + +
+ +
+ + +
+
+
+ + +

+
+

+ + + +

+

+ + + +

+
+ View +
+
+
+
diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.scss b/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.scss new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.spec.ts b/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.spec.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.ts b/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.ts new file mode 100644 index 0000000000..3ef4e9948e --- /dev/null +++ b/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.ts @@ -0,0 +1,14 @@ +import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator'; +import { Component } from '@angular/core'; +import { focusShadow } from '../../../../shared/animations/focus'; +import { TypedItemSearchResultGridElementComponent } from '../../../../shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component'; + +@rendersItemType('JournalVolume', ItemViewMode.Card) +@Component({ + selector: 'ds-journal-volume-grid-element', + styleUrls: ['./journal-volume-grid-element.component.scss'], + templateUrl: './journal-volume-grid-element.component.html', + animations: [focusShadow] +}) +export class JournalVolumeGridElementComponent extends TypedItemSearchResultGridElementComponent { +} diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.html b/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.html new file mode 100644 index 0000000000..54fc0e4215 --- /dev/null +++ b/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.html @@ -0,0 +1,33 @@ + +
+ +
+ + +
+
+
+ + +

+
+

+ + {{dso.firstMetadataValue('journal.contributor.editor')}} + , + {{dso.firstMetadataValue('journal.publisher')}} + +

+

+ + + +

+
+ View +
+
+
+
diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.scss b/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.scss new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.spec.ts b/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.spec.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.ts b/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.ts new file mode 100644 index 0000000000..37c0b0aad1 --- /dev/null +++ b/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.ts @@ -0,0 +1,14 @@ +import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator'; +import { Component } from '@angular/core'; +import { focusShadow } from '../../../../shared/animations/focus'; +import { TypedItemSearchResultGridElementComponent } from '../../../../shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component'; + +@rendersItemType('Journal', ItemViewMode.Card) +@Component({ + selector: 'ds-journal-grid-element', + styleUrls: ['./journal-grid-element.component.scss'], + templateUrl: './journal-grid-element.component.html', + animations: [focusShadow] +}) +export class JournalGridElementComponent extends TypedItemSearchResultGridElementComponent { +} diff --git a/src/app/entity-groups/journal-entities/journal-entities.module.ts b/src/app/entity-groups/journal-entities/journal-entities.module.ts index 50ec160650..4033645e1b 100644 --- a/src/app/entity-groups/journal-entities/journal-entities.module.ts +++ b/src/app/entity-groups/journal-entities/journal-entities.module.ts @@ -9,6 +9,9 @@ import { JournalListElementComponent } from './item-list-elements/journal/journa import { JournalIssueListElementComponent } from './item-list-elements/journal-issue/journal-issue-list-element.component'; import { JournalVolumeListElementComponent } from './item-list-elements/journal-volume/journal-volume-list-element.component'; import { TooltipModule } from 'ngx-bootstrap'; +import { JournalIssueGridElementComponent } from './item-grid-elements/journal-issue/journal-issue-grid-element.component'; +import { JournalVolumeGridElementComponent } from './item-grid-elements/journal-volume/journal-volume-grid-element.component'; +import { JournalGridElementComponent } from './item-grid-elements/journal/journal-grid-element.component'; const ENTRY_COMPONENTS = [ JournalComponent, @@ -16,7 +19,10 @@ const ENTRY_COMPONENTS = [ JournalVolumeComponent, JournalListElementComponent, JournalIssueListElementComponent, - JournalVolumeListElementComponent + JournalVolumeListElementComponent, + JournalIssueGridElementComponent, + JournalVolumeGridElementComponent, + JournalGridElementComponent ]; @NgModule({ diff --git a/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.html b/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.html index afb7f8da09..cb5d9b59af 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.html +++ b/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.html @@ -2,7 +2,7 @@
- +
diff --git a/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.html b/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.html index 05f1eefda1..463007d099 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.html +++ b/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.html @@ -2,7 +2,7 @@
- +
diff --git a/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.html b/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.html index f01f0334d3..1f122895ee 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.html +++ b/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.html @@ -2,7 +2,7 @@
- +
diff --git a/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.html b/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.html index b0509eb5df..06cf8496c4 100644 --- a/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.html +++ b/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.html @@ -2,7 +2,7 @@
- +
diff --git a/src/app/shared/object-grid/object-grid.component.scss b/src/app/shared/object-grid/object-grid.component.scss index ff78634863..fdd6c6e7ac 100644 --- a/src/app/shared/object-grid/object-grid.component.scss +++ b/src/app/shared/object-grid/object-grid.component.scss @@ -7,6 +7,11 @@ ds-wrapper-grid-element ::ng-deep { div.thumbnail > img { height: $card-thumbnail-height; width: 100%; + display: block; + min-width: 100%; + min-height: 100%; + object-fit: cover; + object-position: 50% 15%; } div.card { margin-top: $ds-wrapper-grid-spacing; From 0a32d3f91579daa2eaeb445a16efd4dd79cb3809 Mon Sep 17 00:00:00 2001 From: Kristof De Langhe Date: Fri, 7 Jun 2019 13:23:03 +0200 Subject: [PATCH 03/18] 62741: Remove whitespace and entity thumbnails from grid templates --- .../journal-issue-grid-element.component.html | 6 +++--- .../journal-volume-grid-element.component.html | 6 +++--- .../journal/journal-grid-element.component.html | 6 +++--- .../orgunit/orgunit-grid-element.component.html | 8 ++++---- .../person/person-grid-element.component.html | 8 ++++---- .../project/project-grid-element.component.html | 6 +++--- .../publication/publication-grid-element.component.html | 6 +++--- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.html b/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.html index 6bd296db48..11c1911eda 100644 --- a/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.html +++ b/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.html @@ -8,16 +8,16 @@
- +

- +

- +

diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.html b/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.html index e1d3cb5e0a..aaa22d48f6 100644 --- a/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.html +++ b/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.html @@ -8,16 +8,16 @@
- +

- +

- +

diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.html b/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.html index 54fc0e4215..d532fb60d4 100644 --- a/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.html +++ b/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.html @@ -8,19 +8,19 @@
- +

- + {{dso.firstMetadataValue('journal.contributor.editor')}} , {{dso.firstMetadataValue('journal.publisher')}}

- +

diff --git a/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.html b/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.html index cb5d9b59af..d4150bdc9a 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.html +++ b/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.html @@ -2,23 +2,23 @@
- +
- +

- +

- + {{dso.firstMetadataValue('orgunit.identifier.country')}} , {{dso.firstMetadataValue('orgunit.identifier.city')}} diff --git a/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.html b/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.html index 463007d099..c47e96bcc1 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.html +++ b/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.html @@ -2,22 +2,22 @@

- +
- +

- +

diff --git a/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.html b/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.html index 1f122895ee..16083c5787 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.html +++ b/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.html @@ -2,17 +2,17 @@
- +
- +

- +

diff --git a/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.html b/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.html index 06cf8496c4..3bb21b1f1c 100644 --- a/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.html +++ b/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.html @@ -8,12 +8,12 @@
- +

- + {{dso.firstMetadataValue('dc.date.issued')}} , @@ -21,7 +21,7 @@

- +

From 47994f955764beb08db5d0957eb52016c78c6afb Mon Sep 17 00:00:00 2001 From: Kristof De Langhe Date: Fri, 7 Jun 2019 15:18:38 +0200 Subject: [PATCH 04/18] 62741: Entities grid templates tests --- .../journal-issue-grid-element.component.html | 4 +- ...urnal-issue-grid-element.component.spec.ts | 47 +++++++ ...journal-volume-grid-element.component.html | 4 +- ...rnal-volume-grid-element.component.spec.ts | 47 +++++++ .../journal-grid-element.component.html | 6 +- .../journal-grid-element.component.spec.ts | 53 ++++++++ .../orgunit-grid-element.component.html | 6 +- .../orgunit-grid-element.component.spec.ts | 53 ++++++++ .../person/person-grid-element.component.html | 6 +- .../person-grid-element.component.spec.ts | 47 +++++++ .../project-grid-element.component.html | 2 +- .../project-grid-element.component.spec.ts | 41 ++++++ .../grid-thumbnail.component.spec.ts | 4 +- .../publication-grid-element.component.html | 2 +- ...publication-grid-element.component.spec.ts | 124 ++++++++++++++++++ ...arch-result-grid-element.component.spec.ts | 83 ++++++++++++ ...arch-result-grid-element.component.spec.ts | 89 ++----------- ...arch-result-list-element.component.spec.ts | 2 +- .../item-type-badge.component.spec.ts | 83 ++++++++++++ ...arch-result-list-element.component.spec.ts | 41 +----- 20 files changed, 612 insertions(+), 132 deletions(-) create mode 100644 src/app/shared/object-list/item-type-badge/item-type-badge.component.spec.ts diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.html b/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.html index 11c1911eda..93d3954f2f 100644 --- a/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.html +++ b/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.html @@ -11,12 +11,12 @@

-

+

-

+

diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.spec.ts b/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.spec.ts index e69de29bb2..3af407d0f8 100644 --- a/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.spec.ts +++ b/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.spec.ts @@ -0,0 +1,47 @@ +import { ItemSearchResult } from '../../../../shared/object-collection/shared/item-search-result.model'; +import { Item } from '../../../../core/shared/item.model'; +import { of as observableOf } from 'rxjs/internal/observable/of'; +import { getEntityGridElementTestComponent } from '../../../../shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.spec'; +import { JournalIssueGridElementComponent } from './journal-issue-grid-element.component'; + +const mockItemWithMetadata: ItemSearchResult = new ItemSearchResult(); +mockItemWithMetadata.hitHighlights = {}; +mockItemWithMetadata.indexableObject = Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'dc.title': [ + { + language: 'en_US', + value: 'This is just another title' + } + ], + 'journalissue.issuedate': [ + { + language: null, + value: '2015-06-26' + } + ], + 'journal.title': [ + { + language: 'en_US', + value: 'The journal title' + } + ] + } +}); + +const mockItemWithoutMetadata: ItemSearchResult = new ItemSearchResult(); +mockItemWithoutMetadata.hitHighlights = {}; +mockItemWithoutMetadata.indexableObject = Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'dc.title': [ + { + language: 'en_US', + value: 'This is just another title' + } + ] + } +}); + +describe('JournalIssueGridElementComponent', getEntityGridElementTestComponent(JournalIssueGridElementComponent, mockItemWithMetadata, mockItemWithoutMetadata, ['date', 'journal-title'])); diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.html b/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.html index aaa22d48f6..f5487a34cf 100644 --- a/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.html +++ b/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.html @@ -11,12 +11,12 @@

-

+

-

+

diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.spec.ts b/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.spec.ts index e69de29bb2..4751ed4cd8 100644 --- a/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.spec.ts +++ b/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.spec.ts @@ -0,0 +1,47 @@ +import { ItemSearchResult } from '../../../../shared/object-collection/shared/item-search-result.model'; +import { Item } from '../../../../core/shared/item.model'; +import { of as observableOf } from 'rxjs/internal/observable/of'; +import { getEntityGridElementTestComponent } from '../../../../shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.spec'; +import { JournalVolumeGridElementComponent } from './journal-volume-grid-element.component'; + +const mockItemWithMetadata: ItemSearchResult = new ItemSearchResult(); +mockItemWithMetadata.hitHighlights = {}; +mockItemWithMetadata.indexableObject = Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'dc.title': [ + { + language: 'en_US', + value: 'This is just another title' + } + ], + 'journalvolume.issuedate': [ + { + language: null, + value: '2015-06-26' + } + ], + 'journalvolume.identifier.description': [ + { + language: 'en_US', + value: 'A description for the journal volume' + } + ] + } +}); + +const mockItemWithoutMetadata: ItemSearchResult = new ItemSearchResult(); +mockItemWithoutMetadata.hitHighlights = {}; +mockItemWithoutMetadata.indexableObject = Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'dc.title': [ + { + language: 'en_US', + value: 'This is just another title' + } + ] + } +}); + +describe('JournalVolumeGridElementComponent', getEntityGridElementTestComponent(JournalVolumeGridElementComponent, mockItemWithMetadata, mockItemWithoutMetadata, ['date', 'description'])); diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.html b/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.html index d532fb60d4..d4354efcf4 100644 --- a/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.html +++ b/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.html @@ -14,12 +14,12 @@

- {{dso.firstMetadataValue('journal.contributor.editor')}} + {{dso.firstMetadataValue('journal.contributor.editor')}} , - {{dso.firstMetadataValue('journal.publisher')}} + {{dso.firstMetadataValue('journal.publisher')}}

-

+

diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.spec.ts b/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.spec.ts index e69de29bb2..d9934e2d2f 100644 --- a/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.spec.ts +++ b/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.spec.ts @@ -0,0 +1,53 @@ +import { ItemSearchResult } from '../../../../shared/object-collection/shared/item-search-result.model'; +import { Item } from '../../../../core/shared/item.model'; +import { of as observableOf } from 'rxjs/internal/observable/of'; +import { getEntityGridElementTestComponent } from '../../../../shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.spec'; +import { JournalGridElementComponent } from './journal-grid-element.component'; + +const mockItemWithMetadata: ItemSearchResult = new ItemSearchResult(); +mockItemWithMetadata.hitHighlights = {}; +mockItemWithMetadata.indexableObject = Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'dc.title': [ + { + language: 'en_US', + value: 'This is just another title' + } + ], + 'journal.contributor.editor': [ + { + language: 'en_US', + value: 'Smith, Donald' + } + ], + 'journal.publisher': [ + { + language: 'en_US', + value: 'A company' + } + ], + 'journal.identifier.description': [ + { + language: 'en_US', + value: 'This is the description' + } + ] + } +}); + +const mockItemWithoutMetadata: ItemSearchResult = new ItemSearchResult(); +mockItemWithoutMetadata.hitHighlights = {}; +mockItemWithoutMetadata.indexableObject = Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'dc.title': [ + { + language: 'en_US', + value: 'This is just another title' + } + ] + } +}); + +describe('JournalGridElementComponent', getEntityGridElementTestComponent(JournalGridElementComponent, mockItemWithMetadata, mockItemWithoutMetadata, ['editor', 'publisher', 'description'])); diff --git a/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.html b/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.html index d4150bdc9a..92fffd0166 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.html +++ b/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.html @@ -11,7 +11,7 @@

-

+

@@ -19,9 +19,9 @@

- {{dso.firstMetadataValue('orgunit.identifier.country')}} + {{dso.firstMetadataValue('orgunit.identifier.country')}} , - {{dso.firstMetadataValue('orgunit.identifier.city')}} + {{dso.firstMetadataValue('orgunit.identifier.city')}}

diff --git a/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.spec.ts b/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.spec.ts index e69de29bb2..25249fd2b0 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.spec.ts +++ b/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.spec.ts @@ -0,0 +1,53 @@ +import { ItemSearchResult } from '../../../../shared/object-collection/shared/item-search-result.model'; +import { Item } from '../../../../core/shared/item.model'; +import { of as observableOf } from 'rxjs/internal/observable/of'; +import { getEntityGridElementTestComponent } from '../../../../shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.spec'; +import { OrgunitGridElementComponent } from './orgunit-grid-element.component'; + +const mockItemWithMetadata: ItemSearchResult = new ItemSearchResult(); +mockItemWithMetadata.hitHighlights = {}; +mockItemWithMetadata.indexableObject = Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'dc.title': [ + { + language: 'en_US', + value: 'This is just another title' + } + ], + 'orgunit.identifier.dateestablished': [ + { + language: null, + value: '2015-06-26' + } + ], + 'orgunit.identifier.country': [ + { + language: 'en_US', + value: 'Belgium' + } + ], + 'orgunit.identifier.city': [ + { + language: 'en_US', + value: 'Brussels' + } + ] + } +}); + +const mockItemWithoutMetadata: ItemSearchResult = new ItemSearchResult(); +mockItemWithoutMetadata.hitHighlights = {}; +mockItemWithoutMetadata.indexableObject = Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'dc.title': [ + { + language: 'en_US', + value: 'This is just another title' + } + ] + } +}); + +describe('OrgunitGridElementComponent', getEntityGridElementTestComponent(OrgunitGridElementComponent, mockItemWithMetadata, mockItemWithoutMetadata, ['date', 'country', 'city'])); diff --git a/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.html b/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.html index c47e96bcc1..badc241b65 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.html +++ b/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.html @@ -11,12 +11,12 @@

- -

+

diff --git a/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.spec.ts b/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.spec.ts index e69de29bb2..b3343a0605 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.spec.ts +++ b/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.spec.ts @@ -0,0 +1,47 @@ +import { ItemSearchResult } from '../../../../shared/object-collection/shared/item-search-result.model'; +import { Item } from '../../../../core/shared/item.model'; +import { of as observableOf } from 'rxjs/internal/observable/of'; +import { getEntityGridElementTestComponent } from '../../../../shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.spec'; +import { PersonGridElementComponent } from './person-grid-element.component'; + +const mockItemWithMetadata: ItemSearchResult = new ItemSearchResult(); +mockItemWithMetadata.hitHighlights = {}; +mockItemWithMetadata.indexableObject = Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'dc.title': [ + { + language: 'en_US', + value: 'This is just another title' + } + ], + 'person.identifier.email': [ + { + language: 'en_US', + value: 'Smith-Donald@gmail.com' + } + ], + 'person.identifier.jobtitle': [ + { + language: 'en_US', + value: 'Web Developer' + } + ] + } +}); + +const mockItemWithoutMetadata: ItemSearchResult = new ItemSearchResult(); +mockItemWithoutMetadata.hitHighlights = {}; +mockItemWithoutMetadata.indexableObject = Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'dc.title': [ + { + language: 'en_US', + value: 'This is just another title' + } + ] + } +}); + +describe('PersonGridElementComponent', getEntityGridElementTestComponent(PersonGridElementComponent, mockItemWithMetadata, mockItemWithoutMetadata, ['email', 'jobtitle'])); diff --git a/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.html b/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.html index 16083c5787..1fe4d18dae 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.html +++ b/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.html @@ -11,7 +11,7 @@

-

+

diff --git a/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.spec.ts b/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.spec.ts index e69de29bb2..bcf19ed96a 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.spec.ts +++ b/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.spec.ts @@ -0,0 +1,41 @@ +import { ItemSearchResult } from '../../../../shared/object-collection/shared/item-search-result.model'; +import { Item } from '../../../../core/shared/item.model'; +import { of as observableOf } from 'rxjs/internal/observable/of'; +import { getEntityGridElementTestComponent } from '../../../../shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.spec'; +import { ProjectGridElementComponent } from './project-grid-element.component'; + +const mockItemWithMetadata: ItemSearchResult = new ItemSearchResult(); +mockItemWithMetadata.hitHighlights = {}; +mockItemWithMetadata.indexableObject = Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'dc.title': [ + { + language: 'en_US', + value: 'This is just another title' + } + ], + 'project.identifier.funder': [ + { + language: 'en_US', + value: 'The project funder' + } + ] + } +}); + +const mockItemWithoutMetadata: ItemSearchResult = new ItemSearchResult(); +mockItemWithoutMetadata.hitHighlights = {}; +mockItemWithoutMetadata.indexableObject = Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'dc.title': [ + { + language: 'en_US', + value: 'This is just another title' + } + ] + } +}); + +describe('ProjectGridElementComponent', getEntityGridElementTestComponent(ProjectGridElementComponent, mockItemWithMetadata, mockItemWithoutMetadata, ['funder'])); diff --git a/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.spec.ts b/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.spec.ts index 2d2bd6305a..170ca34b42 100644 --- a/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.spec.ts +++ b/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.spec.ts @@ -6,7 +6,7 @@ import { GridThumbnailComponent } from './grid-thumbnail.component'; import { Bitstream } from '../../../core/shared/bitstream.model'; import { SafeUrlPipe } from '../../utils/safe-url-pipe'; -describe('ThumbnailComponent', () => { +describe('GridThumbnailComponent', () => { let comp: GridThumbnailComponent; let fixture: ComponentFixture; let de: DebugElement; @@ -36,7 +36,7 @@ describe('ThumbnailComponent', () => { it('should display placeholder', () => { fixture.detectChanges(); const image: HTMLElement = de.query(By.css('img')).nativeElement; - expect(image.getAttribute('src')).toBe(comp.holderSource); + expect(image.getAttribute('src')).toBe(comp.defaultImage); }); }); diff --git a/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.html b/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.html index 3bb21b1f1c..e2477524ca 100644 --- a/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.html +++ b/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.html @@ -20,7 +20,7 @@

-

+

diff --git a/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.spec.ts b/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.spec.ts index e69de29bb2..f067a21ae0 100644 --- a/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.spec.ts +++ b/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.spec.ts @@ -0,0 +1,124 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { TruncatePipe } from '../../../../utils/truncate.pipe'; +import { TruncatableService } from '../../../../truncatable/truncatable.service'; +import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; +import { By } from '@angular/platform-browser'; +import { PublicationGridElementComponent } from './publication-grid-element.component'; +import { of as observableOf } from 'rxjs/internal/observable/of'; +import { ItemSearchResult } from '../../../../object-collection/shared/item-search-result.model'; +import { Item } from '../../../../../core/shared/item.model'; +import { ITEM } from '../../../../items/switcher/item-type-switcher.component'; + +const mockItemWithMetadata: ItemSearchResult = new ItemSearchResult(); +mockItemWithMetadata.hitHighlights = {}; +mockItemWithMetadata.indexableObject = Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'dc.title': [ + { + language: 'en_US', + value: 'This is just another title' + } + ], + 'dc.contributor.author': [ + { + language: 'en_US', + value: 'Smith, Donald' + } + ], + 'dc.date.issued': [ + { + language: null, + value: '2015-06-26' + } + ], + 'dc.description.abstract': [ + { + language: 'en_US', + value: 'This is an abstract' + } + ] + } +}); + +const mockItemWithoutMetadata: ItemSearchResult = new ItemSearchResult(); +mockItemWithoutMetadata.hitHighlights = {}; +mockItemWithoutMetadata.indexableObject = Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'dc.title': [ + { + language: 'en_US', + value: 'This is just another title' + } + ] + } +}); + +describe('PublicationGridElementComponent', getEntityGridElementTestComponent(PublicationGridElementComponent, mockItemWithMetadata, mockItemWithoutMetadata, ['authors', 'date', 'abstract'])); + +/** + * Create test cases for a grid component of an entity. + * @param component The component's class + * @param searchResultWithMetadata An ItemSearchResult containing an item with metadata that should be displayed in the grid element + * @param searchResultWithoutMetadata An ItemSearchResult containing an item that's missing the metadata that should be displayed in the grid element + * @param fieldsToCheck A list of fields to check. The tests expect to find html elements with class ".item-${field}", so make sure they exist in the html template of the grid element. + * For example: If one of the fields to check is labeled "authors", the html template should contain at least one element with class ".item-authors" that's + * present when the author metadata is available. + */ +export function getEntityGridElementTestComponent(component, searchResultWithMetadata: ItemSearchResult, searchResultWithoutMetadata: ItemSearchResult, fieldsToCheck: string[]) { + return () => { + let comp; + let fixture; + + const truncatableServiceStub: any = { + isCollapsed: (id: number) => observableOf(true), + }; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + imports: [NoopAnimationsModule], + declarations: [component, TruncatePipe], + providers: [ + { provide: TruncatableService, useValue: truncatableServiceStub }, + {provide: ITEM, useValue: searchResultWithoutMetadata} + ], + schemas: [NO_ERRORS_SCHEMA] + }).overrideComponent(component, { + set: { changeDetection: ChangeDetectionStrategy.Default } + }).compileComponents(); + })); + + beforeEach(async(() => { + fixture = TestBed.createComponent(component); + comp = fixture.componentInstance; + })); + + fieldsToCheck.forEach((field) => { + describe(`when the item has "${field}" metadata`, () => { + beforeEach(() => { + comp.dso = searchResultWithMetadata.indexableObject; + fixture.detectChanges(); + }); + + it(`should show the "${field}" field`, () => { + const itemAuthorField = fixture.debugElement.query(By.css(`.item-${field}`)); + expect(itemAuthorField).not.toBeNull(); + }); + }); + + describe(`when the item has no "${field}" metadata`, () => { + beforeEach(() => { + comp.dso = searchResultWithoutMetadata.indexableObject; + fixture.detectChanges(); + }); + + it(`should not show the "${field}" field`, () => { + const itemAuthorField = fixture.debugElement.query(By.css(`.item-${field}`)); + expect(itemAuthorField).toBeNull(); + }); + }); + }); + } +} diff --git a/src/app/shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component.spec.ts b/src/app/shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component.spec.ts index e69de29bb2..e4ace8d0b2 100644 --- a/src/app/shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component.spec.ts +++ b/src/app/shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component.spec.ts @@ -0,0 +1,83 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { TruncatePipe } from '../../../utils/truncate.pipe'; +import { TruncatableService } from '../../../truncatable/truncatable.service'; +import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; +import { Item } from '../../../../core/shared/item.model'; +import { RemoteData } from '../../../../core/data/remote-data'; +import { PaginatedList } from '../../../../core/data/paginated-list'; +import { PageInfo } from '../../../../core/shared/page-info.model'; +import { ITEM } from '../../../items/switcher/item-type-switcher.component'; +import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model'; +import { createRelationshipsObservable } from '../../../../+item-page/simple/item-types/shared/item.component.spec'; +import { of as observableOf } from 'rxjs'; +import { MetadataMap } from '../../../../core/shared/metadata.models'; +import { TypedItemSearchResultGridElementComponent } from './typed-item-search-result-grid-element.component'; + +const mockItem: Item = Object.assign(new Item(), { + bitstreams: observableOf(new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), []))), + metadata: [], + relationships: createRelationshipsObservable() +}); +const mockSearchResult = { + indexableObject: mockItem as Item, + hitHighlights: new MetadataMap() +} as ItemSearchResult; + +describe('TypedItemSearchResultGridElementComponent', () => { + let comp: TypedItemSearchResultGridElementComponent; + let fixture: ComponentFixture; + + describe('when injecting an Item', () => { + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [TypedItemSearchResultGridElementComponent, TruncatePipe], + providers: [ + {provide: TruncatableService, useValue: {}}, + {provide: ITEM, useValue: mockItem} + ], + + schemas: [NO_ERRORS_SCHEMA] + }).overrideComponent(TypedItemSearchResultGridElementComponent, { + set: {changeDetection: ChangeDetectionStrategy.Default} + }).compileComponents(); + })); + + beforeEach(async(() => { + fixture = TestBed.createComponent(TypedItemSearchResultGridElementComponent); + comp = fixture.componentInstance; + })); + + it('should initiate item, object and dso correctly', () => { + expect(comp.item).toBe(mockItem); + expect(comp.dso).toBe(mockItem); + expect(comp.object.indexableObject).toBe(mockItem); + }) + }); + + describe('when injecting an ItemSearchResult', () => { + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [TypedItemSearchResultGridElementComponent, TruncatePipe], + providers: [ + {provide: TruncatableService, useValue: {}}, + {provide: ITEM, useValue: mockSearchResult} + ], + + schemas: [NO_ERRORS_SCHEMA] + }).overrideComponent(TypedItemSearchResultGridElementComponent, { + set: {changeDetection: ChangeDetectionStrategy.Default} + }).compileComponents(); + })); + + beforeEach(async(() => { + fixture = TestBed.createComponent(TypedItemSearchResultGridElementComponent); + comp = fixture.componentInstance; + })); + + it('should initiate item, object and dso correctly', () => { + expect(comp.item).toBe(mockItem); + expect(comp.dso).toBe(mockItem); + expect(comp.object.indexableObject).toBe(mockItem); + }) + }); +}); diff --git a/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.spec.ts b/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.spec.ts index 655fd268a7..282478ec33 100644 --- a/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.spec.ts +++ b/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.spec.ts @@ -8,6 +8,7 @@ import { Item } from '../../../../core/shared/item.model'; import { TruncatableService } from '../../../truncatable/truncatable.service'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model'; +import { ItemViewMode } from '../../../items/item-type-decorator'; let itemSearchResultGridElementComponent: ItemSearchResultGridElementComponent; let fixture: ComponentFixture; @@ -16,41 +17,17 @@ const truncatableServiceStub: any = { isCollapsed: (id: number) => observableOf(true), }; -const mockItemWithAuthorAndDate: ItemSearchResult = new ItemSearchResult(); -mockItemWithAuthorAndDate.hitHighlights = {}; -mockItemWithAuthorAndDate.indexableObject = Object.assign(new Item(), { - bitstreams: observableOf({}), - metadata: { - 'dc.contributor.author': [ - { - language: 'en_US', - value: 'Smith, Donald' - } - ], - 'dc.date.issued': [ - { - language: null, - value: '2015-06-26' - } - ] - } -}); +const type = 'authorOfPublication'; -const mockItemWithoutAuthorAndDate: ItemSearchResult = new ItemSearchResult(); -mockItemWithoutAuthorAndDate.hitHighlights = {}; -mockItemWithoutAuthorAndDate.indexableObject = Object.assign(new Item(), { +const mockItemWithRelationshipType: ItemSearchResult = new ItemSearchResult(); +mockItemWithRelationshipType.hitHighlights = {}; +mockItemWithRelationshipType.indexableObject = Object.assign(new Item(), { bitstreams: observableOf({}), metadata: { - 'dc.title': [ + 'relationship.type': [ { language: 'en_US', - value: 'This is just another title' - } - ], - 'dc.type': [ - { - language: null, - value: 'Article' + value: type } ] } @@ -63,7 +40,7 @@ describe('ItemSearchResultGridElementComponent', () => { declarations: [ItemSearchResultGridElementComponent, TruncatePipe], providers: [ { provide: TruncatableService, useValue: truncatableServiceStub }, - { provide: 'objectElementProvider', useValue: (mockItemWithoutAuthorAndDate) } + { provide: 'objectElementProvider', useValue: (mockItemWithRelationshipType) } ], schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(ItemSearchResultGridElementComponent, { @@ -76,51 +53,9 @@ describe('ItemSearchResultGridElementComponent', () => { itemSearchResultGridElementComponent = fixture.componentInstance; })); - describe('When the item has an author', () => { - beforeEach(() => { - itemSearchResultGridElementComponent.dso = mockItemWithAuthorAndDate.indexableObject; - fixture.detectChanges(); - }); - - it('should show the author paragraph', () => { - const itemAuthorField = fixture.debugElement.query(By.css('p.item-authors')); - expect(itemAuthorField).not.toBeNull(); - }); - }); - - describe('When the item has no author', () => { - beforeEach(() => { - itemSearchResultGridElementComponent.dso = mockItemWithoutAuthorAndDate.indexableObject; - fixture.detectChanges(); - }); - - it('should not show the author paragraph', () => { - const itemAuthorField = fixture.debugElement.query(By.css('p.item-authors')); - expect(itemAuthorField).toBeNull(); - }); - }); - - describe('When the item has an issuedate', () => { - beforeEach(() => { - itemSearchResultGridElementComponent.dso = mockItemWithAuthorAndDate.indexableObject; - fixture.detectChanges(); - }); - - it('should show the issuedate span', () => { - const itemAuthorField = fixture.debugElement.query(By.css('span.item-date')); - expect(itemAuthorField).not.toBeNull(); - }); - }); - - describe('When the item has no issuedate', () => { - beforeEach(() => { - itemSearchResultGridElementComponent.dso = mockItemWithoutAuthorAndDate.indexableObject; - fixture.detectChanges(); - }); - - it('should not show the issuedate span', () => { - const dateField = fixture.debugElement.query(By.css('span.item-date')); - expect(dateField).toBeNull(); - }); + it('should show send the object to item-type-switcher using viewMode "Card"', () => { + const itemTypeSwitcherComp = fixture.debugElement.query(By.css('ds-item-type-switcher')).componentInstance; + expect(itemTypeSwitcherComp.object).toBe(mockItemWithRelationshipType); + expect(itemTypeSwitcherComp.viewMode).toEqual(ItemViewMode.Card); }); }); diff --git a/src/app/shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component.spec.ts b/src/app/shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component.spec.ts index f320ff2efc..b100f584e2 100644 --- a/src/app/shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component.spec.ts +++ b/src/app/shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component.spec.ts @@ -23,7 +23,7 @@ const mockSearchResult = { hitHighlights: new MetadataMap() } as ItemSearchResult; -describe('ItemSearchResultComponent', () => { +describe('TypedItemSearchResultListElementComponent', () => { let comp: TypedItemSearchResultListElementComponent; let fixture: ComponentFixture; diff --git a/src/app/shared/object-list/item-type-badge/item-type-badge.component.spec.ts b/src/app/shared/object-list/item-type-badge/item-type-badge.component.spec.ts new file mode 100644 index 0000000000..04c40b73ff --- /dev/null +++ b/src/app/shared/object-list/item-type-badge/item-type-badge.component.spec.ts @@ -0,0 +1,83 @@ +import { ItemSearchResult } from '../../object-collection/shared/item-search-result.model'; +import { Item } from '../../../core/shared/item.model'; +import { of as observableOf } from 'rxjs/internal/observable/of'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { TranslateModule } from '@ngx-translate/core'; +import { TruncatePipe } from '../../utils/truncate.pipe'; +import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; +import { ItemTypeBadgeComponent } from './item-type-badge.component'; +import { By } from '@angular/platform-browser'; + +let comp: ItemTypeBadgeComponent; +let fixture: ComponentFixture; + +const type = 'authorOfPublication'; + +const mockItemWithRelationshipType: ItemSearchResult = new ItemSearchResult(); +mockItemWithRelationshipType.hitHighlights = {}; +mockItemWithRelationshipType.indexableObject = Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'relationship.type': [ + { + language: 'en_US', + value: type + } + ] + } +}); + +const mockItemWithoutRelationshipType: ItemSearchResult = new ItemSearchResult(); +mockItemWithoutRelationshipType.hitHighlights = {}; +mockItemWithoutRelationshipType.indexableObject = Object.assign(new Item(), { + bitstreams: observableOf({}), + metadata: { + 'dc.title': [ + { + language: 'en_US', + value: 'This is just another title' + } + ] + } +}); + +describe('ItemTypeBadgeComponent', () => { + beforeEach(async(() => { + TestBed.configureTestingModule({ + imports: [TranslateModule.forRoot()], + declarations: [ItemTypeBadgeComponent, TruncatePipe], + schemas: [NO_ERRORS_SCHEMA] + }).overrideComponent(ItemTypeBadgeComponent, { + set: { changeDetection: ChangeDetectionStrategy.Default } + }).compileComponents(); + })); + + beforeEach(async(() => { + fixture = TestBed.createComponent(ItemTypeBadgeComponent); + comp = fixture.componentInstance; + })); + + describe('When the item has a relationship type', () => { + beforeEach(() => { + comp.object = mockItemWithRelationshipType; + fixture.detectChanges(); + }); + + it('should show the relationship type badge', () => { + const badge = fixture.debugElement.query(By.css('span.badge')); + expect(badge.nativeElement.textContent).toContain(type.toLowerCase()); + }); + }); + + describe('When the item has no relationship type', () => { + beforeEach(() => { + comp.object = mockItemWithoutRelationshipType; + fixture.detectChanges(); + }); + + it('should not show a badge', () => { + const badge = fixture.debugElement.query(By.css('span.badge')); + expect(badge).toBeNull(); + }); + }); +}); diff --git a/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.spec.ts b/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.spec.ts index a370d3a632..8f41018404 100644 --- a/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.spec.ts +++ b/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.spec.ts @@ -33,20 +33,6 @@ mockItemWithRelationshipType.indexableObject = Object.assign(new Item(), { } }); -const mockItemWithoutRelationshipType: ItemSearchResult = new ItemSearchResult(); -mockItemWithoutRelationshipType.hitHighlights = {}; -mockItemWithoutRelationshipType.indexableObject = Object.assign(new Item(), { - bitstreams: observableOf({}), - metadata: { - 'dc.title': [ - { - language: 'en_US', - value: 'This is just another title' - } - ] - } -}); - describe('ItemSearchResultListElementComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ @@ -54,7 +40,7 @@ describe('ItemSearchResultListElementComponent', () => { declarations: [ItemSearchResultListElementComponent, TruncatePipe], providers: [ { provide: TruncatableService, useValue: truncatableServiceStub }, - { provide: 'objectElementProvider', useValue: (mockItemWithoutRelationshipType) } + { provide: 'objectElementProvider', useValue: (mockItemWithRelationshipType) } ], schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(ItemSearchResultListElementComponent, { @@ -67,27 +53,8 @@ describe('ItemSearchResultListElementComponent', () => { itemSearchResultListElementComponent = fixture.componentInstance; })); - describe('When the item has a relationship type', () => { - beforeEach(() => { - itemSearchResultListElementComponent.object = mockItemWithRelationshipType; - fixture.detectChanges(); - }); - - it('should show the relationship type badge', () => { - const badge = fixture.debugElement.query(By.css('span.badge')); - expect(badge.nativeElement.textContent).toContain(type.toLowerCase()); - }); - }); - - describe('When the item has no relationship type', () => { - beforeEach(() => { - itemSearchResultListElementComponent.object = mockItemWithoutRelationshipType; - fixture.detectChanges(); - }); - - it('should not show a badge', () => { - const badge = fixture.debugElement.query(By.css('span.badge')); - expect(badge).toBeNull(); - }); + it('should show a badge on top of the list element', () => { + const badge = fixture.debugElement.query(By.css('ds-item-type-badge')).componentInstance; + expect(badge.object).toBe(mockItemWithRelationshipType); }); }); From bd8177c17d88e55f7f120855e67f3cfbd7f6f4a7 Mon Sep 17 00:00:00 2001 From: Kristof De Langhe Date: Fri, 7 Jun 2019 17:46:45 +0200 Subject: [PATCH 05/18] 62741: AoT build fix --- .../object-list/item-type-badge/item-type-badge.component.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/shared/object-list/item-type-badge/item-type-badge.component.ts b/src/app/shared/object-list/item-type-badge/item-type-badge.component.ts index 53e36a535d..9ffba33758 100644 --- a/src/app/shared/object-list/item-type-badge/item-type-badge.component.ts +++ b/src/app/shared/object-list/item-type-badge/item-type-badge.component.ts @@ -1,10 +1,12 @@ import { Component, Input } from '@angular/core'; import { ListableObject } from '../../object-collection/shared/listable-object.model'; +import { SearchResult } from '../../../+search-page/search-result.model'; +import { DSpaceObject } from '../../../core/shared/dspace-object.model'; @Component({ selector: 'ds-item-type-badge', templateUrl: './item-type-badge.component.html' }) export class ItemTypeBadgeComponent { - @Input() object: ListableObject; + @Input() object: SearchResult; } From 279b80b4de865c3474591610f8c1ca1e54865883 Mon Sep 17 00:00:00 2001 From: Yana De Pauw Date: Mon, 5 Aug 2019 13:14:03 +0200 Subject: [PATCH 06/18] 62769: Bitstream format registry --- resources/i18n/en.json | 82 ++++- .../admin-registries-routing.module.ts | 23 +- .../admin-registries.module.ts | 6 +- .../add-bitstream-format.component.html | 11 + .../add-bitstream-format.component.spec.ts | 109 ++++++ .../add-bitstream-format.component.ts | 49 +++ .../bitstream-format.actions.ts | 64 ++++ .../bitstream-format.reducers.spec.ts | 83 +++++ .../bitstream-format.reducers.ts | 55 +++ .../bitstream-formats-routing.module.ts | 37 ++ .../bitstream-formats.component.html | 33 +- .../bitstream-formats.component.spec.ts | 316 ++++++++++++++---- .../bitstream-formats.component.ts | 134 +++++++- .../bitstream-formats.module.ts | 30 ++ .../bitstream-formats.resolver.ts | 31 ++ .../edit-bitstream-format.component.html | 11 + .../edit-bitstream-format.component.spec.ts | 126 +++++++ .../edit-bitstream-format.component.ts | 62 ++++ .../format-form/format-form.component.html | 3 + .../format-form/format-form.component.spec.ts | 108 ++++++ .../format-form/format-form.component.ts | 193 +++++++++++ src/app/+admin/admin-routing.module.ts | 10 +- src/app/app-routing.module.ts | 8 +- src/app/app.reducer.ts | 6 + .../normalized-bitstream-format.model.ts | 6 +- src/app/core/core.module.ts | 2 + .../bitstream-format-data.service.spec.ts | 293 ++++++++++++++++ .../data/bitstream-format-data.service.ts | 183 ++++++++++ .../registry/mock-bitstream-format.model.ts | 8 - ...egistry-bitstreamformats-response.model.ts | 6 +- .../core/registry/registry.service.spec.ts | 75 ++--- src/app/core/registry/registry.service.ts | 102 ++---- .../shared/bitstream-format-support-level.ts | 5 + src/app/core/shared/bitstream-format.model.ts | 13 +- ...amic-form-control-container.component.html | 2 +- 35 files changed, 2039 insertions(+), 246 deletions(-) create mode 100644 src/app/+admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.html create mode 100644 src/app/+admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.spec.ts create mode 100644 src/app/+admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.ts create mode 100644 src/app/+admin/admin-registries/bitstream-formats/bitstream-format.actions.ts create mode 100644 src/app/+admin/admin-registries/bitstream-formats/bitstream-format.reducers.spec.ts create mode 100644 src/app/+admin/admin-registries/bitstream-formats/bitstream-format.reducers.ts create mode 100644 src/app/+admin/admin-registries/bitstream-formats/bitstream-formats-routing.module.ts create mode 100644 src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.module.ts create mode 100644 src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.resolver.ts create mode 100644 src/app/+admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.html create mode 100644 src/app/+admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.spec.ts create mode 100644 src/app/+admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.ts create mode 100644 src/app/+admin/admin-registries/bitstream-formats/format-form/format-form.component.html create mode 100644 src/app/+admin/admin-registries/bitstream-formats/format-form/format-form.component.spec.ts create mode 100644 src/app/+admin/admin-registries/bitstream-formats/format-form/format-form.component.ts create mode 100644 src/app/core/data/bitstream-format-data.service.spec.ts create mode 100644 src/app/core/data/bitstream-format-data.service.ts delete mode 100644 src/app/core/registry/mock-bitstream-format.model.ts create mode 100644 src/app/core/shared/bitstream-format-support-level.ts diff --git a/resources/i18n/en.json b/resources/i18n/en.json index a066ffe9d0..4ae852c9af 100644 --- a/resources/i18n/en.json +++ b/resources/i18n/en.json @@ -721,19 +721,77 @@ "title": "DSpace Angular :: Bitstream Format Registry", "head": "Bitstream Format Registry", "description": "This list of bitstream formats provides information about known formats and their support level.", - "formats": { - "table": { - "name": "Name", - "mimetype": "MIME Type", - "supportLevel": { - "head": "Support Level", - "0": "Unknown", - "1": "Known", - "2": "Support" - }, - "internal": "internal" + "create": { + "new": "Add a new bitstream format", + "head": "Create Bitstream format", + "success" : { + "head": "Success", + "content": "The new bitstream format was successfully created." }, - "no-items": "No bitstream formats to show." + "failure" : { + "head": "Failure", + "content": "An error occurred while creating the new bitstream format." + } + }, + "table": { + "name": "Name", + "mimetype": "MIME Type", + "supportLevel": { + "head": "Support Level", + "UNKNOWN": "Unknown", + "KNOWN": "Known", + "SUPPORTED": "Supported" + }, + "internal": "internal", + "delete": "Delete selected", + "return": "Return", + "deselect-all": "Deselect all" + }, + "no-items": "No bitstream formats to show.", + "edit": { + "head": "Bitstream format: {{ format }}", + "shortDescription": { + "label": "Name", + "hint": "A unique name for this format, (e.g. Microsoft Word XP or Microsoft Word 2000)" + }, + "mimetype": { + "label": "MIME Type", + "hint": "The MIME type associated with this format, does not have to be unique." + }, + "description": { + "label": "Description", + "hint": "" + }, + "supportLevel": { + "label": "Support level", + "hint": "The level of support your institution pledges for this format." + }, + "internal": { + "label": "Internal", + "hint": "Formats marked as internal are are hidden from the user, and used for administrative purposes." + }, + "extensions": { + "label": "File extensions", + "hint": "Extensions are file extensions that are used to automatically identify the format of uploaded files. You can enter several extensions for each format." + }, + "success" : { + "head": "Success", + "content": "The bitstream format was successfully edited." + }, + "failure" : { + "head": "Failure", + "content": "An error occurred while editing the bitstream format." + } + }, + "delete": { + "success":{ + "head": "Success", + "amount": "The following amount of bitstream formats have been successfully deleted: {{ amount }}" + }, + "failure": { + "head": "Failure", + "amount": "The following amount of bitstream formats could not be deleted: {{ amount }} " + } } } } diff --git a/src/app/+admin/admin-registries/admin-registries-routing.module.ts b/src/app/+admin/admin-registries/admin-registries-routing.module.ts index 8e3c322bc8..afdc46bf17 100644 --- a/src/app/+admin/admin-registries/admin-registries-routing.module.ts +++ b/src/app/+admin/admin-registries/admin-registries-routing.module.ts @@ -2,14 +2,29 @@ import { MetadataRegistryComponent } from './metadata-registry/metadata-registry import { RouterModule } from '@angular/router'; import { NgModule } from '@angular/core'; import { MetadataSchemaComponent } from './metadata-schema/metadata-schema.component'; -import { BitstreamFormatsComponent } from './bitstream-formats/bitstream-formats.component'; +import { URLCombiner } from '../../core/url-combiner/url-combiner'; +import { getRegistriesModulePath } from '../admin-routing.module'; + +const BITSTREAMFORMATS_MODULE_PATH = 'bitstream-formats'; + +export function getBitstreamFormatsModulePath() { + return new URLCombiner(getRegistriesModulePath(), BITSTREAMFORMATS_MODULE_PATH).toString(); +} @NgModule({ imports: [ RouterModule.forChild([ - { path: 'metadata', component: MetadataRegistryComponent, data: { title: 'admin.registries.metadata.title' } }, - { path: 'metadata/:schemaName', component: MetadataSchemaComponent, data: { title: 'admin.registries.schema.title' } }, - { path: 'bitstream-formats', component: BitstreamFormatsComponent, data: { title: 'admin.registries.bitstream-formats.title' } }, + {path: 'metadata', component: MetadataRegistryComponent, data: {title: 'admin.registries.metadata.title'}}, + { + path: 'metadata/:schemaName', + component: MetadataSchemaComponent, + data: {title: 'admin.registries.schema.title'} + }, + { + path: BITSTREAMFORMATS_MODULE_PATH, + loadChildren: './bitstream-formats/bitstream-formats.module#BitstreamFormatsModule', + data: {title: 'admin.registries.bitstream-formats.title'} + }, ]) ] }) diff --git a/src/app/+admin/admin-registries/admin-registries.module.ts b/src/app/+admin/admin-registries/admin-registries.module.ts index c7890e6697..bbeb59f0ab 100644 --- a/src/app/+admin/admin-registries/admin-registries.module.ts +++ b/src/app/+admin/admin-registries/admin-registries.module.ts @@ -5,10 +5,10 @@ import { CommonModule } from '@angular/common'; import { MetadataSchemaComponent } from './metadata-schema/metadata-schema.component'; import { RouterModule } from '@angular/router'; import { TranslateModule } from '@ngx-translate/core'; -import { BitstreamFormatsComponent } from './bitstream-formats/bitstream-formats.component'; import { SharedModule } from '../../shared/shared.module'; import { MetadataSchemaFormComponent } from './metadata-registry/metadata-schema-form/metadata-schema-form.component'; -import {MetadataFieldFormComponent} from './metadata-schema/metadata-field-form/metadata-field-form.component'; +import { MetadataFieldFormComponent } from './metadata-schema/metadata-field-form/metadata-field-form.component'; +import { BitstreamFormatsModule } from './bitstream-formats/bitstream-formats.module'; @NgModule({ imports: [ @@ -16,12 +16,12 @@ import {MetadataFieldFormComponent} from './metadata-schema/metadata-field-form/ SharedModule, RouterModule, TranslateModule, + BitstreamFormatsModule, AdminRegistriesRoutingModule ], declarations: [ MetadataRegistryComponent, MetadataSchemaComponent, - BitstreamFormatsComponent, MetadataSchemaFormComponent, MetadataFieldFormComponent ], diff --git a/src/app/+admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.html b/src/app/+admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.html new file mode 100644 index 0000000000..c05f3badeb --- /dev/null +++ b/src/app/+admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.html @@ -0,0 +1,11 @@ +

+
+
+

{{ 'admin.registries.bitstream-formats.create.new' | translate }}

+ + + +
+
+
\ No newline at end of file diff --git a/src/app/+admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.spec.ts b/src/app/+admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.spec.ts new file mode 100644 index 0000000000..21d997d628 --- /dev/null +++ b/src/app/+admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.spec.ts @@ -0,0 +1,109 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { CommonModule } from '@angular/common'; +import { RouterTestingModule } from '@angular/router/testing'; +import { TranslateModule } from '@ngx-translate/core'; +import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { Router } from '@angular/router'; +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { RouterStub } from '../../../../shared/testing/router-stub'; +import { of as observableOf } from 'rxjs'; +import { NotificationsService } from '../../../../shared/notifications/notifications.service'; +import { NotificationsServiceStub } from '../../../../shared/testing/notifications-service-stub'; +import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service'; +import { RestResponse } from '../../../../core/cache/response.models'; +import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model'; +import { BitstreamFormatSupportLevel } from '../../../../core/shared/bitstream-format-support-level'; +import { ResourceType } from '../../../../core/shared/resource-type'; +import { AddBitstreamFormatComponent } from './add-bitstream-format.component'; + +describe('AddBitstreamFormatComponent', () => { + let comp: AddBitstreamFormatComponent; + let fixture: ComponentFixture; + + const bitstreamFormat: BitstreamFormat = { + uuid: 'test-uuid', + id: 'test-uuid', + shortDescription: 'Adobe PDF', + description: 'Adobe Portable Document Format', + mimetype: 'application/pdf', + supportLevel: BitstreamFormatSupportLevel.Unknown, + internal: false, + extensions: ['pdf', 'also-pdf'], + type: ResourceType.BitstreamFormat, + self: 'self-link' + }; + + let router; + let notificationService: NotificationsServiceStub; + let bitstreamFormatDataService: BitstreamFormatDataService; + + const initAsync = () => { + router = new RouterStub(); + notificationService = new NotificationsServiceStub(); + bitstreamFormatDataService = jasmine.createSpyObj('bitstreamFormatDataService', { + createBitstreamFormat: observableOf(new RestResponse(true, 200, 'Success')), + clearBitStreamFormatRequests: observableOf(null) + }); + + TestBed.configureTestingModule({ + imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule.forRoot()], + declarations: [AddBitstreamFormatComponent], + providers: [ + {provide: Router, useValue: router}, + {provide: NotificationsService, useValue: notificationService}, + {provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService}, + ], + schemas: [CUSTOM_ELEMENTS_SCHEMA] + }).compileComponents(); + }; + + const initBeforeEach = () => { + fixture = TestBed.createComponent(AddBitstreamFormatComponent); + comp = fixture.componentInstance; + + fixture.detectChanges(); + }; + + describe('createBitstreamFormat success', () => { + beforeEach(async(initAsync)); + beforeEach(initBeforeEach); + it('should send the updated form to the service, show a notification and navigate to ', () => { + comp.createBitstreamFormat(bitstreamFormat); + + expect(bitstreamFormatDataService.createBitstreamFormat).toHaveBeenCalledWith(bitstreamFormat); + expect(notificationService.success).toHaveBeenCalled(); + expect(router.navigate).toHaveBeenCalledWith(['/admin/registries/bitstream-formats']); + + }); + }); + describe('createBitstreamFormat error', () => { + beforeEach(async(() => { + router = new RouterStub(); + notificationService = new NotificationsServiceStub(); + bitstreamFormatDataService = jasmine.createSpyObj('bitstreamFormatDataService', { + createBitstreamFormat: observableOf(new RestResponse(false, 400, 'Bad Request')), + clearBitStreamFormatRequests: observableOf(null) + }); + + TestBed.configureTestingModule({ + imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule.forRoot()], + declarations: [AddBitstreamFormatComponent], + providers: [ + {provide: Router, useValue: router}, + {provide: NotificationsService, useValue: notificationService}, + {provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService}, + ], + schemas: [CUSTOM_ELEMENTS_SCHEMA] + }).compileComponents(); + })); + beforeEach(initBeforeEach); + it('should send the updated form to the service, show a notification and navigate to ', () => { + comp.createBitstreamFormat(bitstreamFormat); + + expect(bitstreamFormatDataService.createBitstreamFormat).toHaveBeenCalledWith(bitstreamFormat); + expect(notificationService.error).toHaveBeenCalled(); + expect(router.navigate).not.toHaveBeenCalled(); + + }); + }); +}); diff --git a/src/app/+admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.ts b/src/app/+admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.ts new file mode 100644 index 0000000000..9712be70ca --- /dev/null +++ b/src/app/+admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.ts @@ -0,0 +1,49 @@ +import { take } from 'rxjs/operators'; +import { Router } from '@angular/router'; +import { Component } from '@angular/core'; +import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model'; +import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service'; +import { RestResponse } from '../../../../core/cache/response.models'; +import { NotificationsService } from '../../../../shared/notifications/notifications.service'; +import { getBitstreamFormatsModulePath } from '../../admin-registries-routing.module'; +import { TranslateService } from '@ngx-translate/core'; + +/** + * This component renders the page to create a new bitstream format. + */ +@Component({ + selector: 'ds-add-bitstream-format', + templateUrl: './add-bitstream-format.component.html', +}) +export class AddBitstreamFormatComponent { + + constructor( + private router: Router, + private notificationService: NotificationsService, + private translateService: TranslateService, + private bitstreamFormatDataService: BitstreamFormatDataService, + ) { + } + + /** + * Creates a new bitstream format based on the provided bitstream format emitted by the form. + * When successful, a success notification will be shown and the user will be navigated back to the overview page. + * When failed, an error notification will be shown. + * @param bitstreamFormat + */ + createBitstreamFormat(bitstreamFormat: BitstreamFormat) { + this.bitstreamFormatDataService.createBitstreamFormat(bitstreamFormat).pipe(take(1) + ).subscribe((response: RestResponse) => { + if (response.isSuccessful) { + this.notificationService.success(this.translateService.get('admin.registries.bitstream-formats.create.success.head'), + this.translateService.get('admin.registries.bitstream-formats.create.success.content')); + this.router.navigate([getBitstreamFormatsModulePath()]); + this.bitstreamFormatDataService.clearBitStreamFormatRequests().subscribe(); + } else { + this.notificationService.error(this.translateService.get('admin.registries.bitstream-formats.create.failure.head'), + this.translateService.get('admin.registries.bitstream-formats.create.failure.content')); + } + } + ); + } +} diff --git a/src/app/+admin/admin-registries/bitstream-formats/bitstream-format.actions.ts b/src/app/+admin/admin-registries/bitstream-formats/bitstream-format.actions.ts new file mode 100644 index 0000000000..58b0686dfd --- /dev/null +++ b/src/app/+admin/admin-registries/bitstream-formats/bitstream-format.actions.ts @@ -0,0 +1,64 @@ +import { Action } from '@ngrx/store'; +import { type } from '../../../shared/ngrx/type'; +import { BitstreamFormat } from '../../../core/shared/bitstream-format.model'; + +/** + * For each action type in an action group, make a simple + * enum object for all of this group's action types. + * + * The 'type' utility function coerces strings into string + * literal types and runs a simple check to guarantee all + * action types in the application are unique. + */ +export const BitstreamFormatsRegistryActionTypes = { + + SELECT_FORMAT: type('dspace/bitstream-formats-registry/SELECT_FORMAT'), + DESELECT_FORMAT: type('dspace/bitstream-formats-registry/DESELECT_FORMAT'), + DESELECT_ALL_FORMAT: type('dspace/bitstream-formats-registry/DESELECT_ALL_FORMAT') +}; + +/* tslint:disable:max-classes-per-file */ +/** + * Used to select a single bitstream format in the bitstream format registry + */ +export class BitstreamFormatsRegistrySelectAction implements Action { + type = BitstreamFormatsRegistryActionTypes.SELECT_FORMAT; + + bitstreamFormat: BitstreamFormat; + + constructor(bitstreamFormat: BitstreamFormat) { + this.bitstreamFormat = bitstreamFormat; + } +} + +/** + * Used to deselect a single bitstream format in the bitstream format registry + */ +export class BitstreamFormatsRegistryDeselectAction implements Action { + type = BitstreamFormatsRegistryActionTypes.DESELECT_FORMAT; + + bitstreamFormat: BitstreamFormat; + + constructor(bitstreamFormat: BitstreamFormat) { + this.bitstreamFormat = bitstreamFormat; + } +} + +/** + * Used to deselect all bitstream formats in the bitstream format registry + */ +export class BitstreamFormatsRegistryDeselectAllAction implements Action { + type = BitstreamFormatsRegistryActionTypes.DESELECT_ALL_FORMAT; +} + +/* tslint:enable:max-classes-per-file */ + +/** + * Export a type alias of all actions in this action group + * so that reducers can easily compose action types + * These are all the actions to perform on the bitstream format registry state + */ +export type BitstreamFormatsRegistryAction + = BitstreamFormatsRegistrySelectAction + | BitstreamFormatsRegistryDeselectAction + | BitstreamFormatsRegistryDeselectAllAction diff --git a/src/app/+admin/admin-registries/bitstream-formats/bitstream-format.reducers.spec.ts b/src/app/+admin/admin-registries/bitstream-formats/bitstream-format.reducers.spec.ts new file mode 100644 index 0000000000..76576afc7a --- /dev/null +++ b/src/app/+admin/admin-registries/bitstream-formats/bitstream-format.reducers.spec.ts @@ -0,0 +1,83 @@ +import { Action } from '@ngrx/store'; +import { BitstreamFormat } from '../../../core/shared/bitstream-format.model'; +import { bitstreamFormatReducer, BitstreamFormatRegistryState } from './bitstream-format.reducers'; +import { + BitstreamFormatsRegistryDeselectAction, + BitstreamFormatsRegistryDeselectAllAction, + BitstreamFormatsRegistrySelectAction +} from './bitstream-format.actions'; + +const bitstreamFormat1: BitstreamFormat = new BitstreamFormat(); +bitstreamFormat1.id = 'test-uuid-1'; +bitstreamFormat1.shortDescription = 'test-short-1'; + +const bitstreamFormat2: BitstreamFormat = new BitstreamFormat(); +bitstreamFormat2.id = 'test-uuid-2'; +bitstreamFormat2.shortDescription = 'test-short-2'; + +const initialState: BitstreamFormatRegistryState = { + selectedBitstreamFormats: [] +}; + +const bitstream1SelectedState: BitstreamFormatRegistryState = { + selectedBitstreamFormats: [bitstreamFormat1] +}; + +const bitstream1and2SelectedState: BitstreamFormatRegistryState = { + selectedBitstreamFormats: [bitstreamFormat1, bitstreamFormat2] +}; + +describe('BitstreamFormatReducer', () => { + describe('BitstreamFormatsRegistryActionTypes.SELECT_FORMAT', () => { + it('should add the format to the list of selected formats when initial list is empty', () => { + const state = initialState; + const action = new BitstreamFormatsRegistrySelectAction(bitstreamFormat1); + const newState = bitstreamFormatReducer(state, action); + + expect(newState).toEqual(bitstream1SelectedState); + }); + it('should add the format to the list of selected formats when formats are already present', () => { + const state = bitstream1SelectedState; + const action = new BitstreamFormatsRegistrySelectAction(bitstreamFormat2); + const newState = bitstreamFormatReducer(state, action); + + expect(newState).toEqual(bitstream1and2SelectedState); + }); + }); + describe('BitstreamFormatsRegistryActionTypes.DESELECT_FORMAT', () => { + it('should deselect a format', () => { + const state = bitstream1and2SelectedState; + const action = new BitstreamFormatsRegistryDeselectAction(bitstreamFormat2); + const newState = bitstreamFormatReducer(state, action); + + expect(newState).toEqual(bitstream1SelectedState); + }); + }); + describe('BitstreamFormatsRegistryActionTypes.DESELECT_ALL_FORMAT', () => { + it('should deselect all formats', () => { + const state = bitstream1and2SelectedState; + const action = new BitstreamFormatsRegistryDeselectAllAction(); + const newState = bitstreamFormatReducer(state, action); + + expect(newState).toEqual(initialState); + }); + }); + describe('Invalid action', () => { + it('should return the current state', () => { + const state = initialState; + const action = new NullAction(); + + const newState = bitstreamFormatReducer(state, action); + + expect(newState).toEqual(state); + }); + }); +}); + +class NullAction implements Action { + type = null; + + constructor() { + // empty constructor + } +} diff --git a/src/app/+admin/admin-registries/bitstream-formats/bitstream-format.reducers.ts b/src/app/+admin/admin-registries/bitstream-formats/bitstream-format.reducers.ts new file mode 100644 index 0000000000..41880bf16c --- /dev/null +++ b/src/app/+admin/admin-registries/bitstream-formats/bitstream-format.reducers.ts @@ -0,0 +1,55 @@ +import { BitstreamFormat } from '../../../core/shared/bitstream-format.model'; +import { + BitstreamFormatsRegistryAction, + BitstreamFormatsRegistryActionTypes, + BitstreamFormatsRegistryDeselectAction, + BitstreamFormatsRegistrySelectAction +} from './bitstream-format.actions'; + +/** + * The bitstream format registry state. + * @interface BitstreamFormatRegistryState + */ +export interface BitstreamFormatRegistryState { + selectedBitstreamFormats: BitstreamFormat[]; +} + +/** + * The initial state. + */ +const initialState: BitstreamFormatRegistryState = { + selectedBitstreamFormats: [], +}; + +/** + * Reducer that handles BitstreamFormatsRegistryActions to modify the bitstream format registry state + * @param state The current BitstreamFormatRegistryState + * @param action The BitstreamFormatsRegistryAction to perform on the state + */ +export function bitstreamFormatReducer(state = initialState, action: BitstreamFormatsRegistryAction): BitstreamFormatRegistryState { + + switch (action.type) { + + case BitstreamFormatsRegistryActionTypes.SELECT_FORMAT: { + return Object.assign({}, state, { + selectedBitstreamFormats: [...state.selectedBitstreamFormats, (action as BitstreamFormatsRegistrySelectAction).bitstreamFormat] + }); + } + + case BitstreamFormatsRegistryActionTypes.DESELECT_FORMAT: { + return Object.assign({}, state, { + selectedBitstreamFormats: state.selectedBitstreamFormats.filter( + (selectedBitstreamFormats) => selectedBitstreamFormats !== (action as BitstreamFormatsRegistryDeselectAction).bitstreamFormat + ) + }); + } + + case BitstreamFormatsRegistryActionTypes.DESELECT_ALL_FORMAT: { + return Object.assign({}, state, { + selectedBitstreamFormats: [] + }); + } + default: + return state; + } +} diff --git a/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats-routing.module.ts b/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats-routing.module.ts new file mode 100644 index 0000000000..67f6aa373e --- /dev/null +++ b/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats-routing.module.ts @@ -0,0 +1,37 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { BitstreamFormatsResolver } from './bitstream-formats.resolver'; +import { EditBitstreamFormatComponent } from './edit-bitstream-format/edit-bitstream-format.component'; +import { BitstreamFormatsComponent } from './bitstream-formats.component'; +import { AddBitstreamFormatComponent } from './add-bitstream-format/add-bitstream-format.component'; + +const BITSTREAMFORMAT_EDIT_PATH = ':id/edit'; +const BITSTREAMFORMAT_ADD_PATH = 'add'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { + path: '', + component: BitstreamFormatsComponent + }, + { + path: BITSTREAMFORMAT_ADD_PATH, + component: AddBitstreamFormatComponent, + }, + { + path: BITSTREAMFORMAT_EDIT_PATH, + component: EditBitstreamFormatComponent, + resolve: { + bitstreamFormat: BitstreamFormatsResolver + } + }, + ]) + ], + providers: [ + BitstreamFormatsResolver, + ] +}) +export class BitstreamFormatsRoutingModule { + +} diff --git a/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.html b/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.html index 1ac547653f..ec1993c0f4 100644 --- a/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.html +++ b/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.html @@ -4,11 +4,13 @@ -

{{'admin.registries.bitstream-formats.description' | translate}}

+

{{'admin.registries.bitstream-formats.description' | translate}}

+

{{'admin.registries.bitstream-formats.create.new' | translate}}

+ - {{'admin.registries.bitstream-formats.formats.table.name' | translate}} - {{'admin.registries.bitstream-formats.formats.table.mimetype' | translate}} - {{'admin.registries.bitstream-formats.formats.table.supportLevel.head' | translate}} + + {{'admin.registries.bitstream-formats.table.name' | translate}} + {{'admin.registries.bitstream-formats.table.mimetype' | translate}} + {{'admin.registries.bitstream-formats.table.supportLevel.head' | translate}} - {{bitstreamFormat.shortDescription}} - {{bitstreamFormat.mimetype}} ({{'admin.registries.bitstream-formats.formats.table.internal' | translate}}) - {{'admin.registries.bitstream-formats.formats.table.supportLevel.'+bitstreamFormat.supportLevel | translate}} + + + + {{bitstreamFormat.shortDescription}} + {{bitstreamFormat.mimetype}} ({{'admin.registries.bitstream-formats.table.internal' | translate}}) + {{'admin.registries.bitstream-formats.table.supportLevel.'+bitstreamFormat.supportLevel | translate}}
+
+ + +
diff --git a/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.spec.ts b/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.spec.ts index b6e3b7e989..be82e26033 100644 --- a/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.spec.ts +++ b/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.spec.ts @@ -1,6 +1,5 @@ import { BitstreamFormatsComponent } from './bitstream-formats.component'; import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { RegistryService } from '../../../core/registry/registry.service'; import { of as observableOf } from 'rxjs'; import { RemoteData } from '../../../core/data/remote-data'; import { PaginatedList } from '../../../core/data/paginated-list'; @@ -13,85 +12,288 @@ import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; import { EnumKeysPipe } from '../../../shared/utils/enum-keys-pipe'; import { HostWindowService } from '../../../shared/host-window.service'; import { HostWindowServiceStub } from '../../../shared/testing/host-window-service-stub'; +import { BitstreamFormatDataService } from '../../../core/data/bitstream-format-data.service'; +import { NotificationsService } from '../../../shared/notifications/notifications.service'; +import { NotificationsServiceStub } from '../../../shared/testing/notifications-service-stub'; +import { BitstreamFormat } from '../../../core/shared/bitstream-format.model'; +import { ResourceType } from '../../../core/shared/resource-type'; +import { BitstreamFormatSupportLevel } from '../../../core/shared/bitstream-format-support-level'; +import { cold, getTestScheduler, hot } from 'jasmine-marbles'; +import { TestScheduler } from 'rxjs/testing'; describe('BitstreamFormatsComponent', () => { let comp: BitstreamFormatsComponent; let fixture: ComponentFixture; - let registryService: RegistryService; - const mockFormatsList = [ - { - shortDescription: 'Unknown', - description: 'Unknown data format', - mimetype: 'application/octet-stream', - supportLevel: 0, - internal: false, - extensions: null - }, - { - shortDescription: 'License', - description: 'Item-specific license agreed upon to submission', - mimetype: 'text/plain; charset=utf-8', - supportLevel: 1, - internal: true, - extensions: null - }, - { - shortDescription: 'CC License', - description: 'Item-specific Creative Commons license agreed upon to submission', - mimetype: 'text/html; charset=utf-8', - supportLevel: 2, - internal: true, - extensions: null - }, - { - shortDescription: 'Adobe PDF', - description: 'Adobe Portable Document Format', - mimetype: 'application/pdf', - supportLevel: 0, - internal: false, - extensions: null - } - ]; - const mockFormats = observableOf(new RemoteData(false, false, true, undefined, new PaginatedList(null, mockFormatsList))); - const registryServiceStub = { - getBitstreamFormats: () => mockFormats + let bitstreamFormatService; + let scheduler: TestScheduler; + let notificationsServiceStub; + + const bitstreamFormat1: BitstreamFormat = { + uuid: 'test-uuid-1', + id: 'test-uuid-1', + shortDescription: 'Unknown', + description: 'Unknown data format', + mimetype: 'application/octet-stream', + supportLevel: BitstreamFormatSupportLevel.Unknown, + internal: false, + extensions: null, + type: ResourceType.BitstreamFormat, + self: 'self-link' + }; + const bitstreamFormat2: BitstreamFormat = { + uuid: 'test-uuid-2', + id: 'test-uuid-2', + shortDescription: 'License', + description: 'Item-specific license agreed upon to submission', + mimetype: 'text/plain; charset=utf-8', + supportLevel: BitstreamFormatSupportLevel.Known, + internal: true, + extensions: null, + type: ResourceType.BitstreamFormat, + self: 'self-link' + }; + const bitstreamFormat3: BitstreamFormat = { + uuid: 'test-uuid-3', + id: 'test-uuid-3', + shortDescription: 'CC License', + description: 'Item-specific Creative Commons license agreed upon to submission', + mimetype: 'text/html; charset=utf-8', + supportLevel: BitstreamFormatSupportLevel.Supported, + internal: true, + extensions: null, + type: ResourceType.BitstreamFormat, + self: 'self-link' + }; + const bitstreamFormat4: BitstreamFormat = { + uuid: 'test-uuid-4', + id: 'test-uuid-4', + shortDescription: 'Adobe PDF', + description: 'Adobe Portable Document Format', + mimetype: 'application/pdf', + supportLevel: BitstreamFormatSupportLevel.Unknown, + internal: false, + extensions: null, + type: ResourceType.BitstreamFormat, + self: 'self-link' }; - beforeEach(async(() => { + const mockFormatsList: BitstreamFormat[] = [ + bitstreamFormat1, + bitstreamFormat2, + bitstreamFormat3, + bitstreamFormat4 + ]; + const mockFormatsRD = new RemoteData(false, false, true, undefined, new PaginatedList(null, mockFormatsList)); + + const initAsync = () => { + notificationsServiceStub = new NotificationsServiceStub(); + + scheduler = getTestScheduler(); + + bitstreamFormatService = jasmine.createSpyObj('bitstreamFormatService', { + findAll: observableOf(mockFormatsRD), + find: observableOf(new RemoteData(false, false, true, undefined, mockFormatsList[0])), + getSelectedBitstreamFormats: hot('a', {a: mockFormatsList}), + selectBitstreamFormat: {}, + deselectBitstreamFormat: {}, + deselectAllBitstreamFormats: {}, + delete: observableOf(true), + clearBitStreamFormatRequests: observableOf('cleared') + }); + TestBed.configureTestingModule({ imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule.forRoot()], declarations: [BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe], providers: [ - { provide: RegistryService, useValue: registryServiceStub }, - { provide: HostWindowService, useValue: new HostWindowServiceStub(0) } + {provide: BitstreamFormatDataService, useValue: bitstreamFormatService}, + {provide: HostWindowService, useValue: new HostWindowServiceStub(0)}, + {provide: NotificationsService, useValue: notificationsServiceStub} ] }).compileComponents(); - })); + }; - beforeEach(() => { + const initBeforeEach = () => { fixture = TestBed.createComponent(BitstreamFormatsComponent); comp = fixture.componentInstance; fixture.detectChanges(); - registryService = (comp as any).service; + }; + + describe('Bitstream format page content', () => { + beforeEach(async(initAsync)); + beforeEach(initBeforeEach); + + it('should contain four formats', () => { + const tbody: HTMLElement = fixture.debugElement.query(By.css('#formats>tbody')).nativeElement; + expect(tbody.children.length).toBe(4); + }); + + it('should contain the correct formats', () => { + const unknownName: HTMLElement = fixture.debugElement.query(By.css('#formats tr:nth-child(1) td:nth-child(2)')).nativeElement; + expect(unknownName.textContent).toBe('Unknown'); + + const licenseName: HTMLElement = fixture.debugElement.query(By.css('#formats tr:nth-child(2) td:nth-child(2)')).nativeElement; + expect(licenseName.textContent).toBe('License'); + + const ccLicenseName: HTMLElement = fixture.debugElement.query(By.css('#formats tr:nth-child(3) td:nth-child(2)')).nativeElement; + expect(ccLicenseName.textContent).toBe('CC License'); + + const adobeName: HTMLElement = fixture.debugElement.query(By.css('#formats tr:nth-child(4) td:nth-child(2)')).nativeElement; + expect(adobeName.textContent).toBe('Adobe PDF'); + }); }); - it('should contain four formats', () => { - const tbody: HTMLElement = fixture.debugElement.query(By.css('#formats>tbody')).nativeElement; - expect(tbody.children.length).toBe(4); + describe('selectBitStreamFormat', () => { + beforeEach(async(initAsync)); + beforeEach(initBeforeEach); + it('should select a bitstreamFormat if it was selected in the event', () => { + const event = {target: {checked: true}}; + + comp.selectBitStreamFormat(bitstreamFormat1, event); + + expect(bitstreamFormatService.selectBitstreamFormat).toHaveBeenCalledWith(bitstreamFormat1); + }); + it('should deselect a bitstreamFormat if it is deselected in the event', () => { + const event = {target: {checked: false}}; + + comp.selectBitStreamFormat(bitstreamFormat1, event); + + expect(bitstreamFormatService.deselectBitstreamFormat).toHaveBeenCalledWith(bitstreamFormat1); + }); + it('should be called when a user clicks a checkbox', () => { + spyOn(comp, 'selectBitStreamFormat'); + const unknownFormat = fixture.debugElement.query(By.css('#formats tr:nth-child(1) input')); + + const event = {target: {checked: true}}; + unknownFormat.triggerEventHandler('change', event); + + expect(comp.selectBitStreamFormat).toHaveBeenCalledWith(bitstreamFormat1, event); + }); }); - it('should contain the correct formats', () => { - const unknownName: HTMLElement = fixture.debugElement.query(By.css('#formats tr:nth-child(1) td:nth-child(1)')).nativeElement; - expect(unknownName.textContent).toBe('Unknown'); + describe('isSelected', () => { + beforeEach(async(initAsync)); + beforeEach(initBeforeEach); + it('should return an observable of true if the provided bistream is in the list returned by the service', () => { + const result = comp.isSelected(bitstreamFormat1); - const licenseName: HTMLElement = fixture.debugElement.query(By.css('#formats tr:nth-child(2) td:nth-child(1)')).nativeElement; - expect(licenseName.textContent).toBe('License'); + expect(result).toBeObservable(cold('b', {b: true})); + }); + it('should return an observable of false if the provided bistream is not in the list returned by the service', () => { + const format = new BitstreamFormat(); + format.uuid = 'new'; - const ccLicenseName: HTMLElement = fixture.debugElement.query(By.css('#formats tr:nth-child(3) td:nth-child(1)')).nativeElement; - expect(ccLicenseName.textContent).toBe('CC License'); + const result = comp.isSelected(format); - const adobeName: HTMLElement = fixture.debugElement.query(By.css('#formats tr:nth-child(4) td:nth-child(1)')).nativeElement; - expect(adobeName.textContent).toBe('Adobe PDF'); + expect(result).toBeObservable(cold('b', {b: false})); + }); }); + describe('deselectAll', () => { + beforeEach(async(initAsync)); + beforeEach(initBeforeEach); + it('should deselect all bitstreamFormats', () => { + comp.deselectAll(); + expect(bitstreamFormatService.deselectAllBitstreamFormats).toHaveBeenCalled(); + }); + + it('should be called when the deselect all button is clicked', () => { + spyOn(comp, 'deselectAll'); + const deselectAllButton = fixture.debugElement.query(By.css('button.deselect')); + deselectAllButton.triggerEventHandler('click', null); + + expect(comp.deselectAll).toHaveBeenCalled(); + + }); + }); + + describe('deleteFormats success', () => { + beforeEach(async(() => { + notificationsServiceStub = new NotificationsServiceStub(); + + scheduler = getTestScheduler(); + + bitstreamFormatService = jasmine.createSpyObj('bitstreamFormatService', { + findAll: observableOf(mockFormatsRD), + find: observableOf(new RemoteData(false, false, true, undefined, mockFormatsList[0])), + getSelectedBitstreamFormats: observableOf(mockFormatsList), + selectBitstreamFormat: {}, + deselectBitstreamFormat: {}, + deselectAllBitstreamFormats: {}, + delete: observableOf(true), + clearBitStreamFormatRequests: observableOf('cleared') + }); + + TestBed.configureTestingModule({ + imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule.forRoot()], + declarations: [BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe], + providers: [ + {provide: BitstreamFormatDataService, useValue: bitstreamFormatService}, + {provide: HostWindowService, useValue: new HostWindowServiceStub(0)}, + {provide: NotificationsService, useValue: notificationsServiceStub} + ] + }).compileComponents(); + } + )); + + beforeEach(initBeforeEach); + it('should clear bitstream formats ', () => { + comp.deleteFormats(); + + expect(bitstreamFormatService.clearBitStreamFormatRequests).toHaveBeenCalled(); + expect(bitstreamFormatService.delete).toHaveBeenCalledWith(bitstreamFormat1); + expect(bitstreamFormatService.delete).toHaveBeenCalledWith(bitstreamFormat2); + expect(bitstreamFormatService.delete).toHaveBeenCalledWith(bitstreamFormat3); + expect(bitstreamFormatService.delete).toHaveBeenCalledWith(bitstreamFormat4); + + expect(notificationsServiceStub.success).toHaveBeenCalledWith('admin.registries.bitstream-formats.delete.success.head', + 'admin.registries.bitstream-formats.delete.success.amount'); + expect(notificationsServiceStub.error).not.toHaveBeenCalled(); + + }); + }); + + describe('deleteFormats error', () => { + beforeEach(async(() => { + notificationsServiceStub = new NotificationsServiceStub(); + + scheduler = getTestScheduler(); + + bitstreamFormatService = jasmine.createSpyObj('bitstreamFormatService', { + findAll: observableOf(mockFormatsRD), + find: observableOf(new RemoteData(false, false, true, undefined, mockFormatsList[0])), + getSelectedBitstreamFormats: observableOf(mockFormatsList), + selectBitstreamFormat: {}, + deselectBitstreamFormat: {}, + deselectAllBitstreamFormats: {}, + delete: observableOf(false), + clearBitStreamFormatRequests: observableOf('cleared') + }); + + TestBed.configureTestingModule({ + imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule.forRoot()], + declarations: [BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe], + providers: [ + {provide: BitstreamFormatDataService, useValue: bitstreamFormatService}, + {provide: HostWindowService, useValue: new HostWindowServiceStub(0)}, + {provide: NotificationsService, useValue: notificationsServiceStub} + ] + }).compileComponents(); + } + )); + + beforeEach(initBeforeEach); + it('should clear bitstream formats ', () => { + comp.deleteFormats(); + + expect(bitstreamFormatService.clearBitStreamFormatRequests).toHaveBeenCalled(); + expect(bitstreamFormatService.delete).toHaveBeenCalledWith(bitstreamFormat1); + expect(bitstreamFormatService.delete).toHaveBeenCalledWith(bitstreamFormat2); + expect(bitstreamFormatService.delete).toHaveBeenCalledWith(bitstreamFormat3); + expect(bitstreamFormatService.delete).toHaveBeenCalledWith(bitstreamFormat4); + + expect(notificationsServiceStub.error).toHaveBeenCalledWith('admin.registries.bitstream-formats.delete.failure.head', + 'admin.registries.bitstream-formats.delete.failure.amount'); + expect(notificationsServiceStub.success).not.toHaveBeenCalled(); + }); + }); }); diff --git a/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.ts b/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.ts index bc0cbb8da6..5a619e3e05 100644 --- a/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.ts +++ b/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.ts @@ -1,10 +1,16 @@ -import { Component } from '@angular/core'; -import { RegistryService } from '../../../core/registry/registry.service'; -import { Observable } from 'rxjs'; +import { Component, OnInit } from '@angular/core'; +import { BehaviorSubject, combineLatest as observableCombineLatest, Observable, zip } from 'rxjs'; import { RemoteData } from '../../../core/data/remote-data'; import { PaginatedList } from '../../../core/data/paginated-list'; -import { BitstreamFormat } from '../../../core/registry/mock-bitstream-format.model'; import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model'; +import { BitstreamFormat } from '../../../core/shared/bitstream-format.model'; +import { BitstreamFormatDataService } from '../../../core/data/bitstream-format-data.service'; +import { FindAllOptions } from '../../../core/data/request.models'; +import { map, switchMap, take } from 'rxjs/operators'; +import { hasValue } from '../../../shared/empty.util'; +import { NotificationsService } from '../../../shared/notifications/notifications.service'; +import { Router } from '@angular/router'; +import { TranslateService } from '@ngx-translate/core'; /** * This component renders a list of bitstream formats @@ -13,24 +19,122 @@ import { PaginationComponentOptions } from '../../../shared/pagination/paginatio selector: 'ds-bitstream-formats', templateUrl: './bitstream-formats.component.html' }) -export class BitstreamFormatsComponent { +export class BitstreamFormatsComponent implements OnInit { /** * A paginated list of bitstream formats to be shown on the page */ bitstreamFormats: Observable>>; + /** + * A BehaviourSubject that keeps track of the pageState used to update the currently displayed bitstreamFormats + */ + pageState: BehaviorSubject; + + /** + * The current pagination configuration for the page used by the FindAll method + * Currently simply renders all bitstream formats + */ + config: FindAllOptions = Object.assign(new FindAllOptions(), { + elementsPerPage: 10000 + }); + /** * The current pagination configuration for the page * Currently simply renders all bitstream formats */ - config: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), { + pageConfig: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), { id: 'registry-bitstreamformats-pagination', pageSize: 10000 }); - constructor(private registryService: RegistryService) { - this.updateFormats(); + constructor(private notificationsService: NotificationsService, + private router: Router, + private translateService: TranslateService, + private bitstreamFormatService: BitstreamFormatDataService) { + } + + /** + * Deletes the currently selected formats from the registry and updates the presented list + */ + deleteFormats() { + this.bitstreamFormatService.clearBitStreamFormatRequests().subscribe(); + this.bitstreamFormatService.getSelectedBitstreamFormats().pipe(take(1)).subscribe( + (formats) => { + const tasks$ = []; + for (const format of formats) { + if (hasValue(format.id)) { + tasks$.push(this.bitstreamFormatService.delete(format)); + } + } + zip(...tasks$).subscribe((results: boolean[]) => { + const successResponses = results.filter((result: boolean) => result); + const failedResponses = results.filter((result: boolean) => !result); + if (successResponses.length > 0) { + this.showNotification(true, successResponses.length); + } + if (failedResponses.length > 0) { + this.showNotification(false, failedResponses.length); + } + + this.deselectAll(); + this.pageState.next('update-on-delete'); + }); + } + ); + } + + /** + * Deselects all selecetd bitstream formats + */ + deselectAll() { + this.bitstreamFormatService.deselectAllBitstreamFormats(); + } + + /** + * Checks whether a given bitstream format is selected in the list (checkbox) + * @param bitstreamFormat + */ + isSelected(bitstreamFormat: BitstreamFormat): Observable { + return this.bitstreamFormatService.getSelectedBitstreamFormats().pipe( + map((bitstreamFormats: BitstreamFormat[]) => { + return bitstreamFormats.find((selectedFormat) => selectedFormat.id === bitstreamFormat.id) != null; + }) + ); + } + + /** + * Selects or deselects a bitstream format based on the checkbox state + * @param bitstreamFormat + * @param event + */ + selectBitStreamFormat(bitstreamFormat: BitstreamFormat, event) { + event.target.checked ? + this.bitstreamFormatService.selectBitstreamFormat(bitstreamFormat) : + this.bitstreamFormatService.deselectBitstreamFormat(bitstreamFormat); + } + + /** + * Show notifications for an amount of deleted bitstream formats + * @param success Whether or not the notification should be a success message (error message when false) + * @param amount The amount of deleted bitstream formats + */ + private showNotification(success: boolean, amount: number) { + const prefix = 'admin.registries.bitstream-formats.delete'; + const suffix = success ? 'success' : 'failure'; + + const messages = observableCombineLatest( + this.translateService.get(`${prefix}.${suffix}.head`), + this.translateService.get(`${prefix}.${suffix}.amount`, {amount: amount}) + ); + messages.subscribe(([head, content]) => { + + if (success) { + this.notificationsService.success(head, content); + } else { + this.notificationsService.error(head, content); + } + }); } /** @@ -39,13 +143,23 @@ export class BitstreamFormatsComponent { */ onPageChange(event) { this.config.currentPage = event; + this.pageConfig.currentPage = event; this.updateFormats(); } + ngOnInit(): void { + this.pageState = new BehaviorSubject('init'); + this.bitstreamFormats = this.pageState.pipe( + switchMap(() => { + return this.updateFormats() + ; + })); + } + /** - * Method to update the bitstream formats that are shown + * Finds all formats based on the current config */ private updateFormats() { - this.bitstreamFormats = this.registryService.getBitstreamFormats(this.config); + return this.bitstreamFormatService.findAll(this.config); } } diff --git a/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.module.ts b/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.module.ts new file mode 100644 index 0000000000..0800c50169 --- /dev/null +++ b/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.module.ts @@ -0,0 +1,30 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { RouterModule } from '@angular/router'; +import { TranslateModule } from '@ngx-translate/core'; +import { BitstreamFormatsComponent } from './bitstream-formats.component'; +import { SharedModule } from '../../../shared/shared.module'; +import { FormatFormComponent } from './format-form/format-form.component'; +import { EditBitstreamFormatComponent } from './edit-bitstream-format/edit-bitstream-format.component'; +import { BitstreamFormatsRoutingModule } from './bitstream-formats-routing.module'; +import { AddBitstreamFormatComponent } from './add-bitstream-format/add-bitstream-format.component'; + +@NgModule({ + imports: [ + CommonModule, + SharedModule, + RouterModule, + TranslateModule, + BitstreamFormatsRoutingModule + ], + declarations: [ + BitstreamFormatsComponent, + EditBitstreamFormatComponent, + AddBitstreamFormatComponent, + FormatFormComponent + ], + entryComponents: [] +}) +export class BitstreamFormatsModule { + +} diff --git a/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.resolver.ts b/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.resolver.ts new file mode 100644 index 0000000000..f6eef741fd --- /dev/null +++ b/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.resolver.ts @@ -0,0 +1,31 @@ +import { Injectable } from '@angular/core'; +import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/router'; +import { Observable } from 'rxjs'; +import { find } from 'rxjs/operators'; +import { RemoteData } from '../../../core/data/remote-data'; +import { BitstreamFormat } from '../../../core/shared/bitstream-format.model'; +import { BitstreamFormatDataService } from '../../../core/data/bitstream-format-data.service'; +import { hasValue } from '../../../shared/empty.util'; + +/** + * This class represents a resolver that requests a specific bitstreamFormat before the route is activated + */ +@Injectable() +export class BitstreamFormatsResolver implements Resolve> { + constructor(private bitstreamFormatDataService: BitstreamFormatDataService) { + } + + /** + * Method for resolving an bitstreamFormat based on the parameters in the current route + * @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot + * @param {RouterStateSnapshot} state The current RouterStateSnapshot + * @returns Observable<> Emits the found bitstreamFormat based on the parameters in the current route, + * or an error if something went wrong + */ + resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable> { + return this.bitstreamFormatDataService.findById(route.params.id) + .pipe( + find((RD) => hasValue(RD.error) || RD.hasSucceeded), + ); + } +} diff --git a/src/app/+admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.html b/src/app/+admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.html new file mode 100644 index 0000000000..8e7f2c7451 --- /dev/null +++ b/src/app/+admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.html @@ -0,0 +1,11 @@ +
+
+
+

{{'admin.registries.bitstream-formats.edit.head' | translate:{format: (bitstreamFormatRD$ | async)?.payload.shortDescription} }}

+ + + +
+
+
\ No newline at end of file diff --git a/src/app/+admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.spec.ts b/src/app/+admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.spec.ts new file mode 100644 index 0000000000..0f2c0808a2 --- /dev/null +++ b/src/app/+admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.spec.ts @@ -0,0 +1,126 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { CommonModule } from '@angular/common'; +import { RouterTestingModule } from '@angular/router/testing'; +import { TranslateModule } from '@ngx-translate/core'; +import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { ActivatedRoute, Router } from '@angular/router'; +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { RouterStub } from '../../../../shared/testing/router-stub'; +import { of as observableOf } from 'rxjs'; +import { RemoteData } from '../../../../core/data/remote-data'; +import { EditBitstreamFormatComponent } from './edit-bitstream-format.component'; +import { NotificationsService } from '../../../../shared/notifications/notifications.service'; +import { NotificationsServiceStub } from '../../../../shared/testing/notifications-service-stub'; +import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service'; +import { RestResponse } from '../../../../core/cache/response.models'; +import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model'; +import { BitstreamFormatSupportLevel } from '../../../../core/shared/bitstream-format-support-level'; +import { ResourceType } from '../../../../core/shared/resource-type'; + +describe('EditBitstreamFormatComponent', () => { + let comp: EditBitstreamFormatComponent; + let fixture: ComponentFixture; + + const bitstreamFormat: BitstreamFormat = { + uuid: 'test-uuid', + id: 'test-uuid', + shortDescription: 'Adobe PDF', + description: 'Adobe Portable Document Format', + mimetype: 'application/pdf', + supportLevel: BitstreamFormatSupportLevel.Unknown, + internal: false, + extensions: ['pdf', 'also-pdf'], + type: ResourceType.BitstreamFormat, + self: 'self-link' + }; + + const routeStub = { + data: observableOf({ + bitstreamFormat: new RemoteData(false, false, true, null, bitstreamFormat) + }) + }; + + let router; + let notificationService: NotificationsServiceStub; + let bitstreamFormatDataService: BitstreamFormatDataService; + + const initAsync = () => { + router = new RouterStub(); + notificationService = new NotificationsServiceStub(); + bitstreamFormatDataService = jasmine.createSpyObj('bitstreamFormatDataService', { + updateBitstreamFormat: observableOf(new RestResponse(true, 200, 'Success')) + }); + + TestBed.configureTestingModule({ + imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule.forRoot()], + declarations: [EditBitstreamFormatComponent], + providers: [ + {provide: ActivatedRoute, useValue: routeStub}, + {provide: Router, useValue: router}, + {provide: NotificationsService, useValue: notificationService}, + {provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService}, + ], + schemas: [CUSTOM_ELEMENTS_SCHEMA] + }).compileComponents(); + }; + + const initBeforeEach = () => { + fixture = TestBed.createComponent(EditBitstreamFormatComponent); + comp = fixture.componentInstance; + + fixture.detectChanges(); + }; + + describe('init', () => { + beforeEach(async(initAsync)); + beforeEach(initBeforeEach); + it('should initialise the bitstreamFormat based on the route', () => { + + comp.bitstreamFormatRD$.subscribe((format: RemoteData) => { + expect(format).toEqual(new RemoteData(false, false, true, null, bitstreamFormat)); + }); + }); + }); + describe('updateFormat success', () => { + beforeEach(async(initAsync)); + beforeEach(initBeforeEach); + it('should send the updated form to the service, show a notification and navigate to ', () => { + comp.updateFormat(bitstreamFormat); + + expect(bitstreamFormatDataService.updateBitstreamFormat).toHaveBeenCalledWith(bitstreamFormat); + expect(notificationService.success).toHaveBeenCalled(); + expect(router.navigate).toHaveBeenCalledWith(['/admin/registries/bitstream-formats']); + + }); + }); + describe('updateFormat error', () => { + beforeEach(async( () => { + router = new RouterStub(); + notificationService = new NotificationsServiceStub(); + bitstreamFormatDataService = jasmine.createSpyObj('bitstreamFormatDataService', { + updateBitstreamFormat: observableOf(new RestResponse(false, 400, 'Bad Request')) + }); + + TestBed.configureTestingModule({ + imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule.forRoot()], + declarations: [EditBitstreamFormatComponent], + providers: [ + {provide: ActivatedRoute, useValue: routeStub}, + {provide: Router, useValue: router}, + {provide: NotificationsService, useValue: notificationService}, + {provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService}, + ], + schemas: [CUSTOM_ELEMENTS_SCHEMA] + }).compileComponents(); + })); + beforeEach(initBeforeEach); + it('should send the updated form to the service, show a notification and navigate to ', () => { + comp.updateFormat(bitstreamFormat); + + expect(bitstreamFormatDataService.updateBitstreamFormat).toHaveBeenCalledWith(bitstreamFormat); + expect(notificationService.error).toHaveBeenCalled(); + expect(router.navigate).not.toHaveBeenCalled(); + + }); + }); +}); diff --git a/src/app/+admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.ts b/src/app/+admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.ts new file mode 100644 index 0000000000..0fdcc75689 --- /dev/null +++ b/src/app/+admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.ts @@ -0,0 +1,62 @@ +import { map, take } from 'rxjs/operators'; +import { ActivatedRoute, Router } from '@angular/router'; +import { Observable } from 'rxjs'; +import { Component, OnInit } from '@angular/core'; +import { RemoteData } from '../../../../core/data/remote-data'; +import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model'; +import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service'; +import { RestResponse } from '../../../../core/cache/response.models'; +import { NotificationsService } from '../../../../shared/notifications/notifications.service'; +import { getBitstreamFormatsModulePath } from '../../admin-registries-routing.module'; +import { TranslateService } from '@ngx-translate/core'; + +/** + * This component renders the edit page of a bitstream format. + * The route parameter 'id' is used to request the bitstream format. + */ +@Component({ + selector: 'ds-edit-bitstream-format', + templateUrl: './edit-bitstream-format.component.html', +}) +export class EditBitstreamFormatComponent implements OnInit { + + /** + * The bitstream format wrapped in a remote-data object + */ + bitstreamFormatRD$: Observable>; + + constructor( + private route: ActivatedRoute, + private router: Router, + private notificationService: NotificationsService, + private translateService: TranslateService, + private bitstreamFormatDataService: BitstreamFormatDataService, + ) { + } + + ngOnInit(): void { + this.bitstreamFormatRD$ = this.route.data.pipe( + map((data) => data.bitstreamFormat as RemoteData) + ); + } + + /** + * Updates the bitstream format based on the provided bitstream format emitted by the form. + * When successful, a success notification will be shown and the user will be navigated back to the overview page. + * When failed, an error notification will be shown. + */ + updateFormat(bitstreamFormat: BitstreamFormat) { + this.bitstreamFormatDataService.updateBitstreamFormat(bitstreamFormat).pipe(take(1) + ).subscribe((response: RestResponse) => { + if (response.isSuccessful) { + this.notificationService.success(this.translateService.get('admin.registries.bitstream-formats.edit.success.head'), + this.translateService.get('admin.registries.bitstream-formats.edit.success.content')); + this.router.navigate([getBitstreamFormatsModulePath()]); + } else { + this.notificationService.error('admin.registries.bitstream-formats.edit.failure.head', + 'admin.registries.bitstream-formats.create.edit.content'); + } + } + ); + } +} diff --git a/src/app/+admin/admin-registries/bitstream-formats/format-form/format-form.component.html b/src/app/+admin/admin-registries/bitstream-formats/format-form/format-form.component.html new file mode 100644 index 0000000000..be6ebf2599 --- /dev/null +++ b/src/app/+admin/admin-registries/bitstream-formats/format-form/format-form.component.html @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/src/app/+admin/admin-registries/bitstream-formats/format-form/format-form.component.spec.ts b/src/app/+admin/admin-registries/bitstream-formats/format-form/format-form.component.spec.ts new file mode 100644 index 0000000000..9a91b003a0 --- /dev/null +++ b/src/app/+admin/admin-registries/bitstream-formats/format-form/format-form.component.spec.ts @@ -0,0 +1,108 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { CommonModule } from '@angular/common'; +import { RouterTestingModule } from '@angular/router/testing'; +import { TranslateModule } from '@ngx-translate/core'; +import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { RouterStub } from '../../../../shared/testing/router-stub'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { Router } from '@angular/router'; +import { FormatFormComponent } from './format-form.component'; +import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model'; +import { BitstreamFormatSupportLevel } from '../../../../core/shared/bitstream-format-support-level'; +import { ResourceType } from '../../../../core/shared/resource-type'; +import { DynamicCheckboxModel, DynamicFormArrayModel, DynamicInputModel } from '@ng-dynamic-forms/core'; +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { isEmpty } from '../../../../shared/empty.util'; + +describe('FormatFormComponent', () => { + let comp: FormatFormComponent; + let fixture: ComponentFixture; + + const router = new RouterStub(); + + const bitstreamFormat: BitstreamFormat = { + uuid: 'test-uuid', + id: 'test-uuid', + shortDescription: 'Adobe PDF', + description: 'Adobe Portable Document Format', + mimetype: 'application/pdf', + supportLevel: BitstreamFormatSupportLevel.Unknown, + internal: false, + extensions: ['pdf', 'also-pdf'], + type: ResourceType.BitstreamFormat, + self: 'self-link' + }; + + const submittedBitstreamFormat = new BitstreamFormat(); + submittedBitstreamFormat.id = bitstreamFormat.id; + submittedBitstreamFormat.shortDescription = bitstreamFormat.shortDescription; + submittedBitstreamFormat.mimetype = bitstreamFormat.mimetype; + submittedBitstreamFormat.description = bitstreamFormat.description; + submittedBitstreamFormat.supportLevel = bitstreamFormat.supportLevel; + submittedBitstreamFormat.internal = bitstreamFormat.internal; + submittedBitstreamFormat.extensions = bitstreamFormat.extensions; + + const initAsync = () => { + TestBed.configureTestingModule({ + imports: [CommonModule, RouterTestingModule.withRoutes([]), ReactiveFormsModule, FormsModule, TranslateModule.forRoot(), NgbModule.forRoot()], + declarations: [FormatFormComponent], + providers: [ + {provide: Router, useValue: router}, + ], + schemas: [CUSTOM_ELEMENTS_SCHEMA] + }).compileComponents(); + }; + + const initBeforeEach = () => { + fixture = TestBed.createComponent(FormatFormComponent); + comp = fixture.componentInstance; + + comp.bitstreamFormat = bitstreamFormat; + fixture.detectChanges(); + }; + + describe('initialise', () => { + beforeEach(async(initAsync)); + beforeEach(initBeforeEach); + it('should initialises the values in the form', () => { + + expect((comp.formModel[0] as DynamicInputModel).value).toBe(bitstreamFormat.shortDescription); + expect((comp.formModel[1] as DynamicInputModel).value).toBe(bitstreamFormat.mimetype); + expect((comp.formModel[2] as DynamicInputModel).value).toBe(bitstreamFormat.description); + expect((comp.formModel[3] as DynamicInputModel).value).toBe(bitstreamFormat.supportLevel); + expect((comp.formModel[4] as DynamicCheckboxModel).value).toBe(bitstreamFormat.internal); + + const formArray = (comp.formModel[5] as DynamicFormArrayModel); + const extensions = []; + for (let i = 0; i < formArray.groups.length; i++) { + const value = (formArray.get(i).get(0) as DynamicInputModel).value; + if (!isEmpty(value)) { + extensions.push((formArray.get(i).get(0) as DynamicInputModel).value); + } + } + + expect(extensions).toEqual(bitstreamFormat.extensions); + + }); + }); + describe('onSubmit', () => { + beforeEach(async(initAsync)); + beforeEach(initBeforeEach); + + it('should emit the bitstreamFormat currently present in the form', () => { + spyOn(comp.updatedFormat, 'emit'); + comp.onSubmit(); + + expect(comp.updatedFormat.emit).toHaveBeenCalledWith(submittedBitstreamFormat); + }); + }); + describe('onCancel', () => { + beforeEach(async(initAsync)); + beforeEach(initBeforeEach); + + it('should navigate back to the bitstream overview', () => { + comp.onCancel(); + expect(router.navigate).toHaveBeenCalledWith(['/admin/registries/bitstream-formats']); + }); + }); +}); diff --git a/src/app/+admin/admin-registries/bitstream-formats/format-form/format-form.component.ts b/src/app/+admin/admin-registries/bitstream-formats/format-form/format-form.component.ts new file mode 100644 index 0000000000..febf56bc9f --- /dev/null +++ b/src/app/+admin/admin-registries/bitstream-formats/format-form/format-form.component.ts @@ -0,0 +1,193 @@ +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model'; +import { BitstreamFormatSupportLevel } from '../../../../core/shared/bitstream-format-support-level'; +import { + DynamicCheckboxModel, + DynamicFormArrayModel, + DynamicFormControlLayout, + DynamicFormControlModel, + DynamicFormService, + DynamicInputModel, + DynamicSelectModel, + DynamicTextAreaModel +} from '@ng-dynamic-forms/core'; +import { Router } from '@angular/router'; +import { getBitstreamFormatsModulePath } from '../../admin-registries-routing.module'; +import { hasValue, isEmpty } from '../../../../shared/empty.util'; +import { TranslateService } from '@ngx-translate/core'; + +/** + * The component responsible for rendering the form to create/edit a bitstream format + */ +@Component({ + selector: 'ds-bitstream-format-form', + templateUrl: './format-form.component.html' +}) +export class FormatFormComponent implements OnInit { + + /** + * The current bitstream format + * This can either be and existing one or a new one + */ + @Input() bitstreamFormat: BitstreamFormat = new BitstreamFormat(); + + /** + * EventEmitter that will emit the updated bitstream format + */ + @Output() updatedFormat: EventEmitter = new EventEmitter(); + + /** + * The different supported support level of the bitstream format + */ + supportLevelOptions = [{label: BitstreamFormatSupportLevel.Known, value: BitstreamFormatSupportLevel.Known}, + {label: BitstreamFormatSupportLevel.Unknown, value: BitstreamFormatSupportLevel.Unknown}, + {label: BitstreamFormatSupportLevel.Supported, value: BitstreamFormatSupportLevel.Supported}]; + + /** + * Styling element for repeatable field + */ + arrayElementLayout: DynamicFormControlLayout = { + grid: { + group: 'form-row', + } + }; + + /** + * Styling element for element of repeatable field + */ + arrayInputElementLayout: DynamicFormControlLayout = { + grid: { + host: 'col' + } + }; + + /** + * The form model representing the bitstream format + */ + formModel: DynamicFormControlModel[] = [ + new DynamicInputModel({ + id: 'shortDescription', + name: 'shortDescription', + label: 'admin.registries.bitstream-formats.edit.shortDescription.label', + hint: 'admin.registries.bitstream-formats.edit.shortDescription.hint', + required: true, + validators: { + required: null + }, + errorMessages: { + required: 'Please enter a name for this bitstream format' + }, + }), + new DynamicInputModel({ + id: 'mimetype', + name: 'mimetype', + label: 'admin.registries.bitstream-formats.edit.mimetype.label', + hint: 'admin.registries.bitstream-formats.edit.mimetype.hint', + + }), + new DynamicTextAreaModel({ + id: 'description', + name: 'description', + label: 'admin.registries.bitstream-formats.edit.description.label', + hint: 'admin.registries.bitstream-formats.edit.description.hint', + + }), + new DynamicSelectModel({ + id: 'supportLevel', + name: 'supportLevel', + options: this.supportLevelOptions, + label: 'admin.registries.bitstream-formats.edit.supportLevel.label', + hint: 'admin.registries.bitstream-formats.edit.supportLevel.hint', + value: this.supportLevelOptions[0].value + + }), + new DynamicCheckboxModel({ + id: 'internal', + name: 'internal', + label: 'Internal', + hint: 'admin.registries.bitstream-formats.edit.internal.hint', + }), + new DynamicFormArrayModel({ + id: 'extensions', + name: 'extensions', + label: 'admin.registries.bitstream-formats.edit.extensions.label', + groupFactory: () => [ + new DynamicInputModel({ + id: 'extension', + }, this.arrayInputElementLayout) + ] + }, this.arrayElementLayout), + ]; + + constructor(private dynamicFormService: DynamicFormService, + private translateService: TranslateService, + private router: Router) { + + } + + ngOnInit(): void { + + this.initValues(); + } + + /** + * Initializes the form based on the provided bitstream format + */ + initValues() { + this.formModel.forEach( + (fieldModel: DynamicFormControlModel) => { + if (fieldModel.name === 'extensions') { + if (hasValue(this.bitstreamFormat.extensions)) { + const extenstions = this.bitstreamFormat.extensions; + const formArray = (fieldModel as DynamicFormArrayModel); + for (let i = 0; i < extenstions.length; i++) { + formArray.insertGroup(i).group[0] = new DynamicInputModel({ + id: `extension-${i}`, + value: extenstions[i] + }, this.arrayInputElementLayout); + } + } + } else { + if (hasValue(this.bitstreamFormat[fieldModel.name])) { + (fieldModel as DynamicInputModel).value = this.bitstreamFormat[fieldModel.name]; + } + } + }); + } + + /** + * Creates an updated bistream format based on the current values in the form + * Emits the updated bitstream format trouhg the updatedFormat emitter + */ + onSubmit() { + const updatedBitstreamFormat = Object.assign(new BitstreamFormat(), + { + id: this.bitstreamFormat.id + }); + + this.formModel.forEach( + (fieldModel: DynamicFormControlModel) => { + if (fieldModel.name === 'extensions') { + const formArray = (fieldModel as DynamicFormArrayModel); + const extensions = []; + for (let i = 0; i < formArray.groups.length; i++) { + const value = (formArray.get(i).get(0) as DynamicInputModel).value; + if (!isEmpty(value)) { + extensions.push((formArray.get(i).get(0) as DynamicInputModel).value); + } + } + updatedBitstreamFormat.extensions = extensions; + } else { + updatedBitstreamFormat[fieldModel.name] = (fieldModel as DynamicInputModel).value; + } + }); + this.updatedFormat.emit(updatedBitstreamFormat); + } + + /** + * Cancels the edit/create action of the bitstream format and navigates back to the bitstream format registry + */ + onCancel() { + this.router.navigate([getBitstreamFormatsModulePath()]); + } +} diff --git a/src/app/+admin/admin-routing.module.ts b/src/app/+admin/admin-routing.module.ts index 71af51c683..2003ecf124 100644 --- a/src/app/+admin/admin-routing.module.ts +++ b/src/app/+admin/admin-routing.module.ts @@ -1,11 +1,19 @@ import { RouterModule } from '@angular/router'; import { NgModule } from '@angular/core'; +import { URLCombiner } from '../core/url-combiner/url-combiner'; +import { getAdminModulePath } from '../app-routing.module'; + +const REGISTRIES_MODULE_PATH = 'registries'; + +export function getRegistriesModulePath() { + return new URLCombiner(getAdminModulePath(), REGISTRIES_MODULE_PATH).toString(); +} @NgModule({ imports: [ RouterModule.forChild([ { - path: 'registries', + path: REGISTRIES_MODULE_PATH, loadChildren: './admin-registries/admin-registries.module#AdminRegistriesModule' } ]) diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index cb80d0165e..34bba9513b 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -16,6 +16,12 @@ const COMMUNITY_MODULE_PATH = 'communities'; export function getCommunityModulePath() { return `/${COMMUNITY_MODULE_PATH}`; } + +const ADMIN_MODULE_PATH = 'admin'; +export function getAdminModulePath() { + return `/${ADMIN_MODULE_PATH}`; +} + @NgModule({ imports: [ RouterModule.forRoot([ @@ -27,7 +33,7 @@ export function getCommunityModulePath() { { path: 'mydspace', loadChildren: './+my-dspace-page/my-dspace-page.module#MyDSpacePageModule', canActivate: [AuthenticatedGuard] }, { path: 'search', loadChildren: './+search-page/search-page.module#SearchPageModule' }, { path: 'browse', loadChildren: './+browse-by/browse-by.module#BrowseByModule' }, - { path: 'admin', loadChildren: './+admin/admin.module#AdminModule', canActivate: [AuthenticatedGuard] }, + { path: ADMIN_MODULE_PATH, loadChildren: './+admin/admin.module#AdminModule', canActivate: [AuthenticatedGuard] }, { path: 'login', loadChildren: './+login-page/login-page.module#LoginPageModule' }, { path: 'logout', loadChildren: './+logout-page/logout-page.module#LogoutPageModule' }, { path: 'submit', loadChildren: './+submit-page/submit-page.module#SubmitPageModule' }, diff --git a/src/app/app.reducer.ts b/src/app/app.reducer.ts index ea2512a974..e3333fb34a 100644 --- a/src/app/app.reducer.ts +++ b/src/app/app.reducer.ts @@ -23,6 +23,10 @@ import { hasValue } from './shared/empty.util'; import { cssVariablesReducer, CSSVariablesState } from './shared/sass-helper/sass-helper.reducer'; import { menusReducer, MenusState } from './shared/menu/menu.reducer'; import { historyReducer, HistoryState } from './shared/history/history.reducer'; +import { + bitstreamFormatReducer, + BitstreamFormatRegistryState +} from './+admin/admin-registries/bitstream-formats/bitstream-format.reducers'; export interface AppState { router: fromRouter.RouterReducerState; @@ -30,6 +34,7 @@ export interface AppState { hostWindow: HostWindowState; forms: FormState; metadataRegistry: MetadataRegistryState; + bitstreamFormats: BitstreamFormatRegistryState; notifications: NotificationsState; searchSidebar: SearchSidebarState; searchFilter: SearchFiltersState; @@ -44,6 +49,7 @@ export const appReducers: ActionReducerMap = { hostWindow: hostWindowReducer, forms: formReducer, metadataRegistry: metadataRegistryReducer, + bitstreamFormats: bitstreamFormatReducer, notifications: notificationsReducer, searchSidebar: sidebarReducer, searchFilter: filterReducer, diff --git a/src/app/core/cache/models/normalized-bitstream-format.model.ts b/src/app/core/cache/models/normalized-bitstream-format.model.ts index 994792d535..798aec8dc2 100644 --- a/src/app/core/cache/models/normalized-bitstream-format.model.ts +++ b/src/app/core/cache/models/normalized-bitstream-format.model.ts @@ -4,7 +4,7 @@ import { BitstreamFormat } from '../../shared/bitstream-format.model'; import { mapsTo } from '../builders/build-decorators'; import { IDToUUIDSerializer } from '../id-to-uuid-serializer'; import { NormalizedObject } from './normalized-object.model'; -import { SupportLevel } from './support-level.model'; +import { BitstreamFormatSupportLevel } from '../../shared/bitstream-format-support-level'; /** * Normalized model class for a Bitstream Format @@ -35,7 +35,7 @@ export class NormalizedBitstreamFormat extends NormalizedObject * The level of support the system offers for this Bitstream Format */ @autoserialize - supportLevel: SupportLevel; + supportLevel: BitstreamFormatSupportLevel; /** * True if the Bitstream Format is used to store system information, rather than the content of items in the system @@ -47,7 +47,7 @@ export class NormalizedBitstreamFormat extends NormalizedObject * String representing this Bitstream Format's file extension */ @autoserialize - extensions: string; + extensions: string[]; /** * Identifier for this Bitstream Format diff --git a/src/app/core/core.module.ts b/src/app/core/core.module.ts index 6550435aa3..5bf6260dc7 100644 --- a/src/app/core/core.module.ts +++ b/src/app/core/core.module.ts @@ -87,6 +87,7 @@ import { MyDSpaceResponseParsingService } from './data/mydspace-response-parsing import { ClaimedTaskDataService } from './tasks/claimed-task-data.service'; import { PoolTaskDataService } from './tasks/pool-task-data.service'; import { TaskResponseParsingService } from './tasks/task-response-parsing.service'; +import { BitstreamFormatDataService } from './data/bitstream-format-data.service'; const IMPORTS = [ CommonModule, @@ -126,6 +127,7 @@ const PROVIDERS = [ ObjectCacheService, PaginationComponentOptions, RegistryService, + BitstreamFormatDataService, NormalizedObjectBuildService, RemoteDataBuildService, RequestService, diff --git a/src/app/core/data/bitstream-format-data.service.spec.ts b/src/app/core/data/bitstream-format-data.service.spec.ts new file mode 100644 index 0000000000..f3ce478236 --- /dev/null +++ b/src/app/core/data/bitstream-format-data.service.spec.ts @@ -0,0 +1,293 @@ +import { BitstreamFormatDataService } from './bitstream-format-data.service'; +import { RequestEntry } from './request.reducer'; +import { RestResponse } from '../cache/response.models'; +import { Observable, of as observableOf } from 'rxjs'; +import { Action, Store } from '@ngrx/store'; +import { CoreState } from '../core.reducers'; +import { ObjectCacheService } from '../cache/object-cache.service'; +import { cold, getTestScheduler, hot } from 'jasmine-marbles'; +import { HALEndpointService } from '../shared/hal-endpoint.service'; +import { NotificationsService } from '../../shared/notifications/notifications.service'; +import { HttpClient } from '@angular/common/http'; +import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service'; +import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; +import { BitstreamFormat } from '../shared/bitstream-format.model'; +import { async } from '@angular/core/testing'; +import { + BitstreamFormatsRegistryDeselectAction, + BitstreamFormatsRegistryDeselectAllAction, + BitstreamFormatsRegistrySelectAction +} from '../../+admin/admin-registries/bitstream-formats/bitstream-format.actions'; +import { TestScheduler } from 'rxjs/testing'; + +describe('BitstreamFormatDataService', () => { + let service: BitstreamFormatDataService; + let requestService; + let scheduler: TestScheduler; + + const bitstreamFormatsEndpoint = 'https://rest.api/core/bitstream-formats'; + const bitstreamFormatsIdEndpoint = 'https://rest.api/core/bitstream-formats/format-id'; + + const responseCacheEntry = new RequestEntry(); + responseCacheEntry.response = new RestResponse(true, 200, 'Success'); + responseCacheEntry.completed = true; + + const store = { + dispatch(action: Action) { + // Do Nothing + } + } as Store; + + const objectCache = {} as ObjectCacheService; + const halEndpointService = { + getEndpoint(linkPath: string): Observable { + return cold('a', {a: bitstreamFormatsEndpoint}); + } + } as HALEndpointService; + + const notificationsService = {} as NotificationsService; + const http = {} as HttpClient; + const comparator = {} as any; + const dataBuildService = {} as NormalizedObjectBuildService; + const rdbService = {} as RemoteDataBuildService; + + function initTestService(halService) { + return new BitstreamFormatDataService( + requestService, + rdbService, + dataBuildService, + store, + objectCache, + halService, + notificationsService, + http, + comparator + ); + } + + describe('getBrowseEndpoint', () => { + beforeEach(async(() => { + scheduler = getTestScheduler(); + requestService = jasmine.createSpyObj('requestService', { + configure: {}, + getByHref: observableOf(responseCacheEntry), + getByUUID: cold('a', {a: responseCacheEntry}), + generateRequestId: 'request-id', + removeByHrefSubstring: {} + }); + service = initTestService(halEndpointService); + })); + it('should get the browse endpoint', () => { + const result = service.getBrowseEndpoint(); + const expected = cold('b', {b: bitstreamFormatsEndpoint}); + + expect(result).toBeObservable(expected); + }); + }); + + describe('getUpdateEndpoint', () => { + beforeEach(async(() => { + scheduler = getTestScheduler(); + requestService = jasmine.createSpyObj('requestService', { + configure: {}, + getByHref: observableOf(responseCacheEntry), + getByUUID: cold('a', {a: responseCacheEntry}), + generateRequestId: 'request-id', + removeByHrefSubstring: {} + }); + service = initTestService(halEndpointService); + })); + it('should get the update endpoint', () => { + const formatId = 'format-id'; + + const result = service.getUpdateEndpoint(formatId); + const expected = cold('b', {b: bitstreamFormatsIdEndpoint}); + + expect(result).toBeObservable(expected); + }); + }); + + describe('getCreateEndpoint', () => { + beforeEach(async(() => { + scheduler = getTestScheduler(); + requestService = jasmine.createSpyObj('requestService', { + configure: {}, + getByHref: observableOf(responseCacheEntry), + getByUUID: cold('a', {a: responseCacheEntry}), + generateRequestId: 'request-id', + removeByHrefSubstring: {} + }); + service = initTestService(halEndpointService); + })); + it('should get the create endpoint ', () => { + + const result = service.getCreateEndpoint(); + const expected = cold('b', {b: bitstreamFormatsEndpoint}); + + expect(result).toBeObservable(expected); + }); + }); + + describe('updateBitstreamFormat', () => { + beforeEach(async(() => { + scheduler = getTestScheduler(); + requestService = jasmine.createSpyObj('requestService', { + configure: {}, + getByHref: observableOf(responseCacheEntry), + getByUUID: cold('a', {a: responseCacheEntry}), + generateRequestId: 'request-id', + removeByHrefSubstring: {} + }); + service = initTestService(halEndpointService); + })); + it('should update the bitstream format', () => { + const updatedBistreamFormat = new BitstreamFormat(); + updatedBistreamFormat.uuid = 'updated-uuid'; + + const expected = cold('(b)', {b: new RestResponse(true, 200, 'Success')}); + const result = service.updateBitstreamFormat(updatedBistreamFormat); + + expect(result).toBeObservable(expected); + + }); + }); + + describe('createBitstreamFormat', () => { + beforeEach(async(() => { + scheduler = getTestScheduler(); + requestService = jasmine.createSpyObj('requestService', { + configure: {}, + getByHref: observableOf(responseCacheEntry), + getByUUID: cold('a', {a: responseCacheEntry}), + generateRequestId: 'request-id', + removeByHrefSubstring: {} + }); + service = initTestService(halEndpointService); + })); + it('should create a new bitstream format', () => { + const newFormat = new BitstreamFormat(); + newFormat.uuid = 'new-uuid'; + + const expected = cold('(b)', {b: new RestResponse(true, 200, 'Success')}); + const result = service.createBitstreamFormat(newFormat); + + expect(result).toBeObservable(expected); + }); + }); + + describe('clearBitStreamFormatRequests', () => { + beforeEach(async(() => { + scheduler = getTestScheduler(); + requestService = jasmine.createSpyObj('requestService', { + configure: {}, + getByHref: observableOf(responseCacheEntry), + getByUUID: cold('a', {a: responseCacheEntry}), + generateRequestId: 'request-id', + removeByHrefSubstring: {} + }); + const halService = { + getEndpoint(linkPath: string): Observable { + return observableOf(bitstreamFormatsEndpoint); + } + } as HALEndpointService; + service = initTestService(halService); + service.clearBitStreamFormatRequests().subscribe(); + })); + it('should remove the bitstream format hrefs in the request service', () => { + expect(requestService.removeByHrefSubstring).toHaveBeenCalledWith(bitstreamFormatsEndpoint); + }); + }); + + describe('selectBitstreamFormat', () => { + beforeEach(async(() => { + scheduler = getTestScheduler(); + requestService = jasmine.createSpyObj('requestService', { + configure: {}, + getByHref: observableOf(responseCacheEntry), + getByUUID: cold('a', {a: responseCacheEntry}), + generateRequestId: 'request-id', + removeByHrefSubstring: {} + }); + service = initTestService(halEndpointService); + spyOn(store, 'dispatch'); + })); + it('should add a selected bitstream to the store', () => { + const format = new BitstreamFormat(); + format.uuid = 'uuid'; + + service.selectBitstreamFormat(format); + expect(store.dispatch).toHaveBeenCalledWith(new BitstreamFormatsRegistrySelectAction(format)); + }); + }); + + describe('deselectBitstreamFormat', () => { + beforeEach(async(() => { + scheduler = getTestScheduler(); + requestService = jasmine.createSpyObj('requestService', { + configure: {}, + getByHref: observableOf(responseCacheEntry), + getByUUID: cold('a', {a: responseCacheEntry}), + generateRequestId: 'request-id', + removeByHrefSubstring: {} + }); + service = initTestService(halEndpointService); + spyOn(store, 'dispatch'); + })); + it('should remove a bitstream from the store', () => { + const format = new BitstreamFormat(); + format.uuid = 'uuid'; + + service.deselectBitstreamFormat(format); + expect(store.dispatch).toHaveBeenCalledWith(new BitstreamFormatsRegistryDeselectAction(format)); + }); + }); + + describe('deselectAllBitstreamFormats', () => { + beforeEach(async(() => { + scheduler = getTestScheduler(); + requestService = jasmine.createSpyObj('requestService', { + configure: {}, + getByHref: observableOf(responseCacheEntry), + getByUUID: cold('a', {a: responseCacheEntry}), + generateRequestId: 'request-id', + removeByHrefSubstring: {} + }); + service = initTestService(halEndpointService); + spyOn(store, 'dispatch'); + + })); + it('should remove all bitstreamFormats from the store', () => { + service.deselectAllBitstreamFormats(); + expect(store.dispatch).toHaveBeenCalledWith(new BitstreamFormatsRegistryDeselectAllAction()); + }); + }); + + describe('delete', () => { + beforeEach(async(() => { + scheduler = getTestScheduler(); + requestService = jasmine.createSpyObj('requestService', { + configure: {}, + getByHref: observableOf(responseCacheEntry), + getByUUID: hot('a', {a: responseCacheEntry}), + generateRequestId: 'request-id', + removeByHrefSubstring: {} + }); + const halService = { + getEndpoint(linkPath: string): Observable { + return observableOf(bitstreamFormatsEndpoint); + } + } as HALEndpointService; + service = initTestService(halService); + })); + it('should delete a bitstream format', () => { + const format = new BitstreamFormat(); + format.uuid = 'format-uuid'; + format.id = 'format-id'; + + const expected = cold('(b|)', {b: true}); + const result = service.delete(format); + + expect(result).toBeObservable(expected); + }); + }); +}); diff --git a/src/app/core/data/bitstream-format-data.service.ts b/src/app/core/data/bitstream-format-data.service.ts new file mode 100644 index 0000000000..a5638183c0 --- /dev/null +++ b/src/app/core/data/bitstream-format-data.service.ts @@ -0,0 +1,183 @@ +import { Injectable } from '@angular/core'; +import { DataService } from './data.service'; +import { BitstreamFormat } from '../shared/bitstream-format.model'; +import { RequestService } from './request.service'; +import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; +import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service'; +import { createSelector, select, Store } from '@ngrx/store'; +import { CoreState } from '../core.reducers'; +import { ObjectCacheService } from '../cache/object-cache.service'; +import { HALEndpointService } from '../shared/hal-endpoint.service'; +import { NotificationsService } from '../../shared/notifications/notifications.service'; +import { HttpClient } from '@angular/common/http'; +import { DefaultChangeAnalyzer } from './default-change-analyzer.service'; +import { DeleteByIDRequest, FindAllOptions, PostRequest, PutRequest } from './request.models'; +import { Observable } from 'rxjs'; +import { find, map, tap } from 'rxjs/operators'; +import { configureRequest, getResponseFromEntry } from '../shared/operators'; +import { distinctUntilChanged } from 'rxjs/internal/operators/distinctUntilChanged'; +import { RestResponse } from '../cache/response.models'; +import { AppState } from '../../app.reducer'; +import { BitstreamFormatRegistryState } from '../../+admin/admin-registries/bitstream-formats/bitstream-format.reducers'; +import { + BitstreamFormatsRegistryDeselectAction, + BitstreamFormatsRegistryDeselectAllAction, + BitstreamFormatsRegistrySelectAction +} from '../../+admin/admin-registries/bitstream-formats/bitstream-format.actions'; +import { hasValue } from '../../shared/empty.util'; +import { RequestEntry } from './request.reducer'; + +const bitstreamFormatsStateSelector = (state: AppState) => state.bitstreamFormats; +const selectedBitstreamFormatSelector = createSelector(bitstreamFormatsStateSelector, + (bitstreamFormatRegistryState: BitstreamFormatRegistryState) => bitstreamFormatRegistryState.selectedBitstreamFormats); + +/** + * A service responsible for fetching/sending data from/to the REST API on the bitstreamformats endpoint + */ +@Injectable() +export class BitstreamFormatDataService extends DataService { + + protected linkPath = 'bitstreamformats'; + protected forceBypassCache = false; + + constructor( + protected requestService: RequestService, + protected rdbService: RemoteDataBuildService, + protected dataBuildService: NormalizedObjectBuildService, + protected store: Store, + protected objectCache: ObjectCacheService, + protected halService: HALEndpointService, + protected notificationsService: NotificationsService, + protected http: HttpClient, + protected comparator: DefaultChangeAnalyzer) { + super(); + } + + /** + * Get the endpoint for browsing bitstream formats + * @param {FindAllOptions} options + * @returns {Observable} + */ + getBrowseEndpoint(options: FindAllOptions = {}, linkPath?: string): Observable { + return this.halService.getEndpoint(this.linkPath); + } + + /** + * Get the endpoint to update an existing bitstream format + * @param formatId + */ + public getUpdateEndpoint(formatId: string): Observable { + return this.getBrowseEndpoint().pipe( + map((endpoint: string) => this.getIDHref(endpoint, formatId)) + ); + } + + /** + * Get the endpoint to create a new bitstream format + */ + public getCreateEndpoint(): Observable { + return this.getBrowseEndpoint(); + } + + /** + * Update an existing bitstreamFormat + * @param bitstreamFormat + */ + updateBitstreamFormat(bitstreamFormat: BitstreamFormat): Observable { + const requestId = this.requestService.generateRequestId(); + + this.getUpdateEndpoint(bitstreamFormat.id).pipe( + distinctUntilChanged(), + map((endpointURL: string) => + new PutRequest(requestId, endpointURL, bitstreamFormat)), + configureRequest(this.requestService)).subscribe(); + + return this.requestService.getByUUID(requestId).pipe( + getResponseFromEntry() + ); + + } + + /** + * Create a new BitstreamFormat + * @param BitstreamFormat + */ + public createBitstreamFormat(bitstreamFormat: BitstreamFormat): Observable { + const requestId = this.requestService.generateRequestId(); + + this.getCreateEndpoint().pipe( + map((endpointURL: string) => { + return new PostRequest(requestId, endpointURL, bitstreamFormat); + }), + configureRequest(this.requestService) + ).subscribe(); + + return this.requestService.getByUUID(requestId).pipe( + getResponseFromEntry() + ); + } + + /** + * Clears the cache of the list of BitstreamFormats + */ + public clearBitStreamFormatRequests(): Observable { + return this.getBrowseEndpoint().pipe( + tap((href: string) => this.requestService.removeByHrefSubstring(href)) + ); + } + + /** + * Gets all the selected BitstreamFormats from the store + */ + public getSelectedBitstreamFormats(): Observable { + return this.store.pipe(select(selectedBitstreamFormatSelector)); + } + + /** + * Adds a BistreamFormat to the selected BitstreamFormats in the store + * @param bitstreamFormat + */ + public selectBitstreamFormat(bitstreamFormat: BitstreamFormat) { + this.store.dispatch(new BitstreamFormatsRegistrySelectAction(bitstreamFormat)); + } + + /** + * Removes a BistreamFormat from the list of selected BitstreamFormats in the store + * @param bitstreamFormat + */ + public deselectBitstreamFormat(bitstreamFormat: BitstreamFormat) { + this.store.dispatch(new BitstreamFormatsRegistryDeselectAction(bitstreamFormat)); + } + + /** + * Removes all BitstreamFormats from the list of selected BitstreamFormats in the store + */ + public deselectAllBitstreamFormats() { + this.store.dispatch(new BitstreamFormatsRegistryDeselectAllAction()); + } + + /** + * Delete an existing DSpace Object on the server + * @param format The DSpace Object to be removed + * Return an observable that emits true when the deletion was successful, false when it failed + */ + delete(format: BitstreamFormat): Observable { + const requestId = this.requestService.generateRequestId(); + + const hrefObs = this.halService.getEndpoint(this.linkPath).pipe( + map((endpoint: string) => this.getIDHref(endpoint, format.id))); + + hrefObs.pipe( + find((href: string) => hasValue(href)), + map((href: string) => { + const request = new DeleteByIDRequest(requestId, href, format.id); + this.requestService.configure(request); + }) + ).subscribe(); + + return this.requestService.getByUUID(requestId).pipe( + find((request: RequestEntry) => request.completed), + map((request: RequestEntry) => request.response.isSuccessful) + ); + } +} diff --git a/src/app/core/registry/mock-bitstream-format.model.ts b/src/app/core/registry/mock-bitstream-format.model.ts deleted file mode 100644 index f5811e367c..0000000000 --- a/src/app/core/registry/mock-bitstream-format.model.ts +++ /dev/null @@ -1,8 +0,0 @@ -export class BitstreamFormat { - shortDescription: string; - description: string; - mimetype: string; - supportLevel: number; - internal: boolean; - extensions: string; -} diff --git a/src/app/core/registry/registry-bitstreamformats-response.model.ts b/src/app/core/registry/registry-bitstreamformats-response.model.ts index 81de379e9e..a0ebd542f8 100644 --- a/src/app/core/registry/registry-bitstreamformats-response.model.ts +++ b/src/app/core/registry/registry-bitstreamformats-response.model.ts @@ -1,10 +1,10 @@ import { autoserialize, autoserializeAs } from 'cerialize'; import { PageInfo } from '../shared/page-info.model'; -import { BitstreamFormat } from '../shared/bitstream-format.model'; +import { NormalizedBitstreamFormat } from '../cache/models/normalized-bitstream-format.model'; export class RegistryBitstreamformatsResponse { - @autoserializeAs(BitstreamFormat) - bitstreamformats: BitstreamFormat[]; + @autoserializeAs(NormalizedBitstreamFormat) + bitstreamformats: NormalizedBitstreamFormat[]; @autoserialize page: PageInfo; diff --git a/src/app/core/registry/registry.service.spec.ts b/src/app/core/registry/registry.service.spec.ts index 8274ceef60..80e4e404c8 100644 --- a/src/app/core/registry/registry.service.spec.ts +++ b/src/app/core/registry/registry.service.spec.ts @@ -12,7 +12,6 @@ import { PageInfo } from '../shared/page-info.model'; import { getMockRequestService } from '../../shared/mocks/mock-request.service'; import { - RegistryBitstreamformatsSuccessResponse, RegistryMetadatafieldsSuccessResponse, RegistryMetadataschemasSuccessResponse, RestResponse @@ -20,7 +19,6 @@ import { import { Component } from '@angular/core'; import { RegistryMetadataschemasResponse } from './registry-metadataschemas-response.model'; import { RegistryMetadatafieldsResponse } from './registry-metadatafields-response.model'; -import { RegistryBitstreamformatsResponse } from './registry-bitstreamformats-response.model'; import { map } from 'rxjs/operators'; import { Store, StoreModule } from '@ngrx/store'; import { MockStore } from '../../shared/testing/mock-store'; @@ -42,7 +40,7 @@ import { import { MetadataSchema } from '../metadata/metadataschema.model'; import { MetadataField } from '../metadata/metadatafield.model'; -@Component({ template: '' }) +@Component({template: ''}) class DummyComponent { } @@ -119,7 +117,7 @@ describe('RegistryService', () => { toRemoteDataObservable: (requestEntryObs: Observable, payloadObs: Observable) => { return observableCombineLatest(requestEntryObs, payloadObs).pipe(map(([req, pay]) => { - return { req, pay }; + return {req, pay}; }) ); }, @@ -135,11 +133,11 @@ describe('RegistryService', () => { DummyComponent ], providers: [ - { provide: RequestService, useValue: getMockRequestService() }, - { provide: RemoteDataBuildService, useValue: rdbStub }, - { provide: HALEndpointService, useValue: halServiceStub }, - { provide: Store, useClass: MockStore }, - { provide: NotificationsService, useValue: new NotificationsServiceStub() }, + {provide: RequestService, useValue: getMockRequestService()}, + {provide: RemoteDataBuildService, useValue: rdbStub}, + {provide: HALEndpointService, useValue: halServiceStub}, + {provide: Store, useClass: MockStore}, + {provide: NotificationsService, useValue: new NotificationsServiceStub()}, RegistryService ] }); @@ -154,7 +152,7 @@ describe('RegistryService', () => { page: pageInfo }); const response = new RegistryMetadataschemasSuccessResponse(queryResponse, 200, 'OK', pageInfo); - const responseEntry = Object.assign(new RequestEntry(), { response: response }); + const responseEntry = Object.assign(new RequestEntry(), {response: response}); beforeEach(() => { (registryService as any).requestService.getByHref.and.returnValue(observableOf(responseEntry)); @@ -183,7 +181,7 @@ describe('RegistryService', () => { page: pageInfo }); const response = new RegistryMetadataschemasSuccessResponse(queryResponse, 200, 'OK', pageInfo); - const responseEntry = Object.assign(new RequestEntry(), { response: response }); + const responseEntry = Object.assign(new RequestEntry(), {response: response}); beforeEach(() => { (registryService as any).requestService.getByHref.and.returnValue(observableOf(responseEntry)); @@ -212,7 +210,7 @@ describe('RegistryService', () => { page: pageInfo }); const response = new RegistryMetadatafieldsSuccessResponse(queryResponse, 200, 'OK', pageInfo); - const responseEntry = Object.assign(new RequestEntry(), { response: response }); + const responseEntry = Object.assign(new RequestEntry(), {response: response}); beforeEach(() => { (registryService as any).requestService.getByHref.and.returnValue(observableOf(responseEntry)); @@ -235,35 +233,6 @@ describe('RegistryService', () => { }); }); - describe('when requesting bitstreamformats', () => { - const queryResponse = Object.assign(new RegistryBitstreamformatsResponse(), { - bitstreamformats: mockFieldsList, - page: pageInfo - }); - const response = new RegistryBitstreamformatsSuccessResponse(queryResponse, 200, 'OK', pageInfo); - const responseEntry = Object.assign(new RequestEntry(), { response: response }); - - beforeEach(() => { - (registryService as any).requestService.getByHref.and.returnValue(observableOf(responseEntry)); - /* tslint:disable:no-empty */ - registryService.getBitstreamFormats(pagination).subscribe((value) => { - }); - /* tslint:enable:no-empty */ - }); - - it('should call getEndpoint on the halService', () => { - expect((registryService as any).halService.getEndpoint).toHaveBeenCalled(); - }); - - it('should send out the request on the request service', () => { - expect((registryService as any).requestService.configure).toHaveBeenCalled(); - }); - - it('should call getByHref on the request service with the correct request url', () => { - expect((registryService as any).requestService.getByHref).toHaveBeenCalledWith(endpointWithParams); - }); - }); - describe('when dispatching to the store', () => { beforeEach(() => { spyOn(mockStore, 'dispatch'); @@ -276,7 +245,7 @@ describe('RegistryService', () => { it('should dispatch a MetadataRegistryEditSchemaAction with the correct schema', () => { expect(mockStore.dispatch).toHaveBeenCalledWith(new MetadataRegistryEditSchemaAction(mockSchemasList[0])); - }) + }); }); describe('when calling cancelEditMetadataSchema', () => { @@ -286,7 +255,7 @@ describe('RegistryService', () => { it('should dispatch a MetadataRegistryCancelSchemaAction', () => { expect(mockStore.dispatch).toHaveBeenCalledWith(new MetadataRegistryCancelSchemaAction()); - }) + }); }); describe('when calling selectMetadataSchema', () => { @@ -296,7 +265,7 @@ describe('RegistryService', () => { it('should dispatch a MetadataRegistrySelectSchemaAction with the correct schema', () => { expect(mockStore.dispatch).toHaveBeenCalledWith(new MetadataRegistrySelectSchemaAction(mockSchemasList[0])); - }) + }); }); describe('when calling deselectMetadataSchema', () => { @@ -306,7 +275,7 @@ describe('RegistryService', () => { it('should dispatch a MetadataRegistryDeselectSchemaAction with the correct schema', () => { expect(mockStore.dispatch).toHaveBeenCalledWith(new MetadataRegistryDeselectSchemaAction(mockSchemasList[0])); - }) + }); }); describe('when calling deselectAllMetadataSchema', () => { @@ -316,7 +285,7 @@ describe('RegistryService', () => { it('should dispatch a MetadataRegistryDeselectAllSchemaAction', () => { expect(mockStore.dispatch).toHaveBeenCalledWith(new MetadataRegistryDeselectAllSchemaAction()); - }) + }); }); describe('when calling editMetadataField', () => { @@ -326,7 +295,7 @@ describe('RegistryService', () => { it('should dispatch a MetadataRegistryEditFieldAction with the correct Field', () => { expect(mockStore.dispatch).toHaveBeenCalledWith(new MetadataRegistryEditFieldAction(mockFieldsList[0])); - }) + }); }); describe('when calling cancelEditMetadataField', () => { @@ -336,7 +305,7 @@ describe('RegistryService', () => { it('should dispatch a MetadataRegistryCancelFieldAction', () => { expect(mockStore.dispatch).toHaveBeenCalledWith(new MetadataRegistryCancelFieldAction()); - }) + }); }); describe('when calling selectMetadataField', () => { @@ -346,7 +315,7 @@ describe('RegistryService', () => { it('should dispatch a MetadataRegistrySelectFieldAction with the correct Field', () => { expect(mockStore.dispatch).toHaveBeenCalledWith(new MetadataRegistrySelectFieldAction(mockFieldsList[0])); - }) + }); }); describe('when calling deselectMetadataField', () => { @@ -356,7 +325,7 @@ describe('RegistryService', () => { it('should dispatch a MetadataRegistryDeselectFieldAction with the correct Field', () => { expect(mockStore.dispatch).toHaveBeenCalledWith(new MetadataRegistryDeselectFieldAction(mockFieldsList[0])); - }) + }); }); describe('when calling deselectAllMetadataField', () => { @@ -366,7 +335,7 @@ describe('RegistryService', () => { it('should dispatch a MetadataRegistryDeselectAllFieldAction', () => { expect(mockStore.dispatch).toHaveBeenCalledWith(new MetadataRegistryDeselectAllFieldAction()); - }) + }); }); }); @@ -409,7 +378,7 @@ describe('RegistryService', () => { result.subscribe((response: RestResponse) => { expect(response.isSuccessful).toBe(true); }); - }) + }); }); describe('when deleteMetadataField is called', () => { @@ -423,7 +392,7 @@ describe('RegistryService', () => { result.subscribe((response: RestResponse) => { expect(response.isSuccessful).toBe(true); }); - }) + }); }); describe('when clearMetadataSchemaRequests is called', () => { diff --git a/src/app/core/registry/registry.service.ts b/src/app/core/registry/registry.service.ts index 137b4c3a87..35706c3200 100644 --- a/src/app/core/registry/registry.service.ts +++ b/src/app/core/registry/registry.service.ts @@ -5,13 +5,13 @@ import { PaginatedList } from '../data/paginated-list'; import { PageInfo } from '../shared/page-info.model'; import { MetadataSchema } from '../metadata/metadataschema.model'; import { MetadataField } from '../metadata/metadatafield.model'; -import { BitstreamFormat } from './mock-bitstream-format.model'; import { CreateMetadataFieldRequest, CreateMetadataSchemaRequest, DeleteRequest, GetRequest, - RestRequest, UpdateMetadataFieldRequest, + RestRequest, + UpdateMetadataFieldRequest, UpdateMetadataSchemaRequest } from '../data/request.models'; import { GenericConstructor } from '../shared/generic-constructor'; @@ -21,24 +21,19 @@ import { RemoteDataBuildService } from '../cache/builders/remote-data-build.serv import { RequestService } from '../data/request.service'; import { RegistryMetadataschemasResponse } from './registry-metadataschemas-response.model'; import { - ErrorResponse, MetadatafieldSuccessResponse, MetadataschemaSuccessResponse, - RegistryBitstreamformatsSuccessResponse, + MetadatafieldSuccessResponse, + MetadataschemaSuccessResponse, RegistryMetadatafieldsSuccessResponse, - RegistryMetadataschemasSuccessResponse, RestResponse + RegistryMetadataschemasSuccessResponse, + RestResponse } from '../cache/response.models'; import { HALEndpointService } from '../shared/hal-endpoint.service'; import { RegistryMetadatafieldsResponseParsingService } from '../data/registry-metadatafields-response-parsing.service'; import { RegistryMetadatafieldsResponse } from './registry-metadatafields-response.model'; -import { hasValue, hasNoValue, isNotEmpty, isNotEmptyOperator } from '../../shared/empty.util'; +import { hasNoValue, hasValue, isNotEmpty, isNotEmptyOperator } from '../../shared/empty.util'; import { URLCombiner } from '../url-combiner/url-combiner'; import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model'; -import { RegistryBitstreamformatsResponseParsingService } from '../data/registry-bitstreamformats-response-parsing.service'; -import { RegistryBitstreamformatsResponse } from './registry-bitstreamformats-response.model'; -import { - configureRequest, - getResponseFromEntry, - getSucceededRemoteData -} from '../shared/operators'; +import { configureRequest, getResponseFromEntry } from '../shared/operators'; import { createSelector, select, Store } from '@ngrx/store'; import { AppState } from '../../app.reducer'; import { MetadataRegistryState } from '../../+admin/admin-registries/metadata-registry/metadata-registry.reducers'; @@ -54,7 +49,7 @@ import { MetadataRegistrySelectFieldAction, MetadataRegistrySelectSchemaAction } from '../../+admin/admin-registries/metadata-registry/metadata-registry.actions'; -import { distinctUntilChanged, flatMap, map, switchMap, take, tap } from 'rxjs/operators'; +import { distinctUntilChanged, flatMap, map, take, tap } from 'rxjs/operators'; import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer'; import { NormalizedObjectFactory } from '../cache/models/normalized-object-factory'; import { ResourceType } from '../shared/resource-type'; @@ -76,7 +71,8 @@ export class RegistryService { private metadataSchemasPath = 'metadataschemas'; private metadataFieldsPath = 'metadatafields'; - private bitstreamFormatsPath = 'bitstreamformats'; + + // private bitstreamFormatsPath = 'bitstreamformats'; constructor(protected requestService: RequestService, private rdb: RemoteDataBuildService, @@ -181,7 +177,7 @@ export class RegistryService { */ public getAllMetadataFields(pagination?: PaginationComponentOptions): Observable>> { if (hasNoValue(pagination)) { - pagination = { currentPage: 1, pageSize: 10000 } as any; + pagination = {currentPage: 1, pageSize: 10000} as any; } const requestObs = this.getMetadataFieldsRequestObs(pagination); @@ -215,36 +211,6 @@ export class RegistryService { return this.rdb.toRemoteDataObservable(requestEntryObs, payloadObs); } - public getBitstreamFormats(pagination: PaginationComponentOptions): Observable>> { - const requestObs = this.getBitstreamFormatsRequestObs(pagination); - - const requestEntryObs = requestObs.pipe( - flatMap((request: RestRequest) => this.requestService.getByHref(request.href)) - ); - - const rbrObs: Observable = requestEntryObs.pipe( - getResponseFromEntry(), - map((response: RegistryBitstreamformatsSuccessResponse) => response.bitstreamformatsResponse) - ); - - const bitstreamformatsObs: Observable = rbrObs.pipe( - map((rbr: RegistryBitstreamformatsResponse) => rbr.bitstreamformats) - ); - - const pageInfoObs: Observable = requestEntryObs.pipe( - getResponseFromEntry(), - map((response: RegistryBitstreamformatsSuccessResponse) => response.pageInfo) - ); - - const payloadObs = observableCombineLatest(bitstreamformatsObs, pageInfoObs).pipe( - map(([bitstreamformats, pageInfo]) => { - return new PaginatedList(pageInfo, bitstreamformats); - }) - ); - - return this.rdb.toRemoteDataObservable(requestEntryObs, payloadObs); - } - public getMetadataSchemasRequestObs(pagination: PaginationComponentOptions): Observable { return this.halService.getEndpoint(this.metadataSchemasPath).pipe( map((url: string) => { @@ -307,26 +273,6 @@ export class RegistryService { ); } - private getBitstreamFormatsRequestObs(pagination: PaginationComponentOptions): Observable { - return this.halService.getEndpoint(this.bitstreamFormatsPath).pipe( - map((url: string) => { - const args: string[] = []; - args.push(`size=${pagination.pageSize}`); - args.push(`page=${pagination.currentPage - 1}`); - if (isNotEmpty(args)) { - url = new URLCombiner(url, `?${args.join('&')}`).toString(); - } - const request = new GetRequest(this.requestService.generateRequestId(), url); - return Object.assign(request, { - getResponseParser(): GenericConstructor { - return RegistryBitstreamformatsResponseParsingService; - } - }); - }), - tap((request: RestRequest) => this.requestService.configure(request)), - ); - } - public editMetadataSchema(schema: MetadataSchema) { this.store.dispatch(new MetadataRegistryEditSchemaAction(schema)); } @@ -340,15 +286,15 @@ export class RegistryService { } public selectMetadataSchema(schema: MetadataSchema) { - this.store.dispatch(new MetadataRegistrySelectSchemaAction(schema)) + this.store.dispatch(new MetadataRegistrySelectSchemaAction(schema)); } public deselectMetadataSchema(schema: MetadataSchema) { - this.store.dispatch(new MetadataRegistryDeselectSchemaAction(schema)) + this.store.dispatch(new MetadataRegistryDeselectSchemaAction(schema)); } public deselectAllMetadataSchema() { - this.store.dispatch(new MetadataRegistryDeselectAllSchemaAction()) + this.store.dispatch(new MetadataRegistryDeselectAllSchemaAction()); } public getSelectedMetadataSchemas(): Observable { @@ -368,15 +314,15 @@ export class RegistryService { } public selectMetadataField(field: MetadataField) { - this.store.dispatch(new MetadataRegistrySelectFieldAction(field)) + this.store.dispatch(new MetadataRegistrySelectFieldAction(field)); } public deselectMetadataField(field: MetadataField) { - this.store.dispatch(new MetadataRegistryDeselectFieldAction(field)) + this.store.dispatch(new MetadataRegistryDeselectFieldAction(field)); } public deselectAllMetadataField() { - this.store.dispatch(new MetadataRegistryDeselectAllFieldAction()) + this.store.dispatch(new MetadataRegistryDeselectAllFieldAction()); } public getSelectedMetadataFields(): Observable { @@ -431,7 +377,7 @@ export class RegistryService { this.notificationsService.error('Server Error:', (response as any).errorMessage, new NotificationOptions(-1)); } } else { - this.showNotifications(true, isUpdate, false, { prefix: schema.prefix }); + this.showNotifications(true, isUpdate, false, {prefix: schema.prefix}); return response; } }), @@ -451,7 +397,7 @@ export class RegistryService { public clearMetadataSchemaRequests(): Observable { return this.halService.getEndpoint(this.metadataSchemasPath).pipe( tap((href: string) => this.requestService.removeByHrefSubstring(href)) - ) + ); } /** @@ -501,7 +447,7 @@ export class RegistryService { } } else { const fieldString = `${field.schema.prefix}.${field.element}${field.qualifier ? `.${field.qualifier}` : ''}`; - this.showNotifications(true, isUpdate, true, { field: fieldString }); + this.showNotifications(true, isUpdate, true, {field: fieldString}); return response; } }), @@ -521,7 +467,7 @@ export class RegistryService { public clearMetadataFieldRequests(): Observable { return this.halService.getEndpoint(this.metadataFieldsPath).pipe( tap((href: string) => this.requestService.removeByHrefSubstring(href)) - ) + ); } private delete(path: string, id: number): Observable { @@ -557,9 +503,9 @@ export class RegistryService { ); messages.subscribe(([head, content]) => { if (success) { - this.notificationsService.success(head, content) + this.notificationsService.success(head, content); } else { - this.notificationsService.error(head, content) + this.notificationsService.error(head, content); } }); } diff --git a/src/app/core/shared/bitstream-format-support-level.ts b/src/app/core/shared/bitstream-format-support-level.ts new file mode 100644 index 0000000000..d92aac7708 --- /dev/null +++ b/src/app/core/shared/bitstream-format-support-level.ts @@ -0,0 +1,5 @@ +export enum BitstreamFormatSupportLevel { + Known = 'KNOWN', + Unknown = 'UNKNOWN', + Supported = 'SUPPORTED' +} diff --git a/src/app/core/shared/bitstream-format.model.ts b/src/app/core/shared/bitstream-format.model.ts index 9af345e607..aa76f92b36 100644 --- a/src/app/core/shared/bitstream-format.model.ts +++ b/src/app/core/shared/bitstream-format.model.ts @@ -1,6 +1,6 @@ - import { CacheableObject } from '../cache/object-cache.reducer'; import { ResourceType } from './resource-type'; +import { BitstreamFormatSupportLevel } from './bitstream-format-support-level'; /** * Model class for a Bitstream Format @@ -25,7 +25,7 @@ export class BitstreamFormat implements CacheableObject { /** * The level of support the system offers for this Bitstream Format */ - supportLevel: number; + supportLevel: BitstreamFormatSupportLevel; /** * True if the Bitstream Format is used to store system information, rather than the content of items in the system @@ -35,7 +35,7 @@ export class BitstreamFormat implements CacheableObject { /** * String representing this Bitstream Format's file extension */ - extensions: string; + extensions: string[]; /** * The link to the rest endpoint where this Bitstream Format can be found @@ -52,4 +52,11 @@ export class BitstreamFormat implements CacheableObject { */ uuid: string; + /** + * Identifier for this Bitstream Format + * Note that this ID is unique for bitstream formats, + * but might not be unique across different object types + */ + id: string; + } diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.html b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.html index cead04f797..217f9e79cf 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.html +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.html @@ -14,7 +14,7 @@ - +
{{ message | translate:model.validators }} From 2db0bf44f30233091bc5cfff2023751faaaec0f1 Mon Sep 17 00:00:00 2001 From: Kristof De Langhe Date: Mon, 12 Aug 2019 10:22:49 +0200 Subject: [PATCH 07/18] 62741: PR Feedback changes --- .../journal-issue-grid-element.component.ts | 3 +++ .../journal-volume-grid-element.component.ts | 3 +++ .../journal/journal-grid-element.component.ts | 3 +++ .../orgunit/orgunit-grid-element.component.ts | 3 +++ .../person/person-grid-element.component.html | 10 +++++----- .../person/person-grid-element.component.ts | 3 +++ .../project/project-grid-element.component.ts | 3 +++ .../publication/publication-grid-element.component.ts | 3 +++ 8 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.ts b/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.ts index 538971bf84..06c27ebacf 100644 --- a/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.ts +++ b/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.ts @@ -10,5 +10,8 @@ import { TypedItemSearchResultGridElementComponent } from '../../../../shared/ob templateUrl: './journal-issue-grid-element.component.html', animations: [focusShadow] }) +/** + * The component for displaying a grid element for an item of the type Journal Issue + */ export class JournalIssueGridElementComponent extends TypedItemSearchResultGridElementComponent { } diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.ts b/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.ts index 3ef4e9948e..e5183536ef 100644 --- a/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.ts +++ b/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.ts @@ -10,5 +10,8 @@ import { TypedItemSearchResultGridElementComponent } from '../../../../shared/ob templateUrl: './journal-volume-grid-element.component.html', animations: [focusShadow] }) +/** + * The component for displaying a grid element for an item of the type Journal Volume + */ export class JournalVolumeGridElementComponent extends TypedItemSearchResultGridElementComponent { } diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.ts b/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.ts index 37c0b0aad1..7f23211538 100644 --- a/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.ts +++ b/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.ts @@ -10,5 +10,8 @@ import { TypedItemSearchResultGridElementComponent } from '../../../../shared/ob templateUrl: './journal-grid-element.component.html', animations: [focusShadow] }) +/** + * The component for displaying a grid element for an item of the type Journal + */ export class JournalGridElementComponent extends TypedItemSearchResultGridElementComponent { } diff --git a/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.ts b/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.ts index f0c87eb975..0effc22027 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.ts +++ b/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.ts @@ -10,5 +10,8 @@ import { TypedItemSearchResultGridElementComponent } from '../../../../shared/ob templateUrl: './orgunit-grid-element.component.html', animations: [focusShadow] }) +/** + * The component for displaying a grid element for an item of the type Organisation Unit + */ export class OrgunitGridElementComponent extends TypedItemSearchResultGridElementComponent { } diff --git a/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.html b/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.html index badc241b65..92d1ed40a8 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.html +++ b/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.html @@ -9,16 +9,16 @@
-

+

- -

+

- +

diff --git a/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.ts b/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.ts index 3ec17c9ce5..bf7b8aa119 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.ts +++ b/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.ts @@ -10,5 +10,8 @@ import { focusShadow } from '../../../../shared/animations/focus'; templateUrl: './person-grid-element.component.html', animations: [focusShadow] }) +/** + * The component for displaying a grid element for an item of the type Person + */ export class PersonGridElementComponent extends TypedItemSearchResultGridElementComponent { } diff --git a/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.ts b/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.ts index be246f0fbe..15d525fcf2 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.ts +++ b/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.ts @@ -10,5 +10,8 @@ import { TypedItemSearchResultGridElementComponent } from '../../../../shared/ob templateUrl: './project-grid-element.component.html', animations: [focusShadow] }) +/** + * The component for displaying a grid element for an item of the type Project + */ export class ProjectGridElementComponent extends TypedItemSearchResultGridElementComponent { } diff --git a/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.ts b/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.ts index 18dcccd1d2..1bcd028baf 100644 --- a/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.ts +++ b/src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.ts @@ -11,5 +11,8 @@ import { focusShadow } from '../../../../animations/focus'; templateUrl: './publication-grid-element.component.html', animations: [focusShadow] }) +/** + * The component for displaying a grid element for an item of the type Publication + */ export class PublicationGridElementComponent extends TypedItemSearchResultGridElementComponent { } From 1be7f4e55078d7f1a26834af06f6017389f2dc15 Mon Sep 17 00:00:00 2001 From: Kristof De Langhe Date: Mon, 12 Aug 2019 11:05:45 +0200 Subject: [PATCH 08/18] 62741: Grid template field changes --- .../journal-issue-grid-element.component.html | 4 ++-- .../journal-issue-grid-element.component.spec.ts | 2 +- .../journal-volume-grid-element.component.html | 8 ++++---- ...journal-volume-grid-element.component.spec.ts | 4 ++-- .../journal/journal-grid-element.component.html | 14 ++++++++------ .../journal-grid-element.component.spec.ts | 6 +++--- .../orgunit/orgunit-grid-element.component.html | 16 +++++++++------- .../orgunit-grid-element.component.spec.ts | 6 +++--- .../person/person-grid-element.component.html | 4 ++-- .../person/person-grid-element.component.spec.ts | 4 ++-- .../project/project-grid-element.component.html | 4 ++-- .../project-grid-element.component.spec.ts | 6 +++--- 12 files changed, 41 insertions(+), 37 deletions(-) diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.html b/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.html index 93d3954f2f..4cb34a140b 100644 --- a/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.html +++ b/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.html @@ -11,9 +11,9 @@

-

+

- +

diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.spec.ts b/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.spec.ts index 3af407d0f8..68a05b66c3 100644 --- a/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.spec.ts +++ b/src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.spec.ts @@ -15,7 +15,7 @@ mockItemWithMetadata.indexableObject = Object.assign(new Item(), { value: 'This is just another title' } ], - 'journalissue.issuedate': [ + 'creativework.datePublished': [ { language: null, value: '2015-06-26' diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.html b/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.html index f5487a34cf..d7c9b68a24 100644 --- a/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.html +++ b/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.html @@ -11,14 +11,14 @@

-

+

- +

-

+

- +

diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.spec.ts b/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.spec.ts index 4751ed4cd8..5a8fca5fc6 100644 --- a/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.spec.ts +++ b/src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.spec.ts @@ -15,13 +15,13 @@ mockItemWithMetadata.indexableObject = Object.assign(new Item(), { value: 'This is just another title' } ], - 'journalvolume.issuedate': [ + 'creativework.datePublished': [ { language: null, value: '2015-06-26' } ], - 'journalvolume.identifier.description': [ + 'dc.description': [ { language: 'en_US', value: 'A description for the journal volume' diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.html b/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.html index d4354efcf4..467cdd1594 100644 --- a/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.html +++ b/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.html @@ -11,17 +11,19 @@

-

- {{dso.firstMetadataValue('journal.contributor.editor')}} - , - {{dso.firstMetadataValue('journal.publisher')}} + {{dso.firstMetadataValue('creativework.editor')}} + + , + {{dso.firstMetadataValue('creativework.publisher')}} +

-

+

- +

diff --git a/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.spec.ts b/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.spec.ts index d9934e2d2f..8c12c1a266 100644 --- a/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.spec.ts +++ b/src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.spec.ts @@ -15,19 +15,19 @@ mockItemWithMetadata.indexableObject = Object.assign(new Item(), { value: 'This is just another title' } ], - 'journal.contributor.editor': [ + 'creativework.editor': [ { language: 'en_US', value: 'Smith, Donald' } ], - 'journal.publisher': [ + 'creativework.publisher': [ { language: 'en_US', value: 'A company' } ], - 'journal.identifier.description': [ + 'dc.description': [ { language: 'en_US', value: 'This is the description' diff --git a/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.html b/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.html index 92fffd0166..104d3a0a57 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.html +++ b/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.html @@ -9,19 +9,21 @@
-

+

-

+

- +

-

- {{dso.firstMetadataValue('orgunit.identifier.country')}} - , - {{dso.firstMetadataValue('orgunit.identifier.city')}} + {{dso.firstMetadataValue('organization.address.addressCountry')}} + + , + {{dso.firstMetadataValue('organization.address.addressLocality')}} +

diff --git a/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.spec.ts b/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.spec.ts index 25249fd2b0..39ddea4c7b 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.spec.ts +++ b/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.spec.ts @@ -15,19 +15,19 @@ mockItemWithMetadata.indexableObject = Object.assign(new Item(), { value: 'This is just another title' } ], - 'orgunit.identifier.dateestablished': [ + 'organization.foundingDate': [ { language: null, value: '2015-06-26' } ], - 'orgunit.identifier.country': [ + 'organization.address.addressCountry': [ { language: 'en_US', value: 'Belgium' } ], - 'orgunit.identifier.city': [ + 'organization.address.addressLocality': [ { language: 'en_US', value: 'Brussels' diff --git a/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.html b/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.html index 92d1ed40a8..86353377fa 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.html +++ b/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.html @@ -16,9 +16,9 @@

-

+

- +

diff --git a/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.spec.ts b/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.spec.ts index b3343a0605..a0f8e4c29e 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.spec.ts +++ b/src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.spec.ts @@ -15,13 +15,13 @@ mockItemWithMetadata.indexableObject = Object.assign(new Item(), { value: 'This is just another title' } ], - 'person.identifier.email': [ + 'person.email': [ { language: 'en_US', value: 'Smith-Donald@gmail.com' } ], - 'person.identifier.jobtitle': [ + 'person.jobTitle': [ { language: 'en_US', value: 'Web Developer' diff --git a/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.html b/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.html index 1fe4d18dae..a595791cc4 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.html +++ b/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.html @@ -11,9 +11,9 @@

-

+

- +

diff --git a/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.spec.ts b/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.spec.ts index bcf19ed96a..9ad26935b7 100644 --- a/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.spec.ts +++ b/src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.spec.ts @@ -15,10 +15,10 @@ mockItemWithMetadata.indexableObject = Object.assign(new Item(), { value: 'This is just another title' } ], - 'project.identifier.funder': [ + 'dc.description': [ { language: 'en_US', - value: 'The project funder' + value: 'The project description' } ] } @@ -38,4 +38,4 @@ mockItemWithoutMetadata.indexableObject = Object.assign(new Item(), { } }); -describe('ProjectGridElementComponent', getEntityGridElementTestComponent(ProjectGridElementComponent, mockItemWithMetadata, mockItemWithoutMetadata, ['funder'])); +describe('ProjectGridElementComponent', getEntityGridElementTestComponent(ProjectGridElementComponent, mockItemWithMetadata, mockItemWithoutMetadata, ['description'])); From 930da6dde376cea1de837134b8a335fef914dad8 Mon Sep 17 00:00:00 2001 From: Art Lowel Date: Tue, 13 Aug 2019 15:13:51 +0200 Subject: [PATCH 09/18] fix the labels on edit collection and community pages --- .../comcol-forms/comcol-form/comcol-form.component.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app/shared/comcol-forms/comcol-form/comcol-form.component.ts b/src/app/shared/comcol-forms/comcol-form/comcol-form.component.ts index 6a96892b06..8d1d5c1dca 100644 --- a/src/app/shared/comcol-forms/comcol-form/comcol-form.component.ts +++ b/src/app/shared/comcol-forms/comcol-form/comcol-form.component.ts @@ -9,6 +9,7 @@ import { DynamicFormControlModel } from '@ng-dynamic-forms/core/src/model/dynami import { TranslateService } from '@ngx-translate/core'; import { DSpaceObject } from '../../../core/shared/dspace-object.model'; import { MetadataMap, MetadataValue } from '../../../core/shared/metadata.models'; +import { ResourceType } from '../../../core/shared/resource-type'; import { isNotEmpty } from '../../empty.util'; import { Community } from '../../../core/shared/community.model'; @@ -29,7 +30,7 @@ export class ComColFormComponent implements OnInit { /** * Type of DSpaceObject that the form represents */ - protected type; + protected type: ResourceType; /** * @type {string} Key prefix used to generate form labels @@ -110,11 +111,11 @@ export class ComColFormComponent implements OnInit { private updateFieldTranslations() { this.formModel.forEach( (fieldModel: DynamicInputModel) => { - fieldModel.label = this.translate.instant(this.type + this.LABEL_KEY_PREFIX + fieldModel.id); + fieldModel.label = this.translate.instant(this.type.value + this.LABEL_KEY_PREFIX + fieldModel.id); if (isNotEmpty(fieldModel.validators)) { fieldModel.errorMessages = {}; Object.keys(fieldModel.validators).forEach((key) => { - fieldModel.errorMessages[key] = this.translate.instant(this.type + this.ERROR_KEY_PREFIX + fieldModel.id + '.' + key); + fieldModel.errorMessages[key] = this.translate.instant(this.type.value + this.ERROR_KEY_PREFIX + fieldModel.id + '.' + key); }); } } From 295bbc5c402e79b91129110c183aacc13ff42f7c Mon Sep 17 00:00:00 2001 From: Yana De Pauw Date: Wed, 14 Aug 2019 11:22:36 +0200 Subject: [PATCH 10/18] flatten en.json --- resources/i18n/en.json | 1863 +++++++++++++++------------------------- 1 file changed, 690 insertions(+), 1173 deletions(-) diff --git a/resources/i18n/en.json b/resources/i18n/en.json index 642c1db1ba..c5b542c424 100644 --- a/resources/i18n/en.json +++ b/resources/i18n/en.json @@ -1,1175 +1,692 @@ { - "footer": { - "copyright": "copyright © 2002-{{ year }}", - "link.dspace": "DSpace software", - "link.duraspace": "DuraSpace" - }, - "collection": { - "page": { - "news": "News", - "license": "License", - "browse": { - "recent": { - "head": "Recent Submissions" - } - } - }, - "form": { - "title": "Name", - "description": "Introductory text (HTML)", - "abstract": "Short Description", - "rights": "Copyright text (HTML)", - "tableofcontents": "News (HTML)", - "license": "License", - "provenance": "Provenance", - "errors": { - "title": { - "required": "Please enter a collection name" - } - } - }, - "edit": { - "head": "Edit Collection", - "delete": "Delete this collection" - }, - "create": { - "head": "Create a Collection", - "sub-head": "Create a Collection for Community {{ parent }}" - }, - "delete": { - "head": "Delete Collection", - "text": "Are you sure you want to delete collection \"{{ dso }}\"", - "confirm": "Confirm", - "cancel": "Cancel", - "notification": { - "success": "Successfully deleted collection", - "fail": "Collection could not be deleted" - } - } - }, - "community": { - "page": { - "news": "News", - "license": "License" - }, - "sub-collection-list": { - "head": "Collections of this Community" - }, - "sub-community-list": { - "head": "Communities of this Community" - }, - "form": { - "title": "Name", - "description": "Introductory text (HTML)", - "abstract": "Short Description", - "rights": "Copyright text (HTML)", - "tableofcontents": "News (HTML)", - "errors": { - "title": { - "required": "Please enter a community name" - } - } - }, - "edit": { - "head": "Edit Community", - "delete": "Delete this community" - }, - "create": { - "head": "Create a Community", - "sub-head": "Create a Sub-Community for Community {{ parent }}" - }, - "delete": { - "head": "Delete Community", - "text": "Are you sure you want to delete community \"{{ dso }}\"", - "confirm": "Confirm", - "cancel": "Cancel", - "notification": { - "success": "Successfully deleted community", - "fail": "Community could not be deleted" - } - } - }, - "item": { - "page": { - "author": "Authors", - "abstract": "Abstract", - "date": "Date", - "uri": "URI", - "files": "Files", - "collections": "Collections", - "subject": "Keywords", - "citation": "Citation", - "filesection": { - "download": "Download", - "name": "Name:", - "format": "Format:", - "size": "Size:", - "description": "Description:" - }, - "link": { - "simple": "Simple item page", - "full": "Full item page" - }, - "journal": { - "search": { - "title": "Articles in this journal" - } - }, - "person": { - "search": { - "title": "Articles by this author" - } - } - }, - "select": { - "table": { - "collection": "Collection", - "author": "Author", - "title": "Title" - }, - "confirm": "Confirm selected" - }, - "edit": { - "head": "Edit Item", - "tabs": { - "status": { - "head": "Item Status", - "description": "Welcome to the item management page. From here you can withdraw, reinstate, move or delete the item. You may also update or add new metadata / bitstreams on the other tabs.", - "title": "Item Edit - Status", - "labels": { - "id": "Item Internal ID", - "handle": "Handle", - "lastModified": "Last Modified", - "itemPage": "Item Page" - }, - "buttons": { - "authorizations": { - "label": "Edit item's authorization policies", - "button": "Authorizations..." - }, - "withdraw": { - "label": "Withdraw item from the repository", - "button": "Withdraw..." - }, - "reinstate": { - "label": "Reinstate item into the repository", - "button": "Reinstate..." - }, - "move": { - "label": "Move item to another collection", - "button": "Move..." - }, - "private": { - "label": "Make item private", - "button": "Make it private..." - }, - "public": { - "label": "Make item public", - "button": "Make it public..." - }, - "delete": { - "label": "Completely expunge item", - "button": "Permanently delete" - }, - "mappedCollections": { - "label": "Manage mapped collections", - "button": "Mapped collections" - } - } - }, - "bitstreams": { - "head": "Item Bitstreams", - "title": "Item Edit - Bitstreams" - }, - "metadata": { - "head": "Item Metadata", - "title": "Item Edit - Metadata" - }, - "view": { - "head": "View Item", - "title": "Item Edit - View" - }, - "curate": { - "head": "Curate", - "title": "Item Edit - Curate" - } - }, - "modify.overview": { - "field": "Field", - "value": "Value", - "language": "Language" - }, - "withdraw": { - "header": "Withdraw item: {{ id }}", - "description": "Are you sure this item should be withdrawn from the archive?", - "confirm": "Withdraw", - "cancel": "Cancel", - "success": "The item was withdrawn successfully", - "error": "An error occurred while withdrawing the item" - }, - "reinstate": { - "header": "Reinstate item: {{ id }}", - "description": "Are you sure this item should be reinstated to the archive?", - "confirm": "Reinstate", - "cancel": "Cancel", - "success": "The item was reinstated successfully", - "error": "An error occurred while reinstating the item" - }, - "private": { - "header": "Make item private: {{ id }}", - "description": "Are you sure this item should be made private in the archive?", - "confirm": "Make it Private", - "cancel": "Cancel", - "success": "The item is now private", - "error": "An error occurred while making the item private" - }, - "public": { - "header": "Make item public: {{ id }}", - "description": "Are you sure this item should be made public in the archive?", - "confirm": "Make it Public", - "cancel": "Cancel", - "success": "The item is now public", - "error": "An error occurred while making the item public" - }, - "delete": { - "header": "Delete item: {{ id }}", - "description": "Are you sure this item should be completely deleted? Caution: At present, no tombstone would be left.", - "confirm": "Delete", - "cancel": "Cancel", - "success": "The item has been deleted", - "error": "An error occurred while deleting the item" - }, - "metadata": { - "add-button": "Add", - "discard-button": "Discard", - "reinstate-button": "Undo", - "save-button": "Save", - "headers": { - "field": "Field", - "value": "Value", - "language": "Lang", - "edit": "Edit" - }, - "edit": { - "buttons": { - "edit": "Edit", - "unedit": "Stop editing", - "remove": "Remove", - "undo": "Undo changes" - } - }, - "metadatafield": { - "invalid": "Please choose a valid metadata field" - }, - "notifications": { - "outdated": { - "title": "Changed outdated", - "content": "The item you're currently working on has been changed by another user. Your current changes are discarded to prevent conflicts" - }, - "discarded": { - "title": "Changed discarded", - "content": "Your changes were discarded. To reinstate your changes click the 'Undo' button" - }, - "invalid": { - "title": "Metadata invalid", - "content": "Your changes were not saved. Please make sure all fields are valid before you save." - }, - "saved": { - "title": "Metadata saved", - "content": "Your changes to this item's metadata were saved." - } - } - } - } - }, - "relationships": { - "isPublicationOf": "Publications", - "isProjectOf": "Research Projects", - "isOrgUnitOf": "Organizational Units", - "isAuthorOf": "Authors", - "isPersonOf": "Authors", - "isJournalOf": "Journals", - "isSingleJournalOf": "Journal", - "isVolumeOf": "Journal Volumes", - "isSingleVolumeOf": "Journal Volume", - "isIssueOf": "Journal Issues", - "isJournalIssueOf": "Journal Issue", - "isPublicationOfJournalIssue": "Articles" - }, - "person": { - "page": { - "titleprefix": "Person: ", - "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" - } - }, - "listelement": { - "badge": "Person" - }, - "search": { - "title": "DSpace Angular :: Person Search", - "results": { - "head": "Person Search Results" - } - } - }, - "project": { - "page": { - "titleprefix": "Research Project: ", - "status": "Status", - "contributor": "Contributors", - "funder": "Funders", - "id": "ID", - "expectedcompletion": "Expected Completion", - "description": "Description", - "keyword": "Keywords" - }, - "listelement": { - "badge": "Research Project" - } - }, - "orgunit": { - "page": { - "titleprefix": "Organizational Unit: ", - "dateestablished": "Date established", - "city": "City", - "country": "Country", - "id": "ID", - "description": "Description" - }, - "listelement": { - "badge": "Organizational Unit" - } - }, - "journal": { - "page": { - "titleprefix": "Journal: ", - "issn": "ISSN", - "publisher": "Publisher", - "description": "Description", - "editor": "Editor-in-Chief" - }, - "listelement": { - "badge": "Journal" - }, - "search": { - "title": "DSpace Angular :: Journal Search", - "results": { - "head": "Journal Search Results" - } - } - }, - "journalvolume": { - "page": { - "titleprefix": "Journal Volume: ", - "volume": "Volume", - "issuedate": "Issue Date", - "description": "Description" - }, - "listelement": { - "badge": "Journal Volume" - } - }, - "journalissue": { - "page": { - "titleprefix": "Journal Issue: ", - "number": "Number", - "issuedate": "Issue Date", - "description": "Description", - "keyword": "Keywords", - "journal-title": "Journal Title", - "journal-issn": "Journal ISSN" - }, - "listelement": { - "badge": "Journal Issue" - } - }, - "publication": { - "page": { - "titleprefix": "Publication: ", - "journal-title": "Journal Title", - "journal-issn": "Journal ISSN", - "volume-title": "Volume Title", - "publisher": "Publisher", - "description": "Description" - - }, - "listelement": { - "badge": "Publication" - }, - "search": { - "title": "DSpace Angular :: Publication Search", - "results": { - "head": "Publication Search Results" - } - } - }, - "nav": { - "browse": { - "header": "All of DSpace" - }, - "community-browse": { - "header": "By Community" - }, - "statistics": { - "header": "Statistics" - }, - "login": "Log In", - "logout": "Log Out", - "mydspace": "MyDSpace", - "language": "Language switch", - "search": "Search" - }, - "pagination": { - "results-per-page": "Results Per Page", - "sort-direction": "Sort Options", - "showing": { - "label": "Now showing ", - "detail": "{{ range }} of {{ total }}" - } - }, - "sorting": { - "score": { - "DESC": "Relevance" - }, - "dc.title": { - "ASC": "Title Ascending", - "DESC": "Title Descending" - } - }, + "404.help": "We can't find the page you're looking for. The page may have been moved or deleted. You can use the button below to get back to the home page. ", + "404.link.home-page": "Take me to the home page", + "404.page-not-found": "page not found", + "admin.registries.bitstream-formats.create.failure.content": "An error occurred while creating the new bitstream format.", + "admin.registries.bitstream-formats.create.failure.head": "Failure", + "admin.registries.bitstream-formats.create.head": "Create Bitstream format", + "admin.registries.bitstream-formats.create.new": "Add a new bitstream format", + "admin.registries.bitstream-formats.create.success.content": "The new bitstream format was successfully created.", + "admin.registries.bitstream-formats.create.success.head": "Success", + "admin.registries.bitstream-formats.delete.failure.amount": "The following amount of bitstream formats could not be deleted: {{ amount }} ", + "admin.registries.bitstream-formats.delete.failure.head": "Failure", + "admin.registries.bitstream-formats.delete.success.amount": "The following amount of bitstream formats have been successfully deleted: {{ amount }}", + "admin.registries.bitstream-formats.delete.success.head": "Success", + "admin.registries.bitstream-formats.description": "This list of bitstream formats provides information about known formats and their support level.", + "admin.registries.bitstream-formats.edit.description.hint": "", + "admin.registries.bitstream-formats.edit.description.label": "Description", + "admin.registries.bitstream-formats.edit.extensions.hint": "Extensions are file extensions that are used to automatically identify the format of uploaded files. You can enter several extensions for each format.", + "admin.registries.bitstream-formats.edit.extensions.label": "File extensions", + "admin.registries.bitstream-formats.edit.failure.content": "An error occurred while editing the bitstream format.", + "admin.registries.bitstream-formats.edit.failure.head": "Failure", + "admin.registries.bitstream-formats.edit.head": "Bitstream format: {{ format }}", + "admin.registries.bitstream-formats.edit.internal.hint": "Formats marked as internal are are hidden from the user, and used for administrative purposes.", + "admin.registries.bitstream-formats.edit.internal.label": "Internal", + "admin.registries.bitstream-formats.edit.mimetype.hint": "The MIME type associated with this format, does not have to be unique.", + "admin.registries.bitstream-formats.edit.mimetype.label": "MIME Type", + "admin.registries.bitstream-formats.edit.shortDescription.hint": "A unique name for this format, (e.g. Microsoft Word XP or Microsoft Word 2000)", + "admin.registries.bitstream-formats.edit.shortDescription.label": "Name", + "admin.registries.bitstream-formats.edit.success.content": "The bitstream format was successfully edited.", + "admin.registries.bitstream-formats.edit.success.head": "Success", + "admin.registries.bitstream-formats.edit.supportLevel.hint": "The level of support your institution pledges for this format.", + "admin.registries.bitstream-formats.edit.supportLevel.label": "Support level", + "admin.registries.bitstream-formats.head": "Bitstream Format Registry", + "admin.registries.bitstream-formats.no-items": "No bitstream formats to show.", + "admin.registries.bitstream-formats.table.delete": "Delete selected", + "admin.registries.bitstream-formats.table.deselect-all": "Deselect all", + "admin.registries.bitstream-formats.table.internal": "internal", + "admin.registries.bitstream-formats.table.mimetype": "MIME Type", + "admin.registries.bitstream-formats.table.name": "Name", + "admin.registries.bitstream-formats.table.return": "Return", + "admin.registries.bitstream-formats.table.supportLevel.KNOWN": "Known", + "admin.registries.bitstream-formats.table.supportLevel.SUPPORTED": "Supported", + "admin.registries.bitstream-formats.table.supportLevel.UNKNOWN": "Unknown", + "admin.registries.bitstream-formats.table.supportLevel.head": "Support Level", + "admin.registries.bitstream-formats.title": "DSpace Angular :: Bitstream Format Registry", + "admin.registries.metadata.description": "The metadata registry maintains a list of all metadata fields available in the repository. These fields may be divided amongst multiple schemas. However, DSpace requires the qualified Dublin Core schema.", + "admin.registries.metadata.form.create": "Create metadata schema", + "admin.registries.metadata.form.edit": "Edit metadata schema", + "admin.registries.metadata.form.name": "Name", + "admin.registries.metadata.form.namespace": "Namespace", + "admin.registries.metadata.head": "Metadata Registry", + "admin.registries.metadata.schemas.no-items": "No metadata schemas to show.", + "admin.registries.metadata.schemas.table.delete": "Delete selected", + "admin.registries.metadata.schemas.table.id": "ID", + "admin.registries.metadata.schemas.table.name": "Name", + "admin.registries.metadata.schemas.table.namespace": "Namespace", + "admin.registries.metadata.title": "DSpace Angular :: Metadata Registry", + "admin.registries.schema.description": "This is the metadata schema for \"{{namespace}}\".", + "admin.registries.schema.fields.head": "Schema metadata fields", + "admin.registries.schema.fields.no-items": "No metadata fields to show.", + "admin.registries.schema.fields.table.delete": "Delete selected", + "admin.registries.schema.fields.table.field": "Field", + "admin.registries.schema.fields.table.scopenote": "Scope Note", + "admin.registries.schema.form.create": "Create metadata field", + "admin.registries.schema.form.edit": "Edit metadata field", + "admin.registries.schema.form.element": "Element", + "admin.registries.schema.form.qualifier": "Qualifier", + "admin.registries.schema.form.scopenote": "Scope Note", + "admin.registries.schema.head": "Metadata Schema", + "admin.registries.schema.notification.created": "Successfully created metadata schema \"{{prefix}}\"", + "admin.registries.schema.notification.deleted.failure": "Failed to delete {{amount}} metadata schemas", + "admin.registries.schema.notification.deleted.success": "Successfully deleted {{amount}} metadata schemas", + "admin.registries.schema.notification.edited": "Successfully edited metadata schema \"{{prefix}}\"", + "admin.registries.schema.notification.failure": "Error", + "admin.registries.schema.notification.field.created": "Successfully created metadata field \"{{field}}\"", + "admin.registries.schema.notification.field.deleted.failure": "Failed to delete {{amount}} metadata fields", + "admin.registries.schema.notification.field.deleted.success": "Successfully deleted {{amount}} metadata fields", + "admin.registries.schema.notification.field.edited": "Successfully edited metadata field \"{{field}}\"", + "admin.registries.schema.notification.success": "Success", + "admin.registries.schema.return": "Return", + "admin.registries.schema.title": "DSpace Angular :: Metadata Schema Registry", + "auth.errors.invalid-user": "Invalid email address or password.", + "auth.messages.expired": "Your session has expired. Please log in again.", + "browse.comcol.by.author": "By Author", + "browse.comcol.by.dateissued": "By Issue Date", + "browse.comcol.by.subject": "By Subject", + "browse.comcol.by.title": "By Title", + "browse.comcol.head": "Browse", + "browse.empty": "No items to show.", + "browse.metadata.author": "Author", + "browse.metadata.dateissued": "Issue Date", + "browse.metadata.subject": "Subject", + "browse.metadata.title": "Title", + "browse.startsWith.choose_start": "(Choose start)", + "browse.startsWith.choose_year": "(Choose year)", + "browse.startsWith.jump": "Jump to a point in the index:", + "browse.startsWith.months.april": "April", + "browse.startsWith.months.august": "August", + "browse.startsWith.months.december": "December", + "browse.startsWith.months.february": "February", + "browse.startsWith.months.january": "January", + "browse.startsWith.months.july": "July", + "browse.startsWith.months.june": "June", + "browse.startsWith.months.march": "March", + "browse.startsWith.months.may": "May", + "browse.startsWith.months.none": "(Choose month)", + "browse.startsWith.months.november": "November", + "browse.startsWith.months.october": "October", + "browse.startsWith.months.september": "September", + "browse.startsWith.submit": "Go", + "browse.startsWith.type_date": "Or type in a date (year-month):", + "browse.startsWith.type_text": "Or enter first few letters:", + "browse.title": "Browsing {{ collection }} by {{ field }} {{ value }}", + "chips.remove": "Remove chip", + "collection.create.head": "Create a Collection", + "collection.create.sub-head": "Create a Collection for Community {{ parent }}", + "collection.delete.cancel": "Cancel", + "collection.delete.confirm": "Confirm", + "collection.delete.head": "Delete Collection", + "collection.delete.notification.fail": "Collection could not be deleted", + "collection.delete.notification.success": "Successfully deleted collection", + "collection.delete.text": "Are you sure you want to delete collection \"{{ dso }}\"", + "collection.edit.delete": "Delete this collection", + "collection.edit.head": "Edit Collection", + "collection.form.abstract": "Short Description", + "collection.form.description": "Introductory text (HTML)", + "collection.form.errors.title.required": "Please enter a collection name", + "collection.form.license": "License", + "collection.form.provenance": "Provenance", + "collection.form.rights": "Copyright text (HTML)", + "collection.form.tableofcontents": "News (HTML)", + "collection.form.title": "Name", + "collection.page.browse.recent.head": "Recent Submissions", + "collection.page.license": "License", + "collection.page.news": "News", + "community.create.head": "Create a Community", + "community.create.sub-head": "Create a Sub-Community for Community {{ parent }}", + "community.delete.cancel": "Cancel", + "community.delete.confirm": "Confirm", + "community.delete.head": "Delete Community", + "community.delete.notification.fail": "Community could not be deleted", + "community.delete.notification.success": "Successfully deleted community", + "community.delete.text": "Are you sure you want to delete community \"{{ dso }}\"", + "community.edit.delete": "Delete this community", + "community.edit.head": "Edit Community", + "community.form.abstract": "Short Description", + "community.form.description": "Introductory text (HTML)", + "community.form.errors.title.required": "Please enter a community name", + "community.form.rights": "Copyright text (HTML)", + "community.form.tableofcontents": "News (HTML)", + "community.form.title": "Name", + "community.page.license": "License", + "community.page.news": "News", + "community.sub-collection-list.head": "Collections of this Community", + "community.sub-community-list.head": "Communities of this Community", + "dso-selector.create.collection.head": "New collection", + "dso-selector.create.community.head": "New community", + "dso-selector.create.community.sub-level": "Create a new community in", + "dso-selector.create.community.top-level": "Create a new top-level community", + "dso-selector.create.item.head": "New item", + "dso-selector.edit.collection.head": "Edit collection", + "dso-selector.edit.community.head": "Edit community", + "dso-selector.edit.item.head": "Edit item", + "dso-selector.no-results": "No {{ type }} found", + "dso-selector.placeholder": "Search for a {{ type }}", + "error.browse-by": "Error fetching items", + "error.collection": "Error fetching collection", + "error.community": "Error fetching community", + "error.default": "Error", + "error.item": "Error fetching item", + "error.objects": "Error fetching objects", + "error.recent-submissions": "Error fetching recent submissions", + "error.search-results": "Error fetching search results", + "error.sub-collections": "Error fetching sub-collections", + "error.sub-communities": "Error fetching sub-communities", + "error.submission.sections.init-form-error": "An error occurred during section initialize, please check your input-form configuration. Details are below :

", + "error.top-level-communities": "Error fetching top-level communities", + "error.validation.license.notgranted": "You must grant this license to complete your submission. If you are unable to grant this license at this time you may save your work and return later or remove the submission.", + "error.validation.pattern": "This input is restricted by the current pattern: {{ pattern }}.", + "footer.copyright": "copyright © 2002-{{ year }}", + "footer.link.dspace": "DSpace software", + "footer.link.duraspace": "DuraSpace", + "form.cancel": "Cancel", + "form.clear": "Clear", + "form.clear-help": "Click here to remove the selected value", + "form.edit": "Edit", + "form.edit-help": "Click here to edit the selected value", + "form.first-name": "First name", + "form.group-collapse": "Collapse", + "form.group-collapse-help": "Click here to collapse", + "form.group-expand": "Expand", + "form.group-expand-help": "Click here to expand and add more elements", + "form.last-name": "Last name", + "form.loading": "Loading...", + "form.no-results": "No results found", + "form.no-value": "No value entered", + "form.other-information": {}, + "form.remove": "Remove", + "form.save": "Save", + "form.save-help": "Save changes", + "form.search": "Search", + "form.search-help": "Click here to looking for an existing correspondence", + "form.submit": "Submit", + "home.description": "", + "home.title": "DSpace Angular :: Home", + "home.top-level-communities.head": "Communities in DSpace", + "home.top-level-communities.help": "Select a community to browse its collections.", + "item.edit.delete.cancel": "Cancel", + "item.edit.delete.confirm": "Delete", + "item.edit.delete.description": "Are you sure this item should be completely deleted? Caution: At present, no tombstone would be left.", + "item.edit.delete.error": "An error occurred while deleting the item", + "item.edit.delete.header": "Delete item: {{ id }}", + "item.edit.delete.success": "The item has been deleted", + "item.edit.head": "Edit Item", + "item.edit.metadata.add-button": "Add", + "item.edit.metadata.discard-button": "Discard", + "item.edit.metadata.edit.buttons.edit": "Edit", + "item.edit.metadata.edit.buttons.remove": "Remove", + "item.edit.metadata.edit.buttons.undo": "Undo changes", + "item.edit.metadata.edit.buttons.unedit": "Stop editing", + "item.edit.metadata.headers.edit": "Edit", + "item.edit.metadata.headers.field": "Field", + "item.edit.metadata.headers.language": "Lang", + "item.edit.metadata.headers.value": "Value", + "item.edit.metadata.metadatafield.invalid": "Please choose a valid metadata field", + "item.edit.metadata.notifications.discarded.content": "Your changes were discarded. To reinstate your changes click the 'Undo' button", + "item.edit.metadata.notifications.discarded.title": "Changed discarded", + "item.edit.metadata.notifications.invalid.content": "Your changes were not saved. Please make sure all fields are valid before you save.", + "item.edit.metadata.notifications.invalid.title": "Metadata invalid", + "item.edit.metadata.notifications.outdated.content": "The item you're currently working on has been changed by another user. Your current changes are discarded to prevent conflicts", + "item.edit.metadata.notifications.outdated.title": "Changed outdated", + "item.edit.metadata.notifications.saved.content": "Your changes to this item's metadata were saved.", + "item.edit.metadata.notifications.saved.title": "Metadata saved", + "item.edit.metadata.reinstate-button": "Undo", + "item.edit.metadata.save-button": "Save", + "item.edit.modify.overview.field": "Field", + "item.edit.modify.overview.language": "Language", + "item.edit.modify.overview.value": "Value", + "item.edit.private.cancel": "Cancel", + "item.edit.private.confirm": "Make it Private", + "item.edit.private.description": "Are you sure this item should be made private in the archive?", + "item.edit.private.error": "An error occurred while making the item private", + "item.edit.private.header": "Make item private: {{ id }}", + "item.edit.private.success": "The item is now private", + "item.edit.public.cancel": "Cancel", + "item.edit.public.confirm": "Make it Public", + "item.edit.public.description": "Are you sure this item should be made public in the archive?", + "item.edit.public.error": "An error occurred while making the item public", + "item.edit.public.header": "Make item public: {{ id }}", + "item.edit.public.success": "The item is now public", + "item.edit.reinstate.cancel": "Cancel", + "item.edit.reinstate.confirm": "Reinstate", + "item.edit.reinstate.description": "Are you sure this item should be reinstated to the archive?", + "item.edit.reinstate.error": "An error occurred while reinstating the item", + "item.edit.reinstate.header": "Reinstate item: {{ id }}", + "item.edit.reinstate.success": "The item was reinstated successfully", + "item.edit.tabs.bitstreams.head": "Item Bitstreams", + "item.edit.tabs.bitstreams.title": "Item Edit - Bitstreams", + "item.edit.tabs.curate.head": "Curate", + "item.edit.tabs.curate.title": "Item Edit - Curate", + "item.edit.tabs.metadata.head": "Item Metadata", + "item.edit.tabs.metadata.title": "Item Edit - Metadata", + "item.edit.tabs.status.buttons.authorizations.button": "Authorizations...", + "item.edit.tabs.status.buttons.authorizations.label": "Edit item's authorization policies", + "item.edit.tabs.status.buttons.delete.button": "Permanently delete", + "item.edit.tabs.status.buttons.delete.label": "Completely expunge item", + "item.edit.tabs.status.buttons.mappedCollections.button": "Mapped collections", + "item.edit.tabs.status.buttons.mappedCollections.label": "Manage mapped collections", + "item.edit.tabs.status.buttons.move.button": "Move...", + "item.edit.tabs.status.buttons.move.label": "Move item to another collection", + "item.edit.tabs.status.buttons.private.button": "Make it private...", + "item.edit.tabs.status.buttons.private.label": "Make item private", + "item.edit.tabs.status.buttons.public.button": "Make it public...", + "item.edit.tabs.status.buttons.public.label": "Make item public", + "item.edit.tabs.status.buttons.reinstate.button": "Reinstate...", + "item.edit.tabs.status.buttons.reinstate.label": "Reinstate item into the repository", + "item.edit.tabs.status.buttons.withdraw.button": "Withdraw...", + "item.edit.tabs.status.buttons.withdraw.label": "Withdraw item from the repository", + "item.edit.tabs.status.description": "Welcome to the item management page. From here you can withdraw, reinstate, move or delete the item. You may also update or add new metadata / bitstreams on the other tabs.", + "item.edit.tabs.status.head": "Item Status", + "item.edit.tabs.status.labels.handle": "Handle", + "item.edit.tabs.status.labels.id": "Item Internal ID", + "item.edit.tabs.status.labels.itemPage": "Item Page", + "item.edit.tabs.status.labels.lastModified": "Last Modified", + "item.edit.tabs.status.title": "Item Edit - Status", + "item.edit.tabs.view.head": "View Item", + "item.edit.tabs.view.title": "Item Edit - View", + "item.edit.withdraw.cancel": "Cancel", + "item.edit.withdraw.confirm": "Withdraw", + "item.edit.withdraw.description": "Are you sure this item should be withdrawn from the archive?", + "item.edit.withdraw.error": "An error occurred while withdrawing the item", + "item.edit.withdraw.header": "Withdraw item: {{ id }}", + "item.edit.withdraw.success": "The item was withdrawn successfully", + "item.page.abstract": "Abstract", + "item.page.author": "Authors", + "item.page.citation": "Citation", + "item.page.collections": "Collections", + "item.page.date": "Date", + "item.page.files": "Files", + "item.page.filesection.description": "Description:", + "item.page.filesection.download": "Download", + "item.page.filesection.format": "Format:", + "item.page.filesection.name": "Name:", + "item.page.filesection.size": "Size:", + "item.page.journal.search.title": "Articles in this journal", + "item.page.link.full": "Full item page", + "item.page.link.simple": "Simple item page", + "item.page.person.search.title": "Articles by this author", + "item.page.subject": "Keywords", + "item.page.uri": "URI", + "item.select.confirm": "Confirm selected", + "item.select.table.author": "Author", + "item.select.table.collection": "Collection", + "item.select.table.title": "Title", + "journal.listelement.badge": "Journal", + "journal.page.description": "Description", + "journal.page.editor": "Editor-in-Chief", + "journal.page.issn": "ISSN", + "journal.page.publisher": "Publisher", + "journal.page.titleprefix": "Journal: ", + "journal.search.results.head": "Journal Search Results", + "journal.search.title": "DSpace Angular :: Journal Search", + "journalissue.listelement.badge": "Journal Issue", + "journalissue.page.description": "Description", + "journalissue.page.issuedate": "Issue Date", + "journalissue.page.journal-issn": "Journal ISSN", + "journalissue.page.journal-title": "Journal Title", + "journalissue.page.keyword": "Keywords", + "journalissue.page.number": "Number", + "journalissue.page.titleprefix": "Journal Issue: ", + "journalvolume.listelement.badge": "Journal Volume", + "journalvolume.page.description": "Description", + "journalvolume.page.issuedate": "Issue Date", + "journalvolume.page.titleprefix": "Journal Volume: ", + "journalvolume.page.volume": "Volume", + "loading.browse-by": "Loading items...", + "loading.browse-by-page": "Loading page...", + "loading.collection": "Loading collection...", + "loading.community": "Loading community...", + "loading.default": "Loading...", + "loading.item": "Loading item...", + "loading.mydspace-results": "Loading items...", + "loading.objects": "Loading...", + "loading.recent-submissions": "Loading recent submissions...", + "loading.search-results": "Loading search results...", + "loading.sub-collections": "Loading sub-collections...", + "loading.sub-communities": "Loading sub-communities...", + "loading.top-level-communities": "Loading top-level communities...", + "login.form.email": "Email address", + "login.form.forgot-password": "Have you forgotten your password?", + "login.form.header": "Please log in to DSpace", + "login.form.new-user": "New user? Click here to register.", + "login.form.password": "Password", + "login.form.submit": "Log in", + "login.title": "Login", + "logout.form.header": "Log out from DSpace", + "logout.form.submit": "Log out", + "logout.title": "Logout", + "menu.header.admin": "Admin", + "menu.header.image.logo": "Repository logo", + "menu.section.access_control": "Access Control", + "menu.section.access_control_authorizations": "Authorizations", + "menu.section.access_control_groups": "Groups", + "menu.section.access_control_people": "People", + "menu.section.browse_community": "This Community", + "menu.section.browse_community_by_author": "By Author", + "menu.section.browse_community_by_issue_date": "By Issue Date", + "menu.section.browse_community_by_title": "By Title", + "menu.section.browse_global": "All of DSpace", + "menu.section.browse_global_by_author": "By Author", + "menu.section.browse_global_by_dateissued": "By Issue Date", + "menu.section.browse_global_by_subject": "By Subject", + "menu.section.browse_global_by_title": "By Title", + "menu.section.browse_global_communities_and_collections": "Communities & Collections", + "menu.section.control_panel": "Control Panel", + "menu.section.curation_task": "Curation Task", + "menu.section.edit": "Edit", + "menu.section.edit_collection": "Collection", + "menu.section.edit_community": "Community", + "menu.section.edit_item": "Item", + "menu.section.export": "Export", + "menu.section.export_collection": "Collection", + "menu.section.export_community": "Community", + "menu.section.export_item": "Item", + "menu.section.export_metadata": "Metadata", + "menu.section.find": "Find", + "menu.section.find_items": "Items", + "menu.section.find_private_items": "Private Items", + "menu.section.find_withdrawn_items": "Withdrawn Items", + "menu.section.icon.access_control": "Access Control menu section", + "menu.section.icon.control_panel": "Control Panel menu section", + "menu.section.icon.curation_task": "Curation Task menu section", + "menu.section.icon.edit": "Edit menu section", + "menu.section.icon.export": "Export menu section", + "menu.section.icon.find": "Find menu section", + "menu.section.icon.import": "Import menu section", + "menu.section.icon.new": "New menu section", + "menu.section.icon.pin": "Pin sidebar", + "menu.section.icon.registries": "Registries menu section", + "menu.section.icon.statistics_task": "Statistics Task menu section", + "menu.section.icon.unpin": "Unpin sidebar", + "menu.section.import": "Import", + "menu.section.import_batch": "Batch Import (ZIP)", + "menu.section.import_metadata": "Metadata", + "menu.section.new": "New", + "menu.section.new_collection": "Collection", + "menu.section.new_community": "Community", + "menu.section.new_item": "Item", + "menu.section.new_item_version": "Item Version", + "menu.section.pin": "Pin sidebar", + "menu.section.registries": "Registries", + "menu.section.registries_format": "Format", + "menu.section.registries_metadata": "Metadata", + "menu.section.statistics": "Statistics", + "menu.section.statistics_task": "Statistics Task", + "menu.section.toggle.access_control": "Toggle Access Control section", + "menu.section.toggle.control_panel": "Toggle Control Panel section", + "menu.section.toggle.curation_task": "Toggle Curation Task section", + "menu.section.toggle.edit": "Toggle Edit section", + "menu.section.toggle.export": "Toggle Export section", + "menu.section.toggle.find": "Toggle Find section", + "menu.section.toggle.import": "Toggle Import section", + "menu.section.toggle.new": "Toggle New section", + "menu.section.toggle.registries": "Toggle Registries section", + "menu.section.toggle.statistics_task": "Toggle Statistics Task section", + "menu.section.unpin": "Unpin sidebar", + "mydspace.description": "", + "mydspace.general.text-here": "HERE", + "mydspace.messages.controller-help": "Select this option to send a message to item's submitter.", + "mydspace.messages.description-placeholder": "Insert your message here...", + "mydspace.messages.hide-msg": "Hide message", + "mydspace.messages.mark-as-read": "Mark as read", + "mydspace.messages.mark-as-unread": "Mark as unread", + "mydspace.messages.no-content": "No content.", + "mydspace.messages.no-messages": "No messages yet.", + "mydspace.messages.send-btn": "Send", + "mydspace.messages.show-msg": "Show message", + "mydspace.messages.subject-placeholder": "Subject...", + "mydspace.messages.submitter-help": "Select this option to send a message to controller.", + "mydspace.messages.title": "Messages", + "mydspace.messages.to": "To", + "mydspace.new-submission": "New submission", + "mydspace.results.head": "Your submissions", + "mydspace.results.no-abstract": "No Abstract", + "mydspace.results.no-authors": "No Authors", + "mydspace.results.no-collections": "No Collections", + "mydspace.results.no-date": "No Date", + "mydspace.results.no-files": "No Files", + "mydspace.results.no-results": "There were no items to show", + "mydspace.results.no-title": "No title", + "mydspace.results.no-uri": "No Uri", + "mydspace.show.workflow": "All tasks", + "mydspace.show.workspace": "Your Submissions", + "mydspace.status.archived": "Archived", + "mydspace.status.validation": "Validation", + "mydspace.status.waiting-for-controller": "Waiting for controller", + "mydspace.status.workflow": "Workflow", + "mydspace.status.workspace": "Workspace", + "mydspace.title": "MyDSpace", + "mydspace.upload.upload-failed": "Error creating new workspace. Please verify the content uploaded before retry.", + "mydspace.upload.upload-multiple-successful": "{{qty}} new workspace items created.", + "mydspace.upload.upload-successful": "New workspace item created. Click {{here}} for edit it.", + "mydspace.view-btn": "View", + "nav.browse.header": "All of DSpace", + "nav.community-browse.header": "By Community", + "nav.language": "Language switch", + "nav.login": "Log In", + "nav.logout": "Log Out", + "nav.mydspace": "MyDSpace", + "nav.search": "Search", + "nav.statistics.header": "Statistics", + "orgunit.listelement.badge": "Organizational Unit", + "orgunit.page.city": "City", + "orgunit.page.country": "Country", + "orgunit.page.dateestablished": "Date established", + "orgunit.page.description": "Description", + "orgunit.page.id": "ID", + "orgunit.page.titleprefix": "Organizational Unit: ", + "pagination.results-per-page": "Results Per Page", + "pagination.showing.detail": "{{ range }} of {{ total }}", + "pagination.showing.label": "Now showing ", + "pagination.sort-direction": "Sort Options", + "person.listelement.badge": "Person", + "person.page.birthdate": "Birth Date", + "person.page.email": "Email Address", + "person.page.firstname": "First Name", + "person.page.jobtitle": "Job Title", + "person.page.lastname": "Last Name", + "person.page.link.full": "Show all metadata", + "person.page.orcid": "ORCID", + "person.page.staffid": "Staff ID", + "person.page.titleprefix": "Person: ", + "person.search.results.head": "Person Search Results", + "person.search.title": "DSpace Angular :: Person Search", + "project.listelement.badge": "Research Project", + "project.page.contributor": "Contributors", + "project.page.description": "Description", + "project.page.expectedcompletion": "Expected Completion", + "project.page.funder": "Funders", + "project.page.id": "ID", + "project.page.keyword": "Keywords", + "project.page.status": "Status", + "project.page.titleprefix": "Research Project: ", + "publication.listelement.badge": "Publication", + "publication.page.description": "Description", + "publication.page.journal-issn": "Journal ISSN", + "publication.page.journal-title": "Journal Title", + "publication.page.publisher": "Publisher", + "publication.page.titleprefix": "Publication: ", + "publication.page.volume-title": "Volume Title", + "publication.search.results.head": "Publication Search Results", + "publication.search.title": "DSpace Angular :: Publication Search", + "relationships.isAuthorOf": "Authors", + "relationships.isIssueOf": "Journal Issues", + "relationships.isJournalIssueOf": "Journal Issue", + "relationships.isJournalOf": "Journals", + "relationships.isOrgUnitOf": "Organizational Units", + "relationships.isPersonOf": "Authors", + "relationships.isProjectOf": "Research Projects", + "relationships.isPublicationOf": "Publications", + "relationships.isPublicationOfJournalIssue": "Articles", + "relationships.isSingleJournalOf": "Journal", + "relationships.isSingleVolumeOf": "Journal Volume", + "relationships.isVolumeOf": "Journal Volumes", + "search.description": "", + "search.filters.applied.f.author": "Author", + "search.filters.applied.f.dateIssued.max": "End date", + "search.filters.applied.f.dateIssued.min": "Start date", + "search.filters.applied.f.dateSubmitted": "Date submitted", + "search.filters.applied.f.entityType": "Item Type", + "search.filters.applied.f.has_content_in_original_bundle": "Has files", + "search.filters.applied.f.itemtype": "Type", + "search.filters.applied.f.namedresourcetype": "Status", + "search.filters.applied.f.subject": "Subject", + "search.filters.applied.f.submitter": "Submitter", + "search.filters.filter.author.head": "Author", + "search.filters.filter.author.placeholder": "Author name", + "search.filters.filter.birthDate.head": "Birth Date", + "search.filters.filter.birthDate.placeholder": "Birth Date", + "search.filters.filter.creativeDatePublished.head": "Date Published", + "search.filters.filter.creativeDatePublished.placeholder": "Date Published", + "search.filters.filter.creativeWorkEditor.head": "Editor", + "search.filters.filter.creativeWorkEditor.placeholder": "Editor", + "search.filters.filter.creativeWorkKeywords.head": "Subject", + "search.filters.filter.creativeWorkKeywords.placeholder": "Subject", + "search.filters.filter.creativeWorkPublisher.head": "Publisher", + "search.filters.filter.creativeWorkPublisher.placeholder": "Publisher", + "search.filters.filter.dateIssued.head": "Date", + "search.filters.filter.dateIssued.max.placeholder": "Minimum Date", + "search.filters.filter.dateIssued.min.placeholder": "Maximum Date", + "search.filters.filter.dateSubmitted.head": "Date submitted", + "search.filters.filter.dateSubmitted.placeholder": "Date submitted", + "search.filters.filter.entityType.head": "Item Type", + "search.filters.filter.entityType.placeholder": "Item Type", + "search.filters.filter.has_content_in_original_bundle.head": "Has files", + "search.filters.filter.itemtype.head": "Type", + "search.filters.filter.itemtype.placeholder": "Type", + "search.filters.filter.jobTitle.head": "Job Title", + "search.filters.filter.jobTitle.placeholder": "Job Title", + "search.filters.filter.knowsLanguage.head": "Known language", + "search.filters.filter.knowsLanguage.placeholder": "Known language", + "search.filters.filter.namedresourcetype.head": "Status", + "search.filters.filter.namedresourcetype.placeholder": "Status", + "search.filters.filter.objectpeople.head": "People", + "search.filters.filter.objectpeople.placeholder": "People", + "search.filters.filter.organizationAddressCountry.head": "Country", + "search.filters.filter.organizationAddressCountry.placeholder": "Country", + "search.filters.filter.organizationAddressLocality.head": "City", + "search.filters.filter.organizationAddressLocality.placeholder": "City", + "search.filters.filter.organizationFoundingDate.head": "Date Founded", + "search.filters.filter.organizationFoundingDate.placeholder": "Date Founded", + "search.filters.filter.scope.head": "Scope", + "search.filters.filter.scope.placeholder": "Scope filter", + "search.filters.filter.show-less": "Collapse", + "search.filters.filter.show-more": "Show more", + "search.filters.filter.subject.head": "Subject", + "search.filters.filter.subject.placeholder": "Subject", + "search.filters.filter.submitter.head": "Submitter", + "search.filters.filter.submitter.placeholder": "Submitter", + "search.filters.head": "Filters", + "search.filters.reset": "Reset filters", + "search.form.search": "Search", + "search.form.search_dspace": "Search DSpace", + "search.form.search_mydspace": "Search MyDSpace", + "search.results.head": "Search Results", + "search.results.no-results": "Your search returned no results. Having trouble finding what you're looking for? Try putting", + "search.results.no-results-link": "quotes around it", + "search.sidebar.close": "Back to results", + "search.sidebar.filters.title": "Filters", + "search.sidebar.open": "Search Tools", + "search.sidebar.results": "results", + "search.sidebar.settings.rpp": "Results per page", + "search.sidebar.settings.sort-by": "Sort By", + "search.sidebar.settings.title": "Settings", + "search.switch-configuration.title": "Show", + "search.title": "DSpace Angular :: Search", + "search.view-switch.show-detail": "Show detail", + "search.view-switch.show-grid": "Show as grid", + "search.view-switch.show-list": "Show as list", + "sorting.dc.title.ASC": "Title Ascending", + "sorting.dc.title.DESC": "Title Descending", + "sorting.score.DESC": "Relevance", + "submission.edit.title": "Edit Submission", + "submission.general.cannot_submit": "You have not the privilege to make a new submission.", + "submission.general.deposit": "Deposit", + "submission.general.discard.confirm.cancel": "Cancel", + "submission.general.discard.confirm.info": "This operation can't be undone. Are you sure?", + "submission.general.discard.confirm.submit": "Yes, I'm sure", + "submission.general.discard.confirm.title": "Discard submission", + "submission.general.discard.submit": "Discard", + "submission.general.save": "Save", + "submission.general.save-later": "Save for later", + "submission.mydspace": {}, + "submission.sections.general.add-more": "Add more", + "submission.sections.general.collection": "Collection", + "submission.sections.general.deposit_error_notice": "There was an issue when submitting the item, please try again later.", + "submission.sections.general.deposit_success_notice": "Submission deposited successfully.", + "submission.sections.general.discard_error_notice": "There was an issue when discarding the item, please try again later.", + "submission.sections.general.discard_success_notice": "Submission discarded successfully.", + "submission.sections.general.metadata-extracted": "New metadata have been extracted and added to the {{sectionId}} section.", + "submission.sections.general.metadata-extracted-new-section": "New {{sectionId}} section has been added to submission.", + "submission.sections.general.no-collection": "No collection found", + "submission.sections.general.no-sections": "No options available", + "submission.sections.general.save_error_notice": "There was an issue when saving the item, please try again later.", + "submission.sections.general.save_success_notice": "Submission saved successfully.", + "submission.sections.general.search-collection": "Search for a collection", + "submission.sections.general.sections_not_valid": "There are incomplete sections.", + "submission.sections.submit.progressbar.cclicense": "Creative commons license", + "submission.sections.submit.progressbar.describe.recycle": "Recycle", + "submission.sections.submit.progressbar.describe.stepcustom": "Describe", + "submission.sections.submit.progressbar.describe.stepone": "Describe", + "submission.sections.submit.progressbar.describe.steptwo": "Describe", + "submission.sections.submit.progressbar.detect-duplicate": "Potential duplicates", + "submission.sections.submit.progressbar.license": "Deposit license", + "submission.sections.submit.progressbar.upload": "Upload files", + "submission.sections.upload.delete.confirm.cancel": "Cancel", + "submission.sections.upload.delete.confirm.info": "This operation can't be undone. Are you sure?", + "submission.sections.upload.delete.confirm.submit": "Yes, I'm sure", + "submission.sections.upload.delete.confirm.title": "Delete bitstream", + "submission.sections.upload.delete.submit": "Delete", + "submission.sections.upload.drop-message": "Drop files to attach them to the item", + "submission.sections.upload.form.access-condition-label": "Access condition type", + "submission.sections.upload.form.date-required": "Date is required.", + "submission.sections.upload.form.from-label": "Access grant from", + "submission.sections.upload.form.from-placeholder": "From", + "submission.sections.upload.form.group-label": "Group", + "submission.sections.upload.form.group-required": "Group is required.", + "submission.sections.upload.form.until-label": "Access grant until", + "submission.sections.upload.form.until-placeholder": "Until", + "submission.sections.upload.header.policy.default.nolist": "Uploaded files in the {{collectionName}} collection will be accessible according to the following group(s):", + "submission.sections.upload.header.policy.default.withlist": "Please note that uploaded files in the {{collectionName}} collection will be accessible, in addition to what is explicitly decided for the single file, with the following group(s):", + "submission.sections.upload.info": "Here you will find all the files currently in the item. You can update the fle metadata and access conditions or upload additional files just dragging & dropping them everywhere in the page", + "submission.sections.upload.no-entry": "No", + "submission.sections.upload.no-file-uploaded": "No file uploaded yet.", + "submission.sections.upload.save-metadata": "Save metadata", + "submission.sections.upload.undo": "Cancel", + "submission.sections.upload.upload-failed": "Upload failed", + "submission.sections.upload.upload-successful": "Upload successful", + "submission.submit.title": "Submission", + "submission.workflow.generic.delete": "Delete", + "submission.workflow.generic.delete-help": "If you would to discard this item, select \"Delete\". You will then be asked to confirm it.", + "submission.workflow.generic.edit": "Edit", + "submission.workflow.generic.edit-help": "Select this option to change the item's metadata.", + "submission.workflow.generic.view": "View", + "submission.workflow.generic.view-help": "Select this option to view the item's metadata.", + "submission.workflow.tasks.claimed.approve": "Approve", + "submission.workflow.tasks.claimed.approve_help": "If you have reviewed the item and it is suitable for inclusion in the collection, select \"Approve\".", + "submission.workflow.tasks.claimed.edit": "Edit", + "submission.workflow.tasks.claimed.edit_help": "Select this option to change the item's metadata.", + "submission.workflow.tasks.claimed.reject.reason.info": "Please enter your reason for rejecting the submission into the box below, indicating whether the submitter may fix a problem and resubmit.", + "submission.workflow.tasks.claimed.reject.reason.placeholder": "Describe the reason of reject", + "submission.workflow.tasks.claimed.reject.reason.submit": "Reject item", + "submission.workflow.tasks.claimed.reject.reason.title": "Reason", + "submission.workflow.tasks.claimed.reject.submit": "Reject", + "submission.workflow.tasks.claimed.reject_help": "If you have reviewed the item and found it is not suitable for inclusion in the collection, select \"Reject\". You will then be asked to enter a message indicating why the item is unsuitable, and whether the submitter should change something and resubmit.", + "submission.workflow.tasks.claimed.return": "Return to pool", + "submission.workflow.tasks.claimed.return_help": "Return the task to the pool so that another user may perform the task.", + "submission.workflow.tasks.generic.error": "Error occurred during operation...", + "submission.workflow.tasks.generic.processing": "Processing...", + "submission.workflow.tasks.generic.submitter": "Submitter", + "submission.workflow.tasks.generic.success": "Operation successful", + "submission.workflow.tasks.pool.claim": "Claim", + "submission.workflow.tasks.pool.claim_help": "Assign this task to yourself.", + "submission.workflow.tasks.pool.hide-detail": "Hide detail", + "submission.workflow.tasks.pool.show-detail": "Show detail", "title": "DSpace", - "404": { - "help": "We can't find the page you're looking for. The page may have been moved or deleted. You can use the button below to get back to the home page. ", - "page-not-found": "page not found", - "link": { - "home-page": "Take me to the home page" - } - }, - "home": { - "title": "DSpace Angular :: Home", - "description": "", - "top-level-communities": { - "head": "Communities in DSpace", - "help": "Select a community to browse its collections." - } - }, - "mydspace": { - "title": "MyDSpace", - "description": "", - "new-submission": "New submission", - "results": { - "head": "Your submissions", - "no-results": "There were no items to show", - "no-title": "No title", - "no-authors": "No Authors", - "no-date": "No Date", - "no-abstract": "No Abstract", - "no-files": "No Files", - "no-uri": "No Uri", - "no-collections": "No Collections" - }, - "messages": { - "title": "Messages", - "to": "To", - "hide-msg": "Hide message", - "show-msg": "Show message", - "no-messages": "No messages yet.", - "no-content": "No content.", - "send-btn": "Send", - "subject-placeholder": "Subject...", - "description-placeholder": "Insert your message here...", - "mark-as-read": "Mark as read", - "mark-as-unread": "Mark as unread", - "submitter-help": "Select this option to send a message to controller.", - "controller-help": "Select this option to send a message to item's submitter." - }, - "show": { - "workspace": "Your Submissions", - "workflow": "All tasks" - }, - "status": { - "workflow": "Workflow", - "validation": "Validation", - "waiting-for-controller": "Waiting for controller", - "workspace": "Workspace", - "archived": "Archived" - }, - "view-btn": "View", - "general": { - "text-here": "HERE" - }, - "upload": { - "upload-successful": "New workspace item created. Click {{here}} for edit it.", - "upload-multiple-successful": "{{qty}} new workspace items created.", - "upload-failed": "Error creating new workspace. Please verify the content uploaded before retry." - } - }, - "search": { - "title": "DSpace Angular :: Search", - "description": "", - "form": { - "search": "Search", - "search_dspace": "Search DSpace", - "search_mydspace": "Search MyDSpace" - }, - "results": { - "head": "Search Results", - "no-results": "Your search returned no results. Having trouble finding what you're looking for? Try putting", - "no-results-link": "quotes around it" - }, - "sidebar": { - "close": "Back to results", - "open": "Search Tools", - "results": "results", - "filters": { - "title": "Filters" - }, - "settings": { - "title": "Settings", - "sort-by": "Sort By", - "rpp": "Results per page" - } - }, - "switch-configuration": { - "title":"Show" - }, - "view-switch": { - "show-list": "Show as list", - "show-grid": "Show as grid", - "show-detail": "Show detail" - }, - "filters": { - "head": "Filters", - "reset": "Reset filters", - "applied": { - "f.author": "Author", - "f.dateIssued.min": "Start date", - "f.dateIssued.max": "End date", - "f.subject": "Subject", - "f.has_content_in_original_bundle": "Has files", - "f.entityType": "Item Type", - "f.namedresourcetype": "Status", - "f.dateSubmitted": "Date submitted", - "f.itemtype": "Type", - "f.submitter": "Submitter" - }, - "filter": { - "show-more": "Show more", - "show-less": "Collapse", - "author": { - "placeholder": "Author name", - "head": "Author" - }, - "scope": { - "placeholder": "Scope filter", - "head": "Scope" - }, - "subject": { - "placeholder": "Subject", - "head": "Subject" - }, - "dateIssued": { - "max": { - "placeholder": "Minimum Date" - }, - "min": { - "placeholder": "Maximum Date" - }, - "head": "Date" - }, - "has_content_in_original_bundle": { - "head": "Has files" - }, - "entityType": { - "placeholder": "Item Type", - "head": "Item Type" - }, - "namedresourcetype": { - "placeholder": "Status", - "head": "Status" - }, - "dateSubmitted": { - "placeholder": "Date submitted", - "head": "Date submitted" - }, - "itemtype": { - "placeholder": "Type", - "head": "Type" - }, - "submitter": { - "placeholder": "Submitter", - "head": "Submitter" - }, - "objectpeople": { - "placeholder": "People", - "head": "People" - }, - "jobTitle": { - "placeholder": "Job Title", - "head": "Job Title" - }, - "knowsLanguage": { - "placeholder": "Known language", - "head": "Known language" - }, - "birthDate": { - "placeholder": "Birth Date", - "head": "Birth Date" - }, - "creativeWorkPublisher": { - "placeholder": "Publisher", - "head": "Publisher" - }, - "creativeWorkEditor": { - "placeholder": "Editor", - "head": "Editor" - }, - "creativeWorkKeywords": { - "placeholder": "Subject", - "head": "Subject" - }, - "creativeDatePublished": { - "placeholder": "Date Published", - "head": "Date Published" - }, - "organizationAddressCountry": { - "placeholder": "Country", - "head": "Country" - }, - "organizationAddressLocality": { - "placeholder": "City", - "head": "City" - }, - "organizationFoundingDate": { - "placeholder": "Date Founded", - "head": "Date Founded" - } - } - } - }, - "browse": { - "title": "Browsing {{ collection }} by {{ field }} {{ value }}", - "startsWith": { - "jump": "Jump to a point in the index:", - "choose_year": "(Choose year)", - "choose_start": "(Choose start)", - "type_date": "Or type in a date (year-month):", - "type_text": "Or enter first few letters:", - "months": { - "none": "(Choose month)", - "january": "January", - "february": "February", - "march": "March", - "april": "April", - "may": "May", - "june": "June", - "july": "July", - "august": "August", - "september": "September", - "october": "October", - "november": "November", - "december": "December" - }, - "submit": "Go" - }, - "metadata": { - "title": "Title", - "author": "Author", - "subject": "Subject", - "dateissued": "Issue Date" - }, - "comcol": { - "head": "Browse", - "by": { - "title": "By Title", - "dateissued": "By Issue Date", - "author": "By Author", - "subject": "By Subject" - } - }, - "empty": "No items to show." - }, - "admin": { - "registries": { - "metadata": { - "title": "DSpace Angular :: Metadata Registry", - "head": "Metadata Registry", - "description": "The metadata registry maintains a list of all metadata fields available in the repository. These fields may be divided amongst multiple schemas. However, DSpace requires the qualified Dublin Core schema.", - "form": { - "create": "Create metadata schema", - "edit": "Edit metadata schema", - "namespace": "Namespace", - "name": "Name" - }, - "schemas": { - "table": { - "id": "ID", - "namespace": "Namespace", - "name": "Name", - "delete": "Delete selected" - }, - "no-items": "No metadata schemas to show." - } - }, - "schema": { - "title": "DSpace Angular :: Metadata Schema Registry", - "head": "Metadata Schema", - "description": "This is the metadata schema for \"{{namespace}}\".", - "return": "Return", - "form": { - "create": "Create metadata field", - "edit": "Edit metadata field", - "element": "Element", - "qualifier": "Qualifier", - "scopenote": "Scope Note" - }, - "fields": { - "head": "Schema metadata fields", - "table": { - "field": "Field", - "scopenote": "Scope Note", - "delete": "Delete selected" - }, - "no-items": "No metadata fields to show." - }, - "notification": { - "success": "Success", - "failure": "Error", - "created": "Successfully created metadata schema \"{{prefix}}\"", - "edited": "Successfully edited metadata schema \"{{prefix}}\"", - "deleted": { - "success": "Successfully deleted {{amount}} metadata schemas", - "failure": "Failed to delete {{amount}} metadata schemas" - }, - "field": { - "created": "Successfully created metadata field \"{{field}}\"", - "edited": "Successfully edited metadata field \"{{field}}\"", - "deleted": { - "success": "Successfully deleted {{amount}} metadata fields", - "failure": "Failed to delete {{amount}} metadata fields" - } - } - } - }, - "bitstream-formats": { - "title": "DSpace Angular :: Bitstream Format Registry", - "head": "Bitstream Format Registry", - "description": "This list of bitstream formats provides information about known formats and their support level.", - "create": { - "new": "Add a new bitstream format", - "head": "Create Bitstream format", - "success" : { - "head": "Success", - "content": "The new bitstream format was successfully created." - }, - "failure" : { - "head": "Failure", - "content": "An error occurred while creating the new bitstream format." - } - }, - "table": { - "name": "Name", - "mimetype": "MIME Type", - "supportLevel": { - "head": "Support Level", - "UNKNOWN": "Unknown", - "KNOWN": "Known", - "SUPPORTED": "Supported" - }, - "internal": "internal", - "delete": "Delete selected", - "return": "Return", - "deselect-all": "Deselect all" - }, - "no-items": "No bitstream formats to show.", - "edit": { - "head": "Bitstream format: {{ format }}", - "shortDescription": { - "label": "Name", - "hint": "A unique name for this format, (e.g. Microsoft Word XP or Microsoft Word 2000)" - }, - "mimetype": { - "label": "MIME Type", - "hint": "The MIME type associated with this format, does not have to be unique." - }, - "description": { - "label": "Description", - "hint": "" - }, - "supportLevel": { - "label": "Support level", - "hint": "The level of support your institution pledges for this format." - }, - "internal": { - "label": "Internal", - "hint": "Formats marked as internal are are hidden from the user, and used for administrative purposes." - }, - "extensions": { - "label": "File extensions", - "hint": "Extensions are file extensions that are used to automatically identify the format of uploaded files. You can enter several extensions for each format." - }, - "success" : { - "head": "Success", - "content": "The bitstream format was successfully edited." - }, - "failure" : { - "head": "Failure", - "content": "An error occurred while editing the bitstream format." - } - }, - "delete": { - "success":{ - "head": "Success", - "amount": "The following amount of bitstream formats have been successfully deleted: {{ amount }}" - }, - "failure": { - "head": "Failure", - "amount": "The following amount of bitstream formats could not be deleted: {{ amount }} " - } - } - } - } - }, - "menu": { - "header": { - "admin": "Admin", - "image": { - "logo": "Repository logo" - } - }, - "section": { - "pin": "Pin sidebar", - "unpin": "Unpin sidebar", - "new": "New", - "new_community": "Community", - "new_collection": "Collection", - "new_item": "Item", - "new_item_version": "Item Version", - "edit": "Edit", - "edit_community": "Community", - "edit_collection": "Collection", - "edit_item": "Item", - "import": "Import", - "import_metadata": "Metadata", - "import_batch": "Batch Import (ZIP)", - "export": "Export", - "export_community": "Community", - "export_collection": "Collection", - "export_item": "Item", - "export_metadata": "Metadata", - "access_control": "Access Control", - "access_control_people": "People", - "access_control_groups": "Groups", - "access_control_authorizations": "Authorizations", - "find": "Find", - "find_items": "Items", - "find_withdrawn_items": "Withdrawn Items", - "find_private_items": "Private Items", - "registries": "Registries", - "registries_metadata": "Metadata", - "registries_format": "Format", - "curation_task": "Curation Task", - "statistics_task": "Statistics Task", - "control_panel": "Control Panel", - "browse_global": "All of DSpace", - "browse_global_communities_and_collections": "Communities & Collections", - "browse_global_by_dateissued": "By Issue Date", - "browse_global_by_author": "By Author", - "browse_global_by_title": "By Title", - "browse_global_by_subject": "By Subject", - "statistics": "Statistics", - "browse_community": "This Community", - "browse_community_by_issue_date": "By Issue Date", - "browse_community_by_author": "By Author", - "browse_community_by_title": "By Title", - "icon": { - "pin": "Pin sidebar", - "unpin": "Unpin sidebar", - "new": "New menu section", - "edit": "Edit menu section", - "import": "Import menu section", - "export": "Export menu section", - "access_control": "Access Control menu section", - "find": "Find menu section", - "registries": "Registries menu section", - "curation_task": "Curation Task menu section", - "statistics_task": "Statistics Task menu section", - "control_panel": "Control Panel menu section" - }, - "toggle": { - "new": "Toggle New section", - "edit": "Toggle Edit section", - "import": "Toggle Import section", - "export": "Toggle Export section", - "access_control": "Toggle Access Control section", - "find": "Toggle Find section", - "registries": "Toggle Registries section", - "curation_task": "Toggle Curation Task section", - "statistics_task": "Toggle Statistics Task section", - "control_panel": "Toggle Control Panel section" - } - } - }, - "loading": { - "default": "Loading...", - "top-level-communities": "Loading top-level communities...", - "community": "Loading community...", - "collection": "Loading collection...", - "sub-collections": "Loading sub-collections...", - "sub-communities": "Loading sub-communities...", - "recent-submissions": "Loading recent submissions...", - "item": "Loading item...", - "objects": "Loading...", - "search-results": "Loading search results...", - "mydspace-results": "Loading items...", - "browse-by": "Loading items...", - "browse-by-page": "Loading page..." - }, - "error": { - "default": "Error", - "top-level-communities": "Error fetching top-level communities", - "community": "Error fetching community", - "collection": "Error fetching collection", - "sub-collections": "Error fetching sub-collections", - "sub-communities": "Error fetching sub-communities", - "recent-submissions": "Error fetching recent submissions", - "item": "Error fetching item", - "objects": "Error fetching objects", - "search-results": "Error fetching search results", - "browse-by": "Error fetching items", - "validation": { - "pattern": "This input is restricted by the current pattern: {{ pattern }}.", - "license": { - "notgranted": "You must grant this license to complete your submission. If you are unable to grant this license at this time you may save your work and return later or remove the submission." - } - }, - "submission": { - "sections": { - "init-form-error": "An error occurred during section initialize, please check your input-form configuration. Details are below :

" - } - } - }, - "form": { - "submit": "Submit", - "cancel": "Cancel", - "search": "Search", - "search-help": "Click here to looking for an existing correspondence", - "remove": "Remove", - "clear": "Clear", - "clear-help": "Click here to remove the selected value", - "edit": "Edit", - "edit-help": "Click here to edit the selected value", - "save": "Save", - "save-help": "Save changes", - "first-name": "First name", - "last-name": "Last name", - "loading": "Loading...", - "no-results": "No results found", - "no-value": "No value entered", - "group-collapse": "Collapse", - "group-expand": "Expand", - "group-collapse-help": "Click here to collapse", - "group-expand-help": "Click here to expand and add more elements", - "other-information": { - } - }, - "login": { - "title": "Login", - "form": { - "header": "Please log in to DSpace", - "email": "Email address", - "forgot-password": "Have you forgotten your password?", - "new-user": "New user? Click here to register.", - "password": "Password", - "submit": "Log in" - } - }, - "logout": { - "title": "Logout", - "form": { - "header": "Log out from DSpace", - "submit": "Log out" - } - }, - "auth": { - "messages": { - "expired": "Your session has expired. Please log in again." - }, - "errors": { - "invalid-user": "Invalid email address or password." - } - }, - "chips": { - "remove": "Remove chip" - }, - "dso-selector": { - "create": { - "community": { - "head": "New community", - "sub-level": "Create a new community in", - "top-level": "Create a new top-level community" - }, - "collection": { - "head": "New collection" - }, - "item": { - "head": "New item" - } - }, - "edit": { - "community": { - "head": "Edit community" - }, - "collection": { - "head": "Edit collection" - }, - "item": { - "head": "Edit item" - } - }, - "placeholder": "Search for a {{ type }}", - "no-results": "No {{ type }} found" - }, - "submission": { - "general":{ - "cannot_submit": "You have not the privilege to make a new submission.", - "deposit": "Deposit", - "discard": { - "submit": "Discard", - "confirm": { - "cancel": "Cancel", - "submit": "Yes, I'm sure", - "title": "Discard submission", - "info": "This operation can't be undone. Are you sure?" - } - }, - "save": "Save", - "save-later": "Save for later" - }, - "submit": { - "title": "Submission" - }, - "edit": { - "title": "Edit Submission" - }, - "mydspace": { - - }, - "sections": { - - "general": { - "add-more": "Add more", - "no-sections": "No options available", - "sections_not_valid": "There are incomplete sections.", - "collection": "Collection", - "no-collection": "No collection found", - "search-collection": "Search for a collection", - "save_error_notice": "There was an issue when saving the item, please try again later.", - "deposit_success_notice": "Submission deposited successfully.", - "deposit_error_notice": "There was an issue when submitting the item, please try again later.", - "discard_success_notice": "Submission discarded successfully.", - "discard_error_notice": "There was an issue when discarding the item, please try again later.", - "save_success_notice": "Submission saved successfully.", - "metadata-extracted": "New metadata have been extracted and added to the {{sectionId}} section.", - "metadata-extracted-new-section": "New {{sectionId}} section has been added to submission." - }, - "submit.progressbar.describe.stepone": "Describe", - "submit.progressbar.describe.steptwo": "Describe", - "submit.progressbar.describe.stepcustom": "Describe", - "submit.progressbar.describe.recycle": "Recycle", - "submit.progressbar.upload": "Upload files", - "submit.progressbar.license": "Deposit license", - "submit.progressbar.cclicense": "Creative commons license", - "submit.progressbar.detect-duplicate": "Potential duplicates", - - "upload": { - "no-entry": "No", - "no-file-uploaded": "No file uploaded yet.", - "info": "Here you will find all the files currently in the item. You can update the fle metadata and access conditions or upload additional files just dragging & dropping them everywhere in the page", - "drop-message": "Drop files to attach them to the item", - "upload-successful": "Upload successful", - "upload-failed": "Upload failed", - "header.policy.default.nolist": "Uploaded files in the {{collectionName}} collection will be accessible according to the following group(s):", - "header.policy.default.withlist": "Please note that uploaded files in the {{collectionName}} collection will be accessible, in addition to what is explicitly decided for the single file, with the following group(s):", - "form": { - "access-condition-label": "Access condition type", - "from-label": "Access grant from", - "from-placeholder": "From", - "until-label": "Access grant until", - "until-placeholder": "Until", - "group-label": "Group", - "group-required": "Group is required.", - "date-required": "Date is required." - }, - "save-metadata": "Save metadata", - "undo": "Cancel", - "delete": { - "submit": "Delete", - "confirm": { - "cancel": "Cancel", - "submit": "Yes, I'm sure", - "title": "Delete bitstream", - "info": "This operation can't be undone. Are you sure?" - } - } - } - }, - "workflow": { - "generic": { - "delete": "Delete", - "delete-help": "If you would to discard this item, select \"Delete\". You will then be asked to confirm it.", - "edit": "Edit", - "edit-help": "Select this option to change the item's metadata.", - "view": "View", - "view-help": "Select this option to view the item's metadata." - }, - "tasks": { - "generic": { - "processing": "Processing...", - "success": "Operation successful", - "error": "Error occurred during operation...", - "submitter": "Submitter" - }, - "claimed": { - "approve": "Approve", - "approve_help": "If you have reviewed the item and it is suitable for inclusion in the collection, select \"Approve\".", - "edit": "Edit", - "edit_help": "Select this option to change the item's metadata.", - "reject": { - "submit": "Reject", - "reason": { - "submit": "Reject item", - "title": "Reason", - "info": "Please enter your reason for rejecting the submission into the box below, indicating whether the submitter may fix a problem and resubmit.", - "placeholder": "Describe the reason of reject" - } - }, - "reject_help": "If you have reviewed the item and found it is not suitable for inclusion in the collection, select \"Reject\". You will then be asked to enter a message indicating why the item is unsuitable, and whether the submitter should change something and resubmit.", - "return": "Return to pool", - "return_help": "Return the task to the pool so that another user may perform the task." - - }, - "pool": { - "claim": "Claim", - "claim_help": "Assign this task to yourself.", - "show-detail": "Show detail", - "hide-detail": "Hide detail" - } - } - } - }, - "uploader": { - "drag-message": "Drag & Drop your files here", - "or": ", or", - "browse": "browse", - "queue-lenght": "Queue length", - "processing": "Processing" - } -} + "uploader.browse": "browse", + "uploader.drag-message": "Drag & Drop your files here", + "uploader.or": ", or", + "uploader.processing": "Processing" + "uploader.queue-lenght": "Queue length" +} \ No newline at end of file From 863189b2e56be071dda527d80bbb83ab5c43eb1e Mon Sep 17 00:00:00 2001 From: Yana De Pauw Date: Wed, 14 Aug 2019 11:48:51 +0200 Subject: [PATCH 11/18] fix missing , in messages file --- resources/i18n/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/i18n/en.json b/resources/i18n/en.json index c5b542c424..c63e52e4b3 100644 --- a/resources/i18n/en.json +++ b/resources/i18n/en.json @@ -687,6 +687,6 @@ "uploader.browse": "browse", "uploader.drag-message": "Drag & Drop your files here", "uploader.or": ", or", - "uploader.processing": "Processing" + "uploader.processing": "Processing", "uploader.queue-lenght": "Queue length" } \ No newline at end of file From 737792a1df964ad1e40dc9f5678924af2c532107 Mon Sep 17 00:00:00 2001 From: Kristof De Langhe Date: Wed, 14 Aug 2019 15:05:25 +0200 Subject: [PATCH 12/18] 62741: Moved entity mantis files to correct location --- src/app/+item-page/item-page.module.ts | 3 ++- .../item-pages}/journal-issue/journal-issue.component.html | 0 .../item-pages}/journal-issue/journal-issue.component.scss | 2 +- .../item-pages}/journal-volume/journal-volume.component.html | 0 .../item-pages}/journal-volume/journal-volume.component.scss | 2 +- .../item-pages}/journal/journal.component.html | 0 .../item-pages}/journal/journal.component.scss | 2 +- .../item-pages}/orgunit/orgunit.component.html | 0 .../item-pages}/orgunit/orgunit.component.scss | 2 +- .../research-entities/item-pages}/person/person.component.html | 0 .../research-entities/item-pages}/person/person.component.scss | 2 +- .../item-pages}/project/project.component.html | 0 .../item-pages}/project/project.component.scss | 2 +- 13 files changed, 8 insertions(+), 7 deletions(-) rename themes/mantis/app/{+item-page/simple/item-types => entity-groups/journal-entities/item-pages}/journal-issue/journal-issue.component.html (100%) rename themes/mantis/app/{+item-page/simple/item-types => entity-groups/journal-entities/item-pages}/journal-issue/journal-issue.component.scss (85%) rename themes/mantis/app/{+item-page/simple/item-types => entity-groups/journal-entities/item-pages}/journal-volume/journal-volume.component.html (100%) rename themes/mantis/app/{+item-page/simple/item-types => entity-groups/journal-entities/item-pages}/journal-volume/journal-volume.component.scss (85%) rename themes/mantis/app/{+item-page/simple/item-types => entity-groups/journal-entities/item-pages}/journal/journal.component.html (100%) rename themes/mantis/app/{+item-page/simple/item-types => entity-groups/journal-entities/item-pages}/journal/journal.component.scss (89%) rename themes/mantis/app/{+item-page/simple/item-types => entity-groups/research-entities/item-pages}/orgunit/orgunit.component.html (100%) rename themes/mantis/app/{+item-page/simple/item-types => entity-groups/research-entities/item-pages}/orgunit/orgunit.component.scss (86%) rename themes/mantis/app/{+item-page/simple/item-types => entity-groups/research-entities/item-pages}/person/person.component.html (100%) rename themes/mantis/app/{+item-page/simple/item-types => entity-groups/research-entities/item-pages}/person/person.component.scss (89%) rename themes/mantis/app/{+item-page/simple/item-types => entity-groups/research-entities/item-pages}/project/project.component.html (100%) rename themes/mantis/app/{+item-page/simple/item-types => entity-groups/research-entities/item-pages}/project/project.component.scss (86%) diff --git a/src/app/+item-page/item-page.module.ts b/src/app/+item-page/item-page.module.ts index 6743028b6c..f510ccf19b 100644 --- a/src/app/+item-page/item-page.module.ts +++ b/src/app/+item-page/item-page.module.ts @@ -62,7 +62,8 @@ import { MetadataFieldWrapperComponent } from './field-components/metadata-field GenericItemPageFieldComponent, RelatedEntitiesSearchComponent, RelatedItemsComponent, - MetadataRepresentationListComponent + MetadataRepresentationListComponent, + ItemPageTitleFieldComponent ], entryComponents: [ PublicationComponent diff --git a/themes/mantis/app/+item-page/simple/item-types/journal-issue/journal-issue.component.html b/themes/mantis/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.html similarity index 100% rename from themes/mantis/app/+item-page/simple/item-types/journal-issue/journal-issue.component.html rename to themes/mantis/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.html diff --git a/themes/mantis/app/+item-page/simple/item-types/journal-issue/journal-issue.component.scss b/themes/mantis/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.scss similarity index 85% rename from themes/mantis/app/+item-page/simple/item-types/journal-issue/journal-issue.component.scss rename to themes/mantis/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.scss index 7ce24acc15..3caa55f533 100644 --- a/themes/mantis/app/+item-page/simple/item-types/journal-issue/journal-issue.component.scss +++ b/themes/mantis/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.scss @@ -1,4 +1,4 @@ -@import 'src/app/+item-page/simple/item-types/journal-issue/journal-issue.component.scss'; +@import 'src/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.scss'; :host { > * { diff --git a/themes/mantis/app/+item-page/simple/item-types/journal-volume/journal-volume.component.html b/themes/mantis/app/entity-groups/journal-entities/item-pages/journal-volume/journal-volume.component.html similarity index 100% rename from themes/mantis/app/+item-page/simple/item-types/journal-volume/journal-volume.component.html rename to themes/mantis/app/entity-groups/journal-entities/item-pages/journal-volume/journal-volume.component.html diff --git a/themes/mantis/app/+item-page/simple/item-types/journal-volume/journal-volume.component.scss b/themes/mantis/app/entity-groups/journal-entities/item-pages/journal-volume/journal-volume.component.scss similarity index 85% rename from themes/mantis/app/+item-page/simple/item-types/journal-volume/journal-volume.component.scss rename to themes/mantis/app/entity-groups/journal-entities/item-pages/journal-volume/journal-volume.component.scss index ab1bc700b1..5c2534b318 100644 --- a/themes/mantis/app/+item-page/simple/item-types/journal-volume/journal-volume.component.scss +++ b/themes/mantis/app/entity-groups/journal-entities/item-pages/journal-volume/journal-volume.component.scss @@ -1,4 +1,4 @@ -@import 'src/app/+item-page/simple/item-types/journal-volume/journal-volume.component.scss'; +@import 'src/app/entity-groups/journal-entities/item-pages/journal-volume/journal-volume.component.scss'; :host { > * { diff --git a/themes/mantis/app/+item-page/simple/item-types/journal/journal.component.html b/themes/mantis/app/entity-groups/journal-entities/item-pages/journal/journal.component.html similarity index 100% rename from themes/mantis/app/+item-page/simple/item-types/journal/journal.component.html rename to themes/mantis/app/entity-groups/journal-entities/item-pages/journal/journal.component.html diff --git a/themes/mantis/app/+item-page/simple/item-types/journal/journal.component.scss b/themes/mantis/app/entity-groups/journal-entities/item-pages/journal/journal.component.scss similarity index 89% rename from themes/mantis/app/+item-page/simple/item-types/journal/journal.component.scss rename to themes/mantis/app/entity-groups/journal-entities/item-pages/journal/journal.component.scss index 6d97cbf5c3..5c0d1c44b8 100644 --- a/themes/mantis/app/+item-page/simple/item-types/journal/journal.component.scss +++ b/themes/mantis/app/entity-groups/journal-entities/item-pages/journal/journal.component.scss @@ -1,4 +1,4 @@ -@import 'src/app/+item-page/simple/item-types/journal/journal.component.scss'; +@import 'src/app/entity-groups/journal-entities/item-pages/journal/journal.component.scss'; :host { > * { diff --git a/themes/mantis/app/+item-page/simple/item-types/orgunit/orgunit.component.html b/themes/mantis/app/entity-groups/research-entities/item-pages/orgunit/orgunit.component.html similarity index 100% rename from themes/mantis/app/+item-page/simple/item-types/orgunit/orgunit.component.html rename to themes/mantis/app/entity-groups/research-entities/item-pages/orgunit/orgunit.component.html diff --git a/themes/mantis/app/+item-page/simple/item-types/orgunit/orgunit.component.scss b/themes/mantis/app/entity-groups/research-entities/item-pages/orgunit/orgunit.component.scss similarity index 86% rename from themes/mantis/app/+item-page/simple/item-types/orgunit/orgunit.component.scss rename to themes/mantis/app/entity-groups/research-entities/item-pages/orgunit/orgunit.component.scss index 5b2bdb0382..54651aede0 100644 --- a/themes/mantis/app/+item-page/simple/item-types/orgunit/orgunit.component.scss +++ b/themes/mantis/app/entity-groups/research-entities/item-pages/orgunit/orgunit.component.scss @@ -1,4 +1,4 @@ -@import 'src/app/+item-page/simple/item-types/orgunit/orgunit.component.scss'; +@import 'src/app/entity-groups/research-entities/item-pages/orgunit/orgunit.component.scss'; :host { > * { diff --git a/themes/mantis/app/+item-page/simple/item-types/person/person.component.html b/themes/mantis/app/entity-groups/research-entities/item-pages/person/person.component.html similarity index 100% rename from themes/mantis/app/+item-page/simple/item-types/person/person.component.html rename to themes/mantis/app/entity-groups/research-entities/item-pages/person/person.component.html diff --git a/themes/mantis/app/+item-page/simple/item-types/person/person.component.scss b/themes/mantis/app/entity-groups/research-entities/item-pages/person/person.component.scss similarity index 89% rename from themes/mantis/app/+item-page/simple/item-types/person/person.component.scss rename to themes/mantis/app/entity-groups/research-entities/item-pages/person/person.component.scss index 3b454aab0e..48571b05b2 100644 --- a/themes/mantis/app/+item-page/simple/item-types/person/person.component.scss +++ b/themes/mantis/app/entity-groups/research-entities/item-pages/person/person.component.scss @@ -1,4 +1,4 @@ -@import 'src/app/+item-page/simple/item-types/person/person.component.scss'; +@import 'src/app/entity-groups/research-entities/item-pages/person/person.component.scss'; :host { > * { diff --git a/themes/mantis/app/+item-page/simple/item-types/project/project.component.html b/themes/mantis/app/entity-groups/research-entities/item-pages/project/project.component.html similarity index 100% rename from themes/mantis/app/+item-page/simple/item-types/project/project.component.html rename to themes/mantis/app/entity-groups/research-entities/item-pages/project/project.component.html diff --git a/themes/mantis/app/+item-page/simple/item-types/project/project.component.scss b/themes/mantis/app/entity-groups/research-entities/item-pages/project/project.component.scss similarity index 86% rename from themes/mantis/app/+item-page/simple/item-types/project/project.component.scss rename to themes/mantis/app/entity-groups/research-entities/item-pages/project/project.component.scss index 9c9aa9c629..d2707d30cc 100644 --- a/themes/mantis/app/+item-page/simple/item-types/project/project.component.scss +++ b/themes/mantis/app/entity-groups/research-entities/item-pages/project/project.component.scss @@ -1,4 +1,4 @@ -@import 'src/app/+item-page/simple/item-types/project/project.component.scss'; +@import 'src/app/entity-groups/research-entities/item-pages/project/project.component.scss'; :host { > * { From 1d05680126630c79c7328a6fffe7d7cffc719f3b Mon Sep 17 00:00:00 2001 From: Yana De Pauw Date: Fri, 16 Aug 2019 13:00:04 +0200 Subject: [PATCH 13/18] Implement feedback Change padding into margin Change 'Create link' to a button Add placeholder to extension field Fix pagination --- resources/i18n/en.json | 1 + .../add-bitstream-format.component.html | 4 ++-- .../bitstream-formats/bitstream-formats.component.html | 4 ++-- .../bitstream-formats/bitstream-formats.component.ts | 10 ++++++---- .../edit-bitstream-format.component.html | 4 ++-- .../format-form/format-form.component.ts | 5 +++-- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/resources/i18n/en.json b/resources/i18n/en.json index c63e52e4b3..9a4e49d433 100644 --- a/resources/i18n/en.json +++ b/resources/i18n/en.json @@ -17,6 +17,7 @@ "admin.registries.bitstream-formats.edit.description.label": "Description", "admin.registries.bitstream-formats.edit.extensions.hint": "Extensions are file extensions that are used to automatically identify the format of uploaded files. You can enter several extensions for each format.", "admin.registries.bitstream-formats.edit.extensions.label": "File extensions", + "admin.registries.bitstream-formats.edit.extensions.placeholder": "Enter a file extenstion without the dot", "admin.registries.bitstream-formats.edit.failure.content": "An error occurred while editing the bitstream format.", "admin.registries.bitstream-formats.edit.failure.head": "Failure", "admin.registries.bitstream-formats.edit.head": "Bitstream format: {{ format }}", diff --git a/src/app/+admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.html b/src/app/+admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.html index c05f3badeb..2b65b369b2 100644 --- a/src/app/+admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.html +++ b/src/app/+admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.html @@ -1,8 +1,8 @@
-
+

{{ 'admin.registries.bitstream-formats.create.new' | translate }}

+ class="border-bottom mb-2">{{ 'admin.registries.bitstream-formats.create.new' | translate }} diff --git a/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.html b/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.html index ec1993c0f4..7dd325338a 100644 --- a/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.html +++ b/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.html @@ -2,10 +2,10 @@
- +

{{'admin.registries.bitstream-formats.description' | translate}}

-

{{'admin.registries.bitstream-formats.create.new' | translate}}

+

{{'admin.registries.bitstream-formats.create.new' | translate}}

-
+

{{'admin.registries.bitstream-formats.edit.head' | translate:{format: (bitstreamFormatRD$ | async)?.payload.shortDescription} }}

+ class="border-bottom mb-2">{{'admin.registries.bitstream-formats.edit.head' | translate:{format: (bitstreamFormatRD$ | async)?.payload.shortDescription} }} diff --git a/src/app/+admin/admin-registries/bitstream-formats/format-form/format-form.component.ts b/src/app/+admin/admin-registries/bitstream-formats/format-form/format-form.component.ts index febf56bc9f..505ccccd91 100644 --- a/src/app/+admin/admin-registries/bitstream-formats/format-form/format-form.component.ts +++ b/src/app/+admin/admin-registries/bitstream-formats/format-form/format-form.component.ts @@ -4,7 +4,7 @@ import { BitstreamFormatSupportLevel } from '../../../../core/shared/bitstream-f import { DynamicCheckboxModel, DynamicFormArrayModel, - DynamicFormControlLayout, + DynamicFormControlLayout, DynamicFormControlLayoutConfig, DynamicFormControlModel, DynamicFormService, DynamicInputModel, @@ -49,7 +49,7 @@ export class FormatFormComponent implements OnInit { arrayElementLayout: DynamicFormControlLayout = { grid: { group: 'form-row', - } + }, }; /** @@ -114,6 +114,7 @@ export class FormatFormComponent implements OnInit { groupFactory: () => [ new DynamicInputModel({ id: 'extension', + placeholder: 'admin.registries.bitstream-formats.edit.extensions.placeholder', }, this.arrayInputElementLayout) ] }, this.arrayElementLayout), From 88c8fddbceea980dcb690e1d4158b7db9e0bd02e Mon Sep 17 00:00:00 2001 From: Yana De Pauw Date: Mon, 19 Aug 2019 17:25:41 +0200 Subject: [PATCH 14/18] Fix to message, margin and deletion page reset --- resources/i18n/en.json | 4 ++-- .../bitstream-formats/bitstream-formats.component.html | 2 +- .../bitstream-formats/bitstream-formats.component.ts | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/resources/i18n/en.json b/resources/i18n/en.json index 9a4e49d433..f3236251cf 100644 --- a/resources/i18n/en.json +++ b/resources/i18n/en.json @@ -8,9 +8,9 @@ "admin.registries.bitstream-formats.create.new": "Add a new bitstream format", "admin.registries.bitstream-formats.create.success.content": "The new bitstream format was successfully created.", "admin.registries.bitstream-formats.create.success.head": "Success", - "admin.registries.bitstream-formats.delete.failure.amount": "The following amount of bitstream formats could not be deleted: {{ amount }} ", + "admin.registries.bitstream-formats.delete.failure.amount": "Failed to remove {{ amount }} format(s)", "admin.registries.bitstream-formats.delete.failure.head": "Failure", - "admin.registries.bitstream-formats.delete.success.amount": "The following amount of bitstream formats have been successfully deleted: {{ amount }}", + "admin.registries.bitstream-formats.delete.success.amount": "Successfully removed {{ amount }} format(s)", "admin.registries.bitstream-formats.delete.success.head": "Success", "admin.registries.bitstream-formats.description": "This list of bitstream formats provides information about known formats and their support level.", "admin.registries.bitstream-formats.edit.description.hint": "", diff --git a/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.html b/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.html index 7dd325338a..e5cf7cf5ec 100644 --- a/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.html +++ b/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.html @@ -2,7 +2,7 @@
- +

{{'admin.registries.bitstream-formats.description' | translate}}

{{'admin.registries.bitstream-formats.create.new' | translate}}

diff --git a/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.ts b/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.ts index 737fb59c77..cb7aa1ef91 100644 --- a/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.ts +++ b/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.ts @@ -78,8 +78,11 @@ export class BitstreamFormatsComponent implements OnInit { } this.deselectAll(); - this.pageState.next('update-on-delete'); - }); + + this.router.navigate([], { + queryParams: Object.assign({}, { page: 1 }), + queryParamsHandling: 'merge' + }); }); } ); } From 064552188e0f9a9eef70067e037a06c09bd2af80 Mon Sep 17 00:00:00 2001 From: lhenze Date: Sat, 24 Aug 2019 13:47:20 -0400 Subject: [PATCH 15/18] Moving the ngIf directive to wrap both parts of the statement --- src/app/shared/pagination/pagination.component.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/shared/pagination/pagination.component.html b/src/app/shared/pagination/pagination.component.html index 22a58dd7fc..5941d4fa59 100644 --- a/src/app/shared/pagination/pagination.component.html +++ b/src/app/shared/pagination/pagination.component.html @@ -2,8 +2,10 @@
- {{ 'pagination.showing.label' | translate }} - {{ 'pagination.showing.detail' | translate:getShowingDetails(collectionSize)}} + + {{ 'pagination.showing.label' | translate }} + {{ 'pagination.showing.detail' | translate:getShowingDetails(collectionSize)}} +
From 316ced7fefb225b9f1bbda19451f7c356b0a7afc Mon Sep 17 00:00:00 2001 From: lhenze Date: Mon, 26 Aug 2019 07:47:11 -0400 Subject: [PATCH 16/18] More compact approach h/t @artlowel --- src/app/shared/pagination/pagination.component.html | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/app/shared/pagination/pagination.component.html b/src/app/shared/pagination/pagination.component.html index 5941d4fa59..c16a153026 100644 --- a/src/app/shared/pagination/pagination.component.html +++ b/src/app/shared/pagination/pagination.component.html @@ -1,11 +1,9 @@
-
- +
{{ 'pagination.showing.label' | translate }} {{ 'pagination.showing.detail' | translate:getShowingDetails(collectionSize)}} -
From f49fab35997e9687541a944453e108d6a350528e Mon Sep 17 00:00:00 2001 From: lhenze Date: Mon, 26 Aug 2019 08:56:13 -0400 Subject: [PATCH 17/18] Added "empty" message Modeled on browse-by.component.html --- src/app/+collection-page/collection-page.component.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/app/+collection-page/collection-page.component.html b/src/app/+collection-page/collection-page.component.html index 91239de17c..ddfa17e580 100644 --- a/src/app/+collection-page/collection-page.component.html +++ b/src/app/+collection-page/collection-page.component.html @@ -52,6 +52,9 @@ message="{{'error.recent-submissions' | translate}}"> +
Date: Tue, 3 Sep 2019 17:02:09 -0400 Subject: [PATCH 18/18] New key created for *no recent items in this collection* --- resources/i18n/en.json | 1 + src/app/+collection-page/collection-page.component.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/i18n/en.json b/resources/i18n/en.json index f3236251cf..234967231e 100644 --- a/resources/i18n/en.json +++ b/resources/i18n/en.json @@ -132,6 +132,7 @@ "collection.form.tableofcontents": "News (HTML)", "collection.form.title": "Name", "collection.page.browse.recent.head": "Recent Submissions", + "collection.page.browse.recent.empty": "No items to show", "collection.page.license": "License", "collection.page.news": "News", "community.create.head": "Create a Community", diff --git a/src/app/+collection-page/collection-page.component.html b/src/app/+collection-page/collection-page.component.html index ddfa17e580..2b16bc1ca6 100644 --- a/src/app/+collection-page/collection-page.component.html +++ b/src/app/+collection-page/collection-page.component.html @@ -53,7 +53,7 @@