From fc8861c73ca4acf0a646b0cdb5471d01496cc524 Mon Sep 17 00:00:00 2001 From: marwin Date: Fri, 16 May 2025 20:14:51 +0100 Subject: [PATCH] wir haben unterkategorien --- __pycache__/app.cpython-313.pyc | Bin 116369 -> 118216 bytes app.py | 61 +++++++++- logs/app.log | 66 +++++++++++ static/js/update_mindmap.js | 193 ++++++++++++++++++++++---------- 4 files changed, 259 insertions(+), 61 deletions(-) diff --git a/__pycache__/app.cpython-313.pyc b/__pycache__/app.cpython-313.pyc index 260e3002f9fe70a605254c1bc929ded2b1faf667..fd212152fc2ef5e8e75df9c390e26f72853e949d 100644 GIT binary patch delta 2566 zcmaJ>3v5%@89x7g*f)N~@A&PThw~sWASBS06owLLhal-LZkfC-3yG5$f|Fi{u|^sh zohp@XYlv>kDFsSGL7{XKX&E>z9fP(cXk*|so$N)C#-w%CSSL9oojPsmc8(MC(l#sl z^Zn=i=Y0S7opbKc&(znBs15Uay#|qA*GnZ`pAYRfoHxMbR^~lc8EPp~zIVr}+*)v9 z?QYQG${p}mhr~$+DYr^p4N)eDEa>r95Q?%v2E!4svBn^a=gxo?N87-w{QOgka%9r0Z?P#)e!Qm( zBv^;gl{(Evgg!vF#yZUhwhc8Txhi-YALXtFj1*_4Cy-{7i=EJXo!?|*Cv$-$lQw>n zD-Jv11jBR)_*6HnB5f<{4L0TVbvgc0s+{~bLF;*hBq0hu6yg`h5DF^d7P~X278VC2 z4V}qmQNXvp4?gAfTB|OUmt7JvDszAF;N_=4z}|ZBDC@ti;i9ah#$#<@r?#l^+X7gX z?yqdr4>021Q(&i%H%aDDKpFYeN0;X)hfZcHv=+&lv6~~_LOobD#PkEibUw%_SEj9; zqz>}R{*zXf0o5=;9*+rN!+-cGWLA?C;gz=!WxS{7Kxaw6fo#8|p6ux%>y)8zrpjrN zY*p&4N)c`O2|`*Vq9t~#1wF;bm}(SbNFRl?k0o&e<QL@o4QeVsV;XUn%2$SOXVt5- z>T@&p-dmH=t^DzJ#{2tBR^K&wkcbl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o{s+nQp%(xE delta 1236 zcmYLJTTEP46g}(Qx%0U5V1{|{kf%@#N(!W8?{9wMKxNmi|LV zk=1YjIx1XjYLm9p#im)fszRF%Z!Z^{nLy@Fn{B4pFZ~J`o^@%}dCF|CQmxKX=29Ux zb6IM2p0#ukpL1ShqYt~V(LA>`%WSRDpiMD*oY($1R@}(C^ROdt%PKB)o!brj&)vH-1?MR@Q(OXB6fi6(Jr=qkm7YRRP5e)Qf9c3`8{DQ|ws3njBW! z&zPI#(9}7kgo133lHesQ!3A%Lcw6t5AS&?{u&yeD-&4nM5^8FuDmHXm%Gzx(i;eMoTMaazA0Lz_eWLTp~Ru(uy- z%9wl&QlcpRWm#~xG~*N>zz+4A2)0|+0KRv47PLJrUES?fhH=QCE*rk3-iz3w&5NTY@dOfgC~zJP zR`w-avtf*W9L9Ex(_>dquHFLNj+?l_Wi~@uSx638X6d zvb~1XX-IvBEZ&ec8j{_Re8x>WK8aGzuP`QLvc#}8KZ!G5{}%Y~D~xYg=E7Tk6;wJU X{} 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 = ` -