File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed
pages/browser/components/stream-details/messages-view/MessageClaimPopover Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ const getConsumersOptions = (consumers: ConsumerDto[]) => (
40
40
} ) )
41
41
)
42
42
43
- const timeOptions : EuiSuperSelectOption < string > [ ] = [
43
+ const timeOptions : EuiSuperSelectOption < ClaimTimeOptions > [ ] = [
44
44
{ value : ClaimTimeOptions . RELATIVE , inputDisplay : 'Relative Time' } ,
45
45
{ value : ClaimTimeOptions . ABSOLUTE , inputDisplay : 'Timestamp' } ,
46
46
]
@@ -95,6 +95,18 @@ const MessageClaimPopover = (props: Props) => {
95
95
formik . resetForm ( )
96
96
}
97
97
98
+ const handleChangeTimeFormat = ( value : ClaimTimeOptions ) => {
99
+ formik . setFieldValue ( 'timeOption' , value )
100
+ if ( value === ClaimTimeOptions . ABSOLUTE ) {
101
+ formik . setFieldValue (
102
+ 'timeCount' ,
103
+ new Date ( ) . getTime ( )
104
+ )
105
+ } else {
106
+ formik . setFieldValue ( 'timeCount' , '0' )
107
+ }
108
+ }
109
+
98
110
useEffect ( ( ) => {
99
111
const consumersWithoutCurrent = filter ( consumers , ( consumer ) => consumer . name !== currentConsumerName )
100
112
const sortedConsumers = orderBy ( getConsumersOptions ( consumersWithoutCurrent ) , [ 'name' ] , [ 'asc' ] )
@@ -219,7 +231,7 @@ const MessageClaimPopover = (props: Props) => {
219
231
options = { timeOptions }
220
232
className = { styles . timeOptionField }
221
233
name = "consumerName"
222
- onChange = { ( value ) => formik . setFieldValue ( 'timeOption' , value ) }
234
+ onChange = { handleChangeTimeFormat }
223
235
data-testid = "time-option-select"
224
236
/>
225
237
</ EuiFormRow >
Original file line number Diff line number Diff line change @@ -1014,7 +1014,6 @@ export function ackPendingEntriesAction(
1014
1014
onSuccessAction ?.( )
1015
1015
dispatch ( ackPendingEntriesSuccess ( ) )
1016
1016
dispatch ( deleteMessageFromList ( entries [ 0 ] ) )
1017
- dispatch < any > ( fetchConsumers ( ) )
1018
1017
dispatch ( addMessageNotification (
1019
1018
successMessages . MESSAGE_ACTION ( entries [ 0 ] , 'acknowledged' )
1020
1019
) )
Original file line number Diff line number Diff line change @@ -1404,7 +1404,6 @@ describe('stream slice', () => {
1404
1404
const entries = [ '0-1' ]
1405
1405
const responsePayload = { status : 200 }
1406
1406
1407
- apiService . post = jest . fn ( ) . mockResolvedValue ( responsePayload )
1408
1407
apiService . post = jest . fn ( ) . mockResolvedValue ( responsePayload )
1409
1408
1410
1409
// Act
@@ -1415,7 +1414,6 @@ describe('stream slice', () => {
1415
1414
ackPendingEntries ( ) ,
1416
1415
ackPendingEntriesSuccess ( ) ,
1417
1416
deleteMessageFromList ( '0-1' ) ,
1418
- loadConsumerGroups ( ) ,
1419
1417
addMessageNotification (
1420
1418
successMessages . MESSAGE_ACTION (
1421
1419
entries . join ( '' ) ,
You can’t perform that action at this time.
0 commit comments