From e9bd8db79c14f7cb8fa3cb130b3913b32b6e3d14 Mon Sep 17 00:00:00 2001 From: William Welling Date: Mon, 5 Jun 2017 12:11:05 -0500 Subject: [PATCH 1/8] Increase travis_wait for potential timeouts. --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index e009520b68..96f1a24475 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,17 +19,17 @@ cache: - node_modules before_install: - - yarn run global + - travis_wait 15 yarn run global install: - - yarn install + - travis_wait 15 yarn install before_script: - - yarn run build + - travis_wait 20 yarn run build - export CHROME_BIN=chromium-browser - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start - sleep 3 script: - - yarn run ci + - travis_wait 20 yarn run ci From dfc0ce8f98dd2a7f20bfe4b5445a4ab1cddf17a8 Mon Sep 17 00:00:00 2001 From: William Welling Date: Mon, 5 Jun 2017 12:19:42 -0500 Subject: [PATCH 2/8] Use travis_retry for installs. Use default travis_wait for build. --- .travis.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 96f1a24475..119151e71d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,18 +18,20 @@ cache: directories: - node_modules +bundler_args: --retry 5 + before_install: - - travis_wait 15 yarn run global + - travis_retry yarn run global install: - - travis_wait 15 yarn install + - travis_retry yarn install before_script: - - travis_wait 20 yarn run build + - travis_wait yarn run build - export CHROME_BIN=chromium-browser - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start - sleep 3 script: - - travis_wait 20 yarn run ci + - yarn run ci From c5d92d4e5fe3049fc629df8bafdee78955225fa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=80lex=20Magaz=20Gra=C3=A7a?= Date: Tue, 18 Apr 2017 14:57:01 +0200 Subject: [PATCH 3/8] Implement collection home page Shows the following fields if they exist: * title * logo * introductory text * news (also referred to as sidebarText) * copyright text * license Fixes https://github.com/DSpace/dspace-angular/issues/63 --- resources/i18n/en.json | 6 ++++ src/app/app.module.ts | 2 ++ .../collection-page-routing.module.ts | 13 +++++++ .../collection-page.component.html | 16 +++++++++ .../collection-page.component.scss | 1 + .../collection-page.component.ts | 35 +++++++++++++++++++ .../collection-page/collection-page.module.ts | 33 +++++++++++++++++ .../collection-page-copyright.component.html | 3 ++ .../collection-page-copyright.component.scss | 1 + .../collection-page-copyright.component.ts | 11 ++++++ .../field-wrapper.component.html | 3 ++ .../field-wrapper.component.scss | 1 + .../field-wrapper/field-wrapper.component.ts | 11 ++++++ ...tion-page-introductory-text.component.html | 3 ++ ...tion-page-introductory-text.component.scss | 1 + ...ection-page-introductory-text.component.ts | 11 ++++++ .../collection-page-license.component.html | 4 +++ .../collection-page-license.component.scss | 1 + .../collection-page-license.component.ts | 11 ++++++ .../logo/collection-page-logo.component.html | 3 ++ .../logo/collection-page-logo.component.scss | 1 + .../logo/collection-page-logo.component.ts | 13 +++++++ .../name/collection-page-name.component.html | 1 + .../name/collection-page-name.component.scss | 1 + .../name/collection-page-name.component.ts | 11 ++++++ .../news/collection-page-news.component.html | 4 +++ .../news/collection-page-news.component.scss | 1 + .../news/collection-page-news.component.ts | 11 ++++++ .../models/normalized-bitstream.model.ts | 1 + .../models/normalized-collection.model.ts | 2 ++ src/backend/bitstreams.ts | 15 +++++++- src/backend/collections.ts | 3 +- src/server.routes.ts | 2 +- 33 files changed, 233 insertions(+), 3 deletions(-) create mode 100644 src/app/collection-page/collection-page-routing.module.ts create mode 100644 src/app/collection-page/collection-page.component.html create mode 100644 src/app/collection-page/collection-page.component.scss create mode 100644 src/app/collection-page/collection-page.component.ts create mode 100644 src/app/collection-page/collection-page.module.ts create mode 100644 src/app/collection-page/copyright/collection-page-copyright.component.html create mode 100644 src/app/collection-page/copyright/collection-page-copyright.component.scss create mode 100644 src/app/collection-page/copyright/collection-page-copyright.component.ts create mode 100644 src/app/collection-page/field-wrapper/field-wrapper.component.html create mode 100644 src/app/collection-page/field-wrapper/field-wrapper.component.scss create mode 100644 src/app/collection-page/field-wrapper/field-wrapper.component.ts create mode 100644 src/app/collection-page/introductory-text/collection-page-introductory-text.component.html create mode 100644 src/app/collection-page/introductory-text/collection-page-introductory-text.component.scss create mode 100644 src/app/collection-page/introductory-text/collection-page-introductory-text.component.ts create mode 100644 src/app/collection-page/license/collection-page-license.component.html create mode 100644 src/app/collection-page/license/collection-page-license.component.scss create mode 100644 src/app/collection-page/license/collection-page-license.component.ts create mode 100644 src/app/collection-page/logo/collection-page-logo.component.html create mode 100644 src/app/collection-page/logo/collection-page-logo.component.scss create mode 100644 src/app/collection-page/logo/collection-page-logo.component.ts create mode 100644 src/app/collection-page/name/collection-page-name.component.html create mode 100644 src/app/collection-page/name/collection-page-name.component.scss create mode 100644 src/app/collection-page/name/collection-page-name.component.ts create mode 100644 src/app/collection-page/news/collection-page-news.component.html create mode 100644 src/app/collection-page/news/collection-page-news.component.scss create mode 100644 src/app/collection-page/news/collection-page-news.component.ts diff --git a/resources/i18n/en.json b/resources/i18n/en.json index 43b90d7165..7489228eb5 100644 --- a/resources/i18n/en.json +++ b/resources/i18n/en.json @@ -4,6 +4,12 @@ "link.dspace": "DSpace software", "link.duraspace": "DuraSpace" }, + "collection": { + "page": { + "news": "News", + "license": "License" + } + }, "item": { "page": { "author": "Author", diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 42304c865e..95bfc73517 100755 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -9,6 +9,7 @@ import { SharedModule } from './shared/shared.module'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { HeaderComponent } from './header/header.component'; +import { CollectionPageModule } from './collection-page/collection-page.module'; import { PageNotFoundComponent } from './pagenotfound/pagenotfound.component'; @@ -22,6 +23,7 @@ import { PageNotFoundComponent } from './pagenotfound/pagenotfound.component'; SharedModule, HomeModule, ItemPageModule, + CollectionPageModule, CoreModule.forRoot(), AppRoutingModule ], diff --git a/src/app/collection-page/collection-page-routing.module.ts b/src/app/collection-page/collection-page-routing.module.ts new file mode 100644 index 0000000000..ac8c9b9cb5 --- /dev/null +++ b/src/app/collection-page/collection-page-routing.module.ts @@ -0,0 +1,13 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import { CollectionPageComponent } from './collection-page.component'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: 'collections/:id', component: CollectionPageComponent } + ]) + ] +}) +export class CollectionPageRoutingModule { } diff --git a/src/app/collection-page/collection-page.component.html b/src/app/collection-page/collection-page.component.html new file mode 100644 index 0000000000..467dcb2a82 --- /dev/null +++ b/src/app/collection-page/collection-page.component.html @@ -0,0 +1,16 @@ +
+ + + + + + + + + + +
diff --git a/src/app/collection-page/collection-page.component.scss b/src/app/collection-page/collection-page.component.scss new file mode 100644 index 0000000000..da97dd7a62 --- /dev/null +++ b/src/app/collection-page/collection-page.component.scss @@ -0,0 +1 @@ +@import '../../styles/variables.scss'; diff --git a/src/app/collection-page/collection-page.component.ts b/src/app/collection-page/collection-page.component.ts new file mode 100644 index 0000000000..42afe78881 --- /dev/null +++ b/src/app/collection-page/collection-page.component.ts @@ -0,0 +1,35 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute, Params } from '@angular/router'; + +import { Collection } from "../core/shared/collection.model"; +import { Bitstream } from "../core/shared/bitstream.model"; +import { RemoteData } from "../core/data/remote-data"; +import { CollectionDataService } from "../core/data/collection-data.service"; + +@Component({ + selector: 'ds-collection-page', + styleUrls: ['./collection-page.component.css'], + templateUrl: './collection-page.component.html', +}) +export class CollectionPageComponent implements OnInit { + collectionData: RemoteData; + logoData: RemoteData; + + constructor( + private collectionDataService: CollectionDataService, + private route: ActivatedRoute + ) { + this.universalInit(); + } + + ngOnInit(): void { + this.route.params.subscribe((params: Params) => { + this.collectionData = this.collectionDataService.findById(params['id']) + this.collectionData.payload + .subscribe(collection => this.logoData = collection.logo); + }); + } + + universalInit() { + } +} diff --git a/src/app/collection-page/collection-page.module.ts b/src/app/collection-page/collection-page.module.ts new file mode 100644 index 0000000000..9b204cb0bb --- /dev/null +++ b/src/app/collection-page/collection-page.module.ts @@ -0,0 +1,33 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { TranslateModule } from "@ngx-translate/core"; + +import { CollectionPageComponent } from './collection-page.component'; +import { FieldWrapperComponent } from './field-wrapper/field-wrapper.component'; +import { CollectionPageNameComponent } from './name/collection-page-name.component'; +import { CollectionPageLogoComponent } from './logo/collection-page-logo.component'; +import { CollectionPageIntroductoryTextComponent } from './introductory-text/collection-page-introductory-text.component'; +import { CollectionPageNewsComponent } from './news/collection-page-news.component'; +import { CollectionPageCopyrightComponent } from './copyright/collection-page-copyright.component'; +import { CollectionPageLicenseComponent } from './license/collection-page-license.component'; +import { CollectionPageRoutingModule } from './collection-page-routing.module'; + +@NgModule({ + imports: [ + CollectionPageRoutingModule, + CommonModule, + TranslateModule, + ], + declarations: [ + CollectionPageComponent, + FieldWrapperComponent, + CollectionPageNameComponent, + CollectionPageLogoComponent, + CollectionPageIntroductoryTextComponent, + CollectionPageNewsComponent, + CollectionPageCopyrightComponent, + CollectionPageLicenseComponent, + ] +}) +export class CollectionPageModule { } diff --git a/src/app/collection-page/copyright/collection-page-copyright.component.html b/src/app/collection-page/copyright/collection-page-copyright.component.html new file mode 100644 index 0000000000..db7b77d614 --- /dev/null +++ b/src/app/collection-page/copyright/collection-page-copyright.component.html @@ -0,0 +1,3 @@ + +

