-
Notifications
You must be signed in to change notification settings - Fork 377
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: link to tab #1738
Merged
Merged
feat: link to tab #1738
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
adff726
lint to form type
lei9444 188c644
fix some bug
lei9444 6a2a7b1
update the focused function
lei9444 bff81c0
Merge branch 'master' into convert
lei9444 6d2efb7
add some unit test
lei9444 fd5be1c
Merge branch 'master' into convert
a-b-r-o-w-n 73bbed8
Merge branch 'master' into convert
a-b-r-o-w-n 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 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 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 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 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
15 changes: 15 additions & 0 deletions
15
Composer/packages/lib/shared/__tests__/convertUtils/parsePathToFocused.test.ts
This file contains 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,15 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License | ||
|
||
import { parsePathToFocused } from '../../src'; | ||
|
||
describe('parsePathToFocused', () => { | ||
it('should return focusedPath', () => { | ||
expect(parsePathToFocused('')).toBe(''); | ||
expect(parsePathToFocused('main.trigers[0].actions[0]')).toBe('trigers[0].actions[0]'); | ||
expect(parsePathToFocused('main.trigers[0].actions[0].actions[1]')).toBe('trigers[0].actions[0].actions[1]'); | ||
expect(parsePathToFocused('main.trigers[0].actions[0].elseActions[1]')).toBe( | ||
'trigers[0].actions[0].elseActions[1]' | ||
); | ||
}); | ||
}); |
13 changes: 13 additions & 0 deletions
13
Composer/packages/lib/shared/__tests__/convertUtils/parsePathToSelected.test.ts
This file contains 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,13 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License | ||
|
||
import { parsePathToSelected } from '../../src'; | ||
|
||
describe('parsePathToSelected', () => { | ||
it('should return selected path', () => { | ||
expect(parsePathToSelected('')).toBe(''); | ||
expect(parsePathToSelected('main.triggers[0].actions[0]')).toBe('triggers[0]'); | ||
expect(parsePathToSelected('main')).toBe(''); | ||
expect(parsePathToSelected('main.triggers[0]')).toBe('triggers[0]'); | ||
}); | ||
}); |
15 changes: 15 additions & 0 deletions
15
Composer/packages/lib/shared/__tests__/convertUtils/parseTypeToFragment.test.ts
This file contains 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,15 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License | ||
|
||
import { parseTypeToFragment, PromptTab } from './../../src'; | ||
|
||
describe('parseTypeToFragment', () => { | ||
it('should return corrent tab name', () => { | ||
expect(parseTypeToFragment('Microsoft.TextInput', 'unrecognizedPrompt')).toBe(PromptTab.OTHER); | ||
expect(parseTypeToFragment('Microsoft.TextInput', 'property')).toBe(PromptTab.USER_INPUT); | ||
expect(parseTypeToFragment('Microsoft.TextInput', 'prompt')).toBe(PromptTab.BOT_ASKS); | ||
expect(parseTypeToFragment('Microsoft.NumberInput', 'property')).toBe(PromptTab.USER_INPUT); | ||
expect(parseTypeToFragment('Microsoft.LuisRecognizer', 'property')).toBe(''); | ||
expect(parseTypeToFragment('test', 'items')).toBe(''); | ||
}); | ||
}); |
This file contains 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,6 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
export * from './parsePathToFocused'; | ||
export * from './parsePathToSelected'; | ||
export * from './parseTypeToFragment'; | ||
14 changes: 14 additions & 0 deletions
14
Composer/packages/lib/shared/src/convertUtils/parsePathToFocused.ts
This file contains 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,14 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
export function parsePathToFocused(path: string): string { | ||
//path is like main.trigers[0].actions[0] | ||
|
||
const list = path.split('.'); | ||
|
||
if (list.length > 2) { | ||
list.shift(); | ||
return list.join('.'); | ||
} | ||
return ''; | ||
} |
13 changes: 13 additions & 0 deletions
13
Composer/packages/lib/shared/src/convertUtils/parsePathToSelected.ts
This file contains 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,13 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
export function parsePathToSelected(path: string): string { | ||
//path is like main.trigers[0].actions[0] | ||
|
||
const triggerPattern = /triggers\[(\d+)\]/g; | ||
const matchTriggers = triggerPattern.exec(path); | ||
|
||
const trigger = matchTriggers ? `triggers[${+matchTriggers[1]}]` : ''; | ||
|
||
return trigger; | ||
} |
16 changes: 16 additions & 0 deletions
16
Composer/packages/lib/shared/src/convertUtils/parseTypeToFragment.ts
This file contains 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,16 @@ | ||||||
// Copyright (c) Microsoft Corporation. | ||||||
// Licensed under the MIT License. | ||||||
|
||||||
import { dialogGroups, DialogGroup } from '../viewUtils'; | ||||||
import { PromptTab } from '../promptTabs'; | ||||||
|
||||||
export function parseTypeToFragment(type: string, property: string): string { | ||||||
const inputTypes = dialogGroups[DialogGroup.INPUT].types; | ||||||
const index = inputTypes.findIndex(t => t === type); | ||||||
if (index >= 0) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
if (property === 'property') return PromptTab.USER_INPUT; | ||||||
if (property === 'prompt') return PromptTab.BOT_ASKS; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm worried about this scaling to all fields. Not sure what to do about it, but we should start thinking on how to handle this. |
||||||
return PromptTab.OTHER; | ||||||
} | ||||||
return ''; | ||||||
} |
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these meant to be shared in other packages? I would expect these to live in the client.