Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Unify CRUD in dialog diff #2

Draft
wants to merge 69 commits into
base: upstream-master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
89545ce
json differ
zhixzhan Apr 17, 2020
2683408
refine json diff
zhixzhan Apr 23, 2020
a27a1ac
dialog diff
zhixzhan Apr 23, 2020
d5d2ee6
stash code
zhixzhan Apr 23, 2020
d047641
update
zhixzhan Apr 23, 2020
6b2a9d7
Let differ function return shouldStop
zhixzhan Apr 24, 2020
3e74862
diff in list
zhixzhan Apr 24, 2020
8cea754
list differ util
zhixzhan Apr 26, 2020
97637a5
enable ListDiff in JsonDiff
zhixzhan Apr 26, 2020
3d9d4a8
merge stop function into comparator
zhixzhan Apr 27, 2020
0a3e409
update
zhixzhan Apr 28, 2020
b500d28
update
zhixzhan Apr 29, 2020
9fdd6e1
update
zhixzhan May 6, 2020
869e452
Merge branch 'centralize-action-dialog-derefer' into centralize-action
zhixzhan May 6, 2020
a037dfc
extract lg/lu resources in dialog snippet
zhixzhan May 6, 2020
5ee00c8
Merge branch 'master' into centralize-action
zhixzhan May 6, 2020
f93287e
update
zhixzhan May 6, 2020
21b64fc
use centralized dialog action handle lg/lu
zhixzhan May 8, 2020
f40359e
apply to actions/triggers delete
zhixzhan May 9, 2020
b3870e1
Merge branch 'master' into centralize-action
zhixzhan May 9, 2020
90cb3b9
update
zhixzhan May 9, 2020
bc18139
dialog converter add lg virtual property
zhixzhan May 11, 2020
82ed4ef
convert lu intent into virtual property
zhixzhan May 11, 2020
8bacd9e
use virtual dialog do read
zhixzhan May 12, 2020
b369c90
remove useLg Lu in copy
zhixzhan May 12, 2020
9cadd02
convert virtual dialog back to save
zhixzhan May 12, 2020
5d7a9aa
use schema driven virtual prop widget
zhixzhan May 13, 2020
7f88314
use virtual lgFiled in form by add schema
zhixzhan May 13, 2020
1900cd4
Merge branch 'v-dialog' into centralize-action
zhixzhan May 13, 2020
1e2d6bb
virtual dialog utils
zhixzhan May 14, 2020
2ee18f3
updateVirtualDialog
zhixzhan May 15, 2020
5537626
Merge branch 'upstream-master' into centralize-action
zhixzhan May 15, 2020
d084b23
Merge branch 'upstream-master' into centralize-action
zhixzhan May 18, 2020
03fc148
update
zhixzhan May 18, 2020
591039b
update
zhixzhan May 18, 2020
c59d7ba
use virtual schema
zhixzhan May 18, 2020
e0ab066
move out parsing from reducer to action
zhixzhan May 18, 2020
59cd036
- default value
zhixzhan May 19, 2020
2cc916b
swap virtual prop value
zhixzhan May 19, 2020
f8c2170
refine filterTemplateDiagnostics method
zhixzhan May 20, 2020
5f15f1c
luis use virtual dialog
zhixzhan May 20, 2020
0b420fc
clean up
zhixzhan May 20, 2020
66d272b
update
zhixzhan May 21, 2020
e144c4e
use JSONPath lib do query
zhixzhan May 21, 2020
0ca06f8
unify resource changes in filepersistence
zhixzhan May 21, 2020
b65cb2d
clean
zhixzhan May 21, 2020
f66e40c
update comparation
zhixzhan May 22, 2020
38d0f3e
update
zhixzhan May 22, 2020
20774d7
implement move
zhixzhan May 22, 2020
b30ca65
clean up
zhixzhan May 22, 2020
af964ff
use virtual ui plugin
zhixzhan May 27, 2020
9631f11
ui-plugin virtual widget
zhixzhan May 28, 2020
453af85
refine dialogDiff
zhixzhan May 28, 2020
bf3cd37
clean
zhixzhan May 28, 2020
79562b2
restore changes on origin ui-plugins
zhixzhan May 28, 2020
2db1bca
do not build incompatable ui-plugin
zhixzhan May 28, 2020
9e46cae
virtual regexp intent
zhixzhan May 29, 2020
c3a20c4
move differ to shared lib
zhixzhan May 29, 2020
074e522
code split
zhixzhan May 29, 2020
07b4a66
update
zhixzhan May 29, 2020
b4aa04d
update
zhixzhan May 30, 2020
65b0ae6
update
zhixzhan Jun 1, 2020
09ac3fb
check recoginizer type change
zhixzhan Jun 1, 2020
a7bb925
rename
zhixzhan Jun 1, 2020
fabfa8a
refine list compare
zhixzhan Jun 1, 2020
3781716
use virtual dialog with `Show Code`
zhixzhan Jun 1, 2020
1e9f94b
refine test
zhixzhan Jun 2, 2020
e4f0038
support undo/redo
lei9444 Jun 24, 2020
8ccd5f4
refine convert json changes to dialog changes
zhixzhan Jun 24, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Composer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@
"packages/tools",
"packages/tools/language-servers",
"packages/tools/language-servers/*",
"packages/ui-plugins/*"
"packages/ui-plugins/example",
"packages/ui-plugins/expressions",
"packages/ui-plugins/json",
"packages/ui-plugins/select-dialog",
"packages/ui-plugins/select-skill-dialog",
"packages/ui-plugins/virtual-lg",
"packages/ui-plugins/virtual-luis",
"packages/ui-plugins/virtual-prompts"
],
"scripts": {
"build": "node scripts/begin.js && yarn build:prod && yarn build:plugins",
Expand Down
14 changes: 10 additions & 4 deletions Composer/packages/client/__tests__/store/reducer/reducer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe('test all reducer handlers', () => {
luFiles: [],
schemas: { sdk: { content: {} } },
},
{ type: ActionTypes.CREATE_DIALOG, payload: { id: '3', content: '' } }
{ type: ActionTypes.CREATE_DIALOG, payload: { id: '3', content: {} } }
);
expect(result.dialogs.length).toBe(3);
expect(result.dialogs[2].id).toBe('3');
Expand All @@ -94,10 +94,16 @@ describe('test all reducer handlers', () => {

it('update dialog file', () => {
const result = reducer(
{ dialogs: [{ id: '1', content: 'old' }, { id: '2' }], schemas: { sdk: { content: {} } } },
{ type: ActionTypes.UPDATE_DIALOG, payload: { id: '1', content: 'new' } }
{
dialogs: [{ id: '1', content: { value: 'old' } }, { id: '2' }],
locale: 'en-us',
lgFiles: [],
luFiles: [],
schemas: { sdk: { content: {} } },
},
{ type: ActionTypes.UPDATE_DIALOG, payload: { id: '1', content: { value: 'new' } } }
);
expect(result.dialogs.length).toBe(2);
expect(result.dialogs[0].content).toBe('new');
expect(result.dialogs[0].content).toEqual({ value: 'new' });
});
});
6 changes: 3 additions & 3 deletions Composer/packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
"@bfc/indexers": "*",
"@bfc/shared": "*",
"@bfc/ui-plugin-expressions": "*",
"@bfc/ui-plugin-lg": "*",
"@bfc/ui-plugin-luis": "*",
"@bfc/ui-plugin-prompts": "*",
"@bfc/ui-plugin-select-dialog": "*",
"@bfc/ui-plugin-select-skill-dialog": "*",
"@bfc/ui-plugin-virtual-prompts": "*",
"@bfc/ui-plugin-virtual-lg": "*",
"@bfc/ui-plugin-virtual-luis": "*",
"@bfc/visual-designer": "*",
"@emotion/core": "^10.0.7",
"@microsoft/bf-lu": "4.9.0",
Expand Down
1 change: 1 addition & 0 deletions Composer/packages/client/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export enum ActionTypes {
CREATE_DIALOG_CANCEL = 'CREATE_DIALOG_CANCEL',
CREATE_DIALOG = 'CREATE_DIALOG',
UPDATE_DIALOG = 'UPDATE_DIALOG',
UPDATE_VIRTUAL_DIALOG = 'UPDATE_VIRTUAL_DIALOG',
REMOVE_DIALOG = 'REMOVE_DIALOG',
UPDATE_LG = 'UPDATE_LG',
CREATE_LG = 'CREATE_LG',
Expand Down
21 changes: 14 additions & 7 deletions Composer/packages/client/src/pages/design/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { PromptTab } from '@bfc/shared';
import { DialogFactory, SDKKinds, DialogInfo } from '@bfc/shared';
import { ActionButton } from 'office-ui-fabric-react/lib/Button';
import { JsonEditor } from '@bfc/code-editor';
import { useTriggerApi } from '@bfc/extension';

import { LoadingSpinner } from '../../components/LoadingSpinner';
import { TestController } from '../../components/TestController';
Expand All @@ -28,7 +27,7 @@ import { ToolBar } from '../../components/ToolBar/index';
import { clearBreadcrumb } from '../../utils/navigation';
import undoHistory from '../../store/middlewares/undo/history';
import { navigateTo } from '../../utils';
import { useShell } from '../../shell';
import { useVirtualDialog } from '../../shell/useVirtualDialog';

import { VisualEditorAPI } from './FrameAPI';
import {
Expand Down Expand Up @@ -113,8 +112,6 @@ const DesignPage: React.FC<RouteComponentProps<{ dialogId: string; projectId: st
const [dialogJsonVisible, setDialogJsonVisibility] = useState(false);
const [currentDialog, setCurrentDialog] = useState<DialogInfo>(dialogs[0]);
const [exportSkillModalVisible, setExportSkillModalVisible] = useState(false);
const shell = useShell('ProjectTree');
const triggerApi = useTriggerApi(shell.api);

useEffect(() => {
const currentDialog = dialogs.find(({ id }) => id === dialogId);
Expand All @@ -129,6 +126,9 @@ const DesignPage: React.FC<RouteComponentProps<{ dialogId: string; projectId: st
}
}, [dialogId, dialogs, location]);

const virtualDialogs = useVirtualDialog();
const currentVirtualDialog = virtualDialogs.find(({ id }) => id === currentDialog.id) || currentDialog;

useEffect(() => {
const index = currentDialog.triggers.findIndex(({ type }) => type === SDKKinds.OnBeginDialog);
if (index >= 0 && !designPageLocation.selected) {
Expand Down Expand Up @@ -373,7 +373,7 @@ const DesignPage: React.FC<RouteComponentProps<{ dialogId: string; projectId: st
}

async function handleDeleteTrigger(id, index) {
const content = deleteTrigger(dialogs, id, index, trigger => triggerApi.deleteTrigger(id, trigger));
const content = deleteTrigger(dialogs, id, index);

if (content) {
await updateDialog({ id, projectId, content });
Expand Down Expand Up @@ -431,9 +431,16 @@ const DesignPage: React.FC<RouteComponentProps<{ dialogId: string; projectId: st
key={'dialogjson'}
id={'dialogjson'}
onChange={data => {
actions.updateDialog({ id: currentDialog.id, projectId, content: data });
// actions.updateDialog({ id: currentDialog.id, projectId, content: data });
actions.updateVirtualDialog({
id: currentVirtualDialog.id,
projectId,
content: data,
prevContent: currentVirtualDialog.content,
});
}}
value={currentDialog.content || undefined}
value={currentVirtualDialog.content || undefined}
// value={currentDialog.content || undefined}
schema={schemas.sdk.content}
/>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ const CodeEditor: React.FC<CodeEditorProps> = props => {
setContent(value);
}, [file, templateId, projectId]);

const currentDiagnostics = inlineMode && template ? filterTemplateDiagnostics(diagnostics, template) : diagnostics;
const currentDiagnostics =
inlineMode && file && template ? filterTemplateDiagnostics(file, template.name) : diagnostics;

const editorDidMount: EditorDidMount = (_getValue, lgEditor) => {
setLgEditor(lgEditor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { LuEditor, EditorDidMount } from '@bfc/code-editor';
import get from 'lodash/get';
import debounce from 'lodash/debounce';
import isEmpty from 'lodash/isEmpty';
import { filterTemplateDiagnostics } from '@bfc/indexers';
import { filterSectionDiagnostics } from '@bfc/indexers';
import { RouteComponentProps } from '@reach/router';
import querystring from 'query-string';
import { CodeEditorSettings } from '@bfc/shared';
Expand Down Expand Up @@ -51,7 +51,7 @@ const CodeEditor: React.FC<CodeEditorProps> = props => {
setContent(value);
}, [file, sectionId, projectId]);

const currentDiagnostics = inlineMode && intent ? filterTemplateDiagnostics(diagnostics, intent) : diagnostics;
const currentDiagnostics = inlineMode && file && sectionId ? filterSectionDiagnostics(file, sectionId) : diagnostics;

const editorDidMount: EditorDidMount = (_getValue, luEditor) => {
setLuEditor(luEditor);
Expand Down
6 changes: 3 additions & 3 deletions Composer/packages/client/src/plugins.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import expressions from '@bfc/ui-plugin-expressions';
import prompts from '@bfc/ui-plugin-prompts';
import selectDialog from '@bfc/ui-plugin-select-dialog';
import selectSkillDialog from '@bfc/ui-plugin-select-skill-dialog';
import lg from '@bfc/ui-plugin-lg';
import lu from '@bfc/ui-plugin-luis';
import prompts from '@bfc/ui-plugin-virtual-prompts';
import lg from '@bfc/ui-plugin-virtual-lg';
import lu from '@bfc/ui-plugin-virtual-luis';

export default [prompts, selectDialog, selectSkillDialog, lg, lu, expressions];
112 changes: 0 additions & 112 deletions Composer/packages/client/src/shell/lgApi.ts

This file was deleted.

88 changes: 0 additions & 88 deletions Composer/packages/client/src/shell/luApi.ts

This file was deleted.

Loading