Skip to content

Commit e2ec9fd

Browse files
authored
Merge branch 'dev' into t-naabus-refresh
2 parents 36eed6b + 41899b4 commit e2ec9fd

18 files changed

+4194
-74
lines changed

NOTICE.txt

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Microsoft.PowerBI.JavaScript
2+
3+
THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
4+
Do Not Translate or Localize
5+
6+
This project incorporates components from the projects listed below. The original copyright notices and the licenses under which Microsoft received such components are set forth below. Microsoft reserves all rights not expressly granted herein, whether by implication, estoppel or otherwise.
7+
8+
1. SyntaxHighlighter (https://github.com/syntaxhighlighter/syntaxhighlighter)
9+
10+
Copyright (c) 2004-2013, Alex Gorbatchev
11+
12+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
13+
14+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

demo/LICENSE.txt

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Microsoft.PowerBI.JavaScript
2+
3+
Copyright (c) Microsoft Corporation
4+
5+
All rights reserved.
6+
7+
MIT License
8+
9+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

demo/NOTICE.txt

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Microsoft.PowerBI.JavaScript
2+
3+
THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
4+
Do Not Translate or Localize
5+
6+
This project incorporates components from the projects listed below. The original copyright notices and the licenses under which Microsoft received such components are set forth below. Microsoft reserves all rights not expressly granted herein, whether by implication, estoppel or otherwise.
7+
8+
1. SyntaxHighlighter (https://github.com/syntaxhighlighter/syntaxhighlighter)
9+
10+
Copyright (c) 2004-2013, Alex Gorbatchev
11+
12+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
13+
14+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

demo/code-demo/anyReport.html

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<div id="userReport" class="line">
2+
<div class="pageTitle">
3+
<h3>Embed your own report</h3>
4+
<h8>You can also embed your own report by following the instructions below.</h8>
5+
</div>
6+
<div class="settings">
7+
<div id="EmbedWithSpecificReportDiv">
8+
<div class="line">
9+
<h5>Prerequisites</h5>
10+
<ul>
11+
<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>
12+
<li>Power BI report imported to your workspace.</li>
13+
</ul>
14+
</div>
15+
16+
<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.
19+
20+
To embed a report, you need to get an embed App Token. You can create this token in multiple ways.
21+
<ul>
22+
<li>Using <a href="https://github.com/Microsoft/PowerBI-cli">PowerBI-Cli</a> tool.</li>
23+
<li>From .Net Code using <a href="http://www.nuget.org/packages/Microsoft.PowerBI.Core/">Microsoft.PowerBI.Core</a> package.</li>
24+
<li>From NodeJS code using <a href="https://github.com/Microsoft/PowerBI-Node">powerbi-api</a> package.</li>
25+
</ul>
26+
</div>
27+
28+
<div id="authorizeParameterDiv" class="line">
29+
<h5>Enter embed details</h5>
30+
31+
<table id="user-embed-details">
32+
<tr>
33+
<td class="td-field-name">Embed App Token</td>
34+
<td><input type="text" id="auth_txtAccessToken" onchange="UpdateSession(this, SessionKeys.AccessToken);" /></td>
35+
</tr>
36+
<tr>
37+
<td class="td-field-name">Embed URL</td>
38+
<td>
39+
<input type="text" id="auth_txtReportEmbed" onchange="UpdateSession(this, SessionKeys.EmbedUrl);" />
40+
</td>
41+
</tr>
42+
<tr>
43+
<td class="td-field-name">Report Id</td>
44+
<td><input type="text" id="auth_txtEmbedReportId" onchange="UpdateSession(this, SessionKeys.EmbedId);"/></td>
45+
</tr>
46+
</table>
47+
<button id="nextStep" class="blueButton" onclick="OpenEmbedStepFromUserSettings()">Next step - Embed</button>
48+
</div>
49+
50+
</div>
51+
</div>
52+
</div>

demo/code-demo/code_area.html

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
<div class="editorTitle">Code</div>
33
<div class="textAreaControls">
44
<button id="btnRunCode" class="textAreaControl">
5-
<img src="images\run.png"/> Run
5+
<img src="images\run.png" /> Run
66
</button>
77
<button id="btnCopyCode" class="textAreaControl" onclick="CopyCode();">
8-
<img src="images\copy.png"/> Copy
8+
<img src="images\copy.png" /> Copy
99
</button>
1010
</div>
11-
<textarea id="txtCode" readonly />
11+
12+
<div id="highlighter">
13+
</div>

demo/code-demo/docs.html

+21-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
1+
<div>
2+
<div class="title">
3+
<h2>Getting Started</h2>
4+
</div>
5+
<div>
6+
Please visit our
7+
<a href="https://docs.microsoft.com/en-us/azure/power-bi-embedded/power-bi-embedded-what-is-power-bi-embedded">documentation</a>
8+
to start using Power BI Embedded.
9+
</div>
10+
</div>
11+
12+
<h2>Videos</h2>
13+
114
<div>
215
<div class="title">
316
1. Learn how to Embed and Interact with Power BI Reports.
417
</div>
518
<iframe class="video" src="https://www.youtube.com/embed/nfkVljh_9O4" frameborder="0" allowfullscreen></iframe>
6-
</div>
19+
</div>
20+
21+
<div>
22+
<div class="title">
23+
2. Learn how to Create, Edit and Save Power BI reports in Embedded view.
24+
</div>
25+
<iframe class="video" src="https://www.youtube.com/embed/ibuN4DzCl5c?showinfo=0" frameborder="0" allowfullscreen></iframe>
26+
</div>

demo/code-demo/index.html

+10-6
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77

88
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css" />
9+
<link type="text/css" rel="stylesheet" href="syntaxhighlighter/theme.css">
910
<link rel="stylesheet" type="text/css" href="style/style.css">
1011
<link rel="stylesheet" type="text/css" href="style/layout.css">
12+
<link rel="stylesheet" type="text/css" href="style/syntaxHighlighterOverride.css">
13+
1114
</head>
1215

1316
<body>
@@ -22,6 +25,9 @@
2225
<li id="top-sample" class="top-li-active" onclick="OpenSampleSection();">
2326
<div><a href="#">Sample</a></div>
2427
</li>
28+
<li id="top-anyReport" class="top-li-active" onclick="OpenAnyReportSection();">
29+
<div><a href="#">Any Report</a></div>
30+
</li>
2531
<li id="top-docs" onclick="OpenDocumentationSection();">
2632
<div><a href="#">Documentation</a></div>
2733
</li>
@@ -33,21 +39,19 @@
3339

3440
<div id="contentWrapper">
3541
<div id ="sampleContent" class="content">
36-
3742
</div>
38-
<div id ="documentationContent" class="content">
3943

44+
<div id ="documentationContent" class="content">
4045
</div>
41-
</div>
4246

43-
<div id="oldSample">
44-
<a href="../static.html">Old Sample</a>
47+
<div id ="anyReportContent" class="content">
48+
</div>
4549
</div>
4650

4751
<script src="../node_modules/jquery/dist/jquery.js"></script>
4852
<script src="../node_modules/es6-promise/dist/es6-promise.js"></script>
4953
<script src="../node_modules/powerbi-client/dist/powerbi.js"></script>
50-
54+
5155
<script src="scripts/codesamples.js"></script>
5256

5357
<script src="scripts/index.js"></script>

demo/code-demo/scripts/codesamples.js

+8
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ function _Embed_BasicEmbed() {
5757

5858
report.off("error");
5959
});
60+
61+
report.off("saved");
62+
report.on("saved", function(event) {
63+
Log.log(event.detail);
64+
if(event.detail.saveAs) {
65+
Log.logText('In order to interact with the new report, create a new token and load the new report');
66+
}
67+
});
6068
}
6169

