Repository navigation
Add pageView to loadDashboardConfiguration - #95
Conversation
| validate(config: models.IDashboardLoadConfiguration): models.IError[] { | ||
| return models.validateDashboardLoad(config); | ||
| let error = models.validateDashboardLoad(config); | ||
| return error ? error : this.ValidatePageView(config.pageView); |
There was a problem hiding this comment.
i think you can do
error || this.validate....
There was a problem hiding this comment.
I think it will return false or true like this - won't it? I want to return the error itself.
There was a problem hiding this comment.
the "error" variable isn't boolean...
| validate(config: models.IDashboardLoadConfiguration): models.IError[] { | ||
| return models.validateDashboardLoad(config); | ||
| let error = models.validateDashboardLoad(config); | ||
| return error ? error : this.ValidatePageView(config.pageView); |
There was a problem hiding this comment.
Why isn't ValidatePageView part of validateDashboardLoad?
There was a problem hiding this comment.
validateDashboardLoad is auto generated in the powerbi-models project...
| /** | ||
| * Validate that pageView has a legal value: if page view is defined it must have one of the values defined in models.PageView | ||
| */ | ||
| private ValidatePageView(pageView: models.PageView): models.IError[] { |
There was a problem hiding this comment.
Isn't there any utility class (in TS) existing or new one we can write for verifying whether a value is a valid among all the available values in an emun?
There was a problem hiding this comment.
from a short investigation - I am not familiar with such a class and don't know of a way to create one (this is a string enum, it is not a regular enum).
I will add this task to a "code improvements" task I have (that also include the reuse of loadConfiguration in embedConfiguration)
| pageView: pageView | ||
| }; | ||
|
|
||
| powerbi.embed(component[0], <any>dashboardEmbedConfig); |
There was a problem hiding this comment.
Seems redundant as you embed within try{} catch{}
There was a problem hiding this comment.
The validate is called only on "load" (not on "embed"). In "reality" - the constructor of embed class assigns "onLoad" to the iframe that calls the "load" function when the iframe is ready. That doesn't happen on tests, so we need to call the embed again - when embeding the second time the code flow doesn't wait for the iframe to be ready and calls the load function.
No description provided.