Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
86301a4
RI-6336 - Allow to hide/show columns in Browser - basic functional im…
Jan 10, 2025
5e117aa
RI-6336 - Allow to hide/show columns in Browser - added tooltip
Jan 10, 2025
065d2fe
RI-6336 - Allow to hide/show columns in Browser - added column hiding…
Jan 10, 2025
e3cfa90
RI-6336 - Allow to hide/show columns in Browser - added column hiding…
Jan 10, 2025
6185cf3
RI-6336 - Allow to hide/show columns in Browser - refetching of metad…
Jan 10, 2025
f1e6999
RI-6336 - Allow to hide/show columns in Browser - refetching of metad…
Jan 10, 2025
c666dc3
RI-6336 - Allow to hide/show columns in Browser - refetching of metad…
Jan 10, 2025
3170048
RI-6336 - Allow to hide/show columns in Browser - telemetry data
Jan 10, 2025
ce834c9
RI-6336 - Allow to hide/show columns in Browser - limit for list type
KIvanow Jan 10, 2025
df6c074
RI-6336 - Allow to hide/show columns in Browser - limit for the hash …
KIvanow Jan 10, 2025
db8495b
RI-6336 - Allow to hide/show columns in Browser - limit for the set type
KIvanow Jan 10, 2025
2c4f7e3
RI-6336 - Allow to hide/show columns in Browser - limit for the sorte…
KIvanow Jan 10, 2025
c7e7779
RI-6336 - Allow to hide/show columns in Browser - limit for the strea…
KIvanow Jan 10, 2025
b3694f3
RI-6336 - Allow to hide/show columns in Browser - limit for the json …
KIvanow Jan 10, 2025
0af07e5
RI-6336 - Allow to hide/show columns in Browser - limit handling in t…
KIvanow Jan 10, 2025
1ff4ed2
RI-6336 converted to an array of columns for better scalability later on
Jan 13, 2025
1f3eeb4
Merge branch 'feature/RI-6336-allow-to-hide-show-columns-in-browser' …
Jan 13, 2025
1ba8a91
RI-6336 - columns updated
KIvanow Jan 13, 2025
2a6f46a
Merge branch 'main' of https://github.com/RedisInsight/RedisInsight i…
KIvanow Jan 13, 2025
093dae2
RI-6336 - Allow to hide/show columns in Browser - unit tests pt1
KIvanow Jan 14, 2025
ea6675d
RI-6336 - Allow to hide/show columns in Browser - unit tests pt2
Jan 14, 2025
82296c2
RI-6336 - Allow to hide/show columns in Browser - tests for the API
Jan 14, 2025
9de9493
RI-6336 - RI-6336 - Allow to hide/show columns in Browser - cleanup
Jan 14, 2025
d017611
RI-6336 - Allow to hide/show columns in Browser - updating tests bas…
KIvanow Jan 16, 2025
8aafa09
Merge branch 'feature/RI-6336-allow-to-hide-show-columns-in-browser' …
KIvanow Jan 16, 2025
f47cbe8
RI-6336 - Allow to hide/show columns in Browser - unit tests updated …
KIvanow Jan 16, 2025
1ae38bf
RI-6336 - Allow to hide/show columns in Browser - unit tests updated …
KIvanow Jan 17, 2025
680c46a
Merge branch 'main' of https://github.com/RedisInsight/RedisInsight i…
KIvanow Jan 17, 2025
08ec2c1
Merge branch 'main' of https://github.com/RedisInsight/RedisInsight i…
KIvanow Jan 17, 2025
6382708
RI-6336 - Allow to hide/show columns in Browser - unit tests fixed a …
KIvanow Jan 17, 2025
e9f47cd
RI-6336 - Allow to hide/show columns in Browser - unit tests fixed in…
KIvanow Jan 17, 2025
f8e3e25
RI-6336 - Allow to hide/show columns in Browser - unit tests fixed in…
KIvanow Jan 17, 2025
3be0367
RI-6336 - Allow to hide/show columns in Browser - removed unused file
KIvanow Jan 17, 2025
d153c98
RI-6629 - TTL and Size are not showing
KIvanow Jan 20, 2025
5101978
RI-6630 - Columns icon is not visible for light theme
KIvanow Jan 20, 2025
11b311f
RI-6631 - There is no info icon next to size to get tooltip
KIvanow Jan 20, 2025
5da9333
RI-6631 - There is no info icon next to size to get tooltip
KIvanow Jan 20, 2025
01e8c40
RI-6634 - Inconsistent behavior in displaying size
KIvanow Jan 20, 2025
df59ba7
RI-6336 - removed poluted object for testing
KIvanow Jan 20, 2025
e1f16e4
RI-6336 - removed poluted object for testing
KIvanow Jan 20, 2025
75c7007
RI-6336 - removed poluted object for testing
KIvanow Jan 20, 2025
1618b04
RI-6336 - removed poluted object for testing
KIvanow Jan 20, 2025
a8c439d
RI-6336 - removed poluted object for testing + fixed unit tests
KIvanow Jan 20, 2025
92718d5
RI-6336 - added cluster strategy implementation. Fixed integration tests
KIvanow Jan 21, 2025
f52fdf6
RI-6336 - added cluster strategy implementation. Fixed integration tests
KIvanow Jan 21, 2025
517c9d0
RI-6336 - updated unit tests to match new pattern
KIvanow Jan 21, 2025
f740a06
RI-6638 - No trash icon to remove key if key size column is hidden. A…
KIvanow Jan 21, 2025
6a3f380
RI-6336 - WIP - moving to per DB config
KIvanow Jan 22, 2025
98aebb8
add test for RI-6336
mariasergeenko Jan 22, 2025
ae373d8
RI-6336 - simplified approach for per db setting
Jan 22, 2025
305af80
remove only
mariasergeenko Jan 22, 2025
e3f1735
RI-6336 updated unit tests
Jan 22, 2025
8f5a315
RI-6336 update naming based on feedback from the PR
Jan 22, 2025
13bf38e
RI-6336 - removed unused mocked variables
Jan 22, 2025
48c9ac6
RI-6336 added recommendation from the PR
Jan 22, 2025
3548135
Merge pull request #4299 from RedisInsight/e2e/feature/RI-6336-allow-…
mariasergeenko Jan 22, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ import { IsRedisString, RedisStringType } from 'src/common/decorators';
import { RedisString } from 'src/common/constants';
import { KeyDto, RedisDataType } from './key.dto';

