Merge remote-tracking branch 'remotes/origin/master' into submission

# Conflicts:
#	package.json
#	src/app/+admin/admin-registries/metadata-schema/metadata-schema.component.spec.ts
#	src/app/+search-page/search-service/search.service.spec.ts
#	src/app/app.module.ts
#	src/app/core/auth/auth.interceptor.ts
#	src/app/core/cache/response-cache.service.spec.ts
#	src/app/core/data/browse-response-parsing.service.spec.ts
#	src/app/core/data/data.service.spec.ts
#	src/app/core/data/request.service.spec.ts
#	src/app/core/data/request.service.ts
#	src/app/core/dspace-rest-v2/dspace-rest-v2.service.ts
#	src/app/core/integration/integration.service.ts
#	src/app/core/metadata/metadata.service.spec.ts
#	src/app/core/registry/registry.service.spec.ts
#	src/app/core/shared/collection.model.ts
#	src/app/core/shared/item.model.ts
#	src/app/shared/form/builder/ds-dynamic-form-ui/models/dynamic-group/dynamic-group.component.spec.ts
#	src/app/shared/form/builder/ds-dynamic-form-ui/models/dynamic-group/dynamic-group.components.ts
#	src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list.component.ts
#	src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.spec.ts
#	src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.ts
#	src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.ts
#	src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.spec.ts
#	src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.ts
#	src/app/shared/form/builder/ds-dynamic-form-ui/models/typeahead/dynamic-typeahead.component.ts
#	src/app/shared/form/builder/form-builder.service.spec.ts
#	src/app/shared/form/form.service.spec.ts
#	src/app/shared/notifications/notification/notification.component.spec.ts
#	src/app/shared/services/route.service.spec.ts
#	src/app/shared/services/route.service.ts
#	src/app/shared/shared.module.ts
#	yarn.lock
This commit is contained in:
Giuseppe Digilio
2018-12-13 20:28:11 +01:00
237 changed files with 6869 additions and 7210 deletions

View File

@@ -1,4 +1,5 @@
import { Observable } from 'rxjs/Observable';
import { map, startWith, filter, take } from 'rxjs/operators';
import { Observable } from 'rxjs';
import { DSpaceObject } from './dspace-object.model';
import { Collection } from './collection.model';
@@ -58,9 +59,9 @@ export class Item extends DSpaceObject {
// TODO: currently this just picks the first thumbnail
// should be adjusted when we have a way to determine
// the primary thumbnail from rest
return this.getBitstreamsByBundleName('THUMBNAIL')
.filter((thumbnails) => isNotEmpty(thumbnails))
.map((thumbnails) => thumbnails[0])
return this.getBitstreamsByBundleName('THUMBNAIL').pipe(
filter((thumbnails) => isNotEmpty(thumbnails)),
map((thumbnails) => thumbnails[0]),)
}
/**
@@ -68,10 +69,10 @@ export class Item extends DSpaceObject {
* @returns {Observable<Bitstream>} the primaryBitstream of the 'THUMBNAIL' bundle
*/
getThumbnailForOriginal(original: Bitstream): Observable<Bitstream> {
return this.getBitstreamsByBundleName('THUMBNAIL')
.map((files) => {
return this.getBitstreamsByBundleName('THUMBNAIL').pipe(
map((files) => {
return files.find((thumbnail) => thumbnail.name.startsWith(original.name))
}).startWith(undefined);
}),startWith(undefined),);
}
/**
@@ -88,17 +89,17 @@ export class Item extends DSpaceObject {
* @returns {Observable<Bitstream[]>} the bitstreams with the given bundleName
*/
getBitstreamsByBundleName(bundleName: string): Observable<Bitstream[]> {
return this.bitstreams
.filter((rd: RemoteData<PaginatedList<Bitstream>>) => !rd.isResponsePending)
.map((rd: RemoteData<PaginatedList<Bitstream>>) => rd.payload.page)
.filter((bitstreams: Bitstream[]) => hasValue(bitstreams))
.take(1)
.startWith([])
.map((bitstreams) => {
return this.bitstreams.pipe(
filter((rd: RemoteData<PaginatedList<Bitstream>>) => !rd.isResponsePending),
map((rd: RemoteData<PaginatedList<Bitstream>>) => rd.payload.page),
filter((bitstreams: Bitstream[]) => hasValue(bitstreams)),
take(1),
startWith([]),
map((bitstreams) => {
return bitstreams
.filter((bitstream) => hasValue(bitstream))
.filter((bitstream) => bitstream.bundleName === bundleName)
});
}));
}
}