-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Summary2 and Subform when updating component id
- Loading branch information
Showing
13 changed files
with
259 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
backend/src/Designer/EventHandlers/LayoutPageIdChanged/LayoutPageIdChangedLayoutsHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System.Collections.Generic; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Altinn.Studio.Designer.Events; | ||
using Altinn.Studio.Designer.Hubs.SyncHub; | ||
using Altinn.Studio.Designer.Models; | ||
using Altinn.Studio.Designer.Services.Interfaces; | ||
using MediatR; | ||
|
||
namespace Altinn.Studio.Designer.EventHandlers.LayoutPageDeleted; | ||
|
||
public class LayoutPageIdChangedLayoutsHandler(IFileSyncHandlerExecutor fileSyncHandlerExecutor, IAppDevelopmentService appDevelopmentService) : INotificationHandler<LayoutPageIdChangedEvent> | ||
{ | ||
public async Task Handle(LayoutPageIdChangedEvent notification, CancellationToken cancellationToken) | ||
{ | ||
await fileSyncHandlerExecutor.ExecuteWithExceptionHandlingAndConditionalNotification( | ||
notification.EditingContext, | ||
SyncErrorCodes.LayoutPageIdChangedLayoutsSyncError, | ||
"layouts", | ||
async () => | ||
{ | ||
List<Reference> referencesToUpdate = [new Reference("page", notification.LayoutSetName, notification.LayoutName, notification.NewLayoutName)]; | ||
return await appDevelopmentService.UpdateLayoutReferences(notification.EditingContext, referencesToUpdate, cancellationToken); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
backend/src/Designer/EventHandlers/LayoutSetIdChanged/LayoutSetIdChangedLayoutsHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System.Collections.Generic; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Altinn.Studio.Designer.Events; | ||
using Altinn.Studio.Designer.Hubs.SyncHub; | ||
using Altinn.Studio.Designer.Models; | ||
using Altinn.Studio.Designer.Services.Interfaces; | ||
using MediatR; | ||
|
||
namespace Altinn.Studio.Designer.EventHandlers.LayoutSetDeleted; | ||
|
||
public class LayoutSetIdChangedLayoutsHandler(IFileSyncHandlerExecutor fileSyncHandlerExecutor, IAppDevelopmentService appDevelopmentService) : INotificationHandler<LayoutSetIdChangedEvent> | ||
{ | ||
public async Task Handle(LayoutSetIdChangedEvent notification, CancellationToken cancellationToken) | ||
{ | ||
await fileSyncHandlerExecutor.ExecuteWithExceptionHandlingAndConditionalNotification( | ||
notification.EditingContext, | ||
SyncErrorCodes.LayoutSetIdChangedLayoutsSyncError, | ||
"layouts", | ||
async () => | ||
{ | ||
List<Reference> referencesToUpdate = [new Reference("layoutSet", notification.LayoutSetName, notification.LayoutSetName, notification.NewLayoutSetName)]; | ||
return await appDevelopmentService.UpdateLayoutReferences(notification.EditingContext, referencesToUpdate, cancellationToken); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using Altinn.Studio.Designer.Models; | ||
using MediatR; | ||
|
||
namespace Altinn.Studio.Designer.Events; | ||
|
||
public class LayoutPageIdChangedEvent : INotification | ||
{ | ||
public AltinnRepoEditingContext EditingContext { get; set; } | ||
public string LayoutSetName { get; set; } | ||
public string LayoutName { get; set; } | ||
public string NewLayoutName { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Altinn.Studio.Designer.Models; | ||
using MediatR; | ||
|
||
namespace Altinn.Studio.Designer.Events; | ||
|
||
public class LayoutSetIdChangedEvent : INotification | ||
{ | ||
public AltinnRepoEditingContext EditingContext { get; set; } | ||
public string LayoutSetName { get; set; } | ||
public string NewLayoutSetName { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,3 @@ | ||
namespace Altinn.Studio.Designer.Models; | ||
|
||
public class Reference | ||
{ | ||
public string Type { get; } | ||
public string LayoutSetName { get; } | ||
public string Id { get; } | ||
|
||
public Reference(string type, string layoutSetName, string id) | ||
{ | ||
Type = type; | ||
LayoutSetName = layoutSetName; | ||
Id = id; | ||
} | ||
} | ||
public record Reference(string Type, string LayoutSetName, string Id, string NewId = null); |
Oops, something went wrong.