Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(dependency): update dsp-js to v2.0.0 and dsp-api to v13.2.0 #276

Merged
merged 4 commits into from Feb 9, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
9 changes: 6 additions & 3 deletions projects/dsp-ui/src/lib/viewer/services/user.service.ts
@@ -1,6 +1,7 @@
import { Inject, Injectable } from '@angular/core';
import { KnoraApiConnection, UserCache, UserResponse } from '@dasch-swiss/dsp-js';
import { AsyncSubject } from 'rxjs';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { DspApiConnectionToken } from '../../core/core.module';

@Injectable({
Expand All @@ -21,8 +22,10 @@ export class UserService {
*
* @param userIri the Iri identifying the user.
*/
getUser(userIri: string): AsyncSubject<UserResponse> {
return this._userCache.getUser(userIri);
getUser(userIri: string): Observable<UserResponse> {
return this._userCache.getUser(userIri).pipe(
map(user => user)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

map to the user contained in UserResponse?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the solution that worked. But if you (@tobiasschweizer) have time, feel free to checkout this branch and fix it as it should. Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw I wasn't sure about this AsyncSubject

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I'll take a look at it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have substituted all occurrences of AsyncSubject for Observable in the specs in d289137.

Before, the cache returned an AsyncSubject, now this is an Observable. However, an AsyncSubject is also an Observable, but now simply of can be used in the specs.

About the map: we could use it like this:

    getUser(userIri: string): Observable<ReadUser> {
        return this._userCache.getUser(userIri).pipe(
            map(userRes => userRes.user)
        );
    }

So instead of a UserResponse, the ReadUser would be returned directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tobiasschweizer. So, it's solved now? Would you like to "review" and approve?

);
}

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