export class GetKeyInfoDto extends KeyDto {}
export class GetKeyInfoDto extends KeyDto {
@ApiPropertyOptional({
description: 'Flag to determine if size should be requested and shown in the response',
type: Boolean,
default: false,
})
@IsOptional()
includeSize?: boolean;
}

export class GetKeysInfoDto {
@ApiProperty({
Expand All @@ -31,4 +39,20 @@ export class GetKeysInfoDto {
})
@IsOptional()
type?: RedisDataType;
}

@ApiPropertyOptional({
description: 'Flag to determine if keys should be requested and shown in the response',
type: Boolean,
default: true,
})
@IsOptional()
includeSize?: boolean;

@ApiPropertyOptional({
description: 'Flag to determine if TTL should be requested and shown in the response',
type: Boolean,
default: true,
})
@IsOptional()
includeTTL?: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,52 +34,120 @@ describe('HashKeyInfoStrategy', () => {

describe('getInfo', () => {
const key = getKeyInfoResponse.name;
it('should return appropriate value', async () => {
when(mockStandaloneRedisClient.sendPipeline)
.calledWith([
[BrowserToolKeysCommands.Ttl, key],
[BrowserToolKeysCommands.MemoryUsage, key, 'samples', '0'],
[BrowserToolHashCommands.HLen, key],
])
.mockResolvedValue([
[null, -1],
[null, 50],
[null, 10],
]);

const result = await strategy.getInfo(
mockStandaloneRedisClient,
key,
RedisDataType.Hash,
);

expect(result).toEqual(getKeyInfoResponse);

describe('when includeSize is true', () => {
it('should return all info in single pipeline', async () => {
when(mockStandaloneRedisClient.sendPipeline)
.calledWith([
[BrowserToolKeysCommands.Ttl, key],
[BrowserToolHashCommands.HLen, key],
[BrowserToolKeysCommands.MemoryUsage, key, 'samples', '0'],
])
.mockResolvedValueOnce([
[null, -1],
[null, 10],
[null, 50],
]);

const result = await strategy.getInfo(
mockStandaloneRedisClient,
key,
RedisDataType.Hash,
true,
);

expect(result).toEqual(getKeyInfoResponse);
});
});
it('should return size with null value', async () => {
const replyError: ReplyError = {
name: 'ReplyError',
command: BrowserToolKeysCommands.MemoryUsage,
message: "ERR unknown command 'memory'",
};
when(mockStandaloneRedisClient.sendPipeline)
.calledWith([
[BrowserToolKeysCommands.Ttl, key],
[BrowserToolKeysCommands.MemoryUsage, key, 'samples', '0'],
[BrowserToolHashCommands.HLen, key],
])
.mockResolvedValue([
[null, -1],
[replyError, null],
[null, 10],
]);

const result = await strategy.getInfo(
mockStandaloneRedisClient,
key,
RedisDataType.Hash,
);

expect(result).toEqual({ ...getKeyInfoResponse, size: null });

describe('when includeSize is false', () => {
it('should return appropriate value', async () => {
when(mockStandaloneRedisClient.sendPipeline)
.calledWith([
[BrowserToolKeysCommands.Ttl, key],
[BrowserToolHashCommands.HLen, key],
])
.mockResolvedValueOnce([
[null, -1],
[null, 10],
]);

when(mockStandaloneRedisClient.sendPipeline)
.calledWith([
[BrowserToolKeysCommands.MemoryUsage, key, 'samples', '0'],
])
.mockResolvedValueOnce([
[null, 50],
]);

const result = await strategy.getInfo(
mockStandaloneRedisClient,
key,
RedisDataType.Hash,
false,
);

expect(result).toEqual(getKeyInfoResponse);
});

it('should return size with null value when memory usage fails', async () => {
const replyError: ReplyError = {
name: 'ReplyError',
command: BrowserToolKeysCommands.MemoryUsage,
message: "ERR unknown command 'memory'",
};
when(mockStandaloneRedisClient.sendPipeline)
.calledWith([
[BrowserToolKeysCommands.Ttl, key],
[BrowserToolHashCommands.HLen, key],
])
.mockResolvedValueOnce([
[null, -1],
[null, 10],
]);

when(mockStandaloneRedisClient.sendPipeline)
.calledWith([
[BrowserToolKeysCommands.MemoryUsage, key, 'samples', '0'],
])
.mockResolvedValueOnce([
[replyError, null],
]);

const result = await strategy.getInfo(
mockStandaloneRedisClient,
key,
RedisDataType.Hash,
false,
);

expect(result).toEqual({ ...getKeyInfoResponse, size: null });
});

it('should not check size when length >= 50,000', async () => {
when(mockStandaloneRedisClient.sendPipeline)
.calledWith([
[BrowserToolKeysCommands.Ttl, key],
[BrowserToolHashCommands.HLen, key],
])
.mockResolvedValueOnce([
[null, -1],
[null, 50000],
]);

const result = await strategy.getInfo(
mockStandaloneRedisClient,
key,
RedisDataType.Hash,
false,
);

expect(result).toEqual({
...getKeyInfoResponse,
length: 50000,
size: -1
});
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,53 @@ export class HashKeyInfoStrategy extends KeyInfoStrategy {
client: RedisClient,
key: RedisString,
type: string,
includeSize: boolean,
): Promise<GetKeyInfoResponse> {
this.logger.debug(`Getting ${RedisDataType.Hash} type info.`);

if (includeSize !== false) {
const [
[, ttl = null],
[, length = null],
[, size = null],
] = await client.sendPipeline([
[BrowserToolKeysCommands.Ttl, key],
[BrowserToolHashCommands.HLen, key],
[BrowserToolKeysCommands.MemoryUsage, key, 'samples', '0'],
]) as [any, number][];

return {
name: key,
type,
ttl,
size,
length,
};
}

const [
[, ttl = null],
[, size = null],
[, length = null],
] = await client.sendPipeline([
[BrowserToolKeysCommands.Ttl, key],
[BrowserToolKeysCommands.MemoryUsage, key, 'samples', '0'],
[BrowserToolHashCommands.HLen, key],
]) as [any, number][];

let size = -1;
if (length < 50_000) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add some context for 50_000

const sizeData = await client.sendPipeline([
[BrowserToolKeysCommands.MemoryUsage, key, 'samples', '0'],
]) as [any, number][];
size = sizeData && sizeData[0] && sizeData[0][1];
}

return {
name: key,
type,
ttl,
size,
length,
};

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ export abstract class KeyInfoStrategy {
client: RedisClient,
key: RedisString,
type: string,
includeSize: boolean,
): Promise<GetKeyInfoResponse>;
}
Loading
Loading