Skip to content

Commit

Permalink
chore: indicate when saving agent fails in admin ui (#633)
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Hopper-Lowe <[email protected]>
  • Loading branch information
ryanhopperlowe authored Nov 19, 2024
1 parent 08085a8 commit 0fbea9e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ui/admin/app/components/agent/Agent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type AgentProps = {
};

export function Agent({ className, onRefresh }: AgentProps) {
const { agent, updateAgent, isUpdating, lastUpdated } = useAgent();
const { agent, updateAgent, isUpdating, lastUpdated, error } = useAgent();

const [agentUpdates, setAgentUpdates] = useState(agent);

Expand Down Expand Up @@ -100,8 +100,10 @@ export function Agent({ className, onRefresh }: AgentProps) {
</Card>
</ScrollArea>

<footer className="flex justify-between items-center px-8 py-4 gap-4 text-muted-foreground">
{isUpdating ? (
<footer className="flex justify-between items-center px-8 py-4 gap-4 text-muted-foreground shadow-inner">
{error ? (
<TypographyP>Error saving agent</TypographyP>
) : isUpdating ? (
<TypographyP>Saving...</TypographyP>
) : lastUpdated ? (
<TypographyP>Saved</TypographyP>
Expand Down
2 changes: 2 additions & 0 deletions ui/admin/app/components/agent/AgentContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ interface AgentContextType {
agentId: string;
updateAgent: (agent: Agent) => void;
isUpdating: boolean;
error?: unknown;
lastUpdated?: Date;
}

Expand Down Expand Up @@ -61,6 +62,7 @@ export function AgentProvider({
updateAgent: updateAgent.execute,
isUpdating: updateAgent.isLoading,
lastUpdated,
error: updateAgent.error,
}}
>
{children}
Expand Down

0 comments on commit 0fbea9e

Please sign in to comment.