diff --git a/src/app/core/auth/auth-response-parsing.service.ts b/src/app/core/auth/auth-response-parsing.service.ts index 80c1b2eeca..337bb0fd0a 100644 --- a/src/app/core/auth/auth-response-parsing.service.ts +++ b/src/app/core/auth/auth-response-parsing.service.ts @@ -20,7 +20,7 @@ export class AuthResponseParsingService extends BaseResponseParsingService imple protected toCache = false; constructor(@Inject(GLOBAL_CONFIG) protected EnvConfig: GlobalConfig, - protected objectCache: ObjectCacheService,) { + protected objectCache: ObjectCacheService) { super(); } diff --git a/src/app/core/cache/object-cache.reducer.spec.ts b/src/app/core/cache/object-cache.reducer.spec.ts index 2c059c4dd3..ce41f96bd4 100644 --- a/src/app/core/cache/object-cache.reducer.spec.ts +++ b/src/app/core/cache/object-cache.reducer.spec.ts @@ -26,7 +26,9 @@ describe('objectCacheReducer', () => { }, timeAdded: new Date().getTime(), msToLive: 900000, - requestHref: selfLink1 + requestHref: selfLink1, + patches: [], + isDirty: false }, [selfLink2]: { data: { @@ -35,7 +37,9 @@ describe('objectCacheReducer', () => { }, timeAdded: new Date().getTime(), msToLive: 900000, - requestHref: selfLink2 + requestHref: selfLink2, + patches: [], + isDirty: false } }; deepFreeze(testState); diff --git a/src/app/core/cache/object-cache.reducer.ts b/src/app/core/cache/object-cache.reducer.ts index cd0a927c34..adea46bc57 100644 --- a/src/app/core/cache/object-cache.reducer.ts +++ b/src/app/core/cache/object-cache.reducer.ts @@ -112,13 +112,15 @@ export function objectCacheReducer(state = initialState, action: ObjectCacheActi * the new state, with the object added, or overwritten. */ function addToObjectCache(state: ObjectCacheState, action: AddToObjectCacheAction): ObjectCacheState { + const existing = state[action.payload.objectToCache.self]; return Object.assign({}, state, { [action.payload.objectToCache.self]: { data: action.payload.objectToCache, timeAdded: action.payload.timeAdded, msToLive: action.payload.msToLive, requestHref: action.payload.requestHref, - isDirty: false + isDirty: false, + patches: (hasValue(existing) ? existing.patches : []) } }); } diff --git a/src/app/core/cache/object-cache.service.ts b/src/app/core/cache/object-cache.service.ts index d7bf59500c..f6b295afb4 100644 --- a/src/app/core/cache/object-cache.service.ts +++ b/src/app/core/cache/object-cache.service.ts @@ -90,7 +90,6 @@ export class ObjectCacheService { getBySelfLink(selfLink: string): Observable { return this.getEntry(selfLink).pipe( map((entry: ObjectCacheEntry) => { - // flatten two dimensional array const flatPatch: Operation[] = [].concat(...entry.patches); const patchedData = applyPatch(entry.data, flatPatch).newDocument; return Object.assign({}, entry, { data: patchedData }); @@ -218,7 +217,7 @@ export class ObjectCacheService { * @param {Operation[]} patch * list of operations to perform */ - private addPatch(uuid: string, patch: Operation[]) { + public addPatch(uuid: string, patch: Operation[]) { this.store.dispatch(new AddPatchObjectCacheAction(uuid, patch)); this.store.dispatch(new AddToSSBAction(uuid, RestRequestMethod.Patch)); } diff --git a/src/app/core/cache/server-sync-buffer.effects.ts b/src/app/core/cache/server-sync-buffer.effects.ts index 517c9837c2..d6c1941e86 100644 --- a/src/app/core/cache/server-sync-buffer.effects.ts +++ b/src/app/core/cache/server-sync-buffer.effects.ts @@ -1,4 +1,4 @@ -import { delay, exhaustMap, filter, first, map } from 'rxjs/operators'; +import { delay, exhaustMap, first, map, switchMap, tap } from 'rxjs/operators'; import { Inject, Injectable } from '@angular/core'; import { Actions, Effect, ofType } from '@ngrx/effects'; import { @@ -10,43 +10,77 @@ import { import { GLOBAL_CONFIG } from '../../../config'; import { GlobalConfig } from '../../../config/global-config.interface'; import { CoreState } from '../core.reducers'; -import { select, Store } from '@ngrx/store'; +import { Action, select, Store } from '@ngrx/store'; import { ServerSyncBufferEntry, ServerSyncBufferState } from './server-sync-buffer.reducer'; -import { of as observableOf } from 'rxjs'; +import { of as observableOf, combineLatest as observableCombineLatest } from 'rxjs'; import { RequestService } from '../data/request.service'; -import { PutRequest } from '../data/request.models'; +import { PutRequest, RestRequestMethod } from '../data/request.models'; +import { ObjectCacheService } from './object-cache.service'; +import { ApplyPatchObjectCacheAction } from './object-cache.actions'; +import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer'; +import { GenericConstructor } from '../shared/generic-constructor'; +import { hasValue } from '../../shared/empty.util'; +import { Observable } from 'rxjs/internal/Observable'; @Injectable() export class ObjectCacheEffects { @Effect() setTimeoutForServerSync = this.actions$ - .pipe(ofType(ServerSyncBufferActionTypes.ADD), + .pipe( + ofType(ServerSyncBufferActionTypes.ADD), exhaustMap((action: AddToSSBAction) => { const autoSyncConfig = this.EnvConfig.cache.autoSync; const timeoutInSeconds = autoSyncConfig.timePerMethod[action.type] || autoSyncConfig.defaultTime; - return observableOf(new CommitSSBAction(action.payload.method)).pipe(delay( timeoutInSeconds * 1000)) + return observableOf(new CommitSSBAction(action.payload.method)).pipe(delay(timeoutInSeconds * 1000)) }) ); @Effect() commitServerSyncBuffer = this.actions$ - .pipe(ofType(ServerSyncBufferActionTypes.COMMIT), - map((action: CommitSSBAction) => { - this.store.pipe( + .pipe( + ofType(ServerSyncBufferActionTypes.COMMIT), + switchMap((action: CommitSSBAction) => { + return this.store.pipe( select(serverSyncBufferSelector), - first() - ).subscribe((bufferState: ServerSyncBufferState) => { - bufferState.buffer - .filter((entry: ServerSyncBufferEntry) => entry.method === action.payload) - .forEach((entry: ServerSyncBufferEntry) => { - this.requestService.configure(new PutRequest(this.requestService.generateRequestId(), ,)) - }) - }); - return new EmptySSBAction(action.payload); + map((bufferState: ServerSyncBufferState) => { + const actions: Array> = bufferState.buffer + .filter((entry: ServerSyncBufferEntry) => { + /* If there's a request method, filter + If there's no filter, commit everything */ + if (hasValue(action.payload)) { + return entry.method === action.payload; + } + return true; + }) + .map((entry: ServerSyncBufferEntry) => { + if (entry.method === RestRequestMethod.Patch) { + return this.applyPatch(entry.href); + } else { + /* TODO other request stuff */ + } + }); + /* Add extra action to array, to make sure the ServerSyncBuffer is emptied afterwards */ + return observableCombineLatest(actions).pipe( + map((array) => array.push(new EmptySSBAction(action.payload))) + ); + }) + ) }) ); + private applyPatch(href: string): Observable { + const patchObject = this.objectCache.getBySelfLink(href); + return patchObject.pipe( + map((object) => { + const serializedObject = new DSpaceRESTv2Serializer(object.constructor as GenericConstructor<{}>).serialize(object); + this.requestService.configure(new PutRequest(this.requestService.generateRequestId(), href, serializedObject)); + return new ApplyPatchObjectCacheAction(href) + }) + ) + } + constructor(private actions$: Actions, private store: Store, private requestService: RequestService, + private objectCache: ObjectCacheService, @Inject(GLOBAL_CONFIG) private EnvConfig: GlobalConfig) { } diff --git a/src/app/core/data/base-response-parsing.service.ts b/src/app/core/data/base-response-parsing.service.ts index 050b3c2da5..374a1ea0a9 100644 --- a/src/app/core/data/base-response-parsing.service.ts +++ b/src/app/core/data/base-response-parsing.service.ts @@ -25,7 +25,6 @@ export abstract class BaseResponseParsingService { protected abstract toCache: boolean; protected process(data: any, requestHref: string): any { - if (isNotEmpty(data)) { if (hasNoValue(data) || (typeof data !== 'object')) { return data; diff --git a/src/app/core/data/collection-data.service.ts b/src/app/core/data/collection-data.service.ts index 7d1e463dbe..2642c4b5e6 100644 --- a/src/app/core/data/collection-data.service.ts +++ b/src/app/core/data/collection-data.service.ts @@ -22,8 +22,8 @@ export class CollectionDataService extends ComColDataService, protected cds: CommunityDataService, - protected objectCache: ObjectCacheService, - protected halService: HALEndpointService + protected halService: HALEndpointService, + protected objectCache: ObjectCacheService ) { super(); } diff --git a/src/app/core/data/comcol-data.service.spec.ts b/src/app/core/data/comcol-data.service.spec.ts index eb2e1bd1cf..ff05d73fff 100644 --- a/src/app/core/data/comcol-data.service.spec.ts +++ b/src/app/core/data/comcol-data.service.spec.ts @@ -29,8 +29,8 @@ class TestService extends ComColDataService { protected store: Store, protected EnvConfig: GlobalConfig, protected cds: CommunityDataService, - protected objectCache: ObjectCacheService, protected halService: HALEndpointService, + protected objectCache: ObjectCacheService, protected linkPath: string ) { super(); @@ -92,8 +92,8 @@ describe('ComColDataService', () => { store, EnvConfig, cds, - objectCache, halService, + objectCache, LINK_NAME ); } diff --git a/src/app/core/data/community-data.service.ts b/src/app/core/data/community-data.service.ts index b8e8bd5ce0..a9163fd6b9 100644 --- a/src/app/core/data/community-data.service.ts +++ b/src/app/core/data/community-data.service.ts @@ -29,8 +29,8 @@ export class CommunityDataService extends ComColDataService, - protected objectCache: ObjectCacheService, - protected halService: HALEndpointService + protected halService: HALEndpointService, + protected objectCache: ObjectCacheService ) { super(); } diff --git a/src/app/core/data/data.service.spec.ts b/src/app/core/data/data.service.spec.ts index add84818de..1bb051a9a6 100644 --- a/src/app/core/data/data.service.spec.ts +++ b/src/app/core/data/data.service.spec.ts @@ -9,6 +9,7 @@ import { HALEndpointService } from '../shared/hal-endpoint.service'; import { Observable } from 'rxjs'; import { FindAllOptions } from './request.models'; import { SortOptions, SortDirection } from '../cache/models/sort-options.model'; +import { ObjectCacheService } from '../cache/object-cache.service'; const LINK_NAME = 'test' @@ -17,117 +18,122 @@ class NormalizedTestObject extends NormalizedObject { } class TestService extends DataService { - constructor( - protected responseCache: ResponseCacheService, - protected requestService: RequestService, - protected rdbService: RemoteDataBuildService, - protected store: Store, - protected linkPath: string, - protected halService: HALEndpointService - ) { - super(); - } + constructor( + protected responseCache: ResponseCacheService, + protected requestService: RequestService, + protected rdbService: RemoteDataBuildService, + protected store: Store, + protected linkPath: string, + protected halService: HALEndpointService, + protected objectCache: ObjectCacheService + ) { + super(); + } - public getScopedEndpoint(scope: string): Observable { - throw new Error('getScopedEndpoint is abstract in DataService'); - } + public getScopedEndpoint(scope: string): Observable { + throw new Error('getScopedEndpoint is abstract in DataService'); + } } describe('DataService', () => { - let service: TestService; - let options: FindAllOptions; - const responseCache = {} as ResponseCacheService; - const requestService = {} as RequestService; - const halService = {} as HALEndpointService; - const rdbService = {} as RemoteDataBuildService; - const store = {} as Store; - const endpoint = 'https://rest.api/core'; + let service: TestService; + let options: FindAllOptions; + const responseCache = {} as ResponseCacheService; + const requestService = {} as RequestService; + const halService = {} as HALEndpointService; + const rdbService = {} as RemoteDataBuildService; + const objectCache = {} as ObjectCacheService; + const store = {} as Store; + const endpoint = 'https://rest.api/core'; - function initTestService(): TestService { - return new TestService( - responseCache, - requestService, - rdbService, - store, - LINK_NAME, - halService - ); - } + function initTestService(): TestService { + return new TestService( + responseCache, + requestService, + rdbService, + store, + LINK_NAME, + halService, + objectCache + ); + } - service = initTestService(); + service = initTestService(); - describe('getFindAllHref', () => { + describe('getFindAllHref', () => { - it('should return an observable with the endpoint', () => { - options = {}; + it('should return an observable with the endpoint', () => { + options = {}; - (service as any).getFindAllHref(endpoint).subscribe((value) => { - expect(value).toBe(endpoint); - } - ); - }); - - // getScopedEndpoint is not implemented in abstract DataService - it('should throw error if scopeID provided in options', () => { - options = { scopeID: 'somevalue' }; - - expect(() => { (service as any).getFindAllHref(endpoint, options) }) - .toThrowError('getScopedEndpoint is abstract in DataService'); - }); - - it('should include page in href if currentPage provided in options', () => { - options = { currentPage: 2 }; - const expected = `${endpoint}?page=${options.currentPage - 1}`; - - (service as any).getFindAllHref(endpoint, options).subscribe((value) => { - expect(value).toBe(expected); - }); - }); - - it('should include size in href if elementsPerPage provided in options', () => { - options = { elementsPerPage: 5 }; - const expected = `${endpoint}?size=${options.elementsPerPage}`; - - (service as any).getFindAllHref(endpoint, options).subscribe((value) => { - expect(value).toBe(expected); - }); - }); - - it('should include sort href if SortOptions provided in options', () => { - const sortOptions = new SortOptions('field1', SortDirection.ASC); - options = { sort: sortOptions}; - const expected = `${endpoint}?sort=${sortOptions.field},${sortOptions.direction}`; - - (service as any).getFindAllHref(endpoint, options).subscribe((value) => { - expect(value).toBe(expected); - }); - }); - - it('should include startsWith in href if startsWith provided in options', () => { - options = { startsWith: 'ab' }; - const expected = `${endpoint}?startsWith=${options.startsWith}`; - - (service as any).getFindAllHref(endpoint, options).subscribe((value) => { - expect(value).toBe(expected); - }); - }); - - it('should include all provided options in href', () => { - const sortOptions = new SortOptions('field1', SortDirection.DESC) - options = { - currentPage: 6, - elementsPerPage: 10, - sort: sortOptions, - startsWith: 'ab' - } - const expected = `${endpoint}?page=${options.currentPage - 1}&size=${options.elementsPerPage}` + - `&sort=${sortOptions.field},${sortOptions.direction}&startsWith=${options.startsWith}`; - - (service as any).getFindAllHref(endpoint, options).subscribe((value) => { - expect(value).toBe(expected); - }); - }) + (service as any).getFindAllHref(endpoint).subscribe((value) => { + expect(value).toBe(endpoint); + } + ); }); + // getScopedEndpoint is not implemented in abstract DataService + it('should throw error if scopeID provided in options', () => { + options = { scopeID: 'somevalue' }; + + expect(() => { + (service as any).getFindAllHref(endpoint, options) + }) + .toThrowError('getScopedEndpoint is abstract in DataService'); + }); + + it('should include page in href if currentPage provided in options', () => { + options = { currentPage: 2 }; + const expected = `${endpoint}?page=${options.currentPage - 1}`; + + (service as any).getFindAllHref(endpoint, options).subscribe((value) => { + expect(value).toBe(expected); + }); + }); + + it('should include size in href if elementsPerPage provided in options', () => { + options = { elementsPerPage: 5 }; + const expected = `${endpoint}?size=${options.elementsPerPage}`; + + (service as any).getFindAllHref(endpoint, options).subscribe((value) => { + expect(value).toBe(expected); + }); + }); + + it('should include sort href if SortOptions provided in options', () => { + const sortOptions = new SortOptions('field1', SortDirection.ASC); + options = { sort: sortOptions }; + const expected = `${endpoint}?sort=${sortOptions.field},${sortOptions.direction}`; + + (service as any).getFindAllHref(endpoint, options).subscribe((value) => { + expect(value).toBe(expected); + }); + }); + + it('should include startsWith in href if startsWith provided in options', () => { + options = { startsWith: 'ab' }; + const expected = `${endpoint}?startsWith=${options.startsWith}`; + + (service as any).getFindAllHref(endpoint, options).subscribe((value) => { + expect(value).toBe(expected); + }); + }); + + it('should include all provided options in href', () => { + const sortOptions = new SortOptions('field1', SortDirection.DESC) + options = { + currentPage: 6, + elementsPerPage: 10, + sort: sortOptions, + startsWith: 'ab' + } + const expected = `${endpoint}?page=${options.currentPage - 1}&size=${options.elementsPerPage}` + + `&sort=${sortOptions.field},${sortOptions.direction}&startsWith=${options.startsWith}`; + + (service as any).getFindAllHref(endpoint, options).subscribe((value) => { + expect(value).toBe(expected); + }); + }) + }); + }); diff --git a/src/app/core/data/data.service.ts b/src/app/core/data/data.service.ts index 1d0703bb47..f58868d2ce 100644 --- a/src/app/core/data/data.service.ts +++ b/src/app/core/data/data.service.ts @@ -14,6 +14,9 @@ import { RemoteData } from './remote-data'; import { FindAllOptions, FindAllRequest, FindByIDRequest, GetRequest } from './request.models'; import { RequestService } from './request.service'; import { NormalizedObject } from '../cache/models/normalized-object.model'; +import { compare, Operation } from 'fast-json-patch'; +import { ObjectCacheService } from '../cache/object-cache.service'; +import { DSpaceObject } from '../shared/dspace-object.model'; export abstract class DataService { protected abstract responseCache: ResponseCacheService; @@ -22,6 +25,7 @@ export abstract class DataService protected abstract store: Store; protected abstract linkPath: string; protected abstract halService: HALEndpointService; + protected abstract objectCache: ObjectCacheService; public abstract getScopedEndpoint(scope: string): Observable @@ -97,6 +101,15 @@ export abstract class DataService return this.rdbService.buildSingle(href); } + patch(href: string, operations: Operation[]) { + this.objectCache.addPatch(href, operations); + } + + update(object: DSpaceObject) { + const oldVersion = this.objectCache.getBySelfLink(object.self); + const operations = compare(oldVersion, object); + this.objectCache.addPatch(object.self, operations); + } // TODO implement, after the structure of the REST server's POST response is finalized // create(dso: DSpaceObject): Observable> { // const postHrefObs = this.getEndpoint(); diff --git a/src/app/core/data/dspace-object-data.service.spec.ts b/src/app/core/data/dspace-object-data.service.spec.ts index ef767c5d2d..cdddcb7ce6 100644 --- a/src/app/core/data/dspace-object-data.service.spec.ts +++ b/src/app/core/data/dspace-object-data.service.spec.ts @@ -6,6 +6,7 @@ import { HALEndpointService } from '../shared/hal-endpoint.service'; import { FindByIDRequest } from './request.models'; import { RequestService } from './request.service'; import { DSpaceObjectDataService } from './dspace-object-data.service'; +import { ObjectCacheService } from '../cache/object-cache.service'; describe('DSpaceObjectDataService', () => { let scheduler: TestScheduler; @@ -13,6 +14,7 @@ describe('DSpaceObjectDataService', () => { let halService: HALEndpointService; let requestService: RequestService; let rdbService: RemoteDataBuildService; + let objectCache: ObjectCacheService; const testObject = { uuid: '9b4f22f4-164a-49db-8817-3316b6ee5746' } as DSpaceObject; @@ -37,11 +39,13 @@ describe('DSpaceObjectDataService', () => { } }) }); + objectCache = {} as ObjectCacheService; service = new DSpaceObjectDataService( requestService, rdbService, - halService + halService, + objectCache ) }); diff --git a/src/app/core/data/dspace-object-data.service.ts b/src/app/core/data/dspace-object-data.service.ts index 09eea8a95f..5b92b1beef 100644 --- a/src/app/core/data/dspace-object-data.service.ts +++ b/src/app/core/data/dspace-object-data.service.ts @@ -10,6 +10,7 @@ import { HALEndpointService } from '../shared/hal-endpoint.service'; import { DataService } from './data.service'; import { RemoteData } from './remote-data'; import { RequestService } from './request.service'; +import { ObjectCacheService } from '../cache/object-cache.service'; /* tslint:disable:max-classes-per-file */ class DataServiceImpl extends DataService { @@ -20,7 +21,8 @@ class DataServiceImpl extends DataService protected requestService: RequestService, protected rdbService: RemoteDataBuildService, protected store: Store, - protected halService: HALEndpointService) { + protected halService: HALEndpointService, + protected objectCache: ObjectCacheService) { super(); } @@ -41,8 +43,9 @@ export class DSpaceObjectDataService { constructor( protected requestService: RequestService, protected rdbService: RemoteDataBuildService, - protected halService: HALEndpointService) { - this.dataService = new DataServiceImpl(null, requestService, rdbService, null, halService); + protected halService: HALEndpointService, + protected objectCache: ObjectCacheService) { + this.dataService = new DataServiceImpl(null, requestService, rdbService, null, halService, objectCache); } findById(uuid: string): Observable> { diff --git a/src/app/core/data/item-data.service.spec.ts b/src/app/core/data/item-data.service.spec.ts index 0a233d086c..df0be98f7a 100644 --- a/src/app/core/data/item-data.service.spec.ts +++ b/src/app/core/data/item-data.service.spec.ts @@ -8,6 +8,7 @@ import { CoreState } from '../core.reducers'; import { ItemDataService } from './item-data.service'; import { RequestService } from './request.service'; import { HALEndpointService } from '../shared/hal-endpoint.service'; +import { ObjectCacheService } from '../cache/object-cache.service'; describe('ItemDataService', () => { let scheduler: TestScheduler; @@ -16,6 +17,7 @@ describe('ItemDataService', () => { const requestService = {} as RequestService; const responseCache = {} as ResponseCacheService; const rdbService = {} as RemoteDataBuildService; + const objectCache = {} as ObjectCacheService; const store = {} as Store; const halEndpointService = {} as HALEndpointService; @@ -42,7 +44,8 @@ describe('ItemDataService', () => { rdbService, store, bs, - halEndpointService + halEndpointService, + objectCache ); } diff --git a/src/app/core/data/item-data.service.ts b/src/app/core/data/item-data.service.ts index dead4e5f48..7a0a28729c 100644 --- a/src/app/core/data/item-data.service.ts +++ b/src/app/core/data/item-data.service.ts @@ -17,6 +17,7 @@ import { URLCombiner } from '../url-combiner/url-combiner'; import { DataService } from './data.service'; import { RequestService } from './request.service'; import { HALEndpointService } from '../shared/hal-endpoint.service'; +import { ObjectCacheService } from '../cache/object-cache.service'; @Injectable() export class ItemDataService extends DataService { @@ -28,7 +29,8 @@ export class ItemDataService extends DataService { protected rdbService: RemoteDataBuildService, protected store: Store, private bs: BrowseService, - protected halService: HALEndpointService) { + protected halService: HALEndpointService, + protected objectCache: ObjectCacheService) { super(); } diff --git a/src/app/core/data/request.service.ts b/src/app/core/data/request.service.ts index 101825e3db..e944bcb19f 100644 --- a/src/app/core/data/request.service.ts +++ b/src/app/core/data/request.service.ts @@ -17,6 +17,7 @@ import { RequestConfigureAction, RequestExecuteAction } from './request.actions' import { GetRequest, RestRequest, RestRequestMethod } from './request.models'; import { RequestEntry } from './request.reducer'; +import { CommitSSBAction } from '../cache/server-sync-buffer.actions'; @Injectable() export class RequestService { @@ -123,4 +124,8 @@ export class RequestService { this.requestsOnTheirWayToTheStore = this.requestsOnTheirWayToTheStore.filter((pendingHref: string) => pendingHref !== request.href) }); } + + commit(method?: RestRequestMethod) { + this.store.dispatch(new CommitSSBAction(method)) + } } diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control.component.html b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control.component.html index d838a90f20..750ef721c2 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control.component.html +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control.component.html @@ -1,8 +1,8 @@ -
- diff --git a/src/app/shared/mocks/mock-form-service.ts b/src/app/shared/mocks/mock-form-service.ts index e92be02fcc..1f340f6df6 100644 --- a/src/app/shared/mocks/mock-form-service.ts +++ b/src/app/shared/mocks/mock-form-service.ts @@ -10,7 +10,12 @@ export function getMockFormService( getUniqueId: id$, resetForm: {}, validateAllFormFields: {}, - getForm: errors.pipe(map((err) => { return {data: {}, valid: true, errors: err} })), + getForm: errors.pipe( + map((err) => { + return { data: {}, valid: true, errors: err } + } + ) + ), removeForm: undefined, removeError: undefined, changeForm: undefined, diff --git a/src/app/shared/number-picker/number-picker.component.ts b/src/app/shared/number-picker/number-picker.component.ts index 0bc47e9438..bf3a7e9e7a 100644 --- a/src/app/shared/number-picker/number-picker.component.ts +++ b/src/app/shared/number-picker/number-picker.component.ts @@ -99,7 +99,7 @@ export class NumberPickerComponent implements OnInit, ControlValueAccessor { update(event) { try { - const i = Number.parseInt(event.target.value); + const i = Number.parseInt(event.target.value, 10); if (i >= this.min && i <= this.max) { this.value = i; diff --git a/tslint.json b/tslint.json index cd7ffadac9..b4f905d324 100644 --- a/tslint.json +++ b/tslint.json @@ -151,10 +151,10 @@ "use-input-property-decorator": true, "use-life-cycle-interface": false, "use-output-property-decorator": true, - "use-pipe-transform-interface": true, - "rxjs-collapse-imports": true, - "rxjs-pipeable-operators-only": true, - "rxjs-no-static-observable-methods": true, - "rxjs-proper-imports": true + "use-pipe-transform-interface": true +// "rxjs-collapse-imports": true, +// "rxjs-pipeable-operators-only": true, +// "rxjs-no-static-observable-methods": true, +// "rxjs-proper-imports": true } }