-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 13400-replace-react-modal-with-studiomodal
- Loading branch information
Showing
108 changed files
with
1,042 additions
and
1,717 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
73 changes: 73 additions & 0 deletions
73
backend/src/Designer/EventHandlers/LayoutSetDeleted/LayoutSetDeletedComponentRefHandler.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,73 @@ | ||
using System.Collections.Generic; | ||
using System.Text.Json.Nodes; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Altinn.App.Core.Helpers; | ||
using Altinn.Studio.Designer.Events; | ||
using Altinn.Studio.Designer.Hubs.SyncHub; | ||
using Altinn.Studio.Designer.Infrastructure.GitRepository; | ||
using Altinn.Studio.Designer.Services.Interfaces; | ||
using MediatR; | ||
|
||
namespace Altinn.Studio.Designer.EventHandlers.LayoutSetDeleted; | ||
|
||
public class LayoutSetDeletedComponentRefHandler(IAltinnGitRepositoryFactory altinnGitRepositoryFactory, IFileSyncHandlerExecutor fileSyncHandlerExecutor) : INotificationHandler<LayoutSetDeletedEvent> | ||
{ | ||
public async Task Handle(LayoutSetDeletedEvent notification, CancellationToken cancellationToken) | ||
{ | ||
AltinnAppGitRepository altinnAppGitRepository = altinnGitRepositoryFactory.GetAltinnAppGitRepository( | ||
notification.EditingContext.Org, | ||
notification.EditingContext.Repo, | ||
notification.EditingContext.Developer); | ||
|
||
string[] layoutSetNames = altinnAppGitRepository.GetLayoutSetNames(); | ||
|
||
await fileSyncHandlerExecutor.ExecuteWithExceptionHandlingAndConditionalNotification( | ||
notification.EditingContext, | ||
SyncErrorCodes.LayoutSetSubLayoutSyncError, | ||
"layouts", | ||
async () => | ||
{ | ||
bool hasChanges = false; | ||
foreach (string layoutSetName in layoutSetNames) | ||
{ | ||
Dictionary<string, JsonNode> formLayouts = await altinnAppGitRepository.GetFormLayouts(layoutSetName, cancellationToken); | ||
foreach (var formLayout in formLayouts) | ||
{ | ||
hasChanges |= await RemoveComponentsReferencingLayoutSet( | ||
notification, | ||
altinnAppGitRepository, | ||
layoutSetName, | ||
formLayout, | ||
cancellationToken); | ||
} | ||
} | ||
return hasChanges; | ||
}); | ||
} | ||
|
||
private static async Task<bool> RemoveComponentsReferencingLayoutSet(LayoutSetDeletedEvent notification, AltinnAppGitRepository altinnAppGitRepository, string layoutSetName, KeyValuePair<string, JsonNode> formLayout, CancellationToken cancellationToken) | ||
{ | ||
if (formLayout.Value["data"] is not JsonObject data || data["layout"] is not JsonArray layoutArray) | ||
{ | ||
return false; | ||
} | ||
|
||
bool hasChanges = false; | ||
layoutArray.RemoveAll(jsonNode => | ||
{ | ||
if (jsonNode["layoutSet"]?.GetValue<string>() == notification.LayoutSetId) | ||
{ | ||
hasChanges = true; | ||
return true; | ||
} | ||
return false; | ||
}); | ||
|
||
if (hasChanges) | ||
{ | ||
await altinnAppGitRepository.SaveLayout(layoutSetName, $"{formLayout.Key}.json", formLayout.Value, cancellationToken); | ||
} | ||
return hasChanges; | ||
} | ||
} |
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,10 @@ | ||
using Altinn.Studio.Designer.Models; | ||
using MediatR; | ||
|
||
namespace Altinn.Studio.Designer.Events; | ||
|
||
public class LayoutSetDeletedEvent : INotification | ||
{ | ||
public string LayoutSetId { get; set; } | ||
public AltinnRepoEditingContext EditingContext { 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
28 changes: 17 additions & 11 deletions
28
...itories/testUser/ttd/app-with-layoutsets/App/ui/layoutSet2/layouts/layoutFile1InSet2.json
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,13 +1,19 @@ | ||
{ | ||
"schema": "https://altinncdn.no/schemas/json/layout/layout.schema.v1.json", | ||
"data": { | ||
"layout": [{ | ||
"id": "component-id", | ||
"type": "Header", | ||
"textResourceBindings": { | ||
"title": "some-old-id", | ||
"body": "another-key" | ||
} | ||
}] | ||
} | ||
"schema": "https://altinncdn.no/schemas/json/layout/layout.schema.v1.json", | ||
"data": { | ||
"layout": [ | ||
{ | ||
"id": "component-id", | ||
"type": "Header", | ||
"textResourceBindings": { | ||
"title": "some-old-id", | ||
"body": "another-key" | ||
} | ||
}, | ||
{ | ||
"id": "subform-component-id", | ||
"layoutSet": "layoutSet3" | ||
} | ||
] | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
...ent/features/dataModelling/SchemaEditorWithToolbar/TopToolbar/CreateNewWrapper.module.css
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,4 @@ | ||
.popoverContent { | ||
/* This is so that it goes above the header which has an z-index of 2000 */ | ||
z-index: 2001; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
:root { | ||
font-family: Roboto, 'San Fransisco', 'Helvetica Neue', Helvetica, Arial, sans-serif; | ||
} | ||
|
||
body { | ||
margin: 0; | ||
} |
2 changes: 1 addition & 1 deletion
2
frontend/app-preview/src/components/UserProfileMenu/UserProfileMenu.tsx
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
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
5 changes: 0 additions & 5 deletions
5
frontend/packages/shared/src/components/AltinnHeaderProfile/AltinnHeaderProfile.module.css
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.