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: Delete all Summary 2.0 components that has a reference to a deleted component #14126

Conversation

mlqn
Copy link
Contributor

@mlqn mlqn commented Nov 21, 2024

Description

Delete all Summary 2.0 components that has a reference to a deleted component

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)

Summary by CodeRabbit

Based on the comprehensive summary, here are the updated release notes:

  • New Features

    • Enhanced event handling for layout and component management
    • Improved deletion workflows for layouts, components, and layout sets
    • New classes and methods for handling component and layout deletion events
    • Introduced new enums for resource reference types
  • Bug Fixes

    • Updated reference management to handle component and layout deletions more robustly
  • Documentation

    • Added clearer user warnings about deletion of associated Summary2 components
    • Updated user interface messages to explain deletion consequences
  • Refactor

    • Restructured reference type enumerations
    • Improved event-driven architecture for layout and component management
  • Style

    • Updated confirmation messages for better user clarity

@github-actions github-actions bot added solution/studio/designer Issues related to the Altinn Studio Designer solution. backend labels Nov 21, 2024
mlqn added 4 commits November 27, 2024 13:42
…elete-all-summary-20-components-that-has-a-reference-to-deleted-element-component-page-or-layout-set
@github-actions github-actions bot added the quality/testing Tests that are missing, needs to be created or could be improved. label Nov 29, 2024
Copy link

codecov bot commented Nov 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.66%. Comparing base (b59e9cc) to head (e398474).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #14126   +/-   ##
=======================================
  Coverage   95.66%   95.66%           
=======================================
  Files        1891     1891           
  Lines       24583    24583           
  Branches     2823     2823           
=======================================
  Hits        23517    23517           
  Misses        805      805           
  Partials      261      261           

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

@mlqn mlqn force-pushed the 13525-automatically-delete-all-summary-20-components-that-has-a-reference-to-deleted-element-component-page-or-layout-set branch from d881911 to 160d666 Compare December 16, 2024 11:56
mlqn added 2 commits January 6, 2025 14:50
…elete-all-summary-20-components-that-has-a-reference-to-deleted-element-component-page-or-layout-set
…mponents-that-has-a-reference-to-deleted-element-component-page-or-layout-set
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 (3)
backend/tests/Designer.Tests/Controllers/AppDevelopmentController/DeleteFormLayoutTests.cs (3)

60-62: Consider adding more test scenarios.

The test only covers one scenario with fixed values. Consider parameterizing the test with more scenarios using [InlineData] to test different layouts and components.


74-81: Extract layout paths to a constant or configuration.

The hardcoded array of layout paths could be moved to a constant or configuration file to improve maintainability and reusability. Also, consider using a more flexible collection type instead of an array.

-            string[] layoutPaths = [
-                "layout/layouts/Side1.json",
-                "layout/layouts/Side2.json",
-                "layout2/layouts/Side1.json",
-                "layout2/layouts/Side2.json",
-            ];
+            private static readonly IReadOnlyList<string> LayoutPaths = new[]
+            {
+                "layout/layouts/Side1.json",
+                "layout/layouts/Side2.json",
+                "layout2/layouts/Side1.json",
+                "layout2/layouts/Side2.json"
+            };

64-66: Document test data dependencies.

Add XML documentation to describe the required structure and content of the test data repositories (app-with-summary2-components and app-with-summary2-components-after-deleting-references).

+            // Test data requirements:
+            // app-with-summary2-components: Contains layouts with Summary 2.0 components
+            // app-with-summary2-components-after-deleting-references: Expected state after deletion
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7ca7686 and 0db4933.

📒 Files selected for processing (4)
  • backend/tests/Designer.Tests/Controllers/AppDevelopmentController/DeleteFormLayoutTests.cs (2 hunks)
  • backend/tests/Designer.Tests/Controllers/AppDevelopmentController/DeleteLayoutSetTests.cs (1 hunks)
  • backend/tests/Designer.Tests/Controllers/AppDevelopmentController/SaveFormLayoutTests.cs (2 hunks)
  • frontend/language/src/nb.json (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • backend/tests/Designer.Tests/Controllers/AppDevelopmentController/DeleteLayoutSetTests.cs
  • backend/tests/Designer.Tests/Controllers/AppDevelopmentController/SaveFormLayoutTests.cs
  • frontend/language/src/nb.json
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: Run dotnet build and test (macos-latest)
  • GitHub Check: Build environment and run e2e test
  • GitHub Check: Run dotnet build and test (windows-latest)
  • GitHub Check: Analyze
  • GitHub Check: Run integration tests against actual gitea and db
  • GitHub Check: Run dotnet build and test (ubuntu-latest)
🔇 Additional comments (2)
backend/tests/Designer.Tests/Controllers/AppDevelopmentController/DeleteFormLayoutTests.cs (2)

2-2: LGTM!

The addition of the System.Linq namespace is appropriate as it's required for the ToList() extension method used in the test.


71-72: Verify async operation handling.

Consider adding a timeout to the HTTP request and ensure proper resource cleanup:

-            using var response = await HttpClient.SendAsync(httpRequestMessage);
+            using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
+            using var response = await HttpClient.SendAsync(httpRequestMessage, cts.Token);

Also, verify that no other async operations are running that could affect the test:

…mponents-that-has-a-reference-to-deleted-element-component-page-or-layout-set
Copy link
Contributor

@lassopicasso lassopicasso left a comment

Choose a reason for hiding this comment

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

Tested in dev - works smooth. 🚀

@lassopicasso lassopicasso merged commit 1cf0f2e into main Jan 20, 2025
19 checks passed
@lassopicasso lassopicasso deleted the 13525-automatically-delete-all-summary-20-components-that-has-a-reference-to-deleted-element-component-page-or-layout-set branch January 20, 2025 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/process Area: Related to app process (e.g. signing, receipt, fill inn, payment, etc). backend frontend quality/testing Tests that are missing, needs to be created or could be improved. solution/studio/designer Issues related to the Altinn Studio Designer solution.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants