Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ interface AddBotModalProps {
onDismiss: () => void;
}

const addExistingKey = 'existing';
const addBlankKey = 'blank';
const addExistingBotKey = 'existing';
const addNewBotKey = 'new';

const addSkillOptions: IChoiceGroupOption[] = [
{ key: addExistingKey, text: 'Add an existing bot' },
{ key: addBlankKey, text: 'Create a new blank bot' },
const getAddSkillOptions = (): IChoiceGroupOption[] => [
{ key: addNewBotKey, text: formatMessage('Create a new bot') },
{ key: addExistingBotKey, text: formatMessage('Add an existing bot') },
];

export const AddBotModal: React.FC<AddBotModalProps> = (props) => {
const { setCreationFlowStatus } = useRecoilValue(dispatcherState);
const [addBotType, setAddBotType] = useState(addExistingKey);
const [addBotType, setAddBotType] = useState(addNewBotKey);

const handleChange = (ev?, option?: IChoiceGroupOption): void => {
if (option) {
Expand All @@ -35,10 +35,10 @@ export const AddBotModal: React.FC<AddBotModalProps> = (props) => {
};

const handleSubmit = () => {
if (addBotType === addExistingKey) {
if (addBotType === addExistingBotKey) {
setCreationFlowStatus(CreationFlowStatus.OPEN);
} else {
setCreationFlowStatus(CreationFlowStatus.NEW_FROM_TEMPLATE);
setCreationFlowStatus(CreationFlowStatus.NEW);
}
};

Expand All @@ -50,7 +50,7 @@ export const AddBotModal: React.FC<AddBotModalProps> = (props) => {
title={formatMessage('Add a bot')}
onDismiss={props.onDismiss}
>
<ChoiceGroup required defaultSelectedKey={addExistingKey} options={addSkillOptions} onChange={handleChange} />
<ChoiceGroup required defaultSelectedKey={addNewBotKey} options={getAddSkillOptions()} onChange={handleChange} />
<DialogFooter>
<DefaultButton text={formatMessage('Cancel')} onClick={props.onDismiss} />
<PrimaryButton data-testid="NextStepButton" text={formatMessage('Next')} onClick={handleSubmit} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,22 @@ export function CreateBotV2(props: CreateBotProps) {

useEffect(() => {
const itemKey = selectedProgLang.props.itemKey;
let newTemplates: BotTemplate[] = [];
if (itemKey === csharpFeedKey) {
const newTemplates = templates.filter((template) => {
newTemplates = templates.filter((template) => {
return template.dotnetSupport;
});
setDisplayedTemplates(newTemplates);
} else if (itemKey === nodeFeedKey) {
const newTemplates = templates.filter((template) => {
newTemplates = templates.filter((template) => {
return template.nodeSupport;
});
setDisplayedTemplates(newTemplates);
}
if (creationFlowType === 'Skill') {
Comment thread
pavolum marked this conversation as resolved.
newTemplates = newTemplates.filter((template) => {
return !template.isMultiBotTemplate;
Comment thread
pavolum marked this conversation as resolved.
});
}
setDisplayedTemplates(newTemplates);
Comment thread
pavolum marked this conversation as resolved.
}, [templates, selectedProgLang]);

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ describe('assetManager', () => {
id: 'generator-conversational-core',
name: 'Conversational Core',
description: 'Preview conversational core package for TESTING ONLY',
isMultiBotTemplate: false,
package: {
packageName: 'generator-conversational-core',
packageSource: 'npm',
Expand Down
1 change: 1 addition & 0 deletions Composer/packages/server/src/models/asset/assetManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ export class AssetManager {
webAppSupported: keywords.includes('bf-js-webapp'),
};
}
templateToReturn.isMultiBotTemplate = keywords.includes('msbot-multibot-project');
}
return templateToReturn;
});
Expand Down
1 change: 1 addition & 0 deletions Composer/packages/types/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export type BotTemplate = {
id: string;
name: string;
description: string;
isMultiBotTemplate?: boolean;
Comment thread
pavolum marked this conversation as resolved.
nodeSupport?: EnvSupport;
dotnetSupport?: EnvSupport;
/* absolute path */
Expand Down