Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
dade325
Live Demo with visible code.
ali-hamud Nov 13, 2016
23b13fd
spaces instead of tabs.
ali-hamud Nov 13, 2016
dc1b715
Add pageView to loadDashboardConfiguration
noanu Nov 13, 2016
e72fcc1
fix comments from review - adding null checks.
ali-hamud Nov 14, 2016
744c0b7
Merge pull request #93 from Microsoft/alihamud-live-code
ali-hamud Nov 14, 2016
57208e5
Merge pull request #95 from Microsoft/add_pageview_to_dashboard_embed…
noanu Nov 14, 2016
944aaf1
Add Link to old sample.
ali-hamud Nov 14, 2016
031d6ec
spaces.
ali-hamud Nov 14, 2016
4225d30
Merge pull request #97 from Microsoft/alihamud-live-code
ali-hamud Nov 14, 2016
fc3ae10
enable getting embedUrl, embedId and accessToken from url params.
ali-hamud Nov 16, 2016
a337a44
replace tabs with spaces
ali-hamud Nov 16, 2016
e15763f
Merge pull request #99 from Microsoft/alihamud-live-code
ali-hamud Nov 16, 2016
0b674d7
Fix dependecy module to only work with npm (#103)
breueran Nov 28, 2016
f343434
build things
t-naabus Nov 28, 2016
873345d
Add bower install support
breueran Nov 28, 2016
f413e6e
text fixed
t-naabus Nov 28, 2016
441e0d3
text fixed
t-naabus Nov 28, 2016
307cc61
Merge branch 't-naabus/textfixing' of https://github.com/Microsoft/Po…
t-naabus Nov 28, 2016
d11c2b7
fix sample referencing
breueran Nov 28, 2016
25605e5
fix demo references
breueran Nov 28, 2016
8b9dc5b
text fixed
t-naabus Nov 28, 2016
32968df
text fixed
t-naabus Nov 28, 2016
64bab62
Merge branch 'dev' of https://github.com/Microsoft/PowerBI-JavaScript…
t-naabus Nov 28, 2016
75bbc70
merge
t-naabus Nov 28, 2016
605eb19
merge
t-naabus Nov 28, 2016
b4b0087
Textfix fix
t-naabus Nov 29, 2016
cc78003
Merge pull request #106 from Microsoft/t-naabus/textfixing
t-naabus Nov 29, 2016
095d342
increment version and update dist folder
ali-hamud Nov 29, 2016
ee91c23
Merge pull request #107 from Microsoft/merge_dev_into_master
ali-hamud Nov 29, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion demo/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
"powerbi-client": "^2.2.1"
},
"devDependencies": {}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this change?

43 changes: 43 additions & 0 deletions demo/code-demo/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="stylesheet" href="/node_modules/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="style/style.css">
</head>

<body>
<header class="ms-font-xxl">
<div class="logo-text">
<span class="logo-text-span">Microsoft Power BI JavaScript SDK - Live Sample</span>
</div>
<div id="oldSample">
<a href="/static.html">Old Sample</a>
</div>
</header>

<div id="mainContent" class="jumbotron">
</div>

<script src="/node_modules/jquery/dist/jquery.js"></script>
<script src="/node_modules/es6-promise/dist/es6-promise.js"></script>
<script src="/node_modules/fetch/lib/fetch.js"></script>
<script src="/node_modules/powerbi-client/dist/powerbi.js"></script>

<script src="scripts/codesamples.js"></script>

<script src="scripts/index.js"></script>
<script src="scripts/utils.js"></script>
<script src="scripts/session_utils.js"></script>


<script src="scripts/report.js"></script>

<script src="scripts/step_authorize.js"></script>
<script src="scripts/step_embed.js"></script>
<script src="scripts/step_interact.js"></script>
</body>
</html>
40 changes: 40 additions & 0 deletions demo/code-demo/report.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<div>
<div id="steps-nav-bar">
<div class="main-title">Report Embed</div>
<div id="steps-ul-dev">
<ul id="steps-ul" class="steps-ul">
<li id="steps-auth" class="steps-li-active" onclick="OpenAuthStep();"><a href="#">Authorize</a></li>
<li id="steps-embed" onclick="OpenEmbedStep();"><a href="#">Embed</a></li>
<li id="steps-interact" onclick="OpenInteractStep();"><a href="#">Interact</a></li>
</ul>
</div>
</div>

