-
Notifications
You must be signed in to change notification settings - Fork 70
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: Auto-update taskId in layout files when taskId is updated from process editor #13648
Conversation
backend/src/Designer/EventHandlers/ProcessTaskIdChanged/ProcessTaskIdChangedLayoutsHandler.cs
Fixed
Show fixed
Hide fixed
backend/src/Designer/EventHandlers/ProcessTaskIdChanged/ProcessTaskIdChangedLayoutsHandler.cs
Fixed
Show fixed
Hide fixed
backend/src/Designer/EventHandlers/ProcessTaskIdChanged/ProcessTaskIdChangedLayoutsHandler.cs
Fixed
Show fixed
Hide fixed
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #13648 +/- ##
=======================================
Coverage 94.57% 94.57%
=======================================
Files 1623 1623
Lines 21798 21798
Branches 2570 2570
=======================================
Hits 20616 20616
Misses 939 939
Partials 243 243 ☔ View full report in Codecov by Sentry. |
...end/src/Designer/EventHandlers/ProcessTaskIdChanged/ProcessTaskIdChangedLayoutSetsHandler.cs
Outdated
Show resolved
Hide resolved
...end/src/Designer/EventHandlers/ProcessTaskIdChanged/ProcessTaskIdChangedLayoutSetsHandler.cs
Outdated
Show resolved
Hide resolved
...end/src/Designer/EventHandlers/ProcessTaskIdChanged/ProcessTaskIdChangedLayoutSetsHandler.cs
Outdated
Show resolved
Hide resolved
...end/src/Designer/EventHandlers/ProcessTaskIdChanged/ProcessTaskIdChangedLayoutSetsHandler.cs
Outdated
Show resolved
Hide resolved
Tested and seems to work in general except for one issue around interactions with PR #13752: taskid-summary2-select.mp4Selecting a summary2 component after changing the referenced taskId throws an error. Does not seem to happen after uploading changes, so might be a cache invalidation issue? |
@Jondyr I'll take a look. Thanks for providing the video with console 😄 |
@Jondyr It's fixed now. Spiller.inn.2024-10-14.111610.mp4 |
@ErlingHauan Re-tested locally and I can confirm it now works 👍 But while retesting I noticed another issue. When a subForm layoutset is present in the project, changing a taskId returns an error from the sync-hub websocket: {
"type":1,
"target":"FileSyncError",
"arguments": [{
"errorCode":"LayoutSetsTaskIdSyncError",
"source":{"name":"layout-sets.json","path":"App/ui/layout-sets.json"},
"details":"Object reference not set to an instance of an object."
}]
} |
Add new StudioComponent with default size sm `StudioAlert`
…ltinn/altinn-studio into summary2-taskid-event-handling
@Jondyr |
@ErlingHauan re-tested, looks good now ✅ |
…lated test, and it was not required
…nvalidateQueries in frontend
@Jondyr Additionally, the foreach (string layoutSetName in layoutSetsFile.Sets.Select(layoutSet => layoutSet.Id))
{
string[] layoutNames;
try
{
layoutNames = repository.GetLayoutNames(layoutSetName);
}
catch (FileNotFoundException)
{
continue;
}
await _fileSyncHandlerExecutor.ExecuteWithExceptionHandlingAndConditionalNotification(
notification.EditingContext,
SyncErrorCodes.LayoutTaskIdSyncError,
$"App/ui/{layoutSetName}/layouts",
async () =>
{
bool hasChanged = false;
foreach (string layoutName in layoutNames)
{
var layout = await repository.GetLayout(layoutSetName, layoutName, cancellationToken);
if (TryChangeLayoutTaskIds(layout, notification.OldId, notification.NewId))
{
await repository.SaveLayout(layoutSetName, layoutName, layout, cancellationToken);
hasChanged = true;
}
}
return hasChanged;
});
} Spiller.inn.2024-10-15.122842.mp4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested ✅
Description
The purpose of this PR is to enable automatic updates to the
taskId
reference in the Summary2 config, whentaskId
is changed in the process editor.When updating
taskId
from the process editor, the backend raises a notification that contains the old and the newtaskId
.A new handler then iterates through every field in every layout file, until it finds a
taskId
property. If thetaskId
in the layout matches the oldtaskId
in the notification, it gets replaced by the new.Related Issue(s)
Verification