Skip to content

Commit 07250c0

Browse files
committed
#RI-2964 - send count as maxLen from config for slow log cloud db
#RI-2969 - fix key details closing
1 parent 32ec2d1 commit 07250c0

File tree

5 files changed

+29
-12
lines changed

5 files changed

+29
-12
lines changed

redisinsight/ui/src/pages/browser/components/key-details/KeyDetailsWrapper.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ const KeyDetailsWrapper = (props: Props) => {
110110
}
111111

112112
const handleClosePanel = () => {
113-
dispatch(toggleBrowserFullScreen())
113+
dispatch(toggleBrowserFullScreen(true))
114+
keyProp && onCloseKey()
114115
}
115116

116117
return (

redisinsight/ui/src/pages/slowLog/SlowLogPage.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ import { useParams } from 'react-router-dom'
1414
import { AutoSizer } from 'react-virtualized'
1515

1616
import InstanceHeader from 'uiSrc/components/instance-header'
17+
import { DEFAULT_SLOWLOG_MAX_LEN } from 'uiSrc/constants'
1718
import { DATE_FORMAT } from 'uiSrc/pages/slowLog/components/SlowLogTable/SlowLogTable'
1819
import { convertNumberByUnits } from 'uiSrc/pages/slowLog/utils'
1920
import { connectedInstanceSelector } from 'uiSrc/slices/instances/instances'
20-
import { ConnectionType } from 'uiSrc/slices/interfaces'
21+
import { ConnectionProvider, ConnectionType } from 'uiSrc/slices/interfaces'
2122
import {
2223
clearSlowLogAction,
2324
fetchSlowLogsAction,
@@ -35,18 +36,19 @@ import styles from './styles.module.scss'
3536

3637
const HIDE_TIMESTAMP_FROM_WIDTH = 850
3738
const DEFAULT_COUNT_VALUE = '50'
39+
const MAX_COUNT_VALUE = '-1'
3840
const countOptions: EuiSuperSelectOption<string>[] = [
3941
{ value: '10', inputDisplay: '10' },
4042
{ value: '25', inputDisplay: '25' },
4143
{ value: '50', inputDisplay: '50' },
4244
{ value: '100', inputDisplay: '100' },
43-
{ value: '-1', inputDisplay: 'Max available' },
45+
{ value: MAX_COUNT_VALUE, inputDisplay: 'Max available' },
4446
]
4547

4648
const SlowLogPage = () => {
47-
const { connectionType } = useSelector(connectedInstanceSelector)
49+
const { connectionType, provider } = useSelector(connectedInstanceSelector)
4850
const { data, loading, durationUnit, config } = useSelector(slowLogSelector)
49-
const { slowlogLogSlowerThan = 0 } = useSelector(slowLogConfigSelector)
51+
const { slowlogLogSlowerThan = 0, slowlogMaxLen } = useSelector(slowLogConfigSelector)
5052
const { instanceId } = useParams<{ instanceId: string }>()
5153

5254
const [count, setCount] = useState<string>(DEFAULT_COUNT_VALUE)
@@ -63,9 +65,13 @@ const SlowLogPage = () => {
6365
getSlowLogs()
6466
}, [count])
6567

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+
6773
dispatch(
68-
fetchSlowLogsAction(instanceId, toNumber(count), (data: SlowLog[]) => {
74+
fetchSlowLogsAction(instanceId, countToSend, (data: SlowLog[]) => {
6975
sendEventTelemetry({
7076
event: TelemetryEvent.SLOWLOG_LOADED,
7177
eventData: {
@@ -111,7 +117,7 @@ const SlowLogPage = () => {
111117
Execution time: {numberWithSpaces(convertNumberByUnits(slowlogLogSlowerThan, durationUnit))}
112118
&nbsp;
113119
{durationUnit},
114-
Max length: {numberWithSpaces(config.slowlogMaxLen)}
120+
Max length: {numberWithSpaces(slowlogMaxLen)}
115121
</EuiText>
116122
)}
117123
</EuiFlexItem>

redisinsight/ui/src/pages/slowLog/components/Actions/Actions.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export interface Props {
2727
isEmptySlowLog: boolean
2828
durationUnit: Nullable<DurationUnits>
2929
onClear: () => void
30-
onRefresh: () => void
30+
onRefresh: (maxLen?: number) => void
3131
}
3232

3333
const HIDE_REFRESH_LABEL_WIDTH = 850
@@ -126,7 +126,7 @@ const Actions = (props: Props) => {
126126
displayText={width > HIDE_REFRESH_LABEL_WIDTH}
127127
lastRefreshTime={lastRefreshTime}
128128
containerClassName={styles.refreshContainer}
129-
onRefresh={onRefresh}
129+
onRefresh={() => onRefresh()}
130130
onEnableAutoRefresh={handleEnableAutoRefresh}
131131
onChangeAutoRefreshRate={handleChangeAutoRefreshRate}
132132
testid="refresh-slowlog-btn"

redisinsight/ui/src/pages/slowLog/components/SlowLogConfig/SlowLogConfig.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import styles from './styles.module.scss'
3333

3434
export interface Props {
3535
closePopover: () => void
36-
onRefresh: () => void
36+
onRefresh: (maxLen?: number) => void
3737
}
3838

3939
const SlowLogConfig = ({ closePopover, onRefresh }: Props) => {
@@ -98,7 +98,7 @@ const SlowLogConfig = ({ closePopover, onRefresh }: Props) => {
9898
const onSuccess = () => {
9999
setDBConfigStorageField(instanceId, ConfigDBStorageItem.slowLogDurationUnit, durationUnit)
100100

101-
onRefresh()
101+
onRefresh(maxLen ? toNumber(maxLen) : DEFAULT_SLOWLOG_MAX_LEN)
102102
closePopover()
103103
}
104104

redisinsight/ui/src/slices/interfaces/instances.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ export enum ConnectionType {
4545
Sentinel = 'SENTINEL',
4646
}
4747

48+
export enum ConnectionProvider {
49+
UNKNOWN = 'UNKNOWN',
50+
LOCALHOST = 'LOCALHOST',
51+
RE_CLUSTER = 'RE_CLUSTER',
52+
RE_CLOUD = 'RE_CLOUD',
53+
AZURE = 'AZURE',
54+
AWS = 'AWS',
55+
GOOGLE = 'GOOGLE',
56+
}
57+
4858
export const CONNECTION_TYPE_DISPLAY = Object.freeze({
4959
[ConnectionType.Standalone]: 'Standalone',
5060
[ConnectionType.Cluster]: 'OSS Cluster',

0 commit comments

Comments
 (0)