diff --git a/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-desktop/graph-sidebar-desktop.component.css b/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-desktop/graph-sidebar-desktop.component.css index 5c9f47ea..2bb58350 100644 --- a/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-desktop/graph-sidebar-desktop.component.css +++ b/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-desktop/graph-sidebar-desktop.component.css @@ -5,6 +5,19 @@ margin-top: 10px; } +.presets-row { + display: flex; + align-items: center; + justify-content: space-between; + gap: 8px; + margin-bottom: 8px; +} + +.preset-select { + flex: 1 1 auto; + min-width: 0; +} + .header-row { display: flex; align-items: center; diff --git a/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-desktop/graph-sidebar-desktop.component.html b/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-desktop/graph-sidebar-desktop.component.html index 39f4bb55..ba40bd1a 100644 --- a/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-desktop/graph-sidebar-desktop.component.html +++ b/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-desktop/graph-sidebar-desktop.component.html @@ -1,4 +1,17 @@
+
+ + +
(() => ({ + placeholder: 'Apply Preset…', + options: this.presets().map( + (p): DropdownOption => ({ + name: p.name, + function: () => this.applyPreset(p) + }) + ) + })); + activePresetName = toSignal(this.presetService.getActivePresetName(), { initialValue: undefined }); + ngOnInit(): void { const nodes = dataTypesToNodes(this.dataTypes()); this.treeNodes = mapNodesToTreeNodes(nodes, this.storage, this.injector); @@ -68,6 +91,24 @@ export default class GraphSidebarDesktopComponent implements OnInit { this.selectedNodes = undefined; }; + openPresetsDialog = () => { + const ref = this.dialogService.open(PresetDialogComponent, { + header: 'Topic Presets', + width: '640px', + draggable: true, + closable: true, + closeAriaLabel: 'Close', + data: { + dataTypes: this.dataTypes() + } + }); + ref.onClose.pipe(take(1)).subscribe((matched: DataType[] | null) => { + if (matched) { + this.applyMatched(matched); + } + }); + }; + nodeSelect(event: TreeNodeSelectEvent) { const dt = event.node.data?.dataType; if (dt) { @@ -89,4 +130,14 @@ export default class GraphSidebarDesktopComponent implements OnInit { this.topicSelectionService.removeDataType(dt); } } + + private applyPreset(preset: Preset) { + const matched = this.presetService.resolvePresetTopics(preset, this.dataTypes()); + this.applyMatched(matched); + } + + private applyMatched(matched: DataType[]) { + this.topicSelectionService.setSelectedDataTypes(matched); + this.selectedNodes = findSelectedTreeNodes(this.activeNodes(), this.topicSelectionService); + } } diff --git a/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-mobile/graph-sidebar-mobile.component.css b/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-mobile/graph-sidebar-mobile.component.css index 3a2b26b1..ed54d698 100644 --- a/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-mobile/graph-sidebar-mobile.component.css +++ b/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-mobile/graph-sidebar-mobile.component.css @@ -27,6 +27,17 @@ height: 100%; } +.presets-row { + display: flex; + align-items: center; + gap: 8px; +} + +.preset-select { + flex: 1 1 auto; + min-width: 0; +} + .toggle-group { display: inline-flex; align-items: center; diff --git a/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-mobile/graph-sidebar-mobile.component.html b/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-mobile/graph-sidebar-mobile.component.html index fe998c27..4f9cdff3 100644 --- a/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-mobile/graph-sidebar-mobile.component.html +++ b/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-mobile/graph-sidebar-mobile.component.html @@ -6,6 +6,19 @@