-
Notifications
You must be signed in to change notification settings - Fork 528
feat(experimentation): warehouse connection verification UI #7678
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b7e5637
feat(experimentation): add warehouse test connection mutation and sta…
Zaimwa9 fd6b72d
feat(experimentation): add ingestor url to env
Zaimwa9 b3fcd38
feat(experimentation): add warehouse test event and polling helpers
Zaimwa9 4d87e7f
feat(experimentation): wire warehouse test connection polling and sta…
Zaimwa9 aacbc99
feat(experimentation): hide code snippet docs
Zaimwa9 e6b0874
feat(experimentation): flush events directly in sendWarehouseEvent
Zaimwa9 6db8040
feat: increased polling and fixed env base urls
Zaimwa9 3f1c5f4
feat: render warehouse stats as '-' when counts are null
Zaimwa9 46d33dc
Merge branch 'main' of github.com:Flagsmith/flagsmith into feat/exper…
Zaimwa9 9648ea8
feat: poll on test warehouse connection
Zaimwa9 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...d/web/components/pages/environment-settings/tabs/warehouse-tab/WarehouseSetupSkeleton.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import { FC } from 'react' | ||
| import Skeleton from 'components/Skeleton' | ||
| import './WarehouseSetup.scss' | ||
| import './SelectableCard.scss' | ||
|
|
||
| // Mirrors the WarehouseSetup layout (warehouse-type selector + Flagsmith enable | ||
| // card) so the loading state has the same shape as the empty state it resolves | ||
| // to, avoiding a layout shift when the connections query settles. | ||
| const TYPE_CARD_COUNT = 4 | ||
|
|
||
| const WarehouseSetupSkeleton: FC = () => ( | ||
| <div className='warehouse-setup' aria-hidden> | ||
| <div> | ||
| <div className='warehouse-setup__type-row'> | ||
| {Array.from({ length: TYPE_CARD_COUNT }).map((_, index) => ( | ||
| <div className='warehouse-setup__type-card' key={index}> | ||
| <div className='selectable-card'> | ||
| <div className='selectable-card__content'> | ||
| <div className='selectable-card__icon'> | ||
| <Skeleton variant='circle' width={20} height={20} /> | ||
| </div> | ||
| <Skeleton width={80} height={16} /> | ||
| <Skeleton width={120} height={12} /> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| </div> | ||
|
|
||
| <div className='warehouse-setup__flagsmith-card'> | ||
| <Skeleton width='60%' height={16} /> | ||
| <Skeleton variant='badge' width={88} height={32} /> | ||
| </div> | ||
| </div> | ||
| ) | ||
|
|
||
| WarehouseSetupSkeleton.displayName = 'WarehouseSetupSkeleton' | ||
| export default WarehouseSetupSkeleton |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...ts/pages/environment-settings/tabs/warehouse-tab/__tests__/sendWarehouseTestEvent.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import sendWarehouseTestEvent from 'components/pages/environment-settings/tabs/warehouse-tab/sendWarehouseTestEvent' | ||
|
|
||
| const init = jest.fn().mockResolvedValue(undefined) | ||
| const trackEvent = jest.fn() | ||
| const flushEvents = jest.fn().mockResolvedValue(undefined) | ||
|
|
||
| jest.mock('@flagsmith/flagsmith/isomorphic', () => ({ | ||
| createFlagsmithInstance: () => ({ flushEvents, init, trackEvent }), | ||
| })) | ||
|
|
||
| jest.mock('common/project', () => ({ | ||
| __esModule: true, | ||
| default: { api: 'http://localhost:8000/api/v1/' }, | ||
| })) | ||
|
|
||
| describe('sendWarehouseTestEvent', () => { | ||
| beforeEach(() => { | ||
| init.mockClear() | ||
| trackEvent.mockClear() | ||
| flushEvents.mockClear() | ||
| }) | ||
|
|
||
| it('inits a per-environment instance with events enabled and no flag fetch', async () => { | ||
| await sendWarehouseTestEvent('env-key-123') | ||
|
|
||
| expect(init).toHaveBeenCalledWith( | ||
| expect.objectContaining({ | ||
| defaultFlags: {}, | ||
| enableEvents: true, | ||
| environmentID: 'env-key-123', | ||
| preventFetch: true, | ||
| }), | ||
| ) | ||
| }) | ||
|
|
||
| it('tracks the test_custom_event after init', async () => { | ||
| await sendWarehouseTestEvent('env-key-123') | ||
|
|
||
| expect(trackEvent).toHaveBeenCalledWith('test_custom_event') | ||
| expect(init).toHaveBeenCalledTimes(1) | ||
| expect(trackEvent).toHaveBeenCalledTimes(1) | ||
| }) | ||
|
|
||
| it('flushes events so the tracked event is sent immediately', async () => { | ||
| await sendWarehouseTestEvent('env-key-123') | ||
|
|
||
| expect(flushEvents).toHaveBeenCalledTimes(1) | ||
| }) | ||
| }) | ||
23 changes: 23 additions & 0 deletions
23
...mponents/pages/environment-settings/tabs/warehouse-tab/__tests__/warehousePolling.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { getWarehousePollingInterval } from 'components/pages/environment-settings/tabs/warehouse-tab/warehousePolling' | ||
|
|
||
| describe('getWarehousePollingInterval', () => { | ||
| it('polls every minute while pending_connection', () => { | ||
| expect(getWarehousePollingInterval('pending_connection')).toBe(60000) | ||
| }) | ||
|
|
||
| it('does not poll for connected', () => { | ||
| expect(getWarehousePollingInterval('connected')).toBe(0) | ||
| }) | ||
|
|
||
| it('does not poll for created', () => { | ||
| expect(getWarehousePollingInterval('created')).toBe(0) | ||
| }) | ||
|
|
||
| it('does not poll for errored', () => { | ||
| expect(getWarehousePollingInterval('errored')).toBe(0) | ||
| }) | ||
|
|
||
| it('does not poll when status is undefined', () => { | ||
| expect(getWarehousePollingInterval(undefined)).toBe(0) | ||
| }) | ||
| }) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.