feat(platform/library): Add icons to primary agent run action buttons (#9651)

- Resolves #9612

### Changes 🏗️

- Add icon to "Run" button in run draft view
- Add icons "Stop run" and "Run again" buttons in run view

!["Run"
button](https://github.com/user-attachments/assets/da863753-6cb2-4cea-aa00-c313b606d198)
!["Run again"
button](https://github.com/user-attachments/assets/79958187-05dd-494e-a3a1-e9745db0d2d4)
!["Stop run"
button](https://github.com/user-attachments/assets/ad37ec3a-3c0b-493b-b548-e6b902eb8bda)


### Checklist 📋

#### For code changes:
- [x] I have clearly listed my changes in the PR description
- [x] I have made a test plan
- [x] I have tested my changes according to the test plan:
  - Purely visual changes, no functional test needed.
    Technical changes are covered by the type checker.
This commit is contained in:
Reinier van der Leer
2025-03-18 11:31:33 +01:00
committed by Zamil Majdy
parent 9b19d1959e
commit 2c92122721
3 changed files with 34 additions and 9 deletions

View File

@@ -11,6 +11,7 @@ import {
import type { ButtonAction } from "@/components/agptui/types";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { IconRefresh, IconSquare } from "@/components/ui/icons";
import { Button } from "@/components/agptui/Button";
import { Input } from "@/components/ui/input";
@@ -121,14 +122,29 @@ export default function AgentRunDetailsView({
...(["running", "queued"].includes(runStatus)
? ([
{
label: "Stop run",
label: (
<>
<IconSquare className="mr-2 size-4" />
Stop run
</>
),
variant: "secondary",
callback: stopRun,
},
] satisfies ButtonAction[])
: []),
...(["success", "failed", "stopped"].includes(runStatus)
? [{ label: "Run again", callback: runAgain }]
? [
{
label: (
<>
<IconRefresh className="mr-2 size-4" />
Run again
</>
),
callback: runAgain,
},
]
: []),
{ label: "Delete run", variant: "secondary", callback: deleteRun },
],

View File

@@ -7,6 +7,7 @@ import { GraphExecutionID, GraphMeta } from "@/lib/autogpt-server-api";
import type { ButtonAction } from "@/components/agptui/types";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Button, ButtonProps } from "@/components/agptui/Button";
import { IconPlay } from "@/components/ui/icons";
import { Input } from "@/components/ui/input";
export default function AgentRunDraftView({
@@ -31,12 +32,19 @@ export default function AgentRunDraftView({
[api, graph, inputValues, onRun],
);
const runActions: {
label: string;
variant?: ButtonProps["variant"];
callback: () => void;
}[] = useMemo(
() => [{ label: "Run", variant: "accent", callback: () => doRun() }],
const runActions: ButtonAction[] = useMemo(
() => [
{
label: (
<>
<IconPlay className="mr-2 size-5" />
Run
</>
),
variant: "accent",
callback: doRun,
},
],
[doRun],
);

View File

@@ -1,7 +1,8 @@
import type { ButtonProps } from "@/components/agptui/Button";
import React from "react";
export type ButtonAction = {
label: string;
label: React.ReactNode;
variant?: ButtonProps["variant"];
callback: () => void;
};