Permalink
Browse files

merge conflict fix

  • Loading branch information...
corinagum committed Oct 10, 2018
2 parents 548c3c7 + e1b2455 commit 921019740086f550ac3e2ea66fb6f7a8aa7690ef
View

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

Oops, something went wrong.
@@ -19,3 +19,8 @@
line-height: 16px;
color: var(--notifications-clear-all-btn-color);
}
.no-notifications-msg {
margin: 0;
margin-top: 15px;
}
@@ -1,3 +1,4 @@
// This is a generated file. Changes are likely to result in being overwritten
export const notificationsExplorer: string;
export const clearAllNotificationsBtn: string;
export const noNotificationsMsg: string;
@@ -60,10 +60,13 @@ class NotificationsExplorerComp extends React.Component<NotificationExplorerProp
{ clearAllButton }
<ul className={ styles.notificationsExplorer }>
{
notifications.length ?
notifications.map(n => {
const notification = NotificationManager.get(n);
return <Notification key={ notification.id } notification={ notification } />;
})
:
<p className={ styles.noNotificationsMsg }>No new notifications.</p>
}
</ul>
</>
@@ -138,7 +138,7 @@ export class ServicesExplorer extends ServicePane<ServicesExplorerProps> {
<li
key={ index }
className={ `${ styles.link } ${ toAnimate[service.id] ? styles.animateHighlight : '' } ` }
onClick={ this.onLinkClick }
onDoubleClick={this.onLinkClick}
onKeyPress={ this.onHandleKeyPress }
data-index={ index }
tabIndex={ 0 }>
@@ -65,7 +65,6 @@
"@types/formidable": "^1.0.30",
"@types/fs-extra": "^5.0.4",
"@types/jest": "^22.2.3",
"@types/jsonpath": "^0.2.0",
"@types/mkdirp": "^0.5.2",
"@types/node": "8.9.3",
"@types/request": "^2.47.0",
@@ -126,7 +125,6 @@
"got": "^7.1.0",
"http-status-codes": "^1.3.0",
"jest-fetch-mock": "^1.6.2",
"jsonpath": "^1.0.0",
"jsonwebtoken": "^8.3.0",
"lock": "^0.1.2",
"mkdirp": "^0.5.1",
@@ -36,7 +36,6 @@ import * as Electron from 'electron';
import { mainWindow } from './main';
import { AppUpdater, UpdateStatus } from './appUpdater';
import { BotInfo, SharedConstants } from '@bfemulator/app-shared';
import * as jsonpath from 'jsonpath';
import { ConversationService } from './services/conversationService';
import { getStore as getSettingsStore } from './settingsData/store';
import { rememberTheme } from './settingsData/actions/windowStateActions';
@@ -80,31 +79,7 @@ export const AppMenuBuilder = new class AppMenuBuilderImpl implements AppMenuBui
];
if (process.platform === 'darwin') {
/*
// Create the Application's main menu
var template2: MenuOpts[] = [
{
label: windowTitle,
submenu: [
{ label: "About", click: () => Emulator.send('showExplorer-about') },
{ type: "separator" },
{ label: "Quit", accelerator: "Command+Q", click: () => Electron.app.quit() }
]
}, {
label: "Edit",
submenu: [
{ label: "Undo", accelerator: "CmdOrCtrl+Z", role: "undo" },
{ label: "Redo", accelerator: "Shift+CmdOrCtrl+Z", role: "redo" },
{ type: "separator" },
{ label: "Cut", accelerator: "CmdOrCtrl+X", role: "cut" },
{ label: "Copy", accelerator: "CmdOrCtrl+C", role: "copy" },
{ label: "Paste", accelerator: "CmdOrCtrl+V", role: "paste" },
{ label: "Select All", accelerator: "CmdOrCtrl+A", role: "selectall" }
]
}*/
template.unshift(this.getAppMenuMac());
// Window menu
template.splice(4, 0, {
label: 'Window',
@@ -145,12 +120,12 @@ export const AppMenuBuilder = new class AppMenuBuilderImpl implements AppMenuBui
click: () => {
mainWindow.commandService.remoteCall(Bot.OpenBrowse);
}
}];
} ];
if (recentBots && recentBots.length) {
const recentBotsList = this.createRecentBotsList(recentBots);
subMenu.push({
label: 'Open Recent...',
submenu: [...recentBotsList]
submenu: [ ...recentBotsList ]
});
} else {
subMenu.push({
@@ -250,9 +225,7 @@ export const AppMenuBuilder = new class AppMenuBuilderImpl implements AppMenuBui
{ role: 'cut' },
{ role: 'copy' },
{ role: 'paste' },
{ role: 'delete' },
process.platform === 'win32' ? { type: 'separator' } : null,
{ role: 'selectall' }
{ role: 'delete' }
].filter(item => item) as any[]
};
}
@@ -390,8 +363,8 @@ export const AppMenuBuilder = new class AppMenuBuilderImpl implements AppMenuBui
const getConversationId = async () => {
const state = await getState();
const { editors, activeEditor } = state.editor;
const { activeDocumentId } = editors[activeEditor];
return state.chat.chats[activeDocumentId].conversationId;
const { activeDocumentId } = editors[ activeEditor ];
return state.chat.chats[ activeDocumentId ].conversationId;
};
const getServiceUrl = () => emulator.framework.serverUrl.replace('[::]', 'localhost');
@@ -447,16 +420,17 @@ export const AppMenuBuilder = new class AppMenuBuilderImpl implements AppMenuBui
*/
setFileMenu(fileMenuTemplate: MenuOpts, appMenuTemplate: MenuOpts[]): MenuOpts[] {
if (process.platform === 'darwin') {
appMenuTemplate[1] = fileMenuTemplate;
appMenuTemplate[ 1 ] = fileMenuTemplate;
} else {
appMenuTemplate[0] = fileMenuTemplate;
appMenuTemplate[ 0 ] = fileMenuTemplate;
}
return appMenuTemplate;
}
refreshAppUpdateMenu() {
jsonpath.value(this.menuTemplate,
'$..[?(@.role == "help")].submenu[?(@.id == "auto-update")]', this.getUpdateMenuItem());
const helpMenu = this.menuTemplate.find(menuItem => menuItem.role === 'help');
const autoUpdateMenuItem = (helpMenu.submenu as Array<any>).find(menuItem => menuItem.id === 'auto-update');
Object.assign(autoUpdateMenuItem, this.getUpdateMenuItem());
Electron.Menu.setApplicationMenu(Electron.Menu.buildFromTemplate(this.menuTemplate));
}
};
@@ -38,13 +38,13 @@ import { ExtensionManagerImpl } from '../extensions';
import { Protocol } from '../constants';
import { ProtocolHandler } from '../protocolHandler';
import { getStore } from '../botData/store';
import { getBotsFromDisk, readFileSync } from '../utils';
import * as Path from 'path';
import { getBotsFromDisk } from '../utils';
import { CommandRegistryImpl } from '@bfemulator/sdk-shared';
import { ClientAwareSettings, Settings, SharedConstants } from '@bfemulator/app-shared';
import { Migrator } from '../migrator';
import { getStore as getSettingsStore } from '../settingsData/store';
import { Store } from 'redux';
import { openFileFromCommandLine } from '../utils/openFileFromCommandLine';
/** Registers client initialization commands */
export function registerCommands(commandRegistry: CommandRegistryImpl) {
@@ -97,30 +97,9 @@ export function registerCommands(commandRegistry: CommandRegistryImpl) {
}
// Parse command line args to see if we are opening a .bot or .transcript file
if (args.some(arg => /(\.transcript)|(\.bot)$/.test(arg))) {
const fileToBeOpened = args.find(arg => /(\.transcript)|(\.bot)$/.test(arg));
if (Path.extname(fileToBeOpened) === '.bot') {
try {
const bot = await mainWindow.commandService.call(Commands.Bot.Open, fileToBeOpened);
await mainWindow.commandService.call(Commands.Bot.SetActive, bot);
await mainWindow.commandService.remoteCall(Commands.Bot.Load, bot);
} catch (e) {
throw new Error(`Error while trying to open a .bot file via double click at: ${fileToBeOpened}`);
}
} else if (Path.extname(fileToBeOpened) === '.transcript') {
const transcript = readFileSync(fileToBeOpened);
const conversationActivities = JSON.parse(transcript);
if (!Array.isArray(conversationActivities)) {
throw new Error('Invalid transcript file contents; should be an array of conversation activities.');
}
// open a transcript on the client side and pass in
// some extra info to differentiate it from a transcript on disk
await mainWindow.commandService.remoteCall(Commands.Emulator.OpenTranscript, 'deepLinkedTranscript', {
activities: conversationActivities,
inMemory: true
});
}
const fileToBeOpened = args.find(arg => /(\.transcript)|(\.bot)$/.test(arg));
if (fileToBeOpened) {
await openFileFromCommandLine(fileToBeOpened, mainWindow.commandService);
}
});
}
@@ -57,6 +57,7 @@ import { azureLoggedInUserChanged } from './settingsData/actions/azureAuthAction
import { ngrokEmitter } from './ngrok';
import { sendNotificationToClient } from './utils/sendNotificationToClient';
import Users from '@bfemulator/emulator-core/lib/facility/users';
import { openFileFromCommandLine } from './utils/openFileFromCommandLine';
export let mainWindow: Window;
export let windowManager: WindowManager;
@@ -89,7 +90,7 @@ AppUpdater.on('update-available', (update: UpdateInfo) => {
mainWindow.commandService.call(SharedConstants.Commands.Electron.ShowMessageBox, true, {
title: app.getName(),
message: `An update is available. Download it now?`,
buttons: ['Cancel', 'OK'],
buttons: [ 'Cancel', 'OK' ],
defaultId: 1,
cancelId: 0
}).then(result => {
@@ -107,7 +108,7 @@ AppUpdater.on('update-downloaded', (update: UpdateInfo) => {
mainWindow.commandService.call(SharedConstants.Commands.Electron.ShowMessageBox, true, {
title: app.getName(),
message: 'Finished downloading update. Restart and install now?',
buttons: ['Cancel', 'OK'],
buttons: [ 'Cancel', 'OK' ],
defaultId: 1,
cancelId: 0
}).then(result => {
@@ -202,6 +203,15 @@ Electron.app.on('will-finish-launching', () => {
Electron.app.on('open-url', onOpenUrl);
});
let fileToOpen: string;
Electron.app.on('open-file', async (event: Event, file: string) => {
if (!mainWindow || !mainWindow.commandService) {
fileToOpen = file;
} else {
await openFileFromCommandLine(file, mainWindow.commandService);
}
});
const windowIsOffScreen = function (windowBounds: Electron.Rectangle): boolean {
const nearestDisplay = Electron.screen.getDisplayMatching(windowBounds).workArea;
return (
@@ -372,6 +382,11 @@ const createMainWindow = async () => {
await mainWindow.commandService.call(SharedConstants.Commands.Electron.UpdateFileMenu);
}
}
if (fileToOpen) {
await openFileFromCommandLine(fileToOpen, mainWindow.commandService);
fileToOpen = null;
}
});
mainWindow.browserWindow.on('close', async function (event: Event) {
@@ -387,9 +402,9 @@ const createMainWindow = async () => {
function loadMainPage() {
let queryString = '';
if (process.argv[1] && process.argv[1].indexOf('botemulator') !== -1) {
if (process.argv[ 1 ] && process.argv[ 1 ].indexOf('botemulator') !== -1) {
// add a query string with the botemulator protocol handler content
queryString = '?' + process.argv[1];
queryString = '?' + process.argv[ 1 ];
}
let page = process.env.ELECTRON_TARGET_URL || url.format({
@@ -31,12 +31,12 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
import { Menu, MenuItem, MenuItemConstructorOptions } from 'electron';
import { Menu, MenuItemConstructorOptions } from 'electron';
export class ContextMenuService {
private static currentMenu: Menu;
public static showMenuAndWaitForInput(options: Partial<MenuItemConstructorOptions>[]): Promise<any> {
public static showMenuAndWaitForInput(options: Partial<MenuItemConstructorOptions>[] = []): Promise<any> {
if (ContextMenuService.currentMenu) {
ContextMenuService.currentMenu.closePopup();
}
@@ -53,7 +53,7 @@ export class ContextMenuService {
});
const menu = ContextMenuService.currentMenu = Menu.buildFromTemplate(template);
menu.popup();
menu.popup({});
});
}
}
@@ -0,0 +1,31 @@
import { readFileSync } from './readFileSync';
import { CommandService } from '@bfemulator/sdk-shared';
import * as path from 'path';
import { SharedConstants } from '@bfemulator/app-shared';
export async function openFileFromCommandLine(fileToBeOpened: string, commandService: CommandService): Promise<void> {
const { Bot, Emulator } = SharedConstants.Commands;
if (path.extname(fileToBeOpened) === '.bot') {
try {
const bot = await commandService.call(Bot.Open, fileToBeOpened);
await commandService.call(Bot.SetActive, bot);
await commandService.remoteCall(Bot.Load, bot);
} catch (e) {
throw new Error(`Error while trying to open a .bot file via double click at: ${fileToBeOpened}`);
}
} else if (path.extname(fileToBeOpened) === '.transcript') {
const transcript = readFileSync(fileToBeOpened);
const conversationActivities = JSON.parse(transcript);
if (!Array.isArray(conversationActivities)) {
throw new Error('Invalid transcript file contents; should be an array of conversation activities.');
}
// open a transcript on the client side and pass in
// some extra info to differentiate it from a transcript on disk
await commandService.remoteCall(Emulator.OpenTranscript, 'deepLinkedTranscript', {
activities: conversationActivities,
inMemory: true
});
}
}
@@ -66,19 +66,20 @@ class Editor extends Component<EditorProps, EditorState> {
if (!this.props.recognizerResult || !this.props.recognizerResult.intents) {
return { intent: NoneIntent, score: 0.0 };
}
let intents: { [key: string]: RecognizerResultIntent } = this.props.recognizerResult.intents;
let intents: { [ key: string ]: RecognizerResultIntent } = this.props.recognizerResult.intents;
let topIntent = Object.keys(intents).reduce((a, b) => {
return intents[a].score > intents[b].score ? a : b;
return intents[ a ].score > intents[ b ].score ? a : b;
});
return { intent: topIntent, score: intents[topIntent].score };
return { intent: topIntent, score: intents[ topIntent ].score };
}
render() {
let topScoringIntent = this.getTopScoringIntent();
let mode: IntentEditorMode;
if (this.props.appInfo.authorized) {
const { appInfo = { authorized: false, isDispatchApp: false } } = this.props;
if (appInfo.authorized) {
mode = IntentEditorMode.Enabled;
} else if (this.props.appInfo.isDispatchApp) {
} else if (appInfo.isDispatchApp) {
mode = IntentEditorMode.Hidden;
} else {
mode = IntentEditorMode.Disabled;
Oops, something went wrong.

0 comments on commit 9210197

Please sign in to comment.