[READ-ONLY] Mirror of https://github.com/probablykasper/time-machine-inspector. Time Machine backup size inspector app
backup macos tauri time-machine
0

Configure Feed

Select the types of activity you want to include in your feed.

Add "no backups found" error message (#1)

Kasper (Jan 29, 2022, 2:33 AM +0100) d5b532a1 91cb4ab1

+25 -3
+13 -1
src/App.svelte
··· 33 33 {:else} 34 34 <div class="sidebar-stuff" transition:fade={{ duration: 300, easing: cubicInOut }}> 35 35 <Button disabled={loading} on:click={() => load(true)}>Refresh</Button> 36 - {#if $backups !== null} 36 + {#if $backups && $backups.status !== ''} 37 + <div class="status"> 38 + {$backups.status} 39 + </div> 40 + {:else if $backups} 37 41 <Sidebar backups={$backups} /> 38 42 {/if} 39 43 </div> ··· 79 83 height: 100% 80 84 display: flex 81 85 flex-direction: column 86 + .status 87 + flex-grow: 1 88 + font-size: 15px 89 + display: flex 90 + align-items: center 91 + justify-content: center 92 + color: hsla(216, 50%, 85%, 0.8) 93 + margin-bottom: 64px 82 94 .loading 83 95 height: 100% 84 96 position: absolute // for transition
+12 -2
src/page/page.ts
··· 1 + import { invoke } from '@tauri-apps/api/tauri' 1 2 import { get, writable } from 'svelte/store' 2 - import { runCmd } from '../general' 3 + import { popup, runCmd } from '../general' 3 4 4 5 export type Backups = { 5 6 dirs: DirMap 6 7 rootPath: string 8 + status: string 7 9 } 8 10 export type DirMap = { 9 11 '/': DirContent ··· 102 104 } 103 105 104 106 export async function loadBackups(refresh = false) { 105 - const result = (await runCmd('load_backup_list', { refresh })) as { map: DirMap } 107 + const result = (await invoke('load_backup_list', { refresh }).catch((msg) => { 108 + if (msg.trim() === 'tmutil error 1:\nNo machine directory found for host.') { 109 + return { map: { '/': [] }, status: 'No backups found' } 110 + } else { 111 + popup(msg) 112 + throw msg 113 + } 114 + })) as { map: DirMap; status?: string } 106 115 console.log('Loaded backups', result) 107 116 const map = result.map 108 117 ··· 126 135 backups.set({ 127 136 dirs: result.map, 128 137 rootPath, 138 + status: result.status || '', 129 139 }) 130 140 }