Rifiniture (M8): avvisi su striscia, notifiche di Windows e Telegram con controllo dello spazio su disco; «Esporta l'elenco» della libreria; avvisi e ricette sospese in Attività; guida per il wiki in docs/guida

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01Mzbb6zeFTjT6Rp8b92AVkA
This commit is contained in:
Claude committed 2026-10-13 21:22:52 +00:00
1 parent dc4d1fc738
commit 69dbc7acf9
50 files changed
+3980 -28

No files matched your search

+60 -4
View File
@@ -1,7 +1,8 @@
// Attività (mockups 06 and 11, spec §7.9): what the engine is doing now with a still frame of the browser every few
// seconds, the strip of the day, «Limiti di oggi» with the four main budgets and «Tutti i tetti», the queue with
// «verso le» times, «Appena fatto» with the outcomes, and the stops of the last days. It updates by itself from the
// event stream (the demo asks every 30 seconds). The red strip of a stop is drawn by the page frame.
// «verso le» times, «Appena fatto» with the outcomes, the stops of the last days and the alerts (spec §13.3: also the
// ones that are not stops, like a backfill completed or a disk almost full). It updates by itself from the event
// stream (the demo asks every 30 seconds). The red strip of a stop is drawn by the page frame.
import { api, withCarried } from '../core/api.js';
import { h, icon, fill } from '../core/dom.js';
@@ -22,10 +23,12 @@ export default {
const today = h('section.blocco');
const budgets = h('section.blocco');
const lists = h('div.due-colonne');
const suspended = h('div');
const incidents = h('section.blocco');
const alerts = h('section.blocco', { hidden: true });
// On this page «Riprendi» is in the title row: the red strip keeps only «Apri il browser» (mockup 11).
page.root.dataset.pagina = 'attivita';
fill(page.body, h('div.attivita', now, today, budgets, lists, notice, incidents));
fill(page.body, h('div.attivita', now, suspended, today, budgets, lists, notice, incidents, alerts));
let latest = null;
page.onEngine((state) => {
@@ -35,17 +38,20 @@ export default {
drawToday(today, state);
drawBudgets(budgets, state);
drawLists(lists, state);
drawSuspended(suspended, state);
preview.update(state);
});
async function loadSide() {
try {
const [counts, history] = await Promise.all([
const [counts, history, recent] = await Promise.all([
api('/api/duplicates/count', { signal: page.signal }),
api('/api/engine/incidents', { signal: page.signal }),
api('/api/alerts', { signal: page.signal }),
]);
drawNotice(notice, counts);
drawIncidents(incidents, history);
drawAlerts(alerts, recent);
} catch (error) {
if (error.name !== 'AbortError') showError(error);
}
@@ -287,6 +293,56 @@ function drawNotice(box, counts) {
h('a.btn.piccolo', { href: withCarried('/doppioni') }, t('attivita.decidi'))));
}
/** Recipes suspended after three problems in a row (unknown formats, targets not found): what to do, «Riattiva». */
function drawSuspended(box, state) {
const items = state.snapshot.suspendedRecipes || [];
if (!items.length) {
box.replaceChildren();
return;
}
fill(box, items.map((r) => h('div.avviso.rosso.avviso-azione', { style: { marginBottom: '10px' } },
icon('octagon-alert', 's'),
h('span', t('attivita.sospesa', { nome: r.name })),
h('button.btn.piccolo', {
type: 'button',
onclick: async () => {
try {
const result = await api(`/api/engine/recipes/${encodeURIComponent(r.recipe)}/resume`, { method: 'POST' });
toast(result.message, result.resumed ? '' : 'errore');
refreshEngine();
} catch (error) {
showError(error);
}
},
}, t('attivita.riattiva')))));
}
const ALERT_LOOK = {
error: { icon: 'octagon-alert', label: 'rosso' },
warning: { icon: 'triangle-alert', label: 'ambra' },
success: { icon: 'circle-check', label: 'verde' },
info: { icon: 'bell', label: '' },
};
/** «Avvisi»: every alert of the last days, the same ones Telegram and Windows get. Hidden while there are none. */
function drawAlerts(box, recent) {
const items = (recent && recent.items) || [];
box.hidden = !items.length;
if (!items.length) {
box.replaceChildren();
return;
}
fill(box,
h('div.testa-blocco', h('h2', t('attivita.avvisi')), h('span.muto', t('attivita.avvisiAiuto', { giorni: recent.days }))),
h('div.pannello', h('ul.elenco-attivita.largo', items.map((i) => {
const look = ALERT_LOOK[i.level] || ALERT_LOOK.info;
return h('li',
h('span.quando.dati', capitalize(at(i.at))),
h('div.chi-cosa', h('b', i.title), h('span', i.message)),
label(t(`attivita.livelliAvviso.${i.level}`), look.label, look.icon));
}))));
}
function drawIncidents(box, history) {
const items = history.items || [];
fill(box,
+17
View File
@@ -1,5 +1,6 @@
// Libreria (mockup 01, spec §4.6): every entry by publication day, filters by kind, account, period and provenance,
// search by account name and caption, tile size, multiple selection to export or delete, viewer on click.
// «Esporta l'elenco» in the tools row exports what the filter shows (spec §4.8: CSV with «;», UTF-8 with BOM).
import { api, download, withCarried } from '../core/api.js';
import { caps } from '../core/context.js';
@@ -91,6 +92,8 @@ export default {
const size = local.get('libreria.tessere', 160);
const slider = h('input.cursore', { type: 'range', min: '96', max: '300', step: '4', value: String(size), 'aria-label': t('libreria.grandezza') });
const selectButton = h('button.btn', { type: 'button', 'aria-pressed': 'false' }, icon('circle-check'), h('span', t('libreria.seleziona')));
// Icon only, like the tile size: the row of the mockup has no room for one more label.
const exportButton = h('button.btn.nudo.piccolo.solo-icona.solo-largo', { type: 'button', title: t('libreria.esportaAiuto'), 'aria-label': t('libreria.esporta') }, icon('file-down'));
// Probable duplicates after a download wait for Alberto (spec §9.5): a short link to their review.
const duplicates = h('a.btn.nudo.piccolo.doppioni-link', { href: withCarried('/doppioni'), hidden: true });
api('/api/duplicates/count', { signal: page.signal }).then((counts) => {
@@ -104,6 +107,7 @@ export default {
filtersButton,
h('div.destra',
duplicates,
exportButton,
h('div.grandezza.solo-largo', { title: t('libreria.grandezza') }, icon('grid-3x3', 's'), slider, icon('square', 's')),
selectButton)));
@@ -287,6 +291,7 @@ export default {
}
selectButton.addEventListener('click', () => setSelecting(!mosaic.selecting));
exportButton.addEventListener('click', () => exportFiltered());
async function exportSelected() {
try {
@@ -297,6 +302,18 @@ export default {
}
}
async function exportFiltered() {
exportButton.disabled = true;
try {
await download('/api/entries/export', { query: apiQuery(state, today()) }, 'febe-elementi.csv');
toast(t(filtersActive() ? 'libreria.esportatoFiltro' : 'libreria.esportato'));
} catch (error) {
showError(error);
} finally {
exportButton.disabled = false;
}
}
async function deleteSelected() {
const ids = [...mosaic.selected];
const removed = await confirmDelete(ids);
@@ -1,6 +1,7 @@
// Impostazioni, Notifiche (spec §13.3): which events notify, Windows notifications (desktop only), Telegram with the
// bot token (masked, never shown again once saved, never logged) and the chat identifier, and «Invia una prova».
// The Telegram sender arrives with milestone M8: until then the server answers plainly that nothing was sent.
// Telegram: one HTTPS call from the server (TelegramAlertChannel); where no sender is registered (demonstration) the
// page says that no message leaves.
import { api } from '../core/api.js';
import { h, icon, fill } from '../core/dom.js';