Skip to content

Commit 5de3946

Browse files
committed
merge and build
2 parents 284b9a4 + 888685f commit 5de3946

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+14284
-204
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ docs
55
typings/
66
tmp
77
.publish
8-
npm-debug.log*
8+
npm-debug.log*
9+
dist/*.js.map

demo/code-demo/anyReport.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ <h3>Embed your own report</h3>
66
<div class="settings">
77
<div id="EmbedWithSpecificReportDiv">
88
<div class="line">
9-
<h5>Prerequisites</h5>
9+
<h5>Prerequisites:</h5>
1010
<ul>
1111
<li>A workspace in the <a href="https://azure.microsoft.com/en-us/documentation/articles/power-bi-embedded-get-started/">Power BI embedded service.</a></li>
1212
<li>Power BI report imported to your workspace.</li>
1313
</ul>
1414
</div>
1515

1616
<div class="line">
17-
<h5>Instructions to generate an embed App Token</h5>
18-
Once you have improted a report into Power BI workspace, you are ready to embed it.
17+
<h5>Instructions to generate an Embed Token</h5>
18+
Once you have imported a report into Power BI workspace, you are ready to embed it.
1919

20-
To embed a report, you need to get an embed App Token. You can create this token in multiple ways.
20+
To embed a report, you need to get an Embed Token. You can create this token in multiple ways.
2121
<ul>
2222
<li>Using <a href="https://github.com/Microsoft/PowerBI-cli">PowerBI-Cli</a> tool.</li>
2323
<li>From .Net Code using <a href="http://www.nuget.org/packages/Microsoft.PowerBI.Core/">Microsoft.PowerBI.Core</a> package.</li>
@@ -26,11 +26,11 @@ <h5>Instructions to generate an embed App Token</h5>
2626
</div>
2727

2828
<div id="authorizeParameterDiv" class="line">
29-
<h5>Enter embed details</h5>
29+
<h5>Enter embed details:</h5>
3030

3131
<table id="user-embed-details">
3232
<tr>
33-
<td class="td-field-name">Embed App Token</td>
33+
<td class="td-field-name">Embed Token</td>
3434
<td><input type="text" id="auth_txtAccessToken" onchange="UpdateSession(this, SessionKeys.AccessToken);" /></td>
3535
</tr>
3636
<tr>

demo/code-demo/scripts/codesamples.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -496,28 +496,28 @@ function _Report_Reload() {
496496
// Reload the displayed report
497497
report.reload()
498498
.then(function (result) {
499-
Log.log(result);
499+
Log.logText("Reloaded");
500500
})
501501
.catch(function (errors) {
502502
Log.log(errors);
503503
});
504504
}
505505

506506
function _Report_Refresh() {
507-
// Get a reference to the embedded report HTML element
508-
var reportContainer = $('#reportContainer')[0];
507+
// Get a reference to the embedded report HTML element
508+
var reportContainer = $('#reportContainer')[0];
509509

510-
// Get a reference to the embedded report.
510+
// Get a reference to the embedded report.
511511
report = powerbi.get(reportContainer);
512512

513513
// Refresh the displayed report
514514
report.refresh()
515515
.then(function (result) {
516-
Log.log(result);
516+
Log.logText("Refreshed");
517517
})
518518
.catch(function (errors) {
519519
Log.log(errors);
520-
});
520+
});
521521
}
522522

523523
function _Report_FullScreen() {

demo/code-demo/scripts/function_mapping.js

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,21 @@ function datasetNotSupported() {
2424
Log.logText('Operation not supported for dataset')
2525
}
2626

27-
function IsSaveMock(func) {
28-
return ((func.name === '_Report_save' || func.name === '_Report_saveAs') && (
27+
function IsSaveMock(funcName) {
28+
return ((funcName === '_Report_save' || funcName === '_Report_saveAs') && (
2929
_session.embedId === 'c52af8ab-0468-4165-92af-dc39858d66ad' /*Sample Report*/ ||
3030
_session.embedId === '1ee0b264-b280-43f1-bbb7-9d8bd2d03a78' /*Sample dataset*/ ));
3131
}
3232

33-
function IsBasicMock(func) {
34-
return ((func.name === '_Embed_BasicEmbed' || func.name === '_Embed_BasicEmbed_EditMode') && _session.embedId === 'c52af8ab-0468-4165-92af-dc39858d66ad');
33+
function IsBasicMock(funcName) {
34+
return ((funcName === '_Embed_BasicEmbed' || funcName === '_Embed_BasicEmbed_EditMode') && _session.embedId === 'c52af8ab-0468-4165-92af-dc39858d66ad');
3535
}
3636

37-
function IsCreateMock(func) {
38-
return (func.name === '_Embed_Create' && _session.embedId === '1ee0b264-b280-43f1-bbb7-9d8bd2d03a78');
37+
function IsCreateMock(funcName) {
38+
return (funcName === '_Embed_Create' && _session.embedId === '1ee0b264-b280-43f1-bbb7-9d8bd2d03a78');
3939
}
4040

41-
function IsNotSupported(func) {
41+
function IsNotSupported(funcName) {
4242
if (powerbi.embeds.length === 0) {
4343
return false
4444
}
@@ -49,14 +49,27 @@ function IsNotSupported(func) {
4949
return false;
5050
}
5151

52-
var runFunc = mockDict[func.name];
52+
var runFunc = mockDict[funcName];
5353
return (runFunc && runFunc === datasetNotSupported) ? true : false;
5454
}
5555

56-
function IsMock(func) {
57-
return (IsBasicMock(func) || IsSaveMock(func) || IsCreateMock(func) || IsNotSupported(func));
56+
function IsMock(funcName) {
57+
return (IsBasicMock(funcName) || IsSaveMock(funcName) || IsCreateMock(funcName) || IsNotSupported(funcName));
5858
}
5959

6060
function mapFunc(func) {
61-
return IsMock(func) ? mockDict[func.name] : func;
61+
var funcName = getFuncName(func);
62+
return IsMock(funcName) ? mockDict[funcName] : func;
63+
}
64+
65+
function getFuncName(func) {
66+
var funcName = func.name;
67+
68+
if (!funcName)
69+
{
70+
// in IE, func.name is invalid method. so, function name should be extracted manually.
71+
funcName = func.toString().match(/^function\s*([^\s(]+)/)[1];
72+
}
73+
74+
return funcName;
6275
}

demo/package-lock.json

Lines changed: 236 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"es6-promise": "^3.2.2",
3535
"bootstrap": "^3.3.6",
3636
"jquery": "^3.1.0",
37-
"powerbi-client": "^2.3.0",
37+
"powerbi-client": "^2.3",
3838
"http-server": "^0.9.0",
3939
"syntaxhighlighter": "4.0.1"
4040
},

0 commit comments

Comments
 (0)