@cccarv82/freya 2.8.2 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/web-ui.js +45 -0
- package/cli/web.js +19 -29
- package/package.json +1 -1
package/cli/web-ui.js
CHANGED
|
@@ -1879,6 +1879,50 @@
|
|
|
1879
1879
|
}
|
|
1880
1880
|
}
|
|
1881
1881
|
|
|
1882
|
+
async function runReportPage(name) {
|
|
1883
|
+
// Disable all generation buttons and show spinner
|
|
1884
|
+
const genBtns = document.querySelectorAll('.reportsGenBar button');
|
|
1885
|
+
const spinner = $('reportsGenStatus');
|
|
1886
|
+
genBtns.forEach(b => { b.disabled = true; });
|
|
1887
|
+
if (spinner) spinner.style.display = '';
|
|
1888
|
+
|
|
1889
|
+
try {
|
|
1890
|
+
saveLocal();
|
|
1891
|
+
const r = await api('/api/report', { dir: dirOrDefault(), script: name });
|
|
1892
|
+
|
|
1893
|
+
// Refresh the full reports list and expand the newest report
|
|
1894
|
+
await refreshReportsPage();
|
|
1895
|
+
|
|
1896
|
+
// Auto-expand the first (newest) report in state.reports
|
|
1897
|
+
if (state.reports && state.reports.length > 0) {
|
|
1898
|
+
const newest = state.reports[0];
|
|
1899
|
+
state.reportExpanded[newest.relPath] = true;
|
|
1900
|
+
// Store the generated text directly so the card shows it immediately
|
|
1901
|
+
if (r.reportText) {
|
|
1902
|
+
state.reportTexts[newest.relPath] = r.reportText;
|
|
1903
|
+
}
|
|
1904
|
+
renderReportsPage();
|
|
1905
|
+
// Scroll to top of reportsGrid so user sees the expanded card
|
|
1906
|
+
const grid = $('reportsGrid');
|
|
1907
|
+
if (grid) grid.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
1908
|
+
}
|
|
1909
|
+
} catch (e) {
|
|
1910
|
+
// Show error inline in the gen bar
|
|
1911
|
+
if (spinner) {
|
|
1912
|
+
spinner.style.display = '';
|
|
1913
|
+
spinner.textContent = '❌ ' + (e && e.message ? e.message : 'Erro ao gerar relatório');
|
|
1914
|
+
setTimeout(() => {
|
|
1915
|
+
if (spinner) { spinner.style.display = 'none'; spinner.textContent = '⏳ Gerando...'; }
|
|
1916
|
+
}, 4000);
|
|
1917
|
+
}
|
|
1918
|
+
} finally {
|
|
1919
|
+
genBtns.forEach(b => { b.disabled = false; });
|
|
1920
|
+
if (spinner && !spinner.textContent.startsWith('❌')) {
|
|
1921
|
+
spinner.style.display = 'none';
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1925
|
+
|
|
1882
1926
|
async function exportObsidian() {
|
|
1883
1927
|
try {
|
|
1884
1928
|
setPill('run', 'exporting…');
|
|
@@ -2298,6 +2342,7 @@
|
|
|
2298
2342
|
window.doMigrate = doMigrate;
|
|
2299
2343
|
window.pickDir = pickDir;
|
|
2300
2344
|
window.runReport = runReport;
|
|
2345
|
+
window.runReportPage = runReportPage;
|
|
2301
2346
|
window.publish = publish;
|
|
2302
2347
|
window.refreshReports = refreshReports;
|
|
2303
2348
|
window.refreshToday = refreshToday;
|
package/cli/web.js
CHANGED
|
@@ -1257,23 +1257,6 @@ function buildHtml(safeDefault, appVersion) {
|
|
|
1257
1257
|
</div>
|
|
1258
1258
|
</section>
|
|
1259
1259
|
|
|
1260
|
-
<section class="utilityGrid" id="dashboardControls" style="display:grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 24px;">
|
|
1261
|
-
<div class="utilityCard" style="display:flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px;">
|
|
1262
|
-
<div>
|
|
1263
|
-
<div class="utilityHead" style="margin-bottom: 4px; color: var(--text);">Relatórios Rápidos</div>
|
|
1264
|
-
<div class="help" style="margin: 0;">Gere relatórios sintéticos instantaneamente</div>
|
|
1265
|
-
</div>
|
|
1266
|
-
<div style="display:flex; gap: 8px; flex-wrap: wrap;">
|
|
1267
|
-
<button class="btn" style="min-width: 100px; padding: 6px 12px; font-weight: 500;" type="button" onclick="runReport('status')">Executivo</button>
|
|
1268
|
-
<button class="btn" style="min-width: 100px; padding: 6px 12px; font-weight: 500;" type="button" onclick="runReport('sm-weekly')">SM Semanal</button>
|
|
1269
|
-
<button class="btn" style="min-width: 100px; padding: 6px 12px; font-weight: 500; border-color: rgba(239, 68, 68, 0.4); color: #f87171;" type="button" onclick="runReport('blockers')">Bloqueios</button>
|
|
1270
|
-
<button class="btn" style="min-width: 100px; padding: 6px 12px; font-weight: 500;" type="button" onclick="runReport('daily')">Daily</button>
|
|
1271
|
-
</div>
|
|
1272
|
-
</div>
|
|
1273
|
-
</section>
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
1260
|
<div class="centerHead">
|
|
1278
1261
|
<div>
|
|
1279
1262
|
<h1 style="margin:0">Seu dia em um painel</h1>
|
|
@@ -1311,6 +1294,7 @@ function buildHtml(safeDefault, appVersion) {
|
|
|
1311
1294
|
<b>Relatórios Recentes</b>
|
|
1312
1295
|
<div class="stack">
|
|
1313
1296
|
<button class="btn small" type="button" onclick="refreshReports()">Atualizar</button>
|
|
1297
|
+
<button class="btn small" type="button" onclick="window.location.href='/reports'">Ver todos →</button>
|
|
1314
1298
|
</div>
|
|
1315
1299
|
</div>
|
|
1316
1300
|
<div class="panelBody panelScroll" style="max-height: 300px;">
|
|
@@ -1428,6 +1412,21 @@ function buildReportsHtml(safeDefault, appVersion) {
|
|
|
1428
1412
|
</div>
|
|
1429
1413
|
</section>
|
|
1430
1414
|
|
|
1415
|
+
<!-- Report Generation Bar -->
|
|
1416
|
+
<section class="reportsGenBar" style="display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:16px; padding:16px; background:var(--paper2); border-radius:8px; border:1px solid var(--border);">
|
|
1417
|
+
<div style="flex:1; min-width:140px;">
|
|
1418
|
+
<div style="font-size:13px; font-weight:600; color:var(--text); margin-bottom:2px;">Gerar Novo Relatório</div>
|
|
1419
|
+
<div style="font-size:12px; color:var(--muted);">O relatório gerado aparecerá no topo da lista</div>
|
|
1420
|
+
</div>
|
|
1421
|
+
<div style="display:flex; gap:8px; flex-wrap:wrap; align-items:center;">
|
|
1422
|
+
<button class="btn" style="min-width:110px;" type="button" onclick="runReportPage('daily')">📅 Daily</button>
|
|
1423
|
+
<button class="btn" style="min-width:110px;" type="button" onclick="runReportPage('status')">📊 Executivo</button>
|
|
1424
|
+
<button class="btn" style="min-width:110px; border-color:rgba(239,68,68,0.4); color:#f87171;" type="button" onclick="runReportPage('blockers')">🚧 Bloqueios</button>
|
|
1425
|
+
<button class="btn" style="min-width:110px;" type="button" onclick="runReportPage('sm-weekly')">📋 SM Weekly</button>
|
|
1426
|
+
<span id="reportsGenStatus" style="font-size:12px; color:var(--muted); display:none;">⏳ Gerando...</span>
|
|
1427
|
+
</div>
|
|
1428
|
+
</section>
|
|
1429
|
+
|
|
1431
1430
|
<section class="reportsTools" style="display:flex; gap:12px; align-items:center;">
|
|
1432
1431
|
<div class="tabs" style="display:flex; gap:8px;" id="reportsTabs">
|
|
1433
1432
|
<button class="pill ok" id="tabChrono" onclick="setReportsTab('chrono')">Cronológico</button>
|
|
@@ -1818,12 +1817,9 @@ function buildCompanionHtml(safeDefault, appVersion) {
|
|
|
1818
1817
|
</div>
|
|
1819
1818
|
</section>
|
|
1820
1819
|
|
|
1821
|
-
<
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
<button class="btn" type="button" onclick="runReport('status')">Gerar Status</button>
|
|
1825
|
-
<button class="btn" type="button" onclick="runReport('sm-weekly')">Gerar SM Weekly</button>
|
|
1826
|
-
</section>
|
|
1820
|
+
<button class="btn small" type="button" onclick="window.location.href='/reports'" style="margin-bottom: 16px;">
|
|
1821
|
+
📊 Ver / Gerar Relatórios →
|
|
1822
|
+
</button>
|
|
1827
1823
|
|
|
1828
1824
|
<!-- BENTO GRID LAYOUT -->
|
|
1829
1825
|
<div style="display: grid; grid-template-columns: 1fr 1.5fr; gap: 24px; align-items: start;">
|
|
@@ -1903,12 +1899,6 @@ function buildCompanionHtml(safeDefault, appVersion) {
|
|
|
1903
1899
|
</div>
|
|
1904
1900
|
</section>
|
|
1905
1901
|
|
|
1906
|
-
<section class="panel">
|
|
1907
|
-
<div class="panelHead"><b>Saída de Relatório</b></div>
|
|
1908
|
-
<div class="panelBody">
|
|
1909
|
-
<div id="reportPreview" class="log md" style="font-family: var(--sans);"></div>
|
|
1910
|
-
</div>
|
|
1911
|
-
</section>
|
|
1912
1902
|
</div>
|
|
1913
1903
|
|
|
1914
1904
|
</div>
|
package/package.json
CHANGED