-
Notifications
You must be signed in to change notification settings - Fork 387
RI-7197 Rework the manage index section #4785
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
valkirilov
merged 2 commits into
feature/RI-6855/vector-search
from
fe/feature/RI-7197_vector-search-manage-indexes-rework
Aug 4, 2025
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
36 changes: 0 additions & 36 deletions
36
redisinsight/ui/src/mocks/factories/redisearch/IndexInfoTableData.factory.ts
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,14 +1,17 @@ | ||
import React from 'react' | ||
import { cleanup, render, screen } from 'uiSrc/utils/test-utils' | ||
import { indexInfoTableDataFactory } from 'uiSrc/mocks/factories/redisearch/IndexInfoTableData.factory' | ||
import { | ||
indexInfoAttributeFactory, | ||
indexInfoFactory, | ||
} from 'uiSrc/mocks/factories/redisearch/IndexInfo.factory' | ||
import { | ||
IndexAttributesList, | ||
IndexAttributesListProps, | ||
} from './IndexAttributesList' | ||
|
||
const renderComponent = (props?: Partial<IndexAttributesListProps>) => { | ||
const defaultProps: IndexAttributesListProps = { | ||
data: indexInfoTableDataFactory.buildList(3), | ||
indexInfo: indexInfoFactory.build(), | ||
} | ||
|
||
return render(<IndexAttributesList {...defaultProps} {...props} />) | ||
|
@@ -21,12 +24,41 @@ describe('IndexAttributesList', () => { | |
|
||
it('should render', () => { | ||
const props: IndexAttributesListProps = { | ||
data: [ | ||
indexInfoTableDataFactory.build( | ||
{}, | ||
{ transient: { includeWeight: true, includeSeparator: true } }, | ||
), | ||
], | ||
indexInfo: indexInfoFactory.build(), | ||
} | ||
|
||
const { container } = renderComponent(props) | ||
expect(container).toBeTruthy() | ||
|
||
const list = screen.getByTestId('index-attributes-list') | ||
expect(list).toBeInTheDocument() | ||
|
||
const table = screen.getByTestId('index-attributes-list--table') | ||
const summaryInfo = screen.getByTestId( | ||
'index-attributes-list--summary-info', | ||
) | ||
|
||
expect(table).toBeInTheDocument() | ||
expect(summaryInfo).toBeInTheDocument() | ||
}) | ||
|
||
it('should render loader when index info is not provided', () => { | ||
renderComponent({ indexInfo: undefined }) | ||
|
||
const loader = screen.getByTestId('index-attributes-list--loader') | ||
expect(loader).toBeInTheDocument() | ||
}) | ||
|
||
it('should render index attributes in the table', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
const mockIndexAttribute = indexInfoAttributeFactory.build( | ||
{}, | ||
{ transient: { includeWeight: true, includeNoIndex: true } }, | ||
) | ||
|
||
const props: IndexAttributesListProps = { | ||
indexInfo: indexInfoFactory.build({ | ||
attributes: [mockIndexAttribute], | ||
}), | ||
} | ||
|
||
const { container } = renderComponent(props) | ||
|
@@ -36,14 +68,67 @@ describe('IndexAttributesList', () => { | |
expect(list).toBeInTheDocument() | ||
|
||
// Verify data is rendered correctly | ||
const attribute = screen.getByText(props.data[0].attribute) | ||
const type = screen.getByText(props.data[0].type) | ||
const weight = screen.getByText(props.data[0].weight!) | ||
const separator = screen.getByText(props.data[0].separator!) | ||
const identifier = screen.getByText(mockIndexAttribute.identifier) | ||
const attribute = screen.getByText(mockIndexAttribute.attribute) | ||
const type = screen.getByText(mockIndexAttribute.type) | ||
const weight = screen.getByText(mockIndexAttribute.WEIGHT!) | ||
const noIndex = screen.getByTestId('index-attributes-list--noindex-icon') | ||
|
||
expect(identifier).toBeInTheDocument() | ||
expect(attribute).toBeInTheDocument() | ||
expect(type).toBeInTheDocument() | ||
expect(weight).toBeInTheDocument() | ||
expect(separator).toBeInTheDocument() | ||
expect(noIndex).toBeInTheDocument() | ||
expect(noIndex).toHaveAttribute( | ||
'data-attribute', | ||
mockIndexAttribute.NOINDEX?.toString(), | ||
) | ||
}) | ||
|
||
it('should display index summary info', () => { | ||
const mockIndexInfo = indexInfoFactory.build() | ||
|
||
const props: IndexAttributesListProps = { | ||
indexInfo: mockIndexInfo, | ||
} | ||
|
||
renderComponent(props) | ||
|
||
const summaryInfo = screen.getByTestId( | ||
'index-attributes-list--summary-info', | ||
) | ||
expect(summaryInfo).toBeInTheDocument() | ||
|
||
// Verify Number of documents | ||
const numberOfDocumentLabel = screen.getByText(/Number of docs:/) | ||
const numberOfDocumentValue = screen.getByText( | ||
new RegExp(mockIndexInfo.num_docs), | ||
) | ||
expect(numberOfDocumentLabel).toBeInTheDocument() | ||
expect(numberOfDocumentValue).toBeInTheDocument() | ||
|
||
// Verify Max document ID | ||
const maxDocumentIdLabel = screen.getByText(/max/) | ||
const maxDocumentIdValue = screen.getByText( | ||
new RegExp(mockIndexInfo.max_doc_id!), | ||
) | ||
expect(maxDocumentIdLabel).toBeInTheDocument() | ||
expect(maxDocumentIdValue).toBeInTheDocument() | ||
|
||
// Verify Number of records | ||
const numberOfRecordsLabel = screen.getByText(/Number of records:/) | ||
const numberOfRecordsValue = screen.getByText( | ||
new RegExp(mockIndexInfo.num_records!), | ||
) | ||
expect(numberOfRecordsLabel).toBeInTheDocument() | ||
expect(numberOfRecordsValue).toBeInTheDocument() | ||
|
||
// Verify Number of terms | ||
const numberOfTermsLabel = screen.getByText(/Number of terms:/) | ||
const numberOfTermsValue = screen.getByText( | ||
new RegExp(mockIndexInfo.num_terms!), | ||
) | ||
expect(numberOfTermsLabel).toBeInTheDocument() | ||
expect(numberOfTermsValue).toBeInTheDocument() | ||
}) | ||
}) |
17 changes: 12 additions & 5 deletions
17
redisinsight/ui/src/pages/vector-search/manage-indexes/IndexAttributesList.styles.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 |
---|---|---|
@@ -1,9 +1,16 @@ | ||
import styled from 'styled-components' | ||
|
||
export const StyledIndexAttributesList = styled.div` | ||
> *:first-child { | ||
box-shadow: none !important; | ||
border-radius: 0; | ||
margin: -30px 0; | ||
} | ||
display: flex; | ||
gap: ${({ theme }) => theme.core.space.space150}; | ||
flex-direction: column; | ||
` | ||
|
||
export const StyledIndexAttributesTable = styled.div` | ||
// Drawer width (60rem) minus its padding (2 * 3.2rem), we don't have them as variables in Redis UI | ||
width: calc(60rem - 2 * 3.2rem); | ||
` | ||
|
||
export const StyledIndexSummaryInfo = styled.div` | ||
font-size: ${({ theme }) => theme.core.font.fontSize.s12}; | ||
` |
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
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.
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.