Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,9 @@ export default {
{actionName}.
</>
),
}),
NO_CLAIMED_MESSAGES: () => ({
title: 'No messages claimed',
message: 'No messages exceed the minimum idle time.',
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import {
EuiSwitch,
EuiText,
EuiCheckbox,
EuiSpacer
EuiSpacer,
EuiToolTip
} from '@elastic/eui'
import { useFormik } from 'formik'
import { orderBy, filter } from 'lodash'
Expand Down Expand Up @@ -106,9 +107,35 @@ const MessageClaimPopover = (props: Props) => {
}
}, [consumers, currentConsumerName])

const button = (
<EuiButton
size="s"
color="secondary"
aria-label="Claim pending message"
onClick={showPopover}
data-testid="claim-pending-message"
className={styles.claimBtn}
disabled={consumers.length < 2}
>
CLAIM
</EuiButton>
)

const buttonTooltip = (
<EuiToolTip
content="There is no consumer to claim the message."
position="top"
display="inlineBlock"
anchorClassName="flex-row"
>
{button}
</EuiToolTip>
)

return (
<EuiPopover
key={id}
onWheel={(e) => e.stopPropagation()}
anchorPosition="leftCenter"
ownFocus
isOpen={isOpen}
Expand All @@ -117,18 +144,7 @@ const MessageClaimPopover = (props: Props) => {
anchorClassName="claimPendingMessage"
panelClassName={styles.popoverWrapper}
closePopover={() => {}}
button={(
<EuiButton
size="s"
color="secondary"
aria-label="Claim pending message"
onClick={showPopover}
data-testid="claim-pending-message"
className={styles.claimBtn}
>
CLAIM
</EuiButton>
)}
button={consumers.length < 2 ? buttonTooltip : button}
>
<EuiForm>
<EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
font: normal normal normal 13px/24px Graphik;
letter-spacing: -0.13px;
color: var(--inputPlaceholderColor) !important;
white-space: nowrap;
}

.consumerOption :global(.euiContextMenu__itemLayout) .pendingCount {
Expand Down Expand Up @@ -119,3 +120,8 @@
.popoverWrapper .container .grow {
flex-grow: 2;
}

.consumerName {
overflow: hidden;
text-overflow: ellipsis;
}
12 changes: 9 additions & 3 deletions redisinsight/ui/src/slices/browser/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -959,9 +959,15 @@ export function claimPendingMessages(
dispatch(claimConsumerMessagesSuccess())
dispatch<any>(fetchConsumerMessages())
dispatch<any>(fetchConsumers())
dispatch(addMessageNotification(
successMessages.MESSAGE_ACTION(data.affected[0], 'claimed')
))
if (data.affected.length) {
dispatch(addMessageNotification(
successMessages.MESSAGE_ACTION(data.affected[0], 'claimed')
))
} else {
dispatch(addMessageNotification(
successMessages.NO_CLAIMED_MESSAGES()
))
}
onSuccess?.(data)
}
} catch (_err) {
Expand Down