far async

main
parent 0d290d0930
commit 1dae2f7211

@ -96,7 +96,7 @@ func getFileCountAndSize(dir string) (int, int64, error) {
func (a *App) GetDownloads() string { func (a *App) GetDownloads() string {
cnt, size, err := getFileCountAndSize("C:\\Users\\admin\\Downloads") cnt, size, err := getFileCountAndSize("C:\\Users\\admin\\Downloads")
checkError("getDownloads", err) checkError("getDownloads", err)
info := fmt.Sprintf("%d(%d Mb)", cnt, size/1024/1024) info := fmt.Sprintf("%d (%d Mb)", cnt, size/1024/1024)
return info return info
} }
@ -216,5 +216,5 @@ func getCountReady(ctx context.Context, dir string) int {
func (a *App) GetStatus() string { func (a *App) GetStatus() string {
pics := getCountPics("d:\\pics") pics := getCountPics("d:\\pics")
ready := getCountReady(a.ctx, "d:\\pics-move") ready := getCountReady(a.ctx, "d:\\pics-move")
return fmt.Sprintf("%d/%d", pics, ready) return fmt.Sprintf("%d / %d", pics, ready)
} }

@ -27,8 +27,9 @@ function get_disks() {
console.log("get disks") console.log("get disks")
GetDisks().then((result) => { GetDisks().then((result) => {
console.log("получена информация о дисках:", result) console.log("получена информация о дисках:", result)
disks = result; disks = result
normal = (disks[0].Free > 10) && (disks[1].Free > 50); disks[0].normal = disks[0].Free > 20;
disks[1].normal = disks[1].Free > 50;
}) })
} }
@ -101,7 +102,7 @@ get_status();
{#each disks as disk} {#each disks as disk}
<div> <div>
{disk.Name} {disk.Name}
<span class={normal ? 'info' : 'danger'}>{disk.Free} Gb</span> <span class={disk.normal ? 'info' : 'danger'}>{disk.Free} Gb</span>
</div> </div>
{/each} {/each}
</div> </div>

Loading…
Cancel
Save