From 7232d1c49fab2834fcdf3946f1ed6e4d1d8ffe54 Mon Sep 17 00:00:00 2001 From: Ben Brown Date: Tue, 5 May 2020 15:29:51 -0500 Subject: [PATCH] feat: azure publish plugin (#2733) * split the configuration as object * fix deployment script, change settings path * fix bugs in deploy script and change credential type: * finish gethistory, getstatus, update history and status after publish * add some code comments for clarity add many TODOs in code * more code comments * more code comments for clarity * add login script and hash the config as folder name * add bot deploy package build into lib build * split the provision part out of composer * fix luis appid unfound error * fix typo * polish * use bot root to config the path of settings * differ bot to different layer * change the order of loading settings * update schema * change login and provision script, from save file to output to console * add comment * fix merge conflict * format resulting profile * add comment about security * use Bearer token auth when doing zipdeploy remove use of websiteclient * move provision out of composer, and make sure it not depend on internal package * add provision subfields schema * use token replace the credential * fix output of token * change the error message when token expire * add provision error details, add configurable * update schema require and log message return * fix parse * fix template * update schema and provision script * fix provision luis configurable * detail the token's error handle * Add support for using the ejected runtime code instead of the built in template when publishing to Azure * Make it optional to persist the history to disk. Keep it in memory instead. * move provision script into shared asset folder that is copied into all new projets change hashing to include bot name to avoid possible overlap when using shared resources * add to readme * more readme * more readme * clean up tmp folder after publish completes or fails * remove empty config in provision and appPassword in provision result, Change provision default to true * add token error handle when zipdeploy fail * improve output of provision script: * add usage if missing parameters * colorize and format output * add some additional error formatting * improve output * remove webManagerClient and use token instead * clean up the order of fields, remove unused fields from profile update schema with full form * use publisher description rather than package name * feat: Runtime refactor, new directory structure and Azure Function introduction phase 1 (#2855) * Runtime: new folder structure, refactor common c# code into core, create function runtime * Remove deprecated Bot Project * Runtime: Fix tests * Update runtime code owners * Runtime: Part 1 of updating composer server to honor new runtime paths * Runtime: tweaks for local publish to run prior to merge * Runtime: fixes post merge * Update azure publish to use the azure web app template. * Azure publish: update bot project deploy to new directory structure * Fix codeowners alias mistake * Revert "Merge branch 'master' of https://github.com/microsoft/BotFramework-Composer into wenyluo/azure" This reverts commit af077e248e47e32750629dee7b9b8c8c6e98d84a, reversing changes made to e24071d0ddbce5554d498c1ba34eb18a93b8948d. * WebApp + new runtime: deployment and local runtime all working * Runtime: move nuget.config to dotnet runtime root * Asset manager: add mock folder to reflect new runtime structure * Local publish: remove unnecessary space * Runtime: Add copyright header to all missing files * Fix bad merge * Runtime: rename js -> node and update readmes * add an optional instructions field to the publish plugin so we ca nexplain how to get a config * merge master * fix linter warning * handle errors in kill procss * remove unnecessary dupe fields from schema * fix for modified schema path Co-authored-by: Wenyi Luo Co-authored-by: Qi Kang Co-authored-by: Chris Whitten Co-authored-by: Carlos Castro --- .github/CODEOWNERS | 2 +- .github/workflows/main.yml | 4 +- BotProject/Node/README.md | 1 - BotProject/Templates/CSharp/BotProject.sln | 31 - BotProject/Templates/CSharp/README.md | 44 - .../Templates/CSharp/Tests/Tests.csproj | 19 - Composer/package.json | 6 +- .../src/pages/publish/createPublishTarget.tsx | 7 +- .../client/src/pages/publish/index.tsx | 4 +- Composer/packages/client/src/store/types.ts | 1 + .../electron-server/scripts/copy-templates.js | 2 +- .../adaptive-form/src/utils/resolveRef.ts | 2 +- .../src/composerPluginRegistration.ts | 7 +- .../extensions/plugin-loader/src/types.ts | 2 + Composer/packages/lib/bot-deploy/.gitignore | 2 + Composer/packages/lib/bot-deploy/README.md | 2 +- Composer/packages/lib/bot-deploy/package.json | 5 +- .../lib/bot-deploy/src/botProjectDeploy.ts | 494 ++++++---- .../bot-deploy/src/botProjectDeployConfig.ts | 15 +- .../bot-deploy/src/botProjectLoggerType.ts | 1 + Composer/packages/lib/package.json | 5 +- .../packages/lib/shared/src/types/schema.ts | 2 +- .../__tests__/mocks/runtimes/dotnet/readme.md | 1 + .../packages/server/assets/shared/README.md | 73 +- .../new-rg-parameters.json | 0 .../preexisting-rg-parameters.json | 0 .../template-with-new-rg.json | 0 .../template-with-preexisting-rg.json | 24 +- .../assets/shared/scripts/package-lock.json | 226 +++++ .../server/assets/shared/scripts/package.json | 20 + .../shared/scripts/provisionComposer.js | 508 +++++++++++ .../server/src/controllers/publisher.ts | 7 +- .../server/src/models/asset/assetManager.ts | 32 +- .../server/src/models/bot/botProject.ts | 1 + Composer/packages/server/src/settings/env.ts | 3 +- Composer/plugins/README.md | 4 +- Composer/plugins/azurePublish/.gitignore | 6 + .../plugins/azurePublish/package-lock.json | 795 ++++++++++++++++ Composer/plugins/azurePublish/package.json | 24 + Composer/plugins/azurePublish/src/index.ts | 353 +++++++ Composer/plugins/azurePublish/src/schema.ts | 126 +++ Composer/plugins/azurePublish/tsconfig.json | 21 + Composer/plugins/azurePublish/yarn.lock | 861 ++++++++++++++++++ Composer/plugins/localPublish/src/index.ts | 37 +- docker-compose.yml | 4 +- docs/Deploying-Composer.md | 6 +- docs/architecure/architecure.md | 20 +- docs/olddocs/07-11-2019-Hack.md | 2 +- docs/olddocs/architecure/architecure.md | 20 +- runtime/dotnet/ComposerRuntime.sln | 43 + .../CSharp => runtime/dotnet}/NuGet.Config | 0 runtime/dotnet/README.md | 7 + runtime/dotnet/azurefunctions/.gitignore | 264 ++++++ .../dotnet/azurefunctions/MessagesTrigger.cs | 44 + ...Framework.Composer.FunctionTemplate.csproj | 4 + ...ramework.Composer.FunctionTemplate.ruleset | 0 ...oft.BotFramework.Composer.Functions.csproj | 70 ++ .../Settings/ActivitySerializationSettings.cs | 26 + .../dotnet/azurefunctions/SkillsTrigger.cs | 60 ++ runtime/dotnet/azurefunctions/Startup.cs | 211 +++++ .../appsettings.Deployment.json | 2 +- .../appsettings.Development.json | 0 .../dotnet/azurefunctions}/appsettings.json | 0 runtime/dotnet/azurefunctions/host.json | 3 + .../dotnet/azurewebapp}/.gitignore | 0 .../azurewebapp}/Controllers/BotController.cs | 4 +- .../Controllers/SkillController.cs | 5 +- ...rosoft.BotFramework.Composer.WebApp.csproj | 14 +- ...tFramework.Composer.WebAppTemplate.ruleset | 199 ++++ .../dotnet/azurewebapp}/Program.cs | 7 +- .../Properties/launchSettings.json | 0 runtime/dotnet/azurewebapp/README.md | 21 + .../dotnet/azurewebapp}/Schemas/readme.md | 0 .../dotnet/azurewebapp}/Schemas/sdk.schema | 0 .../dotnet/azurewebapp}/Schemas/update.cmd | 0 .../azurewebapp}/Scripts/build_runtime.ps1 | 0 .../azurewebapp}/Scripts/build_runtime.sh | 0 .../dotnet/azurewebapp}/Scripts/create.ps1 | 0 .../dotnet/azurewebapp}/Scripts/deploy.ps1 | 2 +- .../dotnet/azurewebapp}/Startup.cs | 5 +- .../azurewebapp/appsettings.Deployment.json | 4 + .../azurewebapp/appsettings.Development.json | 4 + runtime/dotnet/azurewebapp/appsettings.json | 27 + .../azurewebapp}/packages/packages.json | 0 .../dotnet/azurewebapp}/wwwroot/default.htm | 0 runtime/dotnet/core/.gitignore | 9 + .../dotnet/core}/ComposerBot.cs | 11 +- .../dotnet/core}/LuisConfig.cs | 4 +- .../dotnet/core/LuisConfigAdapter.cs | 8 +- ...icrosoft.BotFramework.Composer.Core.csproj | 28 + ...crosoft.BotFramework.Composer.Core.ruleset | 199 ++++ .../Settings}/BlobStorageConfiguration.cs | 2 +- .../core/Settings}/BotFeatureSettings.cs | 2 +- .../dotnet/core/Settings}/BotSettings.cs | 2 +- .../core}/SkillConversationIdFactory.cs | 4 +- .../dotnet/tests}/ActionsTests.cs | 2 +- .../tests}/ControllingConversationTests.cs | 2 +- .../dotnet/tests}/InputsTests.cs | 3 +- .../dotnet/tests}/MessageTests.cs | 2 +- ...crosoft.BotFramework.Composer.Tests.csproj | 28 + .../dotnet/tests}/ToDoBotTests.cs | 2 +- runtime/node/README.md | 7 + runtime/node/azurefunctions/README.md | 1 + runtime/node/azurewebapp/README.md | 1 + runtime/node/core/README.md | 1 + scripts/generate_runtime.ps1 | 2 +- 106 files changed, 4763 insertions(+), 415 deletions(-) delete mode 100644 BotProject/Node/README.md delete mode 100644 BotProject/Templates/CSharp/BotProject.sln delete mode 100644 BotProject/Templates/CSharp/README.md delete mode 100644 BotProject/Templates/CSharp/Tests/Tests.csproj create mode 100644 Composer/packages/lib/bot-deploy/.gitignore create mode 100644 Composer/packages/server/__tests__/mocks/runtimes/dotnet/readme.md rename {BotProject/Templates/CSharp => Composer/packages/server/assets/shared/scripts}/DeploymentTemplates/new-rg-parameters.json (100%) rename {BotProject/Templates/CSharp => Composer/packages/server/assets/shared/scripts}/DeploymentTemplates/preexisting-rg-parameters.json (100%) rename {BotProject/Templates/CSharp => Composer/packages/server/assets/shared/scripts}/DeploymentTemplates/template-with-new-rg.json (100%) rename {BotProject/Templates/CSharp => Composer/packages/server/assets/shared/scripts}/DeploymentTemplates/template-with-preexisting-rg.json (93%) create mode 100644 Composer/packages/server/assets/shared/scripts/package-lock.json create mode 100644 Composer/packages/server/assets/shared/scripts/package.json create mode 100644 Composer/packages/server/assets/shared/scripts/provisionComposer.js create mode 100644 Composer/plugins/azurePublish/.gitignore create mode 100644 Composer/plugins/azurePublish/package-lock.json create mode 100644 Composer/plugins/azurePublish/package.json create mode 100644 Composer/plugins/azurePublish/src/index.ts create mode 100644 Composer/plugins/azurePublish/src/schema.ts create mode 100644 Composer/plugins/azurePublish/tsconfig.json create mode 100644 Composer/plugins/azurePublish/yarn.lock create mode 100644 runtime/dotnet/ComposerRuntime.sln rename {BotProject/Templates/CSharp => runtime/dotnet}/NuGet.Config (100%) create mode 100644 runtime/dotnet/README.md create mode 100644 runtime/dotnet/azurefunctions/.gitignore create mode 100644 runtime/dotnet/azurefunctions/MessagesTrigger.cs create mode 100644 runtime/dotnet/azurefunctions/Microsoft.BotFramework.Composer.FunctionTemplate.csproj rename BotProject/Templates/CSharp/BotProject.ruleset => runtime/dotnet/azurefunctions/Microsoft.BotFramework.Composer.FunctionTemplate.ruleset (100%) create mode 100644 runtime/dotnet/azurefunctions/Microsoft.BotFramework.Composer.Functions.csproj create mode 100644 runtime/dotnet/azurefunctions/Settings/ActivitySerializationSettings.cs create mode 100644 runtime/dotnet/azurefunctions/SkillsTrigger.cs create mode 100644 runtime/dotnet/azurefunctions/Startup.cs rename {BotProject/Templates/CSharp => runtime/dotnet/azurefunctions}/appsettings.Deployment.json (96%) rename {BotProject/Templates/CSharp => runtime/dotnet/azurefunctions}/appsettings.Development.json (100%) rename {BotProject/Templates/CSharp => runtime/dotnet/azurefunctions}/appsettings.json (100%) create mode 100644 runtime/dotnet/azurefunctions/host.json rename {BotProject/Templates/CSharp => runtime/dotnet/azurewebapp}/.gitignore (100%) rename {BotProject/Templates/CSharp => runtime/dotnet/azurewebapp}/Controllers/BotController.cs (90%) rename {BotProject/Templates/CSharp => runtime/dotnet/azurewebapp}/Controllers/SkillController.cs (90%) rename BotProject/Templates/CSharp/BotProject.csproj => runtime/dotnet/azurewebapp/Microsoft.BotFramework.Composer.WebApp.csproj (81%) create mode 100644 runtime/dotnet/azurewebapp/Microsoft.BotFramework.Composer.WebAppTemplate.ruleset rename {BotProject/Templates/CSharp => runtime/dotnet/azurewebapp}/Program.cs (93%) rename {BotProject/Templates/CSharp => runtime/dotnet/azurewebapp}/Properties/launchSettings.json (100%) create mode 100644 runtime/dotnet/azurewebapp/README.md rename {BotProject/Templates/CSharp => runtime/dotnet/azurewebapp}/Schemas/readme.md (100%) rename {BotProject/Templates/CSharp => runtime/dotnet/azurewebapp}/Schemas/sdk.schema (100%) rename {BotProject/Templates/CSharp => runtime/dotnet/azurewebapp}/Schemas/update.cmd (100%) rename {BotProject/Templates/CSharp => runtime/dotnet/azurewebapp}/Scripts/build_runtime.ps1 (100%) rename {BotProject/Templates/CSharp => runtime/dotnet/azurewebapp}/Scripts/build_runtime.sh (100%) rename {BotProject/Templates/CSharp => runtime/dotnet/azurewebapp}/Scripts/create.ps1 (100%) rename {BotProject/Templates/CSharp => runtime/dotnet/azurewebapp}/Scripts/deploy.ps1 (99%) rename {BotProject/Templates/CSharp => runtime/dotnet/azurewebapp}/Startup.cs (97%) create mode 100644 runtime/dotnet/azurewebapp/appsettings.Deployment.json create mode 100644 runtime/dotnet/azurewebapp/appsettings.Development.json create mode 100644 runtime/dotnet/azurewebapp/appsettings.json rename {BotProject/Templates/CSharp => runtime/dotnet/azurewebapp}/packages/packages.json (100%) rename {BotProject/Templates/CSharp => runtime/dotnet/azurewebapp}/wwwroot/default.htm (100%) create mode 100644 runtime/dotnet/core/.gitignore rename {BotProject/Templates/CSharp => runtime/dotnet/core}/ComposerBot.cs (93%) rename {BotProject/Templates/CSharp => runtime/dotnet/core}/LuisConfig.cs (86%) rename BotProject/Templates/CSharp/LuisConfigAdaptor.cs => runtime/dotnet/core/LuisConfigAdapter.cs (72%) create mode 100644 runtime/dotnet/core/Microsoft.BotFramework.Composer.Core.csproj create mode 100644 runtime/dotnet/core/Microsoft.BotFramework.Composer.Core.ruleset rename {BotProject/Templates/CSharp/BotSettings => runtime/dotnet/core/Settings}/BlobStorageConfiguration.cs (86%) rename {BotProject/Templates/CSharp/BotSettings => runtime/dotnet/core/Settings}/BotFeatureSettings.cs (92%) rename {BotProject/Templates/CSharp/BotSettings => runtime/dotnet/core/Settings}/BotSettings.cs (95%) rename {BotProject/Templates/CSharp => runtime/dotnet/core}/SkillConversationIdFactory.cs (94%) rename {BotProject/Templates/CSharp/Tests => runtime/dotnet/tests}/ActionsTests.cs (99%) rename {BotProject/Templates/CSharp/Tests => runtime/dotnet/tests}/ControllingConversationTests.cs (98%) rename {BotProject/Templates/CSharp/Tests => runtime/dotnet/tests}/InputsTests.cs (97%) rename {BotProject/Templates/CSharp/Tests => runtime/dotnet/tests}/MessageTests.cs (98%) create mode 100644 runtime/dotnet/tests/Microsoft.BotFramework.Composer.Tests.csproj rename {BotProject/Templates/CSharp/Tests => runtime/dotnet/tests}/ToDoBotTests.cs (98%) create mode 100644 runtime/node/README.md create mode 100644 runtime/node/azurefunctions/README.md create mode 100644 runtime/node/azurewebapp/README.md create mode 100644 runtime/node/core/README.md diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index bc96971698..8a15b50af0 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2,7 +2,7 @@ * @cwhitten @boydc2014 @a-b-r-o-w-n -/BotProject/ @boydc2014 @luhan2017 +/runtime/ @boydc2014 @luhan2017 @carlosscastro @benbrown /Composer/ @cwhitten @boydc2014 @a-b-r-o-w-n @corinagum @beyackle @srinaath @tonyanziano diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2fdb51fd8e..5c1a30ab3f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -63,10 +63,10 @@ jobs: dotnet-version: "3.1.102" # SDK Version to use. - name: dotnet build run: dotnet build - working-directory: BotProject/Templates/CSharp + working-directory: runtime/dotnet - name: dotnet test run: dotnet test - working-directory: BotProject/Templates/CSharp + working-directory: runtime/dotnet/tests docker-build: name: Docker Build diff --git a/BotProject/Node/README.md b/BotProject/Node/README.md deleted file mode 100644 index e35d9cbaa5..0000000000 --- a/BotProject/Node/README.md +++ /dev/null @@ -1 +0,0 @@ -# Bot Launcher in Node \ No newline at end of file diff --git a/BotProject/Templates/CSharp/BotProject.sln b/BotProject/Templates/CSharp/BotProject.sln deleted file mode 100644 index db73c02cd8..0000000000 --- a/BotProject/Templates/CSharp/BotProject.sln +++ /dev/null @@ -1,31 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.136 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotProject", "BotProject.csproj", "{80ACF5BE-4A04-46F8-A83E-530FB21948D5}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{5AFADEA2-A18F-46DF-8080-2CA418880318}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {80ACF5BE-4A04-46F8-A83E-530FB21948D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {80ACF5BE-4A04-46F8-A83E-530FB21948D5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {80ACF5BE-4A04-46F8-A83E-530FB21948D5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {80ACF5BE-4A04-46F8-A83E-530FB21948D5}.Release|Any CPU.Build.0 = Release|Any CPU - {5AFADEA2-A18F-46DF-8080-2CA418880318}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5AFADEA2-A18F-46DF-8080-2CA418880318}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5AFADEA2-A18F-46DF-8080-2CA418880318}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5AFADEA2-A18F-46DF-8080-2CA418880318}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {B13FC467-1A63-4C8F-A29E-43B2D8B79B17} - EndGlobalSection -EndGlobal diff --git a/BotProject/Templates/CSharp/README.md b/BotProject/Templates/CSharp/README.md deleted file mode 100644 index 5942c9b2a1..0000000000 --- a/BotProject/Templates/CSharp/README.md +++ /dev/null @@ -1,44 +0,0 @@ -## Bot Runtime -Bot project is the launcher project for the bots written in declarative form (JSON), using the Composer, for the Bot Framework SDK. -This same code is used by Composer to start the bot locally for testing. - -## Instructions for using and customizing the bot runtime - -Composer can be configured to use a customized copy of this runtime. -A copy of it can be added to your project automatically by using the "runtime settings" page in Composer. - -The Bot Project is a regular Bot Framework SDK V4 project. You can modify the code of this project -and continue to use it with Composer. - -* Add additional middleware -* Customize the state storage system -* Add custom dialog classes - -### Prerequisite: -* Install .Netcore 3.1 - -### Build: - -* cd [my bot folder]/runtime -* dotnet user-secrets init // init the user secret id -* dotnet build // build - - -### Run from Command line: -* cd [my bot folder]/runtime -* dotnet run // start the bot -* It will start a web server and listening at http://localhost:3979. - -### Run with Composer - -Open your bot project in Composer. Navigate to the runtime settings tab. - -Set the path to runtime to the full path to your runtime code. Customize the start command as necessary. - -The "Start Bot" button will now use your customized runtime. - -Note: the application code must be built and ready to run before Composer can manage it. - -### Test bot -* You can set you emulator to connect to http://localhost:3979/api/messages. - diff --git a/BotProject/Templates/CSharp/Tests/Tests.csproj b/BotProject/Templates/CSharp/Tests/Tests.csproj deleted file mode 100644 index 28a2c36621..0000000000 --- a/BotProject/Templates/CSharp/Tests/Tests.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - netcoreapp3.1 - - false - - - - - - - - - - - - - diff --git a/Composer/package.json b/Composer/package.json index 81e4e78e11..6bc2ba9b8d 100644 --- a/Composer/package.json +++ b/Composer/package.json @@ -33,14 +33,14 @@ "build:server": "yarn workspace @bfc/server build", "build:client": "yarn workspace @bfc/client build", "build:tools": "yarn workspace @bfc/tools build:all", - "build:plugins": "cd plugins/localPublish && yarn install && yarn build", + "build:plugins": "concurrently \"cd plugins/localPublish && yarn install && yarn build\" \"cd plugins/azurePublish && yarn install && yarn build\" ", "start": "cross-env NODE_ENV=production PORT=3000 yarn start:server", "startall": "node scripts/update.js && yarn start", "start:dev": "concurrently \"npm:start:client\" \"npm:start:server:dev\"", "start:client": "yarn workspace @bfc/client start", "start:server": "yarn workspace @bfc/server start", "start:server:dev": "yarn workspace @bfc/server start:dev", - "runtime": "cd ../BotProject/CSharp/ && dotnet build && dotnet run", + "runtime": "cd ../runtime/dotnet/azurewebapp && dotnet build && dotnet run", "test": "yarn typecheck && jest", "test:watch": "yarn typecheck && jest --watch", "test:coverage": "yarn test --coverage --no-cache --reporters=default", @@ -113,4 +113,4 @@ "dependencies": { "cross-env": "^6.0.3" } -} +} \ No newline at end of file diff --git a/Composer/packages/client/src/pages/publish/createPublishTarget.tsx b/Composer/packages/client/src/pages/publish/createPublishTarget.tsx index 030eb36a15..197b3638c8 100644 --- a/Composer/packages/client/src/pages/publish/createPublishTarget.tsx +++ b/Composer/packages/client/src/pages/publish/createPublishTarget.tsx @@ -30,7 +30,7 @@ const CreatePublishTarget: React.FC = props => { const [errorMessage, setErrorMsg] = useState(''); const targetTypes = useMemo(() => { - return props.types.map(t => ({ key: t.name, text: t.name })); + return props.types.map(t => ({ key: t.name, text: t.description })); }, [props.targets]); const updateType = (_e, option?: IDropdownOption) => { @@ -57,6 +57,10 @@ const CreatePublishTarget: React.FC = props => { } }; + const instructions: string | undefined = useMemo((): string | undefined => { + return targetType ? props.types.find(t => t.name === targetType)?.instructions : ''; + }, [props.targets, targetType]); + const schema = useMemo(() => { return targetType ? props.types.find(t => t.name === targetType)?.schema : undefined; }, [props.targets, targetType]); @@ -99,6 +103,7 @@ const CreatePublishTarget: React.FC = props => { defaultSelectedKey={props.current ? props.current.type : null} onChange={updateType} /> + {instructions &&

{instructions}

}
{formatMessage('Publish Configuration')}