Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
13 changes: 13 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,16 @@ Open the address to view in the browser:
```
http://127.0.0.1:8080/
```

## Updating the documenatation (For those with push permissions only)
First run the command to build the docs and open it to verify the changes are as expected.

```
npm run gulp -- build:docs
```
> There are errors during the TypeDoc compilation step due to some complication with modules however the documentation should still be generated. It's not clear if these are fixable by including more src files in the gulp task or if it's just the nature of TypeDoc lacking capabilities for this project structure.

If the docs are correct then you may publish them to gh-pages using this command
```
npm run gulp -- ghpages
```
39 changes: 39 additions & 0 deletions demo/app/dataselection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
$(function () {
var models = window['powerbi-client'].models;

console.log('Scenario 7: Data Selection');

var reportUrl = 'https://powerbiembedapi.azurewebsites.net/api/reports/c52af8ab-0468-4165-92af-dc39858d66ad';
var $reportContainer = $('#reportContainer');
var report;
var $dataSelectedContainer = $("#dataSelectedContainer");

// Init
fetch(reportUrl)
.then(function (response) {
if (response.ok) {
return response.json()
.then(function (embedConfig) {
report = powerbi.embed($reportContainer.get(0), embedConfig);
initializeDataSelection(report, $dataSelectedContainer);
return report;
});
}
else {
return response.json()
.then(function (error) {
throw new Error(error);
});
}
});
});

