Skip to content

feat(TopicData): add tab for topic data #2145

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
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

feat(TopicData): add tab for topic data #2145

wants to merge 11 commits into from

Conversation

Raubzeug
Copy link
Contributor

@Raubzeug Raubzeug commented Apr 12, 2025

Stand

CI Results

Test Status: ❌ FAILED

πŸ“Š Full Report

Total Passed Failed Flaky Skipped
318 315 2 1 0

😟 No changes in tests. πŸ˜•

Bundle Size: πŸ”Ί

Current: 83.44 MB | Main: 83.36 MB
Diff: +0.08 MB (0.10%)

⚠️ Bundle size increased. Please review.

ℹ️ CI Information
  • Test recordings for failed tests are available in the full report.
  • Bundle size is measured for the entire 'dist' directory.
  • πŸ“Š indicates links to detailed reports.
  • πŸ”Ί indicates increase, πŸ”½ decrease, and βœ… no change in bundle size.

@Raubzeug Raubzeug requested a review from Copilot April 12, 2025 15:59
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 46 out of 50 changed files in this pull request and generated 2 comments.

Files not reviewed (4)
  • src/components/EmptyState/EmptyState.scss: Language not supported
  • src/components/MultilineTableHeader/MultilineTableHeader.scss: Language not supported
  • src/components/PaginatedTable/PaginatedTable.scss: Language not supported
  • src/containers/Tenant/Diagnostics/Partitions/Headers/Headers.scss: Language not supported

