From 4cbf9c45e00b4c4d612240a22df9915002df2ac3 Mon Sep 17 00:00:00 2001 From: Eric-B-Wu Date: Mon, 1 Apr 2024 13:14:21 -0400 Subject: [PATCH 1/5] fix dictionary \ issue --- libs/designer-ui/src/lib/editor/base/utils/keyvalueitem.ts | 6 +++--- .../state/workflowparameters/workflowparametersSlice.ts | 6 +++--- libs/designer/src/lib/core/utils/validation.ts | 4 ++-- .../src/utils/src/lib/helpers/stringFunctions.ts | 4 ++++ 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/libs/designer-ui/src/lib/editor/base/utils/keyvalueitem.ts b/libs/designer-ui/src/lib/editor/base/utils/keyvalueitem.ts index 54f77b0612c..d9f6f3397ee 100644 --- a/libs/designer-ui/src/lib/editor/base/utils/keyvalueitem.ts +++ b/libs/designer-ui/src/lib/editor/base/utils/keyvalueitem.ts @@ -3,7 +3,7 @@ import { isEmpty } from '../../../dictionary/expandeddictionary'; import type { ValueSegment } from '../../models/parameter'; import { createLiteralValueSegment, insertQutationForStringType } from './helper'; import { convertSegmentsToString } from './parsesegments'; -import { isNumber, isBoolean } from '@microsoft/logic-apps-shared'; +import { isNumber, isBoolean, doubleQuoteString } from '@microsoft/logic-apps-shared'; export interface KeyValueItem { id: string; @@ -29,7 +29,7 @@ export const convertKeyValueItemToSegments = (items: KeyValueItem[], keyType?: s const updatedKey = key.map((segment) => { return { ...segment, - value: convertedKeyType !== constants.SWAGGER.TYPE.STRING ? segment.value : segment.value.replace(/\n/g, '\\n'), + value: convertedKeyType !== constants.SWAGGER.TYPE.STRING ? segment.value : doubleQuoteString(segment.value), }; }); @@ -37,7 +37,7 @@ export const convertKeyValueItemToSegments = (items: KeyValueItem[], keyType?: s const updatedValue = value.map((segment) => { return { ...segment, - value: convertedValueType !== constants.SWAGGER.TYPE.STRING ? segment.value : segment.value.replace(/\n/g, '\\n'), + value: convertedValueType !== constants.SWAGGER.TYPE.STRING ? segment.value : doubleQuoteString(segment.value), }; }); diff --git a/libs/designer/src/lib/core/state/workflowparameters/workflowparametersSlice.ts b/libs/designer/src/lib/core/state/workflowparameters/workflowparametersSlice.ts index 0e157f1d9d1..848dacaf4db 100644 --- a/libs/designer/src/lib/core/state/workflowparameters/workflowparametersSlice.ts +++ b/libs/designer/src/lib/core/state/workflowparameters/workflowparametersSlice.ts @@ -88,7 +88,7 @@ export const validateParameter = ( } error = isInvalid - ? intl.formatMessage({ defaultMessage: 'Enter a valid array.', id: 'MVrv+N', description: 'Error validation message' }) + ? intl.formatMessage({ defaultMessage: 'Enter a valid Array.', id: 'JgugQX', description: 'Error validation message' }) : undefined; break; @@ -99,8 +99,8 @@ export const validateParameter = ( } catch { error = swaggerType === Constants.SWAGGER.TYPE.BOOLEAN - ? intl.formatMessage({ defaultMessage: 'Enter a valid boolean.', id: 'GXXLuT', description: 'Error validation message' }) - : intl.formatMessage({ defaultMessage: 'Enter a valid json.', id: 'kxMDyM', description: 'Error validation message' }); + ? intl.formatMessage({ defaultMessage: 'Enter a valid Boolean.', id: 'b7BQdu', description: 'Error validation message' }) + : intl.formatMessage({ defaultMessage: 'Enter a valid JSON.', id: 'dEe6Ob', description: 'Error validation message' }); } break; diff --git a/libs/designer/src/lib/core/utils/validation.ts b/libs/designer/src/lib/core/utils/validation.ts index bb2dff91591..c747b9ee4cc 100644 --- a/libs/designer/src/lib/core/utils/validation.ts +++ b/libs/designer/src/lib/core/utils/validation.ts @@ -183,8 +183,8 @@ export function validateType(type: string, parameterFormat: string, parameterVal } if (!isValidJSONObjectFormat(parameterValue)) { return intl.formatMessage({ - defaultMessage: 'Enter a valid json.', - id: 'bYwqkV', + defaultMessage: 'Enter a valid JSON.', + id: '3n6GJG', description: 'Error validation message for Objects', }); } diff --git a/libs/logic-apps-shared/src/utils/src/lib/helpers/stringFunctions.ts b/libs/logic-apps-shared/src/utils/src/lib/helpers/stringFunctions.ts index a620f75a067..d80dae03e4e 100644 --- a/libs/logic-apps-shared/src/utils/src/lib/helpers/stringFunctions.ts +++ b/libs/logic-apps-shared/src/utils/src/lib/helpers/stringFunctions.ts @@ -29,3 +29,7 @@ export const splitFileName = (fileName: string) => { const splitFileName = fileName.lastIndexOf('.'); return [fileName.slice(0, splitFileName), fileName.slice(splitFileName)]; }; + +export const doubleQuoteString = (s: string): string => { + return s.replace(/\\/g, '\\\\').replace(/\n/g, '\\n'); +}; From 6af4210dec7469120a4dbc538a6097a6617eaba6 Mon Sep 17 00:00:00 2001 From: Eric-B-Wu Date: Mon, 1 Apr 2024 13:15:35 -0400 Subject: [PATCH 2/5] string update --- Localize/lang/strings.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Localize/lang/strings.json b/Localize/lang/strings.json index c8976cc60d4..95f08df5f95 100644 --- a/Localize/lang/strings.json +++ b/Localize/lang/strings.json @@ -138,6 +138,7 @@ "3eeli7": "Select a source schema", "3ewBbk": "The entered identity is not associated with this Logic App.", "3n5pnv": "(UTC+10:30) Lord Howe Island", + "3n6GJG": "Enter a valid JSON.", "3rzrWf": "Required. The object to remove the property from.", "3sJlV+": "Close code view", "3uA4ml": "Enter a valid datetime.", @@ -430,7 +431,6 @@ "GIUSQs": "Filter by data type", "GLd3MU": "Required. The object to find inside the Within collection.", "GQnN3U": "Explain flow", - "GXXLuT": "Enter a valid boolean.", "GYvF54": "Referencing functions", "GZ8MDP": "{s1} of {s2}", "GcG0qf": "Returns true if the parameters are false", @@ -501,6 +501,7 @@ "JWl/LD": "Add new item", "Jaz3EC": "Converts a string timestamp passed in from a source time zone to a target time zone", "JbgTET": "Method", + "JgugQX": "Enter a valid Array.", "Ji6663": "Returns true if a dictionary contains a key, if an array contains a value, or if a string contains a substring", "Jil/Wa": "Invalid settings", "JjTfC7": "Required. The number to be formatted.", @@ -564,7 +565,6 @@ "MOsuw2": "(UTC+10:00) Guam, Port Moresby", "MPPyI6": "(UTC+04:00) Baku", "MTR4Vg": "Returns the current timestamp as a string", - "MVrv+N": "Enter a valid array.", "MYgKHu": "Actions", "Mb+Eaq": "Bool", "Mb/Vp8": "Next failed", @@ -1045,6 +1045,7 @@ "_3eeli7.comment": "Source schema dropdown placeholder", "_3ewBbk.comment": "error message for invalid user", "_3n5pnv.comment": "Time zone value ", + "_3n6GJG.comment": "Error validation message for Objects", "_3rzrWf.comment": "Required object parameter to identify from which object to remove property from", "_3sJlV+.comment": "Close code view button", "_3uA4ml.comment": "Error validation message for date times", @@ -1337,7 +1338,6 @@ "_GIUSQs.comment": "Filter by data type", "_GLd3MU.comment": "Required object parameter to find for the contains function", "_GQnN3U.comment": "Chatbot prompt to explain the flow", - "_GXXLuT.comment": "Error validation message", "_GYvF54.comment": "Label for referencing functions", "_GZ8MDP.comment": "Shows how many suggested flows there are", "_GcG0qf.comment": "Label for description of custom not Function", @@ -1408,6 +1408,7 @@ "_JWl/LD.comment": "Label to add item to array editor", "_Jaz3EC.comment": "Label for description of custom convertTimeZone Function", "_JbgTET.comment": "Label text for request method", + "_JgugQX.comment": "Error validation message", "_Ji6663.comment": "Label for description of custom contains Function", "_Jil/Wa.comment": "Text to explain that there are invalid settings for this node", "_JjTfC7.comment": "Required value parameter to apply formatNumber function on", @@ -1471,7 +1472,6 @@ "_MOsuw2.comment": "Time zone value ", "_MPPyI6.comment": "Time zone value ", "_MTR4Vg.comment": "Label for description of custom utcNow Function", - "_MVrv+N.comment": "Error validation message", "_MYgKHu.comment": "Heading for a tooltip explaining Actions", "_Mb+Eaq.comment": "This is an option in a dropdown where users can select type Boolean for their parameter.", "_Mb/Vp8.comment": "Button indicating to go to the next page with failed options", @@ -1827,6 +1827,7 @@ "_ahsVI/.comment": "OAuth Pfx Placeholder Text", "_aoUT/3.comment": "Text for loading Azure Resources", "_auUI93.comment": "label to inform to upload or select source schema to be used", + "_b7BQdu.comment": "Error validation message", "_b9/1dK.comment": "A placeholder for the dictionary value field", "_b9P8SA.comment": "Exception for unsupported token types", "_b9Rvl9.comment": "The title of the body field in the static result parseJson action", @@ -1841,7 +1842,6 @@ "_bWBMhe.comment": "description of concurrency setting", "_bWOsvo.comment": "Title for invoker connection", "_bXFGpe.comment": "Info section title", - "_bYwqkV.comment": "Error validation message for Objects", "_ba9yGJ.comment": "Button text for loading more runs", "_bf7078.comment": "Label for description of custom max Function", "_blRFVt.comment": "Chatbot connections setup card description", @@ -1882,6 +1882,7 @@ "_dBxX0M.comment": "Text for the \"Add Trigger\" page header", "_dD8y1n.comment": "Label for editor toggle button when in collapsed mode", "_dDYCuU.comment": "Link text to open URL", + "_dEe6Ob.comment": "Error validation message", "_dKCp2j.comment": "Chatbot query start of sentence for asking for more explaination on an item that the user can should complete.", "_dL9V5t.comment": "Text to show label for managed identity selector", "_dMAC4C.comment": "Chatbot prompt to replace an action", @@ -2058,7 +2059,6 @@ "_klY9UN.comment": "This announced text is read aloud with screen readers. Not shown in text.", "_kq+I5o.comment": "Button to add a dynamically added parameter", "_kuFK3E.comment": "Invalid authentication without type property", - "_kxMDyM.comment": "Error validation message", "_l/3yJr.comment": "Text to show when there is an error with the connection", "_l/9YHQ.comment": "Time zone value ", "_l2YXln.comment": "Chatbot prompt to replace an action", @@ -2456,6 +2456,7 @@ "ahsVI/": "Enter Pfx", "aoUT/3": "Loading resources...", "auUI93": "Add or select a source schema to use for your map.", + "b7BQdu": "Enter a valid Boolean.", "b9/1dK": "Value", "b9P8SA": "Unsupported Token Type: {controls}", "b9Rvl9": "Body", @@ -2470,7 +2471,6 @@ "bWBMhe": "By default, Logic App instances run at the same time, or in parallel. This control changes how new runs are queued and can't be changed after enabling. To run as many parallel instances as possible, leave this control turned off. To limit the number of parallel runs, turn on this control, and select a limit. To run sequentially, select 1 as the limit.", "bWOsvo": "Use Invoker's Connection", "bXFGpe": "Info", - "bYwqkV": "Enter a valid json.", "ba9yGJ": "Load more", "bf7078": "Returns the maximum value in the input array of numbers", "blRFVt": "Set up these connections to use them in your flow.", @@ -2511,6 +2511,7 @@ "dBxX0M": "Add a trigger", "dD8y1n": "Switch to key value mode", "dDYCuU": "Learn more", + "dEe6Ob": "Enter a valid JSON.", "dKCp2j": "Tell me more about", "dL9V5t": "Managed identity", "dMAC4C": "Replace action", @@ -2687,7 +2688,6 @@ "klY9UN": "{count, plural, one {# item matched.} =0 {no items matched.} other {# items matched.}}", "kq+I5o": "Add an output", "kuFK3E": "Missing authentication type property: 'type'.", - "kxMDyM": "Enter a valid json.", "l/3yJr": "Invalid connection", "l/9YHQ": "(UTC+01:00) Windhoek", "l2YXln": "Replace action with", From 616177e59f564d8e2c5c066f2f0fc8f50167e758 Mon Sep 17 00:00:00 2001 From: Eric-B-Wu Date: Mon, 1 Apr 2024 14:15:19 -0400 Subject: [PATCH 3/5] custom logic for monaco --- libs/designer-ui/src/lib/editor/monaco/index.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libs/designer-ui/src/lib/editor/monaco/index.tsx b/libs/designer-ui/src/lib/editor/monaco/index.tsx index 6ff01012728..7ce70fd1613 100644 --- a/libs/designer-ui/src/lib/editor/monaco/index.tsx +++ b/libs/designer-ui/src/lib/editor/monaco/index.tsx @@ -243,6 +243,17 @@ export const MonacoEditor = forwardRef Date: Mon, 1 Apr 2024 14:37:00 -0400 Subject: [PATCH 4/5] wrong word lol --- libs/designer-ui/src/lib/editor/base/utils/keyvalueitem.ts | 6 +++--- .../src/utils/src/lib/helpers/stringFunctions.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/designer-ui/src/lib/editor/base/utils/keyvalueitem.ts b/libs/designer-ui/src/lib/editor/base/utils/keyvalueitem.ts index d9f6f3397ee..cb6a24fc4d1 100644 --- a/libs/designer-ui/src/lib/editor/base/utils/keyvalueitem.ts +++ b/libs/designer-ui/src/lib/editor/base/utils/keyvalueitem.ts @@ -3,7 +3,7 @@ import { isEmpty } from '../../../dictionary/expandeddictionary'; import type { ValueSegment } from '../../models/parameter'; import { createLiteralValueSegment, insertQutationForStringType } from './helper'; import { convertSegmentsToString } from './parsesegments'; -import { isNumber, isBoolean, doubleQuoteString } from '@microsoft/logic-apps-shared'; +import { isNumber, isBoolean, escapeString } from '@microsoft/logic-apps-shared'; export interface KeyValueItem { id: string; @@ -29,7 +29,7 @@ export const convertKeyValueItemToSegments = (items: KeyValueItem[], keyType?: s const updatedKey = key.map((segment) => { return { ...segment, - value: convertedKeyType !== constants.SWAGGER.TYPE.STRING ? segment.value : doubleQuoteString(segment.value), + value: convertedKeyType !== constants.SWAGGER.TYPE.STRING ? segment.value : escapeString(segment.value), }; }); @@ -37,7 +37,7 @@ export const convertKeyValueItemToSegments = (items: KeyValueItem[], keyType?: s const updatedValue = value.map((segment) => { return { ...segment, - value: convertedValueType !== constants.SWAGGER.TYPE.STRING ? segment.value : doubleQuoteString(segment.value), + value: convertedValueType !== constants.SWAGGER.TYPE.STRING ? segment.value : escapeString(segment.value), }; }); diff --git a/libs/logic-apps-shared/src/utils/src/lib/helpers/stringFunctions.ts b/libs/logic-apps-shared/src/utils/src/lib/helpers/stringFunctions.ts index d80dae03e4e..aab8cd76c95 100644 --- a/libs/logic-apps-shared/src/utils/src/lib/helpers/stringFunctions.ts +++ b/libs/logic-apps-shared/src/utils/src/lib/helpers/stringFunctions.ts @@ -30,6 +30,6 @@ export const splitFileName = (fileName: string) => { return [fileName.slice(0, splitFileName), fileName.slice(splitFileName)]; }; -export const doubleQuoteString = (s: string): string => { +export const escapeString = (s: string): string => { return s.replace(/\\/g, '\\\\').replace(/\n/g, '\\n'); }; From b2ed6b5cc8961761bcacdba62ea70ddbfaa7017a Mon Sep 17 00:00:00 2001 From: Eric-B-Wu Date: Tue, 2 Apr 2024 15:24:49 -0400 Subject: [PATCH 5/5] fix a couple of customcode bugs --- .../app/AzureLogicAppsDesigner/DesignerCommandBar.tsx | 11 +++++------ .../Services/WorkflowAndArtifacts.tsx | 11 +++++++++-- .../src/app/AzureLogicAppsDesigner/laDesigner.tsx | 6 ++++-- .../AzureLogicAppsDesigner/laDesignerConsumption.tsx | 3 ++- libs/designer-ui/src/lib/panel/panelResizer.tsx | 4 +++- libs/designer/src/lib/core/index.ts | 1 - libs/designer/src/lib/core/state/global.ts | 2 ++ libs/designer/src/lib/ui/panel/panelRoot.tsx | 2 +- 8 files changed, 26 insertions(+), 14 deletions(-) diff --git a/apps/designer-standalone/src/app/AzureLogicAppsDesigner/DesignerCommandBar.tsx b/apps/designer-standalone/src/app/AzureLogicAppsDesigner/DesignerCommandBar.tsx index d990533fb17..b621c1345f5 100644 --- a/apps/designer-standalone/src/app/AzureLogicAppsDesigner/DesignerCommandBar.tsx +++ b/apps/designer-standalone/src/app/AzureLogicAppsDesigner/DesignerCommandBar.tsx @@ -5,7 +5,7 @@ import { CommandBar } from '@fluentui/react/lib/CommandBar'; import { Spinner, SpinnerSize } from '@fluentui/react/lib/Spinner'; import type { ILoggerService } from '@microsoft/logic-apps-shared'; import { LogEntryLevel, LoggerService, isNullOrEmpty, RUN_AFTER_COLORS } from '@microsoft/logic-apps-shared'; -import type { CustomCodeFileNameMapping, RootState, Workflow } from '@microsoft/logic-apps-designer'; +import type { AppDispatch, CustomCodeFileNameMapping, RootState, Workflow } from '@microsoft/logic-apps-designer'; import { store as DesignerStore, serializeBJSWorkflow, @@ -20,7 +20,7 @@ import { openPanel, useNodesInitialized, getCustomCodeFilesWithData, - resetCustomCode, + resetDesignerDirtyState, } from '@microsoft/logic-apps-designer'; import { useMemo } from 'react'; import { useMutation } from 'react-query'; @@ -50,7 +50,7 @@ export const DesignerCommandBar = ({ location: string; isReadOnly: boolean; discard: () => unknown; - saveWorkflow: (workflow: Workflow, customCodeData: CustomCodeFileNameMapping | undefined) => Promise; + saveWorkflow: (workflow: Workflow, customCodeData: CustomCodeFileNameMapping | undefined, clearDirtyState: () => void) => Promise; isDarkMode: boolean; isConsumption?: boolean; showConnectionsPanel?: boolean; @@ -58,7 +58,7 @@ export const DesignerCommandBar = ({ enableCopilot?: () => void; loggerService?: ILoggerService; }) => { - const dispatch = useDispatch(); + const dispatch = useDispatch(); const isCopilotReady = useNodesInitialized(); const { isLoading: isSaving, mutate: saveWorkflowMutate } = useMutation(async () => { const designerState = DesignerStore.getState(); @@ -92,9 +92,8 @@ export const DesignerCommandBar = ({ const customCodeFilesWithData = getCustomCodeFilesWithData(designerState.customCode); if (!hasParametersErrors) { - await saveWorkflow(serializedWorkflow, customCodeFilesWithData); + await saveWorkflow(serializedWorkflow, customCodeFilesWithData, () => dispatch(resetDesignerDirtyState())); updateCallbackUrl(designerState, DesignerStore.dispatch); - DesignerStore.dispatch(resetCustomCode()); } }); diff --git a/apps/designer-standalone/src/app/AzureLogicAppsDesigner/Services/WorkflowAndArtifacts.tsx b/apps/designer-standalone/src/app/AzureLogicAppsDesigner/Services/WorkflowAndArtifacts.tsx index 40b3ccfa05e..f30c0840a25 100644 --- a/apps/designer-standalone/src/app/AzureLogicAppsDesigner/Services/WorkflowAndArtifacts.tsx +++ b/apps/designer-standalone/src/app/AzureLogicAppsDesigner/Services/WorkflowAndArtifacts.tsx @@ -9,6 +9,7 @@ import type { LogicAppsV2, VFSObject } from '@microsoft/logic-apps-shared'; import axios from 'axios'; import jwt_decode from 'jwt-decode'; import { useQuery } from 'react-query'; +import { isSuccessResponse } from './HttpClient'; const baseUrl = 'https://management.azure.com'; const standardApiVersion = '2020-06-01'; @@ -341,7 +342,8 @@ export const saveWorkflowStandard = async ( connectionsData: ConnectionsData | undefined, parametersData: ParametersData | undefined, settings: Record | undefined, - customCodeData: CustomCodeFileNameMapping | undefined + customCodeData: CustomCodeFileNameMapping | undefined, + clearDirtyState: () => void ): Promise => { const data: any = { files: { @@ -373,13 +375,18 @@ export const saveWorkflowStandard = async ( // saving custom code must happen synchronously with deploying the workflow artifacts as they both cause // the host to go soft restart. We may need to look into if there's a race case where this may still happen saveCustomCodeStandard(customCodeData); - await axios.post(`${baseUrl}${siteResourceId}/deployWorkflowArtifacts?api-version=${standardApiVersion}`, data, { + const response = await axios.post(`${baseUrl}${siteResourceId}/deployWorkflowArtifacts?api-version=${standardApiVersion}`, data, { headers: { 'If-Match': '*', 'Content-Type': 'application/json', Authorization: `Bearer ${environment.armToken}`, }, }); + if (!isSuccessResponse(response.status)) { + alert('Failed to save workflow'); + return; + } + clearDirtyState(); } catch (error) { console.log(error); } diff --git a/apps/designer-standalone/src/app/AzureLogicAppsDesigner/laDesigner.tsx b/apps/designer-standalone/src/app/AzureLogicAppsDesigner/laDesigner.tsx index fc99406bf4c..ec9bd0008d0 100644 --- a/apps/designer-standalone/src/app/AzureLogicAppsDesigner/laDesigner.tsx +++ b/apps/designer-standalone/src/app/AzureLogicAppsDesigner/laDesigner.tsx @@ -194,7 +194,8 @@ const DesignerEditor = () => { const saveWorkflowFromDesigner = async ( workflowFromDesigner: Workflow, - customCode: CustomCodeFileNameMapping | undefined + customCode: CustomCodeFileNameMapping | undefined, + clearDirtyState: () => void ): Promise => { const { definition, connectionReferences, parameters } = workflowFromDesigner; const workflowToSave = { @@ -260,7 +261,8 @@ const DesignerEditor = () => { connectionsToUpdate, parametersToUpdate, settingsToUpdate, - customCode + customCode, + clearDirtyState ); }; diff --git a/apps/designer-standalone/src/app/AzureLogicAppsDesigner/laDesignerConsumption.tsx b/apps/designer-standalone/src/app/AzureLogicAppsDesigner/laDesignerConsumption.tsx index eb6787602c5..fa156bf1cd5 100644 --- a/apps/designer-standalone/src/app/AzureLogicAppsDesigner/laDesignerConsumption.tsx +++ b/apps/designer-standalone/src/app/AzureLogicAppsDesigner/laDesignerConsumption.tsx @@ -66,6 +66,7 @@ const DesignerEditorConsumption = () => { showChatBot, hostOptions, showConnectionsPanel, + language, } = useSelector((state: RootState) => state.workflowLoader); const workflowName = workflowId.split('/').splice(-1)[0]; @@ -201,7 +202,7 @@ const DesignerEditorConsumption = () => {
{ const animationFrame = useRef(0); const resize = useCallback( - ({ clientX }: MouseEvent) => { + (e: MouseEvent) => { + e.preventDefault(); + const { clientX } = e; animationFrame.current = requestAnimationFrame(() => { if (isResizing) { const newWidth = Math.max(window.innerWidth - clientX, 400); diff --git a/libs/designer/src/lib/core/index.ts b/libs/designer/src/lib/core/index.ts index 9d72e9971a5..d2156892087 100644 --- a/libs/designer/src/lib/core/index.ts +++ b/libs/designer/src/lib/core/index.ts @@ -69,4 +69,3 @@ export { getBrandColorFromManifest, getIconUriFromManifest, } from './utils/card'; -export { resetCustomCode } from './state/customcode/customcodeSlice'; diff --git a/libs/designer/src/lib/core/state/global.ts b/libs/designer/src/lib/core/state/global.ts index 79c9dafbafb..5f44f566fa5 100644 --- a/libs/designer/src/lib/core/state/global.ts +++ b/libs/designer/src/lib/core/state/global.ts @@ -1,3 +1,4 @@ +import { resetCustomCode } from './customcode/customcodeSlice'; import { useIsWorkflowDirty } from './workflow/workflowSelectors'; import { setIsWorkflowDirty } from './workflow/workflowSlice'; import { setIsWorkflowParametersDirty } from './workflowparameters/workflowparametersSlice'; @@ -17,4 +18,5 @@ export const resetDesignerDirtyState = createAsyncThunk('resetDesignerDirtyState const dispatch = thunkAPI.dispatch; dispatch(setIsWorkflowDirty(false)); dispatch(setIsWorkflowParametersDirty(false)); + dispatch(resetCustomCode()); }); diff --git a/libs/designer/src/lib/ui/panel/panelRoot.tsx b/libs/designer/src/lib/ui/panel/panelRoot.tsx index d1f3c069218..fe2990ffa72 100644 --- a/libs/designer/src/lib/ui/panel/panelRoot.tsx +++ b/libs/designer/src/lib/ui/panel/panelRoot.tsx @@ -84,7 +84,7 @@ export const PanelRoot = (props: PanelRootProps): JSX.Element => { className={`msla-panel-root-${currentPanelMode}`} isLightDismiss isBlocking={!isLoadingPanel && !nonBlockingPanels.includes(currentPanelMode ?? '')} - type={panelLocation === PanelLocation.Right ? PanelType.custom : PanelType.customNear} + type={commonPanelProps.panelLocation === PanelLocation.Right ? PanelType.custom : PanelType.customNear} isOpen={!collapsed} onDismiss={dismissPanel} hasCloseButton={false}