Skip to content

fix(inventory): default sub-tab is Active Commitments, not RI Exchange - #757

Merged
cristim merged 1 commit into
feat/multicloud-web-frontendfrom
fix/751-inventory-default-tab
May 27, 2026
Merged

fix(inventory): default sub-tab is Active Commitments, not RI Exchange#757
cristim merged 1 commit into
feat/multicloud-web-frontendfrom
fix/751-inventory-default-tab

Conversation

@cristim

@cristim cristim commented May 27, 2026

Copy link
Copy Markdown
Member

Summary

Clicking "Inventory & Coverage" in the sidebar opened the RI Exchange sub-tab by default. Users expect the at-a-glance Active Commitments view; RI Exchange is a more specialised workflow.

Fix

  • DEFAULT_SUB_SECTION changed from 'ri-exchange' to 'active-commitments'.
  • index.html: active class and aria-selected="true" moved from RI Exchange to Active Commitments; hidden flipped accordingly.
  • Deep links (?subSection=ri-exchange) still work; only the no-param default changes.

Files changed

  • frontend/src/inventory.ts
  • frontend/src/index.html
  • frontend/src/__tests__/inventory.test.ts

Test plan

  • Updated buildInventoryDOM helper, fallback test (unknown sub-section -> active-commitments), and loadInventory first-load assertion.
  • All 63 test suites pass (2018 tests).
  • Manual: click Inventory & Coverage from a fresh page load, confirm Active Commitments is visible and highlighted.

Closes #751.

Summary by CodeRabbit

  • Updates
    • The Inventory & Coverage tab now defaults to displaying the "Active Commitments" sub-tab instead of "RI Exchange" when you first access the section.

Review Change Stack

@cristim cristim added triaged Item has been triaged priority/p3 Polish / idea / may never ship severity/low Minor harm urgency/this-sprint Within the current sprint impact/all-users Affects every user effort/xs Trivial / one-liner type/bug Defect labels May 27, 2026
@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2e9f0730-1772-4488-9377-30e49e017053

📥 Commits

Reviewing files that changed from the base of the PR and between 3249775 and 13b99dd.

📒 Files selected for processing (3)
  • frontend/src/__tests__/inventory.test.ts
  • frontend/src/index.html
  • frontend/src/inventory.ts

📝 Walkthrough

Walkthrough

The default Inventory & Coverage sub-section was switched from RI Exchange to Active Commitments. The constant definition, HTML markup (including active state and visibility), and test expectations were updated consistently to reflect the new landing tab behavior.

Changes

Default Inventory Sub-Section

Layer / File(s) Summary
Default sub-section constant and documentation
frontend/src/inventory.ts
DEFAULT_SUB_SECTION is changed from ri-exchange to active-commitments, and loadInventory() documentation is updated to reflect the new default behavior when no sub-section is selected in the session.
DOM markup for new default state
frontend/src/index.html
"Active commitments" button is marked as active/selected and its panel is made visible by default; "RI Exchange" button loses its active state and its panel is explicitly hidden.
Test updates for new default behavior
frontend/src/__tests__/inventory.test.ts
Test fixtures and DOM builder now set active-commitments as the active tab with ri-exchange inactive; assertions updated so unknown sub-sections fall back to active-commitments and default landing checks verify that tab is shown.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • LeanerCloud/CUDly#760: Both PRs modify the Inventory & Coverage sub-tab behavior in frontend/src/inventory.ts/inventory.test.ts (default/fallback subsection selection vs coverage sub-tab routing/loader), so the main PR's UI tab switching changes are directly connected to the coverage tab implementation work.

Poem

🐰 Hops and commits with glee,
Active wins by default, you see!
RI sleeps in hidden night,
While commitments shine bright!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: switching the default inventory sub-tab from RI Exchange to Active Commitments.
Linked Issues check ✅ Passed All acceptance criteria from issue #751 are met: defaulting to Active Commitments [#751], preserving deep-link behavior [#751], and updating UI tab order [#751].
Out of Scope Changes check ✅ Passed All changes directly address the stated objective of changing the default inventory sub-tab with no unrelated modifications present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/751-inventory-default-tab

Comment @coderabbitai help to get the list of available commands and usage tips.

@cristim

cristim commented May 27, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim

cristim commented May 27, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim

cristim commented May 27, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Full review triggered.

Users opening Inventory & Coverage expect the at-a-glance commitment
view, not the more specialised RI Exchange workflow.

Closes #751.
@cristim
cristim force-pushed the fix/751-inventory-default-tab branch from efcd122 to 13b99dd Compare May 27, 2026 19:02
@cristim

cristim commented May 27, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim
cristim merged commit eda0c6b into feat/multicloud-web-frontend May 27, 2026
5 checks passed
cristim added a commit that referenced this pull request Jun 1, 2026
…min (closes #902) (#905)

Resolve QA A.4: Inventory & Coverage remembered its last sub-tab via
hidden in-memory session state while Admin always read its sub-tab from
the /admin/<subtab> URL. The inconsistency was the defect.

Make Inventory sub-tabs URL-addressable as /inventory/<subtab>, matching
the existing Admin convention:

- loadInventory() now derives the sub-section from the URL path
  (getInventorySubTabFromPath), not the module-level currentSubSection, so
  a fresh /inventory lands on the default (active-commitments) and a
  /inventory/<subtab> deep link lands on that sub-tab.
- A sub-nav click routes through navigation.switchInventorySubTab, which
  pushes /inventory/<subtab> via history.pushState so the view is
  shareable/bookmarkable and browser back/forward works.
- The history push lives in navigation.ts alongside switchSettingsSubTab so
  the single historyId counter stays authoritative for the back/forward
  dirty-guard; inventory.ts keeps the pure DOM view switch.

Supersedes the partial PR #757 session-memory behavior with explicit URL
state. Both pages now behave identically; existing /admin/* deep links are
unaffected.

Tests assert, for each page: no param -> default sub-tab, explicit param ->
that sub-tab, switching updates the URL (query/hash preserved, no duplicate
entry), and unknown param -> default.
@cristim
cristim deleted the fix/751-inventory-default-tab branch June 3, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/xs Trivial / one-liner impact/all-users Affects every user priority/p3 Polish / idea / may never ship severity/low Minor harm triaged Item has been triaged type/bug Defect urgency/this-sprint Within the current sprint

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant