diff --git a/backend/src/Designer/Controllers/ProcessModelingController.cs b/backend/src/Designer/Controllers/ProcessModelingController.cs index 0048b227bc0..df5e88e4e8f 100644 --- a/backend/src/Designer/Controllers/ProcessModelingController.cs +++ b/backend/src/Designer/Controllers/ProcessModelingController.cs @@ -57,21 +57,19 @@ public async Task UpsertProcessDefinitionAndNotify(string org, st new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }) : null; - Stream stream = content.OpenReadStream(); + string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); + var editingContext = AltinnRepoEditingContext.FromOrgRepoDeveloper(org, repo, developer); + await using Stream stream = content.OpenReadStream(); try { - await Guard.AssertValidXmlStreamAndRewindAsync(stream); + await _processModelingService.SaveProcessDefinitionAsync(editingContext, stream, cancellationToken); } catch (ArgumentException) { return BadRequest("BPMN file is not valid XML"); } - string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); - var editingContext = AltinnRepoEditingContext.FromOrgRepoDeveloper(org, repo, developer); - await _processModelingService.SaveProcessDefinitionAsync(editingContext, stream, cancellationToken); - if (metadataObject?.TaskIdChange is not null) { await _mediator.Publish(new ProcessTaskIdChangedEvent diff --git a/backend/src/Designer/Infrastructure/GitRepository/AltinnAppGitRepository.cs b/backend/src/Designer/Infrastructure/GitRepository/AltinnAppGitRepository.cs index db8ba9527dd..c173b2aaaf8 100644 --- a/backend/src/Designer/Infrastructure/GitRepository/AltinnAppGitRepository.cs +++ b/backend/src/Designer/Infrastructure/GitRepository/AltinnAppGitRepository.cs @@ -904,9 +904,11 @@ public Stream GetProcessDefinitionFile() public Definitions GetDefinitions() { - Stream processDefinitionStream = GetProcessDefinitionFile(); + using Stream processDefinitionStream = GetProcessDefinitionFile(); XmlSerializer serializer = new(typeof(Definitions)); - return (Definitions)serializer.Deserialize(processDefinitionStream); + Definitions definitions = (Definitions)serializer.Deserialize(processDefinitionStream); + + return definitions; } /// diff --git a/backend/src/Designer/Middleware/UserRequestSynchronization/Services/RequestSyncEvaluators/EndpointNameSyncEvaluator.cs b/backend/src/Designer/Middleware/UserRequestSynchronization/Services/RequestSyncEvaluators/EndpointNameSyncEvaluator.cs index 87c5e76d1d2..36cc15d842b 100644 --- a/backend/src/Designer/Middleware/UserRequestSynchronization/Services/RequestSyncEvaluators/EndpointNameSyncEvaluator.cs +++ b/backend/src/Designer/Middleware/UserRequestSynchronization/Services/RequestSyncEvaluators/EndpointNameSyncEvaluator.cs @@ -54,6 +54,7 @@ public class EndpointNameSyncEvaluator : IRequestSyncEvaluator nameof(ProcessModelingController.AddDataTypeToApplicationMetadata), nameof(ProcessModelingController.DeleteDataTypeFromApplicationMetadata), nameof(ProcessModelingController.UpsertProcessDefinitionAndNotify), + nameof(ProcessModelingController.ProcessDataTypesChangedNotify), nameof(ProcessModelingController.SaveProcessDefinitionFromTemplate) ) }, diff --git a/frontend/packages/ux-editor/src/App.tsx b/frontend/packages/ux-editor/src/App.tsx index b9bc445c878..b7a53f0c972 100644 --- a/frontend/packages/ux-editor/src/App.tsx +++ b/frontend/packages/ux-editor/src/App.tsx @@ -11,6 +11,7 @@ import { cleanupStaleLocalStorageKeys } from './utils/localStorageUtils'; import { usePreviewContext } from 'app-development/contexts/PreviewContext'; import { FormDesignerToolbar } from '@altinn/ux-editor/containers/FormDesignerToolbar'; import { useLayoutSetsQuery } from 'app-shared/hooks/queries/useLayoutSetsQuery'; +import { useLayoutSetsExtendedQuery } from 'app-shared/hooks/queries/useLayoutSetsExtendedQuery'; /** * This is the main React component responsible for controlling @@ -52,6 +53,7 @@ export function App() { org, app, ); + const { status: layoutSetsExtendedStatus } = useLayoutSetsExtendedQuery(org, app); const { status: dataModelStatus, isError: dataModelFetchedError } = useDataModelMetadataQuery({ org, app, @@ -69,6 +71,7 @@ export function App() { const componentIsPending = widgetsStatus === 'pending' || layoutSetsStatus === 'pending' || + layoutSetsExtendedStatus === 'pending' || dataModelStatus === 'pending' || textsStatus === 'pending'; const componentIsReady = diff --git a/frontend/packages/ux-editor/src/containers/FormDesignerToolbar.tsx b/frontend/packages/ux-editor/src/containers/FormDesignerToolbar.tsx index 370773d5776..0b0ce9ea495 100644 --- a/frontend/packages/ux-editor/src/containers/FormDesignerToolbar.tsx +++ b/frontend/packages/ux-editor/src/containers/FormDesignerToolbar.tsx @@ -1,14 +1,14 @@ import React from 'react'; import { useStudioEnvironmentParams } from 'app-shared/hooks/useStudioEnvironmentParams'; import classes from './FormDesignerToolbar.module.css'; -import { useLayoutSetsQuery } from 'app-shared/hooks/queries/useLayoutSetsQuery'; import { LayoutSetsContainer } from '../components/Elements/LayoutSetsContainer'; import { ToggleAddComponentPoc } from './DesignView/AddItem/ToggleAddComponentPoc'; +import { useLayoutSetsExtendedQuery } from 'app-shared/hooks/queries/useLayoutSetsExtendedQuery'; export const FormDesignerToolbar = () => { const { org, app } = useStudioEnvironmentParams(); - const layoutSetsQuery = useLayoutSetsQuery(org, app); - const layoutSetNames = layoutSetsQuery?.data?.sets; + const { data: layoutSetsExtended } = useLayoutSetsExtendedQuery(org, app); + const layoutSetNames = layoutSetsExtended?.sets; return (