diff options
Diffstat (limited to 'ui/src/state/store.ts')
| -rw-r--r-- | ui/src/state/store.ts | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/ui/src/state/store.ts b/ui/src/state/store.ts index 1e835cbd..cde2da17 100644 --- a/ui/src/state/store.ts +++ b/ui/src/state/store.ts @@ -18,6 +18,7 @@ import { import { invoke } from "@tauri-apps/api/core"; import { sessionToken, settings } from "./client"; import { getWeekInfo } from "@/lib/utils"; +import Runbook from "./runbooks/runbook"; // I'll probs want to slice this up at some point, but for now a // big blobby lump of state is fine. @@ -30,14 +31,19 @@ interface AtuinState { shellHistory: ShellHistory[]; calendar: any[]; weekStart: number; + runbooks: Runbook[]; + currentRunbook: String | null; refreshHomeInfo: () => void; refreshCalendar: () => void; refreshAliases: () => void; refreshVars: () => void; refreshUser: () => void; + refreshRunbooks: () => void; refreshShellHistory: (query?: string) => void; historyNextPage: (query?: string) => void; + + setCurrentRunbook: (id: String) => void; } let state = (set: any, get: any): AtuinState => ({ @@ -47,6 +53,8 @@ let state = (set: any, get: any): AtuinState => ({ vars: [], shellHistory: [], calendar: [], + runbooks: [], + currentRunbook: "", weekStart: getWeekInfo().firstDay, @@ -68,6 +76,11 @@ let state = (set: any, get: any): AtuinState => ({ }); }, + refreshRunbooks: async () => { + let runbooks = await Runbook.all(); + set({ runbooks }); + }, + refreshShellHistory: (query?: string) => { if (query) { invoke("search", { query: query }) @@ -141,6 +154,10 @@ let state = (set: any, get: any): AtuinState => ({ }); } }, + + setCurrentRunbook: (id: String) => { + set({ currentRunbook: id }); + }, }); export const useStore = create<AtuinState>()( |
