Permalink
Browse files

Fixed issues

  • Loading branch information...
justinwilaby committed Sep 12, 2018
1 parent 0ce6f03 commit 165a198aba694fe432a9bcf67f4b00c767942d3e
Showing with 867 additions and 396 deletions.
  1. +16 −21 package-lock.json
  2. +6 −4 packages/app/client/src/commands/botCommands.ts
  3. +1 −1 packages/app/client/src/commands/uiCommands.spec.ts
  4. +5 −1 packages/app/client/src/commands/uiCommands.ts
  5. +16 −2 packages/app/client/src/data/action/botActions.ts
  6. +19 −0 packages/app/client/src/data/action/themeActions.ts
  7. +9 −0 packages/app/client/src/data/botHelpers.ts
  8. +7 −2 packages/app/client/src/data/reducer/bot.ts
  9. +20 −0 packages/app/client/src/data/reducer/themeReducer.ts
  10. +10 −2 packages/app/client/src/data/sagas/botSagas.ts
  11. +4 −1 packages/app/client/src/data/store.ts
  12. +4 −4 packages/app/client/src/index.html
  13. +7 −2 packages/app/client/src/inspector-preload.js
  14. +5 −6 packages/app/client/src/ui/editor/emulator/detailPanel/detailPanel.tsx
  15. +2 −3 packages/app/client/src/ui/editor/emulator/parts/detail/detail.tsx
  16. +227 −0 packages/app/client/src/ui/editor/emulator/parts/inspector/inspector.spec.tsx
  17. +150 −114 packages/app/client/src/ui/editor/emulator/parts/inspector/inspector.tsx
  18. +12 −0 packages/app/client/src/ui/editor/emulator/parts/inspector/inspectorContainer.ts
  19. +6 −4 packages/app/client/src/ui/helpers/activeBotHelper.ts
  20. +3 −8 packages/app/main/src/main.ts
  21. +1 −1 packages/app/main/src/settingsData/sagas/settingsSagas.ts
  22. +1 −7 packages/extensions/json/index.html
  23. +1 −2 packages/extensions/luis/client/package.json
  24. +35 −35 packages/extensions/luis/client/public/index.html
  25. +0 −41 packages/extensions/luis/client/src/@types/react-json-view/index.d.ts
  26. +14 −1 packages/extensions/luis/client/src/App.scss
  27. +1 −0 packages/extensions/luis/client/src/App.scss.d.ts
  28. +78 −69 packages/extensions/luis/client/src/App.tsx
  29. +2 −1 packages/extensions/luis/client/src/Controls/ControlBar/ControlBar.scss
  30. +2 −2 packages/extensions/luis/client/src/Controls/Editor/Editor.scss
  31. +1 −0 packages/extensions/luis/client/src/Controls/EntitiesViewer/EntitiesViewer.scss
  32. +17 −31 packages/extensions/luis/client/src/Controls/Header/Header.scss
  33. +1 −0 packages/extensions/luis/client/src/Controls/Header/Header.scss.d.ts
  34. +4 −8 packages/extensions/luis/client/src/Controls/Header/Header.tsx
  35. +8 −9 packages/extensions/luis/client/src/Controls/IntentEditor/IntentEditor.scss
  36. +1 −0 packages/extensions/luis/client/src/Controls/IntentEditor/IntentEditor.scss.d.ts
  37. +5 −7 packages/extensions/luis/client/src/Controls/IntentEditor/IntentEditor.tsx
  38. +55 −3 packages/extensions/luis/client/src/index.scss
  39. +1 −2 packages/extensions/luis/client/webpack.config.js
  40. +28 −0 packages/extensions/qnamaker/client/src/App.tsx
  41. +20 −2 packages/extensions/qnamaker/client/src/index.scss
  42. +3 −0 packages/sdk/client/src/extensions/host.ts
  43. +1 −0 packages/sdk/shared/src/utils/index.ts
  44. +40 −0 packages/sdk/shared/src/utils/json2HTML.ts
  45. +18 −0 testSetup.js
View

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

