spaxel/dashboard/node_modules/istanbul-reports/lib/html-spa/src/summaryHeader.js
jedarden c817e96802 feat: implement repeated-setting change detection with guided calibration
Detects when user changes same config setting 3+ times within 24 hours.
Shows non-intrusive prompt offering help with guided calibration flow.

Guided calibration features:
- Test for false positives (walk around room)
- Test for missed motion (sit still)
- Suggest optimal value based on diurnal baseline SNR and link health
- Apply suggested value button

Files:
- dashboard/js/proactive.js: Complete implementation with localStorage tracking

Acceptance:
- Help prompt fires after 3+ changes in 24h
- Calibration flow tests both directions
- Suggests value based on system data
- Apply button works
2026-04-11 00:18:19 -04:00

63 lines
1.9 KiB
JavaScript

const React = require('react');
function Ignores({ metrics, metricsToShow }) {
const metricKeys = Object.keys(metricsToShow);
const result = [];
for (let i = 0; i < metricKeys.length; i++) {
const metricKey = metricKeys[i];
if (metricsToShow[metricKey]) {
const skipped = metrics[metricKey].skipped;
if (skipped > 0) {
result.push(
`${skipped} ${metricKey}${
skipped === 1 ? '' : metricKey === 'branch' ? 'es' : 's'
}`
);
}
}
}
if (result.length === 0) {
return false;
}
return (
<div className="toolbar__item">
<span className="strong">{result.join(', ')}</span>
<span className="quiet">Ignored</span>
</div>
);
}
function StatusMetric({ data, name }) {
return (
<div className="toolbar__item">
<span className="strong">{data.pct}%</span>{' '}
<span className="quiet">{name}</span>{' '}
<span className={'fraction ' + data.classForPercent}>
{data.covered}/{data.total}
</span>
</div>
);
}
module.exports = function SummaryHeader({ metrics, metricsToShow }) {
return (
<div className="toolbar">
{metricsToShow.statements && (
<StatusMetric data={metrics.statements} name="Statements" />
)}
{metricsToShow.branches && (
<StatusMetric data={metrics.branches} name="Branches" />
)}
{metricsToShow.functions && (
<StatusMetric data={metrics.functions} name="Functions" />
)}
{metricsToShow.lines && (
<StatusMetric data={metrics.lines} name="Lines" />
)}
<Ignores metrics={metrics} metricsToShow={metricsToShow} />
</div>
);
};