Skip to content

Commit

Permalink
fix(designer): Small fix to get fileExtension on custom code action a…
Browse files Browse the repository at this point in the history
…dd (#4711)

* fix(designer): fix issue where scope nodes didn't get focused when they were jumped to

* small pr

* small change

---------

Co-authored-by: Travis Harris <travisharris@microsoft.com>
  • Loading branch information
Eric-B-Wu and hartra344 committed Apr 25, 2024
1 parent 3ca6a7f commit 8dff14c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Expand Up @@ -95,7 +95,7 @@ export const DesignerCommandBar = ({
const customCodeFilesWithData = getCustomCodeFilesWithData(designerState.customCode);

if (!hasParametersErrors) {
await saveWorkflow(serializedWorkflow, customCodeFilesWithData, () => dispatch(resetDesignerDirtyState()));
await saveWorkflow(serializedWorkflow, customCodeFilesWithData, () => dispatch(resetDesignerDirtyState(undefined)));
updateCallbackUrl(designerState, DesignerStore.dispatch);
}
});
Expand Down
Expand Up @@ -466,7 +466,7 @@ export const initializeCustomCodeDataInInputs = (inputs: NodeInputs, nodeId: str
nodeId,
fileData,
fileExtension: getFileExtensionName(language),
fileName: replaceWhiteSpaceWithUnderscore(nodeId),
fileName: replaceWhiteSpaceWithUnderscore(nodeId) + getFileExtensionName(language),
})
);
}
Expand Down
20 changes: 10 additions & 10 deletions libs/logic-apps-shared/src/utils/src/lib/helpers/customcode.ts
Expand Up @@ -59,41 +59,41 @@ export const generateDefaultCustomCodeValue = (language: EditorLanguage): string
return `$action = Get-ActionOutput -actionName "Compose"
$subId = $action["body"]["subscriptionId"]
$resourceGroupName = $action["body"]["resourceGroupName"]
$logicAppName = $action["body"]["logicAppName"]
$result = Start-AzLogicApp -ResourceGroupName $resourceGroupName -Name $logicAppName -TriggerName "manual" -Confirm
Push-ActionOutputs -body $result`;
case EditorLanguage.csharp:
return `// Add the required libraries
const Newtonsoft = require("Newtonsoft.Json");
const AzureScripting = require("Microsoft.Azure.Workflows.Scripting");
// Define the function to run
async function run(context) {
// Get the outputs from the 'compose' action
const outputs = (await context.GetActionResults("compose")).Outputs;
// Generate random temperature within a range based on the temperature scale
const temperatureScale = outputs["temperatureScale"].toString();
const currentTemp = temperatureScale === "Celsius" ? Math.floor(Math.random() * (30 - 1 + 1)) + 1 : Math.floor(Math.random() * (90 - 40 + 1)) + 40;
const lowTemp = currentTemp - 10;
const highTemp = currentTemp + 10;
// Create a Weather object with the temperature information
const weather = {
ZipCode: parseInt(outputs["zipCode"]),
CurrentWeather: \`The current weather is \${currentTemp} \${temperatureScale}\`,
DayLow: \`The low for the day is \${lowTemp} \${temperatureScale}\`,
DayHigh: \`The high for the day is \${highTemp} \${temperatureScale}\`
};
return weather;
}
// Define the Weather class
class Weather {
constructor() {
Expand All @@ -103,7 +103,7 @@ class Weather {
this.DayHigh = "";
}
}
module.exports = run;`;
default:
return '';
Expand Down

0 comments on commit 8dff14c

Please sign in to comment.