@@ -4,6 +4,7 @@ import * as models from 'powerbi-models';
4
4
import * as wpmp from 'window-post-message-proxy' ;
5
5
import * as hpm from 'http-post-message' ;
6
6
import * as utils from './util' ;
7
+ import * as errors from './errors' ;
7
8
import { IFilterable } from './ifilterable' ;
8
9
import { IPageNode , Page } from './page' ;
9
10
import { Defaults } from './defaults' ;
@@ -38,7 +39,7 @@ export class Report extends embed.Embed implements IReportNode, IFilterable {
38
39
static navContentPaneEnabledAttribute = 'powerbi-settings-nav-content-pane-enabled' ;
39
40
static typeAttribute = 'powerbi-type' ;
40
41
static type = "Report" ;
41
-
42
+
42
43
public bookmarksManager : BookmarksManager ;
43
44
44
45
/**
@@ -129,6 +130,10 @@ export class Report extends embed.Embed implements IReportNode, IFilterable {
129
130
* @returns {Promise<models.IFilter[]> }
130
131
*/
131
132
getFilters ( ) : Promise < models . IFilter [ ] > {
133
+ if ( utils . isRDLEmbed ( this . config . embedUrl ) ) {
134
+ return Promise . reject ( errors . APINotSupportedForRDLError ) ;
135
+ }
136
+
132
137
return this . service . hpm . get < models . IFilter [ ] > ( `/report/filters` , { uid : this . config . uniqueId } , this . iframe . contentWindow )
133
138
. then ( response => response . body ,
134
139
response => {
@@ -165,6 +170,10 @@ export class Report extends embed.Embed implements IReportNode, IFilterable {
165
170
* @returns {Promise<Page[]> }
166
171
*/
167
172
getPages ( ) : Promise < Page [ ] > {
173
+ if ( utils . isRDLEmbed ( this . config . embedUrl ) ) {
174
+ return Promise . reject ( errors . APINotSupportedForRDLError ) ;
175
+ }
176
+
168
177
return this . service . hpm . get < models . IPage [ ] > ( '/report/pages' , { uid : this . config . uniqueId } , this . iframe . contentWindow )
169
178
. then ( response => {
170
179
return response . body
@@ -203,6 +212,10 @@ export class Report extends embed.Embed implements IReportNode, IFilterable {
203
212
* Prints the active page of the report by invoking `window.print()` on the embed iframe component.
204
213
*/
205
214
print ( ) : Promise < void > {
215
+ if ( utils . isRDLEmbed ( this . config . embedUrl ) ) {
216
+ return Promise . reject ( errors . APINotSupportedForRDLError ) ;
217
+ }
218
+
206
219
return this . service . hpm . post < models . IError [ ] > ( '/report/print' , null , { uid : this . config . uniqueId } , this . iframe . contentWindow )
207
220
. then ( response => {
208
221
return response . body ;
@@ -222,6 +235,10 @@ export class Report extends embed.Embed implements IReportNode, IFilterable {
222
235
* @returns {Promise<void> }
223
236
*/
224
237
removeFilters ( ) : Promise < void > {
238
+ if ( utils . isRDLEmbed ( this . config . embedUrl ) ) {
239
+ return Promise . reject ( errors . APINotSupportedForRDLError ) ;
240
+ }
241
+
225
242
return this . setFilters ( [ ] ) ;
226
243
}
227
244
@@ -237,6 +254,10 @@ export class Report extends embed.Embed implements IReportNode, IFilterable {
237
254
* @returns {Promise<void> }
238
255
*/
239
256
setPage ( pageName : string ) : Promise < void > {
257
+ if ( utils . isRDLEmbed ( this . config . embedUrl ) ) {
258
+ return Promise . reject ( errors . APINotSupportedForRDLError ) ;
259
+ }
260
+
240
261
const page : models . IPage = {
241
262
name : pageName ,
242
263
displayName : null ,
@@ -267,6 +288,11 @@ export class Report extends embed.Embed implements IReportNode, IFilterable {
267
288
* @returns {Promise<void> }
268
289
*/
269
290
setFilters ( filters : models . IFilter [ ] ) : Promise < void > {
291
+ if ( utils . isRDLEmbed ( this . config . embedUrl ) ) {
292
+ return Promise . reject ( errors . APINotSupportedForRDLError ) ;
293
+ }
294
+
295
+
270
296
return this . service . hpm . put < models . IError [ ] > ( `/report/filters` , filters , { uid : this . config . uniqueId } , this . iframe . contentWindow )
271
297
. catch ( response => {
272
298
throw response . body ;
@@ -290,6 +316,10 @@ export class Report extends embed.Embed implements IReportNode, IFilterable {
290
316
* @returns {Promise<void> }
291
317
*/
292
318
updateSettings ( settings : models . ISettings ) : Promise < void > {
319
+ if ( utils . isRDLEmbed ( this . config . embedUrl ) && settings . customLayout != null ) {
320
+ return Promise . reject ( errors . APINotSupportedForRDLError ) ;
321
+ }
322
+
293
323
return this . service . hpm . patch < models . IError [ ] > ( '/report/settings' , settings , { uid : this . config . uniqueId } , this . iframe . contentWindow )
294
324
. catch ( response => {
295
325
throw response . body ;
@@ -375,6 +405,10 @@ export class Report extends embed.Embed implements IReportNode, IFilterable {
375
405
* @returns {Promise<boolean> }
376
406
*/
377
407
isSaved ( ) : Promise < boolean > {
408
+ if ( utils . isRDLEmbed ( this . config . embedUrl ) ) {
409
+ return Promise . reject ( errors . APINotSupportedForRDLError ) ;
410
+ }
411
+
378
412
return utils . isSavedInternal ( this . service . hpm , this . config . uniqueId , this . iframe . contentWindow ) ;
379
413
}
380
414
@@ -386,6 +420,10 @@ export class Report extends embed.Embed implements IReportNode, IFilterable {
386
420
* ```
387
421
*/
388
422
applyTheme ( theme : models . IReportTheme ) : Promise < void > {
423
+ if ( utils . isRDLEmbed ( this . config . embedUrl ) ) {
424
+ return Promise . reject ( errors . APINotSupportedForRDLError ) ;
425
+ }
426
+
389
427
return this . applyThemeInternal ( theme ) ;
390
428
}
391
429
@@ -397,6 +435,10 @@ export class Report extends embed.Embed implements IReportNode, IFilterable {
397
435
* ```
398
436
*/
399
437
resetTheme ( ) : Promise < void > {
438
+ if ( utils . isRDLEmbed ( this . config . embedUrl ) ) {
439
+ return Promise . reject ( errors . APINotSupportedForRDLError ) ;
440
+ }
441
+
400
442
return this . applyThemeInternal ( < models . IReportTheme > { } ) ;
401
443
}
402
444
0 commit comments