-
Notifications
You must be signed in to change notification settings - Fork 6
[SCAL-265458] Added flags for enable save chat in spotter embed #331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Summary of ChangesHello @vivekkumar7089, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new feature allowing developers to control the visibility of a "past conversations sidebar" within the embedded Spotter experience. By adding an Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
SonarQube Quality Gate
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a new enablePastConversationsSidebar flag for the SpotterEmbed component, allowing control over the visibility of the past conversations sidebar. The implementation is sound and includes necessary interface updates, logic for URL parameter generation, and test coverage. I have a couple of suggestions to improve code consistency and test maintainability, but overall the changes look good.
| it('should render the conversation embed with past conversations sidebar enabled', async () => { | ||
| const viewConfig: SpotterEmbedViewConfig = { | ||
| worksheetId: 'worksheetId', | ||
| searchOptions: { | ||
| searchQuery: 'searchQuery', | ||
| }, | ||
| enablePastConversationsSidebar: true, | ||
| }; | ||
|
|
||
| const conversationEmbed = new SpotterEmbed(getRootEl(), viewConfig); | ||
| await conversationEmbed.render(); | ||
| expectUrlMatchesWithParams( | ||
| getIFrameSrc(), | ||
| `http://${thoughtSpotHost}/v2/?${defaultParams}&isSpotterExperienceEnabled=true&enablePastConversationsSidebar=true#/embed/insights/conv-assist?worksheet=worksheetId&query=searchQuery`, | ||
| ); | ||
| }); | ||
|
|
||
| it('should render the conversation embed with past conversations sidebar disabled', async () => { | ||
| const viewConfig: SpotterEmbedViewConfig = { | ||
| worksheetId: 'worksheetId', | ||
| searchOptions: { | ||
| searchQuery: 'searchQuery', | ||
| }, | ||
| enablePastConversationsSidebar: false, | ||
| }; | ||
|
|
||
| const conversationEmbed = new SpotterEmbed(getRootEl(), viewConfig); | ||
| await conversationEmbed.render(); | ||
| expectUrlMatchesWithParams( | ||
| getIFrameSrc(), | ||
| `http://${thoughtSpotHost}/v2/?${defaultParams}&isSpotterExperienceEnabled=true&enablePastConversationsSidebar=false#/embed/insights/conv-assist?worksheet=worksheetId&query=searchQuery`, | ||
| ); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two test cases for enablePastConversationsSidebar are very similar and can be refactored into a single, more concise parameterized test using it.each. This will reduce code duplication and improve the maintainability of the test suite.
it.each([
{ enabled: true, desc: 'enabled' },
{ enabled: false, desc: 'disabled' },
])('should render the conversation embed with past conversations sidebar $desc', async ({ enabled }) => {
const viewConfig: SpotterEmbedViewConfig = {
worksheetId: 'worksheetId',
searchOptions: {
searchQuery: 'searchQuery',
},
enablePastConversationsSidebar: enabled,
};
const conversationEmbed = new SpotterEmbed(getRootEl(), viewConfig);
await conversationEmbed.render();
expectUrlMatchesWithParams(
getIFrameSrc(),
`http://${thoughtSpotHost}/v2/?${defaultParams}&isSpotterExperienceEnabled=true&enablePastConversationsSidebar=${enabled}#/embed/insights/conv-assist?worksheet=worksheetId&query=searchQuery`,
);
});| if (!isUndefined(enablePastConversationsSidebar)) { | ||
| queryParams[Param.EnablePastConversationsSidebar] = !!enablePastConversationsSidebar; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency with how other boolean flags are handled in this class, the logic for adding the enablePastConversationsSidebar parameter should be moved from getIframeSrc() to getEmbedParamsObject(). Currently, flags like disableSourceSelection, hideSampleQuestions, etc., are all processed within getEmbedParamsObject(). Centralizing this logic improves code organization and maintainability.
After moving this block, you can also remove enablePastConversationsSidebar from the destructuring at the top of getIframeSrc().
You can add the following block inside getEmbedParamsObject() before the return statement:
if (!isUndefined(enablePastConversationsSidebar)) {
queryParams[Param.EnablePastConversationsSidebar] = !!enablePastConversationsSidebar;
}
commit: |








No description provided.