6270
function _Mock_Embed_BasicEmbed(isEdit) {

demo/code-demo/scripts/function_mapping.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ function IsNotSupported(func) {
4949
return false;
5050
}
5151

52-
return mockDict[func.name] ? true : false;
52+
var runFunc = mockDict[func.name];
53+
return (runFunc && runFunc === datasetNotSupported) ? true : false;
5354
}
5455

5556
function IsMock(func) {

demo/code-demo/scripts/index.js

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
var sampleContentLoaded = false;
22
var documentationContentLoaded = false;
3-
3+
var anyReportSectionLoaded = false;
44

55
$(function() {
66
OpenSampleSection();
77
});
88

99
function OpenSampleSection() {
10+
OpenEmbedWorkspace("#top-sample", "step_authorize.html");
11+
}
12+
13+
function OpenAnyReportSection() {
14+
OpenEmbedWorkspace("#top-anyReport", "anyReport.html");
15+
}
16+
17+
function OpenEmbedWorkspace(activeTabSelector, authStepHtml)
18+
{
19+
// Any report, uses the same settings as sample report. ony changes the auth step.
1020
if (!sampleContentLoaded)
1121
{
1222
// Open Report Sample.
@@ -16,10 +26,12 @@ function OpenSampleSection() {
1626
});
1727
}
1828

19-
SetActiveStyle("#top-sample");
29+
$("#authorize-step-wrapper").load(authStepHtml);
30+
SetActiveStyle(activeTabSelector);
2031

2132
$(".content").hide();
2233
$("#sampleContent").show();
34+
OpenAuthStep();
2335
}
2436

