Skip to content

Commit cb7164a

Browse files
committed
Merged PR 3605: Single Visual Embed implementation.
Single Visual Embed implementation. visual extends report class, which automatically gives the visual object a lot of functions like: refresh, reload, and so ..
1 parent acdd5cf commit cb7164a

File tree

11 files changed

+603
-97
lines changed

11 files changed

+603
-97
lines changed

CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ These are often combined and typical command for debugging tests is:
4848
npm test -- --chrome --debug --watch
4949
```
5050

51+
You can debug by directly calling karma:
52+
```
53+
node node_modules/karma/bin/karma start --browsers=Firefox --single-run=false --watch
54+
```
55+
5156
The build and tests use webpack to compile all the source modules into one bundled module that can execute in the browser.
5257

5358
## Running the demo

dist/powerbi-client.d.ts

Lines changed: 84 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ declare module "embed" {
110110
height?: number;
111111
width?: number;
112112
}
113+
export interface IVisualEmbedConfiguration extends IEmbedConfiguration {
114+
visualName: string;
115+
}
113116
/**
114117
* Configuration settings for Power BI QNA embed component
115118
*
@@ -414,7 +417,7 @@ declare module "ifilterable" {
414417
removeFilters(): Promise<void>;
415418
}
416419
}
417-
declare module "visual" {
420+
declare module "visualDescriptor" {
418421
import * as models from 'powerbi-models';
419422
import { IPageNode } from "page";
420423
/**
@@ -434,10 +437,10 @@ declare module "visual" {
434437
* A Power BI visual within a page
435438
*
436439
* @export
437-
* @class Visual
440+
* @class VisualDescriptor
438441
* @implements {IVisualNode}
439442
*/
440-
export class Visual implements IVisualNode {
443+
export class VisualDescriptor implements IVisualNode {
441444
/**
442445
* The visual name
443446
*
@@ -474,7 +477,7 @@ declare module "visual" {
474477
declare module "page" {
475478
import { IFilterable } from "ifilterable";
476479
import { IReportNode } from "report";
477-
import { Visual } from "visual";
480+
import { VisualDescriptor } from "visualDescriptor";
478481
import * as models from 'powerbi-models';
479482
/**
480483
* A Page node within a report hierarchy
@@ -579,9 +582,9 @@ declare module "page" {
579582
* .then(visuals => { ... });
580583
* ```
581584
*
582-
* @returns {Promise<Visual[]>}
585+
* @returns {Promise<VisualDescriptor[]>}
583586
*/
584-
getVisuals(): Promise<Visual[]>;
587+
getVisuals(): Promise<VisualDescriptor[]>;
585588
}
586589
}
587590
declare module "defaults" {
@@ -961,6 +964,80 @@ declare module "qna" {
961964
validate(config: embed.IEmbedConfigurationBase): models.IError[];
962965
}
963966
}
967+
declare module "visual" {
968+
import * as service from "service";
969+
import * as embed from "embed";
970+
import * as models from 'powerbi-models';
971+
import { Report } from "report";
972+
import { Page } from "page";
973+
/**
974+
* The Power BI Visual embed component
975+
*
976+
* @export
977+
* @class Visual
978+
*/
979+
export class Visual extends Report {
980+
static type: string;
981+
static GetFiltersNotSupportedError: string;
982+
static SetFiltersNotSupportedError: string;
983+
static GetPagesNotSupportedError: string;
984+
static SetPageNotSupportedError: string;
985+
/**
986+
* Creates an instance of a Power BI Single Visual.
987+
*
988+
* @param {service.Service} service
989+
* @param {HTMLElement} element
990+
* @param {embed.IEmbedConfiguration} config
991+
*/
992+
constructor(service: service.Service, element: HTMLElement, baseConfig: embed.IEmbedConfigurationBase, phasedRender?: boolean, iframe?: HTMLIFrameElement);
993+
load(baseConfig: embed.IEmbedConfigurationBase, phasedRender?: boolean): Promise<void>;
994+
/**
995+
* Gets the list of pages within the report - not supported in visual embed.
996+
*
997+
* @returns {Promise<Page[]>}
998+
*/
999+
getPages(): Promise<Page[]>;
1000+
/**
1001+
* Sets the active page of the report - not supported in visual embed.
1002+
*
1003+
* @param {string} pageName
1004+
* @returns {Promise<void>}
1005+
*/
1006+
setPage(pageName: string): Promise<void>;
1007+
/**
1008+
* Gets filters that are applied at the visual level.
1009+
*
1010+
* ```javascript
1011+
* // Get filters applied at visual level
1012+
* visual.getFilters()
1013+
* .then(filters => {
1014+
* ...
1015+
* });
1016+
* ```
1017+
*
1018+
* @returns {Promise<models.IFilter[]>}
1019+
*/
1020+
getFilters(): Promise<models.IFilter[]>;
1021+
/**
1022+
* Sets filters at the visual level.
1023+
*
1024+
* ```javascript
1025+
* const filters: [
1026+
* ...
1027+
* ];
1028+
*
1029+
* visual.setFilters(filters)
1030+
* .catch(errors => {
1031+
* ...
1032+
* });
1033+
* ```
1034+
*
1035+
* @param {(models.IFilter[])} filters
1036+
* @returns {Promise<void>}
1037+
*/
1038+
setFilters(filters: models.IFilter[]): Promise<void>;
1039+
}
1040+
}
9641041
declare module "service" {
9651042
import * as embed from "embed";
9661043
import * as wpmp from 'window-post-message-proxy';
@@ -1212,6 +1289,7 @@ declare module "powerbi-client" {
12121289
export { Page } from "page";
12131290
export { Qna } from "qna";
12141291
export { Visual } from "visual";
1292+
export { VisualDescriptor } from "visualDescriptor";
12151293
global {
12161294
interface Window {
12171295
powerbi: service.Service;

0 commit comments

Comments
 (0)