Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
6f359b4
plumb through the option to select azure functions scaffolding
benbrown Feb 23, 2021
03ec8dd
Merge branch 'main' into benbrown/5556
benbrown Feb 23, 2021
fde5302
update test
benbrown Feb 23, 2021
febef76
fix some tests
benbrown Feb 23, 2021
c356f9b
Merge branch 'benbrown/5556' of https://github.com/microsoft/BotFrame…
benbrown Feb 23, 2021
ea7883c
Merge branch 'main' into benbrown/5556
benbrown Feb 23, 2021
5a6c347
Merge branch 'main' into benbrown/5556
a-b-r-o-w-n Feb 25, 2021
abece77
Merge branch 'main' of https://github.com/microsoft/BotFramework-Comp…
benbrown Feb 25, 2021
74199bf
Merge branch 'main' into benbrown/5556
pavolumMsft Mar 8, 2021
5edac76
Removing unused var
pavolumMsft Mar 8, 2021
7a421e1
Merging latest and handling conflicts
pavolumMsft Mar 15, 2021
c961da4
adding back package json precommit declaration
pavolumMsft Mar 15, 2021
ec6f41e
fixing errors that happened in merge
pavolumMsft Mar 15, 2021
6f4f160
fix import statement
pavolumMsft Mar 15, 2021
ca886f4
Merge branch 'main' into benbrown/5556
pavolum Mar 15, 2021
5fbef0a
js support
benbrown Mar 15, 2021
b355df2
fix: revert yeoman-environment to 2.10.3 from 3.1.0
benbrown Mar 15, 2021
591fd2c
Merge branch 'benbrown/fixinstall' into benbrown/jsruntime
benbrown Mar 15, 2021
994adec
initial commit of js runtime support with some draft URLs
benbrown Mar 16, 2021
6072b04
fis: change feature flag text
pavolumMsft Mar 17, 2021
8bea9c3
Merge branch 'main' of https://github.com/microsoft/BotFramework-Comp…
pavolumMsft Mar 17, 2021
e52aaeb
Merge branch 'main' into benbrown/5556
pavolum Mar 17, 2021
6e63cd6
mostly working js publish
benbrown Mar 17, 2021
3826e03
- Passing runtime choice down to generator
pavolumMsft Mar 17, 2021
703e468
Merge branch 'main' into benbrown/5556
pavolumMsft Mar 17, 2021
e53fe6b
Merge branch 'main' into benbrown/jsruntime
pavolumMsft Mar 17, 2021
979391a
Handling merge conflicts
pavolumMsft Mar 17, 2021
cade97c
Passing of runtime type and language to generators from UI implemented
pavolumMsft Mar 17, 2021
49c09f2
Adding testing dropdown to more easily test templates
pavolumMsft Mar 18, 2021
7004c1f
removing npm build as it is unneeded for js generators
pavolumMsft Mar 18, 2021
1a3a000
removing unneeeded code for npm build on buildDeploy
pavolumMsft Mar 18, 2021
910541f
Adding runtime template for dotnet functions and node functions
pavolumMsft Mar 18, 2021
3415723
Merge branch 'main' into benbrown/5556
pavolum Mar 22, 2021
e59a932
Adding needed fields to botTemplate obj
pavolumMsft Mar 23, 2021
f41903b
Fixing keyword parsing and rendering logic for templates
pavolumMsft Mar 24, 2021
9901c02
Removing runtime language dropdown from UI
pavolumMsft Mar 24, 2021
74e15da
adding logic for correct template specific runtime types as available…
pavolumMsft Mar 24, 2021
ba0578a
- Removing unused options code
pavolumMsft Mar 24, 2021
748e040
Enhancing template search query
pavolumMsft Mar 24, 2021
3617bd6
remove unneeded console logs
pavolumMsft Mar 24, 2021
b15c632
Resolving merge conflicts
pavolumMsft Mar 24, 2021
d2b131c
Fixing errors after merge
pavolumMsft Mar 24, 2021
e6d9b58
cleanup some text, remove unneeded fields
benbrown Mar 25, 2021
48bb108
Merge branch 'main' into benbrown/5556
benbrown Mar 25, 2021
ea72406
Merge branch 'main' into benbrown/5556
benbrown Mar 26, 2021
4c093dc
update feed
benbrown Mar 29, 2021
7e1b2af
Merge branch 'main' of https://github.com/microsoft/BotFramework-Comp…
benbrown Mar 30, 2021
4e1e2de
Merge branch 'main' of https://github.com/microsoft/BotFramework-Comp…
benbrown Mar 31, 2021
59a34f6
fix issue where required items were included twice
benbrown Mar 31, 2021
b91de87
remove comment
benbrown Mar 31, 2021
d93e098
Merge branch 'main' of https://github.com/microsoft/BotFramework-Comp…
benbrown Mar 31, 2021
8aae5c1
Merge branch 'main' into benbrown/5556
benbrown Mar 31, 2021
c582229
update and cleanup
benbrown Mar 31, 2021
87dcc1c
Merge branch 'benbrown/5556' of https://github.com/microsoft/BotFrame…
benbrown Mar 31, 2021
72b37a6
Merge branch 'main' of https://github.com/microsoft/BotFramework-Comp…
benbrown Mar 31, 2021
6787614
update variable
benbrown Mar 31, 2021
50a1ac6
fix dismiss of handoff
benbrown Apr 1, 2021
3ea4f21
Merge branch 'main' into benbrown/5556
benbrown Apr 1, 2021
118d978
Merge branch 'benbrown/5556' of https://github.com/microsoft/BotFrame…
benbrown Apr 1, 2021
74a052d
fix tests, update package manager bf-dialgo to latest dev
benbrown Apr 1, 2021
f931ae6
fix tests, adjust labels
benbrown Apr 1, 2021
b68ac9c
remove feature flag
benbrown Apr 1, 2021
c19bc79
fix tests
benbrown Apr 1, 2021
0123346
remove unused elements
benbrown Apr 1, 2021
0ec9040
restore support for legacy runtimes
benbrown Apr 1, 2021
144a838
Adding mocked dipsatch function to fix broken UT
pavolumMsft Apr 2, 2021
e0d7371
Fixing unit test
pavolumMsft Apr 2, 2021
c0d6372
Resolving merge conflicts
pavolumMsft Apr 2, 2021
ec3b761
Making PR changes.
pavolumMsft Apr 2, 2021
13d5c6b
Fixing include statements
pavolumMsft Apr 2, 2021
d8705e4
Fixing default naming
pavolumMsft Apr 2, 2021
4fd0a2d
Fixing home page integration test
pavolumMsft Apr 2, 2021
ce9ee5c
Fixing creation UT
pavolumMsft Apr 2, 2021
6c5a3b7
Updating to latest
pavolumMsft Apr 2, 2021
f3a76c0
Removing old creation integration test
pavolumMsft Apr 2, 2021
8f518fd
Adding integration test for new bot creation
pavolumMsft Apr 3, 2021
1a80b15
Fixing navigateUrl integration test
pavolumMsft Apr 3, 2021
c87bb25
Merging latest
pavolumMsft Apr 3, 2021
a0e384c
Changing names
pavolumMsft Apr 3, 2021
96b8457
Removing unused dep
pavolumMsft Apr 3, 2021
310ebfd
Fixing dependency
pavolumMsft Apr 3, 2021
8b291b0
increasing wait time for creation integration test
pavolumMsft Apr 3, 2021
bae93f2
Testin CI failures with different wait times
pavolumMsft Apr 3, 2021
50c5d99
Update azure-pipelines.yml for Azure Pipelines
srinaath Apr 5, 2021
71fcc78
Indent update
srinaath Apr 5, 2021
125b081
Change to 3.1.x
srinaath Apr 5, 2021
d03c7e4
Merge branch 'benbrown/5556' of https://github.com/microsoft/BotFrame…
pavolumMsft Apr 5, 2021
ae0f831
Merge branch 'main' into benbrown/5556
pavolum Apr 5, 2021
741ccf5
Merge branch 'benbrown/5556' of https://github.com/microsoft/BotFrame…
pavolumMsft Apr 5, 2021
800ea57
Temp removal of expando to get error from CI machine
pavolumMsft Apr 5, 2021
1b8292c
Merge branch 'main' into benbrown/5556
beyackle Apr 5, 2021
9fcc549
testing name change
pavolumMsft Apr 5, 2021
9225486
Merge branch 'benbrown/5556' of https://github.com/microsoft/BotFrame…
pavolumMsft Apr 5, 2021
3abdb22
Getting more error info in modal for testing
pavolumMsft Apr 5, 2021
9433fe0
fix bad merge
benbrown Apr 5, 2021
d592145
Merge branch 'benbrown/5556' of https://github.com/microsoft/BotFrame…
benbrown Apr 5, 2021
3d29dc2
Merge branch 'main' into benbrown/5556
pavolum Apr 5, 2021
f64e147
Update azure-pipelines.yml for Azure Pipelines
pavolum Apr 5, 2021
1cdf213
Update azure-pipelines.yml for Azure Pipelines
pavolum Apr 5, 2021
2e4b2a1
Update azure-pipelines.yml for Azure Pipelines
pavolum Apr 5, 2021
c2efd6e
Update azure-pipelines.yml for Azure Pipelines
pavolum Apr 5, 2021
3e6a291
Update azure-pipelines.yml for Azure Pipelines
pavolum Apr 5, 2021
b63a1bd
Update azure-pipelines.yml for Azure Pipelines
pavolum Apr 5, 2021
4841927
Finalizing dotnet install and nuget feed config step in pipeline
pavolum Apr 5, 2021
d73170e
Reverting error modal testing changes
pavolumMsft Apr 5, 2021
a0fca55
Merge branch 'benbrown/5556' of https://github.com/microsoft/BotFrame…
pavolumMsft Apr 5, 2021
f2d56dc
Merge branch 'main' into benbrown/5556
benbrown Apr 5, 2021
fac810f
Merge branch 'main' into benbrown/5556
benbrown Apr 5, 2021
c70c8e1
Removing FF check
pavolumMsft Apr 5, 2021
1d43ef8
Removing unused import
pavolumMsft Apr 6, 2021
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
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"NODE_ENV": "development",
"DEBUG": "composer*",
"COMPOSER_DEV_TOOLS": "true",
"COMPOSER_ENABLE_ONEAUTH": "false"
"COMPOSER_ENABLE_ONEAUTH": "true"
},
"outputCapture": "std",
"preLaunchTask": "electron: build",
Expand Down
24 changes: 7 additions & 17 deletions Composer/cypress/integration/CreateNewBot.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,15 @@ context('Creating a new bot', () => {
});

