Skip to content
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

Fix: Filter block rows in bucket UI according to searched block ID #5102

Merged
merged 3 commits into from
Feb 13, 2022
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re

### Fixed

- [#5102](https://github.com/thanos-io/thanos/pull/5102) Fix: Filter block rows in bucket UI according to searched block ID
- [#5051](https://github.com/thanos-io/thanos/pull/5051) Prober: Remove spam of changing probe status.
- [#4918](https://github.com/thanos-io/thanos/pull/4918) Tracing: Fixing force tracing with Jaeger.
- [#4879](https://github.com/thanos-io/thanos/pull/4879) Bucket verify: Fixed bug causing wrong number of blocks to be checked.
Expand Down
36 changes: 22 additions & 14 deletions pkg/ui/react-app/src/thanos/pages/blocks/Blocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { SourceView } from './SourceView';
import { BlockDetails } from './BlockDetails';
import { BlockSearchInput } from './BlockSearchInput';
import { BlockFilterCompaction } from './BlockFilterCompaction';
import { sortBlocks } from './helpers';
import { sortBlocks, getBlockByUlid, getFilteredBlockPools } from './helpers';
import styles from './blocks.module.css';
import TimeRange from './TimeRange';
import Checkbox from '../../../components/Checkbox';
Expand Down Expand Up @@ -71,6 +71,8 @@ export const BlocksContent: FC<{ data: BlockListProps }> = ({ data }) => {
const [blockSearch, setBlockSearch] = useState<string>(blockSearchParam);

const blockPools = useMemo(() => sortBlocks(blocks, label, findOverlappingBlocks), [blocks, label, findOverlappingBlocks]);
const filteredBlocks = useMemo(() => getBlockByUlid(blocks, blockSearch), [blocks, blockSearch]);
const filteredBlockPools = useMemo(() => getFilteredBlockPools(blockPools, filteredBlocks), [filteredBlocks, blockPools]);

const setViewTime = (times: number[]): void => {
setQuery({
Expand All @@ -89,7 +91,7 @@ export const BlocksContent: FC<{ data: BlockListProps }> = ({ data }) => {
const onChangeCompactionCheckbox = (target: EventTarget & HTMLInputElement) => {
setFilterCompaction(target.checked);
if (target.checked) {
let compactionLevel: number = parseInt(compactionLevelInput);
const compactionLevel: number = parseInt(compactionLevelInput);
setQuery({
'filter-compaction': target.checked,
'compaction-level': compactionLevel,
Expand Down Expand Up @@ -151,18 +153,24 @@ export const BlocksContent: FC<{ data: BlockListProps }> = ({ data }) => {
<div className={styles.container}>
<div className={styles.grid}>
<div className={styles.sources}>
{Object.keys(blockPools).map((pk) => (
<SourceView
key={pk}
data={blockPools[pk]}
title={pk}
selectBlock={selectBlock}
gridMinTime={viewMinTime}
gridMaxTime={viewMaxTime}
blockSearch={blockSearch}
compactionLevel={compactionLevel}
/>
))}
{Object.keys(filteredBlockPools).length > 0 ? (
Object.keys(filteredBlockPools).map((pk) => (
<SourceView
key={pk}
data={filteredBlockPools[pk]}
title={pk}
selectBlock={selectBlock}
gridMinTime={viewMinTime}
gridMaxTime={viewMaxTime}
blockSearch={blockSearch}
compactionLevel={compactionLevel}
/>
))
) : (
<div>
<h3>No Blocks Found!</h3>
</div>
)}
</div>
<TimeRange
gridMinTime={gridMinTime}
Expand Down
Loading