Skip to content

Commit 76404c0

Browse files
authored
Added a “Virtual” label to Kafka clusters in the cluster dropdown when the cluster is virtual. (#2300)
* Add a “Virtual” label to Kafka clusters in the cluster dropdown when the cluster is virtual. Signed-off-by: hemahg <hhg@redhat.com> * Check for isVirtualKafkaCluster in the dropdown Signed-off-by: hemahg <hhg@redhat.com> --------- Signed-off-by: hemahg <hhg@redhat.com>
1 parent dd84e01 commit 76404c0

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

ui/app/[locale]/(authorized)/kafka/[kafkaId]/layout.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,16 @@ export default async function AsyncLayout({
4444
const namespace = cluster.attributes?.namespace ?? "Not provided";
4545
const authMethod =
4646
cluster.meta?.authentication?.method ?? "no authentication";
47+
const isVirtualKafkaCluster =
48+
cluster.meta?.kind === "virtualkafkaclusters.kroxylicious.io";
4749

4850
return {
4951
clusterName: name,
5052
projectName: namespace,
5153
authenticationMethod: authMethod,
5254
id: id,
5355
loginRequired: loginRequired,
56+
isVirtual: isVirtualKafkaCluster,
5457
};
5558
});
5659

ui/components/AppDropdown.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ import Link from "next/link";
2323
import { useRouter } from "next/navigation";
2424
import { useRef, useState } from "react";
2525
import { useTranslations } from "next-intl";
26+
import { KroxyliciousClusterLabel } from "@/app/[locale]/(authorized)/kafka/[kafkaId]/KroxyliciousClusterLabel";
2627

2728
export type ClusterInfo = {
2829
projectName: string;
2930
clusterName: string;
3031
authenticationMethod: string;
3132
id: string;
3233
loginRequired: boolean;
34+
isVirtual: boolean;
3335
};
3436

3537
export function AppDropdown({
@@ -40,6 +42,7 @@ export function AppDropdown({
4042
readonly clusters: ClusterInfo[];
4143
readonly kafkaId: string;
4244
readonly isOidcEnabled?: boolean;
45+
readonly isVirtualKafkaCluster?: boolean;
4346
}>) {
4447
const t = useTranslations();
4548
const router = useRouter();
@@ -117,7 +120,10 @@ export function AppDropdown({
117120
isSelected={kafkaId === cluster.id}
118121
>
119122
<Flex>
120-
<FlexItem>{cluster.clusterName}</FlexItem>
123+
<FlexItem>
124+
{cluster.clusterName}
125+
{cluster.isVirtual && <KroxyliciousClusterLabel />}
126+
</FlexItem>
121127
<FlexItem align={{ default: "alignRight" }}>
122128
{cluster.id !== kafkaId && (
123129
<Tooltip content={t("cluster-selector.login-to-cluster")}>

0 commit comments

Comments
 (0)