Skip to content

Commit

Permalink
Use the environment Id from the topicDetails (#2603)
Browse files Browse the repository at this point in the history
* Use the environment Id from the topicDetails

Signed-off-by: Aindriu Lavelle <[email protected]>

* add the default consumerGroupId as a constant

Signed-off-by: Aindriu Lavelle <[email protected]>

---------

Signed-off-by: Aindriu Lavelle <[email protected]>
  • Loading branch information
aindriu-aiven authored Sep 4, 2024
1 parent dfd38c9 commit 731e43e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const mockGetTopicMessagesNoContentResponse = {
};

function DummyParent() {
return <Outlet context={{ topicName: "test" }} />;
return <Outlet context={{ topicName: "test", environmentId: "2" }} />;
}

describe("TopicMessages", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { getTopicMessages } from "src/domain/topic/topic-api";
import {
type NoContent,
type TopicMessages as TopicMessagesType,
TOPIC_MESSAGE_DEFAULT_USER_GROUP_ID,
} from "src/domain/topic/topic-types";

function isNoContentResult(
Expand All @@ -31,7 +32,7 @@ function isNoContentResult(
}

function TopicMessages() {
const { topicName } = useTopicDetails();
const { topicName, environmentId } = useTopicDetails();

const {
validateFilters,
Expand Down Expand Up @@ -60,8 +61,8 @@ function TopicMessages() {
queryFn: () =>
getTopicMessages({
topicName,
consumerGroupId: "notdefined",
envId: "2",
consumerGroupId: TOPIC_MESSAGE_DEFAULT_USER_GROUP_ID,
envId: environmentId,
offsetId: defaultOffsetFilters.defaultOffset,
selectedPartitionId: Number(partitionIdFilters.partitionId),
selectedNumberOfOffsets: Number(customOffsetFilters.customOffset),
Expand Down
2 changes: 2 additions & 0 deletions coral/src/domain/topic/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
TopicSchemaOverview,
TopicTeam,
TopicType,
TOPIC_MESSAGE_DEFAULT_USER_GROUP_ID,
} from "src/domain/topic/topic-types";

export {
Expand All @@ -36,6 +37,7 @@ export {
getTopics,
requestTopicPromotion,
updateTopicDocumentation,
TOPIC_MESSAGE_DEFAULT_USER_GROUP_ID,
};
export type {
DeleteTopicPayload,
Expand Down
4 changes: 4 additions & 0 deletions coral/src/domain/topic/topic-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ type TopicClaimPayload = ResolveIntersectionTypes<

type TopicDetailsPerEnv = KlawApiModel<"TopicDetailsPerEnv">;

const TOPIC_MESSAGE_DEFAULT_USER_GROUP_ID = "notdefined";

export type {
AclOverviewInfo,
DeleteTopicPayload,
Expand All @@ -114,3 +116,5 @@ export type {
TopicType,
GetTopicsQueryParameter,
};

export { TOPIC_MESSAGE_DEFAULT_USER_GROUP_ID };

0 comments on commit 731e43e

Please sign in to comment.