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

feat: Main section text and binding #14814

Merged
merged 30 commits into from
Apr 1, 2025
Merged

Conversation

lassopicasso
Copy link
Contributor

@lassopicasso lassopicasso commented Feb 26, 2025

Description

This PR adds title config and main data model binding for the component to the main config, behind a feature flag. I have manually tested it with components such as a simple input, address, summary, and subform.

Refactored the code to make adding additional component specific configs to the main config easier.

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)

Documentation

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

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced new DataModelMainConfig and TextMainConfig components for enhanced management of form settings.
    • Added a visual loading indicator in the PropertiesHeader component to improve user feedback during data fetching.
    • Implemented specific handling for the Summary2 component type, enhancing its functionality.
    • Added a new test suite for the DataModelMainConfig component and introduced tests for the TextMainConfig component to improve coverage.
  • Bug Fixes

    • Improved test coverage for various components, ensuring correct behavior under different conditions.
  • Refactor

    • Streamlined configuration interfaces for a cleaner properties panel experience.
    • Simplified component logic by removing unnecessary state management and props.
    • Updated test setups for consistency and clarity in validation processes.
  • Style

    • Enhanced styling for the .mainContent class to improve layout spacing.
  • Chores

    • Updated language strings for improved clarity in user interface messages.

Sorry, something went wrong.

Copy link
Contributor

coderabbitai bot commented Feb 26, 2025

📝 Walkthrough

Walkthrough

This pull request introduces updates to the UX Editor package, including new components (DataModelMainConfig and TextMainConfig) and enhanced test cases for these components. It modifies existing components like ComponentMainConfig, HeaderMainConfig, and PropertiesHeader to improve functionality, including the addition of a loading spinner in PropertiesHeader. The changes also involve updates to import paths, removal of unnecessary props, and restructuring of test cases to align with new component designs and functionalities.

Changes

File(s) Change Summary
frontend/.../Properties.test.tsx, frontend/.../PropertiesHeader/{DataModelMainConfig.test.tsx,PropertiesHeader.test.tsx,TextMainConfig.test.tsx} Updated test files by adding new tests for DataModelMainConfig and TextMainConfig, introducing a spinner loading test in PropertiesHeader, and refining query client setup in properties tests.
frontend/.../PropertiesHeader/{ComponentMainConfig.tsx,DataModelMainConfig.tsx,HeaderMainConfig.tsx,PropertiesHeader.tsx,TextMainConfig.tsx} Modified components: Updated ComponentMainConfig to use an absolute import for FormItem; added new DataModelMainConfig and TextMainConfig components; removed the children prop from HeaderMainConfig; and enhanced PropertiesHeader with a loading spinner via useComponentSchemaQuery and conditional rendering based on schema availability.
frontend/.../PropertiesHeader/SpecificMainConfig/SummaryMainConfig.tsx, frontend/.../config/componentSpecificContent/Summary2/{Override/Summary2Override.test.tsx,Override/Summary2Override.tsx,Summary2Component.tsx} Removed unnecessary logic and components from SummaryMainConfig, updated Summary2Override to accept a structured component prop, and streamlined Summary2Component to delegate override management to parent components.
frontend/.../PropertiesHeader/PropertiesHeader.module.css Modified styling for the .mainContent class to adjust spacing and padding.

Possibly related PRs

  • feat: summary2 filter override components #14470: The changes in the main PR are related to the modifications in the Summary2Override component, specifically regarding the handling of component state and the introduction of a target prop, which aligns with the updates made in the retrieved PR that also focuses on enhancing the Summary2Override component's functionality.
  • fix: summary2 - displayType selector in override  #14575: The changes in the main PR, which involve updates to the Properties.test.tsx file and the handling of the Summary component, are related to the modifications in the retrieved PR that focus on the Summary2Override component, particularly in how display types are managed and rendered. Both PRs deal with the Summary2 component type and its associated logic, indicating a direct connection at the code level.
  • fix: remove forceshow in summary2 - not supported in app #14606: The changes in the main PR, which involve updates to the Properties.test.tsx file and the introduction of a new test suite for the Summary component, are related to the modifications in the retrieved PR that remove the forceShow configuration from the Summary2Override component, as both involve handling the Summary2 component type and its associated configurations.

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between fe32796 and be1c4a8.

