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

Function loadAIInsights

web/scripts/ragnar_modern.js:15237–15293  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15235 const indicator = document.createElement('span');
15236 indicator.className = 'update-indicator absolute -top-1 -right-1 w-3 h-3 bg-orange-500 rounded-full pulse-glow';
15237 configTabBtn.style.position = 'relative';
15238 configTabBtn.appendChild(indicator);
15239 }
15240 } else {
15241 // Remove update indicator if up to date
15242 const configTabBtn = document.querySelector('[data-tab="config"]');
15243 const indicator = configTabBtn?.querySelector('.update-indicator');
15244 if (indicator) {
15245 indicator.remove();
15246 }
15247 }
15248
15249 } catch (error) {
15250 // Silently fail for background checks
15251 console.debug('Background update check failed:', error);
15252 }
15253}
15254
15255async function restartService() {
15256 if (!confirm('This will restart the Ragnar service. The web interface may be temporarily unavailable. Continue?')) {
15257 return;
15258 }
15259
15260 try {
15261 addConsoleMessage('Restarting Ragnar service...', 'info');
15262 updateElement('service-status', 'Restarting...');
15263 document.getElementById('service-status').className = 'text-sm px-2 py-1 rounded bg-yellow-700 text-yellow-300';
15264
15265 const data = await postAPI('/api/system/restart-service', {});
15266
15267 if (data.success) {
15268 addConsoleMessage('Service restart initiated', 'success');
15269 addConsoleMessage('Service will be back online shortly...', 'info');
15270
15271 // Update status after delay
15272 setTimeout(() => {
15273 updateElement('service-status', 'Running');
15274 document.getElementById('service-status').className = 'text-sm px-2 py-1 rounded bg-green-700 text-green-300';
15275 addConsoleMessage('Service restart completed', 'success');
15276 }, 10000); // 10 seconds delay
15277 } else {
15278 addConsoleMessage(`Service restart failed: ${data.error || 'Unknown error'}`, 'error');
15279 updateElement('service-status', 'Error');
15280 document.getElementById('service-status').className = 'text-sm px-2 py-1 rounded bg-red-700 text-red-300';
15281 }
15282
15283 } catch (error) {
15284 console.error('Error restarting service:', error);
15285 addConsoleMessage('Failed to restart service', 'error');
15286 updateElement('service-status', 'Error');
15287 document.getElementById('service-status').className = 'text-sm px-2 py-1 rounded bg-red-700 text-red-300';
15288 }
15289}
15290
15291async function rebootSystem() {
15292 if (!confirm('This will reboot the entire system. The device will be offline for several minutes. Continue?')) {
15293 return;
15294 }

Callers 3

loadDashboardDataFunction · 0.70
toggleAIEnabledFunction · 0.70
refreshAIInsightsFunction · 0.70

Calls 3

errorMethod · 0.80
displayAIInsightsFunction · 0.70
networkAwareFetchFunction · 0.70

Tested by

no test coverage detected