Skip to content

Commit

Permalink
Merge remote-tracking branch 'powerbi/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
laurent-mic committed Mar 27, 2019
2 parents fa039b2 + eadb4be commit 7ba2ffe
Show file tree
Hide file tree
Showing 9 changed files with 228 additions and 172 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,18 @@ function embedInsightsToActionReport() {
.then(function (pages) {

// Retrieve active page.
let activePage = pages.find(function(page) {
let activePage = pages.filter(function(page) {
return page.isActive
});
})[0];

// Get page's visuals
activePage.getVisuals()
.then(function (visuals) {

// Retrieve the wanted visual.
let visual = visuals.find(function(visual) {
let visual = visuals.filter(function(visual) {
return visual.name === tableVisualName;
});
})[0];

// Exports visual data
visual.exportData(models.ExportDataType.Underlying).then(handleExportData);
Expand Down Expand Up @@ -191,7 +191,10 @@ function parseData(data) {
// Filter the table's data - removing the 'filterValues' columns
function filterTable(filterValues, table) {
for (let i = 0; i < filterValues.length; i++) {
valueIndex = table[0].findIndex(function(value) { return value === filterValues[i] });
valueIndex = table[0].indexOf(
table[0].filter(function(value) { return value === filterValues[i] })[0]
);

for (let j = 0; j < table.length; j++) {
table[j].splice(valueIndex, 1);
}
Expand Down
76 changes: 38 additions & 38 deletions demo/v2-demo/scripts/codesamples.js
Original file line number Diff line number Diff line change
Expand Up @@ -1565,9 +1565,9 @@ function _Page_GetFilters() {
report.getPages()
.then(function (pages) {
// Retrieve active page.
var activePage = pages.find(function(page) {
var activePage = pages.filter(function(page) {
return page.isActive
});
})[0];

activePage.getFilters()
.then(function (filters) {
Expand All @@ -1593,9 +1593,9 @@ function _Page_GetVisuals() {
report.getPages()
.then(function (pages) {
// Retrieve active page.
var activePage = pages.find(function(page) {
var activePage = pages.filter(function(page) {
return page.isActive
});
})[0];

activePage.getVisuals()
.then(function (visuals) {
Expand Down Expand Up @@ -1642,9 +1642,9 @@ function _Page_SetFilters() {
report.getPages()
.then(function (pages) {
// Retrieve active page.
var activePage = pages.find(function(page) {
var activePage = pages.filter(function(page) {
return page.isActive
});
})[0];

activePage.setFilters([filter])
.then(function () {
Expand All @@ -1670,9 +1670,9 @@ function _Page_RemoveFilters() {
report.getPages()
.then(function (pages) {
// Retrieve active page.
var activePage = pages.find(function(page) {
var activePage = pages.filter(function(page) {
return page.isActive
});
})[0];

activePage.removeFilters()
.then(function () {
Expand Down Expand Up @@ -2187,16 +2187,16 @@ function _Visual_GetSlicer() {
report.getPages()
.then(function (pages) {
// Retrieve active page.
var activePage = pages.find(function(page) {
var activePage = pages.filter(function(page) {
return page.isActive;
});
})[0];

activePage.getVisuals()
.then(function (visuals) {
// Retrieve the wanted visual.
var slicer = visuals.find(function(visual) {
var slicer = visuals.filter(function(visual) {
return visual.type == "slicer" && visual.name == "4d55baaa5eddde4cdf90";
});
})[0];

// Get the slicer state which contains the slicer filter.
slicer.getSlicerState()
Expand Down Expand Up @@ -2249,16 +2249,16 @@ function _Visual_SetSlicer() {
report.getPages()
.then(function (pages) {
// Retrieve active page.
var activePage = pages.find(function(page) {
var activePage = pages.filter(function(page) {
return page.isActive;
});
})[0];

activePage.getVisuals()
.then(function (visuals) {
// Retrieve the wanted visual.
var slicer = visuals.find(function(visual) {
var slicer = visuals.filter(function(visual) {
return visual.type == "slicer" && visual.name == "4d55baaa5eddde4cdf90";
});
})[0];

// Set the slicer state which contains the slicer filters.
slicer.setSlicerState({ filters: [filter]})
Expand Down Expand Up @@ -2308,17 +2308,17 @@ function _Visual_SetFilters() {
.then(function (pages) {

// Retrieve active page.
var activePage = pages.find(function(page) {
var activePage = pages.filter(function(page) {
return page.isActive
});
})[0];

activePage.getVisuals()
.then(function (visuals) {

// Retrieve the wanted visual.
var visual = visuals.find(function(visual) {
var visual = visuals.filter(function(visual) {
return visual.name == "VisualContainer4";
});
})[0];

// Set the filter for the visual.
// Pay attention that setFilters receives an array.
Expand Down Expand Up @@ -2351,17 +2351,17 @@ function _Visual_GetFilters() {
.then(function (pages) {

// Retrieve active page.
var activePage = pages.find(function(page) {
var activePage = pages.filter(function(page) {
return page.isActive
});
})[0];

activePage.getVisuals()
.then(function (visuals) {

// Retrieve the wanted visual.
var visual = visuals.find(function(visual) {
var visual = visuals.filter(function(visual) {
return visual.name == "VisualContainer4";
});
})[0];

visual.getFilters()
.then(function (filters) {
Expand Down Expand Up @@ -2392,17 +2392,17 @@ function _Visual_RemoveFilters() {
.then(function (pages) {

// Retrieve active page.
var activePage = pages.find(function(page) {
var activePage = pages.filter(function(page) {
return page.isActive
});
})[0];

activePage.getVisuals()
.then(function (visuals) {

// Retrieve the wanted visual.
var visual = visuals.find(function(visual) {
return visual.name == "47eb6c0240defd498d4b";
});
var visual = visuals.filter(function(visual) {
return visual.name == "VisualContainer4";
})[0];

visual.removeFilters()
.then(function () {
Expand Down Expand Up @@ -2436,17 +2436,17 @@ function _Visual_ExportData_Summarized() {
.then(function (pages) {

// Retrieve active page.
var activePage = pages.find(function(page) {
var activePage = pages.filter(function(page) {
return page.isActive
});
})[0];

activePage.getVisuals()
.then(function (visuals) {

// Retrieve the wanted visual.
var visual = visuals.find(function(visual) {
var visual = visuals.filter(function(visual) {
return visual.name == "VisualContainer4";
});
})[0];

// Exports visual data
visual.exportData(models.ExportDataType.Summarized)
Expand Down Expand Up @@ -2481,17 +2481,17 @@ function _Visual_ExportData_Underlying() {
.then(function (pages) {

// Retrieve active page.
var activePage = pages.find(function(page) {
var activePage = pages.filter(function(page) {
return page.isActive
});
})[0];

activePage.getVisuals()
.then(function (visuals) {

// Retrieve the wanted visual.
var visual = visuals.find(function(visual) {
var visual = visuals.filter(function(visual) {
return visual.name == "VisualContainer4";
});
})[0];

// Exports visual data
visual.exportData(models.ExportDataType.Underlying)
Expand Down Expand Up @@ -2551,7 +2551,7 @@ function _ReportVisual_HideSingleVisualHeader() {
},
selector: {
$schema: "http://powerbi.com/product/schema#visualSelector",
visualName: "47eb6c0240defd498d4b"
visualName: "VisualContainer4"
// The visual name can be retrieved using getVisuals()
// Hide visual header for a single visual only
}
Expand Down
2 changes: 1 addition & 1 deletion demo/v2-demo/scripts/session_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ function FetchUrlIntoSession(url, updateCurrentToken) {
{
let embedContainerId = getEmbedContainerID(capitalizeFirstLetter(embedConfig.type));

let embedContainer = powerbi.embeds.find(function(embedElement) {return (embedElement.element.id == embedContainerId)});
let embedContainer = powerbi.embeds.filter(function(embedElement) { return embedElement.element.id === embedContainerId; })[0];
if (embedContainer)
{
embedContainer.setAccessToken(embedConfig.embedToken.token);
Expand Down
10 changes: 9 additions & 1 deletion dist/powerbi-client.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! powerbi-client v2.7.2 | (c) 2016 Microsoft Corporation MIT */
/*! powerbi-client v2.7.3 | (c) 2016 Microsoft Corporation MIT */
declare module "util" {
import { HttpPostMessage } from 'http-post-message';
/**
Expand Down Expand Up @@ -413,6 +413,14 @@ declare module "embed" {
* Sets Iframe's title
*/
setComponentTitle(title: string): void;
/**
* Sets elements's tabindex attribute
*/
setComponentTabIndex(tabIndex?: number): void;
/**
* Removes element's tabindex attribute
*/
removeComponentTabIndex(tabIndex?: number): void;
/**
* Adds the ability to get groupId from url.
* By extracting the ID we can ensure that the ID is always explicitly provided as part of the load configuration.
Expand Down
Loading

0 comments on commit 7ba2ffe

Please sign in to comment.