+
\ No newline at end of file diff --git a/src/app/collection-page/copyright/collection-page-copyright.component.scss b/src/app/collection-page/copyright/collection-page-copyright.component.scss new file mode 100644 index 0000000000..ad84b72f8c --- /dev/null +++ b/src/app/collection-page/copyright/collection-page-copyright.component.scss @@ -0,0 +1 @@ +@import '../../../styles/variables.scss'; \ No newline at end of file diff --git a/src/app/collection-page/copyright/collection-page-copyright.component.ts b/src/app/collection-page/copyright/collection-page-copyright.component.ts new file mode 100644 index 0000000000..e4bc21553f --- /dev/null +++ b/src/app/collection-page/copyright/collection-page-copyright.component.ts @@ -0,0 +1,11 @@ +import { Component, Input } from '@angular/core'; + + +@Component({ + selector: 'ds-collection-page-copyright', + styleUrls: ['./collection-page-copyright.component.css'], + templateUrl: './collection-page-copyright.component.html', +}) +export class CollectionPageCopyrightComponent { + @Input() copyrightText: String; +} diff --git a/src/app/collection-page/field-wrapper/field-wrapper.component.html b/src/app/collection-page/field-wrapper/field-wrapper.component.html new file mode 100644 index 0000000000..677ff2f918 --- /dev/null +++ b/src/app/collection-page/field-wrapper/field-wrapper.component.html @@ -0,0 +1,3 @@ +
+ +
\ No newline at end of file diff --git a/src/app/collection-page/field-wrapper/field-wrapper.component.scss b/src/app/collection-page/field-wrapper/field-wrapper.component.scss new file mode 100644 index 0000000000..ad84b72f8c --- /dev/null +++ b/src/app/collection-page/field-wrapper/field-wrapper.component.scss @@ -0,0 +1 @@ +@import '../../../styles/variables.scss'; \ No newline at end of file diff --git a/src/app/collection-page/field-wrapper/field-wrapper.component.ts b/src/app/collection-page/field-wrapper/field-wrapper.component.ts new file mode 100644 index 0000000000..c8420661ea --- /dev/null +++ b/src/app/collection-page/field-wrapper/field-wrapper.component.ts @@ -0,0 +1,11 @@ +import { Component, Input } from '@angular/core'; + + +@Component({ + selector: 'ds-field-wrapper', + styleUrls: ['./field-wrapper.component.css'], + templateUrl: './field-wrapper.component.html', +}) +export class FieldWrapperComponent { + @Input() name: String; +} diff --git a/src/app/collection-page/introductory-text/collection-page-introductory-text.component.html b/src/app/collection-page/introductory-text/collection-page-introductory-text.component.html new file mode 100644 index 0000000000..904a6d7f21 --- /dev/null +++ b/src/app/collection-page/introductory-text/collection-page-introductory-text.component.html @@ -0,0 +1,3 @@ + +

