fix: Reorder tabs and fix viz pane session access
- Move Webhooks tab to the right (User Info | Vector Sync | Vector Viz | Webhooks) - Use request.user.display_name instead of session for viz routes - Fixes session middleware error when accessing via iframe
This commit is contained in:
@@ -846,18 +846,6 @@ async def user_info_html(request: Request) -> HTMLResponse:
|
||||
Vector Sync
|
||||
</button>
|
||||
'''
|
||||
}
|
||||
{
|
||||
""
|
||||
if not show_webhooks_tab
|
||||
else '''
|
||||
<button
|
||||
class="tab"
|
||||
:class="activeTab === 'webhooks' ? 'active' : ''"
|
||||
@click="activeTab = 'webhooks'">
|
||||
Webhooks
|
||||
</button>
|
||||
'''
|
||||
}
|
||||
{
|
||||
""
|
||||
@@ -870,6 +858,18 @@ async def user_info_html(request: Request) -> HTMLResponse:
|
||||
Vector Viz
|
||||
</button>
|
||||
'''
|
||||
}
|
||||
{
|
||||
""
|
||||
if not show_webhooks_tab
|
||||
else '''
|
||||
<button
|
||||
class="tab"
|
||||
:class="activeTab === 'webhooks' ? 'active' : ''"
|
||||
@click="activeTab = 'webhooks'">
|
||||
Webhooks
|
||||
</button>
|
||||
'''
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -893,22 +893,22 @@ async def user_info_html(request: Request) -> HTMLResponse:
|
||||
|
||||
{
|
||||
""
|
||||
if not show_webhooks_tab
|
||||
else f'''
|
||||
<!-- Webhooks Tab (admin-only, loaded dynamically) -->
|
||||
<div class="tab-pane" x-show="activeTab === 'webhooks'" x-transition.opacity.duration.150ms>
|
||||
{webhooks_tab_html}
|
||||
if not show_vector_sync_tab
|
||||
else '''
|
||||
<!-- Vector Viz Tab -->
|
||||
<div class="tab-pane" x-show="activeTab === 'vector-viz'" x-transition.opacity.duration.150ms>
|
||||
<iframe src="/app/vector-viz" style="width: 100%; height: 800px; border: none;"></iframe>
|
||||
</div>
|
||||
'''
|
||||
}
|
||||
|
||||
{
|
||||
""
|
||||
if not show_vector_sync_tab
|
||||
else '''
|
||||
<!-- Vector Viz Tab -->
|
||||
<div class="tab-pane" x-show="activeTab === 'vector-viz'" x-transition.opacity.duration.150ms>
|
||||
<iframe src="/app/vector-viz" style="width: 100%; height: 800px; border: none;"></iframe>
|
||||
if not show_webhooks_tab
|
||||
else f'''
|
||||
<!-- Webhooks Tab (admin-only, loaded dynamically) -->
|
||||
<div class="tab-pane" x-show="activeTab === 'webhooks'" x-transition.opacity.duration.150ms>
|
||||
{webhooks_tab_html}
|
||||
</div>
|
||||
'''
|
||||
}
|
||||
|
||||
@@ -57,9 +57,12 @@ async def vector_visualization_html(request: Request) -> HTMLResponse:
|
||||
"""
|
||||
)
|
||||
|
||||
# Get user info from session
|
||||
user_info = request.session.get("user_info", {})
|
||||
username = user_info.get("preferred_username", "unknown")
|
||||
# Get user info from auth context
|
||||
username = (
|
||||
request.user.display_name
|
||||
if hasattr(request.user, "display_name")
|
||||
else "unknown"
|
||||
)
|
||||
|
||||
html_content = f"""
|
||||
<!DOCTYPE html>
|
||||
@@ -374,9 +377,10 @@ async def vector_visualization_search(request: Request) -> JSONResponse:
|
||||
status_code=400,
|
||||
)
|
||||
|
||||
# Get user info
|
||||
user_info = request.session.get("user_info", {})
|
||||
username = user_info.get("preferred_username")
|
||||
# Get user info from auth context
|
||||
username = (
|
||||
request.user.display_name if hasattr(request.user, "display_name") else None
|
||||
)
|
||||
|
||||
if not username:
|
||||
return JSONResponse(
|
||||
|
||||
Reference in New Issue
Block a user