diff --git a/__pycache__/app.cpython-313.pyc b/__pycache__/app.cpython-313.pyc index 260e300..fd21215 100644 Binary files a/__pycache__/app.cpython-313.pyc and b/__pycache__/app.cpython-313.pyc differ diff --git a/app.py b/app.py index c852b37..acb1558 100644 --- a/app.py +++ b/app.py @@ -2134,14 +2134,14 @@ def get_root_mindmap_data(): print(f"Gefundene Hauptkategorien: {[cat.name for cat in categories]}") - # Basis-Knoten erstellen + # Basis-Knoten erstellen (ohne has_children gesetzt, da Wissen selbst keine Unterkategorien haben soll) nodes = [{ 'id': 'root', 'name': 'Wissen', 'description': 'Zentrale Wissensbasis', 'color_code': '#4299E1', 'is_center': True, - 'has_children': bool(categories), + 'has_children': False, # Geändert, damit "Wissen" selbst keine Unterkategorien hat 'icon': 'fa-solid fa-circle' }] @@ -2153,7 +2153,7 @@ def get_root_mindmap_data(): 'description': category.description or '', 'color_code': category.color_code or '#9F7AEA', 'category': category.name, - 'has_children': bool(len(category.children) > 0), + 'has_children': bool(len(category.children) > 0), # Diese Kategorien haben Unterkategorien 'icon': category.icon or 'fa-solid fa-circle' }) @@ -2207,7 +2207,62 @@ def get_mindmap_data(node_id): 'error': 'Ungültige Knoten-ID', 'details': 'Diese ID ist für spezielle Routen reserviert' }), 400 + + # Prüfen, ob es sich um eine Kategorie-ID handelt (Format: cat_X) + if node_id.startswith('cat_'): + category_id = None + try: + category_id = int(node_id.split('_')[1]) + except (IndexError, ValueError) as e: + print(f"Fehler beim Parsen der Kategorie-ID '{node_id}': {str(e)}") + return jsonify({ + 'success': False, + 'error': 'Ungültige Kategorie-ID', + 'details': f"Die ID '{node_id}' konnte nicht als Kategorie identifiziert werden" + }), 400 + # Kategorie mit Unterkategorien laden + category = Category.query.options( + joinedload(Category.children) + ).get_or_404(category_id) + + # Basis-Knoten erstellen + nodes = [{ + 'id': f'cat_{category.id}', + 'name': category.name, + 'description': category.description or '', + 'color_code': category.color_code or '#9F7AEA', + 'is_center': True, + 'has_children': bool(category.children), + 'icon': category.icon or 'fa-solid fa-circle' + }] + + # Unterkategorien hinzufügen + for subcat in category.children: + nodes.append({ + 'id': f'cat_{subcat.id}', + 'name': subcat.name, + 'description': subcat.description or '', + 'color_code': subcat.color_code or '#9F7AEA', + 'category': category.name, + 'has_children': bool(subcat.children), + 'icon': subcat.icon or 'fa-solid fa-circle' + }) + + # Kanten erstellen (vereinheitlichte Schlüssel) + edges = [{ + 'source': f'cat_{category.id}', + 'target': f'cat_{subcat.id}', + 'strength': 0.8 + } for subcat in category.children] + + return jsonify({ + 'success': True, + 'nodes': nodes, + 'edges': edges + }) + + # Sonst: Normale Knoten-ID # Knoten mit Unterknoten in einer Abfrage laden node = MindMapNode.query.options( joinedload(MindMapNode.children) diff --git a/logs/app.log b/logs/app.log index 62508de..dbbb937 100644 --- a/logs/app.log +++ b/logs/app.log @@ -461,3 +461,69 @@ werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on 2025-05-16 14:04:28,258 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] 2025-05-16 14:04:29,923 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] 2025-05-16 14:04:29,923 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:05:10,551 ERROR: Fehler 404: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. +Endpoint: /.well-known/appspecific/com.chrome.devtools.json, Method: GET, IP: 127.0.0.1 +Nicht angemeldet +Traceback (most recent call last): + File "C:\Users\firem\Desktop\111\Systades\website\.venv\Lib\site-packages\flask\app.py", line 1823, in full_dispatch_request + rv = self.dispatch_request() + File "C:\Users\firem\Desktop\111\Systades\website\.venv\Lib\site-packages\flask\app.py", line 1788, in dispatch_request + self.raise_routing_exception(req) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^ + File "C:\Users\firem\Desktop\111\Systades\website\.venv\Lib\site-packages\flask\app.py", line 1770, in raise_routing_exception + raise request.routing_exception # type: ignore + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\firem\Desktop\111\Systades\website\.venv\Lib\site-packages\flask\ctx.py", line 351, in match_request + result = self.url_adapter.match(return_rule=True) # type: ignore + File "C:\Users\firem\Desktop\111\Systades\website\.venv\Lib\site-packages\werkzeug\routing\map.py", line 624, in match + raise NotFound() from None +werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. + [in C:\Users\firem\Desktop\111\Systades\website\app.py:93] +2025-05-16 20:05:10,551 ERROR: Fehler 404: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. +Endpoint: /.well-known/appspecific/com.chrome.devtools.json, Method: GET, IP: 127.0.0.1 +Nicht angemeldet +Traceback (most recent call last): + File "C:\Users\firem\Desktop\111\Systades\website\.venv\Lib\site-packages\flask\app.py", line 1823, in full_dispatch_request + rv = self.dispatch_request() + File "C:\Users\firem\Desktop\111\Systades\website\.venv\Lib\site-packages\flask\app.py", line 1788, in dispatch_request + self.raise_routing_exception(req) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^ + File "C:\Users\firem\Desktop\111\Systades\website\.venv\Lib\site-packages\flask\app.py", line 1770, in raise_routing_exception + raise request.routing_exception # type: ignore + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\firem\Desktop\111\Systades\website\.venv\Lib\site-packages\flask\ctx.py", line 351, in match_request + result = self.url_adapter.match(return_rule=True) # type: ignore + File "C:\Users\firem\Desktop\111\Systades\website\.venv\Lib\site-packages\werkzeug\routing\map.py", line 624, in match + raise NotFound() from None +werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. + [in C:\Users\firem\Desktop\111\Systades\website\app.py:93] +2025-05-16 20:05:50,467 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:05:53,368 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:05:53,368 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:06:06,574 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:06:08,460 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:06:08,460 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:12:23,356 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:12:23,363 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:12:26,797 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:12:26,797 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:12:27,029 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:12:27,029 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:12:57,838 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:12:59,652 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:13:02,105 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:13:02,105 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:13:03,187 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:13:03,187 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:13:43,823 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:13:44,945 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:13:46,112 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:13:46,112 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:13:47,360 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:13:47,360 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:14:18,044 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:14:20,092 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:14:20,092 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:14:28,029 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:14:30,609 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] +2025-05-16 20:14:30,609 INFO: Anwendung gestartet [in C:\Users\firem\Desktop\111\Systades\website\app.py:77] diff --git a/static/js/update_mindmap.js b/static/js/update_mindmap.js index cec0a86..05d563d 100644 --- a/static/js/update_mindmap.js +++ b/static/js/update_mindmap.js @@ -1757,6 +1757,88 @@ editingStyles.textContent = ` `; document.head.appendChild(editingStyles); +// CSS-Styles für die Unterkategorien-Seite +(function() { + const style = document.createElement('style'); + style.textContent = ` + .mindmap-page { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: linear-gradient(135deg, #1a1f2e 0%, #0f172a 100%); + z-index: 1000; + display: flex; + flex-direction: column; + } + + .mindmap-page .mindmap-header { + position: relative; + display: flex; + align-items: center; + padding: 1rem; + background: rgba(15, 23, 42, 0.8); + backdrop-filter: blur(10px); + border-bottom: 1px solid rgba(255, 255, 255, 0.1); + z-index: 10; + height: 64px; + } + + .mindmap-page .back-button { + background: none; + border: none; + color: #fff; + cursor: pointer; + padding: 0.5rem; + margin-right: 1rem; + border-radius: 50%; + transition: background-color 0.3s; + display: flex; + align-items: center; + justify-content: center; + width: 36px; + height: 36px; + } + + .mindmap-page .back-button:hover { + background: rgba(255, 255, 255, 0.1); + } + + .mindmap-page .back-button svg { + width: 20px; + height: 20px; + } + + .mindmap-page .mindmap-title { + color: #fff; + font-size: 1.5rem; + font-weight: 600; + margin: 0; + background: linear-gradient(90deg, #60a5fa, #8b5cf6); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + } + + .mindmap-view { + width: 100%; + height: calc(100% - 64px); + position: relative; + } + + /* Fix für den Cytoscape Container */ + .mindmap-view > div { + width: 100%; + height: 100%; + background: transparent; + position: absolute; + top: 0; + left: 0; + } + `; + document.head.appendChild(style); +})(); + // Funktion zum Laden der Subthemen async function loadSubthemes(node) { try { @@ -1765,7 +1847,15 @@ async function loadSubthemes(node) { showUINotification('Lade Subthemen...', 'info'); + // Finde den Container const mindmapContainer = document.querySelector('.mindmap-container'); + if (!mindmapContainer) { + console.error('Mindmap-Container nicht gefunden'); + showUINotification('Fehler: Mindmap-Container nicht gefunden', 'error'); + return; + } + + // Erstelle eine neue Seite für die Unterkategorien const newPage = document.createElement('div'); newPage.className = 'mindmap-page'; newPage.style.display = 'none'; @@ -1773,7 +1863,7 @@ async function loadSubthemes(node) { const header = document.createElement('div'); header.className = 'mindmap-header'; header.innerHTML = ` -