Skip to content

Commit

Permalink
Add Tags Support
Browse files Browse the repository at this point in the history
  • Loading branch information
ashubham committed Mar 29, 2021
1 parent dd23d19 commit 008f5dd
Show file tree
Hide file tree
Showing 21 changed files with 202 additions and 157 deletions.
15 changes: 15 additions & 0 deletions src/embed/app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,19 @@ describe('App embed tests', () => {
);
});
});

test('Should add the tag to the iframe src', async () => {
const appEmbed = new AppEmbed(getRootEl(), {
...defaultViewConfig,
showPrimaryNavbar: false,
tag: 'Finance',
} as AppViewConfig);

appEmbed.render();
await executeAfterWait(() => {
expect(getIFrameSrc()).toBe(
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&tag=Finance#/home`,
);
});
});
});
9 changes: 9 additions & 0 deletions src/embed/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ export interface AppViewConfig extends ViewConfig {
* in the embedded view.
*/
pageId?: Page;
/**
* This puts a filter tag on the Application, all metadata lists in the app
* like pinboards, Answers etc would be filtered by this tag.
*/
tag?: string;
}

/**
Expand All @@ -85,6 +90,7 @@ export class AppEmbed extends V1Embed {
disabledActions,
disabledActionReason,
hiddenActions,
tag,
} = this.viewConfig;

if (disabledActions?.length) {
Expand All @@ -96,6 +102,9 @@ export class AppEmbed extends V1Embed {
if (hiddenActions?.length) {
params[Param.HideActions] = hiddenActions;
}
if (!!tag) {
params[Param.Tag] = tag;
}

const queryParams = getQueryParamString(params);

Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ export enum Param {
EnableSearchAssist = 'enableSearchAssist',
HideResult = 'hideResult',
UseLastSelectedDataSource = 'useLastSelectedSources',
Tag = 'tag',
}

/**
Expand Down
2 changes: 1 addition & 1 deletion static/typedoc/assets/js/search.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions static/typedoc/classes/appembed.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ <h3>constructor</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/thoughtspot/visual-embed-sdk/blob/22cb1ea/src/embed/app.ts#L71">embed/app.ts:71</a></li>
<li>Defined in <a href="https://github.com/thoughtspot/visual-embed-sdk/blob/df40a37/src/embed/app.ts#L76">embed/app.ts:76</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand Down Expand Up @@ -227,7 +227,7 @@ <h3>on</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/thoughtspot/visual-embed-sdk/blob/22cb1ea/src/embed/base.ts#L437">embed/base.ts:437</a></li>
<li>Defined in <a href="https://github.com/thoughtspot/visual-embed-sdk/blob/df40a37/src/embed/base.ts#L437">embed/base.ts:437</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand All @@ -253,7 +253,7 @@ <h3>render</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/thoughtspot/visual-embed-sdk/blob/22cb1ea/src/embed/app.ts#L167">embed/app.ts:167</a></li>
<li>Defined in <a href="https://github.com/thoughtspot/visual-embed-sdk/blob/df40a37/src/embed/app.ts#L176">embed/app.ts:176</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -275,7 +275,7 @@ <h3>trigger</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/thoughtspot/visual-embed-sdk/blob/22cb1ea/src/embed/base.ts#L387">embed/base.ts:387</a></li>
<li>Defined in <a href="https://github.com/thoughtspot/visual-embed-sdk/blob/df40a37/src/embed/base.ts#L387">embed/base.ts:387</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down
8 changes: 4 additions & 4 deletions static/typedoc/classes/pinboardembed.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ <h3>constructor</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/thoughtspot/visual-embed-sdk/blob/22cb1ea/src/embed/pinboard.ts#L51">embed/pinboard.ts:51</a></li>
<li>Defined in <a href="https://github.com/thoughtspot/visual-embed-sdk/blob/df40a37/src/embed/pinboard.ts#L51">embed/pinboard.ts:51</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand Down Expand Up @@ -227,7 +227,7 @@ <h3>on</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/thoughtspot/visual-embed-sdk/blob/22cb1ea/src/embed/base.ts#L437">embed/base.ts:437</a></li>
<li>Defined in <a href="https://github.com/thoughtspot/visual-embed-sdk/blob/df40a37/src/embed/base.ts#L437">embed/base.ts:437</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand All @@ -253,7 +253,7 @@ <h3>render</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/thoughtspot/visual-embed-sdk/blob/22cb1ea/src/embed/pinboard.ts#L135">embed/pinboard.ts:135</a></li>
<li>Defined in <a href="https://github.com/thoughtspot/visual-embed-sdk/blob/df40a37/src/embed/pinboard.ts#L135">embed/pinboard.ts:135</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -275,7 +275,7 @@ <h3>trigger</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/thoughtspot/visual-embed-sdk/blob/22cb1ea/src/embed/base.ts#L387">embed/base.ts:387</a></li>
<li>Defined in <a href="https://github.com/thoughtspot/visual-embed-sdk/blob/df40a37/src/embed/base.ts#L387">embed/base.ts:387</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down
8 changes: 4 additions & 4 deletions static/typedoc/classes/searchembed.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ <h3>constructor</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/thoughtspot/visual-embed-sdk/blob/22cb1ea/src/embed/search.ts#L62">embed/search.ts:62</a></li>
<li>Defined in <a href="https://github.com/thoughtspot/visual-embed-sdk/blob/df40a37/src/embed/search.ts#L62">embed/search.ts:62</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand Down Expand Up @@ -227,7 +227,7 @@ <h3>on</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/thoughtspot/visual-embed-sdk/blob/22cb1ea/src/embed/base.ts#L365">embed/base.ts:365</a></li>
<li>Defined in <a href="https://github.com/thoughtspot/visual-embed-sdk/blob/df40a37/src/embed/base.ts#L365">embed/base.ts:365</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -265,7 +265,7 @@ <h3>render</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/thoughtspot/visual-embed-sdk/blob/22cb1ea/src/embed/search.ts#L143">embed/search.ts:143</a></li>
<li>Defined in <a href="https://github.com/thoughtspot/visual-embed-sdk/blob/df40a37/src/embed/search.ts#L143">embed/search.ts:143</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -287,7 +287,7 @@ <h3>trigger</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/thoughtspot/visual-embed-sdk/blob/22cb1ea/src/embed/base.ts#L387">embed/base.ts:387</a></li>
<li>Defined in <a href="https://github.com/thoughtspot/visual-embed-sdk/blob/df40a37/src/embed/base.ts#L387">embed/base.ts:387</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down

0 comments on commit 008f5dd

Please sign in to comment.