feat: Dockerfile und Dashboard-Modul hinzugefügt, .htaccess angepasst und SQL-Initialisierung optimiert
This commit is contained in:
12
Dockerfile
Normal file
12
Dockerfile
Normal file
@@ -0,0 +1,12 @@
|
||||
FROM php:8.3-apache
|
||||
|
||||
# Apache Module aktivieren
|
||||
RUN a2enmod rewrite headers
|
||||
|
||||
# Optional, aber empfehlenswert:
|
||||
# PHP-Einstellungen oder Extensions
|
||||
# RUN docker-php-ext-install pdo pdo_mysql
|
||||
RUN docker-php-ext-install mysqli pdo pdo_mysql
|
||||
|
||||
# Apache soll .htaccess erlauben
|
||||
RUN sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf
|
||||
@@ -41,8 +41,8 @@ DirectoryIndex index.php
|
||||
# =========================
|
||||
# Upload-Sicherheit
|
||||
# =========================
|
||||
<FilesMatch "\.(php|phtml|php3|php4|php5|php7|phps)$">
|
||||
Require all denied
|
||||
</FilesMatch>
|
||||
#<FilesMatch "\./uploads(php|phtml|php3|php4|php5|php7|phps)$">
|
||||
# Require all denied
|
||||
#</FilesMatch>
|
||||
|
||||
# TODO: Optional: Upload-Verzeichnisse (device_types, floorplans) via .htaccess zusätzlich schützen
|
||||
|
||||
@@ -120,3 +120,6 @@ function ajaxPost(url, data, callback) {
|
||||
}
|
||||
|
||||
// TODO: weitere Utility-Funktionen (DOM-Helper, SVG-Helper, etc.)
|
||||
|
||||
// Dashboard initialisieren
|
||||
if (window.Dashboard) window.Dashboard.init();
|
||||
|
||||
130
app/assets/js/dashboard.js
Normal file
130
app/assets/js/dashboard.js
Normal file
@@ -0,0 +1,130 @@
|
||||
/**
|
||||
* 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
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -28,12 +28,7 @@ session_start();
|
||||
require_once __DIR__ . '/lib/_sql.php';
|
||||
|
||||
// TODO: Host, User, Passwort, DB aus config.php nutzen
|
||||
$sql = new SQL(
|
||||
DB_HOST, // z.B. localhost
|
||||
DB_USER, // z.B. netdoc
|
||||
DB_PASSWORD, // z.B. netdoc
|
||||
DB_NAME // z.B. netdoc
|
||||
);
|
||||
$sql = new SQL();
|
||||
|
||||
/* =========================
|
||||
* Helper laden
|
||||
|
||||
@@ -58,7 +58,7 @@ if (file_exists($modulePath)) {
|
||||
require_once $modulePath;
|
||||
} else {
|
||||
// TODO: Fehlerseite oder 404
|
||||
echo "<p>Die Seite existiert noch nicht.</p>";
|
||||
echo "<p>Die Seite existiert noch nicht.</p>".$modulePath;
|
||||
}
|
||||
|
||||
/* =========================
|
||||
|
||||
@@ -171,6 +171,4 @@ class SQL {
|
||||
// echo 'DESTROY';
|
||||
}
|
||||
}
|
||||
|
||||
$sql = new SQL();
|
||||
?>
|
||||
3
app/modules/dashboard/list.php
Normal file
3
app/modules/dashboard/list.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
echo '<p>Dashboard</p>';
|
||||
@@ -1,6 +1,6 @@
|
||||
services:
|
||||
web:
|
||||
image: php:8.3-apache
|
||||
build: .
|
||||
container_name: netdoc_web
|
||||
ports:
|
||||
- "80:80"
|
||||
|
||||
Reference in New Issue
Block a user