Skip to content

feat: group fact source table by trait with collapsible rows and per-trait add#95

Open
deacon-mp wants to merge 1 commit into
masterfrom
fix/fact-table-group-by-trait
Open

feat: group fact source table by trait with collapsible rows and per-trait add#95
deacon-mp wants to merge 1 commit into
masterfrom
fix/fact-table-group-by-trait

Conversation

@deacon-mp
Copy link
Copy Markdown
Contributor

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:

  • Facts with the same trait are displayed under a single group header
  • Clicking the chevron icon collapses/expands the rows for that trait
  • The "Add Value" button creates a new editable row with the trait pre-filled
  • Existing edit/save/delete functionality still works per row
  • "Add Fact" still creates a blank row for new traits

Type of change

  • New feature / enhancement (non-breaking, restores v4 behavior)

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
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 groupedFacts computed property, with collapsible group headers and per-trait "Add Value" functionality
  • The template is restructured from a flat v-for over facts to nested templates iterating over grouped traits and their values
  • Expansion state is tracked per-trait via an expandedTraits ref, 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants