Skip to content

Commit

Permalink
Added help document for getting started with debugging via channels
Browse files Browse the repository at this point in the history
  • Loading branch information
justinwilaby committed Apr 25, 2019
1 parent 0fa3c83 commit fdd9670
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,40 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license.
//
// Microsoft Bot Framework: http://botframework.com
//
// Bot Framework Emulator Github:
// https://github.com/Microsoft/BotFramwork-Emulator
//
// Copyright (c) Microsoft Corporation
// All rights reserved.
//
// MIT License:
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
import { mount, ReactWrapper } from 'enzyme';
import { WelcomePage } from '../welcomePage/welcomePage';
import * as React from 'react';

import { WelcomePage } from '../welcomePage/welcomePage';

import { MarkdownPage, MarkdownPageProps } from './markdownPage';

describe('The Markdown page', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { Component } from 'react';
import MarkdownIt from 'markdown-it';

import { GenericDocument } from '../../layout';

import * as styles from './markdownPage.scss';

export interface MarkdownPageProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function mapStateToProps(state: RootState, ownProps: WelcomePageProps): WelcomeP
}

function mapDispatchToProps(dispatch: (action: Action) => void): WelcomePageProps {
const { Commands } = SharedConstants;
const { Commands, Channels } = SharedConstants;
return {
onNewBotClick: () => {
CommandServiceImpl.call(Commands.UI.ShowBotCreationDialog).catch();
Expand All @@ -67,11 +67,7 @@ function mapDispatchToProps(dispatch: (action: Action) => void): WelcomePageProp
},
switchToBot: (path: string) => CommandServiceImpl.call(Commands.Bot.Switch, path),
openBotInspectorDocs: () =>
CommandServiceImpl.call(
Commands.UI.ShowMarkdownPage,
'https://raw.githubusercontent.com/Microsoft/BotFramework-Emulator/master/content/CHANNELS.md',
'Bot Inspector Help'
),
CommandServiceImpl.call(Commands.UI.ShowMarkdownPage, Channels.ReadmeUrl, Channels.HelpLabel),
};
}

Expand Down
2 changes: 1 addition & 1 deletion packages/app/main/src/appMenuBuilder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ describe('AppMenuBuilder', () => {
expect(sendActivityMenu).toHaveLength(7);

const helpMenuTemplate = appMenuTemplate[4].submenu;
expect(helpMenuTemplate).toHaveLength(13);
expect(helpMenuTemplate).toHaveLength(14);

expect(mockSetApplicationMenu).toHaveBeenCalledWith('I am a menu');
});
Expand Down
9 changes: 7 additions & 2 deletions packages/app/main/src/appMenuBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,14 +458,14 @@ export class AppMenuBuilder {
private static async initHelpMenu(): Promise<MenuOpts> {
const appName = Electron.app.getName();
const version = Electron.app.getVersion();

const { Commands, Channels } = SharedConstants;
// TODO - localization
return {
role: 'help',
submenu: [
{
label: 'Welcome',
click: () => mainWindow.commandService.remoteCall(SharedConstants.Commands.UI.ShowWelcomePage),
click: () => mainWindow.commandService.remoteCall(Commands.UI.ShowWelcomePage),
},
{ type: 'separator' },
{
Expand Down Expand Up @@ -520,6 +520,11 @@ export class AppMenuBuilder {
visible: AppUpdater.status === UpdateStatus.Idle || AppUpdater.status === UpdateStatus.UpdateAvailable,
},
{ type: 'separator' },
{
label: Channels.HelpLabel,
click: () =>
mainWindow.commandService.remoteCall(Commands.UI.ShowMarkdownPage, Channels.ReadmeUrl, Channels.HelpLabel),
},
{
label: 'About',
click: () =>
Expand Down
4 changes: 4 additions & 0 deletions packages/app/shared/src/constants/sharedConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,8 @@ export const SharedConstants = {
ContentTypes: {
CONTENT_TYPE_LIVE_CHAT: 'application/vnd.microsoft.bfemulator.document.livechat',
},
Channels: {
ReadmeUrl: 'https://raw.githubusercontent.com/Microsoft/BotFramework-Emulator/master/content/CHANNELS.md',
HelpLabel: 'Get started with channels',
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
//

import * as React from 'react';
import { HTMLAttributes } from 'react';

import { TruncateText } from '../../layout';

import * as styles from './mediumHeader.scss';
import { HTMLAttributes } from 'react';

export interface MediumHeaderProps extends HTMLAttributes<HTMLHeadingElement> {
className?: string;
Expand Down

0 comments on commit fdd9670

Please sign in to comment.