@@ -741,17 +741,11 @@ document.addEventListener('DOMContentLoaded', function() {
741741 // If no namespace filters are selected, show all nodes
742742 if ( namespaceFilters . length === 0 ) return true ;
743743
744- // For namespace nodes, check direct match
745- const node = graph . nodes . find ( n => n . id === nodeId ) ;
746- if ( node && node . group === 'namespace' ) {
747- return namespaceFilters . some ( ns => ns === nodeId ) ;
748- }
744+ // Get the first level of the namespace from the nodeId
745+ const firstLevelNamespace = nodeId . split ( '.' ) [ 0 ] ;
749746
750- // For other nodes, check if they belong to any of the filtered namespaces
751- return namespaceFilters . some ( namespace => {
752- // Check if the node ID starts with the namespace followed by a dot
753- return nodeId === namespace || nodeId . startsWith ( namespace + '.' ) ;
754- } ) ;
747+ // Check if this first level namespace is in the list of filtered namespaces
748+ return namespaceFilters . includes ( firstLevelNamespace ) ;
755749 } ;
756750
757751 // Apply node filters
@@ -1154,40 +1148,34 @@ document.addEventListener('DOMContentLoaded', function() {
11541148 return ;
11551149 }
11561150
1157- // Extract all namespaces from the graph
1151+ // Extract first-level namespaces from the graph
11581152 const namespaces = new Set ( ) ;
11591153
1160- // Extract namespace from node IDs
1154+ // Process each node to extract just the first level of namespaces
11611155 graph . nodes . forEach ( node => {
1156+ let firstLevelNamespace = null ;
1157+
11621158 if ( node . group === 'namespace' ) {
1163- namespaces . add ( node . id ) ;
1159+ // For namespace nodes, get only the first part
1160+ firstLevelNamespace = node . id . split ( '.' ) [ 0 ] ;
11641161 } else {
1165- // For non-namespace nodes, extract the namespace part
1162+ // For other nodes, extract the first part of the namespace
11661163 const parts = node . id . split ( '.' ) ;
11671164 if ( parts . length > 1 ) {
1168- // Find the namespace by looking at the first part(s) of the ID
1169- // We consider everything before the last part as potentially part of the namespace
1170- const potentialNamespace = parts . slice ( 0 , - 1 ) . join ( '.' ) ;
1171-
1172- // Check if this potential namespace exists as a node
1173- const namespaceNode = graph . nodes . find ( n =>
1174- n . group === 'namespace' && ( n . id === potentialNamespace || potentialNamespace . startsWith ( n . id + '.' ) )
1175- ) ;
1176-
1177- if ( namespaceNode ) {
1178- namespaces . add ( namespaceNode . id ) ;
1179- } else if ( potentialNamespace ) {
1180- // Add the potential namespace even if it's not explicitly defined as a node
1181- namespaces . add ( potentialNamespace ) ;
1182- }
1165+ firstLevelNamespace = parts [ 0 ] ;
11831166 }
11841167 }
1168+
1169+ // Add to set if valid
1170+ if ( firstLevelNamespace ) {
1171+ namespaces . add ( firstLevelNamespace ) ;
1172+ }
11851173 } ) ;
11861174
11871175 // Sort namespaces alphabetically
11881176 const sortedNamespaces = Array . from ( namespaces ) . sort ( ) ;
11891177
1190- console . log ( "Found namespaces:" , sortedNamespaces ) ;
1178+ console . log ( "Found first-level namespaces:" , sortedNamespaces ) ;
11911179
11921180 // Generate namespace filter checkboxes
11931181 const namespaceFiltersContainer = document . getElementById ( 'namespace-filters' ) ;
@@ -1233,20 +1221,16 @@ document.addEventListener('DOMContentLoaded', function() {
12331221 checkbox . checked = true ;
12341222 checkbox . setAttribute ( 'data-namespace' , namespace ) ;
12351223
1236- // Extract the last part of the namespace for display
1237- const displayName = namespace . split ( '.' ) . pop ( ) ;
1238-
12391224 const text = document . createElement ( 'span' ) ;
1240- text . textContent = displayName ;
1241- text . title = namespace ; // Show full namespace on hover
1225+ text . textContent = namespace ;
12421226
12431227 label . appendChild ( checkbox ) ;
12441228 label . appendChild ( text ) ;
12451229 div . appendChild ( label ) ;
12461230 namespaceFiltersContainer . appendChild ( div ) ;
12471231 } ) ;
12481232
1249- console . log ( "Namespace filters initialized with" , sortedNamespaces . length , "namespaces" ) ;
1233+ console . log ( "Namespace filters initialized with" , sortedNamespaces . length , "first-level namespaces" ) ;
12501234
12511235 // Set up event listeners for namespace filters
12521236 document . querySelectorAll ( '.namespace-filter' ) . forEach ( filter => {
0 commit comments