131 lines
3.5 KiB
JavaScript
131 lines
3.5 KiB
JavaScript
/**
|
|
* app/assets/js/dashboard.js
|
|
*
|
|
* Dashboard-Modul
|
|
* - Zentrale Übersicht aller Grundfunktionen
|
|
* - Einstiegspunkt für das Tool
|
|
* - Kann später Status, Warnungen, Statistiken anzeigen
|
|
*/
|
|
|
|
window.Dashboard = (function () {
|
|
|
|
// =========================
|
|
// Interne Daten
|
|
// =========================
|
|
|
|
const modules = [
|
|
{
|
|
id: 'device_types',
|
|
label: 'Gerätetypen',
|
|
description: 'Gerätetypen, Port-Definitionen, Module',
|
|
url: '/app/device_types/list.php',
|
|
icon: '🔌'
|
|
},
|
|
{
|
|
id: 'devices',
|
|
label: 'Geräte',
|
|
description: 'Physische Geräte in Racks und Räumen',
|
|
url: '/app/devices/list.php',
|
|
icon: '🖥️'
|
|
},
|
|
{
|
|
id: 'connections',
|
|
label: 'Verbindungen',
|
|
description: 'Kabel, Ports, VLANs, Protokolle',
|
|
url: '/app/connections/list.php',
|
|
icon: '🧵'
|
|
},
|
|
{
|
|
id: 'floors',
|
|
label: 'Standorte & Stockwerke',
|
|
description: 'Gebäude, Etagen, Räume, Dosen',
|
|
url: '/app/floors/list.php',
|
|
icon: '🏢'
|
|
},
|
|
{
|
|
id: 'racks',
|
|
label: 'Serverschränke',
|
|
description: 'Racks, Positionierung, Höheneinheiten',
|
|
url: '/app/racks/list.php',
|
|
icon: '🗄️'
|
|
},
|
|
{
|
|
id: 'network_view',
|
|
label: 'Netzwerk-Ansicht',
|
|
description: 'Grafische Netzwerkdarstellung',
|
|
url: '/network.php',
|
|
icon: '🌐'
|
|
},
|
|
{
|
|
id: 'svg_editor',
|
|
label: 'SVG-Port-Editor',
|
|
description: 'Ports auf Gerätetypen definieren',
|
|
url: '/svg-editor.php',
|
|
icon: '✏️'
|
|
}
|
|
];
|
|
|
|
// =========================
|
|
// Public API
|
|
// =========================
|
|
|
|
function init() {
|
|
console.log('Dashboard initialized');
|
|
|
|
// TODO: Dashboard-Container ermitteln
|
|
// const container = document.querySelector('#dashboard');
|
|
|
|
// TODO: Module rendern
|
|
// renderModules(container);
|
|
|
|
// TODO: Optional: Status-Daten laden (Counts, Warnings)
|
|
}
|
|
|
|
// =========================
|
|
// Render Functions
|
|
// =========================
|
|
|
|
function renderModules(container) {
|
|
if (!container) return;
|
|
|
|
container.innerHTML = '';
|
|
|
|
modules.forEach(module => {
|
|
const el = document.createElement('div');
|
|
el.className = 'dashboard-tile';
|
|
|
|
el.innerHTML = `
|
|
<div class="dashboard-icon">${module.icon}</div>
|
|
<div class="dashboard-content">
|
|
<h3>${module.label}</h3>
|
|
<p>${module.description}</p>
|
|
</div>
|
|
`;
|
|
|
|
el.addEventListener('click', () => {
|
|
window.location.href = module.url;
|
|
});
|
|
|
|
container.appendChild(el);
|
|
});
|
|
}
|
|
|
|
// =========================
|
|
// Optional Erweiterungen
|
|
// =========================
|
|
|
|
// TODO: loadStats() → Anzahl Geräte, offene Ports, unverbundene Dosen
|
|
// TODO: showWarnings() → unverbundene Ports, VLAN-Konflikte
|
|
// TODO: RecentChanges() → letzte Änderungen
|
|
|
|
// =========================
|
|
// Expose Public Methods
|
|
// =========================
|
|
|
|
return {
|
|
init,
|
|
// renderModules // optional öffentlich machen
|
|
};
|
|
|
|
})();
|