Skip to content

Commit 2123638

Browse files
committed
fixes
1 parent 844fd7a commit 2123638

File tree

5 files changed

+17
-36
lines changed

5 files changed

+17
-36
lines changed

src/containers/Node/Node.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ export function Node() {
6868

6969
const isStorageNode = node?.Roles?.find((el) => el === STORAGE_ROLE);
7070

71+
const threadsQuantity = node?.Threads?.length;
72+
7173
const {activeTab, nodeTabs} = React.useMemo(() => {
7274
let actualNodeTabs = isStorageNode
7375
? NODE_TABS
@@ -76,15 +78,15 @@ export function Node() {
7678
actualNodeTabs = actualNodeTabs.filter((el) => el.id !== 'structure');
7779
}
7880
// Filter out threads tab if there's no thread data in the API response
79-
if (!node?.Threads || node.Threads.length === 0) {
81+
if (!threadsQuantity) {
8082
actualNodeTabs = actualNodeTabs.filter((el) => el.id !== 'threads');
8183
}
8284

8385
const actualActiveTab =
8486
actualNodeTabs.find(({id}) => id === activeTabId) ?? actualNodeTabs[0];
8587

8688
return {activeTab: actualActiveTab, nodeTabs: actualNodeTabs};
87-
}, [isStorageNode, isDiskPagesAvailable, activeTabId, node?.Threads]);
89+
}, [isStorageNode, isDiskPagesAvailable, activeTabId, threadsQuantity]);
8890

8991
const tenantName = node?.Tenants?.[0] || tenantNameFromQuery?.toString();
9092

src/store/reducers/node/types.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type {TThreadPoolInfo} from '../../../types/api/threads';
21
import type {PreparedPDisk, PreparedVDisk} from '../../../utils/disks/types';
32
import type {PreparedNodeSystemState} from '../../../utils/nodes';
43

@@ -19,6 +18,4 @@ export interface PreparedStructurePDisk extends PreparedPDisk {
1918

2019
export type PreparedNodeStructure = Record<string, PreparedStructurePDisk>;
2120

22-
export interface PreparedNode extends Partial<PreparedNodeSystemState> {
23-
Threads?: TThreadPoolInfo[];
24-
}
21+
export interface PreparedNode extends Partial<PreparedNodeSystemState> {}

src/store/reducers/node/utils.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,5 @@ export const prepareNodeData = (data: TEvSystemStateResponse): PreparedNode => {
1010

1111
const nodeData = data.SystemStateInfo[0];
1212

13-
const preparedSystemState = prepareNodeSystemState(nodeData);
14-
15-
// Include Threads from the top-level response for the tab filtering logic
16-
return {
17-
...preparedSystemState,
18-
Threads: data.Threads,
19-
};
13+
return prepareNodeSystemState(nodeData);
2014
};

tests/suites/nodes/NodePage.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type {Locator, Page} from '@playwright/test';
22

33
import {PageModel} from '../../models/PageModel';
4+
import {VISIBILITY_TIMEOUT} from '../tenant/TenantPage';
45

56
export class NodePage extends PageModel {
67
readonly tabs: Locator;
@@ -20,8 +21,7 @@ export class NodePage extends PageModel {
2021
async waitForNodePageLoad() {
2122
// Wait for the page to load and tabs to be visible
2223
try {
23-
await this.tabs.waitFor({state: 'visible', timeout: 10000});
24-
console.log('Node page tabs loaded successfully');
24+
await this.tabs.waitFor({state: 'visible', timeout: VISIBILITY_TIMEOUT});
2525
} catch (error) {
2626
console.error('Failed to load node page tabs:', error);
2727
throw error;
@@ -31,24 +31,21 @@ export class NodePage extends PageModel {
3131
async isThreadsTabVisible() {
3232
const threadsTab = this.tabs.locator('.g-tab:has-text("Threads")');
3333
try {
34-
await threadsTab.waitFor({state: 'visible', timeout: 2000});
35-
console.log('Threads tab is visible');
34+
await threadsTab.waitFor({state: 'visible'});
3635
return true;
3736
} catch {
38-
console.log('Threads tab is not visible');
37+
console.error('Threads tab is not visible');
3938
return false;
4039
}
4140
}
4241

4342
async clickThreadsTab() {
4443
const threadsTab = this.tabs.locator('.g-tab:has-text("Threads")');
45-
console.log('Clicking threads tab');
4644
await threadsTab.click();
4745
}
4846

4947
async getAllTabNames() {
5048
const tabs = await this.tabs.locator('.g-tab').allTextContents();
51-
console.log('Available tabs:', tabs);
5249
return tabs;
5350
}
5451
}

tests/suites/nodes/nodes.test.ts

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,9 @@ test.describe('Test Nodes Paginated Table', async () => {
196196
});
197197

198198
test.describe('Test Node Page Threads Tab', async () => {
199-
test('Threads tab is hidden when node has no thread data', async ({page}) => {
199+
test.only('Threads tab is hidden when node has no thread data', async ({page}) => {
200200
// Mock the node API to return no thread data
201-
await page.route(`${backend}/viewer/json/sysinfo?*`, async (route) => {
202-
const url = route.request().url();
203-
console.log('Intercepted sysinfo request:', url);
204-
201+
await page.route(`**/viewer/json/sysinfo?*`, async (route) => {
205202
await route.fulfill({
206203
status: 200,
207204
contentType: 'application/json',
@@ -210,7 +207,7 @@ test.describe('Test Node Page Threads Tab', async () => {
210207
{
211208
Host: 'localhost',
212209
NodeId: 1,
213-
SystemState: 1, // Green
210+
SystemState: 'Green',
214211
Version: 'test-version',
215212
},
216213
],
@@ -236,10 +233,7 @@ test.describe('Test Node Page Threads Tab', async () => {
236233

237234
test('Threads tab is visible when node has thread data', async ({page}) => {
238235
// Mock the node API to return thread data
239-
await page.route(`${backend}/viewer/json/sysinfo?*`, async (route) => {
240-
const url = route.request().url();
241-
console.log('Intercepted sysinfo request:', url);
242-
236+
await page.route(`**/viewer/json/sysinfo?*`, async (route) => {
243237
await route.fulfill({
244238
status: 200,
245239
contentType: 'application/json',
@@ -248,7 +242,7 @@ test.describe('Test Node Page Threads Tab', async () => {
248242
{
249243
Host: 'localhost',
250244
NodeId: 1,
251-
SystemState: 1, // Green
245+
SystemState: 'Green',
252246
Version: 'test-version',
253247
},
254248
],
@@ -283,10 +277,7 @@ test.describe('Test Node Page Threads Tab', async () => {
283277

284278
test('Threads tab is hidden when node has empty thread array', async ({page}) => {
285279
// Mock the node API to return empty thread data
286-
await page.route(`${backend}/viewer/json/sysinfo?*`, async (route) => {
287-
const url = route.request().url();
288-
console.log('Intercepted sysinfo request:', url);
289-
280+
await page.route(`**/viewer/json/sysinfo?*`, async (route) => {
290281
await route.fulfill({
291282
status: 200,
292283
contentType: 'application/json',
@@ -295,7 +286,7 @@ test.describe('Test Node Page Threads Tab', async () => {
295286
{
296287
Host: 'localhost',
297288
NodeId: 1,
298-
SystemState: 1, // Green
289+
SystemState: 'Green',
299290
Version: 'test-version',
300291
},
301292
],

0 commit comments

Comments
 (0)