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
canActivate() { | |
if ( this.authService.isLoggedIn() ) { | |
return true; | |
} | |
this.router.navigate(['/']); | |
return false; | |
} |
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
public class EmbedConfig | |
{ | |
public string Id { get; set; } | |
public string EmbedUrl { get; set; } | |
public EmbedToken EmbedToken { get; set; } | |
public int MinutesToExpiration | |
{ |
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
public class TileEmbedConfig : EmbedConfig | |
{ | |
public string dashboardId { get; set; } | |
} |
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
getReportEmbedToken(): Observable<any> { | |
let apiUrl = environment.apiEndPoint + "/api/values/getReportEmbedToken?username=&roles="; | |
return this.http.get(apiUrl) | |
.pipe( | |
catchError(this.handleError) | |
); | |
} |
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
getDashboardEmbedToken(): Observable<any> { | |
let apiUrl = environment.apiEndPoint + "/api/values/getDashboardEmbedToken"; | |
return this.http.get(apiUrl) | |
.pipe( | |
catchError(this.handleError) | |
); | |
} |
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
getTileEmbedToken(): Observable<any> { | |
let apiUrl = environment.apiEndPoint + "/api/values/getTileEmbedToken"; | |
return this.http.get(apiUrl) | |
.pipe( | |
catchError(this.handleError) | |
); | |
} |
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
embedPowerBIDashboard() { | |
this.service.getDashboardEmbedToken().subscribe((res) => { | |
let response = res.json(); | |
let Token = response.EmbedToken; | |
const config = { | |
type: 'dashboard', | |
tokenType: pbi.models.TokenType.Embed, | |
id: response.Id, | |
embedUrl: response.EmbedUrl, | |
accessToken: Token.token, |
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
setTokenExpirationListener(tokenExpiration, | |
minutesToRefresh = 2){ | |
// get current time | |
var currentTime = Date.now(); | |
var expiration = Date.parse(tokenExpiration); | |
var safetyInterval = minutesToRefresh * 60 * 1000; | |
// time until token refresh in milliseconds | |
var timeout = expiration - currentTime - safetyInterval; |
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
updateToken() { | |
// Generate new EmbedToken | |
this.service.getDashboardEmbedToken() | |
.subscribe((res) => { | |
let Token = res.json(); | |
// Get a reference to the embedded report HTML element | |
var embedDashboard = <HTMLElement>document.getElementById( | |
'embedDashboard' | |
); |
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
import { Component, OnInit } from '@angular/core'; | |
import * as pbi from 'powerbi-client'; | |
@Component({ | |
selector: 'app-dashboard', | |
templateUrl: './dashboard.component.html', | |
styleUrls: ['./dashboard.component.less'] | |
}) | |
export class DashboardComponent implements OnInit { | |
OlderNewer