-
Notifications
You must be signed in to change notification settings - Fork 69
[LG-5362] Add chat/suggestions #2963
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
|
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.
on the right track :) keep going with this! I will review how it looks once the build succeeds and can test on storybook
please also add specs! copilot will be very helpful in getting an initial draft of specs quickly spun up
chat/suggestion-card/src/SuggestionCard/SuggestionCard.types.ts
Outdated
Show resolved
Hide resolved
chat/suggestion-card/src/SuggestionCard/SuggestionCard.types.ts
Outdated
Show resolved
Hide resolved
chat/suggestion-card/src/SuggestionCard/SuggestionCard.styles.ts
Outdated
Show resolved
Hide resolved
chat/suggestion-card/src/SuggestionCard/SuggestionCard.styles.ts
Outdated
Show resolved
Hide resolved
chat/suggestion-card/src/SuggestionCard/SuggestionCard.styles.ts
Outdated
Show resolved
Hide resolved
chat/suggestion-card/src/SuggestionCard/SuggestionCard.styles.ts
Outdated
Show resolved
Hide resolved
chat/suggestion-card/src/SuggestionCard/SuggestionCard.styles.ts
Outdated
Show resolved
Hide resolved
Size Change: -1.88 kB (-0.1%) Total Size: 1.91 MB
ℹ️ View Unchanged
|
Unset: 'unset', | ||
Apply: 'apply', |
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.
can you share more on how/when this 'unset'
status will be used? seems like all we really need is 'apply'
but curious if there's context I'm missing
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.
aha i'm seeing it now great point! i must have intuitively thought there would be a case where we don't want users to apply suggestions but it looks like that's not included in the designs at all so will remove this case!
chat/suggestion-card/package.json
Outdated
@@ -0,0 +1,52 @@ | |||
|
|||
{ | |||
"name": "@lg-chat/suggestion-card", |
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.
What do you think about this renamed structure for the package and main component export?
package: @lg-chat/suggestions
(not limited to the card UI)
main component: SuggestedActions
(has both the main card but also a status banner attached)
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.
SGTM! will update the naming
/** | ||
* Determines rendering of the status banner: | ||
* - `'Unset'` will render suggestions | ||
* - `'Apply'` will render suggestions and the "Apply" button | ||
* - `'Success'` will render success banner with applied suggestions | ||
* - `'Error'` will render error banner with instructions to manually apply suggestions | ||
*/ | ||
status: Status; | ||
/** | ||
* Suggested configuration parameters as key-value pairs | ||
*/ | ||
suggestedConfigurationParameters: ConfigurationParameters; | ||
/** | ||
* Parameters that were successfully applied | ||
*/ | ||
appliedParameters?: ConfigurationParameters; | ||
/** | ||
* Parameters that failed to apply | ||
*/ | ||
failedParameters?: ConfigurationParameters; |
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.
does this API make sense for how data will flow through this component?
also curious if we might be able to DRY this up by attaching a status to each config param?
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.
mmm gotcha will consolidate the parameters to be filtered by status!
i think having the status, configurationParameters, and onClickApply make sense, we have separate utils set up in mms to handle the actual application of these configurations and handle errors, so we can dynamically update this component with these props
chat/suggestion-card/src/SuggestionCard/SuggestionCard.styles.ts
Outdated
Show resolved
Hide resolved
import { | ||
bannerWrapperStyles, | ||
boldedTextStyle, | ||
listStyles, | ||
} from '../SuggestionCard/SuggestionCard.styles'; |
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.
can you move these styles into a separate StatusBanner.styles.ts
?
}: { | ||
status: Status; | ||
appliedParameters: SuggestionCardProps['appliedParameters']; | ||
failedParameters: SuggestionCardProps['failedParameters']; | ||
}) => { |
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.
There's a circular import between StatusBanner
+ SuggestionCard
because
StatusBanner
imports types defined fromSuggestionCard
SuggestionCard
importsStatusBanner
Can the status
+ appliedParameters
+ failedParameters
be defined in a separate StatusBanner.types.ts
or a separate src/shared.types.ts
file? ConfigurationParameters
type can also be defined there
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.
Pull Request Overview
This PR adds a new SuggestionCard component (@lg-chat/suggestions
) that displays MongoDB cluster configuration suggestions with support for applying changes and showing success/error feedback. The component supports three states: applying suggestions with an "Apply" button, showing success banner with applied parameters, and showing error banner with failed parameters.
- Adds a new
SuggestedActions
component with table display for configuration parameters - Implements status-based rendering (Apply/Success/Error) with appropriate banners
- Includes comprehensive test coverage and Storybook integration
Reviewed Changes
Copilot reviewed 19 out of 21 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
tools/install/src/ALL_PACKAGES.ts |
Adds the new package to the global package list |
chat/suggestions/tsconfig.json |
TypeScript configuration for the new package |
chat/suggestions/src/ |
Core component implementation with types, styles, and utilities |
chat/suggestions/package.json |
Package configuration and dependencies |
chat/suggestions/README.md |
Documentation with usage examples and API reference |
README.md |
Updates main README to include new package in table of contents |
Comments suppressed due to low confidence (2)
chat/suggestions/src/testing/getTestUtils.spec.tsx:7
- Empty test case provides no validation. The test should either be removed or implemented to actually test the getTestUtils function.
test('condition', () => {});
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
|
||
import { SuggestedActions } from '.'; |
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.
The import SuggestedActions
from '.' is incorrect. The current directory contains test utilities, not the component. This should import from '../' or '../SuggestedActions' to access the actual component.
import { SuggestedActions } from '.'; | |
import { SuggestedActions } from '../SuggestedActions'; |
Copilot uses AI. Check for mistakes.
import { findByLgId, getByLgId, queryByLgId } from '@lg-tools/test-harnesses'; | ||
|
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.
The imported test utility functions findByLgId
, getByLgId
, and queryByLgId
are not used in the function. Either implement the test utilities or remove the unused imports.
import { findByLgId, getByLgId, queryByLgId } from '@lg-tools/test-harnesses'; |
Copilot uses AI. Check for mistakes.
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.
great job on this! :) I dropped one last note but LGTM
/** | ||
* Determines rendering of the status banner: | ||
* - `'Apply'` will render suggestions and the "Apply" button | ||
* - `'Success'` will render success banner with applied suggestions | ||
* - `'Error'` will render error banner with instructions to manually apply suggestions | ||
*/ | ||
status: Status; |
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.
Sorry, I should have surfaced this in a prior review: can we rename the prop state
, rename the type State
and use Unset: 'unset'
for the default? This would match conventions in the rest of our codebase
52231e9
to
25aaeb5
Compare
✍️ Proposed changes
add SuggestedActions component
🎟 _Jira ticket: LG-5362
✅ Checklist
For bug fixes, new features & breaking changes
pnpm changeset
and documented my changesFor new components
🧪 How to test changes