Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Start Botproject runtime in bot folder #1672

Merged
merged 54 commits into from
Jan 9, 2020
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
69ae226
start runtime from samplpebot csharp runtime
VanyLaw Nov 28, 2019
1f3b631
fix
VanyLaw Nov 28, 2019
b8670c9
fix
VanyLaw Nov 28, 2019
6b04384
fix
VanyLaw Nov 28, 2019
1e0ca12
use logger instead of console log
VanyLaw Nov 28, 2019
fbf2ed7
Merge branch 'master' into wenyluo/csConnector
luhan2017 Nov 29, 2019
1b17984
Merge branch 'master' into wenyluo/csConnector
luhan2017 Dec 2, 2019
3964fd7
fix comment
VanyLaw Dec 2, 2019
c0f1411
fix comment
VanyLaw Dec 2, 2019
0334bb8
Merge remote-tracking branch 'origin/master' into wenyluo/csConnector
VanyLaw Dec 3, 2019
306a0d2
add port usable validation and use log instead console log
VanyLaw Dec 3, 2019
99a2882
Merge remote-tracking branch 'origin/master' into wenyluo/csConnector
VanyLaw Dec 3, 2019
14c4a21
fix comments
VanyLaw Dec 4, 2019
4d989e6
Merge remote-tracking branch 'origin/master' into wenyluo/csConnector
VanyLaw Dec 4, 2019
543785b
move build script from template to server
VanyLaw Dec 4, 2019
396e7c7
Merge remote-tracking branch 'origin/master' into wenyluo/csConnector
VanyLaw Dec 5, 2019
1cc7e70
polish output error message
VanyLaw Dec 5, 2019
4336354
remove environment
VanyLaw Dec 6, 2019
a287f64
Merge remote-tracking branch 'origin/master' into wenyluo/csConnector
VanyLaw Dec 6, 2019
ffb617e
fix comments and add back the build script into template runtime
VanyLaw Dec 6, 2019
9167b0f
Merge remote-tracking branch 'origin/master' into wenyluo/csConnector
VanyLaw Dec 6, 2019
3d67936
add migrate old bot feature
VanyLaw Dec 9, 2019
6a28ec5
Merge remote-tracking branch 'origin/master' into wenyluo/csConnector
VanyLaw Dec 9, 2019
4394dc1
Merge branch 'master' into wenyluo/csConnector
luhan2017 Dec 9, 2019
3a76056
Merge branch 'wenyluo/csConnector' of https://github.com/microsoft/Bo…
VanyLaw Dec 9, 2019
95da7fc
Merge remote-tracking branch 'origin/master' into wenyluo/csConnector
VanyLaw Dec 9, 2019
07b0120
Merge branch 'master' into wenyluo/csConnector
luhan2017 Dec 9, 2019
a02ee26
Merge remote-tracking branch 'origin/master' into wenyluo/csConnector
VanyLaw Dec 10, 2019
5aebd48
change docker file
VanyLaw Dec 10, 2019
af79c2c
remove annotation
VanyLaw Dec 10, 2019
2985023
fix docker
VanyLaw Dec 11, 2019
0d98187
Merge remote-tracking branch 'origin/master' into wenyluo/csConnector
VanyLaw Dec 11, 2019
019f623
simpler dockerfile
VanyLaw Dec 12, 2019
c7ae546
Merge remote-tracking branch 'origin/master' into wenyluo/csConnector
VanyLaw Dec 12, 2019
32ac161
Merge branch 'master' into wenyluo/csConnector
VanyLaw Dec 13, 2019
c05ec0d
fix dockerfile bug and port mapping
VanyLaw Dec 13, 2019
7a7a2cb
add bash script for unix, and remove pwsh from docker
VanyLaw Dec 17, 2019
e3c2de8
Merge remote-tracking branch 'origin/master' into wenyluo/csConnector
VanyLaw Dec 17, 2019
0b0bca9
Merge remote-tracking branch 'origin/master' into wenyluo/csConnector
VanyLaw Dec 18, 2019
4e1bfb5
fix typo and some comments
VanyLaw Dec 19, 2019
1090b93
split dockerfile into two
VanyLaw Dec 19, 2019
0bf8040
Merge remote-tracking branch 'origin/master' into wenyluo/csConnector
VanyLaw Dec 20, 2019
861d57e
Merge remote-tracking branch 'origin/master' into wenyluo/csConnector
VanyLaw Dec 20, 2019
a791621
use nultistage instead of two dockerfile
VanyLaw Dec 20, 2019
6a09761
Merge remote-tracking branch 'origin/master' into wenyluo/csConnector
VanyLaw Dec 27, 2019
3f7d035
Merge remote-tracking branch 'origin/master' into wenyluo/csConnector
VanyLaw Dec 30, 2019
9b9e139
Merge branch 'master' into wenyluo/csConnector
cwhitten Jan 6, 2020
243f9c8
Merge remote-tracking branch 'origin/master' into wenyluo/csConnector
VanyLaw Jan 7, 2020
803fe7a
update yarn lock
VanyLaw Jan 7, 2020
20036eb
Merge remote-tracking branch 'origin/master' into wenyluo/csConnector
VanyLaw Jan 7, 2020
d4be796
Merge branch 'master' into wenyluo/csConnector
cwhitten Jan 8, 2020
551c4a2
Merge branch 'master' into wenyluo/csConnector
cwhitten Jan 8, 2020
6ce7143
add more debug logs
a-b-r-o-w-n Jan 8, 2020
429886e
fix settings file mis-created in server folder
VanyLaw Jan 9, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions BotProject/Templates/CSharp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Licensed under the MIT License.

