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

Function renderNetworkMap

web/scripts/ragnar_modern.js:21059–21217  ·  view source on GitHub ↗
(nodes, links, deviceColors, deviceIcons)

Source from the content-addressed store, hash-verified

21057 fetchNetworkStats();
21058
21059 // Auto-refresh every 5 seconds when on system tab
21060 if (systemMonitoringInterval) {
21061 clearInterval(systemMonitoringInterval);
21062 }
21063
21064 systemMonitoringInterval = setInterval(() => {
21065 if (currentTab === 'system') {
21066 fetchSystemStatus();
21067 fetchNetworkStats();
21068 }
21069 }, 5000);
21070}
21071
21072function fetchSystemStatus() {
21073 networkAwareFetch('/api/system/status')
21074 .then(response => response.json())
21075 .then(data => {
21076 if (data.error) {
21077 showSystemError('Failed to load system status: ' + data.error);
21078 return;
21079 }
21080 updateSystemOverview(data);
21081 updateProcessList(data.processes);
21082 updateNetworkInterfaces(data.network_interfaces);
21083 updateTemperatureDisplay(data.temperatures);
21084 })
21085 .catch(error => {
21086 console.error('Error fetching system status:', error);
21087 showSystemError('Failed to load system status');
21088 });
21089}
21090
21091function fetchNetworkStats() {
21092 networkAwareFetch('/api/system/network-stats')
21093 .then(response => response.json())
21094 .then(data => {
21095 if (data.error) {
21096 console.error('Network stats error:', data.error);
21097 return;
21098 }
21099 updateNetworkStats(data);
21100 })
21101 .catch(error => {
21102 console.error('Error fetching network stats:', error);
21103 });
21104}
21105
21106function updateSystemOverview(data) {
21107 // CPU
21108 const cpuUsage = document.getElementById('cpu-usage');
21109 const cpuDetails = document.getElementById('cpu-details');
21110 const cpuProgress = document.getElementById('cpu-progress');
21111
21112 if (cpuUsage) cpuUsage.textContent = `${data.cpu.percent}%`;
21113 if (cpuDetails) cpuDetails.textContent = `${data.cpu.count} cores`;
21114 if (cpuProgress) cpuProgress.style.width = `${data.cpu.percent}%`;
21115
21116 // Memory

Callers 1

loadNetworkMapFunction · 0.70

Calls 7

nodeColorFunction · 0.85
nodeRadiusFunction · 0.85
appendMethod · 0.80
addMethod · 0.80
openHostPanelFunction · 0.70
escapeHtmlFunction · 0.70
stopMethod · 0.45

Tested by

no test coverage detected