tftsr-devops_investigation/src/components/Kubernetes/Hotbar.tsx
Shaun Arman fb55601e3b
Some checks failed
Test / rust-tests (pull_request) Successful in 14m38s
PR Review Automation / review (pull_request) Has been cancelled
Test / frontend-tests (pull_request) Successful in 1m50s
Test / frontend-typecheck (pull_request) Successful in 1m56s
Test / rust-fmt-check (pull_request) Successful in 11m10s
Test / rust-clippy (pull_request) Successful in 12m54s
fix(kube): correct kubectl context, dialog close, icon visibility, cluster name
1. kubectl credentials error (41 places in kube.rs)
   Every kubectl invocation used .env("KUBERNETES_CONTEXT", context) which
   is not a real kubectl environment variable — kubectl silently ignores it
   and falls back to whatever current-context is set in the kubeconfig YAML.
   If that context has expired or wrong credentials the auth failure occurs.
   Replaced all 41 instances with .arg("--context").arg(context) so kubectl
   always uses the correct context from the stored kubeconfig.

2. Cluster name still showed UUID (two causes)
   a) Hotbar read from kubernetesStore.clusters (ClusterInfo[]) which is never
      populated by the kubeconfig-based flow — always empty, so selectedCluster
      was always undefined. Removed the Zustand cluster lookup from Hotbar and
      added a clusterName prop passed from KubernetesPage.tsx (selectedConfig?.name).
   b) ClusterOverview fell back to showing raw clusterId UUID when clusterName
      was undefined. Changed subtitle to render conditionally so UUID never shows.

3. Bell dialog had no way to close
   Custom DialogContent had no X button and no backdrop-click handler.
   Added X close button (top-right) and backdrop-click-to-close.

4. Hotbar icons invisible in dark mode
   variant="ghost" only styles hover state with no baseline text color.
   Added className="text-foreground" to all icon-only ghost buttons.
2026-06-07 18:58:16 -05:00

71 lines
2.2 KiB
TypeScript

import React from "react";
import { Button } from "@/components/ui";
import { Settings, Bell, User, Search, Plus, RefreshCw } from "lucide-react";
import { Badge } from "@/components/ui";
interface HotbarProps {
onRefresh: () => void;
onAddResource: () => void;
onSettings: () => void;
onNotifications?: () => void;
notificationCount?: number;
clusterName?: string;
}
export function Hotbar({
onRefresh,
onAddResource,
onSettings,
onNotifications,
notificationCount = 0,
clusterName,
}: HotbarProps) {
return (
<div className="h-12 bg-background border-b flex items-center justify-between px-4">
<div className="flex items-center gap-2">
<div className="flex items-center gap-1">
<Button variant="ghost" size="sm" onClick={onRefresh} className="text-foreground">
<RefreshCw className="w-4 h-4" />
</Button>
<Button variant="ghost" size="sm" onClick={onAddResource} className="text-foreground">
<Plus className="w-4 h-4" />
</Button>
</div>
<div className="h-6 w-px bg-border mx-2" />
<div className="flex items-center gap-2">
<Search className="w-4 h-4 text-muted-foreground" />
<span className="text-sm text-muted-foreground">
{clusterName ?? "No cluster selected"}
</span>
</div>
</div>
<div className="flex items-center gap-2">
<Button
variant="ghost"
size="sm"
onClick={onNotifications}
aria-label="Notifications"
className="text-foreground"
>
<Bell className="w-4 h-4" />
{notificationCount > 0 && (
<Badge
variant="destructive"
className="h-4 w-4 flex items-center justify-center p-0 text-[10px]"
>
{notificationCount}
</Badge>
)}
</Button>
<Button variant="ghost" size="sm" onClick={onSettings} className="text-foreground">
<Settings className="w-4 h-4" />
</Button>
<Button variant="ghost" size="sm" className="text-foreground">
<User className="w-4 h-4" />
</Button>
</div>
</div>
);
}