using System;
using System.Diagnostics;
using System.IO;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
Expand All @@ -24,12 +26,19 @@ public static IWebHost BuildWebHost(string[] args) =>
config
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true)
.AddJsonFile($"ComposerDialogs/settings/appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"luis.settings.{env.EnvironmentName}.{luisAuthoringRegion}.json", optional: true, reloadOnChange: true)
.AddJsonFile($"luis.settings.{Environment.UserName}.{luisAuthoringRegion}.json", optional: true, reloadOnChange: true);

if (env.IsDevelopment())
try
{
foreach (string filePath in Directory.GetFiles($"ComposerDialogs", "generated/luis.settings.*.json"))
{
config.AddJsonFile(filePath, optional: true, reloadOnChange: true);
}
}
catch (Exception ex)
{
config.AddUserSecrets<Startup>();
Trace.WriteLine(ex.Message);
}

config
Expand Down
2 changes: 1 addition & 1 deletion Composer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"build:client": "yarn workspace @bfc/client build",
"build:tools": "yarn workspace @bfc/tools build:all",
"start": "cross-env NODE_ENV=production PORT=3000 yarn start:server",
"startall": "node scripts/update.js && concurrently --kill-others-on-fail \"npm:runtime\" \"npm:start\"",
"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",
Expand Down
1 change: 1 addition & 0 deletions Composer/packages/client/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export enum ActionTypes {
SET_CREATION_FLOW_STATUS = 'SET_CREATION_FLOW_STATUS',
SET_DESIGN_PAGE_LOCATION = 'SET_DESIGN_PAGE_LOCATION',
CONNECT_BOT_SUCCESS = 'CONNECT_BOT_SUCCESS',
CONNECT_BOT_FAILURE = 'CONNECT_BOT_FAILURE',
RELOAD_BOT_SUCCESS = 'RELOAD_BOT_SUCCESS',
SYNC_ENV_SETTING = 'SYNC_ENV_SETTING',
GET_ENV_SETTING = 'GET_ENV_SETTING',
Expand Down
10 changes: 8 additions & 2 deletions Composer/packages/client/src/store/action/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const connectBot: ActionCreator = async (store, settings) => {

try {
const res = await httpClient.get(path);
await reloadBot(store, settings);
store.dispatch({
type: ActionTypes.CONNECT_BOT_SUCCESS,
payload: {
Expand All @@ -21,10 +22,15 @@ export const connectBot: ActionCreator = async (store, settings) => {
},
});
} catch (err) {
store.dispatch({
type: ActionTypes.CONNECT_BOT_FAILURE,
payload: {
status: 'unConnected',
},
});
console.error(err.response.data.message);
VanyLaw marked this conversation as resolved.
Show resolved Hide resolved
throw new Error(err.response.data.message);
}

await reloadBot(store, settings);
};

// return only the connect URL -- do not reload
Expand Down
7 changes: 5 additions & 2 deletions Composer/packages/client/src/store/action/setting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.

import get from 'lodash/get';
import has from 'lodash/has';
import { SensitiveProperties } from '@bfc/shared';

import { ActionCreator, DialogSetting } from '../types';
Expand All @@ -27,8 +28,10 @@ export const setSettings: ActionCreator = async (
});
// set value in local storage
for (const property of SensitiveProperties) {
const propertyValue = get(settings, property);
settingsStorage.setField(botName, property, propertyValue ? propertyValue : '');
if (has(settings, property)) {
const propertyValue = get(settings, property, '');
settingsStorage.setField(botName, property, propertyValue);
}
}
// set value to server
const suffix = slot ? `/${slot}` : '';
Expand Down
1 change: 1 addition & 0 deletions Composer/packages/client/src/store/reducer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ export const reducer = createReducer({
[ActionTypes.REMOVE_LU_FAILURE]: noOp,
[ActionTypes.PUBLISH_LU_SUCCCESS]: updateLuTemplate,
[ActionTypes.CONNECT_BOT_SUCCESS]: setBotStatus,
[ActionTypes.CONNECT_BOT_FAILURE]: setBotStatus,
[ActionTypes.RELOAD_BOT_SUCCESS]: setBotLoadErrorMsg,
// [ActionTypes.RELOAD_BOT_FAILURE]: setBotLoadErrorMsg,
[ActionTypes.SET_ERROR]: setError,
Expand Down
6 changes: 4 additions & 2 deletions Composer/packages/server/src/controllers/connector.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import merge from 'lodash/merge';

import { BotEnvironments } from '../models/connector';
import { EnvironmentProvider } from '../models/environment';
Expand All @@ -13,7 +14,7 @@ async function connect(req: any, res: any) {
res.send({ botEndpoint });
} catch (error) {
res.status(400).json({
message: 'cannot connect to a bot runtime, make sure you start the bot runtime',
message: error.message || 'cannot connect to a bot runtime, make sure you start the bot runtime',
});
}
}
Expand All @@ -33,7 +34,8 @@ async function getPublishHistory(req: any, res: any) {
async function sync(req: any, res: any) {
try {
const environment = EnvironmentProvider.getCurrent();
await environment.getBotConnector().sync({ ...req.body, user: req.user });
const settingsInDisk = await environment.getSettingsManager().get('');
await environment.getBotConnector().sync(merge(settingsInDisk, req.body, { user: req.user }));
VanyLaw marked this conversation as resolved.
Show resolved Hide resolved
res.send('OK');
} catch (error) {
res.status(400).json({
Expand Down
Loading