File tree Expand file tree Collapse file tree 4 files changed +48
-16
lines changed
pages/browser/components/stream-details/messages-view/MessageClaimPopover Expand file tree Collapse file tree 4 files changed +48
-16
lines changed Original file line number Diff line number Diff line change @@ -137,5 +137,9 @@ export default {
137
137
{ actionName } .
138
138
</ >
139
139
) ,
140
+ } ) ,
141
+ NO_CLAIMED_MESSAGES : ( ) => ( {
142
+ title : 'No messages claimed' ,
143
+ message : 'No messages exceed the minimum idle time.' ,
140
144
} )
141
145
}
Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ import {
13
13
EuiSwitch ,
14
14
EuiText ,
15
15
EuiCheckbox ,
16
- EuiSpacer
16
+ EuiSpacer ,
17
+ EuiToolTip
17
18
} from '@elastic/eui'
18
19
import { useFormik } from 'formik'
19
20
import { orderBy , filter } from 'lodash'
@@ -106,9 +107,35 @@ const MessageClaimPopover = (props: Props) => {
106
107
}
107
108
} , [ consumers , currentConsumerName ] )
108
109
110
+ const button = (
111
+ < EuiButton
112
+ size = "s"
113
+ color = "secondary"
114
+ aria-label = "Claim pending message"
115
+ onClick = { showPopover }
116
+ data-testid = "claim-pending-message"
117
+ className = { styles . claimBtn }
118
+ disabled = { consumers . length < 2 }
119
+ >
120
+ CLAIM
121
+ </ EuiButton >
122
+ )
123
+
124
+ const buttonTooltip = (
125
+ < EuiToolTip
126
+ content = "There is no consumer to claim the message."
127
+ position = "top"
128
+ display = "inlineBlock"
129
+ anchorClassName = "flex-row"
130
+ >
131
+ { button }
132
+ </ EuiToolTip >
133
+ )
134
+
109
135
return (
110
136
< EuiPopover
111
137
key = { id }
138
+ onWheel = { ( e ) => e . stopPropagation ( ) }
112
139
anchorPosition = "leftCenter"
113
140
ownFocus
114
141
isOpen = { isOpen }
@@ -117,18 +144,7 @@ const MessageClaimPopover = (props: Props) => {
117
144
anchorClassName = "claimPendingMessage"
118
145
panelClassName = { styles . popoverWrapper }
119
146
closePopover = { ( ) => { } }
120
- button = { (
121
- < EuiButton
122
- size = "s"
123
- color = "secondary"
124
- aria-label = "Claim pending message"
125
- onClick = { showPopover }
126
- data-testid = "claim-pending-message"
127
- className = { styles . claimBtn }
128
- >
129
- CLAIM
130
- </ EuiButton >
131
- ) }
147
+ button = { consumers . length < 2 ? buttonTooltip : button }
132
148
>
133
149
< EuiForm >
134
150
< EuiFlexGroup >
Original file line number Diff line number Diff line change 64
64
font : normal normal normal 13px / 24px Graphik;
65
65
letter-spacing : -0.13px ;
66
66
color : var (--inputPlaceholderColor ) !important ;
67
+ white-space : nowrap ;
67
68
}
68
69
69
70
.consumerOption :global(.euiContextMenu__itemLayout ) .pendingCount {
119
120
.popoverWrapper .container .grow {
120
121
flex-grow : 2 ;
121
122
}
123
+
124
+ .consumerName {
125
+ overflow : hidden ;
126
+ text-overflow : ellipsis ;
127
+ }
Original file line number Diff line number Diff line change @@ -959,9 +959,15 @@ export function claimPendingMessages(
959
959
dispatch ( claimConsumerMessagesSuccess ( ) )
960
960
dispatch < any > ( fetchConsumerMessages ( ) )
961
961
dispatch < any > ( fetchConsumers ( ) )
962
- dispatch ( addMessageNotification (
963
- successMessages . MESSAGE_ACTION ( data . affected [ 0 ] , 'claimed' )
964
- ) )
962
+ if ( data . affected . length ) {
963
+ dispatch ( addMessageNotification (
964
+ successMessages . MESSAGE_ACTION ( data . affected [ 0 ] , 'claimed' )
965
+ ) )
966
+ } else {
967
+ dispatch ( addMessageNotification (
968
+ successMessages . NO_CLAIMED_MESSAGES ( )
969
+ ) )
970
+ }
965
971
onSuccess ?.( data )
966
972
}
967
973
} catch ( _err ) {
You can’t perform that action at this time.
0 commit comments