Skip to content

Commit

Permalink
chore(dependency): update dsp-js to v2.0.0 and dsp-api to v13.2.0 (#276)
Browse files Browse the repository at this point in the history
* chore(dependency): update dsp-js to v2.0.0 and dsp-ap to v13.2.0

* fix(viewer): update user cache

* refactor(viewer): delete unused import

* refactor (user service): make AsyncSubject and Observable

Co-authored-by: Tobias Schweizer <t.schweizer@unibas.ch>
  • Loading branch information
André Kilchenmann and Tobias Schweizer committed Feb 9, 2021
1 parent dd35b07 commit d03aef7
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 41 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -46,7 +46,7 @@
"@angular/platform-browser-dynamic": "~9.1.2",
"@angular/router": "~9.1.2",
"@ckeditor/ckeditor5-angular": "^1.2.3",
"@dasch-swiss/dsp-js": "^1.3.0",
"@dasch-swiss/dsp-js": "^2.0.0",
"ckeditor5-custom-build": "github:dasch-swiss/ckeditor_custom_build",
"jdnconvertiblecalendar": "^0.0.5",
"jdnconvertiblecalendardateadapter": "^0.0.13",
Expand Down
2 changes: 1 addition & 1 deletion projects/dsp-ui/package.json
Expand Up @@ -21,7 +21,7 @@
"@angular/core": "^9.0.0",
"@angular/material": "^9.0.0",
"@angular/cdk": "^9.0.0",
"@dasch-swiss/dsp-js": "^1.3.0",
"@dasch-swiss/dsp-js": "^2.0.0",
"jdnconvertiblecalendar": "^0.0.5",
"jdnconvertiblecalendardateadapter": "^0.0.13",
"ngx-color-picker": "^10.0.1",
Expand Down
Expand Up @@ -36,11 +36,10 @@ import {
UpdateIntValue,
UpdateResource,
UpdateValue,
UserResponse,
ValuesEndpointV2,
WriteValueResponse
} from '@dasch-swiss/dsp-js';
import { AsyncSubject, of, throwError } from 'rxjs';
import { of, throwError } from 'rxjs';
import { AjaxError } from 'rxjs/ajax';
import { DspApiConnectionToken } from '../../../core/core.module';
import { UserService } from '../../services/user.service';
Expand Down Expand Up @@ -418,11 +417,7 @@ describe('DisplayEditComponent', () => {
() => {
const user = MockUsers.mockUser();

const subj: AsyncSubject<UserResponse> = new AsyncSubject();
subj.next(user.body);
subj.complete();

return subj;
return of(user.body);
}
);

Expand Down
10 changes: 3 additions & 7 deletions projects/dsp-ui/src/lib/viewer/services/user.service.spec.ts
@@ -1,8 +1,8 @@
import { async, TestBed } from '@angular/core/testing';
import { MockUsers, UserResponse } from '@dasch-swiss/dsp-js';
import { AsyncSubject } from 'rxjs';
import { MockUsers } from '@dasch-swiss/dsp-js';
import { DspApiConnectionToken } from '../../core/core.module';
import { UserService } from './user.service';
import { of } from 'rxjs';

describe('UserService', () => {
let service: UserService;
Expand Down Expand Up @@ -31,11 +31,7 @@ describe('UserService', () => {
() => {
const user = MockUsers.mockUser();

const subj: AsyncSubject<UserResponse> = new AsyncSubject();
subj.next(user.body);
subj.complete();

return subj;
return of(user.body);
}
);

Expand Down
4 changes: 2 additions & 2 deletions projects/dsp-ui/src/lib/viewer/services/user.service.ts
@@ -1,6 +1,6 @@
import { Inject, Injectable } from '@angular/core';
import { KnoraApiConnection, UserCache, UserResponse } from '@dasch-swiss/dsp-js';
import { AsyncSubject } from 'rxjs';
import { Observable } from 'rxjs';
import { DspApiConnectionToken } from '../../core/core.module';

@Injectable({
Expand All @@ -21,7 +21,7 @@ export class UserService {
*
* @param userIri the Iri identifying the user.
*/
getUser(userIri: string): AsyncSubject<UserResponse> {
getUser(userIri: string): Observable<UserResponse> {
return this._userCache.getUser(userIri);
}

Expand Down
Expand Up @@ -13,14 +13,12 @@ import {
MockResource,
MockUsers,
ProjectsEndpointAdmin,
ReadResource,
UserResponse
ReadResource
} from '@dasch-swiss/dsp-js';
import { DspApiConnectionToken } from 'projects/dsp-ui/src/lib/core';
import { AsyncSubject } from 'rxjs';
import { of } from 'rxjs/internal/observable/of';
import { UserService } from '../../../services/user.service';
import { PropertyToolbarComponent } from './property-toolbar.component';
import { of } from 'rxjs';

/**
* Test host component to simulate parent component
Expand Down Expand Up @@ -121,11 +119,7 @@ describe('PropertyToolbarComponent', () => {
() => {
const user = MockUsers.mockUser();

const subj: AsyncSubject<UserResponse> = new AsyncSubject();
subj.next(user.body);
subj.complete();

return subj;
return of(user.body);
}
);

Expand Down
14 changes: 4 additions & 10 deletions src/app/viewer-playground/viewer-playground.component.spec.ts
Expand Up @@ -7,14 +7,12 @@ import {
MockUsers,
ProjectsEndpointAdmin,
ReadResource,
ResourcesEndpointV2,
UserResponse,
ResourcesEndpointV2
} from '@dasch-swiss/dsp-js';
import { DspApiConnectionToken, DspViewerModule, UserService } from '@dasch-swiss/dsp-ui';
import { of } from 'rxjs/internal/observable/of';
import { map } from 'rxjs/internal/operators/map';
import { ViewerPlaygroundComponent } from './viewer-playground.component';
import { AsyncSubject } from 'rxjs';
import { of } from 'rxjs';
import { map } from 'rxjs/operators';

describe('ViewerPlaygroundComponent', () => {
let component: ViewerPlaygroundComponent;
Expand Down Expand Up @@ -89,11 +87,7 @@ describe('ViewerPlaygroundComponent', () => {
() => {
const user = MockUsers.mockUser();

const subj: AsyncSubject<UserResponse> = new AsyncSubject();
subj.next(user.body);
subj.complete();

return subj;
return of(user.body);
}
);

Expand Down
2 changes: 1 addition & 1 deletion vars.mk
@@ -1 +1 @@
API_VERSION := v13.1.1
API_VERSION := v13.2.0

0 comments on commit d03aef7

Please sign in to comment.