Skip to content

Commit 7f5ace6

Browse files
author
Amit Shuster
committed

File tree

demo/v2-demo/demos.html

Lines changed: 0 additions & 45 deletions
This file was deleted.

demo/v2-demo/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
<li id="main-sample" class="main-li-active" onclick="OpenSampleSection();">
2828
<div><a href="#">Sample tool</a></div>
2929
</li>
30-
<li id="main-demos" class="main-li-active" onclick="OpenDemosSection();" style="display: none">
31-
<div><a href="#">Demos</a></div>
30+
<li id="main-showcases" class="main-li-active" onclick="OpenShowcasesSection();" style="display: none">
31+
<div><a href="#">Showcases</a></div>
3232
<div class="newSection">NEW</div>
3333
</li>
3434
<li id="main-docs" onclick="OpenDocumentationSection();">
@@ -42,7 +42,7 @@
4242
<div id="sampleContent" class="content">
4343
</div>
4444

45-
<div id="demosContent" class="content">
45+
<div id="showcasesContent" class="content">
4646
</div>
4747

4848
<div id="documentationContent" class="content">
@@ -68,8 +68,8 @@
6868
<script src="scripts/step_embed.js"></script>
6969
<script src="scripts/step_interact.js"></script>
7070

71-
<script src="live_demos/custom_layout/demo_custom_layout.js"></script>
72-
<script src="live_demos/bookmarks/demo_bookmarks.js"></script>
71+
<script src="live_showcases/custom_layout/showcase_custom_layout.js"></script>
72+
<script src="live_showcases/bookmarks/showcase_bookmarks.js"></script>
7373

7474
</body>
7575
</html>

demo/v2-demo/live_demos/bookmarks/demo_bookmarks.html

Lines changed: 0 additions & 55 deletions
This file was deleted.

demo/v2-demo/live_demos/custom_layout/demo_custom_layout.html

Lines changed: 0 additions & 50 deletions
This file was deleted.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<div id="showcases-text">
2+
<h3>Bookmarks Showcase</h3>
3+
<br>
4+
<div id="showcases-description">
5+
Use this showcase to experience the capabilities of the bookmarks API, so your users can create and share their own bookmarks<br><br>
6+
&nbsp;<b>1. Choose and Apply pre-defined Bookmarks</b><br>
7+
<div class="text-tab">
8+
The Menu on the left displays the report's existing bookmarks. You can switch between available bookmarks by clicking on the desired bookmark's name<br><br>
9+
</div>
10+
&nbsp;<b>2. Capture new Bookmarks</b><br>
11+
<div class="text-tab">
12+
After interacting with the report (filtering, clicking on visuals etc), click on 'Capture bookmark'. The API will return a string that represents the report's state,<br>
13+
which you can use in any way you wish. In our showcase, we have added it to the menu of Bookmarks on the left<br><br>
14+
</div>
15+
&nbsp;<b>3. Share Bookmarks with others</b><br>
16+
<div class="text-tab">
17+
Select the bookmark you would like to share and click on the 'Share' icon. Copy the given URL to a new tab and you will see the embedded report<br>
18+
with the bookmark applied<br>
19+
</div>
20+
</div>
21+
<div class="showcases-buttons">
22+
<button class="selectButton floatButton" onclick="openUrl('BookmarksDocs')">Documentation</button>
23+
<button class="selectButton floatButton" onclick="openUrl('BookmarksCode')">Get Code</button>
24+
</div>
25+
</div>
26+
27+
<div id="showcaseContent">
28+
<div id="bookmarksArea">
29+
<div class="editorTitle">Bookmarks</div>
30+
<div id="bookmarksWrapper">
31+
<div id="bookmarksList">
32+
</div>
33+
</div>
34+
</div>
35+
<div id="showcaseEmbedArea">
36+
<div class="editorTitle">Embedded view</div>
37+
<div class="textAreaControls">
38+
<button id="btnCaptureBookmark" class="textAreaControl" onclick="onBookmarkCaptureClicked();">
39+
<img src="images\add.svg"/> Capture Bookmark
40+
</button>
41+
</div>
42+
<div id="showcase-embedded-view">
43+
<div id="embedContainer" class="iframeContainer active"></div>
44+
</div>
45+
</div>
46+
</div>
47+
48+
<div id="overlay"></div>
49+
<div id="shareDialog">
50+
<div class="dialogHeader">
51+
<div id="btnCloseDialog" onclick="onCloseDialogClicked();">
52+
<img src="images\close.png"/>
53+
</div>
54+
</div>
55+
<div class="dialogBody">
56+
<div class="dialogText">Link to '<span id="dialogBookmarkName"></span>' created</div>
57+
<div class="dialogSubText">Make sure you copy the link below.</div>
58+
<input type="text" id="dialogInput" />
59+
<div id="btnDialogCopy" onclick="onDialogCopyClicked();">Copy</div>
60+
</div>
61+
</div>
62+
63+
<script>
64+
$(document).ready(function() {
65+
embedBookmarksReport();
66+
});
67+
</script>

