-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathembedding.js
More file actions
41 lines (32 loc) · 1.15 KB
/
Copy pathembedding.js
File metadata and controls
41 lines (32 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
var embedding = (function(powerbi) {
let embedUrl = "https://app.powerbigov.us/reportEmbed?reportId=b8735bda-e087-483c-b534-d7015e22d33d&config=eyJjbHVzdGVyVXJsIjoiaHR0cHM6Ly9XQUJJLVVTLUdPVi1JT1dBLXJlZGlyZWN0LmFuYWx5c2lzLnVzZ292Y2xvdWRhcGkubmV0IiwiZW1iZWRGZWF0dXJlcyI6eyJtb2Rlcm5FbWJlZCI6dHJ1ZX19";
let reportId = "b8735bda-e087-483c-b534-d7015e22d33d";
function getAccessToken() {
let accessTokenInput = document.getElementById("accessToken");
return accessTokenInput.value;
}
function getConfigurations(filters) {
let accessToken = getAccessToken();
const reportConfig = {
type: 'report',
accessToken: accessToken,
embedUrl: embedUrl,
id: reportId,
filters: filters
};
return reportConfig;
}
function embed(filters) {
let reportContainer = document.getElementById("reportContainer");
let reportConfig = getConfigurations(filters)
let report = powerbi.embed(reportContainer, reportConfig);
return report
}
return {
/**
* @param {pbi.models.IFilter[]} filters
* @returns {pbi.Report} the report that was embedded
*/
embed: embed
};
})(window.powerbi);