Skip to content

Commit

Permalink
fix build issue
Browse files Browse the repository at this point in the history
Signed-off-by: hemahg <[email protected]>
  • Loading branch information
hemahg committed Oct 1, 2024
1 parent 07586a2 commit 67b0a1e
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 55 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
import { TopicHeader } from "@/app/[locale]/(authorized)/kafka/[kafkaId]/@header/topics/[topicId]/TopicHeader";
import {
TopicHeader,
TopicHeaderProps,
} from "@/app/[locale]/(authorized)/kafka/[kafkaId]/@header/topics/[topicId]/TopicHeader";

export default TopicHeader;
export default function TopicHeaderNoRefresh(
props: Omit<TopicHeaderProps, "showRefresh">,
) {
return <TopicHeader {...props} showRefresh={false} />;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ export const RebalanceList: Story = {
rebalanceList: [
{
id: "geffs",
meta: {
allowedActions: ["approve", "refresh"],
},
attributes: {
name: "kafak-rebalance-test1",
status: "Ready",
Expand All @@ -23,6 +26,9 @@ export const RebalanceList: Story = {
},
{
id: "zwrfts",
meta: {
allowedActions: ["refresh"],
},
attributes: {
name: "kafak-rebalance-test2",
status: "Stopped",
Expand All @@ -32,6 +38,9 @@ export const RebalanceList: Story = {
},
{
id: "zwerts",
meta: {
allowedActions: ["approve"],
},
attributes: {
name: "kafak-rebalance-test3",
status: "New",
Expand All @@ -41,6 +50,9 @@ export const RebalanceList: Story = {
},
{
id: "zw6gscd6w",
meta: {
allowedActions: ["approve", "refresh"],
},
attributes: {
name: "kafak-rebalance-test4",
status: "PendingProposal",
Expand All @@ -57,6 +69,9 @@ export const RebalanceList: Story = {
},
{
id: "zserts",
meta: {
allowedActions: [],
},
attributes: {
name: "kafak-rebalance-test6",
status: "ReconciliationPaused",
Expand All @@ -65,6 +80,9 @@ export const RebalanceList: Story = {
},
{
id: "asqwests",
meta: {
allowedActions: ["approve", "refresh"],
},
attributes: {
name: "kafak-rebalance-test7",
status: "NotReady",
Expand All @@ -73,6 +91,9 @@ export const RebalanceList: Story = {
},
{
id: "asqwests",
meta: {
allowedActions: [],
},
attributes: {
name: "kafak-rebalance-test7",
status: "Rebalancing",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,27 +188,24 @@ export function RebalanceTable({
}
}}
renderActions={({ row, ActionsColumn }) => (
console.log(row.meta?.allowedActions),
(
<ActionsColumn
items={[
{
title: t("approve"),
onClick: () => onApprove(row),
isDisabled: row.meta.allowedActions.includes("approve"),
},
{
title: t("refresh"),
onClick: () => {},
},
{
title: t("stop"),
onClick: () => onStop(row),
isDisabled: !row.meta.allowedActions.includes("approve"),
},
]}
/>
)
<ActionsColumn
items={[
{
title: t("approve"),
onClick: () => onApprove(row),
isDisabled: row.meta?.allowedActions.includes("approve"),
},
{
title: t("refresh"),
onClick: () => {},
},
{
title: t("stop"),
onClick: () => onStop(row),
isDisabled: !row.meta?.allowedActions.includes("approve"),
},
]}
/>
)}
getExpandedRow={({ row }) => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,37 +46,41 @@ async function ConnectedOptimizationProposal({
}) {
const rebalanceDetails = await getRebalanceDetails(kafkaId, rebalanceId);

const { optimizationResult, sessionId } = rebalanceDetails.attributes;
if (rebalanceDetails && typeof rebalanceDetails !== "boolean") {
const { optimizationResult, sessionId } = rebalanceDetails.attributes;

return (
<OptimizationProposal
numIntraBrokerReplicaMovements={
optimizationResult.numIntraBrokerReplicaMovements
}
numReplicaMovements={optimizationResult.numReplicaMovements}
onDemandBalancednessScoreAfter={
optimizationResult.onDemandBalancednessScoreAfter
}
intraBrokerDataToMoveMB={optimizationResult.intraBrokerDataToMoveMB}
monitoredPartitionsPercentage={
optimizationResult.monitoredPartitionsPercentage
}
excludedBrokersForReplicaMove={
optimizationResult.excludedBrokersForReplicaMove
}
excludedBrokersForLeadership={
optimizationResult.excludedBrokersForLeadership
}
onDemandBalancednessScoreBefore={
optimizationResult.onDemandBalancednessScoreBefore
}
recentWindows={optimizationResult.recentWindows}
dataToMoveMB={optimizationResult.dataToMoveMB}
excludedTopics={optimizationResult.excludedTopics}
numLeaderMovements={optimizationResult.numLeaderMovements}
isModalOpen={true}
sessionId={sessionId}
baseurl={`/kafka/${kafkaId}/nodes/rebalances`}
/>
);
return (
<OptimizationProposal
numIntraBrokerReplicaMovements={
optimizationResult.numIntraBrokerReplicaMovements
}
numReplicaMovements={optimizationResult.numReplicaMovements}
onDemandBalancednessScoreAfter={
optimizationResult.onDemandBalancednessScoreAfter
}
intraBrokerDataToMoveMB={optimizationResult.intraBrokerDataToMoveMB}
monitoredPartitionsPercentage={
optimizationResult.monitoredPartitionsPercentage
}
excludedBrokersForReplicaMove={
optimizationResult.excludedBrokersForReplicaMove
}
excludedBrokersForLeadership={
optimizationResult.excludedBrokersForLeadership
}
onDemandBalancednessScoreBefore={
optimizationResult.onDemandBalancednessScoreBefore
}
recentWindows={optimizationResult.recentWindows}
dataToMoveMB={optimizationResult.dataToMoveMB}
excludedTopics={optimizationResult.excludedTopics}
numLeaderMovements={optimizationResult.numLeaderMovements}
isModalOpen={true}
sessionId={sessionId}
baseurl={`/kafka/${kafkaId}/nodes/rebalances`}
/>
);
} else {
return <div>No rebalance details available.</div>;
}
}

0 comments on commit 67b0a1e

Please sign in to comment.