fix: remove extra brace in Agents.tsx, remove unused Progress import
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Progress } from "@/components/ui/progress";
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
@@ -66,30 +65,73 @@ const ROLE_ICONS: Record<string, any> = {
|
||||
function getStatusConfig(status: string) {
|
||||
switch (status) {
|
||||
case "running":
|
||||
return { color: "text-neon-green", bg: "bg-neon-green", badge: "bg-neon-green/15 text-neon-green border-neon-green/30", glow: "glow-green" };
|
||||
return {
|
||||
color: "text-neon-green",
|
||||
bg: "bg-neon-green",
|
||||
badge: "bg-neon-green/15 text-neon-green border-neon-green/30",
|
||||
glow: "glow-green",
|
||||
};
|
||||
case "idle":
|
||||
return { color: "text-primary", bg: "bg-primary", badge: "bg-primary/15 text-primary border-primary/30", glow: "glow-cyan" };
|
||||
return {
|
||||
color: "text-primary",
|
||||
bg: "bg-primary",
|
||||
badge: "bg-primary/15 text-primary border-primary/30",
|
||||
glow: "glow-cyan",
|
||||
};
|
||||
case "error":
|
||||
return { color: "text-neon-red", bg: "bg-neon-red", badge: "bg-neon-red/15 text-neon-red border-neon-red/30", glow: "glow-red" };
|
||||
return {
|
||||
color: "text-neon-red",
|
||||
bg: "bg-neon-red",
|
||||
badge: "bg-neon-red/15 text-neon-red border-neon-red/30",
|
||||
glow: "glow-red",
|
||||
};
|
||||
default:
|
||||
return { color: "text-muted-foreground", bg: "bg-muted", badge: "bg-muted text-muted-foreground border-border", glow: "" };
|
||||
return {
|
||||
color: "text-muted-foreground",
|
||||
bg: "bg-muted",
|
||||
badge: "bg-muted text-muted-foreground border-border",
|
||||
glow: "",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function getContainerStatusConfig(status: string | undefined | null) {
|
||||
switch (status) {
|
||||
case "running":
|
||||
return { label: "RUNNING", color: "text-neon-green", bg: "bg-neon-green/15", border: "border-neon-green/30", icon: Container };
|
||||
return {
|
||||
label: "RUNNING",
|
||||
color: "text-neon-green",
|
||||
bg: "bg-neon-green/15",
|
||||
border: "border-neon-green/30",
|
||||
icon: Container,
|
||||
};
|
||||
case "deploying":
|
||||
return { label: "DEPLOYING", color: "text-neon-amber", bg: "bg-neon-amber/15", border: "border-neon-amber/30", icon: Loader2 };
|
||||
return {
|
||||
label: "DEPLOYING",
|
||||
color: "text-neon-amber",
|
||||
bg: "bg-neon-amber/15",
|
||||
border: "border-neon-amber/30",
|
||||
icon: Loader2,
|
||||
};
|
||||
case "error":
|
||||
return { label: "ERROR", color: "text-neon-red", bg: "bg-neon-red/15", border: "border-neon-red/30", icon: AlertCircle };
|
||||
return {
|
||||
label: "ERROR",
|
||||
color: "text-neon-red",
|
||||
bg: "bg-neon-red/15",
|
||||
border: "border-neon-red/30",
|
||||
icon: AlertCircle,
|
||||
};
|
||||
case "stopped":
|
||||
default:
|
||||
return { label: "STOPPED", color: "text-muted-foreground", bg: "bg-muted/50", border: "border-border", icon: Square };
|
||||
return {
|
||||
label: "STOPPED",
|
||||
color: "text-muted-foreground",
|
||||
bg: "bg-muted/50",
|
||||
border: "border-border",
|
||||
icon: Square,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default function Agents() {
|
||||
const [selectedAgent, setSelectedAgent] = useState<any>(null);
|
||||
@@ -109,13 +151,13 @@ export default function Agents() {
|
||||
setAgentToDelete(null);
|
||||
refetch();
|
||||
},
|
||||
onError: (error) => {
|
||||
onError: error => {
|
||||
toast.error(`Failed to delete agent: ${error.message}`);
|
||||
},
|
||||
});
|
||||
|
||||
const deployMutation = trpc.agents.deployContainer.useMutation({
|
||||
onSuccess: (data) => {
|
||||
onSuccess: data => {
|
||||
if (data.success) {
|
||||
toast.success(`Agent container deployed: ${data.serviceName}`);
|
||||
} else {
|
||||
@@ -123,13 +165,13 @@ export default function Agents() {
|
||||
}
|
||||
refetch();
|
||||
},
|
||||
onError: (error) => {
|
||||
onError: error => {
|
||||
toast.error(`Deploy error: ${error.message}`);
|
||||
},
|
||||
});
|
||||
|
||||
const stopMutation = trpc.agents.stopContainer.useMutation({
|
||||
onSuccess: (data) => {
|
||||
onSuccess: data => {
|
||||
if (data.success) {
|
||||
toast.success("Agent container stopped");
|
||||
} else {
|
||||
@@ -137,7 +179,7 @@ export default function Agents() {
|
||||
}
|
||||
refetch();
|
||||
},
|
||||
onError: (error) => {
|
||||
onError: error => {
|
||||
toast.error(`Stop error: ${error.message}`);
|
||||
},
|
||||
});
|
||||
@@ -432,7 +474,9 @@ export default function Agents() {
|
||||
variant="outline"
|
||||
className={`text-[9px] font-mono ${csc.bg} ${csc.color} ${csc.border}`}
|
||||
>
|
||||
<ContainerIcon className={`w-2.5 h-2.5 mr-1 ${isDeploying || isStopping ? "animate-spin" : ""}`} />
|
||||
<ContainerIcon
|
||||
className={`w-2.5 h-2.5 mr-1 ${isDeploying || isStopping ? "animate-spin" : ""}`}
|
||||
/>
|
||||
{csc.label}
|
||||
</Badge>
|
||||
</div>
|
||||
@@ -524,29 +568,52 @@ export default function Agents() {
|
||||
onClick={e => {
|
||||
e.stopPropagation();
|
||||
setStoppingAgentId(agent.id);
|
||||
stopMutation.mutate({ agentId: agent.id }, {
|
||||
onSettled: () => setStoppingAgentId(null),
|
||||
});
|
||||
stopMutation.mutate(
|
||||
{ agentId: agent.id },
|
||||
{
|
||||
onSettled: () =>
|
||||
setStoppingAgentId(null),
|
||||
}
|
||||
);
|
||||
}}
|
||||
>
|
||||
{isStopping ? <Loader2 className="w-3 h-3 mr-1 animate-spin" /> : <Square className="w-3 h-3 mr-1" />}
|
||||
{isStopping ? (
|
||||
<Loader2 className="w-3 h-3 mr-1 animate-spin" />
|
||||
) : (
|
||||
<Square className="w-3 h-3 mr-1" />
|
||||
)}
|
||||
Stop
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
size="sm"
|
||||
className="h-7 text-[11px] bg-neon-green/15 text-neon-green border border-neon-green/30 hover:bg-neon-green/25"
|
||||
disabled={isDeploying || agent.containerStatus === "deploying"}
|
||||
disabled={
|
||||
isDeploying ||
|
||||
agent.containerStatus === "deploying"
|
||||
}
|
||||
onClick={e => {
|
||||
e.stopPropagation();
|
||||
setDeployingAgentId(agent.id);
|
||||
deployMutation.mutate({ agentId: agent.id }, {
|
||||
onSettled: () => setDeployingAgentId(null),
|
||||
});
|
||||
deployMutation.mutate(
|
||||
{ agentId: agent.id },
|
||||
{
|
||||
onSettled: () =>
|
||||
setDeployingAgentId(null),
|
||||
}
|
||||
);
|
||||
}}
|
||||
>
|
||||
{isDeploying || agent.containerStatus === "deploying" ? <Loader2 className="w-3 h-3 mr-1 animate-spin" /> : <Play className="w-3 h-3 mr-1" />}
|
||||
{isDeploying || agent.containerStatus === "deploying" ? "Deploying" : "Deploy"}
|
||||
{isDeploying ||
|
||||
agent.containerStatus === "deploying" ? (
|
||||
<Loader2 className="w-3 h-3 mr-1 animate-spin" />
|
||||
) : (
|
||||
<Play className="w-3 h-3 mr-1" />
|
||||
)}
|
||||
{isDeploying ||
|
||||
agent.containerStatus === "deploying"
|
||||
? "Deploying"
|
||||
: "Deploy"}
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
|
||||
Reference in New Issue
Block a user