-
Notifications
You must be signed in to change notification settings - Fork 13
feat: Add hierarchical product picker with search and caching #707
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Implement hierarchical tree view for ad unit selection in product editor with search filtering, lazy loading, and response caching. Add flask-caching dependency for improved inventory performance. Includes expandable/collapsible tree nodes, search highlighting, and ancestor node expansion for search results. 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
Extract 200+ lines of tree CSS from add_product_gam.html into shared partial component for reusability across templates. Create foundation for unified tree implementation.
Changes:
- Create templates/partials/hierarchical_tree_styles.html with shared CSS
- Create templates/partials/hierarchical_tree_scripts.html with utility functions
- Update add_product_gam.html to include shared styles via {% include %}
- Reduce duplication and enable consistent tree styling
Note: JavaScript still inline in product picker (product-specific logic). Inventory browser tree update deferred to future work.
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
Fix "Select Matched Formats" button not appearing when using hierarchical tree picker. The tree API response was missing size metadata, causing the format matching logic to fail. Changes: - Add `sizes` field to inventory tree API response (inventory.py:885) - Update JavaScript to use sizes from tree response (add_product_gam.html:448) - Remove hardcoded empty sizes array that was breaking matching This enables the "Select All Matching" button to appear when ad units with size information are selected via the hierarchical tree picker. Fixes: Format matching now works correctly with hierarchical ad unit selection Tests: 861 unit tests passing 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
When a parent ad unit is selected from the tree picker, recursively extract sizes from all child ad units for format matching. This enables the "Select Matched Formats" button to appear when parent units with sized children are selected. Changes: - Add recursive extractSizesFromUnit() helper function - Store children array in inventoryCache during tree rendering - Recursively traverse child units to collect all sizes Example: Selecting "Scribd Ad Exchange Display" (parent) now includes sizes from "Scribd 300x250" (child) for format matching. Tests: 861 unit tests passing 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
Fix child size extraction by accessing sizes directly from child objects instead of looking them up in cache. The children array contains full objects from the tree API with sizes already populated. Changes: - Access child.sizes directly instead of cache lookup - Add grandchildren caching for multi-level hierarchies - Simplify recursive extraction logic This fixes the issue where selecting a parent ad unit wasn't extracting sizes from its children for format matching. Tests: 861 unit tests passing 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
The critical bug: When editing a product, ad units were pre-cached from the flat list API (no children). Then when opening the tree picker, the tree rendering skipped re-caching because units were already cached, so the children array was never stored. Solution: Always update the cache when rendering the tree, overwriting any previous data from the flat list API with the full hierarchical data including children. This fixes child size extraction when editing existing products. Tests: All tests passing 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
Critical fix for edit mode: When editing a product with pre-selected ad units, fetch the tree API (not flat list) to ensure all units are cached with their children arrays. This enables size extraction from child ad units. Changes: - Replace flat list API call with tree API call in edit mode - Add recursive cacheTreeUnits() to process entire tree hierarchy - Ensures children arrays are available for size extraction on page load This fixes the issue where selecting a parent ad unit in edit mode wouldn't extract sizes from its children. Tests: 861 unit tests passing 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
Resolved conflict in templates/add_product_gam.html by keeping our tree API approach for hierarchical size extraction (required for child ad unit sizes) while incorporating debug logging from main. Conflict resolution: - Kept tree API fetch (not flat list) for edit mode initialization - Preserved recursive cacheTreeUnits() function for hierarchical caching - Added debug console.log statements from main for troubleshooting - This ensures child ad unit sizes are available for format matching Other changes from main: - Remove MCP protocol test button and APIs (PR #702) - Make media_buy_ids optional per AdCP spec (PR #704) - Fix User record creation during OAuth (PR #701) - Fix inventory fetching for placements (multiple commits) - Various bug fixes and improvements Tests: Will run after merge completion 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
danf-newton
pushed a commit
to Newton-Research-Inc/salesagent
that referenced
this pull request
Nov 24, 2025
…extprotocol#707) * feat: Add hierarchical product picker with search and caching Implement hierarchical tree view for ad unit selection in product editor with search filtering, lazy loading, and response caching. Add flask-caching dependency for improved inventory performance. Includes expandable/collapsible tree nodes, search highlighting, and ancestor node expansion for search results. 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com> * refactor: Extract hierarchical tree styles into reusable partial Extract 200+ lines of tree CSS from add_product_gam.html into shared partial component for reusability across templates. Create foundation for unified tree implementation. Changes: - Create templates/partials/hierarchical_tree_styles.html with shared CSS - Create templates/partials/hierarchical_tree_scripts.html with utility functions - Update add_product_gam.html to include shared styles via {% include %} - Reduce duplication and enable consistent tree styling Note: JavaScript still inline in product picker (product-specific logic). Inventory browser tree update deferred to future work. 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com> * fix: Include ad unit sizes in tree API for format matching Fix "Select Matched Formats" button not appearing when using hierarchical tree picker. The tree API response was missing size metadata, causing the format matching logic to fail. Changes: - Add `sizes` field to inventory tree API response (inventory.py:885) - Update JavaScript to use sizes from tree response (add_product_gam.html:448) - Remove hardcoded empty sizes array that was breaking matching This enables the "Select All Matching" button to appear when ad units with size information are selected via the hierarchical tree picker. Fixes: Format matching now works correctly with hierarchical ad unit selection Tests: 861 unit tests passing 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com> * fix: Extract sizes from child ad units in hierarchical tree When a parent ad unit is selected from the tree picker, recursively extract sizes from all child ad units for format matching. This enables the "Select Matched Formats" button to appear when parent units with sized children are selected. Changes: - Add recursive extractSizesFromUnit() helper function - Store children array in inventoryCache during tree rendering - Recursively traverse child units to collect all sizes Example: Selecting "Scribd Ad Exchange Display" (parent) now includes sizes from "Scribd 300x250" (child) for format matching. Tests: 861 unit tests passing 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com> * fix: Extract sizes directly from child objects in tree Fix child size extraction by accessing sizes directly from child objects instead of looking them up in cache. The children array contains full objects from the tree API with sizes already populated. Changes: - Access child.sizes directly instead of cache lookup - Add grandchildren caching for multi-level hierarchies - Simplify recursive extraction logic This fixes the issue where selecting a parent ad unit wasn't extracting sizes from its children for format matching. Tests: 861 unit tests passing 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com> * fix: Always update cache with tree data to include children The critical bug: When editing a product, ad units were pre-cached from the flat list API (no children). Then when opening the tree picker, the tree rendering skipped re-caching because units were already cached, so the children array was never stored. Solution: Always update the cache when rendering the tree, overwriting any previous data from the flat list API with the full hierarchical data including children. This fixes child size extraction when editing existing products. Tests: All tests passing 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com> * fix: Load tree API when editing products to cache hierarchical data Critical fix for edit mode: When editing a product with pre-selected ad units, fetch the tree API (not flat list) to ensure all units are cached with their children arrays. This enables size extraction from child ad units. Changes: - Replace flat list API call with tree API call in edit mode - Add recursive cacheTreeUnits() to process entire tree hierarchy - Ensures children arrays are available for size extraction on page load This fixes the issue where selecting a parent ad unit in edit mode wouldn't extract sizes from its children. Tests: 861 unit tests passing 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Implement hierarchical tree view for ad unit selection in product editor with search filtering, lazy loading, and response caching. Add flask-caching dependency for improved inventory API performance.
Changes
Testing
🤖 Generated with Claude Code