<div id="embed-and-interact-panel">
<div id="right-pane" class="halfWidth left">
</div>

<div id="left-pane" class="halfWidth right">
<div id="embedArea">
<h3>Embedded Report Area</h3>
<h5>The following div id is <b>reportContainer</b>. In code, we embed a report to it.</h5>
<div id="reportContainer" style="width: 800px; height: 600px; background: #DDDDDD;"></div>
</div>
</div>
</div>
</div>

<script>
var embedUrl = GetParameterByName("embedUrl");
if (!embedUrl)
{
// Open Authorization Step after this page loads.
OpenAuthStep();
}
else
{
OpenEmbedStep();
}

</script>
273 changes: 273 additions & 0 deletions demo/code-demo/scripts/codesamples.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,273 @@
/*
This file contains the code samples which will appear live in the web-page.
Each sample method name starts with _Report_ or _Page or _Embed depends on which section it appears.
Please keep this.
*/

// ---- Embed Code ----------------------------------------------------

function _Embed_BasicEmbed() {
var txtAccessToken = $('#txtAccessToken').val();
var txtEmbedUrl = $('#txtReportEmbed').val();
var txtEmbedReportId = $('#txtEmbedReportId').val();

var embedConfiguration = {
type: 'report',
accessToken: txtAccessToken,
embedUrl: txtEmbedUrl,
id: txtEmbedReportId,
settings: {
filterPaneEnabled: true,
navContentPaneEnabled: true
}
};

var reportContainer = document.getElementById('reportContainer');
powerbi.embed(reportContainer, embedConfiguration);
}

function _Embed_EmbedWithDefaultFilter() {
var txtAccessToken = $('#txtAccessToken').val();
var txtEmbedUrl = $('#txtReportEmbed').val();
var txtEmbedReportId = $('#txtEmbedReportId').val();

const filter = {
$schema: "http://powerbi.com/product/schema#basic",
target: {
table: "Store",
column: "Chain"
},
operator: "In",
values: ["Lindseys"]
};

var embedConfiguration = {
type: 'report',
accessToken: txtAccessToken,
embedUrl: txtEmbedUrl,
id: txtEmbedReportId,
settings: {
filterPaneEnabled: false,
navContentPaneEnabled: false
},
filters: [filter]
};

var reportContainer = document.getElementById('reportContainer');
powerbi.embed(reportContainer, embedConfiguration);
}

// ---- Report Operations ----------------------------------------------------

function _Report_GetId() {
report = powerbi.embeds[0];
$('#result').html(report.getId());
}

function _Report_UpdateSettings() {
const newSettings = {
navContentPaneEnabled: true,
filterPaneEnabled: false
};

report = powerbi.embeds[0];
report.updateSettings(newSettings)
.then(function (result) {
$("#result").html(result);
})
.catch(function (error) {
$("#result").html(error);
});
}

function _Report_GetPages() {
report = powerbi.embeds[0];

report.getPages()
.then(function (pages) {
var result = "";
var index = 1;
pages.forEach(function(page) {
result = result + index + ") " + page.name + "(displayName: " + page.displayName + ")" + "<br/>";
index++;
});

$("#result").html("Done. <br/>" + result);
})
.catch(function (errors) {
$("#result").html("Error. <br/>" + JSON.stringify(errors));
});
}

function _Report_SetPage() {
report = powerbi.embeds[0];
report.setPage("ReportSection2")
.then(function (result) {
$("#result").html("Done. <br/>" + JSON.stringify(result));
})
.catch(function (errors) {
$("#result").html("Error. <br/>" + JSON.stringify(errors));
});
}

