Skip to content

Commit ded9e13

Browse files
committed
Fixed cape sdk angular standalone and minor fixes
1 parent 04c0d6d commit ded9e13

File tree

31 files changed

+115
-62
lines changed

31 files changed

+115
-62
lines changed

cape-dashboard/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services:
55
build:
66
context: .
77
args:
8-
BASE_HREF: /cape-dashboard
8+
BASE_HREF: /cape-dashboard/
99
ports:
1010
- '80:80'
1111
volumes:

cape-online-services/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"private": true,
1717
"dependencies": {
18-
"cape-sdk-angular": "1.0.36",
18+
"cape-sdk-angular": "1.0.38",
1919
"@akveo/ng2-completer": "^9.0.1",
2020
"@angular/animations": "11.2.12",
2121
"@angular/cdk": "11.2.11",

cape-playground/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
},
1717
"private": true,
1818
"dependencies": {
19-
"cape-sdk-angular": "1.0.36",
19+
"cape-sdk-angular": "1.0.38",
2020
"@akveo/ng2-completer": "^9.0.1",
2121
"@angular/animations": "11.2.12",
2222
"@angular/cdk": "11.2.11",

cape-playground/src/app/pages/services/mymeasurements/cholesterol/cholesterol.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, OnInit, ChangeDetectorRef } from '@angular/core';
1+
import { Component, OnInit, ChangeDetectorRef, OnDestroy } from '@angular/core';
22
import { NgxConfigureService } from 'ngx-configure';
33
import { TranslateService } from '@ngx-translate/core';
44
import { CapeSdkAngularService, ServiceLinkEvent, ConsentRecordEvent, SlStatusEnum, ConsentStatusEnum } from 'cape-sdk-angular';
@@ -63,7 +63,7 @@ const sampleChartData: any[] = [
6363
templateUrl: './cholesterol.component.html',
6464
styleUrls: ['./cholesterol.component.scss'],
6565
})
66-
export class CholesterolComponent implements OnInit {
66+
export class CholesterolComponent implements OnInit, OnDestroy {
6767
private config: any;
6868
public locale: string;
6969
public sdkUrl: string;

cape-sdk/cape-sdk-angular-standalone/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"private": true,
1717
"dependencies": {
18-
"cape-sdk-angular": "1.0.36",
18+
"cape-sdk-angular": "1.0.38",
1919
"@akveo/ng2-completer": "^9.0.1",
2020
"@angular/animations": "11.2.12",
2121
"@angular/cdk": "11.2.11",

cape-sdk/cape-sdk-angular-standalone/src/app/layout/header/header.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<div class="header-container">
22
<div class="logo-container">
3-
<a (click)="toggleSidebar()" href="#" class="sidebar-toggle">
3+
<!-- <a (click)="toggleSidebar()" href="#" class="sidebar-toggle">
44
<nb-icon icon="menu-2-outline"></nb-icon>
5-
</a>
5+
</a> -->
66
<a class="logo" href="#" (click)="navigateHome()"
77
><img class="p-1" src="assets\images\cape-logo.png" style="height: 64px" />
88
<!-- <span class="ml-3">{{ 'general.services.no_name_welcome' | translate: { name: user?.name } }}</span> -->
@@ -21,7 +21,7 @@
2121
<!--<nb-action class="control-item" icon="email-outline"></nb-action>-->
2222
<!-- <nb-action class="control-item" icon="bell-outline"></nb-action>-->
2323
<nb-action class="user-action">
24-
<nb-user [nbContextMenu]="loggedUserMenu" [onlyPicture]="userPictureOnly" [name]="user?.name" [title]="" [picture]="'assets/images/app/default_user.png'">
24+
<nb-user [nbContextMenu]="loggedUserMenu" [onlyPicture]="userPictureOnly" [name]="user.name" [title]="" [picture]="'assets/images/app/default_user.png'">
2525
</nb-user>
2626

2727
<ng-template #elseBlock>

cape-sdk/cape-sdk-angular-standalone/src/app/layout/header/header.component.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { Subject } from 'rxjs';
55
import { TranslateService } from '@ngx-translate/core';
66
import { OidcUserInformationService } from 'src/app/auth/services/oidc-user-information.service';
77
import { UserClaims } from 'src/app/auth/model/oidc';
8+
import { NgxConfigureService } from 'ngx-configure';
9+
import { AppConfig } from 'src/app/model/appConfig';
810

911
@Component({
1012
selector: 'ngx-header',
@@ -15,6 +17,7 @@ export class HeaderComponent implements OnInit, OnDestroy {
1517
private destroy$: Subject<void> = new Subject<void>();
1618
userPictureOnly: boolean = false;
1719
user: UserClaims;
20+
appConfig: AppConfig;
1821

1922
themes = [
2023
{
@@ -47,10 +50,18 @@ export class HeaderComponent implements OnInit, OnDestroy {
4750
private breakpointService: NbMediaBreakpointsService,
4851
private translateService: TranslateService,
4952
private userService: OidcUserInformationService,
50-
private cdr: ChangeDetectorRef
51-
) {}
53+
private cdr: ChangeDetectorRef,
54+
private configureService: NgxConfigureService
55+
) {
56+
this.appConfig = this.configureService.config;
57+
}
5258

5359
ngOnInit() {
60+
this.loggedUserMenu.push({
61+
title: this.translateService.instant('general.go_to_dashboard') as string,
62+
url: this.appConfig.system.dashboardUrl,
63+
target: '_blank',
64+
});
5465
this.loggedUserMenu.push({ title: this.translateService.instant('login.logout_button') as string, link: '' });
5566
this.currentTheme = this.themeService.currentTheme;
5667

cape-sdk/cape-sdk-angular-standalone/src/app/model/appConfig.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export interface Auth {
2424
export interface Services {
2525
sdkUrl: string;
2626
checkConsentAtOperator: boolean;
27+
showAdditionalConsentFormOptions: boolean;
2728
}
2829

2930
export interface I18n {

cape-sdk/cape-sdk-angular-standalone/src/app/pages/services/services.component.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AfterViewInit, Component, OnInit } from '@angular/core';
1+
import { AfterViewInit, Component, OnDestroy, OnInit } from '@angular/core';
22
import { Router, ActivatedRoute, NavigationExtras, Params } from '@angular/router';
33
import { NgxConfigureService } from 'ngx-configure';
44
import { NbDialogService } from '@nebular/theme';
@@ -12,16 +12,19 @@ import {
1212
CapeSdkDialogService,
1313
dialogType,
1414
ConsentFormComponent,
15+
ConsentRecordEvent,
1516
} from 'cape-sdk-angular';
1617
// import { NbAuthService } from '@nebular/auth';
1718
import { AppConfig } from 'src/app/model/appConfig';
1819
import { ErrorDialogService } from '../error-dialog/error-dialog.service';
20+
import { takeUntil } from 'rxjs/operators';
21+
import { Subject } from 'rxjs';
1922
@Component({
2023
selector: 'app-services',
2124
templateUrl: './services.component.html',
2225
styleUrls: ['./services.component.scss'],
2326
})
24-
export class ServicesComponent implements AfterViewInit {
27+
export class ServicesComponent implements AfterViewInit, OnDestroy {
2528
config: AppConfig;
2629
private locale: string;
2730

@@ -42,6 +45,7 @@ export class ServicesComponent implements AfterViewInit {
4245
public checkConsentAtOperator: boolean;
4346
public showConsentAdditionalOptions = false;
4447
consentRecord: ConsentRecordSigned;
48+
private unsubscribe: Subject<void> = new Subject();
4549

4650
constructor(
4751
private configService: NgxConfigureService,
@@ -81,6 +85,11 @@ export class ServicesComponent implements AfterViewInit {
8185

8286
this.checkAndGo(this.serviceId, this.serviceName, this.serviceRole, queryParams.purposeId);
8387
}
88+
89+
// this.capeService.consentRecordStatus$.pipe(takeUntil(this.unsubscribe)).subscribe(async (event) => {
90+
// event = event as ConsentRecordEvent;
91+
// if (event?.serviceId === this.serviceId) this.capeConsentStatus = event.status.consent_status;
92+
// });
8493
}
8594

8695
checkAndGo = async (serviceId: string, serviceName: string, serviceRole: RoleEnum, purposeId: string) => {
@@ -234,7 +243,7 @@ export class ServicesComponent implements AfterViewInit {
234243
sdkUrl: this.sdkUrl,
235244
consentForm: await this.capeService.fetchConsentForm(this.sdkUrl, this.serviceAccountId, serviceId, this.operatorId, purposeId, serviceRole),
236245
locale: sessionStorage.getItem('currentLocale') as string,
237-
showAdditionalOptions: true,
246+
showAdditionalOptions: this.config.services.showAdditionalConsentFormOptions,
238247
},
239248
})
240249
.onClose.subscribe((accepted) => {
@@ -244,4 +253,9 @@ export class ServicesComponent implements AfterViewInit {
244253
this.errorDialogService.openErrorDialog(error);
245254
}
246255
}
256+
257+
ngOnDestroy() {
258+
this.unsubscribe.next();
259+
this.unsubscribe.complete();
260+
}
247261
}

cape-sdk/cape-sdk-angular-standalone/src/assets/config.prod.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
},
1616
"services": {
1717
"sdkUrl": "https://www.cape-suite.eu/cape-service-sdk",
18-
"checkConsentAtOperator": "true"
18+
"checkConsentAtOperator": "true",
19+
"showAdditionalConsentFormOptions": false
1920
},
2021
"i18n": {
2122
"locale": "en"

0 commit comments

Comments
 (0)