MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / updateTrafficBandwidthChart

Function updateTrafficBandwidthChart

web/scripts/ragnar_modern.js:15661–15761  ·  view source on GitHub ↗

* Update bandwidth timeline chart

(summary)

Source from the content-addressed store, hash-verified

15659 const month = Number(digits.slice(4, 6)) - 1;
15660 const day = Number(digits.slice(6, 8));
15661 const hour = digits.length >= 10 ? Number(digits.slice(8, 10)) : 0;
15662 const minute = digits.length >= 12 ? Number(digits.slice(10, 12)) : 0;
15663 const second = digits.length >= 14 ? Number(digits.slice(12, 14)) : 0;
15664
15665 const date = new Date(year, month, day, hour, minute, second);
15666 return Number.isNaN(date.getTime()) ? null : date;
15667}
15668
15669function buildLastScanInfo(rawStatus, isoTimestamp) {
15670 const info = {
15671 label: 'Never',
15672 className: 'text-gray-400',
15673 timestampText: '',
15674 tooltip: '',
15675 rawStatus: rawStatus || '',
15676 rawTimestamp: isoTimestamp || ''
15677 };
15678
15679 let statusPart = (rawStatus || '').toString().trim();
15680 let timestamp = null;
15681
15682 if (statusPart.includes('_')) {
15683 const parts = statusPart.split('_');
15684 statusPart = parts[0];
15685 const timestampCandidate = parts.slice(1).join('_');
15686 timestamp = parseCompactTimestamp(timestampCandidate);
15687 }
15688
15689 if (!timestamp && isoTimestamp) {
15690 const parsed = new Date(isoTimestamp);
15691 if (!Number.isNaN(parsed.getTime())) {
15692 timestamp = parsed;
15693 }
15694 }
15695
15696 if (!timestamp && rawStatus) {
15697 const digits = rawStatus.replace(/[^0-9]/g, '');
15698 if (digits.length >= 8) {
15699 const parsedDigits = parseCompactTimestamp(digits);
15700 if (parsedDigits) {
15701 timestamp = parsedDigits;
15702 }
15703 }
15704 }
15705
15706 const lowerStatus = statusPart.toLowerCase();
15707 if (!statusPart) {
15708 if (timestamp) {
15709 info.label = 'Completed';
15710 info.className = 'text-blue-400';
15711 } else {
15712 info.label = 'Never';
15713 info.className = 'text-gray-400';
15714 }
15715 } else if (lowerStatus.startsWith('success')) {
15716 info.label = 'Success';
15717 info.className = 'text-green-400';
15718 } else if (lowerStatus.startsWith('failed')) {

Callers 1

loadTrafficAnalysisDataFunction · 0.70

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected