File tree Expand file tree Collapse file tree 4 files changed +20
-6
lines changed
redisinsight/ui/src/components Expand file tree Collapse file tree 4 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,11 @@ const KeysSummary = (props: Props) => {
35
35
36
36
const resultsLength = items . length
37
37
const scannedDisplay = resultsLength > scanned ? resultsLength : scanned
38
+ const notAccurateScanned = totalItemsCount
39
+ && scanned >= totalItemsCount
40
+ && nextCursor
41
+ && nextCursor !== '0'
42
+ ? '~' : ''
38
43
39
44
return (
40
45
< >
@@ -51,7 +56,7 @@ const KeysSummary = (props: Props) => {
51
56
</ b >
52
57
< EuiTextColor color = "subdued" >
53
58
{ 'Scanned ' }
54
- < span data-testid = "keys-number-of-scanned" > { numberWithSpaces ( scannedDisplay ) } </ span >
59
+ < span data-testid = "keys-number-of-scanned" > { notAccurateScanned } { numberWithSpaces ( scannedDisplay ) } </ span >
55
60
{ ' / ' }
56
61
< span data-testid = "keys-total" > { nullableNumberWithSpaces ( totalItemsCount ) } </ span >
57
62
< span
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ describe('ScanMore', () => {
14
14
const handleClick = jest . fn ( )
15
15
16
16
const renderer = render (
17
- < ScanMore { ...instance ( mockedProps ) } loadMoreItems = { handleClick } totalItemsCount = { 1 } />
17
+ < ScanMore { ...instance ( mockedProps ) } loadMoreItems = { handleClick } scanned = { 1 } totalItemsCount = { 2 } />
18
18
)
19
19
20
20
expect ( renderer ) . toBeTruthy ( )
@@ -23,9 +23,17 @@ describe('ScanMore', () => {
23
23
expect ( handleClick ) . toHaveBeenCalledTimes ( 1 )
24
24
} )
25
25
26
- it ( 'should button be hidden when totalItemsCount < scanned ' , ( ) => {
26
+ it ( 'should show button when totalItemsCount < scanned and nextCursor is not zero ' , ( ) => {
27
27
const { queryByTestId } = render (
28
- < ScanMore { ...instance ( mockedProps ) } scanned = { 2 } totalItemsCount = { 1 } />
28
+ < ScanMore { ...instance ( mockedProps ) } scanned = { 2 } totalItemsCount = { 1 } nextCursor = "123" />
29
+ )
30
+
31
+ expect ( queryByTestId ( 'scan-more' ) ) . toBeInTheDocument ( )
32
+ } )
33
+
34
+ it ( 'should hide button when totalItemsCount < scanned and nextCursor is zero' , ( ) => {
35
+ const { queryByTestId } = render (
36
+ < ScanMore { ...instance ( mockedProps ) } scanned = { 2 } totalItemsCount = { 1 } nextCursor = "0" />
29
37
)
30
38
31
39
expect ( queryByTestId ( 'scan-more' ) ) . not . toBeInTheDocument ( )
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ const ScanMore = ({
31
31
nextCursor,
32
32
} : Props ) => (
33
33
< >
34
- { ( ( scanned < totalItemsCount || isNull ( totalItemsCount ) ) )
34
+ { ( ( scanned || isNull ( totalItemsCount ) ) )
35
35
&& nextCursor !== '0'
36
36
&& (
37
37
< EuiButton
Original file line number Diff line number Diff line change @@ -161,7 +161,8 @@ describe('VirtualTable', () => {
161
161
162
162
expect ( scanMoreBtn ) . toBeInTheDocument ( )
163
163
} )
164
- it ( 'Scan more button should no be in the document when total == scanned' , ( ) => {
164
+ // obsolete test. todo: review and remove or refactor
165
+ xit ( 'Scan more button should no be in the document when total == scanned' , ( ) => {
165
166
const { queryByTestId } = render (
166
167
< VirtualTable
167
168
{ ...instance ( mockedProps ) }
You can’t perform that action at this time.
0 commit comments