Oops, something went wrong.
@@ -73,16 +73,18 @@ export function registerCommands(commandRegistry: CommandRegistryImpl) {
// Syncs the client side list of bots with bots arg (usually called from server side)
commandRegistry.registerCommand(Commands.Bot.SyncBotList, async (bots: BotInfo[]): Promise<void> => {
store.dispatch(BotActions.load(bots));
CommandServiceImpl.remoteCall(Commands.Electron.UpdateFileMenu);
await CommandServiceImpl.remoteCall(Commands.Electron.UpdateFileMenu);
});
// ---------------------------------------------------------------------------
// Sets a bot as active (called from server-side)
commandRegistry.registerCommand(Commands.Bot.SetActive, (bot: BotConfigWithPath, botDirectory: string) => {
commandRegistry.registerCommand(Commands.Bot.SetActive, async (bot: BotConfigWithPath, botDirectory: string) => {
store.dispatch(BotActions.setActive(bot));
store.dispatch(FileActions.setRoot(botDirectory));
CommandServiceImpl.remoteCall(Commands.Electron.UpdateFileMenu);
CommandServiceImpl.remoteCall(Commands.Electron.SetTitleBar, getBotDisplayName(bot));
await Promise.all([
CommandServiceImpl.remoteCall(Commands.Electron.UpdateFileMenu),
CommandServiceImpl.remoteCall(Commands.Electron.SetTitleBar, getBotDisplayName(bot))
]);
});
commandRegistry.registerCommand(Commands.Bot.TranscriptFilesUpdated, (transcripts: IFileService[]) => {
@@ -110,7 +110,7 @@ describe('the uiCommands', () => {
let link = document.createElement('link');
link.id = 'themeVars';
document.querySelector('head').appendChild(link);
registry.getCommand(Commands.SwitchTheme).handler('./light.css');
registry.getCommand(Commands.SwitchTheme).handler('light', './light.css');
expect(link.href).toBe('http://localhost/light.css');
});
});
@@ -50,6 +50,7 @@ import { SharedConstants } from '@bfemulator/app-shared';
import { azureArmTokenDataChanged, beginAzureAuthWorkflow, invalidateArmToken } from '../data/action/azureAuthActions';
import { AzureAuthState } from '../data/reducer/azureAuthReducer';
import { ProgressIndicatorPayload, updateProgressIndicator } from '../data/action/progressIndicatorActions';
import { switchTheme } from '../data/action/themeActions';
/** Register UI commands (toggling UI) */
export function registerCommands(commandRegistry: CommandRegistry) {
@@ -94,11 +95,14 @@ export function registerCommands(commandRegistry: CommandRegistry) {
// ---------------------------------------------------------------------------
// Theme switching from main
commandRegistry.registerCommand(UI.SwitchTheme, themeHref => {
commandRegistry.registerCommand(UI.SwitchTheme, (themeName: string, themeHref: string) => {
const linkTags = document.querySelectorAll<HTMLLinkElement>('[data-theme-component="true"]');
const themeTag = document.getElementById('themeVars') as HTMLLinkElement;
if (themeTag) {
themeTag.href = themeHref;
}
const themeComponents = Array.prototype.map.call(linkTags, link => link.href); // href is fully qualified
store.dispatch(switchTheme(themeName, themeComponents));
});
// ---------------------------------------------------------------------------
@@ -39,7 +39,8 @@ export enum BotActions {
load = 'BOT/LOAD',
setActive = 'BOT/SET_ACTIVE',
close = 'BOT/CLOSE',
browse = 'BOT/BROWSE'
browse = 'BOT/BROWSE',
hashGenerated = 'BOT/HASH_GENERATED'
}
export interface CreateBotAction {
@@ -75,12 +76,18 @@ export interface BrowseBotAction {
payload: {};
}
export interface BotHashAction {
type: BotActions.hashGenerated;
payload: { hash: string };
}
export type BotAction =
CreateBotAction |
LoadBotAction |
SetActiveBotAction |
CloseBotAction |
BrowseBotAction;
BrowseBotAction |
BotHashAction;
export function create(bot: BotConfigWithPath, botFilePath: string, secret: string): CreateBotAction {
return {
@@ -131,3 +138,10 @@ export function browse(): BrowseBotAction {
payload: {}
};
}
export function botHashGenerated(hash: string): BotHashAction {
return {
type: BotActions.hashGenerated,
payload: { hash }
};
}
@@ -0,0 +1,19 @@
export const SWITCH_THEME = 'switchTheme';
export declare type ThemeType = 'switchTheme';
export interface ThemeAction<T> {
type: ThemeType;
payload: T;
}
export interface SwitchThemePayload {
themeName: string;
themeComponents: string[];
}
export function switchTheme(themeName: string, themeComponents: string[]): ThemeAction<SwitchThemePayload> {
return {
type: SWITCH_THEME,
payload: { themeName, themeComponents }
};
}
@@ -39,6 +39,15 @@ export function getActiveBot(): BotConfigWithPath {
return store.getState().bot.activeBot;
}
const encoder = new (window as any).TextEncoder();
const decoder = new (window as any).TextDecoder();
export const generateBotHash = async (bot: BotConfigWithPath): Promise<string> => {
const buffer = encoder.encode(JSON.stringify(bot));
const digest = await window.crypto.subtle.digest('SHA-256', buffer);
return btoa(encoder.encode(decoder.decode(digest)));
};
/** Returns a copy of the matching BotInfo in the store */
export function getBotInfoByPath(path: string): BotInfo {
const state = store.getState();
@@ -32,16 +32,18 @@
//
import { BotInfo, getBotDisplayName } from '@bfemulator/app-shared';
import { BotConfigWithPath, applyBotConfigOverrides, botsAreTheSame } from '@bfemulator/sdk-shared';
import { applyBotConfigOverrides, BotConfigWithPath, botsAreTheSame } from '@bfemulator/sdk-shared';
import { BotAction, BotActions } from '../action/botActions';
export interface BotState {
activeBot: BotConfigWithPath;
activeBotDigest: string;
botFiles: BotInfo[];
}
const DEFAULT_STATE: BotState = {
activeBot: null,
activeBotDigest: null,
botFiles: []
};
@@ -81,11 +83,14 @@ export default function bot(state: BotState = DEFAULT_STATE, action: BotAction)
}
case BotActions.close: {
// close the ative bot
// close the active bot
state = setActiveBot(null, state);
break;
}
case BotActions.hashGenerated:
return { ...state, activeBotDigest: action.payload.hash };
default:
break;
}
@@ -0,0 +1,20 @@
import { SwitchThemePayload, ThemeAction } from '../action/themeActions';
export interface ThemeState {
themeName: string;
themeHref: string;
themeComponents: string[];
}
export const initialState: ThemeState = { themeName: null, themeHref: null, themeComponents: [] };
export default function theme(state: ThemeState = initialState, action: ThemeAction<SwitchThemePayload>): ThemeState {
switch (action.type) {
case 'switchTheme':
return { ...state, ...action.payload };
default:
return state;
}
}
@@ -31,16 +31,24 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
import { ForkEffect, takeEvery } from 'redux-saga/effects';
import { ForkEffect, put, takeEvery } from 'redux-saga/effects';
import { CommandServiceImpl } from '../../platform/commands/commandServiceImpl';
import { SharedConstants } from '@bfemulator/app-shared';
import { BotActions } from '../action/botActions';
import { BotActions, botHashGenerated, SetActiveBotAction } from '../action/botActions';
import { generateBotHash } from '../botHelpers';
/** Opens up native open file dialog to browse for a .bot file */
export function* browseForBot(): IterableIterator<any> {
yield CommandServiceImpl.call(SharedConstants.Commands.Bot.OpenBrowse);
}
export function* generateHashForActiveBot(action: SetActiveBotAction): IterableIterator<any> {
const { bot } = action.payload;
const generatedHash = yield generateBotHash(bot);
yield put(botHashGenerated(generatedHash));
}
export function* botSagas(): IterableIterator<ForkEffect> {
yield takeEvery(BotActions.browse, browseForBot);
yield takeEvery(BotActions.setActive, generateHashForActiveBot);
}
@@ -46,6 +46,7 @@ import notification, { NotificationState } from './reducer/notification';
import presentation, { PresentationState } from './reducer/presentation';
import progressIndicator, { ProgressIndicatorState } from './reducer/progressIndicator';
import resources, { ResourcesState } from './reducer/resourcesReducer';
import theme, { ThemeState } from './reducer/themeReducer';
import { applicationSagas } from './sagas';
@@ -61,6 +62,7 @@ export interface RootState {
notification?: NotificationState;
progressIndicator?: ProgressIndicatorState;
resources?: ResourcesState;
theme?: ThemeState;
}
const sagaMiddleWare = sagaMiddlewareFactory();
@@ -78,7 +80,8 @@ const configureStore = (initialState: RootState = DEFAULT_STATE): Store<RootStat
azureAuth,
notification,
progressIndicator,
resources
resources,
theme
}),
initialState,
applyMiddleware(
@@ -42,10 +42,10 @@
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="manifest.json">
<link rel="stylesheet" href="./css/neutral.css"/>
<link rel="stylesheet" id="themeVars" href="./themes/light.css"/>
<link rel="stylesheet" href="./css/fonts.css"/>
<link rel="stylesheet" href="./css/redline.css"/>
<link rel="stylesheet" data-theme-component="true" href="./css/neutral.css"/>
<link rel="stylesheet" data-theme-component="true" id="themeVars" href="./themes/light.css"/>
<link rel="stylesheet" data-theme-component="true" href="./css/fonts.css"/>
<link rel="stylesheet" data-theme-component="true" href="./css/redline.css"/>
<title></title>
</head>
<body>
Oops, something went wrong.

0 comments on commit 165a198

Please sign in to comment.