Skip to content

Commit 4c76d07

Browse files
authored
remove offset input render condition in topic messages filters (#1876)
1 parent f708091 commit 4c76d07

File tree

2 files changed

+36
-38
lines changed

2 files changed

+36
-38
lines changed

kafka-ui-react-app/src/components/Topics/Topic/Details/Messages/Filters/Filters.tsx

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -357,42 +357,40 @@ const Filters: React.FC<FiltersProps> = ({
357357
value={query}
358358
onChange={({ target: { value } }) => setQuery(value)}
359359
/>
360-
{isSeekTypeControlVisible && (
361-
<S.SeekTypeSelectorWrapper>
362-
<Select
363-
id="selectSeekType"
364-
onChange={(option) => setCurrentSeekType(option as SeekType)}
365-
value={currentSeekType}
366-
selectSize="M"
367-
minWidth="100px"
368-
options={SeekTypeOptions}
360+
<S.SeekTypeSelectorWrapper>
361+
<Select
362+
id="selectSeekType"
363+
onChange={(option) => setCurrentSeekType(option as SeekType)}
364+
value={currentSeekType}
365+
selectSize="M"
366+
minWidth="100px"
367+
options={SeekTypeOptions}
368+
disabled={isLive}
369+
/>
370+
{currentSeekType === SeekType.OFFSET ? (
371+
<Input
372+
id="offset"
373+
type="text"
374+
inputSize="M"
375+
value={offset}
376+
className="offset-selector"
377+
placeholder="Offset"
378+
onChange={({ target: { value } }) => setOffset(value)}
369379
disabled={isLive}
370380
/>
371-
{currentSeekType === SeekType.OFFSET ? (
372-
<Input
373-
id="offset"
374-
type="text"
375-
inputSize="M"
376-
value={offset}
377-
className="offset-selector"
378-
placeholder="Offset"
379-
onChange={({ target: { value } }) => setOffset(value)}
380-
disabled={isLive}
381-
/>
382-
) : (
383-
<DatePicker
384-
selected={timestamp}
385-
onChange={(date: Date | null) => setTimestamp(date)}
386-
showTimeInput
387-
timeInputLabel="Time:"
388-
dateFormat="MMMM d, yyyy HH:mm"
389-
className="date-picker"
390-
placeholderText="Select timestamp"
391-
disabled={isLive}
392-
/>
393-
)}
394-
</S.SeekTypeSelectorWrapper>
395-
)}
381+
) : (
382+
<DatePicker
383+
selected={timestamp}
384+
onChange={(date: Date | null) => setTimestamp(date)}
385+
showTimeInput
386+
timeInputLabel="Time:"
387+
dateFormat="MMMM d, yyyy HH:mm"
388+
className="date-picker"
389+
placeholderText="Select timestamp"
390+
disabled={isLive}
391+
/>
392+
)}
393+
</S.SeekTypeSelectorWrapper>
396394
<MultiSelect
397395
options={partitions.map((p) => ({
398396
label: `Partition #${p.partition.toString()}`,

kafka-ui-react-app/src/components/Topics/Topic/Details/Messages/__test__/Messages.spec.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ describe('Messages', () => {
3535
setUpComponent();
3636
});
3737
it('should check default seekDirection if it actually take the value from the url', () => {
38-
expect(screen.getByRole('listbox')).toHaveTextContent(
38+
expect(screen.getAllByRole('listbox')[1]).toHaveTextContent(
3939
SeekDirectionOptionsObj[SeekDirection.FORWARD].label
4040
);
4141
});
4242

4343
it('should check the SeekDirection select changes', () => {
44-
const seekDirectionSelect = screen.getByRole('listbox');
45-
const seekDirectionOption = screen.getByRole('option');
44+
const seekDirectionSelect = screen.getAllByRole('listbox')[1];
45+
const seekDirectionOption = screen.getAllByRole('option')[1];
4646

4747
expect(seekDirectionOption).toHaveTextContent(
4848
SeekDirectionOptionsObj[SeekDirection.FORWARD].label
@@ -69,7 +69,7 @@ describe('Messages', () => {
6969
setUpComponent(
7070
searchParams.replace(SeekDirection.FORWARD, SeekDirection.BACKWARD)
7171
);
72-
expect(screen.getByRole('listbox')).toHaveTextContent(
72+
expect(screen.getAllByRole('listbox')[1]).toHaveTextContent(
7373
SeekDirectionOptionsObj[SeekDirection.BACKWARD].label
7474
);
7575
});

0 commit comments

Comments
 (0)