Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mlqn committed Jan 6, 2025
1 parent c5a6487 commit 73e2f93
Show file tree
Hide file tree
Showing 39 changed files with 25 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ await _fileSyncHandlerExecutor.ExecuteWithExceptionHandlingAndConditionalNotific
}

List<Reference> referencesToUpdate = [new Reference("component", notification.LayoutSetName, notification.OldComponentId, notification.NewComponentId)];
hasChanges = await _appDevelopmentService.UpdateLayoutReferences(notification.EditingContext, referencesToUpdate, cancellationToken);
hasChanges |= await _appDevelopmentService.UpdateLayoutReferences(notification.EditingContext, referencesToUpdate, cancellationToken);

return hasChanges;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -729,20 +729,29 @@ private async Task<bool> UpdateLayoutReferences(AltinnAppGitRepository altinnApp
{
case "layoutSet":
updatedReference = updatedLayoutsSets.FirstOrDefault(item => item.Type == type && item.Id == layoutSetId);
if (updatedReference != null)
{
target["taskId"] = updatedReference.NewId;
hasLayoutChanges = true;
}
break;
case "page":
updatedReference = updatedLayouts.FirstOrDefault(item => item.Type == type && item.LayoutSetName == layoutSetId && item.Id == id);
if (updatedReference != null)
{
target["id"] = updatedReference.NewId;
hasLayoutChanges = true;
}
break;
case "component":
updatedReference = updatedComponents.FirstOrDefault(item => item.Type == type && item.LayoutSetName == layoutSetId && item.Id == id);
if (updatedReference != null)
{
target["id"] = updatedReference.NewId;
hasLayoutChanges = true;
}
break;
}

if (updatedReference != null)
{
target["taskId"] = updatedReference.NewId;
hasLayoutChanges = true;
}
}

if (component["overrides"] is JsonArray overrideList)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ public async Task DeleteFormLayout_NonExistingFile_Should_AndReturnNotFound(stri

[Theory]
[InlineData("ttd", "testUser", "layout", "Side2")]
public async Task DeleteFormLayout_DeletesAssociatedSummaryComponents_ReturnsOk(string org, string developer, string layoutSetName, string layoutName)
public async Task DeleteFormLayout_DeletesAssociatedSummary2Components_ReturnsOk(string org, string developer, string layoutSetName, string layoutName)
{
string actualApp = "deleted-component-before-delete";
string actualApp = "app-with-summary2-components";
string app = TestDataHelper.GenerateTestRepoName();
await CopyRepositoryForTest(org, actualApp, developer, app);

Expand All @@ -72,7 +72,7 @@ public async Task DeleteFormLayout_DeletesAssociatedSummaryComponents_ReturnsOk(
using var response = await HttpClient.SendAsync(httpRequestMessage);
response.StatusCode.Should().Be(HttpStatusCode.OK);

string expectedApp = "deleted-component-after-delete";
string expectedApp = "app-with-summary2-components-after-deleting-references";

string[] layoutPaths = [
"layout/layouts/Side1.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ public async Task DeleteLayoutSet_RemovesComponentsReferencingLayoutSet(string o

[Theory]
[InlineData("ttd", "testUser", "layoutSet")]
public async Task DeleteLayoutSet_DeletesAssociatedSummaryComponents_ReturnsOk(string org, string developer, string layoutSetName)
public async Task DeleteLayoutSet_DeletesAssociatedSummary2Components_ReturnsOk(string org, string developer, string layoutSetName)
{
string actualApp = "deleted-component-before-delete";
string actualApp = "app-with-summary2-components";
string app = TestDataHelper.GenerateTestRepoName();
await CopyRepositoryForTest(org, actualApp, developer, app);

Expand All @@ -174,7 +174,7 @@ public async Task DeleteLayoutSet_DeletesAssociatedSummaryComponents_ReturnsOk(s
using var response = await HttpClient.SendAsync(httpRequestMessage);
response.StatusCode.Should().Be(HttpStatusCode.OK, await response.Content.ReadAsStringAsync());

string expectedApp = "deleted-component-after-delete";
string expectedApp = "app-with-summary2-components-after-deleting-references";

string[] layoutPaths = [
"layoutSet/layouts/Side1.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ public async Task SaveFormLayoutWithComponentIdsChange_ReturnsOk(string org, str

[Theory]
[InlineData("ttd", "testUser", "component", "Side2", "Input-Om7N3y")]
public async Task SaveFormLayoutWithDeletedComponent_DeletesAssociatedSummaryComponents_ReturnsOk(string org, string developer, string layoutSetName, string layoutName, string componentId)
public async Task SaveFormLayoutWithDeletedComponent_DeletesAssociatedSummary2Components_ReturnsOk(string org, string developer, string layoutSetName, string layoutName, string componentId)
{
string actualApp = "deleted-component-before-delete";
string actualApp = "app-with-summary2-components";
string app = TestDataHelper.GenerateTestRepoName();
await CopyRepositoryForTest(org, actualApp, developer, app);

Expand All @@ -121,7 +121,7 @@ public async Task SaveFormLayoutWithDeletedComponent_DeletesAssociatedSummaryCom
HttpResponseMessage response = await SendHttpRequest(url, payload);
response.StatusCode.Should().Be(HttpStatusCode.OK);

string expectedApp = "deleted-component-after-delete";
string expectedApp = "app-with-summary2-components-after-deleting-references";

string[] layoutPaths = [
"component/layouts/Side1.json",
Expand Down

0 comments on commit 73e2f93

Please sign in to comment.