@cccarv82/freya 2.16.0 → 2.17.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 +0 -78
- package/cli/web.js +349 -496
- package/package.json +2 -3
- package/scripts/build-vector-index.js +87 -35
- package/templates/base/scripts/build-vector-index.js +87 -35
- package/scripts/generate-weekly-report.js +0 -128
package/cli/web-ui.js
CHANGED
|
@@ -1283,83 +1283,6 @@
|
|
|
1283
1283
|
}
|
|
1284
1284
|
}
|
|
1285
1285
|
|
|
1286
|
-
async function refreshIncidents() {
|
|
1287
|
-
try {
|
|
1288
|
-
const r = await api('/api/incidents', { dir: dirOrDefault() });
|
|
1289
|
-
const el = $('incidentsBox');
|
|
1290
|
-
if (el) {
|
|
1291
|
-
const md = r.markdown || '';
|
|
1292
|
-
if (!md) { el.innerHTML = '<div class="help">Nenhum incidente registrado.</div>'; return; }
|
|
1293
|
-
const lines = md.split(/\n/);
|
|
1294
|
-
const cards = [];
|
|
1295
|
-
let current = null;
|
|
1296
|
-
for (const line of lines) {
|
|
1297
|
-
if (line.startsWith('- **')) {
|
|
1298
|
-
if (current) cards.push(current);
|
|
1299
|
-
current = { title: line.replace('- **', '').replace('**', '').trim(), body: [] };
|
|
1300
|
-
} else if (current && line.trim().startsWith('- ')) {
|
|
1301
|
-
current.body.push(line.trim().replace(/^- /, ''));
|
|
1302
|
-
}
|
|
1303
|
-
}
|
|
1304
|
-
if (current) cards.push(current);
|
|
1305
|
-
el.innerHTML = '';
|
|
1306
|
-
if (!cards.length) { el.innerHTML = renderMarkdown(md); return; }
|
|
1307
|
-
for (let idx = 0; idx < cards.length; idx++) {
|
|
1308
|
-
const c = cards[idx];
|
|
1309
|
-
const card = document.createElement('div');
|
|
1310
|
-
card.className = 'reportCard';
|
|
1311
|
-
const dateLine = c.body.find((b) => b.toLowerCase().includes('data'));
|
|
1312
|
-
const impactLine = c.body.find((b) => b.toLowerCase().includes('descricao') || b.toLowerCase().includes('impacto'));
|
|
1313
|
-
const statusLine = c.body.find((b) => /^status\s*:/i.test(b));
|
|
1314
|
-
const statusRaw = statusLine ? statusLine.split(':').slice(1).join(':').trim().toLowerCase() : '';
|
|
1315
|
-
let statusKey = '';
|
|
1316
|
-
if (['open', 'aberto', 'aberta'].includes(statusRaw)) statusKey = 'open';
|
|
1317
|
-
else if (['mitigating', 'mitigando', 'mitigacao', 'mitigação'].includes(statusRaw)) statusKey = 'mitigating';
|
|
1318
|
-
else if (['resolved', 'resolvido', 'resolvida', 'closed', 'fechado', 'fechada'].includes(statusRaw)) statusKey = 'resolved';
|
|
1319
|
-
|
|
1320
|
-
card.innerHTML = '<div class="reportTitle">' + escapeHtml(c.title) + '</div>'
|
|
1321
|
-
+ (dateLine ? ('<div class="reportMeta">' + escapeHtml(dateLine) + '</div>') : '')
|
|
1322
|
-
+ (impactLine ? ('<div class="help" style="margin-top:4px">' + escapeHtml(impactLine) + '</div>') : '')
|
|
1323
|
-
+ c.body.filter((b) => b !== dateLine && b !== impactLine && b !== statusLine).map((b) => '<div class="help" style="margin-top:4px">' + escapeHtml(b) + '</div>').join('');
|
|
1324
|
-
|
|
1325
|
-
if (statusKey) {
|
|
1326
|
-
const actions = document.createElement('div');
|
|
1327
|
-
actions.className = 'reportActions';
|
|
1328
|
-
actions.style.display = 'flex';
|
|
1329
|
-
actions.style.gap = '8px';
|
|
1330
|
-
actions.style.marginTop = '8px';
|
|
1331
|
-
actions.style.flexWrap = 'wrap';
|
|
1332
|
-
|
|
1333
|
-
const label = statusKey === 'open' ? 'aberto' : (statusKey === 'mitigating' ? 'mitigando' : 'resolvido');
|
|
1334
|
-
const pillClass = statusKey === 'resolved' ? 'ok' : (statusKey === 'mitigating' ? 'info' : 'warn');
|
|
1335
|
-
const pill = document.createElement('span');
|
|
1336
|
-
pill.className = 'pill ' + pillClass;
|
|
1337
|
-
pill.textContent = label;
|
|
1338
|
-
actions.appendChild(pill);
|
|
1339
|
-
|
|
1340
|
-
if (statusKey !== 'resolved') {
|
|
1341
|
-
const btn = document.createElement('button');
|
|
1342
|
-
btn.className = 'btn small';
|
|
1343
|
-
btn.type = 'button';
|
|
1344
|
-
btn.textContent = 'Marcar resolvido';
|
|
1345
|
-
btn.onclick = async () => {
|
|
1346
|
-
await api('/api/incidents/resolve', { dir: dirOrDefault(), title: c.title, index: idx });
|
|
1347
|
-
await refreshIncidents();
|
|
1348
|
-
};
|
|
1349
|
-
actions.appendChild(btn);
|
|
1350
|
-
}
|
|
1351
|
-
|
|
1352
|
-
card.appendChild(actions);
|
|
1353
|
-
}
|
|
1354
|
-
|
|
1355
|
-
el.appendChild(card);
|
|
1356
|
-
}
|
|
1357
|
-
}
|
|
1358
|
-
} catch {
|
|
1359
|
-
const el = $('incidentsBox');
|
|
1360
|
-
if (el) el.textContent = 'Falha ao carregar incidentes.';
|
|
1361
|
-
}
|
|
1362
|
-
}
|
|
1363
1286
|
|
|
1364
1287
|
function setHeatmapSort(sort) {
|
|
1365
1288
|
state.heatmapSort = sort;
|
|
@@ -2686,7 +2609,6 @@
|
|
|
2686
2609
|
window.refreshProjects = refreshProjects;
|
|
2687
2610
|
window.refreshTimeline = refreshTimeline;
|
|
2688
2611
|
window.refreshGraph = refreshGraph;
|
|
2689
|
-
window.refreshIncidents = refreshIncidents;
|
|
2690
2612
|
window.refreshHeatmap = refreshHeatmap;
|
|
2691
2613
|
window.setHeatmapSort = setHeatmapSort;
|
|
2692
2614
|
window.setTimelineKind = setTimelineKind;
|