function _Report_GetFilters() {
report = powerbi.embeds[0];

report.getFilters()
.then(function (filters) {
$("#result").html("Done. <br/>" + JSON.stringify(filters, null, " "));
})
.catch(function (errors) {
$("#result").html("Error. <br/>" + JSON.stringify(errors));
});
}

function _Report_SetFilters() {
const filter = {
$schema: "http://powerbi.com/product/schema#basic",
target: {
table: "Store",
column: "Chain"
},
operator: "In",
values: ["Lindseys"]
};

report = powerbi.embeds[0];
report.setFilters([filter])
.then(function (result) {
$("#result").html("Done. <br/>" + JSON.stringify(result));
})
.catch(function (errors) {
$("#result").html("Error. <br/>" + JSON.stringify(errors));
});
}

function _Report_RemoveFilters() {
report = powerbi.embeds[0];
report.removeFilters()
.then(function (result) {
$("#result").html("Done. <br/>" + JSON.stringify(result));
})
.catch(function (errors) {
$("#result").html("Error. <br/>" + JSON.stringify(errors));
});
}

function _Report_PrintCurrentReport() {
report = powerbi.embeds[0];
report.print()
.then(function (result) {
$("#result").html("Done. <br/>" + JSON.stringify(result));
})
.catch(function (errors) {
$("#result").html("Error. <br/>" + JSON.stringify(errors));
});
}

function _Report_Reload() {
report = powerbi.embeds[0];
report.reload()
.then(function (result) {
$("#result").html("Done. <br/>" + JSON.stringify(result));
})
.catch(function (errors) {
$("#result").html("Error. <br/>" + JSON.stringify(errors));
});
}

function _Report_FullScreen() {
report = powerbi.embeds[0];
report.fullscreen();

$("#result").html("Done!");
}

function _Report_ExitFullScreen() {
report = powerbi.embeds[0];
report.exitFullscreen();

$("#result").html("Done!");
}

// ---- Page Operations ----------------------------------------------------

function _Page_SetActive() {
report = powerbi.embeds[0];

// Set the second page active
report.getPages()
.then(function (pages) {
pages[1].setActive().then(function (result) {
$("#result").html("Done. <br/>" + result)
});
})
.catch(function (errors) {
$("#result").html("getPages Error. " + errors);
});
}

function _Page_GetFilters() {
report = powerbi.embeds[0];

// Get Filters of first page
report.getPages()
.then(function (pages) {
pages[1].getFilters()
.then(function (filters) {
$("#result").html("Done. <br/>" + JSON.stringify(filters, null, " "))
})
.catch(function (errors) {
$("#result").html("Error. <br/>" + JSON.stringify(errors));
});
})
.catch(function (errors) {
$("#result").html("getPages Error. " + errors);
});
}

function _Page_SetFilters() {
const filter = {
$schema: "http://powerbi.com/product/schema#basic",
target: {
table: "Store",
column: "Chain"
},
operator: "In",
values: ["Lindseys"]
};

report = powerbi.embeds[0];
report.getPages()
.then(function (pages) {
pages[1].setFilters([filter])
.then(function (result) {
$("#result").html("Done. <br/>" + JSON.stringify(result));
})
.catch(function (errors) {
$("#result").html("Error. <br/>" + JSON.stringify(errors));
});
})
.catch(function (errors) {
$("#result").html("Error. <br/>" + JSON.stringify(errors));
});
}

function _Page_RemoveFilters() {
report = powerbi.embeds[0];

// Get Filters of first page
report.getPages()
.then(function (pages) {
pages[1].removeFilters()
.then(function (result) {
$("#result").html("Done. <br/>" + JSON.stringify(result));
})
.catch(function (errors) {
$("#result").html("Error. <br/>" + JSON.stringify(errors));
});
})
.catch(function (errors) {
$("#result").html("getPages Error. " + errors);
});
}
4 changes: 4 additions & 0 deletions demo/code-demo/scripts/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
$(function() {
// Open Report Sample.
$("#mainContent").load("report.html");
});
Loading