Skip to content

Commit

Permalink
[SCAL-215364] Add config to enable data panel v2 when only liveboard …
Browse files Browse the repository at this point in the history
…is embedded (#1175)

* [SCAL-215364] Add config to enable data panel v2 when only liveboard is embeded

* Move dataPanelV2 to viewConfig

* Update version and add test
  • Loading branch information
bishalts2019 authored and ashubham committed Aug 26, 2024
1 parent 3a272e0 commit aa58429
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 26 deletions.
13 changes: 0 additions & 13 deletions src/embed/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,19 +265,6 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
* ```
*/
fullHeight?: boolean;
/**
* Flag to control Data panel experience
* @default true
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
* @example
* ```js
* const embed = new AppEmbed('#tsEmbed', {
* ... // other options
* dataPanelV2: true,
* })
* ```
*/
dataPanelV2?: boolean;
/**
* Show or hide Liveboard header
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
Expand Down
14 changes: 14 additions & 0 deletions src/embed/liveboard.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,20 @@ describe('Liveboard/viz embed tests', () => {
});
});

test('should render liveboard with data panel v2 flag set to true by default', async () => {
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
...defaultViewConfig,
liveboardId,
} as LiveboardViewConfig);
liveboardEmbed.render();
await executeAfterWait(() => {
expectUrlMatchesWithParams(
getIFrameSrc(),
`http://${thoughtSpotHost}/?embedApp=true${defaultParams}${prefixParams}&enableDataPanelV2=true#/embed/viz/${liveboardId}`,
);
});
});

test('should set disabled actions', async () => {
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
disabledActions: [Action.DownloadAsCsv, Action.DownloadAsPdf, Action.DownloadAsXlsx],
Expand Down
2 changes: 2 additions & 0 deletions src/embed/liveboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ export class LiveboardEmbed extends V1Embed {
isLiveboardHeaderSticky = true,
enableAskSage,
enable2ColumnLayout,
dataPanelV2 = true,
} = this.viewConfig;

const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
Expand Down Expand Up @@ -388,6 +389,7 @@ export class LiveboardEmbed extends V1Embed {

params[Param.LiveboardHeaderSticky] = isLiveboardHeaderSticky;

params[Param.DataPanelV2Enabled] = dataPanelV2;
const queryParams = getQueryParamString(params, true);

return queryParams;
Expand Down
13 changes: 0 additions & 13 deletions src/embed/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,19 +227,6 @@ export interface SearchViewConfig
* ```
*/
hideSearchBar?: boolean;
/**
* Flag to control Data panel experience
* @default true
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
* @example
* ```js
* const embed = new SearchEmbed('#tsEmbed', {
* ... // other options
* dataPanelV2:false,
* })
* ```
*/
dataPanelV2?: boolean;
/**
* Flag to set if last selected dataSource should be used
* @version: SDK: 1.24.0
Expand Down
13 changes: 13 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,19 @@ export interface ViewConfig {
* @version SDK: 1.32.1 | ThoughtSpot: 10.3.0.cl
*/
disableRedirectionLinksInNewTab?: boolean;
/**
* Flag to control Data panel experience
* @default true
* @version SDK: 1.34.0 | Thoughtspot: 10.3.0.cl
* @example
* ```js
* const embed = new AppEmbed('#tsEmbed', {
* ... // other options
* dataPanelV2: true,
* })
* ```
*/
dataPanelV2?: boolean;
}

/**
Expand Down

0 comments on commit aa58429

Please sign in to comment.