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

Function toggleCredentialFields

web/scripts/ragnar_modern.js:20512–20568  ·  view source on GitHub ↗

* Toggle credential form fields based on auth type

()

Source from the content-addressed store, hash-verified

20510 updateWifiStatus('Error checking Wi-Fi status', 'error');
20511
20512 const statusIndicator = document.getElementById('wifi-status-indicator');
20513 const wifiInfo = document.getElementById('wifi-info');
20514
20515 if (statusIndicator) {
20516 statusIndicator.textContent = 'Error';
20517 statusIndicator.className = 'text-sm px-2 py-1 rounded bg-red-700 text-red-300';
20518 }
20519 if (wifiInfo) {
20520 wifiInfo.textContent = 'Error checking Wi-Fi status';
20521 }
20522 const connectedList = document.getElementById('wifi-connected-list');
20523 if (connectedList) {
20524 connectedList.innerHTML = '<div class="text-xs text-red-300">Unable to load adapter list</div>';
20525 connectedList.classList.remove('hidden');
20526 }
20527 wifiMultiInterfaceState = null;
20528 setWifiInterfaceMetadata([]);
20529 renderDashboardMultiInterfaceSummary(null);
20530 renderConnectTabMultiInterface(null);
20531 }
20532}
20533
20534// ============================================================================
20535// ETHERNET / LAN STATUS
20536// ============================================================================
20537
20538async function refreshEthernetStatus() {
20539 const indicator = document.getElementById('lan-status-indicator');
20540 const info = document.getElementById('lan-info');
20541 const listEl = document.getElementById('lan-interface-list');
20542
20543 try {
20544 const data = await fetchAPI('/api/ethernet/status');
20545
20546 if (!indicator || !info) return;
20547
20548 if (data.active && data.active_interface) {
20549 const iface = data.active_interface;
20550 indicator.className = 'text-sm px-2 py-1 rounded bg-green-900/50 text-green-400';
20551 indicator.textContent = 'Connected';
20552 info.innerHTML = `<span class="text-green-400 font-medium">${escapeHtml(iface.name)}</span> &mdash; ${escapeHtml(iface.ip_address || 'No IP')}`;
20553 if (iface.network_cidr) {
20554 info.innerHTML += `<br><span class="text-gray-500 text-xs">Network: ${escapeHtml(iface.network_cidr)}</span>`;
20555 }
20556 } else if (data.available) {
20557 indicator.className = 'text-sm px-2 py-1 rounded bg-yellow-900/50 text-yellow-400';
20558 indicator.textContent = 'No Link';
20559 info.textContent = 'Ethernet interface found but no active connection';
20560 } else {
20561 indicator.className = 'text-sm px-2 py-1 rounded bg-gray-700 text-gray-400';
20562 indicator.textContent = 'Not Found';
20563 info.textContent = 'No Ethernet interfaces detected';
20564 }
20565
20566 // Show interface list
20567 if (listEl && data.interfaces && data.interfaces.length > 0) {
20568 listEl.innerHTML = data.interfaces.map(iface => {
20569 const statusColor = iface.connected ? 'text-green-400' : iface.has_carrier ? 'text-yellow-400' : 'text-gray-500';

Callers 2

clearCredentialFormFunction · 0.70
editTargetCredentialFunction · 0.70

Calls 1

addMethod · 0.80

Tested by

no test coverage detected