-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2519 from sap-labs-france/master-qa
Merge master-qa
- Loading branch information
Showing
24 changed files
with
301 additions
and
21 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/app/authentication/mercedes-data-usage/authentication-mercedes-data-usage.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<div class="wrapper wrapper-full-page"> | ||
<div class="page-header register-page header-filter" filter-color="black"> | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-md-12 ml-auto mr-auto mt-5 pt-5 eula-page"> | ||
<div>{{"authentication.mercedes_data_usage" | translate}}</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
16 changes: 16 additions & 0 deletions
16
src/app/authentication/mercedes-data-usage/authentication-mercedes-data-usage.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Component, } from '@angular/core'; | ||
|
||
import { SpinnerService } from '../../services/spinner.service'; | ||
|
||
@Component({ | ||
templateUrl: './authentication-mercedes-data-usage.component.html', | ||
}) | ||
export class AuthenticationMercedesDataUsageComponent { | ||
|
||
public constructor( | ||
private spinnerService: SpinnerService, | ||
) { | ||
this.spinnerService.hide(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/app/pages/users/connections/mercedes/mercedes-user-connection.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<div class="main-content"> | ||
</div> |
65 changes: 65 additions & 0 deletions
65
src/app/pages/users/connections/mercedes/mercedes-user-connection.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { Component } from '@angular/core'; | ||
import { ActivatedRoute, Router } from '@angular/router'; | ||
import { IntegrationConnectionType } from 'types/Connection'; | ||
|
||
import { CentralServerService } from '../../../../services/central-server.service'; | ||
import { MessageService } from '../../../../services/message.service'; | ||
import { WindowService } from '../../../../services/window.service'; | ||
import { AbstractTabComponent } from '../../../../shared/component/abstract-tab/abstract-tab.component'; | ||
import { ActionResponse } from '../../../../types/DataResult'; | ||
import { RestResponse } from '../../../../types/GlobalType'; | ||
import { Utils } from '../../../../utils/Utils'; | ||
|
||
@Component({ | ||
templateUrl: 'mercedes-user-connection.component.html', | ||
}) | ||
export class MercedesUserConnectionComponent extends AbstractTabComponent { | ||
|
||
public constructor( | ||
private centralServerService: CentralServerService, | ||
private messageService: MessageService, | ||
private router: Router, | ||
activatedRoute: ActivatedRoute, | ||
windowService: WindowService) { | ||
super(activatedRoute, windowService, [], false); | ||
|
||
if (this.activatedRoute.snapshot.queryParams['state']) { | ||
const state = JSON.parse(this.activatedRoute.snapshot.queryParams['state']); | ||
if (state.connector === IntegrationConnectionType.MERCEDES) { | ||
this.createMercedesConnection(state); | ||
} | ||
} | ||
} | ||
|
||
private createMercedesConnection(state: any) { | ||
if (this.activatedRoute.snapshot.queryParams['code']) { | ||
const payload = { | ||
userId: state.userId, | ||
connectorId: IntegrationConnectionType.MERCEDES, | ||
data: | ||
{ | ||
code: this.activatedRoute.snapshot.queryParams['code'], | ||
redirectUri: this.windowService.getOrigin() + this.windowService.getPath(), | ||
}, | ||
}; | ||
this.centralServerService.createIntegrationConnection(payload).subscribe((response: ActionResponse) => { | ||
if (response.status === RestResponse.SUCCESS) { | ||
this.messageService.showSuccessMessage('settings.car_connector.mercedes.link_success'); | ||
} else { | ||
Utils.handleError(JSON.stringify(response), | ||
this.messageService, 'settings.car_connector.mercedes.link_error'); | ||
} | ||
this.router.navigate(['/users/profile'], { fragment: 'connections' }); | ||
}, (error) => { | ||
Utils.handleError(JSON.stringify(error), | ||
this.messageService, 'settings.car_connector.mercedes.link_error'); | ||
this.router.navigate(['/users/profile'], { fragment: 'connections' }); | ||
}, | ||
); | ||
} else if (this.activatedRoute.snapshot.queryParams['error']) { | ||
Utils.handleError(this.activatedRoute.snapshot.queryParams['error'], | ||
this.messageService, 'settings.car_connector.mercedes.link_error'); | ||
this.router.navigate(['/users/profile'], { fragment: 'connections' }); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.