function initializeDataSelection(report, $dataSelectedContainer) {
report.on('dataSelected', event => {
console.log('dataSelected: ', event);

var data = event.detail;

$dataSelectedContainer.text(JSON.stringify(data, null, ' '));
});
}
2 changes: 1 addition & 1 deletion demo/app/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ $(function () {

console.log('Scenario 5: Default Page and/or Filter');

var staticReportUrl = 'https://powerbiembedapi.azurewebsites.net/api/dxt/reports/c4d31ef0-7b34-4d80-9bcb-5974d1405572';
var staticReportUrl = 'https://powerbiembedapi.azurewebsites.net/api/reports/c52af8ab-0468-4165-92af-dc39858d66ad';
var $defaultPageReportContainer = $('#reportdefaults');
var defaultPageReport;
var defaultPageName = 'ReportSection2';
Expand Down
4 changes: 2 additions & 2 deletions demo/app/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ $(function () {

console.log('Scenario 4: Custom Filter Pane');

var reportUrl = 'https://powerbiembedapi.azurewebsites.net/api/dxt/reports/c4d31ef0-7b34-4d80-9bcb-5974d1405572';
var reportUrl = 'https://powerbiembedapi.azurewebsites.net/api/reports/c52af8ab-0468-4165-92af-dc39858d66ad';
var $customFilterPaneContainer = $('#reportcustomfilter');
var customFilterPaneReport;
var customFilterPaneReportPages;
Expand Down Expand Up @@ -223,7 +223,7 @@ $(function () {
$element.empty();
filters
.map(generateFilterElement)
.forEach(function ($filterS) {
.forEach(function ($filter) {
$element.append($filter);
});
});
Expand Down
2 changes: 1 addition & 1 deletion demo/app/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ $(function () {

console.log('Scenario 6: Update settings');

var reportUrl = 'https://powerbiembedapi.azurewebsites.net/api/dxt/reports/c4d31ef0-7b34-4d80-9bcb-5974d1405572';
var reportUrl = 'https://powerbiembedapi.azurewebsites.net/api/reports/c52af8ab-0468-4165-92af-dc39858d66ad';
var $updateSettingsReport = $('#updatesettingsreport');
var updateSettingsReport;
var updateSettingsReportFilterPaneEnabled = false;
Expand Down
49 changes: 49 additions & 0 deletions demo/dataselection.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Power BI - Sample - Client - JavaScript</title>
<base path="/" />

<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="styles/app.css" />
</head>
<body>
<div class="container">
<h1>Power BI - Sample - Client - Javascript</h1>
<p>Demonstrate how to embed reports and interact with them using the api provided by the core library. <a href="https://github.com/microsoft/PowerBI-JavaScript" target="_blank">PowerBI-JavaScript</a></p>

<h2>Scenarios:</h2>
<ul id="navigation" class="nav nav-pills">
<li id="pageLinkStatic" class=""><a href="index.html">Scenario 1: Static Embed</a></li>
<li id="pageLinkDynamic" class=""><a href="dynamic.html">Scenario 2: Dynamic Embed</a></li>
<li id="pageLinkPageNav" class=""><a href="pagenavigation.html">Scenario 3: Custom Page Navigation</a></li>
<li id="pageLinkFilters" class=""><a href="filters.html">Scenario 4: Custom Filter Pane</a></li>
<li id="pageLinkDefaults" class=""><a href="defaults.html">Scenario 5: Default Page and/or Filter</a></li>
<li id="pageLinkSettings" class=""><a href="settings.html">Scenario 6: Update Settings</a></li>
<li id="pageLinkDataSelection" class="active"><a href="dataselection.html">Scenario 7: Data Selection</a></li>
</ul>

<h2>Data Selection Events</h2>
<p>Respond to user selecting data.</p>

<div id="reportContainer" class="powerbi-container"></div>

<h2>Data Selected Event Data:</h2>
<p>Notice the event.detail contains information about the visual the user clicked and the page the visual is on. It also contains details about the data the user clicked such as identity, value, and regions if applicable.</p>
<p>Note: the values rendered in the tooltip are currently not returned in event but we hope to have this feature soon.</p>
<pre id="dataSelectedContainer">
</pre>
</div>

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

<script src="app/dataselection.js"></script>

</body>
</html>
3 changes: 2 additions & 1 deletion demo/defaults.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<body>
<div class="container">
<h1>Power BI - Sample - Client - Javascript</h1>
<p>Demonstrate how to consume Power BI API and render using core library. <a href="https://github.com/microsoft/PowerBI-JavaScript" target="_blank">PowerBI-JavaScript</a></p>
<p>Demonstrate how to embed reports and interact with them using the api provided by the core library. <a href="https://github.com/microsoft/PowerBI-JavaScript" target="_blank">PowerBI-JavaScript</a></p>

<h2>Scenarios:</h2>
<ul id="navigation" class="nav nav-pills">
Expand All @@ -23,6 +23,7 @@ <h2>Scenarios:</h2>
<li id="pageLinkFilters" class=""><a href="filters.html">Scenario 4: Custom Filter Pane</a></li>
<li id="pageLinkDefaults" class="active"><a href="defaults.html">Scenario 5: Default Page and/or Filter</a></li>
<li id="pageLinkSettings" class=""><a href="settings.html">Scenario 6: Update Settings</a></li>
<li id="pageLinkDataSelection" class=""><a href="dataselection.html">Scenario 7: Data Selection</a></li>
</ul>

<h2>Default Page and/or Default Filter</h2>
Expand Down
3 changes: 2 additions & 1 deletion demo/dynamic.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<body>
<div class="container">
<h1>Power BI - Sample - Client - Javascript</h1>
<p>Demonstrate how to consume Power BI API and render using core library. <a href="https://github.com/microsoft/PowerBI-JavaScript" target="_blank">PowerBI-JavaScript</a></p>
<p>Demonstrate how to embed reports and interact with them using the api provided by the core library. <a href="https://github.com/microsoft/PowerBI-JavaScript" target="_blank">PowerBI-JavaScript</a></p>

<h2>Scenarios:</h2>
<ul id="navigation" class="nav nav-pills">
Expand All @@ -23,6 +23,7 @@ <h2>Scenarios:</h2>
<li id="pageLinkFilters" class=""><a href="filters.html">Scenario 4: Custom Filter Pane</a></li>
<li id="pageLinkDefaults" class=""><a href="defaults.html">Scenario 5: Default Page and/or Filter</a></li>
<li id="pageLinkSettings" class=""><a href="settings.html">Scenario 6: Update Settings</a></li>
<li id="pageLinkDataSelection" class=""><a href="dataselection.html">Scenario 7: Data Selection</a></li>
</ul>

<h2>Dynamic Embed</h2>
Expand Down
3 changes: 2 additions & 1 deletion demo/filters.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<body>
<div class="container">
<h1>Power BI - Sample - Client - Javascript</h1>
<p>Demonstrate how to consume Power BI API and render using core library. <a href="https://github.com/microsoft/PowerBI-JavaScript" target="_blank">PowerBI-JavaScript</a></p>
<p>Demonstrate how to embed reports and interact with them using the api provided by the core library. <a href="https://github.com/microsoft/PowerBI-JavaScript" target="_blank">PowerBI-JavaScript</a></p>

<h2>Scenarios:</h2>
<ul id="navigation" class="nav nav-pills">
Expand All @@ -23,6 +23,7 @@ <h2>Scenarios:</h2>
<li id="pageLinkFilters" class="active"><a href="filters.html">Scenario 4: Custom Filter Pane</a></li>
<li id="pageLinkDefaults" class=""><a href="defaults.html">Scenario 5: Default Page and/or Filter</a></li>
<li id="pageLinkSettings" class=""><a href="settings.html">Scenario 6: Update Settings</a></li>
<li id="pageLinkDataSelection" class=""><a href="dataselection.html">Scenario 7: Data Selection</a></li>
</ul>

<h2>Custom Filter Pane</h2>
Expand Down
3 changes: 2 additions & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<body>
<div class="container">
<h1>Power BI - Sample - Client - Javascript</h1>
<p>Demonstrate how to consume Power BI API and render using core library. <a href="https://github.com/microsoft/PowerBI-JavaScript" target="_blank">PowerBI-JavaScript</a></p>
<p>Demonstrate how to embed reports and interact with them using the api provided by the core library. <a href="https://github.com/microsoft/PowerBI-JavaScript" target="_blank">PowerBI-JavaScript</a></p>

<h2>Scenarios:</h2>
<ul id="navigation" class="nav nav-pills">
Expand All @@ -23,6 +23,7 @@ <h2>Scenarios:</h2>
<li id="pageLinkFilters" class=""><a href="filters.html">Scenario 4: Custom Filter Pane</a></li>
<li id="pageLinkDefaults" class=""><a href="defaults.html">Scenario 5: Default Page and/or Filter</a></li>
<li id="pageLinkSettings" class=""><a href="settings.html">Scenario 6: Update Settings</a></li>
<li id="pageLinkDataSelection" class=""><a href="dataselection.html">Scenario 7: Data Selection</a></li>
</ul>

<h2>Static Embed</h2>
Expand Down
3 changes: 2 additions & 1 deletion demo/pagenavigation.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<body>
<div class="container">
<h1>Power BI - Sample - Client - Javascript</h1>
<p>Demonstrate how to consume Power BI API and render using core library. <a href="https://github.com/microsoft/PowerBI-JavaScript" target="_blank">PowerBI-JavaScript</a></p>
<p>Demonstrate how to embed reports and interact with them using the api provided by the core library. <a href="https://github.com/microsoft/PowerBI-JavaScript" target="_blank">PowerBI-JavaScript</a></p>

<h2>Scenarios:</h2>
<ul id="navigation" class="nav nav-pills">
Expand All @@ -23,6 +23,7 @@ <h2>Scenarios:</h2>
<li id="pageLinkFilters" class=""><a href="filters.html">Scenario 4: Custom Filter Pane</a></li>
<li id="pageLinkDefaults" class=""><a href="defaults.html">Scenario 5: Default Page and/or Filter</a></li>
<li id="pageLinkSettings" class=""><a href="settings.html">Scenario 6: Update Settings</a></li>
<li id="pageLinkDataSelection" class=""><a href="dataselection.html">Scenario 7: Data Selection</a></li>
</ul>

<h2>Custom Page Navigation</h2>
Expand Down
3 changes: 2 additions & 1 deletion demo/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<body>
<div class="container">
<h1>Power BI - Sample - Client - Javascript</h1>
<p>Demonstrate how to consume Power BI API and render using core library. <a href="https://github.com/microsoft/PowerBI-JavaScript" target="_blank">PowerBI-JavaScript</a></p>
<p>Demonstrate how to embed reports and interact with them using the api provided by the core library. <a href="https://github.com/microsoft/PowerBI-JavaScript" target="_blank">PowerBI-JavaScript</a></p>

<h2>Scenarios:</h2>
<ul id="navigation" class="nav nav-pills">
Expand All @@ -23,6 +23,7 @@ <h2>Scenarios:</h2>
<li id="pageLinkFilters" class=""><a href="filters.html">Scenario 4: Custom Filter Pane</a></li>
<li id="pageLinkDefaults" class=""><a href="defaults.html">Scenario 5: Default Page and/or Filter</a></li>
<li id="pageLinkSettings" class="active"><a href="settings.html">Scenario 6: Update Settings</a></li>
<li id="pageLinkDataSelection" class=""><a href="dataselection.html">Scenario 7: Data Selection</a></li>
</ul>

<h2>Update Settings</h2>
Expand Down
2 changes: 1 addition & 1 deletion dist/config.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! powerbi-client v2.0.0 | (c) 2016 Microsoft Corporation MIT */
/*! powerbi-client v2.1.1 | (c) 2016 Microsoft Corporation MIT */
declare const config: {
version: string;
type: string;
Expand Down
58 changes: 58 additions & 0 deletions dist/dashboard.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*! powerbi-client v2.1.1 | (c) 2016 Microsoft Corporation MIT */
import * as service from './service';
import * as embed from './embed';
import * as models from 'powerbi-models';
/**
* A Dashboard node within a dashboard hierarchy
*
* @export
* @interface IDashboardNode
*/
export interface IDashboardNode {
iframe: HTMLIFrameElement;
service: service.IService;
config: embed.IInternalEmbedConfiguration;
}
/**
* A Power BI Dashboard embed component
*
* @export
* @class Dashboard
* @extends {embed.Embed}
* @implements {IDashboardNode}
* @implements {IFilterable}
*/
export declare class Dashboard extends embed.Embed implements IDashboardNode {
static allowedEvents: string[];
static dashboardIdAttribute: string;
static typeAttribute: string;
static type: string;
/**
* Creates an instance of a Power BI Dashboard.
*
* @param {service.Service} service
* @param {HTMLElement} element
*/
constructor(service: service.Service, element: HTMLElement, config: embed.IEmbedConfiguration);
/**
* This adds backwards compatibility for older config which used the dashboardId query param to specify dashboard id.
* E.g. https://powerbi-df.analysis-df.windows.net/dashboardEmbedHost?dashboardId=e9363c62-edb6-4eac-92d3-2199c5ca2a9e
*
* By extracting the id we can ensure id is always explicitly provided as part of the load configuration.
*
* @static
* @param {string} url
* @returns {string}
*/
static findIdFromEmbedUrl(url: string): string;
/**
* Get dashboard id from first available location: options, attribute, embed url.
*
* @returns {string}
*/
getId(): string;
/**
* Validate load configuration.
*/
validate(config: models.IDashboardLoadConfiguration): models.IError[];
}
14 changes: 11 additions & 3 deletions dist/embed.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! powerbi-client v2.0.0 | (c) 2016 Microsoft Corporation MIT */
/*! powerbi-client v2.1.1 | (c) 2016 Microsoft Corporation MIT */
import * as service from './service';
import * as models from 'powerbi-models';
declare global {
Expand Down Expand Up @@ -27,7 +27,7 @@ export interface IEmbedConfiguration {
pageName?: string;
filters?: models.IFilter[];
}
export interface IInternalEmbedConfiguration extends models.ILoadConfiguration {
export interface IInternalEmbedConfiguration extends models.IReportLoadConfiguration {
uniqueId: string;
type: string;
embedUrl: string;
Expand Down Expand Up @@ -82,6 +82,10 @@ export declare abstract class Embed {
* @type {IInternalEmbedConfiguration}
*/
config: IInternalEmbedConfiguration;
/**
* Url used in the load request.
*/
loadPath: string;
/**
* Creates an instance of Embed.
*
Expand Down Expand Up @@ -117,7 +121,7 @@ export declare abstract class Embed {
* @param {models.ILoadConfiguration} config
* @returns {Promise<void>}
*/
load(config: models.ILoadConfiguration): Promise<void>;
load(config: models.IReportLoadConfiguration | models.IDashboardLoadConfiguration): Promise<void>;
/**
* Removes one or more event handlers from the list of handlers.
* If a reference to the existing handle function is specified, remove the specific handler.
Expand Down Expand Up @@ -210,4 +214,8 @@ export declare abstract class Embed {
* @returns {boolean}
*/
private isFullscreen(iframe);
/**
* Validate load configuration.
*/
abstract validate(config: models.IReportLoadConfiguration | models.IDashboardLoadConfiguration): models.IError[];
}
2 changes: 1 addition & 1 deletion dist/factories.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! powerbi-client v2.0.0 | (c) 2016 Microsoft Corporation MIT */
/*! powerbi-client v2.1.1 | (c) 2016 Microsoft Corporation MIT */
/**
* TODO: Need to find better place for these factory functions or refactor how we handle dependency injection
*/
Expand Down
4 changes: 2 additions & 2 deletions dist/ifilterable.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*! powerbi-client v2.0.0 | (c) 2016 Microsoft Corporation MIT */
/*! powerbi-client v2.1.1 | (c) 2016 Microsoft Corporation MIT */
import * as models from 'powerbi-models';
/**
* Decorates embed components that support filters
* Examples include reports, pages and visuals
* Examples include reports and pages
*
* @export
* @interface IFilterable
Expand Down
2 changes: 1 addition & 1 deletion dist/page.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! powerbi-client v2.0.0 | (c) 2016 Microsoft Corporation MIT */
/*! powerbi-client v2.1.1 | (c) 2016 Microsoft Corporation MIT */
import { IFilterable } from './ifilterable';
import { IReportNode } from './report';
import * as models from 'powerbi-models';
Expand Down
2 changes: 1 addition & 1 deletion dist/powerbi.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! powerbi-client v2.0.0 | (c) 2016 Microsoft Corporation MIT */
/*! powerbi-client v2.1.1 | (c) 2016 Microsoft Corporation MIT */
import * as service from './service';
import * as factories from './factories';
import * as models from 'powerbi-models';
Expand Down
Loading