forked from streamshub/console
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove charts and visual details that will not be available for mvp (s…
- Loading branch information
1 parent
19c3ff7
commit 1579b16
Showing
34 changed files
with
553 additions
and
427 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { | ||
ClusterDetail, | ||
ClusterList, | ||
ClusterResponse, | ||
ClustersResponse, | ||
} from "@/api/types"; | ||
|
||
export async function getKafkaClusters(): Promise<ClusterList[]> { | ||
const url = `${process.env.BACKEND_URL}/api/kafkas?fields%5Bkafkas%5D=name,bootstrapServers,authType`; | ||
try { | ||
const res = await fetch(url, { | ||
headers: { | ||
Accept: "application/json", | ||
}, | ||
cache: "no-store", | ||
}); | ||
const rawData = await res.json(); | ||
return ClustersResponse.parse(rawData).data; | ||
} catch (err) { | ||
console.error(err); | ||
throw err; | ||
} | ||
} | ||
|
||
export async function getKafkaCluster( | ||
clusterId: string, | ||
): Promise<ClusterDetail> { | ||
const url = `${process.env.BACKEND_URL}/api/kafkas/${clusterId}/?fields%5Bkafkas%5D=name,namespace,creationTimestamp,nodes,controller,authorizedOperations,bootstrapServers,authType`; | ||
try { | ||
const res = await fetch(url, { | ||
headers: { | ||
Accept: "application/json", | ||
}, | ||
cache: "no-store", | ||
}); | ||
const rawData = await res.json(); | ||
return ClusterResponse.parse(rawData).data; | ||
} catch (err) { | ||
console.error(err); | ||
throw err; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
"use client"; | ||
|
||
import { KafkaResource } from "@/api/types"; | ||
import { ResponsiveTable } from "@/components/table"; | ||
import { ClipboardCopy, Label, LabelGroup } from "@patternfly/react-core"; | ||
import { | ||
DataSourceIcon, | ||
SecurityIcon, | ||
UserIcon, | ||
} from "@patternfly/react-icons"; | ||
import Link from "next/link"; | ||
|
||
const columns = ["name", "source", "bootstrapUrl", "authentication"] as const; | ||
|
||
export function ClustersTable({ | ||
clusters = [], | ||
}: { | ||
clusters: KafkaResource[] | undefined; | ||
}) { | ||
return ( | ||
<ResponsiveTable | ||
ariaLabel={"Kafka clusters"} | ||
columns={columns} | ||
data={clusters} | ||
renderHeader={({ column, Th }) => { | ||
switch (column) { | ||
case "name": | ||
return <Th width={15}>Name</Th>; | ||
case "bootstrapUrl": | ||
return <Th>Bootstrap url</Th>; | ||
case "source": | ||
return <Th>Source</Th>; | ||
case "authentication": | ||
return <Th width={15}>Authentication</Th>; | ||
} | ||
}} | ||
renderCell={({ column, row, Td }) => { | ||
switch (column) { | ||
case "name": | ||
return ( | ||
<Td> | ||
<Link href={`/kafka/${row.id}`}>{row.attributes.name}</Link> | ||
</Td> | ||
); | ||
case "bootstrapUrl": | ||
return ( | ||
<Td> | ||
<ClipboardCopy | ||
hoverTip="Copy" | ||
clickTip="Copied" | ||
variant="inline-compact" | ||
> | ||
{row.attributes.bootstrapServer} | ||
</ClipboardCopy> | ||
</Td> | ||
); | ||
case "source": | ||
return ( | ||
<Td> | ||
<Label icon={<DataSourceIcon />} color={"blue"}> | ||
{row.attributes.source === "auto" ? "Autodiscovery" : "User"} | ||
</Label> | ||
</Td> | ||
); | ||
case "authentication": | ||
return ( | ||
<Td> | ||
{row.attributes.source === "auto" ? ( | ||
<Label icon={<SecurityIcon />} color={"purple"}> | ||
Automatic | ||
</Label> | ||
) : ( | ||
<LabelGroup> | ||
<Label icon={<SecurityIcon />} color={"purple"}> | ||
{row.attributes.mechanism} | ||
</Label> | ||
<Label icon={<UserIcon />} color={"gold"}> | ||
{row.attributes.principal} | ||
</Label> | ||
</LabelGroup> | ||
)} | ||
</Td> | ||
); | ||
} | ||
}} | ||
/> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
ui/app/[locale]/kafka/[kafkaId]/(root)/@activeBreadcrumb/brokers/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function BrokersActiveBreadcrumb() { | ||
return "Brokers"; | ||
} |
3 changes: 3 additions & 0 deletions
3
ui/app/[locale]/kafka/[kafkaId]/(root)/@activeBreadcrumb/consumer-groups/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function ConsumerGroupsActiveBreadcrumb() { | ||
return "Consumer groups"; | ||
} |
3 changes: 3 additions & 0 deletions
3
ui/app/[locale]/kafka/[kafkaId]/(root)/@activeBreadcrumb/schema-registry/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function SchemaRegistryActiveBreadcrumb() { | ||
return "Schema registry"; | ||
} |
3 changes: 3 additions & 0 deletions
3
ui/app/[locale]/kafka/[kafkaId]/(root)/@activeBreadcrumb/topics/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function TopicsActiveBreadcrumb() { | ||
return "Topics"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
ui/app/[locale]/kafka/[kafkaId]/(root)/brokers/BrokersTable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
"use client"; | ||
|
||
import { KafkaNode } from "@/api/types"; | ||
import { ResponsiveTable } from "@/components/table"; | ||
import { ClipboardCopy, Label, LabelGroup } from "@patternfly/react-core"; | ||
import { ServerIcon } from "@patternfly/react-icons"; | ||
|
||
const columns = ["id", "host", "rack"] as const; | ||
|
||
export function BrokersTable({ | ||
brokers, | ||
controller, | ||
}: { | ||
brokers: KafkaNode[]; | ||
controller: KafkaNode; | ||
}) { | ||
return ( | ||
<ResponsiveTable | ||
ariaLabel={"Kafka clusters"} | ||
columns={columns} | ||
data={brokers} | ||
renderHeader={({ column, Th }) => { | ||
switch (column) { | ||
case "id": | ||
return <Th width={15}>Id</Th>; | ||
case "host": | ||
return <Th>Host</Th>; | ||
case "rack": | ||
return <Th>Rack</Th>; | ||
} | ||
}} | ||
renderCell={({ column, row, Td }) => { | ||
switch (column) { | ||
case "id": | ||
return ( | ||
<Td> | ||
<LabelGroup> | ||
<Label icon={<ServerIcon />} color={"orange"}> | ||
{row.id} | ||
</Label> | ||
{row.id === controller.id && ( | ||
<Label color={"purple"}>Controller</Label> | ||
)} | ||
</LabelGroup> | ||
</Td> | ||
); | ||
case "host": | ||
return ( | ||
<Td> | ||
<ClipboardCopy | ||
hoverTip="Copy" | ||
clickTip="Copied" | ||
variant="inline-compact" | ||
> | ||
{row.host}:{row.port} | ||
</ClipboardCopy> | ||
</Td> | ||
); | ||
case "rack": | ||
return <Td>{row.rack || "-"}</Td>; | ||
} | ||
}} | ||
/> | ||
); | ||
} |
Oops, something went wrong.