Skip to content

Commit

Permalink
refactor(coral): Update copy for topic messages (#1589)
Browse files Browse the repository at this point in the history
* Update copy for topic messages

---------

Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
  • Loading branch information
programmiri authored Aug 9, 2023
1 parent 92f59e0 commit 1c9dca5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ describe("TopicMessages", () => {
queryClient: true,
}
);
screen.getByText("Select offset and Update results.");
screen.getByText(
"To view messages in this topic, select the number of messages you'd like to view and select Fetch messages."
);
});
it("requests and displays all messages when Update results is pressed", async () => {
mockGetTopicMessages.mockResolvedValue(mockGetTopicMessagesResponse);
Expand All @@ -65,7 +67,7 @@ describe("TopicMessages", () => {
);
await userEvent.click(
screen.getByRole("button", {
name: "Consume and display the latest 5 messages from topic test",
name: "Fetch and display the latest 5 messages from topic test",
})
);
await waitFor(() => expect(mockGetTopicMessages).toHaveBeenCalledTimes(1));
Expand Down Expand Up @@ -95,11 +97,11 @@ describe("TopicMessages", () => {
);
await userEvent.click(
screen.getByRole("button", {
name: "Consume and display the latest 5 messages from topic test",
name: "Fetch and display the latest 5 messages from topic test",
})
);
await waitFor(() => {
screen.getByText("This Topic contains no Messages.");
screen.getByText("This Topic contains no messages.");
});
});

Expand Down Expand Up @@ -128,7 +130,7 @@ describe("TopicMessages", () => {
);
await userEvent.click(
screen.getByRole("button", {
name: "Consume and display the latest 25 messages from topic test",
name: "Fetch and display the latest 25 messages from topic test",
})
);
await waitFor(() => {
Expand All @@ -155,7 +157,7 @@ describe("TopicMessages", () => {
await userEvent.click(screen.getByRole("radio", { name: "50" }));
await userEvent.click(
screen.getByRole("button", {
name: "Consume and display the latest 50 messages from topic test",
name: "Fetch and display the latest 50 messages from topic test",
})
);
await waitFor(() => {
Expand Down
11 changes: 6 additions & 5 deletions coral/src/app/features/topics/details/messages/TopicMessages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,15 @@ function TopicMessages() {
function getTableContent() {
if (!consumeResult) {
return (
<EmptyState title="Consume Messages">
Select offset and Update results.
<EmptyState title="No messages displayed">
To view messages in this topic, select the number of messages
you&apos;d like to view and select Fetch messages.
</EmptyState>
);
} else if (isNoContentResult(consumeResult)) {
return (
<EmptyState title="No messages">
This Topic contains no Messages.
This Topic contains no messages.
</EmptyState>
);
} else {
Expand Down Expand Up @@ -110,10 +111,10 @@ function TopicMessages() {
onClick={handleUpdateResultClick}
disabled={isConsuming}
loading={isConsuming}
aria-label={`Consume and display the latest ${offset} messages from topic ${topicName}`}
aria-label={`Fetch and display the latest ${offset} messages from topic ${topicName}`}
icon={refreshIcon}
>
Update results
Fetch messages
</Button.Primary>
</Box.Flex>,
]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe("TopicMessageOffsetFilter", () => {
disabled={true}
/>
);
within(screen.getByRole("group", { name: "Offset" }))
within(screen.getByRole("group", { name: "Number of messages" }))
.getAllByRole("radio")
.forEach((option) => expect(option).toBeDisabled());
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function TopicMessageOffsetFilter({
<RadioButtonGroup
name={"offset"}
value={value}
labelText="Offset"
labelText="Number of messages"
disabled={disabled}
onChange={(value) => onChange(value as Offset)}
>
Expand Down

0 comments on commit 1c9dca5

Please sign in to comment.