Merge branch 'master' into configurable_entities

Conflicts:
	src/app/+collection-page/collection-page.component.ts
	src/app/+item-page/full/full-item-page.component.ts
	src/app/+item-page/simple/item-page.component.ts
	src/app/+search-page/search-filters/search-filter/search-filter.service.spec.ts
	src/app/+search-page/search-filters/search-filter/search-filter.service.ts
	src/app/+search-page/search-page.component.spec.ts
	src/app/+search-page/search-page.component.ts
	src/app/+search-page/search-results/search-results.component.spec.ts
	src/app/+search-page/search-results/search-results.component.ts
	src/app/+search-page/search-service/search-configuration.service.spec.ts
	src/app/+search-page/search-service/search-configuration.service.ts
	src/app/+search-page/search-service/search.service.ts
	src/app/core/cache/builders/remote-data-build.service.spec.ts
	src/app/core/cache/builders/remote-data-build.service.ts
	src/app/core/data/data.service.ts
	src/app/core/metadata/metadata.service.ts
	src/app/core/shared/item.model.ts
	src/app/core/shared/operators.ts
	src/app/shared/loading/loading.component.ts
	src/app/shared/object-collection/object-collection.component.ts
	src/app/shared/object-list/item-list-element/item-list-element.component.spec.ts
	src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.spec.ts
	src/app/shared/services/route.service.spec.ts
	src/app/shared/services/route.service.ts
	src/app/shared/shared.module.ts
	src/app/shared/testing/hal-endpoint-service-stub.ts
	src/app/shared/testing/search-service-stub.ts
	yarn.lock
This commit is contained in:
lotte
2018-12-10 11:13:01 +01:00
236 changed files with 7005 additions and 7392 deletions

View File

