mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33:04 +00:00
Merge remote-tracking branch 'remotes/origin/master' into #601-resource-policies
# Conflicts: # src/app/core/eperson/eperson-data.service.spec.ts # src/app/core/eperson/group-data.service.spec.ts # src/app/shared/shared.module.ts # src/app/submission/sections/upload/section-upload.component.spec.ts
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
import 'reflect-metadata';
|
||||
import { hasNoValue, hasValue } from '../../../shared/empty.util';
|
||||
import { DataService } from '../../data/data.service';
|
||||
|
||||
import { GenericConstructor } from '../../shared/generic-constructor';
|
||||
import { HALResource } from '../../shared/hal-resource.model';
|
||||
@@ -98,7 +96,7 @@ export const link = <T extends HALResource>(
|
||||
let targetMap = linkMap.get(target.constructor);
|
||||
|
||||
if (hasNoValue(targetMap)) {
|
||||
targetMap = new Map<keyof T['_links'],LinkDefinition<T>>();
|
||||
targetMap = new Map<keyof T['_links'], LinkDefinition<T>>();
|
||||
}
|
||||
|
||||
if (hasNoValue(linkName)) {
|
||||
|
@@ -40,10 +40,10 @@ class TestModel implements HALResource {
|
||||
@Injectable()
|
||||
class TestDataService {
|
||||
findAllByHref(href: string, findListOptions: FindListOptions = {}, ...linksToFollow: Array<FollowLinkConfig<any>>) {
|
||||
return 'findAllByHref'
|
||||
return 'findAllByHref';
|
||||
}
|
||||
findByHref(href: string, ...linksToFollow: Array<FollowLinkConfig<any>>) {
|
||||
return 'findByHref'
|
||||
return 'findByHref';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ describe('LinkService', () => {
|
||||
describe('resolveLinks', () => {
|
||||
beforeEach(() => {
|
||||
spyOn(service, 'resolveLink');
|
||||
service.resolveLinks(testModel, followLink('predecessor'), followLink('successor'))
|
||||
result = service.resolveLinks(testModel, followLink('predecessor'), followLink('successor'))
|
||||
});
|
||||
|
||||
it('should call resolveLink with the model for each of the provided links', () => {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../shared/testing/utils';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
|
||||
import { PaginatedList } from '../../data/paginated-list';
|
||||
import { RemoteData } from '../../data/remote-data';
|
||||
import { Item } from '../../shared/item.model';
|
||||
|
@@ -8,7 +8,7 @@ import {
|
||||
isNotEmpty,
|
||||
isNotUndefined
|
||||
} from '../../../shared/empty.util';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../../shared/testing/utils';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
||||
import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model';
|
||||
import { PaginatedList } from '../../data/paginated-list';
|
||||
import { RemoteData } from '../../data/remote-data';
|
||||
|
@@ -5,10 +5,9 @@ import { cold, hot } from 'jasmine-marbles';
|
||||
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
import * as operators from 'rxjs/operators';
|
||||
import { GLOBAL_CONFIG } from '../../../config';
|
||||
import { getMockRequestService } from '../../shared/mocks/mock-request.service';
|
||||
import { MockStore } from '../../shared/testing/mock-store';
|
||||
import { spyOnOperator } from '../../shared/testing/utils';
|
||||
import { getMockRequestService } from '../../shared/mocks/request.service.mock';
|
||||
import { StoreMock } from '../../shared/testing/store.mock';
|
||||
import { spyOnOperator } from '../../shared/testing/utils.test';
|
||||
import { RequestService } from '../data/request.service';
|
||||
import { RestRequestMethod } from '../data/rest-request-method';
|
||||
import { DSpaceObject } from '../shared/dspace-object.model';
|
||||
@@ -17,6 +16,7 @@ import { ObjectCacheService } from './object-cache.service';
|
||||
import { CommitSSBAction, EmptySSBAction, ServerSyncBufferActionTypes } from './server-sync-buffer.actions';
|
||||
|
||||
import { ServerSyncBufferEffects } from './server-sync-buffer.effects';
|
||||
import { storeModuleConfig } from '../../app.reducer';
|
||||
|
||||
describe('ServerSyncBufferEffects', () => {
|
||||
let ssbEffects: ServerSyncBufferEffects;
|
||||
@@ -37,12 +37,11 @@ describe('ServerSyncBufferEffects', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
StoreModule.forRoot({}),
|
||||
StoreModule.forRoot({}, storeModuleConfig),
|
||||
],
|
||||
providers: [
|
||||
ServerSyncBufferEffects,
|
||||
provideMockActions(() => actions),
|
||||
{ provide: GLOBAL_CONFIG, useValue: testConfig },
|
||||
{ provide: RequestService, useValue: getMockRequestService() },
|
||||
{
|
||||
provide: ObjectCacheService, useValue: {
|
||||
@@ -62,7 +61,7 @@ describe('ServerSyncBufferEffects', () => {
|
||||
}
|
||||
}
|
||||
},
|
||||
{ provide: Store, useClass: MockStore }
|
||||
{ provide: Store, useClass: StoreMock }
|
||||
// other providers
|
||||
],
|
||||
});
|
||||
|
19
src/app/core/cache/server-sync-buffer.effects.ts
vendored
19
src/app/core/cache/server-sync-buffer.effects.ts
vendored
@@ -1,15 +1,8 @@
|
||||
import { delay, exhaustMap, map, switchMap, take } from 'rxjs/operators';
|
||||
import { Inject, Injectable } from '@angular/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Actions, Effect, ofType } from '@ngrx/effects';
|
||||
import { coreSelector } from '../core.selectors';
|
||||
import {
|
||||
AddToSSBAction,
|
||||
CommitSSBAction,
|
||||
EmptySSBAction,
|
||||
ServerSyncBufferActionTypes
|
||||
} from './server-sync-buffer.actions';
|
||||
import { GLOBAL_CONFIG } from '../../../config';
|
||||
import { GlobalConfig } from '../../../config/global-config.interface';
|
||||
import { AddToSSBAction, CommitSSBAction, EmptySSBAction, ServerSyncBufferActionTypes } from './server-sync-buffer.actions';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { Action, createSelector, MemoizedSelector, select, Store } from '@ngrx/store';
|
||||
import { ServerSyncBufferEntry, ServerSyncBufferState } from './server-sync-buffer.reducer';
|
||||
@@ -21,6 +14,7 @@ import { ApplyPatchObjectCacheAction } from './object-cache.actions';
|
||||
import { hasValue, isNotEmpty, isNotUndefined } from '../../shared/empty.util';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { RestRequestMethod } from '../data/rest-request-method';
|
||||
import { environment } from '../../../environments/environment';
|
||||
import { ObjectCacheEntry } from './object-cache.reducer';
|
||||
import { Operation } from 'fast-json-patch';
|
||||
|
||||
@@ -37,7 +31,7 @@ export class ServerSyncBufferEffects {
|
||||
.pipe(
|
||||
ofType(ServerSyncBufferActionTypes.ADD),
|
||||
exhaustMap((action: AddToSSBAction) => {
|
||||
const autoSyncConfig = this.EnvConfig.cache.autoSync;
|
||||
const autoSyncConfig = environment.cache.autoSync;
|
||||
const timeoutInSeconds = autoSyncConfig.timePerMethod[action.payload.method] || autoSyncConfig.defaultTime;
|
||||
return observableOf(new CommitSSBAction(action.payload.method)).pipe(
|
||||
delay(timeoutInSeconds * 1000),
|
||||
@@ -85,7 +79,7 @@ export class ServerSyncBufferEffects {
|
||||
return observableOf({ type: 'NO_ACTION' });
|
||||
}
|
||||
})
|
||||
)
|
||||
);
|
||||
})
|
||||
);
|
||||
|
||||
@@ -114,8 +108,7 @@ export class ServerSyncBufferEffects {
|
||||
constructor(private actions$: Actions,
|
||||
private store: Store<CoreState>,
|
||||
private requestService: RequestService,
|
||||
private objectCache: ObjectCacheService,
|
||||
@Inject(GLOBAL_CONFIG) private EnvConfig: GlobalConfig) {
|
||||
private objectCache: ObjectCacheService) {
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user