-
-
Notifications
You must be signed in to change notification settings - Fork 193
FE: Optional FTS #1402
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
Open
Vixtir
wants to merge
39
commits into
main
Choose a base branch
from
issues/1333-optional-fts-fe
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+357
−59
Open
FE: Optional FTS #1402
Changes from 27 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
844e34e
Impl HeartbeatSerde
Haarolean 496aa43
Impl OffsetSyncSerde
Haarolean 13c951f
Impl CheckpointSerde
Haarolean c25604b
lint
Haarolean de52924
Change result type from string to json in appropriate cases
Haarolean 6146073
Impl tests
Haarolean fc59e6b
Logs
Haarolean 267d52d
Split k/v methods
Haarolean 89ca82c
Upd fields visibility
Haarolean 1ea2aa6
Auto register serdes for well known topic patterns
Haarolean 9c987ef
Simplify serialization
Haarolean 7e25c7c
Reduced duplicate code
germanosin c5cb67d
Reduced duplicate code
germanosin 40760ca
Reduced duplicate code
germanosin 68a8a26
Reduced duplicate code
germanosin dfa9cbb
Reduced duplicate code
germanosin 6b2431c
Reduced duplicate code
germanosin 35f6c08
Reduced duplicate code
germanosin bf2fce1
BE: issue-1333 optional fts
germanosin 57ede6c
FE: Add button for enabling topics fts search
Vixtir 1b36d3a
FE: Fix tests, icon styles
Vixtir db6aca2
Merge main
germanosin 552c305
Merge branch 'main' into issues/1333-optional-fts-fe
germanosin 40d6a38
Add useFts to topic table
Vixtir 1333af0
Merge branch 'main' into issues/1333-optional-fts-fe
germanosin fb7faa1
Merge branch 'main' into issues/1333-optional-fts-fe
germanosin ca25d84
FE: Add fts to other resources, add logic to show and handle fts button
Vixtir 07190b2
FE: Use config vars
Vixtir 4ed5e88
FE: Fix state sync
Vixtir 2a96c1e
FE: Use config vars
Vixtir 6384333
FE: Fix race condition in cluster context
Vixtir 6f5b2ca
FE: Use config vars
Vixtir 9ea7766
FE: Remove redundant connectors request
Vixtir 353bbc2
FE: Fix test
Vixtir 137037d
FE: Fix typos
Vixtir 7470cbd
FE: Fix set params
Vixtir 0285669
FE: Make a nav scrollbar thin
Vixtir 362ff3c
FE: Add useFts deps
Vixtir 40d03b2
Merge branch 'main' into issues/1333-optional-fts-fe
germanosin 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
8 changes: 7 additions & 1 deletion
8
frontend/src/components/ACLPage/lib/useConsumerGroupsOptions.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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| import React from 'react'; | ||
| import FtsIcon from 'components/common/Icons/FtsIcon'; | ||
| import styled from 'styled-components'; | ||
| import Tooltip from 'components/common/Tooltip/Tooltip'; | ||
| import ClusterContext from 'components/contexts/ClusterContext'; | ||
|
|
||
| import useFts, { FtsAvailableResource } from './useFts'; | ||
|
|
||
| export const IconWrapper = styled.span.attrs<{ active: boolean }>(() => ({ | ||
| role: 'button', | ||
| tabIndex: 1, | ||
| }))` | ||
| display: inline-block; | ||
| &:hover { | ||
| cursor: pointer; | ||
| } | ||
| color: ${(props) => | ||
| props.active | ||
| ? props.theme.icons.ftsIcon.active | ||
| : props.theme.icons.ftsIcon.normal}; | ||
| `; | ||
|
|
||
| const Fts = ({ resourceName }: { resourceName: FtsAvailableResource }) => { | ||
| const { ftsEnabled: isFtsFetureEnabled } = React.useContext(ClusterContext); | ||
| const { handleSwitch, isFtsEnabled } = useFts(resourceName); | ||
|
|
||
| if (!isFtsFetureEnabled) { | ||
| return null; | ||
| } | ||
|
|
||
| return ( | ||
| <Tooltip | ||
| value={ | ||
| <IconWrapper onClick={handleSwitch} active={isFtsEnabled}> | ||
| <FtsIcon /> | ||
| </IconWrapper> | ||
| } | ||
| content="Apply full text search" | ||
| placement="bottom" | ||
| showTooltip | ||
| fullWidth | ||
| /> | ||
| ); | ||
| }; | ||
|
|
||
| export default Fts; |
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,73 @@ | ||
| import ClusterContext from 'components/contexts/ClusterContext'; | ||
| import React from 'react'; | ||
| import { useSearchParams } from 'react-router-dom'; | ||
|
|
||
| export type FtsAvailableResource = | ||
| | 'topics' | ||
| | 'acl' | ||
| | 'consumer_groups' | ||
| | 'connects' | ||
| | 'schemas'; | ||
|
|
||
| const storageName = 'kafbat-ui_fts'; | ||
|
|
||
| const useFts = (resourceName: FtsAvailableResource) => { | ||
| const { ftsEnabled: isFtsFeatureEnabled, ftsDefaultEnabled } = | ||
| React.useContext(ClusterContext); | ||
| const [searchParams, setSearchParams] = useSearchParams(); | ||
| const storageKey = `${storageName}:${resourceName}`; | ||
|
|
||
| React.useEffect(() => { | ||
| if (!isFtsFeatureEnabled) { | ||
| searchParams.delete('fts'); | ||
| localStorage.removeItem(storageKey); | ||
| } | ||
|
|
||
| if (!searchParams.has('fts')) { | ||
| const value = localStorage.getItem(storageKey); | ||
| if (value === null) { | ||
| searchParams.set('fts', ftsDefaultEnabled ? 'true' : 'false'); | ||
| } else { | ||
| searchParams.set('fts', value); | ||
| } | ||
| } | ||
|
|
||
| setSearchParams(searchParams); | ||
| }, [isFtsFeatureEnabled, ftsDefaultEnabled]); | ||
Vixtir marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| const handleSwitch = () => { | ||
| if (!isFtsFeatureEnabled) { | ||
| return; | ||
| } | ||
| const currentValue = searchParams.get('fts') === 'true'; | ||
| if (currentValue) { | ||
| localStorage.setItem(storageKey, 'false'); | ||
| searchParams.set('fts', 'false'); | ||
| } else { | ||
| localStorage.setItem(storageKey, 'true'); | ||
| searchParams.set('fts', 'true'); | ||
| } | ||
|
|
||
| searchParams.set('page', '1'); | ||
| setSearchParams(searchParams); | ||
| }; | ||
|
|
||
| let isFtsEnabled = isFtsFeatureEnabled; | ||
| if (isFtsEnabled) { | ||
| if (searchParams.has('fts')) { | ||
| isFtsEnabled = searchParams.get('fts') === 'true'; | ||
| } else if (localStorage.getItem(storageKey)) { | ||
| isFtsEnabled = localStorage.getItem(storageKey) === 'true'; | ||
| } else { | ||
| isFtsEnabled = ftsDefaultEnabled; | ||
| } | ||
| } | ||
|
|
||
| return { | ||
| handleSwitch, | ||
| isFtsFetureEnabled: isFtsFeatureEnabled, | ||
Vixtir marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| isFtsEnabled, | ||
| }; | ||
| }; | ||
|
|
||
| export default useFts; | ||
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,20 @@ | ||
| import React from 'react'; | ||
|
|
||
| const FtsIcon: React.FC = () => { | ||
| return ( | ||
| <svg | ||
| fill="currentColor" | ||
| width="800px" | ||
| height="800px" | ||
| viewBox="0 0 56 56" | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| > | ||
| <path | ||
| fill="currentColor" | ||
| d="M 13.5039 50.9570 L 26.3476 50.9570 C 25.1055 49.9023 24.0508 48.6367 23.2773 47.1836 L 13.7148 47.1836 C 11.3008 47.1836 10.0117 45.9414 10.0117 43.5976 L 10.0117 8.1367 C 10.0117 5.8164 11.2773 4.4805 13.7148 4.4805 L 38.2070 4.4805 C 40.5508 4.4805 41.8867 5.7930 41.8867 8.1367 L 41.8867 28.5742 C 43.3398 29.3476 44.6055 30.3789 45.6602 31.6211 L 45.6602 8.0664 C 45.6602 3.1679 43.2461 .7070 38.3945 .7070 L 13.5039 .7070 C 8.6758 .7070 6.2383 3.1914 6.2383 8.0664 L 6.2383 43.6211 C 6.2383 48.5195 8.6758 50.9570 13.5039 50.9570 Z M 17.0898 14.0430 L 34.8555 14.0430 C 35.6758 14.0430 36.3086 13.3867 36.3086 12.5664 C 36.3086 11.7695 35.6758 11.1601 34.8555 11.1601 L 17.0898 11.1601 C 16.2227 11.1601 15.6133 11.7695 15.6133 12.5664 C 15.6133 13.3867 16.2227 14.0430 17.0898 14.0430 Z M 17.0898 22.2226 L 34.8555 22.2226 C 35.6758 22.2226 36.3086 21.5664 36.3086 20.7461 C 36.3086 19.9492 35.6758 19.3398 34.8555 19.3398 L 17.0898 19.3398 C 16.2227 19.3398 15.6133 19.9492 15.6133 20.7461 C 15.6133 21.5664 16.2227 22.2226 17.0898 22.2226 Z M 35.1367 50.9570 C 37.2461 50.9570 39.2383 50.3476 40.8789 49.2461 L 46.1524 54.5430 C 46.7148 55.0820 47.2305 55.2930 47.8633 55.2930 C 48.9414 55.2930 49.7617 54.4492 49.7617 53.2539 C 49.7617 52.7383 49.5040 52.2226 49.1056 51.8242 L 43.7617 46.4805 C 44.9570 44.7695 45.6602 42.6836 45.6602 40.4336 C 45.6602 34.5976 40.9492 29.8867 35.1367 29.8867 C 29.3242 29.8867 24.5664 34.6445 24.5664 40.4336 C 24.5664 46.2461 29.3242 50.9570 35.1367 50.9570 Z M 35.1367 47.6054 C 31.1524 47.6054 27.9180 44.3945 27.9180 40.4336 C 27.9180 36.5195 31.1524 33.2617 35.1367 33.2617 C 39.0508 33.2617 42.2851 36.5195 42.2851 40.4336 C 42.2851 44.3945 39.0742 47.6054 35.1367 47.6054 Z" | ||
| /> | ||
| </svg> | ||
| ); | ||
| }; | ||
|
|
||
| export default FtsIcon; |
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.