+
\ No newline at end of file diff --git a/src/app/collection-page/introductory-text/collection-page-introductory-text.component.scss b/src/app/collection-page/introductory-text/collection-page-introductory-text.component.scss new file mode 100644 index 0000000000..ad84b72f8c --- /dev/null +++ b/src/app/collection-page/introductory-text/collection-page-introductory-text.component.scss @@ -0,0 +1 @@ +@import '../../../styles/variables.scss'; \ No newline at end of file diff --git a/src/app/collection-page/introductory-text/collection-page-introductory-text.component.ts b/src/app/collection-page/introductory-text/collection-page-introductory-text.component.ts new file mode 100644 index 0000000000..f6526c9943 --- /dev/null +++ b/src/app/collection-page/introductory-text/collection-page-introductory-text.component.ts @@ -0,0 +1,11 @@ +import { Component, Input } from '@angular/core'; + + +@Component({ + selector: 'ds-collection-page-introductory-text', + styleUrls: ['./collection-page-introductory-text.component.css'], + templateUrl: './collection-page-introductory-text.component.html', +}) +export class CollectionPageIntroductoryTextComponent { + @Input() introductoryText: String; +} diff --git a/src/app/collection-page/license/collection-page-license.component.html b/src/app/collection-page/license/collection-page-license.component.html new file mode 100644 index 0000000000..af0a6e4261 --- /dev/null +++ b/src/app/collection-page/license/collection-page-license.component.html @@ -0,0 +1,4 @@ + +