<div className={b('head-cell-content')}>{content}</div>
{column.note && (
<HelpMark
placement={columnAlignToHelpMarkPlacement[column.align]}
Copy link
Preview

Copilot AI Apr 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If column.align is undefined or not one of 'left', 'right', or 'center', this mapping will return undefined. Consider providing a default placement value to prevent potential runtime issues.

Suggested change
placement={columnAlignToHelpMarkPlacement[column.align]}
placement={columnAlignToHelpMarkPlacement[column.align] ?? 'top'}

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.


import './MultilineTableHeader.scss';

const b = cn('ydb-mulitiline-table-header');
Copy link
Preview

Copilot AI Apr 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There appears to be a typo in the class name 'ydb-mulitiline-table-header'; consider renaming it to 'ydb-multiline-table-header' for clarity.

Suggested change
const b = cn('ydb-mulitiline-table-header');
const b = cn('ydb-multiline-table-header');

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

@Raubzeug Raubzeug changed the title Ydb topic data feat(TopicData): add tab for topic data Apr 12, 2025
@Raubzeug Raubzeug linked an issue Apr 12, 2025 that may be closed by this pull request
@Raubzeug Raubzeug requested a review from Copilot April 12, 2025 16:09
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 46 out of 50 changed files in this pull request and generated no comments.

Files not reviewed (4)
  • src/components/EmptyState/EmptyState.scss: Language not supported
  • src/components/MultilineTableHeader/MultilineTableHeader.scss: Language not supported
  • src/components/PaginatedTable/PaginatedTable.scss: Language not supported
  • src/containers/Tenant/Diagnostics/Partitions/Headers/Headers.scss: Language not supported
Comments suppressed due to low confidence (1)

src/components/PaginatedTable/TableHead.tsx:138

  • The 'align' property is used to determine the HelpMark placement but is not declared in the Column interface. Consider adding an optional 'align' field to the Column type with a default value to ensure consistent behavior.
placement={columnAlignToHelpMarkPlacement[column.align]}

<FullValue value={fullValue} onClose={() => setFullValue(undefined)} />
<ResizeablePaginatedTable
//if any filter change, we need to initiate a new table component to ensure correct start offset calculations in generateTopicDataGetter
key={topicDataFilter + selectedOffset + startTimestamp + selectedPartition}
Copy link
Member

@artemmufazalov artemmufazalov Apr 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Table chunks are reset every time value in filters changes, why do you need key here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of logic inside generateTopicDataGetter https://github.com/ydb-platform/ydb-embedded-ui/pull/2145/files/c38c503b6fcc6c99e35da4324056d8374ccb5c03#diff-55d62e69373cb3d825abe22e33d121b8cda18477596ea4d1038a5560934ac1f4 ! Every time we should calculate initial offset, and table offset should be reset to 0.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But there is already

parentRef.current.scrollTo(0, 0);

in React.useLayoutEffect in PaginatedTable

shouldnt this be enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a little improvement to PaginatedTable, so it does't refetch previous active chunks when filters changes. So the key is not needed any more.

import {cn} from '../../utils/cn';
import {DebouncedInput} from '../DebouncedInput/DebouncedInput';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think we need search component now - we can use DebouncedInput directly where Search was used

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We definitely can, but it will require to pass similar props in a lot of places where was used. Do you think it is really needed?

import type {TextInputProps} from '@gravity-ui/uikit';
import {TextInput} from '@gravity-ui/uikit';

interface SearchProps extends TextInputProps {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DebouncedInputProps ?

@@ -5,11 +5,12 @@
flex-grow: 1;

height: 100%;
margin-right: -20px;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

calc(-1 * var(--g-spacing-5))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems we don't need it at all

{TopicDataFilterValues.TIMESTAMP}
</RadioButton.Option>
<RadioButton.Option value="OFFSET">
{TopicDataFilterValues.OFFSET}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose value in RadioButton should be TopicDataFilterValues.OFFSET and text i18(...)

according to current project rules

{TopicDataFilterValues.OFFSET}
</RadioButton.Option>
</RadioButton>
{topicDataFilter === 'OFFSET' && (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here and below too

&__table {
@include mixins.freeze-nth-column(1);
// padding-right: 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment

@Raubzeug
Copy link
Contributor Author

@astandrik @artemmufazalov stand redeployed

Copy link
Contributor

@Copilot Copilot AI left a 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 "Data" tab for topic data diagnostics and enhances related page linking and filtering logic for topic and database entity types.

  • Updated diagnostics pages to include the new topicData tab
  • Refactored page lookup logic to handle topic data and database feature flags
  • Replaced TextInput with a DebouncedInput component for better search handling

Reviewed Changes

Copilot reviewed 45 out of 48 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/containers/Tenant/Diagnostics/DiagnosticsPages.ts Added topicData tab and updated pages filtering logic
src/containers/Tenant/Diagnostics/Diagnostics.tsx Integrated topicData rendering with updated diagnostics page linking
src/containers/Storage/shared.ts Removed unused paginated table error message helper
src/containers/Storage/PaginatedStorageNodes.tsx Updated import usage for error message rendering
src/containers/Storage/PaginatedStorageGroups.tsx Updated import usage for error message rendering
src/containers/Storage/EmptyFilter/EmptyFilter.tsx Modified to allow an optional custom image for empty filters
src/components/Search/Search.tsx Replaced TextInput with DebouncedInput for improved debounced search input
src/components/PaginatedTable/useScrollBasedChunks.ts Adjusted active chunks calculation logic
src/components/PaginatedTable/types.ts Added a note property to the Column type
src/components/PaginatedTable/TableHead.tsx Added HelpMark support for displaying column notes
src/components/PaginatedTable/TableChunk.tsx Updated offset calculation to include startOffset
src/components/PaginatedTable/PaginatedTable.tsx Introduced startOffset prop and refined filters update and dependency
src/components/MultilineTableHeader/MultilineTableHeader.tsx New component for rendering multi-line table headers
src/components/MetricChart/getDefaultDataFormatter.ts Replaced numeric conversion helper with a safer version
src/components/DebouncedInput/DebouncedInput.tsx New debounced input component implementation
Files not reviewed (3)
  • src/components/EmptyState/EmptyState.scss: Language not supported
  • src/components/MultilineTableHeader/MultilineTableHeader.scss: Language not supported
  • src/components/PaginatedTable/PaginatedTable.scss: Language not supported

@@ -84,7 +92,7 @@ export const useScrollBasedChunks = ({
return React.useMemo(() => {
// boolean array that represents active chunks
const activeChunks = Array(chunksCount).fill(false);
for (let i = startChunk; i <= endChunk; i++) {
for (let i = startChunk; i <= Math.min(endChunk, chunksCount); i++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

endChunk already has value calculated based on chunksCount, because of this code in calculateVisibleRange:

const end = Math.min(
    Math.floor(visibleEnd / rowHeight / chunkSize) + overscanCount, 
    Math.max(chunksCount - 1, 0),
);

REQUIRED_TOPIC_DATA_COLUMNS,
);

const emptyData = React.useMemo(() => !currentData?.Messages?.length, [currentData]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

emptyData is boolean, you don't need useMemo here


const scrollToOffset = React.useCallback(
(newOffset: number) => {
const scrollTop = (newOffset - (startOffset ?? 0)) * 41;
Copy link
Member

@artemmufazalov artemmufazalov Apr 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably it's better to make 41 a constant and pass it to PaginatedTable as rowHeight to ensure they are the same

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to do it but completely forgot...

@@ -30,6 +30,7 @@ interface TableChunkProps<T, F> {
sortParams?: SortParams;
isActive: boolean;
tableName: string;
startOffset: number;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mb its possible to set startOffset as rowIndex?

parentRef: React.RefObject<HTMLElement>;
}

export function TopicData({parentRef, path, database}: TopicDataProps) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no data is shown when filters updated

https://nda.ya.ru/t/3AK7x3oY7Dp5qT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tab Data in topic's Diagnostics
3 participants