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 376
feature: add new copy UI for provision #6728
Merged
Merged
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8460ec3
Created choose action step
GeoffCoxMSFT 696b8c2
Updates
GeoffCoxMSFT aa4313b
Merge branch 'main' into gcox/newInfoForProvision
GeoffCoxMSFT b188747
Merge branch 'main' into gcox/newInfoForProvision
GeoffCoxMSFT bf837ec
PR fixes
GeoffCoxMSFT 935971a
Merge branch 'gcox/newInfoForProvision' of https://github.com/microso…
GeoffCoxMSFT 89abbf7
Merge branch 'main' into gcox/newInfoForProvision
GeoffCoxMSFT ae40202
Updated links
GeoffCoxMSFT 7a17552
Merge branch 'gcox/newInfoForProvision' of https://github.com/microso…
GeoffCoxMSFT 5b5179e
Merge branch 'main' into gcox/newInfoForProvision
GeoffCoxMSFT 5170bc1
Merge branch 'main' into gcox/newInfoForProvision
GeoffCoxMSFT 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
264 changes: 264 additions & 0 deletions
264
extensions/azurePublish/src/components/ChooseProvisionAction.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,264 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| import * as React from 'react'; | ||
| import formatMessage from 'format-message'; | ||
| import styled from '@emotion/styled'; | ||
| import { ChoiceGroup, IChoiceGroupOption } from 'office-ui-fabric-react/lib/ChoiceGroup'; | ||
| import { Stack } from 'office-ui-fabric-react/lib/Stack'; | ||
| import { Text } from 'office-ui-fabric-react/lib/Text'; | ||
| import { FluentTheme, NeutralColors } from '@uifabric/fluent-theme'; | ||
| import { Link } from 'office-ui-fabric-react/lib/Link'; | ||
|
|
||
| // ---------- Styles ---------- // | ||
|
|
||
| const Root = styled.div` | ||
| height: 100%; | ||
| width: 100%; | ||
| display: grid; | ||
| grid-template-columns: 30% 1fr; | ||
| grid-template-rows: 1fr; | ||
| `; | ||
|
|
||
| const ChoicesPane = styled.div` | ||
| height: 100%; | ||
| width: 100%; | ||
| `; | ||
|
|
||
| const ContentPane = styled(Stack)` | ||
| border-left: 1px solid ${NeutralColors.gray30}; | ||
| height: 100%; | ||
| `; | ||
|
|
||
| const Content = styled(Stack)` | ||
| padding: 20px; | ||
| `; | ||
|
|
||
| const Title = styled(Text)` | ||
| font-size: ${FluentTheme.fonts.xLarge.fontSize}; | ||
| margin: 8px 0; | ||
| `; | ||
|
|
||
| const Summary = styled(Stack)` | ||
| margin: 8px 0; | ||
| `; | ||
|
|
||
| const Details = styled(Stack)` | ||
| margin: 10px 0; | ||
| `; | ||
|
|
||
| const Instruction = styled(Stack)` | ||
| margin: 10px 0; | ||
| `; | ||
|
|
||
| const InstructionTitle = styled(Text)` | ||
| font-size: ${FluentTheme.fonts.smallPlus.fontSize}; | ||
| text-transform: uppercase; | ||
| margin: 8px 0; | ||
| `; | ||
|
|
||
| const InstructionDetails = styled.div` | ||
| margin: 10px 0; | ||
| `; | ||
|
|
||
| const ResourceTitle = styled(Stack)` | ||
| margin: 10px 0; | ||
| `; | ||
|
|
||
| const LearnMoreLink = styled(Link)` | ||
| user-select: none; | ||
| `; | ||
|
|
||
| // ---------- CreateActionContent ---------- // | ||
|
|
||
| const CreateActionContent = () => { | ||
| return ( | ||
| <Content> | ||
| <Title>{formatMessage('Create New Resources')}</Title> | ||
| <Summary> | ||
| <Text> | ||
| {formatMessage( | ||
| 'Select this option when you want to provision new Azure resources and publish a bot. A subscription to Microsoft Azure is required.' | ||
| )} | ||
| </Text> | ||
| </Summary> | ||
| <Details> | ||
| <Instruction> | ||
| <InstructionTitle>{formatMessage('Step 1')}</InstructionTitle> | ||
| <InstructionDetails> | ||
| <Text>{formatMessage('Sign in to Azure.')}</Text> | ||
| </InstructionDetails> | ||
| </Instruction> | ||
| <Instruction> | ||
| <InstructionTitle>{formatMessage('Step 2')}</InstructionTitle> | ||
| <InstructionDetails> | ||
| <Text> | ||
| {formatMessage( | ||
| 'Select tenant & subscription, enter resource group name and resource name, and select region.' | ||
| )} | ||
| </Text> | ||
| </InstructionDetails> | ||
| </Instruction> | ||
| <Instruction> | ||
| <InstructionTitle>{formatMessage('Step 3')}</InstructionTitle> | ||
| <InstructionDetails> | ||
| <Text> | ||
| {formatMessage( | ||
| 'Review & create new resources. Once provisioned these resources will be available in your Azure portal.' | ||
| )} | ||
| </Text> | ||
| </InstructionDetails> | ||
| </Instruction> | ||
| </Details> | ||
| <LearnMoreLink>{formatMessage('Learn More')}</LearnMoreLink> | ||
| </Content> | ||
| ); | ||
| }; | ||
|
|
||
| const ImportActionContent = () => { | ||
| return ( | ||
| <Content> | ||
| <Title>{formatMessage('Import existing resources')}</Title> | ||
| <Summary> | ||
| <p> | ||
| <Text>{formatMessage('Select this option to import existing Azure resources and publish a bot.')}</Text> | ||
| </p> | ||
| <p> | ||
| <Text> | ||
| {formatMessage( | ||
| 'Edit the JSON file in the Publish Configuration field. You will need to find the values of associated resources in your Azure portal. A list of required and optional resources may include:' | ||
| )} | ||
| </Text> | ||
| </p> | ||
| </Summary> | ||
| <Details> | ||
| <ResourceTitle> | ||
| <Text>Microsoft Application Registration</Text> | ||
|
GeoffCoxMSFT marked this conversation as resolved.
Outdated
|
||
| </ResourceTitle> | ||
| <ResourceTitle> | ||
| <Text>Azure Hosting</Text> | ||
| </ResourceTitle> | ||
| <ResourceTitle> | ||
| <Text>Microsoft Bot Channels Registration </Text> | ||
| </ResourceTitle> | ||
| <ResourceTitle> | ||
| <Text>Azure Cosmos DB </Text> | ||
| </ResourceTitle> | ||
| <ResourceTitle> | ||
| <Text>Application Insights </Text> | ||
| </ResourceTitle> | ||
| <ResourceTitle> | ||
| <Text>Azure Blob Storage </Text> | ||
| </ResourceTitle> | ||
| <ResourceTitle> | ||
| <Text>Microsoft Language Understanding (LUIS)</Text> | ||
| </ResourceTitle> | ||
| <ResourceTitle> | ||
| <Text>Microsoft QnA Maker </Text> | ||
| </ResourceTitle> | ||
| </Details> | ||
| <LearnMoreLink>{formatMessage('Learn More')}</LearnMoreLink> | ||
|
GeoffCoxMSFT marked this conversation as resolved.
Outdated
|
||
| </Content> | ||
| ); | ||
| }; | ||
|
|
||
| const GenerateActionContent = () => { | ||
| return ( | ||
| <Content> | ||
| <Title>{formatMessage('Hand off to admin')}</Title> | ||
| <Summary> | ||
| <Text> | ||
| {formatMessage( | ||
| 'Select this option to request your Azure admin to provision resources on your behalf, for example, when you don’t have proper permissions to use Azure or you want to generate resources from a sovereign cloud.' | ||
| )} | ||
| </Text> | ||
| </Summary> | ||
| <Details> | ||
| <Instruction> | ||
| <InstructionTitle>{formatMessage('Step 1')}</InstructionTitle> | ||
| <InstructionDetails> | ||
| <Text> | ||
| {formatMessage( | ||
| 'Add resources you need for the bot and generate a resource request to share with your Azure admin.' | ||
| )} | ||
| </Text> | ||
| </InstructionDetails> | ||
| </Instruction> | ||
| <Instruction> | ||
| <InstructionTitle>{formatMessage('Step 2')}</InstructionTitle> | ||
| <InstructionDetails> | ||
| <Text> | ||
| {formatMessage( | ||
| 'Once you get the resource details from your Azure admin, use them to import existing resources.' | ||
| )} | ||
| </Text> | ||
| </InstructionDetails> | ||
| </Instruction> | ||
| </Details> | ||
| <LearnMoreLink>{formatMessage('Learn More')}</LearnMoreLink> | ||
|
GeoffCoxMSFT marked this conversation as resolved.
Outdated
|
||
| </Content> | ||
| ); | ||
| }; | ||
|
|
||
| // ---------- Helpers ---------- // | ||
|
|
||
| const choiceOptions: IChoiceGroupOption[] = [ | ||
| { key: 'create', text: 'Create new resources' }, | ||
| { key: 'import', text: 'Import existing resources' }, | ||
| { key: 'generate', text: 'Hand off to admin' }, | ||
| ]; | ||
|
|
||
| // ---------- ChooseProvisionActionStep ---------- // | ||
|
|
||
| type ProvisionAction = 'create' | 'import' | 'generate'; | ||
|
|
||
| type Props = { | ||
| /** | ||
| * The optional choice of provisioning action. | ||
| * Defaults to 'create'. | ||
| */ | ||
| choice?: ProvisionAction; | ||
|
|
||
| onChoiceChanged: (choice: ProvisionAction) => void; | ||
| }; | ||
|
|
||
| /** | ||
| * Provides the step where the user can choose a provisioning action. | ||
| */ | ||
| export const ChooseProvisionAction = ({ choice: controlledChoice, onChoiceChanged }) => { | ||
| const [choice, setChoice] = React.useState(controlledChoice || 'create'); | ||
|
|
||
| React.useEffect(() => { | ||
| setChoice(controlledChoice || 'create'); | ||
| }, [controlledChoice]); | ||
|
|
||
| React.useEffect(() => { | ||
| onChoiceChanged(choice); | ||
| }, [choice]); | ||
|
|
||
| const renderContent = React.useMemo(() => { | ||
| switch (choice) { | ||
| case 'create': | ||
| return <CreateActionContent />; | ||
| case 'import': | ||
| return <ImportActionContent />; | ||
| case 'generate': | ||
| return <GenerateActionContent />; | ||
| } | ||
| }, [choice]); | ||
|
|
||
| return ( | ||
| <Root> | ||
| <ChoicesPane> | ||
| <ChoiceGroup | ||
| options={choiceOptions} | ||
| selectedKey={choice} | ||
| onChange={(_e, option) => { | ||
| setChoice(option.key); | ||
| }} | ||
| /> | ||
| </ChoicesPane> | ||
| <ContentPane>{renderContent}</ContentPane> | ||
| </Root> | ||
| ); | ||
| }; | ||
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.