Skip to content

Commit a52091f

Browse files
committed
Merged PR 52310: Merge adding rdl sample to master
Merge adding rdl sample to master
1 parent 906174e commit a52091f

15 files changed

+269
-15
lines changed

CONTRIBUTING.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,12 @@ npm run gulp -- build:docs
8484
If the docs are correct then you may publish them to gh-pages using this command
8585
```
8686
npm run gulp -- ghpages
87-
```
87+
```
88+
89+
## Known issues
90+
Running demo fails with an error ERR_INVALID_REDIRECT
91+
This happens due to version 10 of http-server. To solve the problem, please install [email protected] globally using:
92+
93+
```
94+
npm install -g [email protected]
95+
```

demo/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@
3131
],
3232
"dependencies": {
3333
"bootstrap": "^4.1.2",
34+
"ecstatic": "^3.3.1",
3435
"es6-promise": "^3.2.2",
3536
"fetch": "^1.0.0",
36-
"http-server": "^0.10.0",
37+
"http-server": "^0.9.0",
3738
"jquery": "^3.1.0",
3839
"powerbi-client": "file:..",
3940
"powerbi-report-authoring": "^1.0.0",
84.9 KB
Loading

demo/v2-demo/report.html

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
<div class="visualContainer iframeContainer"></div>
4343
<div class="tileContainer iframeContainer"></div>
4444
<div class="qnaContainer iframeContainer"></div>
45+
<div class="paginatedReportContainer iframeContainer"></div>
4546
</div>
4647
<div class="mobile-view">
4748
<div class="phone-frame">
@@ -54,6 +55,7 @@
5455
<div class="visualMobileContainer iframeContainer"></div>
5556
<div class="tileMobileContainer iframeContainer"></div>
5657
<div class="qnaMobileContainer iframeContainer"></div>
58+
<div class="paginatedReportMobileContainer iframeContainer"></div>
5759
</div>
5860
<div class="phone-bottom">
5961
<div class="phone-button"></div>

demo/v2-demo/scripts/codesamples.js

+92
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,48 @@ function _Embed_BasicEmbed_Mobile() {
152152
});
153153
}
154154

155+
// ---- Paginated Embed Code ----------------------------------------------------
156+
function _Embed_PaginatedReportBasicEmbed() {
157+
// Read embed application token from textbox
158+
var txtAccessToken = $('#txtAccessToken').val();
159+
160+
// Read embed URL from textbox
161+
var txtEmbedUrl = $('#txtReportEmbed').val();
162+
163+
// Read paginated report Id from textbox
164+
var txtEmbedReportId = $('#txtEmbedReportId').val();
165+
166+
// Read embed type from radio
167+
var tokenType = $('input:radio[name=tokenType]:checked').val();
168+
169+
// Get models. models contains enums that can be used.
170+
var models = window['powerbi-client'].models;
171+
172+
// Se view permissions.
173+
var permissions = models.Permissions.View;
174+
175+
// Embed configuration used to describe the what and how to embed.
176+
// This object is used when calling powerbi.embed.
177+
// This also includes settings and options such as filters.
178+
// You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
179+
var config = {
180+
type: 'report',
181+
tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed,
182+
accessToken: txtAccessToken,
183+
embedUrl: txtEmbedUrl,
184+
id: txtEmbedReportId,
185+
permissions: permissions,
186+
};
187+
188+
// Get a reference to the paginated embedded report HTML element
189+
var paginatedReportContainer = $('#paginatedReportContainer')[0];
190+
191+
// Embed the paginated report and display it within the div container.
192+
var report = powerbi.embed(paginatedReportContainer, config);
193+
194+
Log.logText("Loading Paginated Report.");
195+
}
196+
155197
function _Embed_VisualEmbed() {
156198
// Read embed application token from textbox
157199
var txtAccessToken = $('#txtAccessToken').val();
@@ -1163,6 +1205,19 @@ function _Report_Reload() {
11631205
});
11641206
}
11651207

1208+
function _PaginatedReport_Reload() {
1209+
// Get a reference to the paginated report HTML element
1210+
var paginatedReportContainer = $('#paginatedReportContainer')[0];
1211+
1212+
// Get a reference to the embedded paginated report.
1213+
paginatedReport = powerbi.get(paginatedReportContainer);
1214+
1215+
// Reload the displayed paginated report
1216+
paginatedReport.reload();
1217+
1218+
Log.logText("Reload Paginated Report");
1219+
}
1220+
11661221
function _Report_Refresh() {
11671222
// Get a reference to the embedded report HTML element
11681223
var embedContainer = $('#embedContainer')[0];
@@ -1380,6 +1435,43 @@ function _Report_ExitFullScreen() {
13801435
report.exitFullscreen();
13811436
}
13821437

1438+
// ---- PaginatedReport Operations ----------------------------------------------------
1439+
1440+
function _PaginatedReport_GetId() {
1441+
// Get a reference to the embedded report HTML element
1442+
var paginatedReportContainer = $('#paginatedReportContainer')[0];
1443+
1444+
// Get a reference to the embedded report.
1445+
paginatedReport = powerbi.get(paginatedReportContainer);
1446+
1447+
// Retrieve the report id.
1448+
var reportId = paginatedReport.getId();
1449+
1450+
Log.logText(reportId);
1451+
}
1452+
1453+
function _PaginatedReport_FullScreen() {
1454+
// Get a reference to the paginated embedded report HTML element
1455+
var paginatedReportContainer = $('#paginatedReportContainer')[0];
1456+
1457+
// Get a reference to the paginated embedded report.
1458+
paginatedReport = powerbi.get(paginatedReportContainer);
1459+
1460+
// Displays the paginated report in full screen mode.
1461+
paginatedReport.fullscreen();
1462+
}
1463+
1464+
function _PaginatedReport_ExitFullScreen() {
1465+
// Get a reference to the paginated embedded report HTML element
1466+
var paginatedReportContainer = $('#paginatedReportContainer')[0];
1467+
1468+
// Get a reference to the paginated embedded report.
1469+
paginatedReport = powerbi.get(paginatedReportContainer);
1470+
1471+
// Exits full screen mode.
1472+
paginatedReport.exitFullscreen();
1473+
}
1474+
13831475
function _Report_switchModeEdit() {
13841476
// Get a reference to the embedded report HTML element
13851477
var embedContainer = $('#embedContainer')[0];

demo/v2-demo/scripts/function_mapping.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function IsNotSupported(funcName) {
4848
return false
4949
}
5050

51-
const notReportMatch = funcName.match(/Dashboard|Tile|Qna|Visual|Mobile/);
51+
const notReportMatch = funcName.match(/Dashboard|Tile|Qna|Visual|Mobile|PaginatedReport/);
5252
if (notReportMatch) {
5353
return false;
5454
}

demo/v2-demo/scripts/report.js

+39
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@ function LoadEmbedSettings(mode, entityType, tokenType) {
145145
OpenEmbedMode(mode, entityType,tokenType);
146146
});
147147
}
148+
else if (entityType == EntityType.PaginatedReport)
149+
{
150+
$("#settings").load("settings_embed_paginatedreport.html", function() {
151+
OpenEmbedMode(mode, entityType,tokenType);
152+
});
153+
}
148154
}
149155

150156
function OpenEmbedTab() {
@@ -219,6 +225,13 @@ function OpenInteractTab() {
219225
LoadCodeArea("#embedCodeDiv", "");
220226
});
221227
}
228+
else if (entityType == EntityType.PaginatedReport)
229+
{
230+
$("#settings").load("settings_interact_paginatedreport.html", function() {
231+
SetToggleHandler("operation-categories");
232+
LoadCodeArea("#embedCodeDiv", "");
233+
});
234+
}
222235
else
223236
{
224237
$("#settings").load("settings_interact_report.html", function() {
@@ -269,6 +282,10 @@ function getEmbedCode(mode, entityType)
269282
{
270283
code = GetParameterByName(SessionKeys.TokenType) === '0' /* AAD Token */ ? _Embed_QnaEmbed_Aad : _Embed_QnaEmbed;
271284
}
285+
else if (entityType == EntityType.PaginatedReport)
286+
{
287+
code = _Embed_PaginatedReportBasicEmbed
288+
}
272289
return code;
273290
}
274291

@@ -420,6 +437,18 @@ function OpenEmbedMode(mode, entityType, tokenType)
420437
LoadSettings();
421438
}
422439
}
440+
else if (entityType == EntityType.PaginatedReport) {
441+
if (IsEmbeddingSamplePaginatedReport()) {
442+
LoadSamplePaginatedReportIntoSession().then(function (response) {
443+
SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtReportEmbed", "#txtEmbedReportId");
444+
setCodeAndShowEmbedSettings(mode, entityType, tokenType);
445+
});
446+
}
447+
else {
448+
SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtReportEmbed", "#txtEmbedReportId");
449+
setCodeAndShowEmbedSettings(mode, entityType, tokenType);
450+
}
451+
}
423452
}
424453

425454
function setCodeAndShowEmbedSettings(mode, entityType, tokenType) {
@@ -459,6 +488,10 @@ function IsEmbeddingSampleQna() {
459488
return GetSession(SessionKeys.IsSampleQna) == true;
460489
}
461490

491+
function IsEmbeddingSamplePaginatedReport() {
492+
return GetSession(SessionKeys.IsSamplePaginatedReport) == true;
493+
}
494+
462495
function ToggleQuestionBox(enabled) {
463496
UpdateSession("input[name='qnaMode']:checked", SessionKeys.QnaMode);
464497
let txtQuestion = $("#txtQuestion");
@@ -540,6 +573,12 @@ function ReloadSample(entityType) {
540573
SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtQnaEmbed", "#txtDatasetId");
541574
});
542575
}
576+
else if (entityType == EntityType.PaginatedReport)
577+
{
578+
LoadSamplePaginatedReportIntoSession().then(function (response) {
579+
SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtReportEmbed", "#txtEmbedReportId");
580+
});
581+
}
543582
}
544583

545584
function EmbedAreaDesktopView() {

demo/v2-demo/scripts/session_utils.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const datasetUrl = 'https://powerbiplaygroundbe.azurewebsites.net/api/Reports/Sa
33
const dashboardUrl = 'https://powerbiplaygroundbe.azurewebsites.net/api/Dashboards/SampleDashboard';
44
const tileUrl = 'https://powerbiplaygroundbe.azurewebsites.net/api/Tiles/SampleTile';
55
const qnaUrl = 'https://powerbiplaygroundbe.azurewebsites.net/api/Datasets/SampleQna';
6+
const paginatedReportUrl = 'https://powerbiplaygroundbe.azurewebsites.net/api/Reports/SampleRdlReport';
67
const layoutShowcaseReportUrl = 'https://powerbiplaygroundbe.azurewebsites.net/api/Reports/LayoutDemoReport';
78
const insightToActionShowcaseReportUrl = 'https://powerbiplaygroundbe.azurewebsites.net/api/Reports/InsightToActionReport';
89
const themesShowcaseReportUrl = 'https://powerbiplaygroundbe.azurewebsites.net/api/Reports/ThemesReport';
@@ -19,7 +20,8 @@ const EntityType = {
1920
Visual : "Visual",
2021
Dashboard : "Dashboard",
2122
Tile : "Tile",
22-
Qna: "Qna"
23+
Qna: "Qna",
24+
PaginatedReport: "PaginatedReport"
2325
};
2426

2527
const SessionKeys = {
@@ -34,6 +36,7 @@ const SessionKeys = {
3436
IsSampleDashboard: "IsSampleDashboard",
3537
IsSampleTile: "IsSampleTile",
3638
IsSampleQna: "IsSampleQna",
39+
IsSamplePaginatedReport: "IsSamplePaginatedReport",
3740
IsTelemetryEnabled: "isTelemetryEnabled",
3841
PageName: "PageName",
3942
QnaQuestion: "QnaQuestion",
@@ -110,6 +113,10 @@ function SetIsSample(value) {
110113
{
111114
SetSession(SessionKeys.IsSampleQna, value);
112115
}
116+
else if (entityType == EntityType.PaginatedReport)
117+
{
118+
SetSession(SessionKeys.IsSamplePaginatedReport, value);
119+
}
113120
}
114121

115122
function SetTextboxFromSessionOrUrlParam(sessionKey, textboxSelector) {
@@ -278,6 +285,11 @@ function LoadSampleQnaIntoSession() {
278285
return FetchUrlIntoSession(qnaUrl, false /* updateCurrentToken */);
279286
}
280287

288+
function LoadSamplePaginatedReportIntoSession() {
289+
SetSession(SessionKeys.EntityType, EntityType.PaginatedReport);
290+
return FetchUrlIntoSession(paginatedReportUrl, false /* updateCurrentToken */);
291+
}
292+
281293
function LoadLayoutShowcaseReportIntoSession() {
282294
SetSession(SessionKeys.EntityType, EntityType.Report);
283295
return FetchUrlIntoSession(layoutShowcaseReportUrl, false /* updateCurrentToken */);

demo/v2-demo/scripts/step_embed.js

+16
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,22 @@ function Report_Reload() {
3535
SetCode(_Report_Reload);
3636
}
3737

38+
function PaginatedReport_Reload() {
39+
SetCode(_PaginatedReport_Reload);
40+
}
41+
42+
function PaginatedReport_GetId() {
43+
SetCode(_PaginatedReport_GetId);
44+
}
45+
46+
function PaginatedReport_FullScreen() {
47+
SetCode(_PaginatedReport_FullScreen);
48+
}
49+
50+
function PaginatedReport_ExitFullScreen() {
51+
SetCode(_PaginatedReport_ExitFullScreen);
52+
}
53+
3854
function Report_Refresh() {
3955
SetCode(_Report_Refresh);
4056
}

demo/v2-demo/scripts/step_samples.js

+5
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ function OpenCodeStepWithSample(entityType) {
3232
SetSession(SessionKeys.IsSampleQna, true);
3333
OpenCodeStep(EmbedViewMode, EntityType.Qna)
3434
}
35+
else if (entityType == EntityType.PaginatedReport)
36+
{
37+
SetSession(SessionKeys.IsSamplePaginatedReport, true);
38+
OpenCodeStep(EmbedViewMode, EntityType.PaginatedReport)
39+
}
3540
else {
3641
assert(false);
3742
trackEvent(TelemetryEventName.CodeStepError, {});

demo/v2-demo/scripts/utils.js

+6
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ function getEmbedContainerID(entityType) {
122122
return "tileContainer";
123123
case EntityType.Qna:
124124
return "qnaContainer";
125+
case EntityType.PaginatedReport:
126+
return "paginatedReportContainer";
125127
default:
126128
return "embedContainer";
127129
}
@@ -137,6 +139,8 @@ function getEmbedContainerClassPrefix(entityType) {
137139
return ".tile";
138140
case EntityType.Qna:
139141
return ".qna";
142+
case EntityType.PaginatedReport:
143+
return ".paginatedReport";
140144
default:
141145
return ".report";
142146
}
@@ -159,6 +163,8 @@ function getEntityTypeFromParameter(urlParam) {
159163
return EntityType.Tile;
160164
case "qna":
161165
return EntityType.Qna;
166+
case "rdl":
167+
return EntityType.PaginatedReport;
162168
default:
163169
return EntityType.Report;
164170
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<div id="rdl-report-embed-table" class="embed-table">
2+
<div id="wrapper-settings-div">
3+
<h8>Select token type:</h8>
4+
5+
<div id="typeSelector">
6+
<label class="radioContainer">
7+
<div onclick="OnTokenTypeRadioClicked(1);"><input type="radio" name="tokenType" value="1" checked="checked"> Embed token </input>
8+
<span class="checkmark"></span></div>
9+
</label>
10+
<label class="radioContainer">
11+
<div onclick="OnTokenTypeRadioClicked(0);"><input type="radio" name="tokenType" value="0"> AAD token </input>
12+
<span class="checkmark"></span></div>
13+
</label>
14+
</div>
15+
16+
<div class="noOverflow"><h8>Fill in the fields below to get the code to embed your paginated report</h8></div>
17+
<div class="spacer" />
18+
<div id="embedModeInput">
19+
<div class="inputLine">
20+
<div class="inputLineTitle">Embed Token</div>
21+
<input type="text" id="txtAccessToken" onchange="UpdateSession(this, SessionKeys.AccessToken);" />
22+
</div>
23+
<div class="inputLine">
24+
<div class="inputLineTitle">Embed URL</div>
25+
<input type="text" id="txtReportEmbed" onchange="UpdateSession(this, SessionKeys.EmbedUrl);" value="https://embedded.powerbi.com/ReportEmbed"/>
26+
</div>
27+
<div class="inputLine">
28+
<div class="inputLineTitle">Report ID</div>
29+
<input type="text" id="txtEmbedReportId" onchange="UpdateSession(this, SessionKeys.EmbedId);"/>
30+
</div>
31+
</div>
32+
</div>
33+
</div>

0 commit comments

Comments
 (0)