- Initialize git repository - Add comprehensive .gitignore (protects .env and secrets) - Fix package.json (correct main entry, add metadata) - Expand .env.example with all required variables and comments - Add README.md with architecture, setup, and commands - Clean up empty scaffolding directories (logs removed, agents/models marked) - Backup previous .env file locally This establishes a safe foundation before further development.
30 lines
No EOL
1 KiB
JavaScript
30 lines
No EOL
1 KiB
JavaScript
function mergeDeviceData(siwDevices, merakiClients) {
|
|
return siwDevices.map(siw => {
|
|
// Primary match: name
|
|
let match = merakiClients.find(m =>
|
|
m.description && siw.name &&
|
|
m.description.toLowerCase().includes(siw.name.toLowerCase())
|
|
);
|
|
|
|
// Fallback: MAC address
|
|
if (!match && siw.mac) {
|
|
match = merakiClients.find(m =>
|
|
m.mac && m.mac.toLowerCase() === siw.mac.toLowerCase()
|
|
);
|
|
}
|
|
|
|
return {
|
|
name: siw.name || siw.deviceName || 'Unknown',
|
|
ip: siw.ip || siw.ipAddress || match?.ip || 'N/A',
|
|
status: match?.status === 'Online' ? '✅ Connected' : '❌ Disconnected',
|
|
lastSeen: match?.lastSeen
|
|
? new Date(match.lastSeen * 1000).toLocaleString()
|
|
: 'N/A',
|
|
deeplink: match?.mac
|
|
? `https://dashboard.meraki.com/o/${match.orgId || 'your-org'}/n/${match.networkId || 'your-net'}/clients?mac=${match.mac}`
|
|
: null
|
|
};
|
|
}).sort((a, b) => a.name.localeCompare(b.name));
|
|
}
|
|
|
|
module.exports = { mergeDeviceData }; |