{{ 'collection.page.license' | translate }}

+

{{ license }}

+
\ No newline at end of file diff --git a/src/app/collection-page/license/collection-page-license.component.scss b/src/app/collection-page/license/collection-page-license.component.scss new file mode 100644 index 0000000000..ad84b72f8c --- /dev/null +++ b/src/app/collection-page/license/collection-page-license.component.scss @@ -0,0 +1 @@ +@import '../../../styles/variables.scss'; \ No newline at end of file diff --git a/src/app/collection-page/license/collection-page-license.component.ts b/src/app/collection-page/license/collection-page-license.component.ts new file mode 100644 index 0000000000..8f269cca8c --- /dev/null +++ b/src/app/collection-page/license/collection-page-license.component.ts @@ -0,0 +1,11 @@ +import { Component, Input } from '@angular/core'; + + +@Component({ + selector: 'ds-collection-page-license', + styleUrls: ['./collection-page-license.component.css'], + templateUrl: './collection-page-license.component.html', +}) +export class CollectionPageLicenseComponent { + @Input() license: String; +} diff --git a/src/app/collection-page/logo/collection-page-logo.component.html b/src/app/collection-page/logo/collection-page-logo.component.html new file mode 100644 index 0000000000..1c331e2e25 --- /dev/null +++ b/src/app/collection-page/logo/collection-page-logo.component.html @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/src/app/collection-page/logo/collection-page-logo.component.scss b/src/app/collection-page/logo/collection-page-logo.component.scss new file mode 100644 index 0000000000..ad84b72f8c --- /dev/null +++ b/src/app/collection-page/logo/collection-page-logo.component.scss @@ -0,0 +1 @@ +@import '../../../styles/variables.scss'; \ No newline at end of file diff --git a/src/app/collection-page/logo/collection-page-logo.component.ts b/src/app/collection-page/logo/collection-page-logo.component.ts new file mode 100644 index 0000000000..22c34422ea --- /dev/null +++ b/src/app/collection-page/logo/collection-page-logo.component.ts @@ -0,0 +1,13 @@ +import { Component, Input } from '@angular/core'; + +import { Bitstream } from "../../core/shared/bitstream.model"; + + +@Component({ + selector: 'ds-collection-page-logo', + styleUrls: ['./collection-page-logo.component.css'], + templateUrl: './collection-page-logo.component.html', +}) +export class CollectionPageLogoComponent { + @Input() logo: Bitstream; +} diff --git a/src/app/collection-page/name/collection-page-name.component.html b/src/app/collection-page/name/collection-page-name.component.html new file mode 100644 index 0000000000..21f1f65331 --- /dev/null +++ b/src/app/collection-page/name/collection-page-name.component.html @@ -0,0 +1 @@ +

{{ name }}

