From f8c963c7d668fc57680f25413f20bc207d4bf64a Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Tue, 23 Jul 2024 13:18:54 +0100 Subject: feat(gui): clean up home page, fix a few bugs (#2304) * wip home screen changes * more * adjust * fixes and things * patch runbook pty check --- ui/src/state/models.ts | 4 ++++ ui/src/state/store.ts | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'ui/src/state') diff --git a/ui/src/state/models.ts b/ui/src/state/models.ts index c1d97f4b..4ca79006 100644 --- a/ui/src/state/models.ts +++ b/ui/src/state/models.ts @@ -18,12 +18,16 @@ export interface HomeInfo { historyCount: number; recordCount: number; lastSyncTime: Date | null; + recentCommands: ShellHistory[]; + topCommands: ShellHistory[]; } export const DefaultHomeInfo: HomeInfo = { historyCount: 0, recordCount: 0, lastSyncTime: new Date(), + recentCommands: [], + topCommands: [], }; export class ShellHistory { diff --git a/ui/src/state/store.ts b/ui/src/state/store.ts index c6d3c152..39ee0096 100644 --- a/ui/src/state/store.ts +++ b/ui/src/state/store.ts @@ -58,7 +58,7 @@ export interface AtuinState { setCurrentRunbook: (id: String) => void; setPtyTerm: (pty: string, terminal: any) => void; - newPtyTerm: (pty: string, runbook: string) => TerminalData; + newPtyTerm: (pty: string) => TerminalData; cleanupPtyTerm: (pty: string) => void; terminals: { [pty: string]: TerminalData }; @@ -125,11 +125,17 @@ let state = (set: any, get: any): AtuinState => ({ refreshHomeInfo: () => { invoke("home_info") .then((res: any) => { + console.log(res); set({ homeInfo: { historyCount: res.history_count, recordCount: res.record_count, lastSyncTime: (res.last_sync && parseISO(res.last_sync)) || null, + recentCommands: res.recent_commands, + topCommands: res.top_commands.map((top: any) => ({ + command: top[0], + count: top[1], + })), }, }); }) -- cgit v1.3.1