📒 Files selected for processing (1)
  • frontend/language/src/nb.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/language/src/nb.json

🪧 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.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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 26, 2025
@lassopicasso lassopicasso changed the title Main section text and binding feat: Main section text and binding Feb 26, 2025
@lassopicasso lassopicasso linked an issue Feb 26, 2025 that may be closed by this pull request
7 tasks
Copy link

codecov bot commented Mar 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.95%. Comparing base (d0472aa) to head (fe32796).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #14814   +/-   ##
=======================================
  Coverage   95.94%   95.95%           
=======================================
  Files        2012     2014    +2     
  Lines       26012    26038   +26     
  Branches     2936     2943    +7     
=======================================
+ Hits        24958    24984   +26     
  Misses        788      788           
  Partials      266      266           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lassopicasso
Copy link
Contributor Author

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented Mar 10, 2025

✅ 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.

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: 1

🧹 Nitpick comments (2)
frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/TextMainConfig.tsx (1)

1-49: Well-structured component with clear responsibilities

The TextMainConfig component is well-designed, handling text resource bindings with clear separation of concerns. The conditional rendering based on titleKey presence is a good pattern for avoiding unnecessary rendering.

I noticed the static analysis flagged line 37 for using the delete operator. While this works, it could impact performance in some cases.

-    const componentCopy = { ...component };
-    delete componentCopy.textResourceBindings?.title;
-    handleComponentChange(componentCopy);
+    const { textResourceBindings, ...rest } = component;
+    const newTextResourceBindings = textResourceBindings 
+      ? { ...textResourceBindings }
+      : {};
+    if ('title' in newTextResourceBindings) {
+      delete newTextResourceBindings.title;
+    }
+    handleComponentChange({
+      ...rest,
+      ...(Object.keys(newTextResourceBindings).length > 0 
+        ? { textResourceBindings: newTextResourceBindings } 
+        : {})
+    });

Alternatively, a simpler approach could be:

-    const componentCopy = { ...component };
-    delete componentCopy.textResourceBindings?.title;
-    handleComponentChange(componentCopy);
+    const { textResourceBindings, ...rest } = component;
+    const updatedTextResourceBindings = { ...textResourceBindings };
+    delete updatedTextResourceBindings.title;
+    
+    handleComponentChange({
+      ...rest,
+      textResourceBindings: Object.keys(updatedTextResourceBindings).length > 0 
+        ? updatedTextResourceBindings 
+        : undefined,
+    });
🧰 Tools
🪛 Biome (1.9.4)

[error] 37-37: Avoid the delete operator which can impact performance.

(lint/performance/noDelete)

frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/PropertiesHeader.test.tsx (1)

199-205: Consider adding a comment explaining the useSetQueryDataSchema parameter

