Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/embed/app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,34 @@ describe('App embed tests', () => {
});
});

test('should set liveboardXLSXCSVDownload to true in url', async () => {
const appEmbed = new AppEmbed(getRootEl(), {
...defaultViewConfig,
liveboardXLSXCSVDownload: true,
} as AppViewConfig);
appEmbed.render();
await executeAfterWait(() => {
expectUrlMatchesWithParams(
getIFrameSrc(),
`http://${thoughtSpotHost}/?embedApp=true&profileAndHelpInNavBarHidden=false&isLiveboardXLSXCSVDownloadEnabled=true${defaultParamsPost}#/home`,
);
});
});

test('should set liveboardXLSXCSVDownload to false in url', async () => {
const appEmbed = new AppEmbed(getRootEl(), {
...defaultViewConfig,
liveboardXLSXCSVDownload: false,
} as AppViewConfig);
appEmbed.render();
await executeAfterWait(() => {
expectUrlMatchesWithParams(
getIFrameSrc(),
`http://${thoughtSpotHost}/?embedApp=true&profileAndHelpInNavBarHidden=false&isLiveboardXLSXCSVDownloadEnabled=false${defaultParamsPost}#/home`,
);
});
});

test('Should add the tag to the iframe src', async () => {
const appEmbed = new AppEmbed(getRootEl(), {
...defaultViewConfig,
Expand Down
2 changes: 2 additions & 0 deletions src/embed/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ export class AppEmbed extends V1Embed {
enablePendoHelp = true,
discoveryExperience,
coverAndFilterOptionInPDF = false,
liveboardXLSXCSVDownload = false,
isLiveboardStylingAndGroupingEnabled,
} = this.viewConfig;

Expand All @@ -662,6 +663,7 @@ export class AppEmbed extends V1Embed {
params[Param.HideIrrelevantFiltersInTab] = hideIrrelevantChipsInLiveboardTabs;
params[Param.IsUnifiedSearchExperienceEnabled] = isUnifiedSearchExperienceEnabled;
params[Param.CoverAndFilterOptionInPDF] = !!coverAndFilterOptionInPDF;
params[Param.LiveboardXLSXCSVDownload] = !!liveboardXLSXCSVDownload;

params = this.getBaseQueryParams(params);

Expand Down
30 changes: 30 additions & 0 deletions src/embed/liveboard.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,36 @@ describe('Liveboard/viz embed tests', () => {
});
});

test('should add liveboardXLSXCSVDownload flag and set value to true to the iframe src', async () => {
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
...defaultViewConfig,
liveboardId,
liveboardXLSXCSVDownload: true,
} as LiveboardViewConfig);
liveboardEmbed.render();
await executeAfterWait(() => {
expectUrlMatchesWithParams(
getIFrameSrc(),
`http://${thoughtSpotHost}/?embedApp=true${defaultParams}&isLiveboardXLSXCSVDownloadEnabled=true${prefixParams}#/embed/viz/${liveboardId}`,
);
});
});

test('should add liveboardXLSXCSVDownload flag and set value to false to the iframe src', async () => {
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
...defaultViewConfig,
liveboardId,
liveboardXLSXCSVDownload: false,
} as LiveboardViewConfig);
liveboardEmbed.render();
await executeAfterWait(() => {
expectUrlMatchesWithParams(
getIFrameSrc(),
`http://${thoughtSpotHost}/?embedApp=true${defaultParams}&isLiveboardXLSXCSVDownloadEnabled=false&${prefixParams}#/embed/viz/${liveboardId}`,
);
});
});

test('should not append runtime filters in URL if excludeRuntimeFiltersfromURL is true', async () => {
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
...defaultViewConfig,
Expand Down
2 changes: 2 additions & 0 deletions src/embed/liveboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ export class LiveboardEmbed extends V1Embed {
isForceRedirect,
dataSourceId,
coverAndFilterOptionInPDF = false,
liveboardXLSXCSVDownload = false,
isLiveboardStylingAndGroupingEnabled,
} = this.viewConfig;

Expand Down Expand Up @@ -511,6 +512,7 @@ export class LiveboardEmbed extends V1Embed {
params[Param.DataPanelV2Enabled] = dataPanelV2;
params[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
params[Param.CoverAndFilterOptionInPDF] = coverAndFilterOptionInPDF;
params[Param.LiveboardXLSXCSVDownload] = !!liveboardXLSXCSVDownload;
const queryParams = getQueryParamString(params, true);

return queryParams;
Expand Down
19 changes: 18 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1441,6 +1441,22 @@ export interface LiveboardAppEmbedViewConfig {
* ```
*/
coverAndFilterOptionInPDF?: boolean;
/**
* This flag is used to enable or disable the XLSX/CSV download option for Liveboards.
*
* Supported embed types: `AppEmbed`, `LiveboardEmbed`
* @version SDK: 1.41.0 | ThoughtSpot: 10.14.0.cl
* @example
* ```js
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed or LiveboardEmbed
* const embed = new <EmbedComponent>('#tsEmbed', {
* ... // other embed view config
* liveboardXLSXCSVDownload: true,
* })
* ```
*/
liveboardXLSXCSVDownload?: boolean;

}

export interface AllEmbedViewConfig extends BaseViewConfig, SearchLiveboardCommonViewConfig, HomePageConfig, LiveboardAppEmbedViewConfig {}
Expand Down Expand Up @@ -4238,7 +4254,8 @@ export enum Param {
isSpotterAgentEmbed = 'isSpotterAgentEmbed',
IsLiveboardStylingAndGroupingEnabled = 'isLiveboardStylingAndGroupingEnabled',
IsLazyLoadingForEmbedEnabled = 'isLazyLoadingForEmbedEnabled',
RootMarginForLazyLoad = 'rootMarginForLazyLoad'
RootMarginForLazyLoad = 'rootMarginForLazyLoad',
LiveboardXLSXCSVDownload = 'isLiveboardXLSXCSVDownloadEnabled',
}

/**
Expand Down
Loading
Loading