2537
function OpenDocumentationSection() {

demo/code-demo/scripts/utils.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ function LoadLogWindow(divSelector) {
5050
}
5151

5252
function SetCode(func) {
53-
$("#txtCode").val(BodyCodeOfFunction(func));
53+
var codeHtml = '<pre id="txtCode" class="brush: js; gutter: false;">';
54+
codeHtml = codeHtml + BodyCodeOfFunction(func) + '</pre><script type="text/javascript" src="syntaxhighlighter/syntaxhighlighter.js"></script>';
55+
$("#highlighter").html(codeHtml);
5456

5557
var runFunc = mapFunc(func);
5658

demo/code-demo/step_authorize.html

+1-56
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!DOCTYPE html>
22
<div id="authStepDiv">
3-
<div id="sampleReport" class="line">
3+
<div id="sampleReport" class="pbi-line">
44
<div class="pageTitle">
55
<h3>Sample Report</h3>
66
<h8>You can embed a sample report and interact with Power BI Embedded firsthand by clicking below.</h8>
@@ -9,61 +9,6 @@ <h3>Sample Report</h3>
99
<button id="GoToEmbedStepButton" class="blueButton" onclick="OpenEmbedStepWithSample()">Embed sample report</button>
1010
</div>
1111
</div>
12-
13-
<hr />
14-
15-
<div id="userReport" class="line">
16-
<div class="pageTitle">
17-
<h3>Embed your own report</h3>
18-
<h8>You can also embed your own report by following the instructions below.</h8>
19-
</div>
20-
<div class="settings">
21-
<div id="EmbedWithSpecificReportDiv">
22-
<div class="line">
23-
<h5>Prerequisites</h5>
24-
<ul>
25-
<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>
26-
<li>Power BI report imported to your workspace.</li>
27-
</ul>
28-
</div>
29-
30-
<div class="line">
31-
<h5>Instructions to generate an embed App Token</h5>
32-
Once you have improted a report into Power BI workspace, you are ready to embed it.
33-
34-
To embed a report, you need to get an embed App Token. You can create this token in multiple ways.
35-
<ul>
36-
<li>Using <a href="https://github.com/Microsoft/PowerBI-cli">PowerBI-Cli</a> tool.</li>
37-
<li>From .Net Code using <a href="http://www.nuget.org/packages/Microsoft.PowerBI.Core/">Microsoft.PowerBI.Core</a> package.</li>
38-
<li>From NodeJS code using <a href="https://github.com/Microsoft/PowerBI-Node">powerbi-api</a> package.</li>
39-
</ul>
40-
</div>
41-
42-
<div id="authorizeParameterDiv" class="line">
43-
<h5>Enter embed details</h5>
44-
45-
<table id="user-embed-details">
46-
<tr>
47-
<td class="td-field-name">Embed App Token</td>
48-
<td><input type="text" id="auth_txtAccessToken" onchange="UpdateSession(this, SessionKeys.AccessToken);" /></td>
49-
</tr>
50-
<tr>
51-
<td class="td-field-name">Embed URL</td>
52-
<td>
53-
<input type="text" id="auth_txtReportEmbed" onchange="UpdateSession(this, SessionKeys.EmbedUrl);" />
54-
</td>
55-
</tr>
56-
<tr>
57-
<td class="td-field-name">Report Id</td>
58-
<td><input type="text" id="auth_txtEmbedReportId" onchange="UpdateSession(this, SessionKeys.EmbedId);"/></td>
59-
</tr>
60-
</table>
61-
<button id="nextStep" class="blueButton" onclick="OpenEmbedStepFromUserSettings()">Next step - Embed</button>
62-
</div>
63-
64-
</div>
65-
</div>
66-
</div>
6712
</div>
6813

6914
<script>

demo/code-demo/style/layout.css

+10
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,16 @@ header
127127
}
128128
}
129129

130+
@media screen and (max-width: 500px) {
131+
.top-ul li {
132+
float: left;
133+
margin-right: 15px;
134+
text-align: center;
135+
line-height: 22px;
136+
font-size: 13px;
137+
}
138+
}
139+
130140
@media screen and (min-width: 321px) {
131141
header
132142
{

demo/code-demo/style/style.css

+5-3
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ a {
134134
width: 100%;
135135
}
136136

137-
.line {
137+
.pbi-line {
138138
display: inline-block;
139139
width: 100%;
140140
}
@@ -509,10 +509,12 @@ a {
509509
width: 100%;
510510
height: 300px;
511511
border: none;
512-
padding-top: 40px;
512+
padding: 20px;
513513
position: relative;
514514
top: -30px;
515-
padding-left: 20px;
515+
background: #FFFFFF;
516+
overflow: auto;
517+
white-space: pre-wrap;
516518
}
517519

518520
#GoToEmbedStepButton {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.syntaxhighlighter {
2+
overflow: hidden !important;
3+
margin: 0em !important;
4+
padding: 0em !important;
5+
top: -98px !important;
6+
}
7+
8+
.syntaxhighlighter .line {
9+
white-space: pre-wrap !important;
10+
}

0 commit comments

Comments
 (0)