Skip to content

feat(TopicData): add topic message details in Drawer #2266

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 10 commits into from
May 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/components/EnableFullscreenButton/EnableFullscreenButton.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
import {SquareDashed} from '@gravity-ui/icons';
import type {ButtonView} from '@gravity-ui/uikit';
import {Button, Icon} from '@gravity-ui/uikit';

import {enableFullscreen} from '../../store/reducers/fullscreen';
import {useTypedDispatch} from '../../utils/hooks';

interface EnableFullscreenButtonProps {
disabled?: boolean;
view?: ButtonView;
}

function EnableFullscreenButton({disabled}: EnableFullscreenButtonProps) {
function EnableFullscreenButton({disabled, view = 'flat-secondary'}: EnableFullscreenButtonProps) {
const dispatch = useTypedDispatch();
const onEnableFullscreen = () => {
dispatch(enableFullscreen());
};
return (
<Button
onClick={onEnableFullscreen}
view="flat-secondary"
disabled={disabled}
title="Fullscreen"
>
<Button onClick={onEnableFullscreen} view={view} disabled={disabled} title="Fullscreen">
<Icon data={SquareDashed} />
</Button>
);
Expand Down
10 changes: 8 additions & 2 deletions src/components/EntityStatus/EntityStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const b = cn('entity-status');
interface EntityStatusProps {
status?: EFlag;
name?: string;
renderName?: (name?: string) => React.ReactNode;
label?: string;
path?: string;
iconPath?: string;
Expand All @@ -34,9 +35,14 @@ interface EntityStatusProps {
className?: string;
}

function defaultRenderName(name?: string) {
return name ?? '';
}

export function EntityStatus({
status = EFlag.Grey,
name = '',
renderName = defaultRenderName,
label,
path,
iconPath,
Expand Down Expand Up @@ -75,14 +81,14 @@ export function EntityStatus({
if (externalLink) {
return (
<UIKitLink className={b('name')} href={path}>
{name}
{renderName(name)}
</UIKitLink>
);
}

return (
<InternalLink className={b('name')} to={path}>
{name}
{renderName(name)}
</InternalLink>
);
}
Expand Down
2 changes: 2 additions & 0 deletions src/components/JsonViewer/JsonViewer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
--data-table-row-height: 20px;
--toolbar-background-color: var(--g-color-base-background);

width: max-content;

&__toolbar {
position: sticky;
z-index: 2;
Expand Down
9 changes: 7 additions & 2 deletions src/components/JsonViewer/JsonViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ interface JsonViewerCommonProps {
tableSettings?: DT100.Settings;
search?: boolean;
collapsedInitially?: boolean;
maxValueWidth?: number;
toolbarClassName?: string;
}

interface JsonViewerProps extends JsonViewerCommonProps {
Expand Down Expand Up @@ -60,7 +62,7 @@ const SETTINGS: DT100.Settings = {
displayIndices: false,
dynamicRender: true,
sortable: false,
dynamicRenderMinSize: 100,
dynamicRenderMinSize: 50,
};

function getCollapsedState(value: UnipikaValue) {
Expand Down Expand Up @@ -114,6 +116,8 @@ function JsonViewerComponent({
search = true,
extraTools,
collapsedInitially,
maxValueWidth = 100,
toolbarClassName,
}: JsonViewerComponentProps) {
const [caseSensitiveSearch, setCaseSensitiveSearch] = useSetting(
CASE_SENSITIVE_JSON_SEARCH,
Expand Down Expand Up @@ -162,6 +166,7 @@ function JsonViewerComponent({
filter={filter}
showFullText={onShowFullText}
index={index}
maxValueWidth={maxValueWidth}
/>
);
};
Expand Down Expand Up @@ -295,7 +300,7 @@ function JsonViewerComponent({

const renderToolbar = () => {
return (
<Flex gap={2} wrap="nowrap" className={block('toolbar')}>
<Flex gap={2} wrap="nowrap" className={block('toolbar', toolbarClassName)}>
<Flex gap={1} wrap="nowrap">
<ActionTooltip title={i18n('action_expand-all')}>
<Button onClick={onExpandAll} view="flat-secondary">
Expand Down
21 changes: 16 additions & 5 deletions src/components/JsonViewer/components/Cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ interface CellProps {
filter?: string;
index: number;
showFullText: (index: number) => void;
maxValueWidth?: number;
}

export function Cell(props: CellProps) {
Expand Down Expand Up @@ -69,6 +70,7 @@ export function Cell(props: CellProps) {
matched={matched?.valueMatch}
filter={filter}
showFullText={handleShowFullText}
maxValueWidth={props.maxValueWidth}
/>
)}
{collapsed && depth === undefined && <span className={'unipika'}>...</span>}
Expand Down Expand Up @@ -97,6 +99,7 @@ function Key(props: KeyProps) {

interface ValueProps extends KeyProps {
showFullText?: () => void;
maxValueWidth?: number;
}

function Value(props: ValueProps) {
Expand All @@ -109,16 +112,24 @@ function Value(props: ValueProps) {

function renderValueWithFilter(props: ValueProps, className: string) {
if ('string' === props.text?.$type) {
return renderStringWithFilter(props, className, 100);
return renderStringWithFilter(props, className);
}
return renderWithFilter(props, block('value'));
}

function renderStringWithFilter(props: ValueProps, className: string, maxWidth = Infinity) {
const {text, settings = defaultUnipikaSettings, matched = [], filter, showFullText} = props;
const tmp = unipika.format(text, {...settings, asHTML: false});
function renderStringWithFilter(props: ValueProps, className: string) {
const {
text,
settings = defaultUnipikaSettings,
matched = [],
filter,
showFullText,
maxValueWidth = Infinity,
} = props;

const tmp = unipika.format(text, {...settings, maxStringSize: 10, asHTML: false});
const length = tmp.length;
const visible = tmp.substring(1, Math.min(length - 1, maxWidth + 1));
const visible = tmp.substring(1, Math.min(length - 1, maxValueWidth + 1));
const truncated = visible.length < tmp.length - 2;
let hasHiddenMatch = false;
if (truncated) {
Expand Down
6 changes: 5 additions & 1 deletion src/components/JsonViewer/components/FullValueDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ interface FullValueDialogProps {
}

export function FullValueDialog({onClose, text, starts, length}: FullValueDialogProps) {
//if dialog opens from Drawer, outside click should not close Drawer
const handleClickOutside = (e: MouseEvent) => {
e.stopPropagation();
};
return (
<Dialog open={true} onClose={onClose}>
<Dialog open={true} onClose={onClose} onOutsideClick={handleClickOutside}>
<Dialog.Header caption={i18n('description_full-value')} />
<Dialog.Divider />
<Dialog.Body>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ShortyString/ShortyString.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.kv-shorty-string {
&__toggle {
margin-left: 2em;
margin-left: 1em;

font-size: 0.85em;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const PartitionsControls = ({
connectionHost,
} = partition;

const isPartitionIdMatch = partitionIdRe.test(partitionId);
const isPartitionIdMatch = partitionIdRe.test(String(partitionId));

const otherValues = [
readerName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const allColumns: Column<PreparedPartitionDataWithHosts>[] = [
),
sortAccessor: (row) => isNumeric(row.partitionId) && Number(row.partitionId),
align: DataTable.LEFT,
render: ({row}) => <PartitionId id={row.partitionId} />,
render: ({row}) => <PartitionId id={String(row.partitionId)} />,
},
{
name: PARTITIONS_COLUMNS_IDS.STORE_SIZE,
Expand Down
10 changes: 8 additions & 2 deletions src/containers/Tenant/Diagnostics/TopicData/TopicData.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
&__date-picker {
min-width: 265px;
}
&__column-setup {
margin-left: auto;
&__offset-input {
width: max-content;
}

&__row {
Expand All @@ -24,5 +24,11 @@
background: var(--g-color-base-selection-hover) !important;
}
}
&_removed {
color: var(--g-color-text-secondary);
}
}
&__scroll-button {
margin-right: var(--g-spacing-half);
}
}
Loading
Loading