Skip to content

Commit

Permalink
Merge branch 'main' into qika/skill
Browse files Browse the repository at this point in the history
* main:
  fix: make composer support https proxy (#6766)
  Force refresh of fluent List via slice (#6810)
  fix: Telemetry for Orchestrator R13 (#6689)
  fix: Fixed broken tenant ID on save (#6809)
  feat: Add devops and app insights to get started (#6790)
  fix: check for node on app start on users machine and notify if not installed (#6578)
  feat: Expose default search query, pre-release flag and type for each feed. (#6781)
  fix: do not provision an endpoint key (#6791)
  remove folder if project fails to create (#6793)
  Removed preview from publish type names (#6795)
  fix: Fixing deep link for QNA and Luis (#6743)
  Make LUIS, QNA and Speech blocking modals so they cannot be dismiessed while active (#6788)
  Added workerRuntime value (#6784)
  fix: apply publishing profile to new runtime during publish (#6719)
  fix: during publish, do not copy project into a build folder (#6729)
  chore: Adapters: copy the 'type' passed in the adapter config to fully support adapter schemas (#6697)
  • Loading branch information
alanlong9278 committed Apr 9, 2021
2 parents daa9e71 + 0d7aac5 commit cbeeeee
Show file tree
Hide file tree
Showing 51 changed files with 893 additions and 381 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ const mockSchemas = {
description: 'Route',
default: 'mockRoute',
},
type: {
type: 'string',
title: 'Type',
description: 'Fully qualified type for the adapter',
default: 'Adapter.Full.Type.Mock',
},
},
},
},
Expand All @@ -47,6 +53,7 @@ const mockSchemas = {
subtitle: 'Connect to Fake Chat Client',
helpLink: 'https://example.com/',
order: ['route', 'exampleName'],
hidden: ['type'],
},
},
},
Expand Down Expand Up @@ -129,20 +136,29 @@ describe('ExternalAdapterSettings', () => {
name: 'Adapter.Mock',
route: 'mockRoute',
enabled: true,
type: 'Adapter.Full.Type.Mock',
},
],
},
'Adapter.Mock': { exampleName: 'test text 12345', route: 'mockRoute', $kind: 'Adapter.Mock' },
'Adapter.Mock': {
exampleName: 'test text 12345',
route: 'mockRoute',
$kind: 'Adapter.Mock',
type: 'Adapter.Full.Type.Mock',
},
});
});

it('disables an adapter', async () => {
const initStateWithAdapter = {
runtimeSettings: { adapters: [{ name: 'Adapter.Mock', enabled: true, route: 'mock' }] },
runtimeSettings: {
adapters: [{ name: 'Adapter.Mock', enabled: true, route: 'mock', type: 'Adapter.Full.Type.Mock' }],
},
'Adapter.Mock': {
exampleName: 'example',
route: 'mock',
$kind: 'Adapter.Mock',
type: 'Adapter.Full.Type.Mock',
},
};

Expand All @@ -161,17 +177,22 @@ describe('ExternalAdapterSettings', () => {
expect(setSettingsMock).toHaveBeenLastCalledWith(
PROJECT_ID,
expect.objectContaining({
runtimeSettings: { adapters: [{ name: 'Adapter.Mock', enabled: false, route: 'mock' }] },
runtimeSettings: {
adapters: [{ name: 'Adapter.Mock', enabled: false, route: 'mock', type: 'Adapter.Full.Type.Mock' }],
},
})
);
});

it('enables an adapter', async () => {
const initStateWithAdapter = {
runtimeSettings: { adapters: [{ name: 'Adapter.Mock', enabled: false, route: 'mock' }] },
runtimeSettings: {
adapters: [{ name: 'Adapter.Mock', enabled: false, route: 'mock', type: 'Adapter.Full.Type.Mock' }],
},
'Adapter.Mock': {
exampleName: 'example',
route: 'mock',
type: 'Adapter.Full.Type.Mock',
},
};

Expand All @@ -190,7 +211,9 @@ describe('ExternalAdapterSettings', () => {
expect(setSettingsMock).toHaveBeenLastCalledWith(
PROJECT_ID,
expect.objectContaining({
runtimeSettings: { adapters: [{ name: 'Adapter.Mock', enabled: true, route: 'mock' }] },
runtimeSettings: {
adapters: [{ name: 'Adapter.Mock', enabled: true, route: 'mock', type: 'Adapter.Full.Type.Mock' }],
},
})
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jest.mock('../../../src/utils/auth', () => ({

const state = {
projectId: 'test',
publishTypes: [{ name: 'azurePublish', description: 'Publish bot to Azure (Preview)' }],
publishTypes: [{ name: 'azurePublish', description: 'Publish bot to Azure' }],
};

describe('Publish Target', () => {
Expand All @@ -31,7 +31,7 @@ describe('Publish Target', () => {
setPublishTargets: setPublishTargetsMock,
getPublishTargetTypes: () => {},
});
set(publishTypesState(state.projectId), [{ name: 'azurePublish', description: 'Publish bot to Azure (Preview)' }]);
set(publishTypesState(state.projectId), [{ name: 'azurePublish', description: 'Publish bot to Azure' }]);
};
it('should add new publish profile', () => {
const { getByTestId, getByText } = renderWithRecoilAndCustomDispatchers(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,23 +92,6 @@ describe('Root Bot External Service', () => {
subscriptionKey: '',
},
});
const textFieldEndpoint = getByTestId('rootLUISEndpointKey');
await act(async () => {
await fireEvent.change(textFieldEndpoint, {
target: { value: 'myRootLUISEndpointKey' },
});
await fireEvent.blur(textFieldEndpoint);
});
expect(setSettingsMock).toBeCalledWith('test', {
luis: {
authoringKey: '',
authoringRegion: '',
endpointKey: 'myRootLUISEndpointKey',
},
qna: {
subscriptionKey: '',
},
});
const regionDropdown = getByTestId('rootLUISRegion');
await act(async () => {
await fireEvent.focus(regionDropdown);
Expand Down
4 changes: 3 additions & 1 deletion Composer/packages/client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ const Logger = () => {

export const App: React.FC = () => {
const { appLocale } = useRecoilValue(userSettingsState);
const { fetchExtensions, fetchFeatureFlags } = useRecoilValue(dispatcherState);

const { fetchExtensions, fetchFeatureFlags, checkNodeVersion } = useRecoilValue(dispatcherState);

useEffect(() => {
loadLocale(appLocale);
}, [appLocale]);

useEffect(() => {
checkNodeVersion();
fetchExtensions();
fetchFeatureFlags();
}, []);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ import { DialogWrapper, DialogTypes } from '@bfc/ui-shared';
import { navigate, RouteComponentProps } from '@reach/router';
import querystring from 'query-string';
import axios from 'axios';
import { useRecoilValue } from 'recoil';

import { DialogCreationCopy } from '../../../constants';
import { getAliasFromPayload } from '../../../utils/electronUtil';
import { getAliasFromPayload, isElectron } from '../../../utils/electronUtil';
import { userHasNodeInstalledState } from '../../../recoilModel';

import { CreateBotV2 } from './CreateBot';
import { NodeModal } from './NodeModal';

// -------------------- CreateOptions -------------------- //
type CreateOptionsProps = {
Expand All @@ -36,6 +39,8 @@ export function CreateOptionsV2(props: CreateOptionsProps) {
const [option, setOption] = useState('Create');
const [isOpenCreateModal, setIsOpenCreateModal] = useState(false);
const { templates, onDismiss, onNext, onJumpToOpenModal, fetchTemplates, fetchReadMe } = props;
const [showNodeModal, setShowNodeModal] = useState(false);
const userHasNode = useRecoilValue(userHasNodeInstalledState);

useEffect(() => {
// open bot directly if alias exist.
Expand Down Expand Up @@ -100,6 +105,12 @@ export function CreateOptionsV2(props: CreateOptionsProps) {
}
};

useEffect(() => {
if (!userHasNode) {
setShowNodeModal(true);
}
}, [userHasNode]);

return (
<Fragment>
<DialogWrapper
Expand All @@ -124,6 +135,7 @@ export function CreateOptionsV2(props: CreateOptionsProps) {
onDismiss={onDismiss}
onNext={onNext}
/>
{isElectron() && showNodeModal && <NodeModal isOpen={showNodeModal} setIsOpen={setShowNodeModal} />}
</Fragment>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/* eslint-disable react/no-danger */
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

/** @jsx jsx */
import { DialogTypes, DialogWrapper } from '@bfc/ui-shared/lib/components/DialogWrapper';
import { jsx } from '@emotion/core';
import formatMessage from 'format-message';
import { DefaultButton, PrimaryButton } from 'office-ui-fabric-react/lib/components/Button';
import { DialogFooter } from 'office-ui-fabric-react/lib/components/Dialog';
import React from 'react';
import { Text } from 'office-ui-fabric-react/lib/Text';
import { mergeStyles } from 'office-ui-fabric-react/lib/Styling';

const dialogFooterClass = mergeStyles({
marginTop: '25px',
});

type NodeModalProps = {
setIsOpen: Function;
isOpen: boolean;
};

export const NodeModal: React.FC<NodeModalProps> = (props) => {
return (
<DialogWrapper
dialogType={DialogTypes.DesignFlow}
isOpen={props.isOpen}
title="Node.js required"
onDismiss={() => {
props.setIsOpen(false);
}}
>
<Text>
{formatMessage(
'Bot Framework Composer requires Node.js in order to create and run a new bot. Click “Install Node.js” to install the latest version'
)}
</Text>
<DialogFooter className={dialogFooterClass}>
<PrimaryButton
data-testid="InstallNode"
href="https://nodejs.org/en/download/"
target="_blank"
text={formatMessage('Install Node.js')}
/>
<DefaultButton
text={formatMessage('Cancel')}
onClick={() => {
props.setIsOpen(false);
}}
/>
</DialogFooter>
</DialogWrapper>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ export const GetStartedNextSteps: React.FC<GetStartedProps> = (props) => {

const openLink = (link) => {
TelemetryClient.track('GettingStartedLinkClicked', { method: 'link', url: link });
navigateTo(link);
if (link.startsWith('http')) {
// eslint-disable-next-line security/detect-non-literal-fs-filename
window.open(link, '_blank');
} else {
navigateTo(link);
}
};

const doNextStep = (currentStep) => {
Expand Down Expand Up @@ -93,6 +98,8 @@ export const GetStartedNextSteps: React.FC<GetStartedProps> = (props) => {
const linktoQNASettings = `/bot/${rootBotProjectId}/botProjectsSettings/#qnaKey`;
const linkToLGEditor = `/bot/${rootBotProjectId}/language-generation`;
const linkToLUEditor = `/bot/${rootBotProjectId}/language-understanding`;
const linkToAppInsights = 'http://aka.ms/botinsights';
const linkToDevOps = 'https://aka.ms/bfcomposercicd';

useEffect(() => {
const newNextSteps: NextSteps[] = [];
Expand Down Expand Up @@ -194,6 +201,28 @@ export const GetStartedNextSteps: React.FC<GetStartedProps> = (props) => {
openLink(linkToLUEditor);
},
},
{
key: 'insights',
label: formatMessage('Enable Insights'),
description: formatMessage(
'Collect service-level and conversation-level data to help gauge the performance and efficacy of your bot.'
),
learnMore: '',
checked: false,
onClick: () => {
openLink(linkToAppInsights);
},
},
{
key: 'devops',
label: formatMessage('Publish to Dev Ops'),
description: formatMessage('Learn how to publish to a Dev Ops pipeline using CI / CD.'),
learnMore: '',
checked: false,
onClick: () => {
openLink(linkToDevOps);
},
},
];

if (hasPublishingProfile) {
Expand Down
Loading

0 comments on commit cbeeeee

Please sign in to comment.