\ No newline at end of file diff --git a/src/app/collection-page/name/collection-page-name.component.scss b/src/app/collection-page/name/collection-page-name.component.scss new file mode 100644 index 0000000000..ad84b72f8c --- /dev/null +++ b/src/app/collection-page/name/collection-page-name.component.scss @@ -0,0 +1 @@ +@import '../../../styles/variables.scss'; \ No newline at end of file diff --git a/src/app/collection-page/name/collection-page-name.component.ts b/src/app/collection-page/name/collection-page-name.component.ts new file mode 100644 index 0000000000..30121fd01b --- /dev/null +++ b/src/app/collection-page/name/collection-page-name.component.ts @@ -0,0 +1,11 @@ +import { Component, Input } from '@angular/core'; + + +@Component({ + selector: 'ds-collection-page-name', + styleUrls: ['./collection-page-name.component.css'], + templateUrl: './collection-page-name.component.html', +}) +export class CollectionPageNameComponent { + @Input() name: String; +} diff --git a/src/app/collection-page/news/collection-page-news.component.html b/src/app/collection-page/news/collection-page-news.component.html new file mode 100644 index 0000000000..bd17c7ea77 --- /dev/null +++ b/src/app/collection-page/news/collection-page-news.component.html @@ -0,0 +1,4 @@ + +

{{ 'collection.page.news' | translate }}

+

