Skip to content

Commit

Permalink
Merge branch 'v4' into jwilaby/#947-mac-bot-file-open
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Wilaby committed Oct 10, 2018
2 parents 1ccf13a + 2713b6a commit 7aece0e
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 76 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@
line-height: 16px;
color: var(--notifications-clear-all-btn-color);
}

.no-notifications-msg {
margin: 0;
margin-top: 15px;
}
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -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>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }>
Expand Down
28 changes: 1 addition & 27 deletions packages/app/main/src/appMenuBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,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',
Expand Down Expand Up @@ -249,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[]
};
}
Expand Down
6 changes: 3 additions & 3 deletions packages/app/main/src/services/contextMenuService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -53,7 +53,7 @@ export class ContextMenuService {
});
const menu = ContextMenuService.currentMenu = Menu.buildFromTemplate(template);

menu.popup();
menu.popup({});
});
}
}
11 changes: 6 additions & 5 deletions packages/extensions/luis/client/src/Controls/Editor/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class LuisClient {
private publishService: Publish;
private luisAppInfo: LuisAppInfo;

private static getCacheKey(apiName: string, appId: string, versionId: string | undefined= undefined): string {
private static getCacheKey(apiName: string, appId: string, versionId: string | undefined = undefined): string {
let key: string = apiName + '_' + appId;
if (versionId) {
key += '_';
Expand Down Expand Up @@ -113,8 +113,8 @@ class LuisClient {
let r = await this.appsService.getApplicationInfo({ appId: this.luisAppInfo.appId });
let appInfo: AppInfo = {} as AppInfo;
if (r.status === 401 ||
// Cortana Built in app (static, user cannot author it)
(r.status === 400 && this.luisAppInfo.appId.toLowerCase() === CortanaAppId)) {
// Cortana Built in app (static, user cannot author it)
(r.status === 400 && this.luisAppInfo.appId.toLowerCase() === CortanaAppId)) {
appInfo = {
authorized: false,
activeVersion: Unauthorized,
Expand Down Expand Up @@ -155,12 +155,12 @@ class LuisClient {
text: luisResponse.query,
intentName: newIntent,
entityLabels: luisResponse.entities.map(e => {
return {
entityName: this.getNormalizedEntityType(e.type),
startCharIndex: e.startIndex,
endCharIndex: e.endIndex
};
})
return {
entityName: this.getNormalizedEntityType(e.type),
startCharIndex: e.startIndex,
endCharIndex: e.endIndex
};
})
};

let addLabelParapms: AddLabelParams = {
Expand All @@ -177,7 +177,7 @@ class LuisClient {
async publish(appInfo: AppInfo, staging: boolean): Promise<any> {
this.configureClient();
let endpointKey: string = staging ? 'STAGING' : 'PRODUCTION';
let region: string = appInfo.endpoints[endpointKey].endpointRegion;
let region: string = appInfo.endpoints[ endpointKey ].endpointRegion;
if (!region) {
throw new LuisClientError('Unknown publishing region');
}
Expand All @@ -186,43 +186,44 @@ class LuisClient {
region: region,
versionId: appInfo.activeVersion
};
let r = await this.publishService.publishApplication({appId: appInfo.appId}, applicationPublishRequest);
let r = await this.publishService.publishApplication({ appId: appInfo.appId }, applicationPublishRequest);
if (r.status !== 201) {
throw new LuisClientError('Publish Failed', r.status);
}
}

async train(appInfo: AppInfo): Promise<any> {
this.configureClient();
let r = await this.trainService.trainApplicationVersion({appId: appInfo.appId, versionId: appInfo.activeVersion});
let r = await this.trainService.trainApplicationVersion({ appId: appInfo.appId, versionId: appInfo.activeVersion });
if (r.status !== 202) {
throw new LuisClientError('Failed to queue training request', r.status);
}

let retryCounter = 0;
return new Promise((resolve, reject) => {
let intervalId = setInterval(async () => {
r = await this.trainService.getVersionTrainingStatus({
appId: appInfo.appId,
versionId: appInfo.activeVersion});

if (retryCounter++ >= TrainStatusRetryCount) {
clearInterval(intervalId);
reject('Failed to train the application');
}

if (r.status !== 200) {
return;
}

let appTrainingStatus: ModelTrainStatus[] = await r.json();
if (appTrainingStatus.every(s =>
s.details.statusId === TrainStatus.UpToDate ||
s.details.statusId === TrainStatus.Success )) {
clearInterval(intervalId);
resolve();
}
}, WaitIntervalInMs);
r = await this.trainService.getVersionTrainingStatus({
appId: appInfo.appId,
versionId: appInfo.activeVersion
});

if (retryCounter++ >= TrainStatusRetryCount) {
clearInterval(intervalId);
reject('Failed to train the application');
}

if (r.status !== 200) {
return;
}

let appTrainingStatus: ModelTrainStatus[] = await r.json();
if (appTrainingStatus.every(s =>
s.details.statusId === TrainStatus.UpToDate ||
s.details.statusId === TrainStatus.Success)) {
clearInterval(intervalId);
resolve();
}
}, WaitIntervalInMs);
});
}

Expand Down

0 comments on commit 7aece0e

Please sign in to comment.