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 375
fix: Display Orchestrator Selection Dialog for Local Skills #7518
Merged
Merged
Changes from 6 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
577d22a
First pass to add OrchSkillDialog to local skills
taicchoumsft 5c2bd6b
Merge branch 'main' into tachou/orchLocalSkillDialog
taicchoumsft 5e182d7
Rename Orchestractor to Orchestrator
taicchoumsft 4f5991f
Merge branch 'main' into tachou/orchLocalSkillDialog
taicchoumsft 912419b
Merge branch 'main' into tachou/orchLocalSkillDialog
taicchoumsft 0976f11
Merge branch 'main' into tachou/orchLocalSkillDialog
cwhitten f8d973d
update package to 4.13.1
taicchoumsft 744d2ce
Merge branch 'tachou/orchLocalSkillDialog' of https://github.com/micr…
taicchoumsft ed9fe92
Address PR comments
taicchoumsft 507b0e4
Use string constants where possible
taicchoumsft d980894
Rename Orchestrator component
taicchoumsft 53df210
Fix another typo
taicchoumsft d86dcf1
Merge branch 'main' into tachou/orchLocalSkillDialog
taicchoumsft 02063aa
Change link to bf-orchestrator
taicchoumsft 3d6c7ba
Merge branch 'tachou/orchLocalSkillDialog' of https://github.com/micr…
taicchoumsft d41e3c5
Merge branch 'main' into tachou/orchLocalSkillDialog
taicchoumsft 82558e5
Link and copy changes per PM and Design
taicchoumsft 0a55178
add unit test
taicchoumsft 9d35094
Merge branch 'main' into tachou/orchLocalSkillDialog
taicchoumsft 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
141 changes: 79 additions & 62 deletions
141
...nts/AddRemoteSkillModal/Orchestractor.tsx → ...ents/AddRemoteSkillModal/Orchestrator.tsx
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 |
|---|---|---|
| @@ -1,62 +1,79 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| import React, { useState } from 'react'; | ||
| import formatMessage from 'format-message'; | ||
| import { Link } from 'office-ui-fabric-react/lib/Link'; | ||
| import { Checkbox } from 'office-ui-fabric-react/lib/Checkbox'; | ||
| import { Stack, StackItem } from 'office-ui-fabric-react/lib/Stack'; | ||
| import { PrimaryButton, DefaultButton } from 'office-ui-fabric-react/lib/Button'; | ||
| import { useRecoilValue } from 'recoil'; | ||
|
|
||
| import { dispatcherState } from '../../recoilModel'; | ||
| import { enableOrchestratorDialog } from '../../constants'; | ||
|
|
||
| import { importOrchestractor } from './helper'; | ||
|
|
||
| const learnMoreUrl = 'https://aka.ms/bf-composer-docs-publish-bot'; | ||
|
|
||
| export const Orchestractor = (props) => { | ||
| const { projectId, onSubmit, onBack } = props; | ||
| const [enableOrchestrator, setEnableOrchestrator] = useState(true); | ||
| const { setApplicationLevelError, reloadProject } = useRecoilValue(dispatcherState); | ||
| const onChange = (ev, check) => { | ||
| setEnableOrchestrator(check); | ||
| }; | ||
| return ( | ||
| <Stack> | ||
| <StackItem styles={{ root: { height: 300, width: '60%' } }}> | ||
| <div style={{ marginBottom: '16px' }}> | ||
| {enableOrchestratorDialog.content} | ||
| <Link href={learnMoreUrl} target="_blank"> | ||
| <div>{formatMessage('Learn more about Orchestractor')}</div> | ||
| </Link> | ||
| </div> | ||
| <Checkbox | ||
| defaultChecked | ||
| label={formatMessage('Make Orchestrator my preferred recognizer for multi-bot projects')} | ||
| styles={{ root: { margin: '20px 0' } }} | ||
| onChange={onChange} | ||
| /> | ||
| </StackItem> | ||
| <Stack horizontal horizontalAlign="space-between"> | ||
| <DefaultButton text={formatMessage('Back')} onClick={onBack} /> | ||
| <span> | ||
| <DefaultButton styles={{ root: { marginRight: '8px' } }} text={formatMessage('Skip')} onClick={onSubmit} /> | ||
| <PrimaryButton | ||
| text={formatMessage('Continue')} | ||
| onClick={(event) => { | ||
| onSubmit(event, enableOrchestrator); | ||
| if (enableOrchestrator) { | ||
| // TODO. show notification | ||
| // download orchestrator first | ||
| importOrchestractor(projectId, reloadProject, setApplicationLevelError); | ||
| // TODO. update notification | ||
| } | ||
| }} | ||
| /> | ||
| </span> | ||
| </Stack> | ||
| </Stack> | ||
| ); | ||
| }; | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| import React, { useState } from 'react'; | ||
| import formatMessage from 'format-message'; | ||
| import { Link } from 'office-ui-fabric-react/lib/Link'; | ||
| import { Checkbox } from 'office-ui-fabric-react/lib/Checkbox'; | ||
| import { Stack, StackItem } from 'office-ui-fabric-react/lib/Stack'; | ||
| import { PrimaryButton, DefaultButton } from 'office-ui-fabric-react/lib/Button'; | ||
| import { useRecoilValue } from 'recoil'; | ||
|
|
||
| import { dispatcherState } from '../../recoilModel'; | ||
| import { enableOrchestratorDialog } from '../../constants'; | ||
|
|
||
| import { importOrchestrator } from './helper'; | ||
|
|
||
| const learnMoreUrl = 'https://aka.ms/bf-composer-docs-publish-bot'; | ||
|
hatpick marked this conversation as resolved.
Outdated
|
||
|
|
||
| interface OrchestratorProps { | ||
|
hatpick marked this conversation as resolved.
Outdated
|
||
| projectId: string; | ||
| onSubmit: (event: any, userSelected?: boolean) => Promise<void>; | ||
| onBack: (event: any) => void; | ||
|
hatpick marked this conversation as resolved.
Outdated
|
||
| hideBackButton?: boolean; | ||
| } | ||
|
|
||
| const Orchestrator: React.FC<OrchestratorProps> = (props) => { | ||
| const { projectId, onSubmit, onBack } = props; | ||
| const [enableOrchestrator, setEnableOrchestrator] = useState(true); | ||
| const { setApplicationLevelError, reloadProject } = useRecoilValue(dispatcherState); | ||
| const onChange = (ev, check) => { | ||
| setEnableOrchestrator(check); | ||
| }; | ||
| return ( | ||
| <Stack> | ||
| <StackItem styles={{ root: { height: 300, width: '60%' } }}> | ||
| <div style={{ marginBottom: '16px' }}> | ||
| {enableOrchestratorDialog.content} | ||
| <Link href={learnMoreUrl} target="_blank"> | ||
| <div>{formatMessage('Learn more about Orchestractor')}</div> | ||
| </Link> | ||
| </div> | ||
| <Checkbox | ||
| defaultChecked | ||
| label={formatMessage('Make Orchestrator my preferred recognizer for multi-bot projects')} | ||
| styles={{ root: { margin: '20px 0' } }} | ||
| onChange={onChange} | ||
| /> | ||
| </StackItem> | ||
| <Stack horizontal horizontalAlign="space-between"> | ||
| <Stack.Item> | ||
| {!props.hideBackButton && <DefaultButton text={formatMessage('Back')} onClick={onBack} />} | ||
|
hatpick marked this conversation as resolved.
Outdated
|
||
| </Stack.Item> | ||
| <Stack.Item align="end"> | ||
| <span> | ||
|
hatpick marked this conversation as resolved.
Outdated
|
||
| <DefaultButton styles={{ root: { marginRight: '8px' } }} text={formatMessage('Skip')} onClick={onSubmit} /> | ||
| <PrimaryButton | ||
| text={formatMessage('Continue')} | ||
| onClick={(event) => { | ||
| onSubmit(event, enableOrchestrator); | ||
| if (enableOrchestrator) { | ||
| // TODO. show notification | ||
|
hatpick marked this conversation as resolved.
Outdated
|
||
| // download orchestrator first | ||
| importOrchestrator(projectId, reloadProject, setApplicationLevelError); | ||
| // TODO. update notification | ||
| } | ||
| }} | ||
| /> | ||
| </span> | ||
| </Stack.Item> | ||
| </Stack> | ||
| </Stack> | ||
| ); | ||
| }; | ||
|
|
||
| Orchestrator.defaultProps = { | ||
|
hatpick marked this conversation as resolved.
Outdated
|
||
| hideBackButton: false, | ||
| }; | ||
|
|
||
| export { OrchestratorProps, Orchestrator }; | ||
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
76 changes: 76 additions & 0 deletions
76
Composer/packages/client/src/components/Orchestrator/OrchestratorForSkillsDialog.tsx
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,76 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| import { DialogTypes, DialogWrapper } from '@bfc/ui-shared/lib/components/DialogWrapper'; | ||
| import { SDKKinds } from '@botframework-composer/types'; | ||
| import formatMessage from 'format-message'; | ||
| import React, { useMemo } from 'react'; | ||
| import { useRecoilState, useRecoilValue } from 'recoil'; | ||
|
|
||
| import { | ||
| designPageLocationState, | ||
| dispatcherState, | ||
| localeState, | ||
| orchestratorForSkillsDialogState, | ||
| rootBotProjectIdSelector, | ||
| } from '../../recoilModel'; | ||
| import { recognizersSelectorFamily } from '../../recoilModel/selectors/recognizers'; | ||
| import { Orchestrator } from '../AddRemoteSkillModal/Orchestrator'; | ||
|
|
||
| export const OrchestratorForSkillsDialog = (props) => { | ||
|
hatpick marked this conversation as resolved.
Outdated
|
||
| const [showOrchestratorDialog, setShowOrchestratorDialog] = useRecoilState(orchestratorForSkillsDialogState); | ||
| const rootProjectId = useRecoilValue(rootBotProjectIdSelector) || ''; | ||
| const { dialogId } = useRecoilValue(designPageLocationState(rootProjectId)); | ||
| const locale = useRecoilValue(localeState(rootProjectId)); | ||
| const curRecognizers = useRecoilValue(recognizersSelectorFamily(rootProjectId)); | ||
|
|
||
| const { updateRecognizer } = useRecoilValue(dispatcherState); | ||
|
|
||
| const hasOrchestrator = useMemo(() => { | ||
| const fileName = `${dialogId}.${locale}.lu.dialog`; | ||
| return curRecognizers.some((f) => f.id === fileName && f.content.$kind === SDKKinds.OrchestratorRecognizer); | ||
| }, [curRecognizers, dialogId, locale]); | ||
|
|
||
| const handleOrchestratorSubmit = async (event: any, enable?: boolean) => { | ||
| event.preventDefault(); | ||
| if (enable) { | ||
| // update recognizor type to orchestrator | ||
| await updateRecognizer(rootProjectId, dialogId, SDKKinds.OrchestratorRecognizer); | ||
| } | ||
| setShowOrchestratorDialog(false); | ||
| }; | ||
|
|
||
| const isVisible = () => { | ||
|
hatpick marked this conversation as resolved.
Outdated
|
||
| if (showOrchestratorDialog) { | ||
| if (hasOrchestrator) { | ||
| setShowOrchestratorDialog(false); | ||
| return false; | ||
| } | ||
| return true; | ||
| } | ||
| return false; | ||
| }; | ||
|
|
||
| const onDismissHandler = (event: any) => { | ||
| setShowOrchestratorDialog(false); | ||
| }; | ||
|
|
||
| return ( | ||
| <DialogWrapper | ||
| dialogType={DialogTypes.CreateFlow} | ||
| isOpen={isVisible()} | ||
| subText={formatMessage('Enable Orchestrator as the recognizer at the root level to add this skill')} | ||
|
Contributor
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. nit: a better message to explain would be something like:
Member
Author
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 will leave this to UX, but found that these strings were declared in constants for the remote skill flow, switched to those here. |
||
| title={formatMessage('Enable Orchestrator')} | ||
| onDismiss={onDismissHandler} | ||
| > | ||
| <Orchestrator | ||
| hideBackButton | ||
| projectId={rootProjectId} | ||
| onBack={() => { | ||
|
hatpick marked this conversation as resolved.
Outdated
|
||
| setShowOrchestratorDialog(false); | ||
| }} | ||
| onSubmit={handleOrchestratorSubmit} | ||
| /> | ||
| </DialogWrapper> | ||
| ); | ||
| }; | ||
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
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.