mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-09 15:07:55 -05:00
Clear console only clears from current console
This commit is contained in:
@@ -85,7 +85,7 @@ export function Console() {
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={clearConsole}
|
||||
onClick={() => clearConsole(activeWorkflowId)}
|
||||
className="text-muted-foreground hover:text-foreground"
|
||||
>
|
||||
Clear
|
||||
|
||||
@@ -25,7 +25,11 @@ export const useConsoleStore = create<ConsoleStore>()(
|
||||
})
|
||||
},
|
||||
|
||||
clearConsole: () => set({ entries: [] }),
|
||||
clearConsole: (workflowId: string | null) => {
|
||||
set((state) => ({
|
||||
entries: state.entries.filter(entry => !workflowId || entry.workflowId !== workflowId)
|
||||
}))
|
||||
},
|
||||
|
||||
getWorkflowEntries: (workflowId) => {
|
||||
return get().entries.filter((entry) => entry.workflowId === workflowId)
|
||||
|
||||
@@ -13,6 +13,6 @@ export interface ConsoleEntry {
|
||||
export interface ConsoleStore {
|
||||
entries: ConsoleEntry[]
|
||||
addConsole: (entry: Omit<ConsoleEntry, 'id'>) => void
|
||||
clearConsole: () => void
|
||||
clearConsole: (workflowId: string | null) => void
|
||||
getWorkflowEntries: (workflowId: string) => ConsoleEntry[]
|
||||
}
|
||||
Reference in New Issue
Block a user