Graph page topic selection preset#629
Conversation
| // silently skipped on Apply (with a warn toast), not hard-errored. | ||
| export const PRESET_SEEDS: PresetSeed[] = [ | ||
| { | ||
| name: 'test preset', |
There was a problem hiding this comment.
'test preset' ships to every fresh user via loadOrSeed(). Replace with real defaults or empty array.
| <button | ||
| pButton | ||
| type="button" | ||
| label="Restore defaults" |
There was a problem hiding this comment.
We should change the name of this button and the related functions to something more related to it's function: something like sync current templates or something like that.
| } | ||
| }); | ||
| ref.onClose.pipe(take(1)).subscribe((matched: DataType[] | null) => { | ||
| if (matched) { |
There was a problem hiding this comment.
Skip setSelectedDataTypes when matched is empty and unknown isn't; let the "Unknown Topics Skipped" warn toast be the only feedback
There was a problem hiding this comment.
fix: if (matched && matched.length > 0)
There was a problem hiding this comment.
also do the same for mobile sidebar
| import { TestBed } from '@angular/core/testing'; | ||
| import { GraphPresetService, PRESET_SEEDS, Preset } from './graph-preset.service'; | ||
|
|
||
| const STORAGE_KEY = 'argos.graphPresets'; |
| export class GraphPresetService { | ||
| private topicSelectionService = inject(TopicSelectionService); | ||
| private messageService = inject(MessageService); | ||
| private subject = new BehaviorSubject<Preset[]>([]); |
There was a problem hiding this comment.
can add some more descriptive naming here.
|
|
||
| replacePreset = (id: string, patch: Partial<Pick<Preset, 'name' | 'topicNames'>>): void => { | ||
| const next = this.subject.value.map((p) => { | ||
| if (p.id !== id) return p; |
There was a problem hiding this comment.
this should be able to be simplified
| private messageService = inject(MessageService); | ||
| private subject = new BehaviorSubject<Preset[]>([]); | ||
| private presets$ = this.subject.asObservable(); | ||
| private activePresetName$: Observable<string | undefined> = combineLatest([ |
There was a problem hiding this comment.
actually can you do some looking into a documentation on this whole service.

Changes
Adds a client-side topic-selection preset system to the graph page so engineers can save and reapply named topic groupings without having to reselect each session. New GraphPresetService persists presets in localStorage. New PresetDialogComponent provides save selection, apply, upload, download, delete, and restore defaults actions. It opens from both graph sidebars via DialogService. The graph sidebar gets a presets row above the topic tree containing a select dropdown for fast applying and a manage button, with the dropdown's defaultValue bound to activePresetName so it tracks the live selection.
Notes
Closes #566