demo/v2-demo/live_demos/bookmarks/demo_bookmarks.js renamed to demo/v2-demo/live_showcases/bookmarks/showcase_bookmarks.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22

3-
var BookmarkDemoState = {
3+
var BookmarkShowcaseState = {
44
bookmarksArray: null,
55
bookmarksReport: null,
66

@@ -50,13 +50,13 @@ function embedBookmarksReport() {
5050
var embedContainer = $('#embedContainer')[0];
5151

5252
// Embed the report and display it within the div container
53-
BookmarkDemoState.bookmarksReport = powerbi.embed(embedContainer, config);
53+
BookmarkShowcaseState.bookmarksReport = powerbi.embed(embedContainer, config);
5454

5555
// Report.on will add an event handler for report loaded event.
56-
BookmarkDemoState.bookmarksReport.on("loaded", function() {
56+
BookmarkShowcaseState.bookmarksReport.on("loaded", function() {
5757

5858
// Get report's existing bookmarks
59-
BookmarkDemoState.bookmarksReport.bookmarksManager.getBookmarks().then(function (bookmarks) {
59+
BookmarkShowcaseState.bookmarksReport.bookmarksManager.getBookmarks().then(function (bookmarks) {
6060

6161
// Create bookmarks list from the existing report bookmarks
6262
createBookmarksList(bookmarks);
@@ -116,22 +116,22 @@ function embedSharedBookmark(enableFilterPane, bookmarkState) {
116116
var embedContainer = $('#embedContainer')[0];
117117

118118
// Embed the report and display it within the div container
119-
BookmarkDemoState.bookmarksReport = powerbi.embed(embedContainer, config);
119+
BookmarkShowcaseState.bookmarksReport = powerbi.embed(embedContainer, config);
120120
});
121121
}
122122

123123
// Create a bookmarks list from the existing report bookmarks and update the HTML
124124
function createBookmarksList(bookmarks) {
125125

126126
// Reset next bookmark ID
127-
BookmarkDemoState.nextBookmarkId = 1;
127+
BookmarkShowcaseState.nextBookmarkId = 1;
128128

129129
// Set bookmarks array to the report's fetched bookmarks
130-
BookmarkDemoState.bookmarksArray = bookmarks;
130+
BookmarkShowcaseState.bookmarksArray = bookmarks;
131131

132132
// Build the bookmarks list HTML code
133133
var bookmarksList = $('#bookmarksList');
134-
for (let bookmark of BookmarkDemoState.bookmarksArray) {
134+
for (let bookmark of BookmarkShowcaseState.bookmarksArray) {
135135
bookmarksList.append(buildBookmarkElement(bookmark));
136136
}
137137
}
@@ -142,21 +142,21 @@ function onBookmarkCaptureClicked() {
142142
elementClicked('#btnCaptureBookmark');
143143

144144
// Capture the report's current state
145-
BookmarkDemoState.bookmarksReport.bookmarksManager.capture().then(function (capturedBookmark) {
145+
BookmarkShowcaseState.bookmarksReport.bookmarksManager.capture().then(function (capturedBookmark) {
146146

147147
// Build bookmark element
148148
let bookmark = {
149-
name: "bookmark_" + BookmarkDemoState.nextBookmarkId,
150-
displayName: "Bookmark " + BookmarkDemoState.nextBookmarkId,
149+
name: "bookmark_" + BookmarkShowcaseState.nextBookmarkId,
150+
displayName: "Bookmark " + BookmarkShowcaseState.nextBookmarkId,
151151
state: capturedBookmark.state
152152
}
153153

154154
// Add and set the captured bookmark as active
155155
setCapturedBookmarkActive(bookmark);
156156

157157
// Add the bookmark to the bookmarks array and increase the bookmarks number counter
158-
BookmarkDemoState.bookmarksArray.push(bookmark);
159-
BookmarkDemoState.nextBookmarkId++;
158+
BookmarkShowcaseState.bookmarksArray.push(bookmark);
159+
BookmarkShowcaseState.nextBookmarkId++;
160160
});
161161
}
162162

@@ -168,13 +168,13 @@ function setCapturedBookmarkActive(bookmark) {
168168
$('#bookmarkShare').remove();
169169

170170
// Find bookmark parent node
171-
let parentNode = ($('#bookmark_' + BookmarkDemoState.nextBookmarkId)[0]).parentNode;
171+
let parentNode = ($('#bookmark_' + BookmarkShowcaseState.nextBookmarkId)[0]).parentNode;
172172

173173
// Add share bookmark icon to bookmark's line
174174
$(parentNode).append(buildShareElement());
175175

176176
// Set bookmark radio button to checked
177-
$('#bookmark_' + BookmarkDemoState.nextBookmarkId).attr('checked', true);
177+
$('#bookmark_' + BookmarkShowcaseState.nextBookmarkId).attr('checked', true);
178178
}
179179

180180
function onCloseDialogClicked() {
@@ -202,10 +202,10 @@ function onBookmarkClicked(element) {
202202
const bookmarkId = $(element).attr('id');
203203

204204
// Find the bookmark in the bookmarks array
205-
let currentBookmark = BookmarkDemoState.bookmarksArray.find(bookmark => { return bookmark.name === bookmarkId });
205+
let currentBookmark = BookmarkShowcaseState.bookmarksArray.find(bookmark => { return bookmark.name === bookmarkId });
206206

207207
// Apply the bookmark state
208-
BookmarkDemoState.bookmarksReport.bookmarksManager.applyState(currentBookmark.state);
208+
BookmarkShowcaseState.bookmarksReport.bookmarksManager.applyState(currentBookmark.state);
209209
}
210210

211211
// Open bookmark share dialog
@@ -215,10 +215,10 @@ function shareBookmark(element) {
215215
const bookmarkId = $($(element).siblings('input')).attr('id');
216216

217217
// Find the bookmark in the bookmarks array
218-
let currentBookmark = BookmarkDemoState.bookmarksArray.find(bookmark => { return bookmark.name === bookmarkId });
218+
let currentBookmark = BookmarkShowcaseState.bookmarksArray.find(bookmark => { return bookmark.name === bookmarkId });
219219

220220
// Build the share bookmark URL
221-
let shareUrl = location.href.substring(0, location.href.lastIndexOf("/")) + '/shareBookmark' + '?state=' + currentBookmark.state;
221+
let shareUrl = location.href.substring(0, location.href.lastIndexOf("/")) + '/shareBookmark.html' + '?state=' + currentBookmark.state;
222222

223223
// Set bookmark display name and share URL on dialog HTML code
224224
var displayNameElement = document.createTextNode(currentBookmark.displayName);

0 commit comments

Comments
 (0)