feat: group fact source table by trait with collapsible rows and per-trait add#95
feat: group fact source table by trait with collapsible rows and per-trait add#95deacon-mp wants to merge 1 commit into
Conversation
Facts in the Fact Sources table are now grouped by trait name, with each group showing a header row containing the trait, the count of values, and an "Add Value" button. Individual value rows are collapsible per trait group. This restores the v4 behavior of showing one trait with multiple values grouped together rather than one row per fact. Also adds an "Add Value" button per trait group header so users can append a new value to an existing trait without having to manually retype the trait name. Addresses #28
There was a problem hiding this comment.
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
This PR groups the Fact Sources table by trait name with collapsible rows and adds per-trait "Add Value" buttons, addressing issue #28 which requested restoring v4 grouping and single-click value addition features.
Changes:
- Facts are grouped by trait name using a computed property, displayed under collapsible group header rows with value counts
- An "Add Value" button on each group header appends a new fact row with the trait pre-filled
- Existing add/edit/save/delete functionality is preserved with index-based tracking
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (!groups[trait]) { | ||
| groups[trait] = []; | ||
| } | ||
| groups[trait].push({ ...fact, _index: index }); |
| let showAbilitySelection = ref(false); | ||
| let showAddFromAdversary = ref(false); | ||
|
|
||
| // Track which trait groups are expanded (collapsed by default if many values) |
There was a problem hiding this comment.
Pull request overview
This PR groups facts by trait name in the Fact Sources table, addressing issue #28. Instead of a flat list, each unique trait becomes a collapsible group header showing a value count, with individual fact rows nested beneath. An "Add Value" button on each group header allows adding new values to an existing trait without retyping the trait name.
Changes:
- Facts are grouped by trait via a
groupedFactscomputed property, with collapsible group headers and per-trait "Add Value" functionality - The template is restructured from a flat
v-forover facts to nested templates iterating over grouped traits and their values - Expansion state is tracked per-trait via an
expandedTraitsref, defaulting to expanded
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (!groups[trait]) { | ||
| groups[trait] = []; | ||
| } | ||
| groups[trait].push({ ...fact, _index: index }); |
| let showAbilitySelection = ref(false); | ||
| let showAddFromAdversary = ref(false); | ||
|
|
||
| // Track which trait groups are expanded (collapsed by default if many values) |
Summary
Addresses #28
The Fact Sources page previously displayed facts as a flat 1:1 list of trait → value rows. This became unwieldy with many facts, and there was no way to add a new value to an existing trait without retyping the trait name.
Changes
Observation 1 fix: Facts are now grouped by trait name. Each unique trait appears as a collapsible group header row showing the trait name and a count of its values. Individual value rows appear under each group header and can be collapsed/expanded per trait.
Observation 2 fix: Each group header row includes an "Add Value" button that appends a new fact row with the trait name pre-filled, making it easy to add multiple values to an existing trait with one click.
How Has This Been Tested?
Manually verified in the Fact Sources page:
Type of change