Skip to content
Permalink
Browse files

Fixed LUIS No Models modal issues #1471 (#1484)

* Fixed LUIS No Models modal issues #1471

* Fixed the travis error and updated the changelig file

* Added telemetry routing

* Added tests
  • Loading branch information...
ivanov-dan authored and cwhitten committed May 7, 2019
1 parent 1fae143 commit 6c3d0a473d107e0bfad0ae006ee9a2c2bc5d00b4
@@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [client] Fixed invisible scrollbar styling in log panel in PR [1442](https://github.com/Microsoft/BotFramework-Emulator/pull/1442)
- [main] Fixed issue where opening a livechat or bot via protocol wasn't working because ngrok wasn't being started on startup in PR [1446](https://github.com/Microsoft/BotFramework-Emulator/pull/1446)
- [main / client] Got rid of node Buffer() deprecation warnings in PR [1426](https://github.com/Microsoft/BotFramework-Emulator/pull/1426)
- [client] Fixed LUIS No Models modal issues #1471 in PR [1484](https://github.com/Microsoft/BotFramework-Emulator/pull/1484)

## Removed
- [main] Removed custom user agent string from outgoing requests in PR [1427](https://github.com/Microsoft/BotFramework-Emulator/pull/1427)

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -40,6 +40,7 @@ import { CONNECTED_SERVICES_PANEL_ID } from './explorerActions';
export const OPEN_SERVICE_DEEP_LINK = 'OPEN_SERVICE_DEEP_LINK';
export const OPEN_CONTEXT_MENU_FOR_CONNECTED_SERVICE = 'OPEN_CONTEXT_MENU_FOR_CONNECTED_SERVICE';
export const OPEN_ADD_CONNECTED_SERVICE_CONTEXT_MENU = 'OPEN_ADD_CONNECTED_SERVICE_CONTEXT_MENU';
export const LAUNCH_EXTERNAL_LINK = 'LAUNCH_EXTERNAL_LINK';
export const OPEN_CONNECTED_SERVICE_SORT_CONTEXT_MENU = 'OPEN_CONNECTED_SERVICE_SORT_CONTEXT_MENU';
export const LAUNCH_CONNECTED_SERVICE_EDITOR = 'LAUNCH_CONNECTED_SERVICE_EDITOR';
export const LAUNCH_CONNECTED_SERVICE_PICKER = 'LAUNCH_CONNECTED_SERVICE_PICKER';
@@ -115,6 +116,13 @@ export function openAddServiceContextMenu(
};
}

export function launchExternalLink(payload: ConnectedServicePayload): ConnectedServiceAction<ConnectedServicePayload> {
return {
type: LAUNCH_EXTERNAL_LINK,
payload,
};
}

export function openSortContextMenu(): ConnectedServiceAction<ConnectedServicePayload> {
return {
type: OPEN_CONNECTED_SERVICE_SORT_CONTEXT_MENU,
@@ -53,13 +53,16 @@ import {
ConnectedServicePickerPayload,
launchConnectedServicePicker,
openAddServiceContextMenu,
launchExternalLink,
openContextMenuForConnectedService,
openServiceDeepLink,
} from '../action/connectedServiceActions';
import { azureAuth } from '../reducer/azureAuthReducer';
import { bot } from '../reducer/bot';

import { servicesExplorerSagas } from './servicesExplorerSagas';
import { launchExternalLink as launchExternalLinkSaga, servicesExplorerSagas } from './servicesExplorerSagas';

import { call } from 'redux-saga/effects';

const sagaMiddleWare = sagaMiddlewareFactory();
const mockStore = createStore(combineReducers({ azureAuth, bot }), {}, applyMiddleware(sagaMiddleWare));
@@ -110,6 +113,12 @@ jest.mock('./azureAuthSaga', () => ({
},
}));

jest.mock('../../platform/commands/commandServiceImpl', () => ({
CommandServiceImpl: {
remoteCall: () => Promise.resolve(true),
},
}));

CommandServiceImpl.remoteCall = async function(type: string) {
switch (type) {
case SharedConstants.Commands.ConnectedService.GetConnectedServicesByType:
@@ -397,6 +406,96 @@ describe('The ServiceExplorerSagas', () => {
});
});

describe(' launchExternalLink', () => {
let action: ConnectedServiceAction<ConnectedServicePayload>;
let openConnectedServiceGen;
let sagaIt;

it(' should open a LIUS external link', async () => {
const payload = {
azureAuthWorkflowComponents: {
loginFailedDialog: AzureLoginFailedDialogContainer,
loginSuccessDialog: AzureLoginSuccessDialogContainer,
promptDialog: ConnectServicePromptDialogContainer,
},
getStartedDialog: GetStartedWithCSDialogContainer,
editorComponent: ConnectedServiceEditorContainer,
pickerComponent: ConnectedServicePickerContainer,
serviceType: ServiceTypes.Luis,
};

action = launchExternalLink(payload as any);
sagaIt = launchExternalLinkSaga;

const it = sagaIt(action);
const result = it.next().value;

expect(result).toEqual(
call(
[CommandServiceImpl, CommandServiceImpl.remoteCall],
SharedConstants.Commands.Electron.OpenExternal,
'https://luis.ai'
)
);
});

it(' should open a Dispatch external link', () => {
const payload = {
azureAuthWorkflowComponents: {
loginFailedDialog: AzureLoginFailedDialogContainer,
loginSuccessDialog: AzureLoginSuccessDialogContainer,
promptDialog: ConnectServicePromptDialogContainer,
},
getStartedDialog: GetStartedWithCSDialogContainer,
editorComponent: ConnectedServiceEditorContainer,
pickerComponent: ConnectedServicePickerContainer,
serviceType: ServiceTypes.Dispatch,
};

action = launchExternalLink(payload as any);
sagaIt = launchExternalLinkSaga;

const it = sagaIt(action);
const result = it.next().value;

expect(result).toEqual(
call(
[CommandServiceImpl, CommandServiceImpl.remoteCall],
SharedConstants.Commands.Electron.OpenExternal,
'https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-tutorial-dispatch?view=azure-bot-service-4.0&tabs=csharp'
)
);
});

it(' should open a Dispatch external link', () => {
const payload = {
azureAuthWorkflowComponents: {
loginFailedDialog: AzureLoginFailedDialogContainer,
loginSuccessDialog: AzureLoginSuccessDialogContainer,
promptDialog: ConnectServicePromptDialogContainer,
},
getStartedDialog: GetStartedWithCSDialogContainer,
editorComponent: ConnectedServiceEditorContainer,
pickerComponent: ConnectedServicePickerContainer,
serviceType: ServiceTypes.QnA,
};

action = launchExternalLink(payload as any);
sagaIt = launchExternalLinkSaga;

const it = sagaIt(action);
const result = it.next().value;

expect(result).toEqual(
call(
[CommandServiceImpl, CommandServiceImpl.remoteCall],
SharedConstants.Commands.Electron.OpenExternal,
'https://www.qnamaker.ai/'
)
);
});
});

describe(' openAddConnectedServiceContextMenu', () => {
let action: ConnectedServiceAction<ConnectedServicePickerPayload>;
let contextMenuGen;
@@ -42,7 +42,7 @@ import {
IQnAService,
ServiceTypes,
} from 'botframework-config/lib/schema';
import { ForkEffect, put, select, takeEvery, takeLatest } from 'redux-saga/effects';
import { call, ForkEffect, put, select, takeEvery, takeLatest } from 'redux-saga/effects';

import { CommandServiceImpl } from '../../platform/commands/commandServiceImpl';
import { DialogService } from '../../ui/dialogs/service';
@@ -58,6 +58,7 @@ import {
OPEN_CONNECTED_SERVICE_SORT_CONTEXT_MENU,
OPEN_CONTEXT_MENU_FOR_CONNECTED_SERVICE,
OPEN_SERVICE_DEEP_LINK,
LAUNCH_EXTERNAL_LINK,
} from '../action/connectedServiceActions';
import { sortExplorerContents } from '../action/explorerActions';
import { SortCriteria } from '../reducer/explorer';
@@ -124,7 +125,7 @@ function* launchConnectedServicePicker(
});
// Sign up with XXXX
if (result === 1) {
// TODO - launch an external link
yield* launchExternalLink(action);
}
// Add services manually
if (result === 2) {
@@ -209,6 +210,38 @@ function* openConnectedServiceDeepLink(action: ConnectedServiceAction<ConnectedS
}
}

export function* launchExternalLink(action: ConnectedServiceAction<ConnectedServicePayload>): IterableIterator<any> {
const serviceType = action.payload.serviceType;
switch (serviceType) {
case ServiceTypes.QnA:
yield call(
[CommandServiceImpl, CommandServiceImpl.remoteCall],
SharedConstants.Commands.Electron.OpenExternal,
'https://www.qnamaker.ai/'
);
break;

case ServiceTypes.Dispatch:
yield call(
[CommandServiceImpl, CommandServiceImpl.remoteCall],
SharedConstants.Commands.Electron.OpenExternal,
'https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-tutorial-dispatch?view=azure-bot-service-4.0&tabs=csharp'
);
break;

case ServiceTypes.Luis:
yield call(
[CommandServiceImpl, CommandServiceImpl.remoteCall],
SharedConstants.Commands.Electron.OpenExternal,
'https://luis.ai'
);
break;

default:
return;
}
}

function* openContextMenuForService(action: ConnectedServiceAction<ConnectedServicePayload>): IterableIterator<any> {
const menuItems = [
{ label: 'Manage service', id: 'open' },
@@ -359,6 +392,7 @@ function openQnaMakerDeepLink(service: IQnAService) {
export function* servicesExplorerSagas(): IterableIterator<ForkEffect> {
yield takeLatest(LAUNCH_CONNECTED_SERVICE_PICKER, launchConnectedServicePicker);
yield takeLatest(LAUNCH_CONNECTED_SERVICE_EDITOR, launchConnectedServiceEditor);
yield takeEvery(LAUNCH_EXTERNAL_LINK, launchExternalLink);
yield takeEvery(OPEN_SERVICE_DEEP_LINK, openConnectedServiceDeepLink);
yield takeEvery(OPEN_CONTEXT_MENU_FOR_CONNECTED_SERVICE, openContextMenuForService);
yield takeEvery(OPEN_ADD_CONNECTED_SERVICE_CONTEXT_MENU, openAddConnectedServiceContextMenu);
Oops, something went wrong.

0 comments on commit 6c3d0a4

Please sign in to comment.
You can’t perform that action at this time.