Skip to content

Commit

Permalink
fix(ui): add null check to find overlapping blocks logicx (#7644)
Browse files Browse the repository at this point in the history
Signed-off-by: pureiboi <[email protected]>
  • Loading branch information
pureiboi authored Aug 27, 2024
1 parent d966613 commit ce52e9f
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
- [#7592](https://github.com/thanos-io/thanos/pull/7592) Ruler: Only increment `thanos_rule_evaluation_with_warnings_total` metric for non PromQL warnings.
- [#7614](https://github.com/thanos-io/thanos/pull/7614) *: fix debug log formatting.
- [#7492](https://github.com/thanos-io/thanos/pull/7492) Compactor: update filtered blocks list before second downsample pass.
- [#7644](https://github.com/thanos-io/thanos/pull/7644) fix(ui): add null check to find overlapping blocks logic

### Added

Expand Down
7 changes: 5 additions & 2 deletions pkg/ui/react-app/src/thanos/pages/blocks/helpers.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,9 @@ const blockPools = {
],
],
},
'5': {
'1-0': [],
},
};

// Total filtered blocks = 1
Expand Down Expand Up @@ -634,8 +637,8 @@ describe('isOverlapping helper', () => {
});

describe('Block Pools', () => {
it('should have exactly 4 objects', () => {
expect(Object.keys(blockPools)).toHaveLength(4);
it('should have exactly 5 objects', () => {
expect(Object.keys(blockPools)).toHaveLength(5);
});
});

Expand Down
6 changes: 5 additions & 1 deletion pkg/ui/react-app/src/thanos/pages/blocks/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ export const getFilteredBlockPools = (
const poolArrayIndex = blockPools[key];
const poolArray = poolArrayIndex[Object.keys(poolArrayIndex)[0]];
for (let i = 0; i < filteredBlocks.length; i++) {
if (JSON.stringify(filteredBlocks[i].thanos.labels) === JSON.stringify(poolArray[0][0].thanos.labels)) {
if (
poolArray[0] &&
poolArray[0][0] &&
JSON.stringify(filteredBlocks[i].thanos.labels) === JSON.stringify(poolArray[0][0].thanos.labels)
) {
Object.assign(newblockPools, { [key]: blockPools[key] });
break;
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/ui/static/react/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"files": {
"main.css": "./static/css/main.17d667f4.css",
"main.js": "./static/js/main.20f9b436.js",
"main.js": "./static/js/main.13865c91.js",
"static/media/codicon.ttf": "./static/media/codicon.b3726f0165bf67ac6849.ttf",
"index.html": "./index.html",
"static/media/index.cjs": "./static/media/index.cd351d7c31d0d3fccf96.cjs",
"main.17d667f4.css.map": "./static/css/main.17d667f4.css.map",
"main.20f9b436.js.map": "./static/js/main.20f9b436.js.map"
"main.13865c91.js.map": "./static/js/main.13865c91.js.map"
},
"entrypoints": [
"static/css/main.17d667f4.css",
"static/js/main.20f9b436.js"
"static/js/main.13865c91.js"
]
}
2 changes: 1 addition & 1 deletion pkg/ui/static/react/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="shortcut icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><meta name="theme-color" content="#000000"/><script>const GLOBAL_PATH_PREFIX="{{ pathPrefix }}"</script><script>const THANOS_COMPONENT="{{ .Component }}",THANOS_QUERY_URL="{{ .queryURL }}",THANOS_TENANT_HEADER="{{ .tenantHeader }}",THANOS_DEFAULT_TENANT="{{ .defaultTenant }}",THANOS_DISPLAY_TENANT_BOX="{{ .displayTenantBox }}"</script><link rel="manifest" href="./manifest.json"/><title>Thanos | Highly available Prometheus setup</title><script defer="defer" src="./static/js/main.20f9b436.js"></script><link href="./static/css/main.17d667f4.css" rel="stylesheet"></head><body class="bootstrap"><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="shortcut icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><meta name="theme-color" content="#000000"/><script>const GLOBAL_PATH_PREFIX="{{ pathPrefix }}"</script><script>const THANOS_COMPONENT="{{ .Component }}",THANOS_QUERY_URL="{{ .queryURL }}",THANOS_TENANT_HEADER="{{ .tenantHeader }}",THANOS_DEFAULT_TENANT="{{ .defaultTenant }}",THANOS_DISPLAY_TENANT_BOX="{{ .displayTenantBox }}"</script><link rel="manifest" href="./manifest.json"/><title>Thanos | Highly available Prometheus setup</title><script defer="defer" src="./static/js/main.13865c91.js"></script><link href="./static/css/main.17d667f4.css" rel="stylesheet"></head><body class="bootstrap"><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

0 comments on commit ce52e9f

Please sign in to comment.