D1, terza parte: Dashboard come pagina iniziale ovunque, miniature anche del Giro

Richiesta di Alberto (#59, parte b): la Dashboard al posto di Attività, prima voce e
pagina iniziale, compatta, con l'anteprima del browser sempre visibile e le miniature di
ciò che è arrivato. La prima parte (d6c0ef8) aveva già pagina, rotte e anteprima; qui si
chiude ciò che mancava.

- La finestra di Febe per Windows apre /dashboard?gettone=… (non più /): tolto il
  gettone l'indirizzo resta /dashboard.
- La voce Dashboard ha un'icona sua, layout-dashboard, disegnata in casa.
- Cronologia: anche le righe del Giro dei seguiti, che non hanno un account, mostrano le
  miniature di ciò che è arrivato di tutti gli account; mai gli elementi importati. Indice
  ix_entry_discovered nella migrazione 0002 (non ancora unita), così la domanda legge
  solo le righe dei minuti della ricetta anche con 200.000 elementi.
- Anteprima ingrandita: le frecce funzionano anche con il fuoco sui pulsanti del piede,
  «Apri l'account» segue l'elemento mostrato, chiudendo non si disegna più nulla.
- Al telefono il cruscotto è più basso (anteprima 196 px, miniature 40 px).
- Guida: «Attività e arresti» diventa «Dashboard e arresti», collegamenti e testi delle
  altre pagine aggiornati; differenze dai mockup in docs/schermate/differenze.md; quattro
  righe in docs/decisioni.md.
- Prove: DashboardApiTests (riga del Giro, importati esclusi, domande sbagliate),
  DesktopCompositionTests (/dashboard), GuideTests; DashboardInterfaceTests con Chromium
  (miniature, anteprima, frecce, Esc, una colonna sotto i 1000 px), solo nella CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-25 16:00:02 +01:00
1 parent 0547c747c5
commit 34fe5e9073
31 files changed
+265 -78

No files matched your search

+11 -4
View File
@@ -47,16 +47,23 @@ public static class ActivityApi
endpoints.MapGet("/api/alerts", async (IFebeStorage storage, IClock clock, CancellationToken ct) =>
ApiHttp.Json(await AlertsAsync(storage, clock, ct).ConfigureAwait(false), FebeJsonContext.Default.AlertListDto));
// The thumbnails of a line of the history (spec §7.9): asked by the page only when the line is in view.
// The thumbnails of a line of the history (spec §7.9): asked by the page only when the line is in view. Without
// «account» (the Giro dei seguiti saves posts of many accounts), what arrived of every account in that time.
endpoints.MapGet("/api/activity/arrived", async (HttpContext context, IFebeStorage storage, IClock clock, CancellationToken ct) =>
{
var query = context.Request.Query;
if (!long.TryParse(query["account"].ToString(), NumberStyles.None, CultureInfo.InvariantCulture, out var account)
|| !TryTime(query["from"].ToString(), out var from)
var accountText = query["account"].ToString();
long? account = null;
if (accountText.Length > 0)
{
account = long.TryParse(accountText, NumberStyles.None, CultureInfo.InvariantCulture, out var id) ? id : throw new BadRequestException("Account non valido.");
}
if (!TryTime(query["from"].ToString(), out var from)
|| !TryTime(query["to"].ToString(), out var to)
|| to < from)
{
throw new BadRequestException("Indica account, inizio e fine.");
throw new BadRequestException("Indica inizio e fine.");
}
var limit = int.TryParse(query["limit"].ToString(), NumberStyles.None, CultureInfo.InvariantCulture, out var n) ? Math.Clamp(n, 1, ArrivedLimit) : ArrivedShown;
+5 -4
View File
@@ -84,7 +84,7 @@ Tutti con un ripiego registrato con `TryAdd`; la composizione registra i propri
| Veste | Opzioni | Effetto |
|---|---|---|
| Docker | `Edition = Docker`, `Access = Password`, `Password = FEBE_PASSWORD`, `AllowedHosts` = nomi con cui si raggiunge il server (anche `nome:*`), `FebeListen.Any(8480)` | Pagina `/accesso`, cookie `febe_sessione` HttpOnly SameSite=Strict, blocco dopo 5 errori per client e 20 in tutto in 15 minuti. Senza password risponde solo alla pagina dell'errore (indirizzi delle pagine, file dell'interfaccia, `GET /api/capabilities` e `/api/preferences`, `/salute`); tutto il resto, vista remota compresa, 503 |
| Windows | `Edition = Desktop`, `Access = Token`, `AccessToken = AccessToken.Create()`, `AllowedHosts = FebeWebOptions.LoopbackHosts(porta)`, `FebeListen.Loopback(0)` | La finestra apre `/?gettone=…` una volta: il gettone diventa un cookie HttpOnly Strict e sparisce dall'indirizzo. Anche l'intestazione `X-Febe-Gettone` vale |
| Windows | `Edition = Desktop`, `Access = Token`, `AccessToken = AccessToken.Create()`, `AllowedHosts = FebeWebOptions.LoopbackHosts(porta)`, `FebeListen.Loopback(0)` | La finestra apre `/dashboard?gettone=…` una volta: il gettone diventa un cookie HttpOnly Strict e sparisce dall'indirizzo. Anche l'intestazione `X-Febe-Gettone` vale |
| Prove e dimostrazione | `Access = None` | Solo su 127.0.0.1 |
Sempre attivi: nome Host in elenco (altrimenti 400), Origin uguale all'Host per ogni comando, per `/api/eventi` e
@@ -119,10 +119,11 @@ sono anche `day` (`aaaa-mm-gg`) e `clock` calcolati sul fuso di Febe.
| `GET /accesso`, `POST /api/accesso`, `POST /api/uscita` | Accesso con password |
| `GET /api/connection`, `POST /api/connection/begin` (`{ openLogin }`), `/finish`, `/cancel`, `/disconnect` | Collegamento a Instagram (`IConnectionService`, §6.4): stato `notConnected`, `connected`, `verificationRequired`, `browserUnavailable` |
| `GET /api/engine/incidents` | Incidenti degli ultimi 14 giorni (rallentamenti, verifiche, arresti), con un consiglio dopo 3 rallentamenti in 7 giorni |
| `POST /api/engine/recipes/{ricetta}/resume` | «Riattiva» una ricetta sospesa dopo tre problemi di fila (`IEngineControl.ResumeRecipeAsync`: metodo con un'implementazione predefinita che risponde «non era sospesa», così le altre implementazioni non cambiano). Attività mostra le ricette sospese da `snapshot.suspendedRecipes` |
| `GET /api/alerts` | Avvisi degli ultimi 14 giorni (§13.3, sezione «Avvisi» di Attività): righe della cronologia con i codici di `AlertCatalog.Codes`, compresi gli avvisi non arrivati |
| `POST /api/engine/recipes/{ricetta}/resume` | «Riattiva» una ricetta sospesa dopo tre problemi di fila (`IEngineControl.ResumeRecipeAsync`: metodo con un'implementazione predefinita che risponde «non era sospesa», così le altre implementazioni non cambiano). La Dashboard mostra le ricette sospese da `snapshot.suspendedRecipes` |
| `GET /api/alerts` | Avvisi degli ultimi 14 giorni (§13.3, sezione «Avvisi» della Dashboard): righe della cronologia con i codici di `AlertCatalog.Codes`, compresi gli avvisi non arrivati |
| `GET /api/engine/diagnostica` | «Esporta il rapporto di diagnostica» (issue #39, §7.9): file JSON `febe-diagnostica-aaaa-mm-gg.json` (giorno locale) in allegato, `no-store`, UTF-8 senza BOM, da `DiagnosticReport.Write` con le tracce di `IDiagnosticSource`. Nessun valore dei dati: solo conteggi, misure, orari, codici da elenchi chiusi e forme degli indirizzi. In testa `righeRovinate`, `erroriRegistratore`, `fileIlleggibili` e `sessioniSenzaFine` (`IDiagnosticSource.GatherAsync`). Risponde anche con un problema di configurazione (`ConfigurationGateMiddleware.AllowedApi`), con gli elenchi vuoti: il motore non è partito |
| `GET /api/browser/preview`, `GET /api/browser/preview/frame` | Anteprima del browser in Attività: indirizzo e immagine JPEG (`no-store`, 404 se non c'è) |
| `GET /api/browser/preview`, `GET /api/browser/preview/frame` | Anteprima del browser nella Dashboard: indirizzo e immagine JPEG (`no-store`, 404 se non c'è), al più un fotogramma nuovo al secondo |
| `GET /api/activity/arrived?account=&from=&to=&limit=` | Miniature di una riga della cronologia della Dashboard (§7.9): gli elementi scaricati da Febe (mai gli importati) scoperti fra `from` e `to`, dell'account o, senza `account`, di tutti (righe del Giro dei seguiti); tessere come la Libreria, al più `limit` (8, fino a 60), e `total` |
| `GET /api/duplicates/count`, `GET /api/duplicates?after=`, `POST /api/duplicates/{pairId}` (`{ decision, applyToAll }`) | Doppioni dopo uno scaricamento (§9.5): `keepLarger`, `keepExisting`, `keepBoth`; niente si decide da solo |
| `GET/PUT /api/settings/general`, `POST /api/settings/naming-preview`, `/pick-folder`, `/data-folder` | Cartelle (cambio della libreria solo desktop), schema dei nomi con anteprima, tema, avvio, area di notifica |
| `GET/PUT /api/settings/limits` | Profilo di prudenza, orari, sessioni, tetti, avvio graduale; le regole di §7.5 rispondono 400 con i messaggi italiani |
+9
View File
@@ -703,6 +703,15 @@ a.stato:hover{border-color:var(--bordo-forte)}
.cruscotto .anteprima{width:100%}
.storia-coda{grid-template-columns:minmax(0,1fr)}
}
@media (max-width:560px){
/* On the phone the preview stays at the top but lower, so that what is happening and the budgets fit too */
.cruscotto{padding:12px;gap:14px}
.cruscotto .anteprima .quadro{height:196px}
.miniatura,.miniature-altre{width:40px;height:40px}
.miniature{min-height:40px}
.anteprima-palco{height:min(52vh,460px)}
.anteprima-scena .btn.tondo{width:30px;height:30px}
}
.ora-pannello{display:flex;align-items:center;gap:24px;padding:18px 18px 18px 24px;min-height:142px}
.ora-testo{flex:1;min-width:0}
.ora-testo .riga{display:flex;align-items:center;gap:10px}
@@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round">
<rect x="3.5" y="3.5" width="7" height="9" rx="1.5"/>
<rect x="13.5" y="3.5" width="7" height="5" rx="1.5"/>
<rect x="13.5" y="11.5" width="7" height="9" rx="1.5"/>
<rect x="3.5" y="15.5" width="7" height="5" rx="1.5"/>
</svg>

After

Width:  |  Height:  |  Size: 397 B

+1 -1
View File
@@ -12,7 +12,7 @@ import { avatar, showError, toast, closeMenu } from './ui.js';
import { routes } from '../routes.js';
const NAV = [
{ key: 'dashboard', href: '/dashboard', icon: 'activity' },
{ key: 'dashboard', href: '/dashboard', icon: 'layout-dashboard' },
{ key: 'libreria', href: '/libreria', icon: 'layout-grid' },
{ key: 'account', href: '/account', icon: 'users' },
{ key: 'importa', href: '/importa', icon: 'folder-input' },
+26 -9
View File
@@ -374,7 +374,7 @@ function historyBox(page) {
page.onLeave(() => watcher && watcher.disconnect());
function keyOf(r) {
return `${r.accountId}|${r.from}|${r.at}`;
return `${r.accountId || ''}|${r.from}|${r.at}`;
}
async function loadThumbs(holder) {
@@ -388,8 +388,7 @@ function historyBox(page) {
const item = { loading: true, result: null, line: holder.line };
arrived.set(key, item);
try {
const query = new URLSearchParams({ account: String(holder.line.accountId), from: holder.line.from, to: holder.line.at, limit: String(THUMBS) });
item.result = await api(`/api/activity/arrived?${query}`, { signal: page.signal });
item.result = await api(`/api/activity/arrived?${arrivedQuery(holder.line, THUMBS)}`, { signal: page.signal });
} catch (error) {
if (error.name === 'AbortError') return;
item.result = { tiles: [], total: 0 };
@@ -423,7 +422,7 @@ function historyBox(page) {
}
const list = h('ul.elenco-attivita.storia-righe', items.map((r) => {
let holder = null;
if (r.accountId && r.from && r.newEntries > 0) {
if (r.from && r.newEntries > 0) {
holder = h('div.miniature', { dataset: { chiave: keyOf(r) }, 'aria-label': t('attivita.arrivate', { n: r.newEntries }), role: 'group' });
holder.line = r;
const known = arrived.get(keyOf(r));
@@ -438,13 +437,23 @@ function historyBox(page) {
}));
fill(element, h('h2', t('attivita.fatto')), h('div.pannello', list));
// Lines no longer shown are forgotten, so that a long day does not keep every answer.
const keys = new Set(items.filter((r) => r.accountId && r.from).map(keyOf));
const keys = new Set(items.filter((r) => r.from).map(keyOf));
for (const key of arrived.keys()) if (!keys.has(key)) arrived.delete(key);
}
return { element, draw };
}
/**
* The question for what a line of the history saved: the recipe's account and time; a line without an account (the
* Giro dei seguiti saves posts of many accounts) asks for what arrived of every account in that time.
*/
function arrivedQuery(line, limit) {
const query = new URLSearchParams({ from: line.from, to: line.at, limit: String(limit) });
if (line.accountId) query.set('account', String(line.accountId));
return query;
}
/** A small tile of the history: the thumbnail of §8.4 with the marks of the mosaic (video length, ring of stories). */
function thumb(tile, onOpen) {
const cover = tile.cover;
@@ -475,8 +484,7 @@ async function openPreview(page, line, firstTiles, total, startIndex) {
// More entries than the thumbnails: the arrows walk all of them (up to the server's limit).
if (total > firstTiles.length) {
try {
const query = new URLSearchParams({ account: String(line.accountId), from: line.from, to: line.at, limit: '60' });
const all = await api(`/api/activity/arrived?${query}`, { signal: page.signal });
const all = await api(`/api/activity/arrived?${arrivedQuery(line, 60)}`, { signal: page.signal });
if (all.tiles.length) tiles = all.tiles;
} catch (error) {
if (error.name === 'AbortError') return;
@@ -492,6 +500,8 @@ async function openPreview(page, line, firstTiles, total, startIndex) {
const prev = h('button.btn.nudo.tondo', { type: 'button', 'aria-label': t('vis.precedente'), onclick: () => step(-1) }, icon('chevron-left'));
const next = h('button.btn.nudo.tondo', { type: 'button', 'aria-label': t('vis.successivo'), onclick: () => step(1) }, icon('chevron-right'));
let closeDialog = null;
// «Apri l'account» follows the arrows: a line of the Giro dei seguiti holds entries of many accounts.
const accountLink = h('a.btn', { onclick: () => closeDialog() }, icon('user'), t('attivita.apriAccount'));
async function entryOf(i) {
const id = tiles[i].id;
@@ -502,6 +512,7 @@ async function openPreview(page, line, firstTiles, total, startIndex) {
async function show() {
const mine = ++token;
const tile = tiles[entryIndex];
accountLink.href = withCarried(`/account/${tile.accountId}/contenuti`);
const entry = await entryOf(entryIndex);
if (mine !== token) return;
const media = entry && entry.media.length ? entry.media[Math.min(fileIndex, entry.media.length - 1)] : null;
@@ -571,12 +582,18 @@ async function openPreview(page, line, firstTiles, total, startIndex) {
className: 'anteprima-cronologia',
build: (close) => {
closeDialog = close;
// The arrows walk the files wherever the focus is in the dialog (also on its buttons); Esc is the dialog's.
document.addEventListener('keydown', onKey);
return {
body: h('div.contenuto', { onkeydown: onKey }, h('div.anteprima-scena', prev, stage, next), caption),
onClose: () => {
token += 1; // an entry still loading draws nothing any more
document.removeEventListener('keydown', onKey);
},
body: h('div.contenuto', h('div.anteprima-scena', prev, stage, next), caption),
footer: h('footer',
position,
h('div.destra',
h('a.btn', { href: withCarried(`/account/${tiles[entryIndex].accountId}/contenuti`), onclick: () => closeDialog() }, icon('user'), t('attivita.apriAccount')),
accountLink,
h('button.btn.primo', {
type: 'button',
onclick: () => {