Skip to content

Commit c09373d

Browse files
feat(schema): clicking the [count] bracket in the tree opens the Entries tab
The on-page instructions already promised that "the number of instances of each class is shown in square brackets and links to a listing of all instances of that class," but the implementation routed both the class name and the count to the same handler -- always landing on Properties. Split the tree-node row into two adjacent buttons. The class name still calls onTreeNodeClick (navigates and defaults to Properties). The count now calls a new onTreeNodeCountClick which navigates with ?tab=entries and stops propagation so the parent name-button doesn't also fire. selectClass reads ?tab=entries from the route's queryParamMap so a direct URL like /content/schema/Reactome?tab=entries also lands straight on Entries.
1 parent 7aeb7e5 commit c09373d

3 files changed

Lines changed: 33 additions & 2 deletions

File tree

projects/website-angular/src/app/content/schema/schema.component.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,12 @@ <h3>Data Model</h3>
5555
}
5656
<button class="node-label" (click)="onTreeNodeClick(node.className)">
5757
<span class="node-name">{{ node.className }}</span>
58-
<span class="node-count">[{{ node.count }}]</span>
5958
</button>
59+
<button
60+
class="node-count"
61+
(click)="onTreeNodeCountClick(node.className, $event)"
62+
title="Show entries"
63+
>[{{ node.count }}]</button>
6064
</div>
6165
}
6266
</div>

projects/website-angular/src/app/content/schema/schema.component.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,16 @@ $sidebar-width: 320px;
192192
color: #999;
193193
font-size: 0.75rem;
194194
flex-shrink: 0;
195+
background: none;
196+
border: none;
197+
padding: 2px 4px;
198+
cursor: pointer;
199+
font-family: inherit;
200+
201+
&:hover {
202+
color: var(--primary);
203+
text-decoration: underline;
204+
}
195205
}
196206

197207
// --- Main content ---

projects/website-angular/src/app/content/schema/schema.component.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,15 @@ export class SchemaComponent implements OnInit, OnDestroy {
163163
this.sidebarOpen = false;
164164
}
165165

166+
onTreeNodeCountClick(className: string, event: Event) {
167+
// Stop the parent .node-label button from also firing onTreeNodeClick.
168+
event.stopPropagation();
169+
this.router.navigate(['/content/schema', className], {
170+
queryParams: { tab: 'entries' },
171+
});
172+
this.sidebarOpen = false;
173+
}
174+
166175
onTreeSearch(event: Event) {
167176
const value = (event.target as HTMLInputElement).value;
168177
this.treeSearchQuery = value.toLowerCase().trim();
@@ -202,12 +211,20 @@ export class SchemaComponent implements OnInit, OnDestroy {
202211

203212
selectClass(className: string) {
204213
this.selectedClass = className;
205-
this.activeTab = 'properties';
206214
this.entries = [];
207215
this.entriesPage = 1;
208216
this.selectedInstanceId = null;
209217
this.loadAttributes(className);
210218

219+
// Respect ?tab=entries in the URL (set by the count-bracket click in
220+
// the tree sidebar, or pasted directly) so the page lands straight
221+
// on the Entries tab. Otherwise default to Properties.
222+
if (this.route.snapshot.queryParamMap.get('tab') === 'entries') {
223+
this.switchToEntries();
224+
} else {
225+
this.activeTab = 'properties';
226+
}
227+
211228
// Expand tree path to this node
212229
this.expandPathTo(className);
213230
}

0 commit comments

Comments
 (0)