Skip to content

Commit dcf2e22

Browse files
[SCAL-295746] add muze chart enabled flag
1 parent 7a562b7 commit dcf2e22

8 files changed

Lines changed: 1957 additions & 1679 deletions

File tree

src/embed/app.spec.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,53 @@ describe('App embed tests', () => {
811811
});
812812
});
813813

814+
test('Should add muzeChartPhase1EnabledGA true to the iframe src', async () => {
815+
const appEmbed = new AppEmbed(getRootEl(), {
816+
...defaultViewConfig,
817+
showPrimaryNavbar: false,
818+
muzeChartPhase1EnabledGA: true,
819+
} as AppViewConfig);
820+
821+
appEmbed.render();
822+
await executeAfterWait(() => {
823+
expectUrlMatchesWithParams(
824+
getIFrameSrc(),
825+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&muzeChartPhase1EnabledGA=true${defaultParams}${defaultParamsPost}#/home`,
826+
);
827+
});
828+
});
829+
830+
test('Should add muzeChartPhase1EnabledGA false to the iframe src', async () => {
831+
const appEmbed = new AppEmbed(getRootEl(), {
832+
...defaultViewConfig,
833+
showPrimaryNavbar: false,
834+
muzeChartPhase1EnabledGA: false,
835+
} as AppViewConfig);
836+
837+
appEmbed.render();
838+
await executeAfterWait(() => {
839+
expectUrlMatchesWithParams(
840+
getIFrameSrc(),
841+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&muzeChartPhase1EnabledGA=false${defaultParams}${defaultParamsPost}#/home`,
842+
);
843+
});
844+
});
845+
846+
test('Should not add muzeChartPhase1EnabledGA to the iframe src when not specified', async () => {
847+
const appEmbed = new AppEmbed(getRootEl(), {
848+
...defaultViewConfig,
849+
showPrimaryNavbar: false,
850+
} as AppViewConfig);
851+
852+
appEmbed.render();
853+
await executeAfterWait(() => {
854+
expectUrlMatchesWithParams(
855+
getIFrameSrc(),
856+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false${defaultParams}${defaultParamsPost}#/home`,
857+
);
858+
});
859+
});
860+
814861
test('Should add enableSearchAssist flagto the iframe src', async () => {
815862
const appEmbed = new AppEmbed(getRootEl(), {
816863
...defaultViewConfig,

src/embed/app.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,7 @@ export class AppEmbed extends V1Embed {
807807
showLiveboardDescription = true,
808808
showMaskedFilterChip = false,
809809
isLiveboardMasterpiecesEnabled = false,
810+
muzeChartPhase1EnabledGA,
810811
hideHomepageLeftNav = false,
811812
modularHomeExperience = false,
812813
isLiveboardHeaderSticky = true,
@@ -850,6 +851,9 @@ export class AppEmbed extends V1Embed {
850851
params[Param.ShowLiveboardDescription] = !!showLiveboardDescription;
851852
params[Param.ShowMaskedFilterChip] = showMaskedFilterChip;
852853
params[Param.IsLiveboardMasterpiecesEnabled] = isLiveboardMasterpiecesEnabled;
854+
if (muzeChartPhase1EnabledGA !== undefined) {
855+
params[Param.MuzeChartPhase1EnabledGA] = muzeChartPhase1EnabledGA;
856+
}
853857
params[Param.LiveboardHeaderSticky] = isLiveboardHeaderSticky;
854858
params[Param.IsFullAppEmbed] = true;
855859
params[Param.LiveboardHeaderV2] = isLiveboardCompactHeaderEnabled;

src/embed/liveboard.spec.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,38 @@ describe('Liveboard/viz embed tests', () => {
547547
});
548548
});
549549

550+
test('Should add muzeChartPhase1EnabledGA flag set to true to the iframe src', async () => {
551+
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
552+
...defaultViewConfig,
553+
liveboardId,
554+
muzeChartPhase1EnabledGA: true,
555+
} as LiveboardViewConfig);
556+
557+
liveboardEmbed.render();
558+
await executeAfterWait(() => {
559+
expectUrlMatchesWithParams(
560+
getIFrameSrc(),
561+
`http://${thoughtSpotHost}/?embedApp=true${defaultParams}&muzeChartPhase1EnabledGA=true${prefixParams}#/embed/viz/${liveboardId}`,
562+
);
563+
});
564+
});
565+
566+
test('Should add muzeChartPhase1EnabledGA flag set to false to the iframe src', async () => {
567+
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
568+
...defaultViewConfig,
569+
liveboardId,
570+
muzeChartPhase1EnabledGA: false,
571+
} as LiveboardViewConfig);
572+
573+
liveboardEmbed.render();
574+
await executeAfterWait(() => {
575+
expectUrlMatchesWithParams(
576+
getIFrameSrc(),
577+
`http://${thoughtSpotHost}/?embedApp=true${defaultParams}&muzeChartPhase1EnabledGA=false${prefixParams}#/embed/viz/${liveboardId}`,
578+
);
579+
});
580+
});
581+
550582
test('Should add hideIrrelevantFiltersAtTabLevel flag to the iframe src', async () => {
551583
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
552584
...defaultViewConfig,

src/embed/liveboard.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,7 @@ export class LiveboardEmbed extends V1Embed {
578578
hideIrrelevantChipsInLiveboardTabs = false,
579579
showMaskedFilterChip = false,
580580
isLiveboardMasterpiecesEnabled = false,
581+
muzeChartPhase1EnabledGA,
581582
isEnhancedFilterInteractivityEnabled = false,
582583
enableAskSage,
583584
enable2ColumnLayout,
@@ -707,6 +708,10 @@ export class LiveboardEmbed extends V1Embed {
707708
params[Param.IsThisPeriodInDateFiltersEnabled] = isThisPeriodInDateFiltersEnabled;
708709
}
709710

711+
if (muzeChartPhase1EnabledGA !== undefined) {
712+
params[Param.MuzeChartPhase1EnabledGA] = muzeChartPhase1EnabledGA;
713+
}
714+
710715
params[Param.LiveboardHeaderSticky] = isLiveboardHeaderSticky;
711716
params[Param.LiveboardHeaderV2] = isLiveboardCompactHeaderEnabled;
712717
params[Param.ShowLiveboardVerifiedBadge] = showLiveboardVerifiedBadge;

src/embed/search.spec.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,34 @@ describe('Search embed tests', () => {
524524
});
525525
});
526526

527+
test('Should add muzeChartPhase1EnabledGA flag set to true to the iframe src', async () => {
528+
const searchEmbed = new SearchEmbed(getRootEl(), {
529+
...defaultViewConfig,
530+
muzeChartPhase1EnabledGA: true,
531+
});
532+
searchEmbed.render();
533+
await executeAfterWait(() => {
534+
expectUrlMatchesWithParams(
535+
getIFrameSrc(),
536+
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&enableDataPanelV2=true&muzeChartPhase1EnabledGA=true&dataSourceMode=expand&useLastSelectedSources=false${prefixParams}#/embed/answer`,
537+
);
538+
});
539+
});
540+
541+
test('Should add muzeChartPhase1EnabledGA flag set to false to the iframe src', async () => {
542+
const searchEmbed = new SearchEmbed(getRootEl(), {
543+
...defaultViewConfig,
544+
muzeChartPhase1EnabledGA: false,
545+
});
546+
searchEmbed.render();
547+
await executeAfterWait(() => {
548+
expectUrlMatchesWithParams(
549+
getIFrameSrc(),
550+
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&enableDataPanelV2=true&muzeChartPhase1EnabledGA=false&dataSourceMode=expand&useLastSelectedSources=false${prefixParams}#/embed/answer`,
551+
);
552+
});
553+
});
554+
527555
test('should set dataPanelCustomGroupsAccordionInitialState to EXPAND_FIRST when passed', async () => {
528556
const searchEmbed = new SearchBarEmbed(getRootEl() as any, {
529557
...defaultViewConfig,

src/embed/search.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,21 @@ export interface SearchViewConfig
317317
* ```
318318
*/
319319
focusSearchBarOnRender?: boolean;
320+
/**
321+
* Enable or disable Muze chart phase 1 GA
322+
*
323+
* Supported embed types: `SearchEmbed`
324+
* @version SDK: 1.45.0 | ThoughtSpot: 26.2.0.cl
325+
* @default false
326+
* @example
327+
* ```js
328+
* const embed = new SearchEmbed('#tsEmbed', {
329+
* ... // other embed view config
330+
* muzeChartPhase1EnabledGA: true,
331+
* })
332+
* ```
333+
*/
334+
muzeChartPhase1EnabledGA?: boolean;
320335
}
321336

322337
export const HiddenActionItemByDefaultForSearchEmbed = [
@@ -405,6 +420,7 @@ export class SearchEmbed extends TsEmbed {
405420
excludeSearchTokenStringFromURL,
406421
collapseSearchBar = true,
407422
isThisPeriodInDateFiltersEnabled,
423+
muzeChartPhase1EnabledGA,
408424
} = this.viewConfig;
409425
const queryParams = this.getBaseQueryParams();
410426

@@ -451,6 +467,10 @@ export class SearchEmbed extends TsEmbed {
451467
queryParams[Param.IsThisPeriodInDateFiltersEnabled] = isThisPeriodInDateFiltersEnabled;
452468
}
453469

470+
if (muzeChartPhase1EnabledGA !== undefined) {
471+
queryParams[Param.MuzeChartPhase1EnabledGA] = muzeChartPhase1EnabledGA;
472+
}
473+
454474
queryParams[Param.DataPanelV2Enabled] = dataPanelV2;
455475
queryParams[Param.DataSourceMode] = this.getDataSourceMode();
456476

src/types.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,6 +1987,22 @@ export interface LiveboardAppEmbedViewConfig {
19871987
* ```
19881988
*/
19891989
isLiveboardMasterpiecesEnabled?: boolean;
1990+
/**
1991+
* Enable or disable Muze chart phase 1 GA
1992+
*
1993+
* Supported embed types: `AppEmbed`, `LiveboardEmbed`
1994+
* @version SDK: 1.45.0 | ThoughtSpot: 26.2.0.cl
1995+
* @default false
1996+
* @example
1997+
* ```js
1998+
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed or LiveboardEmbed
1999+
* const embed = new <EmbedComponent>('#tsEmbed', {
2000+
* ... // other embed view config
2001+
* muzeChartPhase1EnabledGA: true,
2002+
* })
2003+
* ```
2004+
*/
2005+
muzeChartPhase1EnabledGA?: boolean;
19902006
}
19912007

19922008
export interface AllEmbedViewConfig
@@ -5068,6 +5084,7 @@ export enum Param {
50685084
ShowLiveboardTitle = 'showLiveboardTitle',
50695085
ShowMaskedFilterChip = 'showMaskedFilterChip',
50705086
IsLiveboardMasterpiecesEnabled = 'isLiveboardMasterpiecesEnabled',
5087+
MuzeChartPhase1EnabledGA = 'muzeChartPhase1EnabledGA',
50715088
HiddenTabs = 'hideTabs',
50725089
VisibleTabs = 'visibleTabs',
50735090
HideTabPanel = 'hideTabPanel',

0 commit comments

Comments
 (0)