Skip to content

Commit 4481424

Browse files
#RI-3013,3014 - scroll, update success messages (#736)
* #RI-3013,3014 - scroll, update success messages
1 parent b6046df commit 4481424

File tree

4 files changed

+48
-16
lines changed

4 files changed

+48
-16
lines changed

redisinsight/ui/src/components/notifications/success-messages.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,5 +137,9 @@ export default {
137137
{actionName}.
138138
</>
139139
),
140+
}),
141+
NO_CLAIMED_MESSAGES: () => ({
142+
title: 'No messages claimed',
143+
message: 'No messages exceed the minimum idle time.',
140144
})
141145
}

redisinsight/ui/src/pages/browser/components/stream-details/messages-view/MessageClaimPopover/MessageClaimPopover.tsx

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import {
1313
EuiSwitch,
1414
EuiText,
1515
EuiCheckbox,
16-
EuiSpacer
16+
EuiSpacer,
17+
EuiToolTip
1718
} from '@elastic/eui'
1819
import { useFormik } from 'formik'
1920
import { orderBy, filter } from 'lodash'
@@ -106,9 +107,35 @@ const MessageClaimPopover = (props: Props) => {
106107
}
107108
}, [consumers, currentConsumerName])
108109

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+
109135
return (
110136
<EuiPopover
111137
key={id}
138+
onWheel={(e) => e.stopPropagation()}
112139
anchorPosition="leftCenter"
113140
ownFocus
114141
isOpen={isOpen}
@@ -117,18 +144,7 @@ const MessageClaimPopover = (props: Props) => {
117144
anchorClassName="claimPendingMessage"
118145
panelClassName={styles.popoverWrapper}
119146
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}
132148
>
133149
<EuiForm>
134150
<EuiFlexGroup>

redisinsight/ui/src/pages/browser/components/stream-details/messages-view/MessageClaimPopover/styles.module.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
font: normal normal normal 13px/24px Graphik;
6565
letter-spacing: -0.13px;
6666
color: var(--inputPlaceholderColor) !important;
67+
white-space: nowrap;
6768
}
6869

6970
.consumerOption :global(.euiContextMenu__itemLayout) .pendingCount {
@@ -119,3 +120,8 @@
119120
.popoverWrapper .container .grow {
120121
flex-grow: 2;
121122
}
123+
124+
.consumerName {
125+
overflow: hidden;
126+
text-overflow: ellipsis;
127+
}

redisinsight/ui/src/slices/browser/stream.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -959,9 +959,15 @@ export function claimPendingMessages(
959959
dispatch(claimConsumerMessagesSuccess())
960960
dispatch<any>(fetchConsumerMessages())
961961
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+
}
965971
onSuccess?.(data)
966972
}
967973
} catch (_err) {

0 commit comments

Comments
 (0)