fixing reconnection.

related #381
This commit is contained in:
Jason Kulatunga 2024-01-17 19:23:14 -08:00
parent b469fbbe7b
commit 98b06df9a2
No known key found for this signature in database
2 changed files with 13 additions and 4 deletions

View File

@ -18,7 +18,7 @@
</button> </button>
</div> </div>
<div *ngIf="modalSelectedSourceListItem.source?.platform_type != 'fasten'; else fastenSourceDescription" class="modal-body"> <div *ngIf="modalSelectedSourceListItem?.source?.platform_type != 'fasten'; else fastenSourceDescription" class="modal-body">
<h6>Manage Source</h6> <h6>Manage Source</h6>
<p>Existing connections can be "Synced", "Reconnected" or "Deleted"</p> <p>Existing connections can be "Synced", "Reconnected" or "Deleted"</p>
<ul> <ul>
@ -43,7 +43,7 @@
<a routerLink="/explore/{{modalSelectedSourceListItem?.source?.id}}" (click)="modal.close()" class="btn btn-indigo mr-auto">Explore</a> <a routerLink="/explore/{{modalSelectedSourceListItem?.source?.id}}" (click)="modal.close()" class="btn btn-indigo mr-auto">Explore</a>
<div *ngIf="modalSelectedSourceListItem.source?.platform_type != 'fasten'" class="d-inline-block" ngbDropdown> <div *ngIf="modalSelectedSourceListItem?.source?.platform_type != 'fasten'" class="d-inline-block" ngbDropdown>
<button <button
type="button" type="button"
class="btn btn-outline-indigo" class="btn btn-outline-indigo"
@ -52,8 +52,8 @@
Actions Actions
</button> </button>
<div ngbDropdownMenu aria-labelledby="dropdownManual"> <div ngbDropdownMenu aria-labelledby="dropdownManual">
<button *ngIf="modalSelectedSourceListItem.source?.platform_type != 'manual'" ngbDropdownItem (click)="sourceSyncHandler(modalSelectedSourceListItem.source)" type="button" class="btn btn-indigo">Sync</button> <button *ngIf="modalSelectedSourceListItem?.source?.platform_type != 'manual'" ngbDropdownItem (click)="sourceSyncHandler(modalSelectedSourceListItem.source)" type="button" class="btn btn-indigo">Sync</button>
<button *ngIf="modalSelectedSourceListItem.source?.platform_type != 'manual'" ngbDropdownItem (click)="sourceReconnectHandler(modalSelectedSourceListItem)" type="button" class="btn btn-danger">Reconnect</button> <button *ngIf="modalSelectedSourceListItem?.source?.platform_type != 'manual'" ngbDropdownItem (click)="sourceReconnectHandler(modalSelectedSourceListItem)" type="button" class="btn btn-danger">Reconnect</button>
<button ngbDropdownItem (click)="sourceDeleteHandler()" type="button" class="btn btn-danger">Delete</button> <button ngbDropdownItem (click)="sourceDeleteHandler()" type="button" class="btn btn-danger">Delete</button>
</div> </div>
</div> </div>

View File

@ -383,12 +383,21 @@ export class MedicalSourcesConnectedComponent implements OnInit {
let endpointId = selectedSourceListItem?.source?.endpoint_id let endpointId = selectedSourceListItem?.source?.endpoint_id
this.lighthouseApi.getLighthouseSource(endpointId) this.lighthouseApi.getLighthouseSource(endpointId)
.then(async (sourceMetadata: LighthouseSourceMetadata) => { .then(async (sourceMetadata: LighthouseSourceMetadata) => {
if(selectedSourceListItem?.source){
sourceMetadata.brand_id = selectedSourceListItem.source.brand_id
sourceMetadata.portal_id = selectedSourceListItem.source.portal_id
}
console.log(sourceMetadata); console.log(sourceMetadata);
let authorizationUrl = await this.lighthouseApi.generateSourceAuthorizeUrl(sourceMetadata, selectedSourceListItem.source.id) let authorizationUrl = await this.lighthouseApi.generateSourceAuthorizeUrl(sourceMetadata, selectedSourceListItem.source.id)
console.log('authorize url:', authorizationUrl.toString()); console.log('authorize url:', authorizationUrl.toString());
// redirect to lighthouse with uri's (or open a new window in desktop mode) // redirect to lighthouse with uri's (or open a new window in desktop mode)
this.lighthouseApi.redirectWithOriginAndDestination(authorizationUrl.toString(), sourceMetadata).subscribe((desktopRedirectData) => { this.lighthouseApi.redirectWithOriginAndDestination(authorizationUrl.toString(), sourceMetadata).subscribe((desktopRedirectData) => {
if(!desktopRedirectData){
return //wait for redirect
}
//Note: this code will only run in Desktop mode (with popups) //Note: this code will only run in Desktop mode (with popups)
//in non-desktop environments, the user is redirected in the same window, and this code is never executed. //in non-desktop environments, the user is redirected in the same window, and this code is never executed.