The parameter addition is a good improvement to allow testing of loading states, but it would benefit from a brief documentation comment.

 const renderPropertiesHeader = (
   props: Partial<PropertiesHeaderProps> = {},
+  // Controls whether to pre-populate component schema data
+  // Set to false to test loading states
   useSetQueryDataSchema: boolean = true,
 ) => {
   const componentType = props.formItem ? props.formItem.type : defaultProps.formItem.type;
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 029349b and 0415d67.

📒 Files selected for processing (9)
  • frontend/packages/ux-editor/src/components/Properties/Properties.test.tsx (2 hunks)
  • frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/ComponentMainConfig.tsx (1 hunks)
  • frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/DataModelMainConfig.test.tsx (1 hunks)
  • frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/DataModelMainConfig.tsx (1 hunks)
  • frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/HeaderMainConfig.tsx (1 hunks)
  • frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/PropertiesHeader.test.tsx (3 hunks)
  • frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/PropertiesHeader.tsx (4 hunks)
  • frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/TextMainConfig.test.tsx (1 hunks)
  • frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/TextMainConfig.tsx (1 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/TextMainConfig.tsx

[error] 37-37: Avoid the delete operator which can impact performance.

(lint/performance/noDelete)

🔇 Additional comments (16)
frontend/packages/ux-editor/src/components/Properties/Properties.test.tsx (2)

17-17: Adding import for componentSchemaMocks is a good addition

This correctly imports the mocks needed for the component schema data in the tests.


301-304: Good enhancement to mock the component schema data

Setting up the query data for FormComponent ensures that the component schema is available during testing, which aligns with the changes in PropertiesHeader to support loading states and schema data.

frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/HeaderMainConfig.tsx (1)

7-7: Simplified component signature looks good

Removing the children prop simplifies the component, making it more focused on its specific purpose of rendering the main configuration heading. This change aligns with the current implementation where the component doesn't need to render child elements.

frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/DataModelMainConfig.test.tsx (1)

1-81: Well-structured tests for the new DataModelMainConfig component

The test suite is comprehensive and covers different scenarios effectively:

  • Testing for null return when schema lacks data model binding
  • Verifying correct rendering when dataModelBindings is defined
  • Testing update functionality for deleting bindings

The helper function for rendering the component with necessary context is well implemented.

frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/ComponentMainConfig.tsx (2)

4-5: Good addition of specialized type imports

Importing the specific FormComponent and FormContainer types will provide better type safety than using the more generic FormItem type.


8-9: Improved type definitions for better component handling

Updating the component prop type to accept either FormComponent or FormContainer enhances the flexibility of this component, allowing it to handle a wider range of component types in the UX editor.

frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/DataModelMainConfig.tsx (1)

1-39: Clean implementation with good error handling

The DataModelMainConfig component is well-implemented with proper error handling for missing dataModelBindingKey. The use of the useFormItemContext hook for accessing the debounceSave function shows good integration with the wider component ecosystem.

The conditional label logic at line 35 is particularly elegant, only showing the key name when it's not 'simpleBinding'.

frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/TextMainConfig.test.tsx (1)

1-107: Comprehensive test coverage with good practices

The tests for the TextMainConfig component are well-structured and cover key functionality including:

  • Rendering behavior with and without a title prop
  • Text resource selection behavior
  • Deletion of text resource binding

The use of helper functions like textButton() and renderTextMainConfig() improves readability and maintainability. The mock setup is clean and comprehensive.

frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/PropertiesHeader.tsx (5)

5-5: Good inclusion of necessary components

The addition of StudioSpinner to the import list is appropriate for handling loading states.


16-18: Proper imports for new component integration

The imports for useComponentSchemaQuery, TextMainConfig, and DataModelMainConfig are well-organized and necessary for the component enhancements.


30-42: Excellent loading state handling

Adding loading state management with the useComponentSchemaQuery hook and displaying a spinner during the loading phase significantly improves the user experience. The early return pattern for loading states is a clean approach.

The destructuring of schema properties is also well-implemented for clarity.


48-48: Simplified condition

The hideMainConfig condition has been simplified for better readability, focusing on the essential condition.


75-101: Good integration of new components with feature flags

The integration of TextMainConfig and DataModelMainConfig components with appropriate feature flag checking is well-implemented. The components receive the correct props from the parent component and schema.

The structure of conditional rendering based on the hideMainConfig variable is clear and logical.

frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/PropertiesHeader.test.tsx (3)

35-35: Good addition to cleanup between tests

Adding queryClientMock.clear() ensures that query data doesn't leak between test cases, which helps maintain test isolation and prevents unexpected behavior.


205-210: Good implementation of conditional query data setting

The conditional check allows tests to control whether component schema data is pre-loaded, which is essential for testing loading states.


213-214:

✅ Verification successful

Simplified render output

Removing the FormItemContext.Provider wrapper simplifies the test setup. Ensure that the component still works correctly without this context if it was previously required.


🏁 Script executed:

#!/bin/bash
# Check if FormItemContext is used in PropertiesHeader.tsx
rg -A 3 -B 3 "FormItemContext" ./frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/PropertiesHeader.tsx

Length of output: 124


I'll run an additional script to search specifically for any usage of FormItemContext.Provider in the affected file to further verify if its removal impacts the component's behavior.


🏁 Script executed:

#!/bin/bash
# Check if FormItemContext.Provider is used in PropertiesHeader.tsx
rg -n "FormItemContext\.Provider" ./frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/PropertiesHeader.tsx

Length of output: 129


Verified: Simplified render output is safe
The search confirmed that no instance of FormItemContext.Provider exists in PropertiesHeader.tsx, which indicates that removing it from the test setup does not affect the component's actual usage. No further changes are needed on this front.

@lassopicasso lassopicasso marked this pull request as ready for review March 10, 2025 07:49
Copy link
Contributor

@JamalAlabdullah JamalAlabdullah left a comment

Choose a reason for hiding this comment

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

Looks good and works fine 👍 Just small things, and I also see that we need maybe a little margin as the pictures show here:

Screenshot 2025-03-13 at 13 42 43
Screenshot 2025-03-13 at 13 44 42

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: 0

🧹 Nitpick comments (1)
frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/SpecificMainConfig/SummaryMainConfig.test.tsx (1)

27-32: Consider expanding test coverage

The test is now only checking for the presence of the target text label. Consider adding assertions to verify that the actual target selection functionality works correctly, since that's a key part of the component's purpose.

 it('should render summary2 config', async () => {
   render(summary2Component);
   expect(
     screen.getByText(textMock('ux_editor.component_properties.target')),
   ).toBeInTheDocument();
+  // Verify target selection dropdown is present
+  expect(summary2TargetLayoutSet()).toBeInTheDocument();
 });
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1f1dff7 and b59cf8c.

📒 Files selected for processing (3)
  • frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/DataModelMainConfig.test.tsx (1 hunks)
  • frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/PropertiesHeader.tsx (4 hunks)
  • frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/SpecificMainConfig/SummaryMainConfig.test.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/DataModelMainConfig.test.tsx
  • frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/PropertiesHeader.tsx
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Build environment and run e2e test
  • GitHub Check: CodeQL
  • GitHub Check: Testing
🔇 Additional comments (4)
frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/SpecificMainConfig/SummaryMainConfig.test.tsx (4)

11-12: Improved import structure

The import changes look good. Adding textMock from the i18n mocks helps with text-based assertions, and importing layoutSetsExtendedMock aligns with its usage in the query client setup.


29-31: Better assertion approach using i18n text mock

Good change to check for the presence of the internationalized text rather than testing implementation details. This makes the tests more resilient to UI refactoring while still verifying the expected content is displayed.


49-50: Simplification of test setup

The removal of unnecessary mock data and setup code keeps the tests focused on what's being tested. The query client setup with just the layout sets data is sufficient for these tests.


53-53: Simplified render options

The simplification of the renderWithProviders options to only include what's needed (the query client) is a good practice. This reduces test complexity and maintenance overhead.

Copy link
Contributor

@JamalAlabdullah JamalAlabdullah left a comment

Choose a reason for hiding this comment

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

Nice! 👍

lassopicasso and others added 2 commits March 25, 2025 09:49

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
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.

Works well 👍 But i have some questions/concerns:
Since they are UX-related i'm adding @Annikenkbrathen @Ildest in case you have comments.

Some properties might need a new visualization when rendered outside their original context.

For example, in my opinion, it's not clear that this is a datamodel binding:
image
Maybe there should be a label or small subheading to indicate that this is a datamodel-binding? Or maybe something else can help to clarify this?

Just the first datamodelbinding is shown as required, which might be misleading

For example, Address just shows address, while zipCode and postalPlace are also required datamodel fields.
image
I don't think we have a good way to check which fields are required with todays solution(?), but i think maybe we should either show all required or none for these cases.

@lassopicasso
Copy link
Contributor Author

lassopicasso commented Mar 26, 2025

For example, Address just shows address, while zipCode and postalPlace are also required datamodel fields.

@Jondyr
I was also wondering about this but I ended up with only the first one, because the component was rendered in the preview without error messages. So it didn't seem like they all were required.

I don't think we have a good way to check which fields are required with todays solution(?), but i think maybe we should either show all required or none for these cases.

Should maybe render all datamodelbindings regardless, when component have more than one, @Annikenkbrathen?

@Annikenkbrathen
Copy link

Annikenkbrathen commented Mar 26, 2025

Datamodel-bindings:
I think the best approach would be to manually go through each component and add the bindings that we believe make sense to be required, regardless of whether they are technically required or not. Address is a good example—at least three fields are needed for it to make sense, so I think we should include those three here.

Could we do that?

Subtitles:
When it comes to subheadings, we’ve discussed this before and we did not decide anything then. We could consider adding titles, but then it might feel inconsistent if some have them and others don’t. In that case, we’d probably need them for everything—one for text, one for columns, one for data models, etc.—which could take up space and make things cluttered.

My initial thought was to avoid titles altogether, so users would have to open the “Add” button to understand what it is. However, I’m unsure if that would be too confusing since they wouldn’t know what it is before clicking.
Maybe it's confusing as it is now since we show something open, like the summary component. Perhaps it should be hidden behind an "Add" button from the start to keep things looking tidy🤷‍♀️. Or maybe dividers can solve something?
That said, all of these are required, so users will have to add them anyway. Still a bit unsure about this.

Skjermbilde 2025-03-26 kl  13 18 49

@Annikenkbrathen
Copy link

My initial thought was to avoid titles altogether, so users would have to open the “Add” button to understand what it is. However, I’m unsure if that would be too confusing since they wouldn’t know what it is before clicking.
Maybe it's confusing as it is now since we show something open, like the summary component. Perhaps it should be hidden behind an "Add" button from the start to keep things looking tidy🤷‍♀️. Or maybe dividers can solve something?
That said, all of these are required, so users will have to add them anyway. Still a bit unsure about this.

Or could we try add a tooltip with Datamodellbindingas text?

@Jondyr
Copy link
Member

Jondyr commented Mar 26, 2025

@Annikenkbrathen Quick thought for the datamodelbindings; Could we change the displayname of simpleBindings/default datamodelbinding to just have the label "datamodellbinding" or something like that?

The default datamodel binding for a component just being the component name might be superfluous? That way we can avoid having a label/title and still communicate what the actual property is? 🤔

@Annikenkbrathen
Copy link

So you're thinking of only displaying "datamodelbinding" as text when it refers to a single binding, but when there are multiple—like in an address—do we keep it as it is now, or add a title? Or what was your thought?

And how does it look in the datamodel accordion further down? Does it stay the same as it is now? or does we rename them too? Is it weird to have different naming there and in the main config?🤔

@Jondyr
Copy link
Member

Jondyr commented Mar 26, 2025

So you're thinking of only displaying "datamodelbinding" as text when it refers to a single binding, but when there are multiple—like in an address—do we keep it as it is now, or add a title? Or what was your thought?

I might be wrong, but i believe components with multiple bindings do not usesimpleBinding, so it could affect only those with 1 binding. Address for example, does not have a simpleBinding. (edit: there are two exceptions for this, the map component and options component. But both have simpleBinding as the required one, and the rest are optional)

And how does it look in the datamodel accordion further down? Does it stay the same as it is now? or does we rename them too? Is it weird to have different naming there and in the main config?🤔

It makes sense to me to have this both places. It feels more consistent, with properties like "ledetekst" in my opinion.
I did not give the name that much thought, but here is an example of what it would look like:
image

@lassopicasso lassopicasso assigned Jondyr and unassigned lassopicasso Mar 31, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@Jondyr Jondyr merged commit 85b504b into main Apr 1, 2025
9 checks passed
@Jondyr Jondyr deleted the main-section-text-and-binding branch April 1, 2025 07:13
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. team/studio-domain2
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Move title text resource binding and data model bindings config to the top
4 participants