Skip to content
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

fix: summary2 - displayType selector in override #14575

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

lassopicasso
Copy link
Contributor

@lassopicasso lassopicasso commented Feb 4, 2025

Description

  • Set "Ikke satt" as the default option. If this one is selected, displayType prop will be removed instead of being saved with "NoSet" to the backend, aligning with team apps config.

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)

Documentation

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

Summary by CodeRabbit

  • New Features

    • Enhanced the configuration interface for selecting custom configuration types.
    • Introduced a new option representing an empty value in the custom configuration type selection.
  • Bug Fixes

    • Improved validation and mapping logic to ensure only valid selection values are applied.
    • Added error handling for invalid inputs in the type selector, enhancing component robustness.
  • Refactor

    • Streamlined the logic for handling display type selections and interactions within the component.

Copy link
Contributor

coderabbitai bot commented Feb 4, 2025

Warning

Rate limit exceeded

@lassopicasso has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 15 minutes and 6 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between c7fe508 and 2c7c415.

📒 Files selected for processing (2)
  • frontend/packages/ux-editor/src/components/config/componentSpecificContent/Summary2/Override/utils.test.tsx (1 hunks)
  • frontend/packages/ux-editor/src/components/config/componentSpecificContent/Summary2/Override/utils.ts (1 hunks)
📝 Walkthrough

Walkthrough

This pull request introduces significant updates to the Summary2OverrideDisplayType component and its related functionalities. Key changes include the removal of the ReactElement import, updates to prop destructuring, and modifications to the handleCustomTypeChange function. The test suite for Summary2Override has been refined to enhance interaction with the type selector and to improve error handling. The useCustomConfigType hook has been updated to include a new empty value option, while the utility functions have been streamlined for better parameter handling. The SummaryCustomTargetType type has also been adjusted to remove the 'notSet' option.

Changes

File(s) Change Summary
frontend/.../Override/OverrideFields/Summary2OverrideDisplayType.tsx Removed ReactElement import, updated override prop destructuring, modified handleCustomTypeChange to accept newDisplayType, adjusted onChange handler for StudioNativeSelect, removed CustomConfigTypeOptions, and integrated options rendering directly.
frontend/.../Override/Summary2Override.test.tsx Enhanced interaction with type selector, refactored selection logic, added error handling for invalid input, wrapped expectations in waitFor, and renamed functions for clarity.
frontend/.../Override/hook/useCustomConfigType.ts Added an object with value: '' to the returned array and removed the notSet option.
frontend/.../Override/utils.test.tsx Streamlined variable usage by removing local declarations and using globally declared variables for tests.
frontend/.../Override/utils.ts Changed mapSelectedTypeToConfig to accept a single object parameter with a new type SelectedTypeProps, enhancing input handling based on displayType.
frontend/.../types/ComponentSpecificConfig.ts Updated SummaryCustomTargetType to remove 'notSet', leaving only 'list' and 'string'.

Possibly related PRs

Suggested labels

team/studio-domain2, skip-manual-testing

Suggested reviewers

  • Jondyr
  • mlqn

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added area/ui-editor Area: Related to the designer tool for assembling app UI in Altinn Studio. solution/studio/designer Issues related to the Altinn Studio Designer solution. frontend labels Feb 4, 2025
@lassopicasso lassopicasso changed the title fix display type in override fix: displayType selector in override Feb 4, 2025
@lassopicasso lassopicasso changed the title fix: displayType selector in override fix: summary2 - displayType selector in override Feb 4, 2025
@lassopicasso lassopicasso marked this pull request as ready for review February 4, 2025 15:34
Copy link

codecov bot commented Feb 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.73%. Comparing base (ec108d4) to head (2c7c415).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14575      +/-   ##
==========================================
- Coverage   95.73%   95.73%   -0.01%     
==========================================
  Files        1908     1908              
  Lines       24876    24874       -2     
  Branches     2846     2846              
==========================================
- Hits        23816    23814       -2     
  Misses        799      799              
  Partials      261      261              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 49a009a and c7fe508.

📒 Files selected for processing (5)
  • frontend/packages/shared/src/types/ComponentSpecificConfig.ts (1 hunks)
  • frontend/packages/ux-editor/src/components/config/componentSpecificContent/Summary2/Override/OverrideFields/Summary2OverrideDisplayType.tsx (4 hunks)
  • frontend/packages/ux-editor/src/components/config/componentSpecificContent/Summary2/Override/Summary2Override.test.tsx (4 hunks)
  • frontend/packages/ux-editor/src/components/config/componentSpecificContent/Summary2/Override/hook/useCustomConfigType.ts (1 hunks)
  • frontend/packages/ux-editor/src/components/config/componentSpecificContent/Summary2/Override/utils.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • frontend/packages/ux-editor/src/components/config/componentSpecificContent/Summary2/Override/hook/useCustomConfigType.ts
  • frontend/packages/ux-editor/src/components/config/componentSpecificContent/Summary2/Override/Summary2Override.test.tsx
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Build environment and run e2e test
  • GitHub Check: Testing
  • GitHub Check: CodeQL
🔇 Additional comments (4)
frontend/packages/ux-editor/src/components/config/componentSpecificContent/Summary2/Override/utils.ts (2)

6-9: LGTM! Well-structured type definition.

The new SelectedTypeProps type clearly defines the shape of the configuration object with an optional displayType.


11-20: LGTM! Clean implementation of the configuration mapping.

The function now handles undefined displayType gracefully, which aligns with the PR objective of removing the displayType property when "Ikke satt" is selected.

frontend/packages/ux-editor/src/components/config/componentSpecificContent/Summary2/Override/OverrideFields/Summary2OverrideDisplayType.tsx (2)

25-27: LGTM! Clean prop destructuring and component type detection.

The code efficiently extracts required props and determines the component type.


37-43: LGTM! Improved handler implementation.

The handleCustomTypeChange function now directly accepts the displayType and uses the new mapSelectedTypeToConfig structure effectively.

Copy link
Member

@Jondyr Jondyr left a comment

Choose a reason for hiding this comment

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

Nice work! 💪 LGTM ✅

Copy link
Contributor

@mlqn mlqn left a comment

Choose a reason for hiding this comment

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

Tested OK in dev! 🚀 Up to you decide to merge it as is or make the additional changes related to the default value we discussed this Friday

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ui-editor Area: Related to the designer tool for assembling app UI in Altinn Studio. frontend solution/studio/designer Issues related to the Altinn Studio Designer solution.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Override Type: String, List, or Not set – change default to not set and potential Config Adjustment
3 participants