mirror of
https://github.com/Dvorinka/beszel.git
synced 2026-10-28 07:41:17 +00:00
feat(hub): implement native in-app container updates
Introduces the ability for registered users to trigger Beszel container updates directly from the web interface. - Added `app_update` logic to the hub to pull the latest image from GHCR and recreate the container. - Implemented `/api/beszel/update` and `/api/beszel/update/apply` endpoints. - Added a new `AppUpdatePanel` in the settings UI to check for and apply updates. - Added update notifications in the navbar and settings. - Updated `docker-compose.yml` and `README.md` to include the required Docker socket mount for update functionality. - Added a new public status page route that bypasses authentication. - Refactored several TypeScript interfaces to replace `any` with `unknown` or specific types for better type safety. - Updated localization files to support new update-related strings.
This commit is contained in:
1 parent
67254f89a9
commit
7727be166b
63 files changed
+582907
-636
No files matched your search
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
||||
{"files": {"code": ["/home/tdvorak/Desktop/PROG+HTML/Beszel/beszel.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/chart-library.tsx", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/gpu_amd_unsupported.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/data_dir.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/gpu_darwin_test.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/systemd_nonlinux_test.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/gpu_amd_linux_test.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/system.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/sensors_test.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/fingerprint.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/emmc_stub.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/server.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/update.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/mdraid_linux_test.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/network_test.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/systemd_nonlinux.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/gpu_intel.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/connection_manager_test.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/gpu.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/agent.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/systemd_test.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/mdraid_stub.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/handlers.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/gpu_nvml_linux.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/gpu_nvml.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/sensors.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/smart_test.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/gpu_darwin_unsupported.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/handlers_test.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/gpu_test.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/smart_windows.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/emmc_linux.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/disk.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/gpu_nvml_windows.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/server_test.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/cpu.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/docker_test.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/agent_cache.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/systemd.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/smart_nonwindows.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/gpu_nvtop.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/gpu_amd_linux.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/client.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/gpu_nvml_unsupported.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/sensors_default.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/emmc_common_test.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/network.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/disk_test.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/system_test.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/smart.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/gpu_darwin.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/data_dir_test.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/response.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/fingerprint_test.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/agent_cache_test.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/sensors_windows.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/connection_manager.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/emmc_linux_test.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/docker.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/mdraid_linux.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/emmc_common.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/agent_test_helpers.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/client_test.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/zfs/zfs_freebsd.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/zfs/zfs_unsupported.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/zfs/zfs_linux.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/tools/fetchsmartctl/main.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/deltatracker/deltatracker.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/deltatracker/deltatracker_test.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/utils/utils.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/utils/utils_test.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/health/health.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/health/health_test.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/battery/battery_linux.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/battery/battery_linux_test.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/battery/battery.go", "/home/tdvorak/Desktop/PROG+HTML/Beszel/agent/battery/battery_Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
/home/tdvorak/.local/share/uv/tools/graphifyy/bin/python
|
||||
@@ -0,0 +1,75 @@
|
||||
# Beszel Repository - Knowledge Graph Report
|
||||
|
||||
Generated: /home/tdvorak/Desktop/PROG+HTML/Beszel
|
||||
|
||||
## Summary
|
||||
|
||||
- **Total Nodes**: 6,011
|
||||
- **Total Edges**: 7,957
|
||||
- **Communities**: 867
|
||||
- **Code Files**: 1,131
|
||||
- **Document Files**: 180
|
||||
|
||||
## Top God Nodes (High Connectivity)
|
||||
|
||||
- **sleep()** (degree: 73)
|
||||
- **New()** (degree: 64)
|
||||
- **Monitor** (degree: 52)
|
||||
- **CreateRecord()** (degree: 49)
|
||||
- **GetHubWithUser()** (degree: 49)
|
||||
- **GPUManager** (degree: 40)
|
||||
- **GetEnv()** (degree: 39)
|
||||
- **SupabaseService** (degree: 38)
|
||||
- **Agent** (degree: 35)
|
||||
- **SystemManager** (degree: 34)
|
||||
- **PgDatabaseService** (degree: 31)
|
||||
- **Hub** (degree: 30)
|
||||
- **System** (degree: 30)
|
||||
- **AddDomainComponent** (degree: 29)
|
||||
- **MainDatabaseService** (degree: 28)
|
||||
- **LoginPageComponent** (degree: 28)
|
||||
- **SmartManager** (degree: 27)
|
||||
- **AverageSystemStatsSlice()** (degree: 27)
|
||||
- **AlertManager** (degree: 27)
|
||||
- **parseInt()** (degree: 27)
|
||||
|
||||
## Surprising Connections
|
||||
|
||||
- ? ↔ ? (cross-community)
|
||||
- ? ↔ ? (cross-community)
|
||||
- ? ↔ ? (cross-community)
|
||||
- ? ↔ ? (cross-community)
|
||||
- ? ↔ ? (cross-community)
|
||||
|
||||
## Largest Communities
|
||||
|
||||
1. **Community 0** (248 nodes): agent_agent_cache_newsystemdatacache, agent_agent_cache_test_createtestcachedata, agent_agent_cache_test_go, agent_agent_cache_test_testcachefreshness, agent_agent_cache_test_testcachegetset...
|
||||
2. **Community 1** (176 nodes): agent_agent_getfingerprint, agent_battery_battery_windows_go, agent_fingerprint_deletefingerprint, agent_fingerprint_generatefingerprint, agent_fingerprint_getfingerprint...
|
||||
3. **Community 2** (164 nodes): bulk_api_newapihandler, bulk_api_parseint, bulk_importresult, components_countup_data, components_countup_isnum...
|
||||
4. **Community 3** (155 nodes): layouts_layout_if, mixins_lang_changelang, mixins_lang_created, mixins_lang_data, mixins_lang_language...
|
||||
5. **Community 4** (147 nodes): alerts_alerts_sheet_copyalertsfromsystem, alerts_alerts_sheet_failedupdatetoast, components_add_system_addsystemdialog, components_add_system_handlesubmit, components_navbar_navbar...
|
||||
6. **Community 5** (146 nodes): agent_agent, agent_agent_applynetworktotals, agent_agent_attachsystemdetails, agent_agent_computebytespersecond, agent_agent_ensurenetinterfacesinitialized...
|
||||
7. **Community 6** (143 nodes): advanced_page_list_page_pagelistcomponent, advanced_page_list_page_pagelistcomponent_buildroutetree, advanced_page_list_page_pagelistcomponent_formatname, advanced_page_list_page_pagelistcomponent_insertintotree, advanced_page_list_page_pagelistcomponent_mergesitemapurls...
|
||||
8. **Community 7** (139 nodes): components_templatedinput_get, components_templatedinput_set, components_templatedtextarea_get, components_templatedtextarea_set, components_togglesection_data...
|
||||
9. **Community 8** (134 nodes): components_maintenancetime_enddatetime, components_maintenancetime_startdatetime, components_monitorlistitem_beforemount, components_monitorlistitem_changecollapsed, components_monitorlistitem_data...
|
||||
10. **Community 9** (133 nodes): agent_deltatracker_deltatracker_go, agent_deltatracker_deltatracker_test_go, agent_docker_builddockercontainerendpoint, agent_docker_calculatememoryusage, agent_docker_convertcontainerportstostring...
|
||||
11. **Community 10** (133 nodes): agent_agent_go, agent_agent_newagent, agent_checkfingerprinthandler, agent_checkfingerprinthandler_handle, agent_client_newwebsocketclient...
|
||||
12. **Community 11** (126 nodes): agent_agent_gatherstats, agent_collectordefinition, agent_collectorsource, agent_docker_test_testconstantsandutilityfunctions, agent_gpu_amd_linux_cacheamdgpuname...
|
||||
13. **Community 12** (115 nodes): domains_alertcallback, domains_scheduler, domains_scheduler_checkalldomains, domains_scheduler_checkdomain, domains_scheduler_checkdomains...
|
||||
14. **Community 13** (92 nodes): agent_agent_cache_go, agent_cachenode, agent_systemdatacache, agent_systemdatacache_get, agent_systemdatacache_set...
|
||||
15. **Community 14** (82 nodes): constants_security_categories_getallbyclientserver, constants_security_categories_getallbyseverity, constants_security_categories_getallwithactions, constants_security_categories_getbyeppcode, constants_security_categories_geteppcodesbyclientserver...
|
||||
|
||||
## File Type Distribution
|
||||
|
||||
- **Go**: Main backend language
|
||||
- **TypeScript/React**: Frontend components
|
||||
- **Markdown**: Documentation
|
||||
|
||||
## How to Use This Graph
|
||||
|
||||
1. Query the graph:
|
||||
2. Find paths:
|
||||
3. Explore communities: Open in a graph viewer
|
||||
|
||||
---
|
||||
*Generated by graphify*
|
||||
@@ -0,0 +1,276 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>graphify - graphify-out/graph.html</title>
|
||||
<script src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"></script>
|
||||
<style>
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
body { background: #0f0f1a; color: #e0e0e0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; display: flex; height: 100vh; overflow: hidden; }
|
||||
#graph { flex: 1; }
|
||||
#sidebar { width: 280px; background: #1a1a2e; border-left: 1px solid #2a2a4e; display: flex; flex-direction: column; overflow: hidden; }
|
||||
#search-wrap { padding: 12px; border-bottom: 1px solid #2a2a4e; }
|
||||
#search { width: 100%; background: #0f0f1a; border: 1px solid #3a3a5e; color: #e0e0e0; padding: 7px 10px; border-radius: 6px; font-size: 13px; outline: none; }
|
||||
#search:focus { border-color: #4E79A7; }
|
||||
#search-results { max-height: 140px; overflow-y: auto; padding: 4px 12px; border-bottom: 1px solid #2a2a4e; display: none; }
|
||||
.search-item { padding: 4px 6px; cursor: pointer; border-radius: 4px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.search-item:hover { background: #2a2a4e; }
|
||||
#info-panel { padding: 14px; border-bottom: 1px solid #2a2a4e; min-height: 140px; }
|
||||
#info-panel h3 { font-size: 13px; color: #aaa; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em; }
|
||||
#info-content { font-size: 13px; color: #ccc; line-height: 1.6; }
|
||||
#info-content .field { margin-bottom: 5px; }
|
||||
#info-content .field b { color: #e0e0e0; }
|
||||
#info-content .empty { color: #555; font-style: italic; }
|
||||
.neighbor-link { display: block; padding: 2px 6px; margin: 2px 0; border-radius: 3px; cursor: pointer; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid #333; }
|
||||
.neighbor-link:hover { background: #2a2a4e; }
|
||||
#neighbors-list { max-height: 160px; overflow-y: auto; margin-top: 4px; }
|
||||
#legend-wrap { flex: 1; overflow-y: auto; padding: 12px; }
|
||||
#legend-wrap h3 { font-size: 13px; color: #aaa; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
|
||||
.legend-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; border-radius: 4px; font-size: 12px; }
|
||||
.legend-item:hover { background: #2a2a4e; padding-left: 4px; }
|
||||
.legend-item.dimmed { opacity: 0.35; }
|
||||
.legend-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
|
||||
.legend-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.legend-count { color: #666; font-size: 11px; }
|
||||
#stats { padding: 10px 14px; border-top: 1px solid #2a2a4e; font-size: 11px; color: #555; }
|
||||
#legend-controls { display: flex; gap: 6px; margin-bottom: 8px; }
|
||||
#legend-controls button { flex: 1; background: #0f0f1a; border: 1px solid #3a3a5e; color: #aaa; padding: 4px 0; border-radius: 4px; font-size: 11px; cursor: pointer; }
|
||||
#legend-controls button:hover { border-color: #4E79A7; color: #e0e0e0; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="graph"></div>
|
||||
<div id="sidebar">
|
||||
<div id="search-wrap">
|
||||
<input id="search" type="text" placeholder="Search nodes..." autocomplete="off">
|
||||
<div id="search-results"></div>
|
||||
</div>
|
||||
<div id="info-panel">
|
||||
<h3>Node Info</h3>
|
||||
<div id="info-content"><span class="empty">Click a node to inspect it</span></div>
|
||||
</div>
|
||||
<div id="legend-wrap">
|
||||
<h3>Communities</h3>
|
||||
<div id="legend-controls">
|
||||
<button onclick="toggleAllCommunities(false)">Show All</button>
|
||||
<button onclick="toggleAllCommunities(true)">Hide All</button>
|
||||
</div>
|
||||
<div id="legend"></div>
|
||||
</div>
|
||||
<div id="stats">1124 nodes · 2082 edges · 30 communities</div>
|
||||
</div>
|
||||
<script>
|
||||
const RAW_NODES = [{"id": "agent_gpumanager", "label": "GPUManager", "color": {"background": "#F28E2B", "border": "#F28E2B", "highlight": {"background": "#ffffff", "border": "#F28E2B"}}, "size": 22.5, "font": {"size": 12, "color": "#ffffff"}, "title": "GPUManager", "community": 1, "community_name": "Community 1", "source_file": "agent/gpu_darwin.go", "file_type": "code", "degree": 40}, {"id": "agent_gpumanager_hasamdsysfs", "label": ".hasAmdSysfs()", "color": {"background": "#F28E2B", "border": "#F28E2B", "highlight": {"background": "#ffffff", "border": "#F28E2B"}}, "size": 10.3, "font": {"size": 0, "color": "#ffffff"}, "title": ".hasAmdSysfs()", "community": 1, "community_name": "Community 1", "source_file": "agent/gpu_amd_linux.go", "file_type": "code", "degree": 1}, {"id": "agent_gpumanager_collectamdstats", "label": ".collectAmdStats()", "color": {"background": "#F28E2B", "border": "#F28E2B", "highlight": {"background": "#ffffff", "border": "#F28E2B"}}, "size": 11.9, "font": {"size": 0, "color": "#ffffff"}, "title": ".collectAmdStats()", "community": 1, "community_name": "Community 1", "source_file": "agent/gpu_amd_linux.go", "file_type": "code", "degree": 6}, {"id": "agent_data_dir_getdatadir", "label": "GetDataDir()", "color": {"background": "#59A14F", "border": "#59A14F", "highlight": {"background": "#ffffff", "border": "#59A14F"}}, "size": 11.2, "font": {"size": 0, "color": "#ffffff"}, "title": "GetDataDir()", "community": 4, "community_name": "Community 4", "source_file": "agent/data_dir.go", "file_type": "code", "degree": 4}, {"id": "agent_data_dir_testdatadirs", "label": "testDataDirs()", "color": {"background": "#59A14F", "border": "#59A14F", "highlight": {"background": "#ffffff", "border": "#59A14F"}}, "size": 10.6, "font": {"size": 0, "color": "#ffffff"}, "title": "testDataDirs()", "community": 4, "community_name": "Community 4", "source_file": "agent/data_dir.go", "file_type": "code", "degree": 2}, {"id": "agent_agent", "label": "Agent", "color": {"background": "#F28E2B", "border": "#F28E2B", "highlight": {"background": "#ffffff", "border": "#F28E2B"}}, "size": 20.9, "font": {"size": 12, "color": "#ffffff"}, "title": "Agent", "community": 1, "community_name": "Community 1", "source_file": "agent/agent_test_helpers.go", "file_type": "code", "degree": 35}, {"id": "agent_agent_refreshsystemdetails", "label": ".refreshSystemDetails()", "color": {"background": "#F28E2B", "border": "#F28E2B", "highlight": {"background": "#ffffff", "border": "#F28E2B"}}, "size": 11.6, "font": {"size": 0, "color": "#ffffff"}, "title": ".refreshSystemDetails()", "community": 1, "community_name": "Community 1", "source_file": "agent/system.go", "file_type": "code", "degree": 5}, {"id": "agent_agent_attachsystemdetails", "label": ".attachSystemDetails()", "color": {"background": "#F28E2B", "border": "#F28E2B", "highlight": {"background": "#ffffff", "border": "#F28E2B"}}, "size": 10.3, "font": {"size": 0, "color": "#ffffff"}, "title": ".attachSystemDetails()", "community": 1, "community_name": "Community 1", "source_file": "agent/system.go", "file_type": "code", "degree": 1}, {"id": "agent_agent_updatesystemdetails", "label": ".updateSystemDetails()", "color": {"background": "#F28E2B", "border": "#F28E2B", "highlight": {"background": "#ffffff", "border": "#F28E2B"}}, "size": 10.3, "font": {"size": 0, "color": "#ffffff"}, "title": ".updateSystemDetails()", "community": 1, "community_name": "Community 1", "source_file": "agent/system.go", "file_type": "code", "degree": 1}, {"id": "agent_agent_getsystemstats", "label": ".getSystemStats()", "color": {"background": "#59A14F", "border": "#59A14F", "highlight": {"background": "#ffffff", "border": "#59A14F"}}, "size": 11.9, "font": {"size": 0, "color": "#ffffff"}, "title": ".getSystemStats()", "community": 14, "community_name": "Community 14", "source_file": "agent/system.go", "file_type": "code", "degree": 6}, {"id": "agent_system_getosprettyname", "label": "getOsPrettyName()", "color": {"background": "#F28E2B", "border": "#F28E2B", "highlight": {"background": "#ffffff", "border": "#F28E2B"}}, "size": 10.6, "font": {"size": 0, "color": "#ffffff"}, "title": "getOsPrettyName()", "community": 1, "community_name": "Community 1", "source_file": "agent/system.go", "file_type": "code", "degree": 2}, {"id": "agent_sensors_test_testgettempswithtimeout", "label": "TestGetTempsWithTimeout()", "color": {"background": "#4E79A7", "border": "#4E79A7", "highlight": {"background": "#ffffff", "border": "#4E79A7"}}, "size": 10.6, "font": {"size": 0, "color": "#ffffff"}, "title": "TestGetTempsWithTimeout()", "community": 0, "community_name": "Community 0", "source_file": "agent/sensors_test.go", "file_type": "code", "degree": 2}, {"id": "agent_sensors_test_testupdatetemperaturesskipsontimeout", "label": "TestUpdateTemperaturesSkipsOnTimeout()", "color": {"background": "#4E79A7", "border": "#4E79A7", "highlight": {"background": "#ffffff", "border": "#4E79A7"}}, "size": 10.3, "font": {"size": 0, "cLine truncated
|
||||
const RAW_EDGES = [{"from": "agent_gpumanager", "to": "agent_gpumanager_hasamdsysfs", "label": "method", "title": "method [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "agent_gpumanager", "to": "agent_gpumanager_collectamdstats", "label": "method", "title": "method [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "agent_gpumanager", "to": "agent_gpumanager_updateintelfromstats", "label": "method", "title": "method [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "agent_gpumanager", "to": "agent_gpumanager_collectintelstats", "label": "method", "title": "method [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "agent_gpumanager", "to": "agent_gpumanager_parseintelheaders", "label": "method", "title": "method [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "agent_gpumanager", "to": "agent_gpumanager_parseinteldata", "label": "method", "title": "method [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "agent_gpumanager", "to": "agent_gpu_go", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "agent_gpumanager", "to": "agent_gpumanager_getjetsonparser", "label": "method", "title": "method [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "agent_gpumanager", "to": "agent_gpumanager_parsenvidiadata", "label": "method", "title": "method [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "agent_gpumanager", "to": "agent_gpumanager_parseamddata", "label": "method", "title": "method [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "agent_gpumanager", "to": "agent_gpumanager_getcurrentdata", "label": "method", "title": "method [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "agent_gpumanager", "to": "agent_gpumanager_initializesnapshots", "label": "method", "title": "method [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "agent_gpumanager", "to": "agent_gpumanager_countgpunames", "label": "method", "title": "method [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "agent_gpumanager", "to": "agent_gpumanager_calculategpuaverage", "label": "method", "title": "method [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "agent_gpumanager", "to": "agent_gpumanager_calculatedeltacount", "label": "method", "title": "method [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "agent_gpumanager", "to": "agent_gpumanager_calculatedeltas", "label": "method", "title": "method [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "agent_gpumanager", "to": "agent_gpumanager_calculateintelgpuusage", "label": "method", "title": "method [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "agent_gpumanager", "to": "agent_gpumanager_updateinstantaneousvalues", "label": "method", "title": "method [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "agent_gpumanager", "to": "agent_gpumanager_storesnapshot", "label": "method", "title": "method [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "agent_gpumanager", "to": "agent_gpumanager_discovergpucapabilities", "label": "method", "title": "method [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "agent_gpumanager", "to": "agent_gpumanager_startintelcollector", "label": "method", "title": "method [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "agent_gpumanager", "to": "agent_gpumanager_startnvidiasmicollector", "label": "method", "title": "method [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "agent_gpumanager", "to": "agent_gpumanager_starttegrastatscollector", "label": "method", "title": "method [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "agent_gpumanager", "to": "agent_gpumanager_startrocmsmicollector", "label": "method", "title": "method [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "agent_Line truncated
|
||||
const LEGEND = [];
|
||||
|
||||
// HTML-escape helper — prevents XSS when injecting graph data into innerHTML
|
||||
function esc(s) {
|
||||
return String(s).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"').replace(/'/g,''');
|
||||
}
|
||||
|
||||
// Build vis datasets
|
||||
const nodesDS = new vis.DataSet(RAW_NODES.map(n => ({
|
||||
id: n.id, label: n.label, color: n.color, size: n.size,
|
||||
font: n.font, title: n.title,
|
||||
_community: n.community, _community_name: n.community_name,
|
||||
_source_file: n.source_file, _file_type: n.file_type, _degree: n.degree,
|
||||
})));
|
||||
|
||||
const edgesDS = new vis.DataSet(RAW_EDGES.map((e, i) => ({
|
||||
id: i, from: e.from, to: e.to,
|
||||
label: '',
|
||||
title: e.title,
|
||||
dashes: e.dashes,
|
||||
width: e.width,
|
||||
color: e.color,
|
||||
arrows: { to: { enabled: true, scaleFactor: 0.5 } },
|
||||
})));
|
||||
|
||||
const container = document.getElementById('graph');
|
||||
const network = new vis.Network(container, { nodes: nodesDS, edges: edgesDS }, {
|
||||
physics: {
|
||||
enabled: true,
|
||||
solver: 'forceAtlas2Based',
|
||||
forceAtlas2Based: {
|
||||
gravitationalConstant: -60,
|
||||
centralGravity: 0.005,
|
||||
springLength: 120,
|
||||
springConstant: 0.08,
|
||||
damping: 0.4,
|
||||
avoidOverlap: 0.8,
|
||||
},
|
||||
stabilization: { iterations: 200, fit: true },
|
||||
},
|
||||
interaction: {
|
||||
hover: true,
|
||||
tooltipDelay: 100,
|
||||
hideEdgesOnDrag: true,
|
||||
navigationButtons: false,
|
||||
keyboard: false,
|
||||
},
|
||||
nodes: { shape: 'dot', borderWidth: 1.5 },
|
||||
edges: { smooth: { type: 'continuous', roundness: 0.2 }, selectionWidth: 3 },
|
||||
});
|
||||
|
||||
network.once('stabilizationIterationsDone', () => {
|
||||
network.setOptions({ physics: { enabled: false } });
|
||||
});
|
||||
|
||||
function showInfo(nodeId) {
|
||||
const n = nodesDS.get(nodeId);
|
||||
if (!n) return;
|
||||
const neighborIds = network.getConnectedNodes(nodeId);
|
||||
const neighborItems = neighborIds.map(nid => {
|
||||
const nb = nodesDS.get(nid);
|
||||
const color = nb ? nb.color.background : '#555';
|
||||
return `<span class="neighbor-link" style="border-left-color:${esc(color)}" onclick="focusNode(${JSON.stringify(nid)})">${esc(nb ? nb.label : nid)}</span>`;
|
||||
}).join('');
|
||||
document.getElementById('info-content').innerHTML = `
|
||||
<div class="field"><b>${esc(n.label)}</b></div>
|
||||
<div class="field">Type: ${esc(n._file_type || 'unknown')}</div>
|
||||
<div class="field">Community: ${esc(n._community_name)}</div>
|
||||
<div class="field">Source: ${esc(n._source_file || '-')}</div>
|
||||
<div class="field">Degree: ${n._degree}</div>
|
||||
${neighborIds.length ? `<div class="field" style="margin-top:8px;color:#aaa;font-size:11px">Neighbors (${neighborIds.length})</div><div id="neighbors-list">${neighborItems}</div>` : ''}
|
||||
`;
|
||||
}
|
||||
|
||||
function focusNode(nodeId) {
|
||||
network.focus(nodeId, { scale: 1.4, animation: true });
|
||||
network.selectNodes([nodeId]);
|
||||
showInfo(nodeId);
|
||||
}
|
||||
|
||||
// Track hovered node — hover detection is more reliable than click params
|
||||
let hoveredNodeId = null;
|
||||
network.on('hoverNode', params => {
|
||||
hoveredNodeId = params.node;
|
||||
container.style.cursor = 'pointer';
|
||||
});
|
||||
network.on('blurNode', () => {
|
||||
hoveredNodeId = null;
|
||||
container.style.cursor = 'default';
|
||||
});
|
||||
container.addEventListener('click', () => {
|
||||
if (hoveredNodeId !== null) {
|
||||
showInfo(hoveredNodeId);
|
||||
network.selectNodes([hoveredNodeId]);
|
||||
}
|
||||
});
|
||||
network.on('click', params => {
|
||||
if (params.nodes.length > 0) {
|
||||
showInfo(params.nodes[0]);
|
||||
} else if (hoveredNodeId === null) {
|
||||
document.getElementById('info-content').innerHTML = '<span class="empty">Click a node to inspect it</span>';
|
||||
}
|
||||
});
|
||||
|
||||
const searchInput = document.getElementById('search');
|
||||
const searchResults = document.getElementById('search-results');
|
||||
searchInput.addEventListener('input', () => {
|
||||
const q = searchInput.value.toLowerCase().trim();
|
||||
searchResults.innerHTML = '';
|
||||
if (!q) { searchResults.style.display = 'none'; return; }
|
||||
const matches = RAW_NODES.filter(n => n.label.toLowerCase().includes(q)).slice(0, 20);
|
||||
if (!matches.length) { searchResults.style.display = 'none'; return; }
|
||||
searchResults.style.display = 'block';
|
||||
matches.forEach(n => {
|
||||
const el = document.createElement('div');
|
||||
el.className = 'search-item';
|
||||
el.textContent = n.label;
|
||||
el.style.borderLeft = `3px solid ${n.color.background}`;
|
||||
el.style.paddingLeft = '8px';
|
||||
el.onclick = () => {
|
||||
network.focus(n.id, { scale: 1.5, animation: true });
|
||||
network.selectNodes([n.id]);
|
||||
showInfo(n.id);
|
||||
searchResults.style.display = 'none';
|
||||
searchInput.value = '';
|
||||
};
|
||||
searchResults.appendChild(el);
|
||||
});
|
||||
});
|
||||
document.addEventListener('click', e => {
|
||||
if (!searchResults.contains(e.target) && e.target !== searchInput)
|
||||
searchResults.style.display = 'none';
|
||||
});
|
||||
|
||||
const hiddenCommunities = new Set();
|
||||
|
||||
function toggleAllCommunities(hide) {
|
||||
document.querySelectorAll('.legend-item').forEach(item => {
|
||||
hide ? item.classList.add('dimmed') : item.classList.remove('dimmed');
|
||||
});
|
||||
LEGEND.forEach(c => {
|
||||
if (hide) hiddenCommunities.add(c.cid); else hiddenCommunities.delete(c.cid);
|
||||
});
|
||||
const updates = RAW_NODES.map(n => ({ id: n.id, hidden: hide }));
|
||||
nodesDS.update(updates);
|
||||
}
|
||||
|
||||
const legendEl = document.getElementById('legend');
|
||||
LEGEND.forEach(c => {
|
||||
const item = document.createElement('div');
|
||||
item.className = 'legend-item';
|
||||
item.innerHTML = `<div class="legend-dot" style="background:${c.color}"></div>
|
||||
<span class="legend-label">${c.label}</span>
|
||||
<span class="legend-count">${c.count}</span>`;
|
||||
item.onclick = () => {
|
||||
if (hiddenCommunities.has(c.cid)) {
|
||||
hiddenCommunities.delete(c.cid);
|
||||
item.classList.remove('dimmed');
|
||||
} else {
|
||||
hiddenCommunities.add(c.cid);
|
||||
item.classList.add('dimmed');
|
||||
}
|
||||
const updates = RAW_NODES
|
||||
.filter(n => n.community === c.cid)
|
||||
.map(n => ({ id: n.id, hidden: hiddenCommunities.has(c.cid) }));
|
||||
nodesDS.update(updates);
|
||||
};
|
||||
legendEl.appendChild(item);
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
// Render hyperedges as shaded regions
|
||||
const hyperedges = [];
|
||||
// afterDrawing passes ctx already transformed to network coordinate space.
|
||||
// Draw node positions raw — no manual pan/zoom/DPR math needed.
|
||||
network.on('afterDrawing', function(ctx) {
|
||||
hyperedges.forEach(h => {
|
||||
const positions = h.nodes
|
||||
.map(nid => network.getPositions([nid])[nid])
|
||||
.filter(p => p !== undefined);
|
||||
if (positions.length < 2) return;
|
||||
ctx.save();
|
||||
ctx.globalAlpha = 0.12;
|
||||
ctx.fillStyle = '#6366f1';
|
||||
ctx.strokeStyle = '#6366f1';
|
||||
ctx.lineWidth = 2;
|
||||
ctx.beginPath();
|
||||
// Centroid and expanded hull in network coordinates
|
||||
const cx = positions.reduce((s, p) => s + p.x, 0) / positions.length;
|
||||
const cy = positions.reduce((s, p) => s + p.y, 0) / positions.length;
|
||||
const expanded = positions.map(p => ({
|
||||
x: cx + (p.x - cx) * 1.15,
|
||||
y: cy + (p.y - cy) * 1.15
|
||||
}));
|
||||
ctx.moveTo(expanded[0].x, expanded[0].y);
|
||||
expanded.slice(1).forEach(p => ctx.lineTo(p.x, p.y));
|
||||
ctx.closePath();
|
||||
ctx.fill();
|
||||
ctx.globalAlpha = 0.4;
|
||||
ctx.stroke();
|
||||
// Label
|
||||
ctx.globalAlpha = 0.8;
|
||||
ctx.fillStyle = '#4f46e5';
|
||||
ctx.font = 'bold 11px sans-serif';
|
||||
ctx.textAlign = 'center';
|
||||
ctx.fillText(h.label, cx, cy - 5);
|
||||
ctx.restore();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
+131360
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user