@@ -14,10 +14,11 @@ import { useParams } from 'react-router-dom'
14
14
import { AutoSizer } from 'react-virtualized'
15
15
16
16
import InstanceHeader from 'uiSrc/components/instance-header'
17
+ import { DEFAULT_SLOWLOG_MAX_LEN } from 'uiSrc/constants'
17
18
import { DATE_FORMAT } from 'uiSrc/pages/slowLog/components/SlowLogTable/SlowLogTable'
18
19
import { convertNumberByUnits } from 'uiSrc/pages/slowLog/utils'
19
20
import { connectedInstanceSelector } from 'uiSrc/slices/instances/instances'
20
- import { ConnectionType } from 'uiSrc/slices/interfaces'
21
+ import { ConnectionProvider , ConnectionType } from 'uiSrc/slices/interfaces'
21
22
import {
22
23
clearSlowLogAction ,
23
24
fetchSlowLogsAction ,
@@ -35,18 +36,19 @@ import styles from './styles.module.scss'
35
36
36
37
const HIDE_TIMESTAMP_FROM_WIDTH = 850
37
38
const DEFAULT_COUNT_VALUE = '50'
39
+ const MAX_COUNT_VALUE = '-1'
38
40
const countOptions : EuiSuperSelectOption < string > [ ] = [
39
41
{ value : '10' , inputDisplay : '10' } ,
40
42
{ value : '25' , inputDisplay : '25' } ,
41
43
{ value : '50' , inputDisplay : '50' } ,
42
44
{ value : '100' , inputDisplay : '100' } ,
43
- { value : '-1' , inputDisplay : 'Max available' } ,
45
+ { value : MAX_COUNT_VALUE , inputDisplay : 'Max available' } ,
44
46
]
45
47
46
48
const SlowLogPage = ( ) => {
47
- const { connectionType } = useSelector ( connectedInstanceSelector )
49
+ const { connectionType, provider } = useSelector ( connectedInstanceSelector )
48
50
const { data, loading, durationUnit, config } = useSelector ( slowLogSelector )
49
- const { slowlogLogSlowerThan = 0 } = useSelector ( slowLogConfigSelector )
51
+ const { slowlogLogSlowerThan = 0 , slowlogMaxLen } = useSelector ( slowLogConfigSelector )
50
52
const { instanceId } = useParams < { instanceId : string } > ( )
51
53
52
54
const [ count , setCount ] = useState < string > ( DEFAULT_COUNT_VALUE )
@@ -63,9 +65,13 @@ const SlowLogPage = () => {
63
65
getSlowLogs ( )
64
66
} , [ count ] )
65
67
66
- const getSlowLogs = ( ) => {
68
+ const getSlowLogs = ( maxLen ?: number ) => {
69
+ const countToSend = ( provider === ConnectionProvider . RE_CLOUD && count === MAX_COUNT_VALUE )
70
+ ? ( maxLen || slowlogMaxLen || DEFAULT_SLOWLOG_MAX_LEN )
71
+ : toNumber ( count )
72
+
67
73
dispatch (
68
- fetchSlowLogsAction ( instanceId , toNumber ( count ) , ( data : SlowLog [ ] ) => {
74
+ fetchSlowLogsAction ( instanceId , countToSend , ( data : SlowLog [ ] ) => {
69
75
sendEventTelemetry ( {
70
76
event : TelemetryEvent . SLOWLOG_LOADED ,
71
77
eventData : {
@@ -111,7 +117,7 @@ const SlowLogPage = () => {
111
117
Execution time: { numberWithSpaces ( convertNumberByUnits ( slowlogLogSlowerThan , durationUnit ) ) }
112
118
113
119
{ durationUnit } ,
114
- Max length: { numberWithSpaces ( config . slowlogMaxLen ) }
120
+ Max length: { numberWithSpaces ( slowlogMaxLen ) }
115
121
</ EuiText >
116
122
) }
117
123
</ EuiFlexItem >
0 commit comments