@@ -4,13 +4,13 @@ import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
import { By } from '@angular/platform-browser';
import { TruncatePipe } from '../../utils/truncate.pipe';
import { Item } from '../../../core/shared/item.model';
import { Observable } from 'rxjs/Observable';
import { of as observableOf } from 'rxjs';
let itemGridElementComponent: ItemGridElementComponent;
let fixture: ComponentFixture<ItemGridElementComponent>;
const mockItemWithAuthorAndDate: Item = Object.assign(new Item(), {
bitstreams: Observable.of({}),
bitstreams: observableOf({}),
metadata: [
{
key: 'dc.contributor.author',
@@ -24,7 +24,7 @@ const mockItemWithAuthorAndDate: Item = Object.assign(new Item(), {
}]
});
const mockItemWithoutAuthorAndDate: Item = Object.assign(new Item(), {
bitstreams: Observable.of({}),
bitstreams: observableOf({}),
metadata: [
{
key: 'dc.title',

View File

@@ -1,3 +1,6 @@
import { combineLatest as observableCombineLatest, BehaviorSubject, Observable } from 'rxjs';
import { startWith, distinctUntilChanged, map } from 'rxjs/operators';
import {
ChangeDetectionStrategy,
Component,
@@ -6,9 +9,6 @@ import {
Output,
ViewEncapsulation
} from '@angular/core';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Observable } from 'rxjs/Observable';
import { distinctUntilChanged, map } from 'rxjs/operators';
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
import { PaginatedList } from '../../core/data/paginated-list';
@@ -25,7 +25,7 @@ import { PaginationComponentOptions } from '../pagination/pagination-component-o
changeDetection: ChangeDetectionStrategy.Default,
encapsulation: ViewEncapsulation.Emulated,
selector: 'ds-object-grid',
styleUrls: [ './object-grid.component.scss' ],
styleUrls: ['./object-grid.component.scss'],
templateUrl: './object-grid.component.html',
animations: [fadeIn]
})
@@ -37,9 +37,11 @@ export class ObjectGridComponent implements OnInit {
@Input() hideGear = false;
@Input() hidePagerWhenSinglePage = true;
private _objects$: BehaviorSubject<RemoteData<PaginatedList<ListableObject>>>;
@Input() set objects(objects: RemoteData<PaginatedList<ListableObject>>) {
this._objects$.next(objects);
}
get objects() {
return this._objects$.getValue();
}
@@ -106,30 +108,29 @@ export class ObjectGridComponent implements OnInit {
}
}),
distinctUntilChanged()
).startWith(3);
).pipe(startWith(3));
this.columns$ = Observable.combineLatest(
this.columns$ = observableCombineLatest(
nbColumns$,
this._objects$,
(nbColumns, objects) => {
if (hasValue(objects) && hasValue(objects.payload) && hasValue(objects.payload.page)) {
const page = objects.payload.page;
this._objects$).pipe(map(([nbColumns, objects]) => {
if (hasValue(objects) && hasValue(objects.payload) && hasValue(objects.payload.page)) {
const page = objects.payload.page;
const result = [];
const result = [];
page.forEach((obj: ListableObject, i: number) => {
const colNb = i % nbColumns;
let col = result[colNb];
if (hasNoValue(col)) {
col = [];
}
result[colNb] = [...col, obj];
});
return result;
} else {
return [];
}
});
page.forEach((obj: ListableObject, i: number) => {
const colNb = i % nbColumns;
let col = result[colNb];
if (hasNoValue(col)) {
col = [];
}
result[colNb] = [...col, obj];
});
return result;
} else {
return [];
}
}));
}
onPageChange(event) {

View File

@@ -1,6 +1,6 @@
import { CollectionSearchResultGridElementComponent } from './collection-search-result-grid-element.component';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { Observable } from 'rxjs/Observable';
import { of as observableOf } from 'rxjs';
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
import { By } from '@angular/platform-browser';
import { TruncatePipe } from '../../../utils/truncate.pipe';
@@ -12,7 +12,7 @@ let collectionSearchResultGridElementComponent: CollectionSearchResultGridElemen
let fixture: ComponentFixture<CollectionSearchResultGridElementComponent>;
const truncatableServiceStub: any = {
isCollapsed: (id: number) => Observable.of(true),
isCollapsed: (id: number) => observableOf(true),
};
const mockCollectionWithAbstract: CollectionSearchResult = new CollectionSearchResult();

View File

@@ -1,6 +1,6 @@
import { CommunitySearchResultGridElementComponent } from './community-search-result-grid-element.component';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { Observable } from 'rxjs/Observable';
import { of as observableOf } from 'rxjs';
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
import { By } from '@angular/platform-browser';
import { TruncatePipe } from '../../../utils/truncate.pipe';
@@ -12,7 +12,7 @@ let communitySearchResultGridElementComponent: CommunitySearchResultGridElementC
let fixture: ComponentFixture<CommunitySearchResultGridElementComponent>;
const truncatableServiceStub: any = {
isCollapsed: (id: number) => Observable.of(true),
isCollapsed: (id: number) => observableOf(true),
};
const mockCommunityWithAbstract: CommunitySearchResult = new CommunitySearchResult();

View File

@@ -1,7 +1,7 @@
import { ItemSearchResultGridElementComponent } from './item-search-result-grid-element.component';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { Observable } from 'rxjs/Observable';
import { NO_ERRORS_SCHEMA, ChangeDetectionStrategy } from '@angular/core';
import { of as observableOf } from 'rxjs';
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
import { By } from '@angular/platform-browser';
import { TruncatePipe } from '../../../utils/truncate.pipe';
import { Item } from '../../../../core/shared/item.model';
@@ -13,13 +13,13 @@ let itemSearchResultGridElementComponent: ItemSearchResultGridElementComponent;
let fixture: ComponentFixture<ItemSearchResultGridElementComponent>;
const truncatableServiceStub: any = {
isCollapsed: (id: number) => Observable.of(true),
isCollapsed: (id: number) => observableOf(true),
};
const mockItemWithAuthorAndDate: ItemSearchResult = new ItemSearchResult();
mockItemWithAuthorAndDate.hitHighlights = [];
mockItemWithAuthorAndDate.dspaceObject = Object.assign(new Item(), {
bitstreams: Observable.of({}),
bitstreams: observableOf({}),
metadata: [
{
key: 'dc.contributor.author',
@@ -36,7 +36,7 @@ mockItemWithAuthorAndDate.dspaceObject = Object.assign(new Item(), {
const mockItemWithoutAuthorAndDate: ItemSearchResult = new ItemSearchResult();
mockItemWithoutAuthorAndDate.hitHighlights = [];
mockItemWithoutAuthorAndDate.dspaceObject = Object.assign(new Item(), {
bitstreams: Observable.of({}),
bitstreams: observableOf({}),
metadata: [
{
key: 'dc.title',

View File

@@ -7,7 +7,7 @@ import { isEmpty, hasNoValue, hasValue } from '../../empty.util';
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
import { ListableObject } from '../../object-collection/shared/listable-object.model';
import { TruncatableService } from '../../truncatable/truncatable.service';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
@Component({
selector: 'ds-search-result-grid-element',

View File

@@ -1,6 +1,6 @@
import { WrapperGridElementComponent } from './wrapper-grid-element.component';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { Observable } from 'rxjs/Observable';
import { of as observableOf } from 'rxjs';
import { ActivatedRoute, Router } from '@angular/router';
import { RouterStub } from '../../testing/router-stub';
import { NO_ERRORS_SCHEMA } from '@angular/core';
@@ -11,7 +11,7 @@ let fixture: ComponentFixture<WrapperGridElementComponent>;
const queryParam = 'test query';
const scopeParam = '7669c72a-3f2a-451f-a3b9-9210e7a4c02f';
const activatedRouteStub = {
queryParams: Observable.of({
queryParams: observableOf({
query: queryParam,
scope: scopeParam
})