+
\ No newline at end of file diff --git a/src/app/collection-page/news/collection-page-news.component.scss b/src/app/collection-page/news/collection-page-news.component.scss new file mode 100644 index 0000000000..ad84b72f8c --- /dev/null +++ b/src/app/collection-page/news/collection-page-news.component.scss @@ -0,0 +1 @@ +@import '../../../styles/variables.scss'; \ No newline at end of file diff --git a/src/app/collection-page/news/collection-page-news.component.ts b/src/app/collection-page/news/collection-page-news.component.ts new file mode 100644 index 0000000000..479c37a7c6 --- /dev/null +++ b/src/app/collection-page/news/collection-page-news.component.ts @@ -0,0 +1,11 @@ +import { Component, Input } from '@angular/core'; + + +@Component({ + selector: 'ds-collection-page-news', + styleUrls: ['./collection-page-news.component.css'], + templateUrl: './collection-page-news.component.html', +}) +export class CollectionPageNewsComponent { + @Input() sidebarText: String; +} diff --git a/src/app/core/cache/models/normalized-bitstream.model.ts b/src/app/core/cache/models/normalized-bitstream.model.ts index b6df211c2e..c89cf5dc05 100644 --- a/src/app/core/cache/models/normalized-bitstream.model.ts +++ b/src/app/core/cache/models/normalized-bitstream.model.ts @@ -16,6 +16,7 @@ export class NormalizedBitstream extends NormalizedDSpaceObject { /** * The relative path to this Bitstream's file */ + @autoserialize url: string; /** diff --git a/src/app/core/cache/models/normalized-collection.model.ts b/src/app/core/cache/models/normalized-collection.model.ts index 9b31f34837..cc6a4173e8 100644 --- a/src/app/core/cache/models/normalized-collection.model.ts +++ b/src/app/core/cache/models/normalized-collection.model.ts @@ -17,6 +17,8 @@ export class NormalizedCollection extends NormalizedDSpaceObject { /** * The Bitstream that represents the logo of this Collection */ + @autoserialize + @relationship(NormalizedDSOType.NormalizedBitstream) logo: string; /** diff --git a/src/backend/bitstreams.ts b/src/backend/bitstreams.ts index df10fae3e1..67ab3dbe76 100644 --- a/src/backend/bitstreams.ts +++ b/src/backend/bitstreams.ts @@ -63,5 +63,18 @@ export const BITSTREAMS = [ ], "format": "Text", "mimetype": "text/plain" - } + }, + { + "_links": { + "self": { "href": "/bitstreams/4688" }, + }, + "id": "4688", + "uuid": "1bb1be24-c934-41e3-a0fb-ca7a71ab0e71", + "type": "bitstream", + "name": "collection-5179-logo.png", + "size": 299832, + "url": "/bitstreams/1bb1be24-c934-41e3-a0fb-ca7a71ab0e71/retrieve", + "format": "PNG", + "mimetype": "image/png" + }, ]; diff --git a/src/backend/collections.ts b/src/backend/collections.ts index c701b38ed4..995f93f98c 100644 --- a/src/backend/collections.ts +++ b/src/backend/collections.ts @@ -5,7 +5,8 @@ export const COLLECTIONS = [ "items": [ { "href": "/items/8871" }, { "href": "/items/9978" } - ] + ], + "logo": { "href": "/bitstreams/4688" } }, "id": "5179", "uuid": "9e32a2e2-6b91-4236-a361-995ccdc14c60", diff --git a/src/server.routes.ts b/src/server.routes.ts index 704ea15df5..19ba0264aa 100644 --- a/src/server.routes.ts +++ b/src/server.routes.ts @@ -10,5 +10,5 @@ * ]; **/ export const routes: string[] = [ - 'home', 'items/:id' , '**' + 'home', 'items/:id' , 'collections/:id', '**' ]; From 2e89cb03d8456ec8d58411de4dc8b90cd0729e09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=80lex=20Magaz=20Gra=C3=A7a?= Date: Wed, 7 Jun 2017 14:50:02 +0200 Subject: [PATCH 4/8] Fix page loading failing when the collection hasn't a logo --- src/app/collection-page/collection-page.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/collection-page/collection-page.component.html b/src/app/collection-page/collection-page.component.html index 467dcb2a82..e9a4ab9916 100644 --- a/src/app/collection-page/collection-page.component.html +++ b/src/app/collection-page/collection-page.component.html @@ -1,6 +1,6 @@
- + From 7e12b33151944eebae4cbb3dbfa51c592a883353 Mon Sep 17 00:00:00 2001 From: Art Lowel Date: Fri, 9 Jun 2017 18:32:47 +0200 Subject: [PATCH 5/8] fix merge isses --- .../models/normalized-collection.model.ts | 2 +- src/backend/bitstreams.ts | 1 + src/backend/bundles.ts | 1 + src/backend/items.ts | 105 ++++++++++++++++-- 4 files changed, 98 insertions(+), 11 deletions(-) diff --git a/src/app/core/cache/models/normalized-collection.model.ts b/src/app/core/cache/models/normalized-collection.model.ts index 86a1ba177a..2114e4cc43 100644 --- a/src/app/core/cache/models/normalized-collection.model.ts +++ b/src/app/core/cache/models/normalized-collection.model.ts @@ -18,7 +18,7 @@ export class NormalizedCollection extends NormalizedDSpaceObject { * The Bitstream that represents the logo of this Collection */ @autoserialize - @relationship(NormalizedDSOType.NormalizedBitstream) + @relationship(ResourceType.Bitstream) logo: string; /** diff --git a/src/backend/bitstreams.ts b/src/backend/bitstreams.ts index da6a87e042..63eae94a98 100644 --- a/src/backend/bitstreams.ts +++ b/src/backend/bitstreams.ts @@ -52,6 +52,7 @@ export const BITSTREAMS = { }, "id": "8934", "uuid": "ba7d24f2-8fc7-4b8e-b7b6-6c32be1c12a6", + "type": "bitstream", "name": "license.txt", "size": 41183, "checksum": { diff --git a/src/backend/bundles.ts b/src/backend/bundles.ts index b7411c6412..06a38e6fac 100644 --- a/src/backend/bundles.ts +++ b/src/backend/bundles.ts @@ -51,6 +51,7 @@ export const BUNDLES = { }, "id": "8475", "uuid": "99f78e5e-3677-43b0-aaef-cddaa1a49092", + "type": "bundle", "name": "LICENSE", "metadata": [ { "key": "dc.title", "value": "LICENSE", "language": "en" } diff --git a/src/backend/items.ts b/src/backend/items.ts index 63913f8245..9598f334a2 100644 --- a/src/backend/items.ts +++ b/src/backend/items.ts @@ -17,12 +17,9 @@ export const ITEMS = { { "href": "/bundles/2355" }, - { - "href": "/bundles/5687" - }, - { - "href": "/bundles/8475" - } + // { + // "href": "/bundles/5687" + // } ] }, "id": "8871", @@ -94,7 +91,86 @@ export const ITEMS = { "value": "(not specified)", "language": "en" } - ] + ], + "_embedded": { + "parents": [ + { + "_links": { + "self": { "href": "/collections/5179" }, + "items": [ + { "href": "/items/8871" }, + { "href": "/items/9978" } + ] + }, + "id": "5179", + "uuid": "9e32a2e2-6b91-4236-a361-995ccdc14c60", + "type": "collection", + "name": "A Test Collection", + "handle": "123456789/5179", + }, + { + "_links": { + "self": { "href": "/collections/6547" }, + "items": [ + { "href": "/items/8871" }, + { "href": "/items/9978" } + ] + }, + "id": "6547", + "uuid": "598ce822-c357-46f3-ab70-63724d02d6ad", + "type": "collection", + "name": "Another Test Collection", + "handle": "123456789/6547", + } + ], + "bundles": [ + { + "_links": { + "self": { "href": "/bundles/2355" }, + "items": [ + { "href": "/items/8871" } + ], + "bitstreams": [ + { "href": "/bitstreams/3678" }, + ], + "primaryBitstream": { "href": "/bitstreams/3678" } + }, + "id": "2355", + "uuid": "35e0606d-5e18-4f9c-aa61-74fc751cc3f9", + "type": "bundle", + "name": "ORIGINAL", + "metadata": [ + { "key": "dc.title", "value": "ORIGINAL", "language": "en" } + ], + "_embedded": { + "bitstreams": [ + { + "_links": { + "self": { "href": "/bitstreams/3678" }, + "bundle": { "href": "/bundles/35e0606d-5e18-4f9c-aa61-74fc751cc3f9" }, + "retrieve": { "href": "/bitstreams/43c57c2b-206f-4645-8c8f-5f10c84b09fa/retrieve" } + }, + "id": "3678", + "uuid": "43c57c2b-206f-4645-8c8f-5f10c84b09fa", + "type": "bitstream", + "name": "do_open_access_CRL.pdf", + "size": 636626, + "checksum": { + "value": "063dfbbbac873aa3fca479b878eccff3", + "algorithm": "MD5" + }, + "metadata": [ + { "key": "dc.title", "value": "do_open_access_CRL.pdf", "language": null }, + { "key": "dc.description", "value": "Conference Paper", "language": "en" } + ], + "format": "Adobe PDF", + "mimetype": "application/pdf" + } + ] + } + } + ] + } }, { "_links": { @@ -113,9 +189,9 @@ export const ITEMS = { { "href": "/bundles/2355" }, - { - "href": "/bundles/5687" - } + // { + // "href": "/bundles/5687" + // } ] }, "id": "9978", @@ -167,6 +243,15 @@ export const ITEMS = { "value": "(not specified)", "language": "en" } + ], + "_embedded": { + "parents": [ + { + "_links": { + "self": { "href": "/collections/5179" }, + "items": [ + { "href": "/items/8871" }, + { "href": "/items/9978" } ] } ] From 84a3272e5509a0fd18e97c6f0047c94d20a0a44d Mon Sep 17 00:00:00 2001 From: Art Lowel Date: Mon, 12 Jun 2017 10:18:27 +0200 Subject: [PATCH 6/8] never push things on a friday night as you're about to leave ;) --- src/backend/items.ts | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/src/backend/items.ts b/src/backend/items.ts index 9598f334a2..5460cafa81 100644 --- a/src/backend/items.ts +++ b/src/backend/items.ts @@ -94,20 +94,7 @@ export const ITEMS = { ], "_embedded": { "parents": [ - { - "_links": { - "self": { "href": "/collections/5179" }, - "items": [ - { "href": "/items/8871" }, - { "href": "/items/9978" } - ] - }, - "id": "5179", - "uuid": "9e32a2e2-6b91-4236-a361-995ccdc14c60", - "type": "collection", - "name": "A Test Collection", - "handle": "123456789/5179", - }, + { "_links": { "self": { "href": "/collections/6547" }, @@ -252,7 +239,30 @@ export const ITEMS = { "items": [ { "href": "/items/8871" }, { "href": "/items/9978" } - ] + ] + }, + "id": "5179", + "uuid": "9e32a2e2-6b91-4236-a361-995ccdc14c60", + "type": "collection", + "name": "A Test Collection", + "handle": "123456789/5179", + }, + { + "_links": { + "self": { "href": "/collections/6547" }, + "items": [ + { "href": "/items/8871" }, + { "href": "/items/9978" } + ] + }, + "id": "6547", + "uuid": "598ce822-c357-46f3-ab70-63724d02d6ad", + "type": "collection", + "name": "Another Test Collection", + "handle": "123456789/6547", + } + ] + } } ] }; From e3778afd45a8dd080e59fb9c066c6faac246839a Mon Sep 17 00:00:00 2001 From: Giuseppe Digilio Date: Mon, 12 Jun 2017 16:35:14 +0200 Subject: [PATCH 7/8] Remove matrix URL notation in PaginationComponent --- .../pagination/pagination.component.spec.ts | 4 ++-- .../shared/pagination/pagination.component.ts | 20 ++++++++++--------- src/app/shared/testing/router-stubs.ts | 2 +- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/app/shared/pagination/pagination.component.spec.ts b/src/app/shared/pagination/pagination.component.spec.ts index b1e1390dd8..3ff6f39609 100644 --- a/src/app/shared/pagination/pagination.component.spec.ts +++ b/src/app/shared/pagination/pagination.component.spec.ts @@ -247,12 +247,12 @@ describe('Pagination component', () => { changePage(testFixture, 3); tick(); - expect(routerStub.navigate).toHaveBeenCalledWith([{pageId: 'test', page: 3, pageSize: 10}]); + expect(routerStub.navigate).toHaveBeenCalledWith([], { queryParams: { pageId: 'test', page: 3, pageSize: 10 } }); expect(paginationComponent.currentPage).toEqual(3); changePageSize(testFixture, '20'); tick(); - expect(routerStub.navigate).toHaveBeenCalledWith([{pageId: 'test', page: 3, pageSize: 20}]); + expect(routerStub.navigate).toHaveBeenCalledWith([], { queryParams: { pageId: 'test', page: 3, pageSize: 20 } }); expect(paginationComponent.pageSize).toEqual(20); })); diff --git a/src/app/shared/pagination/pagination.component.ts b/src/app/shared/pagination/pagination.component.ts index 2d5be240bc..0edf2ad35d 100644 --- a/src/app/shared/pagination/pagination.component.ts +++ b/src/app/shared/pagination/pagination.component.ts @@ -57,6 +57,7 @@ export class PaginationComponent implements OnDestroy, OnInit { * Current page. */ public currentPage = 1; + public currentQueryParams = {}; /** * An observable of HostWindowState type @@ -121,14 +122,15 @@ export class PaginationComponent implements OnDestroy, OnInit { this.pageSize = this.paginationOptions.pageSize; this.pageSizeOptions = this.paginationOptions.pageSizeOptions; - this.routeSubscription = this.route.params - .map(params => params) - .subscribe(params => { - if(this.id == params['pageId'] - && (this.paginationOptions.currentPage != params['page'] - || this.paginationOptions.pageSize != params['pageSize']) + this.routeSubscription = this.route.queryParams + .map(queryParams => queryParams) + .subscribe(queryParams => { + this.currentQueryParams = queryParams; + if(this.id == queryParams['pageId'] + && (this.paginationOptions.currentPage != queryParams['page'] + || this.paginationOptions.pageSize != queryParams['pageSize']) ) { - this.validateParams(params['page'], params['pageSize']); + this.validateParams(queryParams['page'], queryParams['pageSize']); } }); this.setShowingDetail(); @@ -162,7 +164,7 @@ export class PaginationComponent implements OnDestroy, OnInit { * The page being navigated to. */ public doPageChange(page: number) { - this.router.navigate([{ pageId: this.id, page: page, pageSize: this.pageSize }]); + this.router.navigate([], { queryParams: Object.assign({}, this.currentQueryParams, { pageId: this.id, page: page, pageSize: this.pageSize }) }); this.currentPage = page; this.setShowingDetail(); this.pageChange.emit(page); @@ -175,7 +177,7 @@ export class PaginationComponent implements OnDestroy, OnInit { * The new page size. */ public setPageSize(pageSize: number) { - this.router.navigate([{ pageId: this.id, page: this.currentPage, pageSize: pageSize }]); + this.router.navigate([], { queryParams: Object.assign({}, this.currentQueryParams, { pageId: this.id, page: this.currentPage, pageSize: pageSize }) }); this.pageSize = pageSize; this.setShowingDetail(); this.pageSizeChange.emit(pageSize); diff --git a/src/app/shared/testing/router-stubs.ts b/src/app/shared/testing/router-stubs.ts index 42a6270aea..4f68678288 100644 --- a/src/app/shared/testing/router-stubs.ts +++ b/src/app/shared/testing/router-stubs.ts @@ -4,7 +4,6 @@ import { BehaviorSubject } from "rxjs"; export class RouterStub { //noinspection TypeScriptUnresolvedFunction navigate = jasmine.createSpy('navigate'); - //navigate1: jasmine.createSpy('navigate'); } export class ActivatedRouteStub { @@ -12,6 +11,7 @@ export class ActivatedRouteStub { // ActivatedRoute.params is Observable private subject = new BehaviorSubject(this.testParams); params = this.subject.asObservable(); + queryParams = this.subject.asObservable(); constructor(params?: Params) { if (params) { From 06f3a4ff905b5f1b366e18df9e22dcf599d8c578 Mon Sep 17 00:00:00 2001 From: Giuseppe Date: Mon, 12 Jun 2017 16:39:52 +0200 Subject: [PATCH 8/8] Create pagination.component.ts --- src/app/shared/pagination/pagination.component.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app/shared/pagination/pagination.component.ts b/src/app/shared/pagination/pagination.component.ts index 0edf2ad35d..cb1155f652 100644 --- a/src/app/shared/pagination/pagination.component.ts +++ b/src/app/shared/pagination/pagination.component.ts @@ -57,6 +57,10 @@ export class PaginationComponent implements OnDestroy, OnInit { * Current page. */ public currentPage = 1; + + /** + * Current URL query parameters + */ public currentQueryParams = {}; /**