it('can create a new bot', () => {
cy.findByTestId('Create from scratch').click();
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(3000);
cy.findByTestId('@microsoft/generator-bot-empty').click();
cy.findByTestId('NextStepButton').click();
cy.enterTextAndSubmit('NewDialogName', '__TestNewProject', 'SubmitNewBotBtn');
cy.enterTextAndSubmit('NewDialogName', 'TestNewProject3', 'SubmitNewBotBtn');
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(150000);
cy.findByTestId('ProjectTree').within(() => {
cy.findAllByText('__TestNewProject').should('exist');
});
});

it('can create a bot from the ToDo template', () => {
cy.findByTestId('Create from template').click();
cy.findByTestId('TodoSample').click({ force: true });
cy.findByTestId('NextStepButton').click();
cy.enterTextAndSubmit('NewDialogName', '__TestNewProject2', 'SubmitNewBotBtn');
cy.findByTestId('ProjectTree').within(() => {
cy.findAllByText('__TestNewProject2').should('exist');
cy.findByText('addtodo').should('exist');
cy.findByText('cleartodos').should('exist');
cy.findByText('deletetodo').should('exist');
cy.findByText('showtodos').should('exist');
cy.findAllByText('TestNewProject3').should('exist');
});
});
});
2 changes: 0 additions & 2 deletions Composer/cypress/integration/HomePage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ context('Home Page ', () => {
it('can open buttons in home page', () => {
cy.findByTestId('LeftNav-CommandBarButtonHome').click();
cy.findByTestId('homePage-Toolbar-New').click();
cy.findByText('Create bot from template or scratch?').should('exist');
cy.findByText('Cancel').should('exist');
cy.findByText('Cancel').click();
cy.findByTestId('homePage-Toolbar-Open').click();
cy.findByText('Select a Bot').should('exist');
cy.findByText('Cancel').should('exist');
cy.findByText('Cancel').click();
cy.findByTestId('homePage-body-New').click();
cy.findByText('Create bot from template or scratch?').should('exist');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ context('Navigate Url', () => {
cy.visit('/home');
});

it('should open Create From Scratch/Template window from a url', () => {
it('should open Select Template window from a url', () => {
cy.visit('/projects/create');
cy.get('[data-testid="Create from scratch"]').should('be.visible');
cy.get('[data-testid="Create from template"]').should('be.visible');
cy.findAllByTestId('dotnetFeed').should('exist');
});

it('should open Define Conversations window from a url', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ describe('<CreationFlow/>', () => {
onboardingAddCoachMarkRef: jest.fn(),
fetchRecentProjects: jest.fn(),
fetchTemplates: jest.fn(),
fetchTemplatesV2: jest.fn(),
setCreationFlowStatus: jest.fn(),
navTo: jest.fn(),
saveTemplateId: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ describe('<CreateOptionsV2/>', () => {
id: 'generator-conversational-core',
index: 0,
name: 'conversational-core',
dotnetSupport: { webAppSupported: true, functionsSupported: true },
nodeSupport: { webAppSupported: true, functionsSupported: true },
package: {
packageName: 'generator-conversational-core',
packageSource: 'npm',
Expand All @@ -44,10 +46,10 @@ describe('<CreateOptionsV2/>', () => {

it('should save conversational core template id', async () => {
const component = renderComponent();
const conversationalCoreBot = await component.findByText('conversational-core');
const conversationalCoreBot = await component.findByTestId('generator-conversational-core');
fireEvent.click(conversationalCoreBot);
const nextButton = await component.findByText('Next');
fireEvent.click(nextButton);
expect(handleCreateNextMock).toBeCalledWith('generator-conversational-core');
expect(handleCreateNextMock).toBeCalledWith('generator-conversational-core', 'dotnet');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ describe('<CreationFlowV2/>', () => {
onboardingAddCoachMarkRef: jest.fn(),
fetchRecentProjects: jest.fn(),
fetchTemplates: jest.fn(),
fetchTemplatesV2: jest.fn(),
setCreationFlowStatus: jest.fn(),
navTo: jest.fn(),
saveTemplateId: jest.fn(),
Expand Down Expand Up @@ -71,7 +72,7 @@ describe('<CreationFlowV2/>', () => {
</RecoilRoot>
);

navigate('create/generator-conversational-core');
navigate('create/dotnet/generator-conversational-core');
const node = await findByText('OK');

act(() => {
Expand All @@ -94,8 +95,13 @@ describe('<CreationFlowV2/>', () => {
eTag: undefined,
preserveRoot: undefined,
qnqKbUrls: undefined,
runtimeType: 'webapp',
templateDir: undefined,
urlSuffix: undefined,
profile: undefined,
qnaKbUrls: undefined,
runtimeLanguage: 'dotnet',
source: undefined,
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ import { DialogFooter } from 'office-ui-fabric-react/lib/Dialog';
import { BotTemplate } from '@bfc/shared';
import { DialogWrapper, DialogTypes } from '@bfc/ui-shared';
import { RouteComponentProps, navigate } from '@reach/router';
import { useRecoilValue } from 'recoil';
import querystring from 'query-string';
import axios from 'axios';

import { DialogCreationCopy } from '../../constants';
import { featureFlagsState } from '../../recoilModel';
import { getAliasFromPayload } from '../../utils/electronUtil';

import { CreateBot } from './CreateBot';
Expand All @@ -34,11 +32,8 @@ export function CreateOptions(props: CreateOptionsProps) {
const [option, setOption] = useState('Create');
const [isOpenCreateModal, setIsOpenCreateModal] = useState(false);
const { templates, onDismiss, onNext, onJumpToOpenModal } = props;
const featureFlags = useRecoilValue(featureFlagsState);
useEffect(() => {
if (featureFlags.NEW_CREATION_FLOW?.enabled) {
navigate(`/v2/projects/create${props?.location?.search}`);
}
navigate(`/v2/projects/create${props?.location?.search}`);
});

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,15 @@ import Path from 'path';
import React, { useEffect, useRef, Fragment } from 'react';
import { RouteComponentProps, Router, navigate } from '@reach/router';
import { useRecoilValue } from 'recoil';
import { csharpFeedKey } from '@bfc/shared';

import { CreationFlowStatus, feedDictionary } from '../../constants';
import { CreationFlowStatus, firstPartyTemplateFeed } from '../../constants';
import {
dispatcherState,
creationFlowStatusState,
storagesState,
focusedStorageFolderState,
currentProjectIdState,
userSettingsState,
featureFlagsState,
templateProjectsState,
} from '../../recoilModel';
import Home from '../../pages/home/Home';
Expand All @@ -33,7 +31,6 @@ type CreationFlowProps = RouteComponentProps<{}>;

const CreationFlow: React.FC<CreationFlowProps> = (props: CreationFlowProps) => {
const {
fetchTemplates,
fetchTemplatesV2,
fetchRecentProjects,
fetchStorages,
Expand All @@ -51,7 +48,6 @@ const CreationFlow: React.FC<CreationFlowProps> = (props: CreationFlowProps) =>
} = useRecoilValue(dispatcherState);

const templateProjects = useRecoilValue(templateProjectsState);
const featureFlags = useRecoilValue(featureFlagsState);
const creationFlowStatus = useRecoilValue(creationFlowStatusState);
const projectId = useRecoilValue(currentProjectIdState);
const storages = useRecoilValue(storagesState);
Expand All @@ -78,7 +74,7 @@ const CreationFlow: React.FC<CreationFlowProps> = (props: CreationFlowProps) =>
}
await fetchStorages();
fetchRecentProjects();
featureFlags.NEW_CREATION_FLOW?.enabled ? fetchTemplatesV2([feedDictionary[csharpFeedKey]]) : fetchTemplates();
fetchTemplatesV2([firstPartyTemplateFeed]);
};

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
/** @jsx jsx */
import { jsx, css } from '@emotion/core';
import { useState, Fragment, useEffect, useMemo } from 'react';
import find from 'lodash/find';
import formatMessage from 'format-message';
import { PrimaryButton, DefaultButton } from 'office-ui-fabric-react/lib/Button';
import { DialogFooter } from 'office-ui-fabric-react/lib/Dialog';
Expand All @@ -17,18 +16,18 @@ import {
CheckboxVisibility,
DetailsRow,
} from 'office-ui-fabric-react/lib/DetailsList';
import { BotTemplate, QnABotTemplateId } from '@bfc/shared';
import { BotTemplate } from '@bfc/shared';
import { DialogWrapper, DialogTypes, LoadingSpinner } from '@bfc/ui-shared';
import { NeutralColors } from '@uifabric/fluent-theme';
import { WindowLocation } from '@reach/router';
import { IPivotItemProps, Pivot, PivotItem } from 'office-ui-fabric-react/lib/Pivot';
import { Link } from 'office-ui-fabric-react/lib/Link';
import { FontIcon } from 'office-ui-fabric-react/lib/Icon';
import { csharpFeedKey } from '@botframework-composer/types';
import { csharpFeedKey, nodeFeedKey } from '@botframework-composer/types';
import { useRecoilState, useRecoilValue } from 'recoil';

import msftIcon from '../../../images/msftIcon.svg';
import { DialogCreationCopy, feedDictionary } from '../../../constants';
import { DialogCreationCopy } from '../../../constants';
import { creationFlowTypeState, fetchReadMePendingState, selectedTemplateReadMeState } from '../../../recoilModel';
import TelemetryClient from '../../../telemetry/TelemetryClient';

Expand Down Expand Up @@ -112,15 +111,13 @@ const optionKeys = {
const templateRequestUrl =
'https://github.com/microsoft/botframework-components/issues/new?assignees=&labels=needs-triage%2C+feature-request&template=-net-sdk-feature-request.md&title=[NewTemplateRequest]';

const defaultTemplateId = '@microsoft/generator-microsoft-bot-empty';

// -------------------- CreateOptions -------------------- //
type CreateBotProps = {
isOpen: boolean;
templates: BotTemplate[];
location?: WindowLocation | undefined;
onDismiss: () => void;
onNext: (templateName: string, urlData?: string) => void;
onNext: (templateName: string, templateLanguage: string, urlData?: string) => void;
fetchTemplates: (feedUrls?: string[]) => Promise<void>;
fetchReadMe: (moduleName: string) => {};
};
Expand All @@ -129,9 +126,11 @@ export function CreateBotV2(props: CreateBotProps) {
const [option] = useState(optionKeys.createFromTemplate);
const [disabled] = useState(false);
const { isOpen, templates, onDismiss, onNext } = props;
const [currentTemplateId, setCurrentTemplateId] = useState(defaultTemplateId);
const [emptyBotKey, setEmptyBotKey] = useState('');
const [selectedFeed, setSelectedFeed] = useState<{ props: IPivotItemProps }>({ props: { itemKey: csharpFeedKey } });
const [currentTemplateId, setCurrentTemplateId] = useState('');
const [selectedProgLang, setSelectedProgLang] = useState<{ props: IPivotItemProps }>({
props: { itemKey: csharpFeedKey },
});
const [displayedTemplates, setDisplayedTemplates] = useState<BotTemplate[]>([]);
const [readMe] = useRecoilState(selectedTemplateReadMeState);
const fetchReadMePending = useRecoilValue(fetchReadMePendingState);
const creationFlowType = useRecoilValue(creationFlowTypeState);
Expand All @@ -140,6 +139,7 @@ export function CreateBotV2(props: CreateBotProps) {
return new Selection({
onSelectionChanged: () => {
const t = selectedTemplate.getSelection()[0] as BotTemplate;

if (t) {
setCurrentTemplateId(t.id);
}
Expand All @@ -148,21 +148,13 @@ export function CreateBotV2(props: CreateBotProps) {
}, []);

const handleJumpToNext = () => {
let routeToTemplate = emptyBotKey;
if (option === optionKeys.createFromTemplate) {
routeToTemplate = currentTemplateId;
}

if (option === optionKeys.createFromQnA) {
routeToTemplate = QnABotTemplateId;
}

TelemetryClient.track('CreateNewBotProjectNextButton', { template: routeToTemplate });
TelemetryClient.track('CreateNewBotProjectNextButton', { template: currentTemplateId });
const runtimeLanguage = selectedProgLang?.props?.itemKey ?? csharpFeedKey;

if (location?.search) {
onNext(routeToTemplate, location.search);
onNext(currentTemplateId, runtimeLanguage, location.search);
} else {
onNext(routeToTemplate);
onNext(currentTemplateId, runtimeLanguage);
}
};

Expand Down Expand Up @@ -200,27 +192,32 @@ export function CreateBotV2(props: CreateBotProps) {
};

const getTemplate = (): BotTemplate | undefined => {
const currentTemplate = templates.find((t) => {
return t.id === currentTemplateId;
const currentTemplate = displayedTemplates.find((t) => {
return t?.id === currentTemplateId;
});
return currentTemplate;
};

useEffect(() => {
if (templates.length > 1) {
const emptyBotTemplate = find(templates, ['id', defaultTemplateId]);
if (emptyBotTemplate) {
setCurrentTemplateId(emptyBotTemplate.id);
setEmptyBotKey(emptyBotTemplate.id);
}
const itemKey = selectedProgLang.props.itemKey;
if (itemKey === csharpFeedKey) {
const newTemplates = templates.filter((template) => {
return template.dotnetSupport;
});
setDisplayedTemplates(newTemplates);
} else if (itemKey === nodeFeedKey) {
const newTemplates = templates.filter((template) => {
return template.nodeSupport;
});
setDisplayedTemplates(newTemplates);
}
}, [templates]);
}, [templates, selectedProgLang]);

useEffect(() => {
if (selectedFeed?.props?.itemKey) {
props.fetchTemplates([feedDictionary[selectedFeed.props.itemKey]]);
if (displayedTemplates?.[0]?.id) {
setCurrentTemplateId(displayedTemplates[0].id);
}
}, [selectedFeed]);
}, [displayedTemplates]);

useEffect(() => {
if (currentTemplateId) {
Expand All @@ -238,11 +235,12 @@ export function CreateBotV2(props: CreateBotProps) {
defaultSelectedKey={csharpFeedKey}
onLinkClick={(item) => {
if (item) {
setSelectedFeed(item);
setSelectedProgLang(item);
}
}}
>
<PivotItem headerText="C#" itemKey={csharpFeedKey}></PivotItem>
<PivotItem data-testid="dotnetFeed" headerText="C#" itemKey={csharpFeedKey}></PivotItem>
<PivotItem data-testid="nodeFeed" headerText="Node" itemKey={nodeFeedKey}></PivotItem>
</Pivot>
<div css={pickerContainer}>
<div css={detailListContainer} data-is-scrollable="true" id="templatePickerContainer">
Expand All @@ -256,7 +254,7 @@ export function CreateBotV2(props: CreateBotProps) {
compact={false}
getKey={(item) => item.name}
isHeaderVisible={false}
items={templates}
items={displayedTemplates}
layoutMode={DetailsListLayoutMode.justified}
selection={selectedTemplate}
selectionMode={disabled ? SelectionMode.none : SelectionMode.single}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { CreateBotV2 } from './CreateBot';
type CreateOptionsProps = {
templates: BotTemplate[];
onDismiss: () => void;
onNext: (data: string) => void;
onNext: (templateName: string, templateLanguage: string, urlData?: string) => void;
onJumpToOpenModal: (search?: string) => void;
fetchTemplates: (feedUrls?: string[]) => Promise<void>;
fetchReadMe: (moduleName: string) => {};
Expand Down
Loading