feat: field-sync-gui MVP — Wails GUI ingest SD→local+S3 (4 slots //)
This commit is contained in:
124
frontend/src/App.svelte
Normal file
124
frontend/src/App.svelte
Normal file
@@ -0,0 +1,124 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { ScanCards, StartIngest, CancelIngest, GetSnapshot, SetDryRun, LoadConfig } from '../wailsjs/go/main/App';
|
||||
import { EventsOn } from '../wailsjs/runtime/runtime';
|
||||
|
||||
let cards: any[] = [];
|
||||
let snapshot: any = { slots: [], running: false, dryRun: false, sessionID: '', config: {} };
|
||||
let dryRun = false;
|
||||
|
||||
async function refresh() {
|
||||
cards = await ScanCards();
|
||||
snapshot = await GetSnapshot();
|
||||
}
|
||||
|
||||
async function start() {
|
||||
const payload = cards.slice(0, 4).map((c: any, i: number) => ({
|
||||
slot: ['A','B','C','D'][i],
|
||||
mountpoint: c.mountpoint,
|
||||
}));
|
||||
await StartIngest(payload);
|
||||
}
|
||||
|
||||
async function cancel() { await CancelIngest(); await refresh(); }
|
||||
|
||||
function toggleDryRun() {
|
||||
dryRun = !dryRun;
|
||||
SetDryRun(dryRun);
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
refresh();
|
||||
const t = setInterval(refresh, 3000);
|
||||
EventsOn('slot-update', () => refresh());
|
||||
EventsOn('session-done', () => refresh());
|
||||
return () => clearInterval(t);
|
||||
});
|
||||
|
||||
function pct(done: number, total: number) {
|
||||
if (!total) return 0;
|
||||
return Math.round((done / total) * 100);
|
||||
}
|
||||
|
||||
function fmtBytes(b: number) {
|
||||
if (b < 1024) return b + ' B';
|
||||
if (b < 1024*1024) return (b/1024).toFixed(1) + ' KB';
|
||||
if (b < 1024*1024*1024) return (b/1024/1024).toFixed(1) + ' MB';
|
||||
return (b/1024/1024/1024).toFixed(2) + ' GB';
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="min-h-screen p-6 flex flex-col gap-6">
|
||||
<header class="flex items-center justify-between border-b border-slate-700 pb-4">
|
||||
<div>
|
||||
<h1 class="text-3xl font-bold text-cyan-400">field-sync</h1>
|
||||
<p class="text-sm text-slate-400">Cosma terrain · SD → local + S3</p>
|
||||
</div>
|
||||
<div class="text-right text-xs text-slate-400">
|
||||
<div>Session: <span class="text-slate-200">{snapshot.sessionID || '—'}</span></div>
|
||||
<div>Bucket: <span class="text-slate-200">{snapshot.config?.s3Bucket || '—'}</span></div>
|
||||
<div>Dest: <span class="text-slate-200">{snapshot.config?.localDest || '—'}</span></div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section class="grid grid-cols-2 gap-4">
|
||||
{#each ['A','B','C','D'] as letter, i}
|
||||
{@const s = (snapshot.slots && snapshot.slots[i]) || { slot: letter, status: 'idle' }}
|
||||
{@const card = cards[i]}
|
||||
<div class="bg-slate-800 rounded-2xl p-5 border border-slate-700 shadow-lg">
|
||||
<div class="flex items-center justify-between mb-3">
|
||||
<div class="text-2xl font-bold text-cyan-300">SLOT {letter}</div>
|
||||
<span class="px-3 py-1 rounded-full text-xs font-mono uppercase tracking-wider"
|
||||
class:bg-slate-700={s.status==='idle'}
|
||||
class:bg-blue-700={s.status==='copying'||s.status==='scanning'}
|
||||
class:bg-amber-600={s.status==='uploading'}
|
||||
class:bg-emerald-700={s.status==='done'}
|
||||
class:bg-red-700={s.status==='error'}>{s.status || 'idle'}</span>
|
||||
</div>
|
||||
{#if card}
|
||||
<div class="text-sm text-slate-300 mb-1 truncate">{card.label || card.mountpoint}</div>
|
||||
<div class="text-xs text-slate-500 mb-3 truncate">{card.mountpoint}</div>
|
||||
{:else}
|
||||
<div class="text-sm text-slate-500 italic mb-3">— vide —</div>
|
||||
{/if}
|
||||
<div class="space-y-2">
|
||||
<div>
|
||||
<div class="flex justify-between text-xs text-slate-400">
|
||||
<span>Fichiers</span><span>{s.filesDone || 0} / {s.filesTotal || 0}</span>
|
||||
</div>
|
||||
<div class="w-full bg-slate-700 rounded h-2 overflow-hidden">
|
||||
<div class="h-full bg-cyan-500 transition-all" style="width: {pct(s.filesDone, s.filesTotal)}%"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="flex justify-between text-xs text-slate-400">
|
||||
<span>Octets</span><span>{fmtBytes(s.bytesDone || 0)} / {fmtBytes(s.bytesTotal || 0)}</span>
|
||||
</div>
|
||||
<div class="w-full bg-slate-700 rounded h-2 overflow-hidden">
|
||||
<div class="h-full bg-emerald-500 transition-all" style="width: {pct(s.bytesDone, s.bytesTotal)}%"></div>
|
||||
</div>
|
||||
</div>
|
||||
{#if s.speedMBs}<div class="text-xs text-slate-400">{s.speedMBs.toFixed(1)} MB/s</div>{/if}
|
||||
{#if s.error}<div class="text-xs text-red-400 mt-1">⚠ {s.error}</div>{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</section>
|
||||
|
||||
<footer class="flex gap-3 items-center mt-auto border-t border-slate-700 pt-4">
|
||||
<button on:click={refresh} class="px-5 py-3 bg-slate-700 hover:bg-slate-600 rounded-lg font-semibold">↻ Rescan</button>
|
||||
<button on:click={start} disabled={snapshot.running || cards.length===0}
|
||||
class="px-6 py-3 bg-cyan-600 hover:bg-cyan-500 disabled:bg-slate-700 disabled:text-slate-500 rounded-lg font-bold text-lg">
|
||||
▶ START INGEST
|
||||
</button>
|
||||
<button on:click={cancel} disabled={!snapshot.running}
|
||||
class="px-5 py-3 bg-red-700 hover:bg-red-600 disabled:bg-slate-700 disabled:text-slate-500 rounded-lg font-semibold">
|
||||
✕ Cancel
|
||||
</button>
|
||||
<label class="flex items-center gap-2 ml-4 text-sm cursor-pointer">
|
||||
<input type="checkbox" bind:checked={dryRun} on:change={toggleDryRun} class="w-4 h-4">
|
||||
Dry-run
|
||||
</label>
|
||||
<div class="ml-auto text-xs text-slate-500">{cards.length} carte(s) détectée(s)</div>
|
||||
</footer>
|
||||
</div>
|
||||
93
frontend/src/assets/fonts/OFL.txt
Normal file
93
frontend/src/assets/fonts/OFL.txt
Normal file
@@ -0,0 +1,93 @@
|
||||
Copyright 2016 The Nunito Project Authors (contact@sansoxygen.com),
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
BIN
frontend/src/assets/fonts/nunito-v16-latin-regular.woff2
Normal file
BIN
frontend/src/assets/fonts/nunito-v16-latin-regular.woff2
Normal file
Binary file not shown.
BIN
frontend/src/assets/images/logo-universal.png
Normal file
BIN
frontend/src/assets/images/logo-universal.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 136 KiB |
8
frontend/src/main.ts
Normal file
8
frontend/src/main.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import './style.css'
|
||||
import App from './App.svelte'
|
||||
|
||||
const app = new App({
|
||||
target: document.getElementById('app')
|
||||
})
|
||||
|
||||
export default app
|
||||
5
frontend/src/style.css
Normal file
5
frontend/src/style.css
Normal file
@@ -0,0 +1,5 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
html, body { @apply bg-slate-900 text-slate-100 h-full m-0; font-family: system-ui, sans-serif; }
|
||||
2
frontend/src/vite-env.d.ts
vendored
Normal file
2
frontend/src/vite-env.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/// <reference types="svelte" />
|
||||
/// <reference types="vite/client" />
|
||||
Reference in New Issue
Block a user