This repository was archived by the owner on Jul 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 374
feat: Trigger UI Schema #4079
Merged
Merged
feat: Trigger UI Schema #4079
Changes from 62 commits
Commits
Show all changes
67 commits
Select commit
Hold shift + click to select a range
c1df63a
chore: move TriggerCreationModal to folder
yeze322 e777525
chore: move styles into styles.ts
yeze322 11aea2d
chore: move validators out
yeze322 45a29ef
Extract dropdown options as constants
yeze322 360fd69
remove outdated dropdown option generators
yeze322 bde230d
don't re-declare SDKKinds as type key
yeze322 eb76dd0
remove initialError, fix tslint
yeze322 8d80721
fix warning icon size
yeze322 7dd1340
refactor show warning logic
yeze322 5d4a0d9
move static func outside TriggerModal
yeze322 134568e
refactor: move trigger widget out of Modal
yeze322 d5d9df8
Merge branch 'main' into uischema/trigger
yeze322 d04c877
replay changes in #4117 'mutiple projects'
yeze322 732ae47
fix a wrong import path
yeze322 a86389b
Merge branch 'main' into uischema/trigger
yeze322 2c75030
Merge branch 'main' into uischema/trigger
yeze322 f6482a1
refactor: extract TriggerDropdownGroup
yeze322 78413bc
define builtinSchema
yeze322 2635ccc
TriggerOptionTree
yeze322 7a6891c
remove duplicated $kinds
yeze322 ea57599
link leaf ndoe to parent node
yeze322 235b99d
migrate to option tree
yeze322 e72611a
Merge branch 'main' into uischema/trigger
yeze322 1f3824e
fix a React grammar
yeze322 f186639
rename builtinSchema
yeze322 ba8013a
refactor the warning icon logic of trigger modal
yeze322 80cd840
remove unreferenced utils
yeze322 a049f21
add a todo
yeze322 b6d5978
fix UT by adding data-testid
yeze322 23dd5b8
declare TriggerUISchema in extension
yeze322 4d70307
use trigger uischema from extension context
yeze322 f3a76a4
check trigger option existence
yeze322 2e8cf9b
sort trigger dropdown labels
yeze322 ce3b69d
Merge branch 'main' into uischema/trigger
cwhitten 7d912c7
Merge branch 'main' into uischema/trigger
yeze322 7f918b7
move root text out of tree utils
yeze322 2aceb82
pass in option compare fn
yeze322 4718f6f
add UT for triggerOptionTree
yeze322 60615fa
Merge branch 'uischema/trigger' of https://github.com/yeze322/BotFram…
yeze322 9027017
Merge branch 'main' into uischema/trigger
yeze322 66c6c37
align icon size with main
yeze322 4693034
Merge branch 'main' into uischema/trigger
yeze322 d85f49f
migrate 1.2 PVA logic
yeze322 9b92c0a
use 'Boolean' to filter trigger menus
yeze322 e844fa3
wrap trigger UI Schema with formatMessage
yeze322 a569fbf
add 'px' unit to styles
yeze322 7dafd08
Merge branch 'uischema/trigger' of https://github.com/yeze322/BotFram…
yeze322 42ab589
Merge branch 'main' into uischema/trigger
yeze322 3b865a0
add trigger menu order
yeze322 fe233c9
'order' property to manage trigger order
yeze322 6261692
early returning & add comments
yeze322 3bf9618
avoid duplicated iteration and add comments
yeze322 d6c5c29
fix trigger modal UT
yeze322 19554e7
lint
yeze322 7d2532b
Merge branch 'main' into uischema/trigger
yeze322 e7dc9ae
Merge branch 'main' into uischema/trigger
yeze322 2eb8d89
replay Ben's commit
yeze322 328207b
Merge branch 'main' into uischema/trigger
yeze322 7e26895
Merge branch 'main' into uischema/trigger
yeze322 9e3755f
Merge branch 'main' into uischema/trigger
yeze322 f4cc1d5
Merge branch 'main' into uischema/trigger
yeze322 d559d08
Merge branch 'main' into uischema/trigger
yeze322 385c848
Merge branch 'main' into uischema/trigger
a-b-r-o-w-n 2fa8db1
CI fix
yeze322 7ff43f2
Merge branch 'main' into uischema/trigger
yeze322 c3c6091
Merge branch 'main' into uischema/trigger
yeze322 8c44790
Merge branch 'main' into uischema/trigger
yeze322 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
Composer/packages/client/__tests__/components/TriggerCreationModal/triggerOptionTree.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| import { TriggerUISchema } from '@bfc/extension-client'; | ||
| import { SDKKinds } from '@botframework-composer/types'; | ||
|
|
||
| import { | ||
| generateTriggerOptionTree, | ||
| TriggerOptionGroupNode, | ||
| } from '../../../src/components/TriggerCreationModal/TriggerOptionTree'; | ||
|
|
||
| describe('generateTriggerOptionTree()', () => { | ||
| it('can generate one layer tree.', () => { | ||
| const simpleTriggerUIOptions: TriggerUISchema = { | ||
| [SDKKinds.OnIntent]: { | ||
| label: '1.OnIntent', | ||
| order: 1, | ||
| }, | ||
| [SDKKinds.OnInvokeActivity]: { | ||
| label: '2.OnInvokeActivity', | ||
| order: 2, | ||
| }, | ||
| }; | ||
| const tree = generateTriggerOptionTree(simpleTriggerUIOptions, 'Select a trigger', 'Which trigger?'); | ||
|
|
||
| expect(tree.prompt).toEqual('Select a trigger'); | ||
| expect(tree.placeholder).toEqual('Which trigger?'); | ||
|
|
||
| expect(tree.parent).toBeNull(); | ||
| expect(tree.children.length).toEqual(2); | ||
|
|
||
| expect(tree.children[0].label).toEqual('1.OnIntent'); | ||
| expect(tree.children[0].parent).toEqual(tree); | ||
|
|
||
| expect(tree.children[1].label).toEqual('2.OnInvokeActivity'); | ||
| expect(tree.children[1].parent).toEqual(tree); | ||
| }); | ||
|
|
||
| it('can generate tree with submenu.', () => { | ||
| const advancedTriggerUIOptions: TriggerUISchema = { | ||
| [SDKKinds.OnIntent]: { | ||
| label: '1.OnIntent', | ||
| order: 1, | ||
| }, | ||
| [SDKKinds.OnTypingActivity]: { | ||
| label: '2.1.OnTypingActivity', | ||
| order: 2.1, | ||
| submenu: { | ||
| label: '2.Activities', | ||
| prompt: 'Select an activity trigger', | ||
| placeholder: 'Which activity?', | ||
| }, | ||
| }, | ||
| [SDKKinds.OnEventActivity]: { | ||
| label: '2.2OnEventActivity', | ||
| order: 2.2, | ||
| submenu: '2.Activities', | ||
| }, | ||
| [SDKKinds.OnInvokeActivity]: { | ||
| label: '2.3OnInvokeActivity', | ||
| order: 2.3, | ||
| submenu: '2.Activities', | ||
| }, | ||
| }; | ||
| const tree = generateTriggerOptionTree(advancedTriggerUIOptions, 'Select a trigger', 'Which trigger?'); | ||
|
|
||
| expect(tree.children.length).toEqual(2); | ||
|
|
||
| expect(tree.children[0].label).toEqual('1.OnIntent'); | ||
| expect(tree.children[0].parent).toEqual(tree); | ||
|
|
||
| const secondChild = tree.children[1] as TriggerOptionGroupNode; | ||
| expect(secondChild.label).toEqual('2.Activities'); | ||
| expect(secondChild.prompt).toEqual('Select an activity trigger'); | ||
| expect(secondChild.children.length).toEqual(3); | ||
|
|
||
| expect(secondChild.children[0].label).toEqual('2.1.OnTypingActivity'); | ||
| expect(secondChild.children[0].parent).toEqual(secondChild); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.