Skip to content

Show switch to show/hide expired resources in ResourceList - #2386

Merged
mgunnerud merged 3 commits into
mainfrom
feat/3321-part2
Jul 28, 2026
Merged

Show switch to show/hide expired resources in ResourceList#2386
mgunnerud merged 3 commits into
mainfrom
feat/3321-part2

Conversation

@mgunnerud

@mgunnerud mgunnerud commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Description

  • If prop enableSearch is on, show expired resources filter switch
  • Only show switch if at least one resource in the unfiltered list is expired
  • The switch can be visible in all views with resource filter toolbar (which are many)
  • For testing, I have added a MigratedApp resource to the access package "Jordbruk" in AT22
image

Related Issue(s)

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)
  • All tests run green

Documentation

  • User documentation is updated with a separate linked PR in altinn-studio-docs. (if applicable)

Summary by CodeRabbit

  • New Features

    • Added an option to show expired services in resource lists.
    • The option appears only when expired services are available and includes explanatory help.
    • Improved toolbar layout for search, filtering, and delegation actions.
  • Bug Fixes

    • Expired services are now excluded from filtered results by default unless explicitly included.

@github-actions github-actions Bot added the kind/feature-request Used when issue is a new feature or request label Jul 17, 2026
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

ResourceList now conditionally offers an “include expired services” switch, passes its state to useFilteredResources, and excludes expired resources by default. Toolbar CSS was updated for wrapping, spacing, switch alignment, and delegation modal placement.

Changes

Expired resource visibility

Layer / File(s) Summary
Expired-resource filtering contract
src/features/amUI/common/ResourceList/useFilteredResources.ts
The hook accepts expired-resource options, excludes expired resources when disabled, and updates memoization dependencies.
Expired-resource toggle and toolbar layout
src/features/amUI/common/ResourceList/ResourceList.tsx, src/features/amUI/common/ResourceList/ResourceList.module.css
ResourceList detects expired resources, renders the switch and help popover, connects switch state to filtering, and updates toolbar alignment.
Estimated code review effort: 3 (Moderate) ~20 minutes

Possibly related PRs

Suggested reviewers: sonwit, allinox

Poem

Expired services wait in the shade,
A tiny switch invites their parade.
Search flows onward, filters align,
Popovers answer questions in time.
The toolbar wraps neatly in line.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a switch in ResourceList to show or hide expired resources.
✨ 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 feat/3321-part2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/features/amUI/common/ResourceList/useFilteredResources.ts (1)

51-59: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Add missing functions to the dependency array.

Both isExpiredResource and getOwnerOrgCode are used inside the useMemo callback but are missing from the dependency array.

🐛 Proposed fix to add missing dependencies
   }, [
     resources,
     normalizedSearch,
     serviceOwnerFilter,
     includeExpiredResources,
     getDescription,
     getOwnerName,
     getResourceName,
+    getOwnerOrgCode,
+    isExpiredResource,
   ]);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/features/amUI/common/ResourceList/useFilteredResources.ts` around lines
51 - 59, Update the useMemo dependency array in useFilteredResources to include
both isExpiredResource and getOwnerOrgCode, matching the functions used by its
callback while preserving the existing dependencies.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/features/amUI/common/ResourceList/useFilteredResources.ts`:
- Around line 51-59: Update the useMemo dependency array in useFilteredResources
to include both isExpiredResource and getOwnerOrgCode, matching the functions
used by its callback while preserving the existing dependencies.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5d804a9d-15f7-4059-a069-b2c1eddf5a6b

📥 Commits

Reviewing files that changed from the base of the PR and between f198cd3 and b2818a6.

📒 Files selected for processing (3)
  • src/features/amUI/common/ResourceList/ResourceList.module.css
  • src/features/amUI/common/ResourceList/ResourceList.tsx
  • src/features/amUI/common/ResourceList/useFilteredResources.ts

@mgunnerud
mgunnerud requested a review from sonwit July 28, 2026 09:58

@sonwit sonwit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ser bra ut 👍🏼

@mgunnerud
mgunnerud merged commit a304d1b into main Jul 28, 2026
5 checks passed
@mgunnerud
mgunnerud deleted the feat/3321-part2 branch July 28, 2026 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature-request Used when issue is a new feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Legg til toggle for filtrering av utgåtte tjenester i tilgangspakker

2 participants