Skip to content

Commit

Permalink
Merge branch 'main' into beyackle/botProjBreadcrumbs
Browse files Browse the repository at this point in the history
  • Loading branch information
cwhitten authored Nov 5, 2020
2 parents e315fa6 + c2844c8 commit 448617a
Show file tree
Hide file tree
Showing 28 changed files with 56 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ import React, { useState, useEffect } from 'react';
import { FieldProps, useShellApi, MicrosoftIDialog } from '@bfc/extension-client';
import { RegexRecognizer } from '@bfc/shared';

import { useFormData } from '../../hooks';

import { StringField } from './StringField';

function getRegexIntentPattern(formData: MicrosoftIDialog, intent: string): string {
const recognizer = formData.recognizer as RegexRecognizer;
function getRegexIntentPattern(dialogContent: MicrosoftIDialog, intent: string): string {
const recognizer = dialogContent.recognizer as RegexRecognizer;
let pattern = '';

if (!recognizer) {
Expand All @@ -28,15 +26,14 @@ function getRegexIntentPattern(formData: MicrosoftIDialog, intent: string): stri

const RegexIntentField: React.FC<FieldProps> = ({ value: intentName, ...rest }) => {
const { currentDialog, shellApi } = useShellApi();
const formData = useFormData();
const [localValue, setLocalValue] = useState(getRegexIntentPattern(formData, intentName));
const [localValue, setLocalValue] = useState(getRegexIntentPattern(currentDialog?.content, intentName));

// if the intent name changes or intent names in the regex patterns
// we need to reset the local value
useEffect(() => {
const pattern = getRegexIntentPattern(formData, intentName);
const pattern = getRegexIntentPattern(currentDialog?.content, intentName);
setLocalValue(pattern);
}, [intentName, (formData.recognizer as RegexRecognizer)?.intents.map((i) => i.intent)]);
}, [intentName, currentDialog?.content]);

const handleIntentChange = (pattern?: string) => {
setLocalValue(pattern ?? '');
Expand Down
15 changes: 14 additions & 1 deletion Composer/packages/client/src/utils/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ import find from 'lodash/find';
import { useRecoilValue } from 'recoil';
import { FeatureFlagKey } from '@bfc/shared';

import { designPageLocationState, currentProjectIdState, pluginPagesSelector, featureFlagsState } from '../recoilModel';
import {
designPageLocationState,
currentProjectIdState,
pluginPagesSelector,
featureFlagsState,
rootBotProjectIdSelector,
} from '../recoilModel';

import { bottomLinks, topLinks } from './pageLinks';
import routerCache from './routerCache';
Expand Down Expand Up @@ -50,10 +56,17 @@ export const useLinks = () => {
};

export const useRouterCache = (to: string) => {
const rootProjectId = useRecoilValue(rootBotProjectIdSelector);
const [state, setState] = useState(routerCache.getAll());
const { topLinks, bottomLinks } = useLinks();
const linksRef = useRef(topLinks.concat(bottomLinks));
linksRef.current = topLinks.concat(bottomLinks);

useEffect(() => {
routerCache.cleanAll();
setState({});
}, [rootProjectId]);

useEffect(() => {
globalHistory.listen(({ location }) => {
const links = linksRef.current;
Expand Down
5 changes: 5 additions & 0 deletions Composer/packages/client/src/utils/routerCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ class RouterCache {
this._all[linkTo] = uri;
this.storage.set(KEY, this._all);
}

cleanAll() {
this._all = {};
this.storage.set(KEY, this._all);
}
}

export default new RouterCache();
2 changes: 1 addition & 1 deletion Composer/packages/server/schemas/sdk.cs.schema
Original file line number Diff line number Diff line change
Expand Up @@ -4348,7 +4348,7 @@
}
},
"Microsoft.UpdateActivity": {
"title": "Send an activity",
"title": "Update an activity",
"description": "Respond with an activity.",
"patternProperties": {
"^\\$": {
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/server/schemas/sdk.de.schema
Original file line number Diff line number Diff line change
Expand Up @@ -4348,7 +4348,7 @@
}
},
"Microsoft.UpdateActivity": {
"title": "Send an activity",
"title": "Update an activity",
"description": "Respond with an activity.",
"patternProperties": {
"^\\$": {
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/server/schemas/sdk.en-US.schema
Original file line number Diff line number Diff line change
Expand Up @@ -4348,7 +4348,7 @@
}
},
"Microsoft.UpdateActivity": {
"title": "Send an activity",
"title": "Update an activity",
"description": "Respond with an activity.",
"patternProperties": {
"^\\$": {
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/server/schemas/sdk.es.schema
Original file line number Diff line number Diff line change
Expand Up @@ -4348,7 +4348,7 @@
}
},
"Microsoft.UpdateActivity": {
"title": "Send an activity",
"title": "Update an activity",
"description": "Respond with an activity.",
"patternProperties": {
"^\\$": {
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/server/schemas/sdk.fr.schema
Original file line number Diff line number Diff line change
Expand Up @@ -4348,7 +4348,7 @@
}
},
"Microsoft.UpdateActivity": {
"title": "Send an activity",
"title": "Update an activity",
"description": "Respond with an activity.",
"patternProperties": {
"^\\$": {
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/server/schemas/sdk.hu.schema
Original file line number Diff line number Diff line change
Expand Up @@ -4348,7 +4348,7 @@
}
},
"Microsoft.UpdateActivity": {
"title": "Send an activity",
"title": "Update an activity",
"description": "Respond with an activity.",
"patternProperties": {
"^\\$": {
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/server/schemas/sdk.it.schema
Original file line number Diff line number Diff line change
Expand Up @@ -4348,7 +4348,7 @@
}
},
"Microsoft.UpdateActivity": {
"title": "Send an activity",
"title": "Update an activity",
"description": "Respond with an activity.",
"patternProperties": {
"^\\$": {
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/server/schemas/sdk.ja.schema
Original file line number Diff line number Diff line change
Expand Up @@ -4348,7 +4348,7 @@
}
},
"Microsoft.UpdateActivity": {
"title": "Send an activity",
"title": "Update an activity",
"description": "Respond with an activity.",
"patternProperties": {
"^\\$": {
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/server/schemas/sdk.ko.schema
Original file line number Diff line number Diff line change
Expand Up @@ -4348,7 +4348,7 @@
}
},
"Microsoft.UpdateActivity": {
"title": "Send an activity",
"title": "Update an activity",
"description": "Respond with an activity.",
"patternProperties": {
"^\\$": {
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/server/schemas/sdk.nl.schema
Original file line number Diff line number Diff line change
Expand Up @@ -4348,7 +4348,7 @@
}
},
"Microsoft.UpdateActivity": {
"title": "Send an activity",
"title": "Update an activity",
"description": "Respond with an activity.",
"patternProperties": {
"^\\$": {
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/server/schemas/sdk.pl.schema
Original file line number Diff line number Diff line change
Expand Up @@ -4348,7 +4348,7 @@
}
},
"Microsoft.UpdateActivity": {
"title": "Wyślij działanie",
"title": "Zmodernizować działanie",
"description": "Reaguj działaniem.",
"patternProperties": {
"^\\$": {
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/server/schemas/sdk.pt-BR.schema
Original file line number Diff line number Diff line change
Expand Up @@ -4348,7 +4348,7 @@
}
},
"Microsoft.UpdateActivity": {
"title": "Send an activity",
"title": "Update an activity",
"description": "Respond with an activity.",
"patternProperties": {
"^\\$": {
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/server/schemas/sdk.pt-PT.schema
Original file line number Diff line number Diff line change
Expand Up @@ -4348,7 +4348,7 @@
}
},
"Microsoft.UpdateActivity": {
"title": "Send an activity",
"title": "Update an activity",
"description": "Respond with an activity.",
"patternProperties": {
"^\\$": {
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/server/schemas/sdk.ru.schema
Original file line number Diff line number Diff line change
Expand Up @@ -4348,7 +4348,7 @@
}
},
"Microsoft.UpdateActivity": {
"title": "Send an activity",
"title": "Update an activity",
"description": "Respond with an activity.",
"patternProperties": {
"^\\$": {
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/server/schemas/sdk.schema
Original file line number Diff line number Diff line change
Expand Up @@ -8420,7 +8420,7 @@
},
"Microsoft.UpdateActivity": {
"$role": "implements(Microsoft.IDialog)",
"title": "Send an activity",
"title": "Update an activity",
"description": "Respond with an activity.",
"type": "object",
"$package": {
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/server/schemas/sdk.sv.schema
Original file line number Diff line number Diff line change
Expand Up @@ -4348,7 +4348,7 @@
}
},
"Microsoft.UpdateActivity": {
"title": "Skicka en aktivitet",
"title": "Uppdatera en aktivitet",
"description": "Svara med en aktivitet.",
"patternProperties": {
"^\\$": {
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/server/schemas/sdk.tr.schema
Original file line number Diff line number Diff line change
Expand Up @@ -4348,7 +4348,7 @@
}
},
"Microsoft.UpdateActivity": {
"title": "Send an activity",
"title": "Update an activity",
"description": "Respond with an activity.",
"patternProperties": {
"^\\$": {
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/server/schemas/sdk.zh-Hans.schema
Original file line number Diff line number Diff line change
Expand Up @@ -4348,7 +4348,7 @@
}
},
"Microsoft.UpdateActivity": {
"title": "Send an activity",
"title": "Update an activity",
"description": "Respond with an activity.",
"patternProperties": {
"^\\$": {
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/server/schemas/sdk.zh-Hant.schema
Original file line number Diff line number Diff line change
Expand Up @@ -4348,7 +4348,7 @@
}
},
"Microsoft.UpdateActivity": {
"title": "Send an activity",
"title": "Update an activity",
"description": "Respond with an activity.",
"patternProperties": {
"^\\$": {
Expand Down
1 change: 1 addition & 0 deletions Composer/packages/server/src/models/bot/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ export class Builder {
suffix: config.suffix,
keptVersionCount: 10,
isStaging: false,
region: config.region,
});

await this.luBuilder.writeDialogAssets(buildResult, {
Expand Down
2 changes: 2 additions & 0 deletions extensions/localPublish/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ class LocalPublisher implements PublishPlugin<PublishConfig> {
'azurewebapp'
);
} else if (project.settings.runtime.path && project.settings.runtime.command) {
const runtimePath = path.isAbsolute(project.settings.runtime.path)? project.settings.runtime.path: path.resolve(project.dataDir, project.settings.runtime.path);
await runtime.build(runtimePath, project);
await runtime.setSkillManifest(
project.settings.runtime.path,
project.fileStorage,
Expand Down
16 changes: 4 additions & 12 deletions extensions/runtimes/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,14 @@ export default async (composer: any): Promise<void> => {
// install dev dependencies in production, make sure typescript is installed
const { stderr: installErr } = await execAsync('npm install && npm install --only=dev', {
cwd: runtimePath,
timeout: 120000,
});
if (installErr) {
// in order to not throw warning, we just log all warning and error message
composer.log(installErr);
composer.log(`npm install timeout, ${installErr}`);
}

// runtime build need typescript
const { stderr: install2Err } = await execAsync('npm run build', {
cwd: runtimePath,
});
Expand Down Expand Up @@ -220,17 +223,6 @@ export default async (composer: any): Promise<void> => {
// used to read bot project template from source (bundled in plugin)
const excludeFolder = new Set<string>().add(path.resolve(sourcePath, 'node_modules'));
await copyDir(sourcePath, localDisk, destPath, project.fileStorage, excludeFolder);
// install dev dependencies in production, make sure typescript is installed
const { stderr: initErr } = await execAsync('npm install && npm install --only=dev', {
cwd: destPath,
});
if (initErr) {
composer.log(initErr);
}
const { stderr: initErr2 } = await execAsync('npm run build', { cwd: destPath });
if (initErr2) {
throw new Error(initErr2);
}
return destPath;
} else {
throw new Error(`Runtime already exists at ${destPath}`);
Expand Down
8 changes: 4 additions & 4 deletions extensions/samples/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ const boilerplates = getBoilerplates();

export default async (composer: any): Promise<void> => {
// register this publishing method with Composer
for (const temlate of samples) {
await composer.addBotTemplate(temlate);
for (const template of samples) {
await composer.addBotTemplate(template);
}

for (const temlate of boilerplates) {
await composer.addBaseTemplate(temlate);
for (const template of boilerplates) {
await composer.addBaseTemplate(template);
}
};
2 changes: 1 addition & 1 deletion runtime/dotnet/azurewebapp/Schemas/sdk.schema
Original file line number Diff line number Diff line change
Expand Up @@ -9542,7 +9542,7 @@
},
"Microsoft.UpdateActivity": {
"$role": "implements(Microsoft.IDialog)",
"title": "Send an activity",
"title": "Update an activity",
"description": "Respond with an activity.",
"type": "object",
"$package": {
Expand Down
2 changes: 1 addition & 1 deletion runtime/dotnet/azurewebapp/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
using Microsoft.Bot.Connector.Authentication;
using Microsoft.BotFramework.Composer.Core;
using Microsoft.BotFramework.Composer.Core.Settings;
using Microsoft.BotFramework.Composer.WebAppTemplates.Authorization;

//using Microsoft.BotFramework.Composer.CustomAction;
using Microsoft.BotFramework.Composer.WebAppTemplates.Authorization;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

Expand Down

0 comments on commit 448617a

Please sign in to comment.