From 0f3d69a68d510bab2e5c7c34ae21757248648cfb Mon Sep 17 00:00:00 2001 From: Vamsi Modem Date: Mon, 3 May 2021 09:27:06 -0700 Subject: [PATCH 1/7] Added auth flow MSA Accounts --- .../ManageService/ManageService.tsx | 227 ++++++++++++++---- .../botProject/RootBotExternalService.tsx | 2 +- 2 files changed, 185 insertions(+), 44 deletions(-) diff --git a/Composer/packages/client/src/components/ManageService/ManageService.tsx b/Composer/packages/client/src/components/ManageService/ManageService.tsx index bac5e6f1d5..357b3cf339 100644 --- a/Composer/packages/client/src/components/ManageService/ManageService.tsx +++ b/Composer/packages/client/src/components/ManageService/ManageService.tsx @@ -22,6 +22,7 @@ import { ChoiceGroup, IChoiceGroupOption } from 'office-ui-fabric-react/lib/Choi import { ProvisionHandoff } from '@bfc/ui-shared'; import sortBy from 'lodash/sortBy'; import { NeutralColors } from '@uifabric/fluent-theme'; +import { AzureTenant } from '@botframework-composer/types'; import TelemetryClient from '../../telemetry/TelemetryClient'; import { AuthClient } from '../../utils/authClient'; @@ -59,7 +60,12 @@ type KeyRec = { resourceGroup: string; key: string; }; - +enum Page { + Intro = 1, + Subscription = 2, + ResourceCreation = 2.1, + Outcome = 3, +} const dropdownStyles = { dropdown: { width: '100%', marginBottom: 10 } }; const inputStyles = { root: { width: '100%', marginBottom: 10 } }; const summaryLabelStyles = { display: 'block', color: '#605E5C', fontSize: 14 }; @@ -74,13 +80,15 @@ export const ManageService = (props: ManageServiceProps) => { const { setApplicationLevelError } = useRecoilValue(dispatcherState); const [subscriptionId, setSubscription] = useState(''); + const [tenantId, setTenantId] = useState(undefined); const [resourceGroups, setResourceGroups] = useState([]); const [createResourceGroup, setCreateResourceGroup] = useState(false); const [newResourceGroupName, setNewResourceGroupName] = useState(''); const [resourceGroupKey, setResourceGroupKey] = useState(''); const [resourceGroup, setResourceGroup] = useState(''); const [tier, setTier] = useState(''); - + const [allTenants, setAllTenants] = useState([]); + const [tenantsErrorMessage, setTenantsErrorMessage] = useState(undefined); const [showHandoff, setShowHandoff] = useState(false); const [resourceName, setResourceName] = useState(''); const [loading, setLoading] = useState(undefined); @@ -89,6 +97,7 @@ export const ManageService = (props: ManageServiceProps) => { const [key, setKey] = useState(''); const [region, setRegion] = useState(''); const [availableSubscriptions, setAvailableSubscriptions] = useState([]); + const [subscriptionsErrorMessage, setSubscriptionsErrorMessage] = useState(); const [keys, setKeys] = useState([]); const [currentPage, setCurrentPage] = useState(1); @@ -132,6 +141,69 @@ export const ManageService = (props: ManageServiceProps) => { return []; } }; + useEffect(() => { + if (!userShouldProvideTokens()) { + AuthClient.getTenants() + .then((tenants) => { + setAllTenants(tenants); + if (tenants.length === 0) { + setTenantsErrorMessage(formatMessage('No Azure Directories were found.')); + } else if (tenants.length === 1) { + setTenantId(tenants[0].tenantId); + } else { + setTenantsErrorMessage(undefined); + } + }) + .catch((err) => { + setTenantsErrorMessage( + formatMessage('There was a problem loading Azure directories. {errMessage}', { + errMessage: err.message || err.toString(), + }) + ); + }); + } + }, []); + useEffect(() => { + if (tenantId) { + AuthClient.getARMTokenForTenant(tenantId) + .then((token) => { + setToken(token); + setTenantsErrorMessage(undefined); + }) + .catch((err) => { + setTenantId(undefined); + setTenantsErrorMessage( + formatMessage( + 'There was a problem getting the access token for the current Azure directory. {errMessage}', + { + errMessage: err.message || err.toString(), + } + ) + ); + setTenantsErrorMessage(err.message || err.toString()); + }); + } + }, [tenantId]); + useEffect(() => { + if (token) { + setAvailableSubscriptions([]); + setSubscriptionsErrorMessage(undefined); + getSubscriptions(token) + .then((data) => { + setAvailableSubscriptions(data); + if (data.length === 0) { + setSubscriptionsErrorMessage( + formatMessage( + 'Your subscription list is empty, please add your subscription, or login with another account.' + ) + ); + } + }) + .catch((err) => { + setSubscriptionsErrorMessage(err.message); + }); + } + }, [token]); const hasAuth = async () => { let newtoken = ''; @@ -140,22 +212,11 @@ export const ManageService = (props: ManageServiceProps) => { setShowAuthDialog(true); } newtoken = getTokenFromCache('accessToken'); - } else { - newtoken = await AuthClient.getAccessToken(armScopes); } - - setToken(newtoken); - if (newtoken) { - // reset the list - setAvailableSubscriptions([]); - - // fetch list of available subscriptions - setAvailableSubscriptions(await getSubscriptions(newtoken)); - - // go on to the next page post-auth - setCurrentPage(2); + setToken(newtoken); } + setCurrentPage(2); }; useEffect(() => { @@ -441,13 +502,13 @@ export const ManageService = (props: ManageServiceProps) => { ); }; - const renderPageOne = () => { + const pageOne = () => { return (

{formatMessage( - 'Choose from existing {service} keys, create a new {service} resource, or generate a request to handoff to your Azure admin. ', + 'Select your Azure directory, then choose the subscription where your existing resource is located and the keys you want to use.', { service: props.serviceName } )} {props.learnMore ? ( @@ -472,13 +533,13 @@ export const ManageService = (props: ManageServiceProps) => { ); }; - const renderPageChoose = () => { + const chooseResource = () => { return (

{formatMessage( - 'Choose from existing {service} keys, create a new {service} resource, or generate a request to handoff to your Azure admin. ', + 'Select your Azure directory, then choose the subscription where you’d like your new {service} resource.', { service: props.serviceName } )} {props.learnMore ? ( @@ -489,8 +550,22 @@ export const ManageService = (props: ManageServiceProps) => {

({ key: t.tenantId, text: t.displayName }))} + selectedKey={tenantId} + styles={dropdownStyles} + onChange={(_e, o) => { + setTenantId(o?.key as string); + }} + /> + 0)} - label={formatMessage('Select subscription')} + errorMessage={subscriptionsErrorMessage} + label={formatMessage('Subscription')} options={ availableSubscriptions ?.filter((p) => p.subscriptionId && p.displayName) @@ -551,7 +626,7 @@ export const ManageService = (props: ManageServiceProps) => { ); }; - const renderPageCreate = () => { + const resourceCreator = () => { return (
@@ -563,21 +638,6 @@ export const ManageService = (props: ManageServiceProps) => {

- 0)} - label={formatMessage('Select subscription')} - options={ - availableSubscriptions - ?.filter((p) => p.subscriptionId && p.displayName) - .map((p) => { - return { key: p.subscriptionId ?? '', text: p.displayName ?? 'Unnamed' }; - }) ?? [] - } - placeholder={formatMessage('Select one')} - selectedKey={subscriptionId} - styles={dropdownStyles} - onChange={onChangeSubscription} - /> { setCurrentPage(1)} + onClick={() => setCurrentPage(2)} /> { ); }; - const renderPageThree = () => { + const pageThree = () => { return (
@@ -695,6 +755,90 @@ export const ManageService = (props: ManageServiceProps) => { ); }; + const subscriptionSelector = () => { + return ( +
+
+

+ {formatMessage( + 'Select your Azure directory, then choose the subscription where you’d like your new {service} resource.', + { service: props.serviceName } + )} + {props.learnMore ? ( + + {formatMessage('Learn more')} + + ) : null} +

+
+ ({ key: t.tenantId, text: t.displayName }))} + selectedKey={tenantId} + styles={dropdownStyles} + onChange={(_e, o) => { + setTenantId(o?.key as string); + }} + /> + 0)} + errorMessage={subscriptionsErrorMessage} + label={formatMessage('Subscription')} + options={ + availableSubscriptions + ?.filter((p) => p.subscriptionId && p.displayName) + .map((p) => { + return { key: p.subscriptionId ?? '', text: p.displayName ?? 'Unnamed' }; + }) ?? [] + } + placeholder={formatMessage('Select one')} + selectedKey={subscriptionId} + styles={dropdownStyles} + onChange={onChangeSubscription} + /> +
+
+ + {loading && } + setCurrentPage(1)} + /> + setCurrentPage(2.1)} + /> + + +
+ ); + }; + + const getPage = () => { + switch (currentPage as Page) { + case Page.Intro: + return pageOne(); + case Page.Subscription: { + if (nextAction === 'choose') { + return chooseResource(); + } + return subscriptionSelector(); + } + case Page.ResourceCreation: + return resourceCreator(); + case Page.Outcome: + return pageThree(); + default: + return null; + } + }; + return ( {showAuthDialog && ( @@ -726,7 +870,7 @@ export const ManageService = (props: ManageServiceProps) => { dialogContentProps={{ type: DialogType.normal, title: - currentPage === 2 + nextAction === 'create' ? formatMessage('Create new {service} resource', { service: props.serviceName }) : formatMessage('Select {service} keys', { service: props.serviceName }), }} @@ -737,10 +881,7 @@ export const ManageService = (props: ManageServiceProps) => { }} onDismiss={loading ? () => {} : props.onDismiss} > - {currentPage === 1 && renderPageOne()} - {currentPage === 2 && nextAction === 'choose' && renderPageChoose()} - {currentPage === 2 && nextAction === 'create' && renderPageCreate()} - {currentPage === 3 && renderPageThree()} + {getPage()} ); diff --git a/Composer/packages/client/src/pages/botProject/RootBotExternalService.tsx b/Composer/packages/client/src/pages/botProject/RootBotExternalService.tsx index 50f06d7447..ee1f9d6bda 100644 --- a/Composer/packages/client/src/pages/botProject/RootBotExternalService.tsx +++ b/Composer/packages/client/src/pages/botProject/RootBotExternalService.tsx @@ -429,7 +429,7 @@ export const RootBotExternalService: React.FC = (pr ), a2: ({ children }) => ( From 09359021e2e87845675a72f507ec692bf1e76848 Mon Sep 17 00:00:00 2001 From: Vamsi Modem Date: Mon, 3 May 2021 11:20:51 -0700 Subject: [PATCH 2/7] Code review changes --- .../ManageService/ManageService.tsx | 120 +++++++++--------- 1 file changed, 57 insertions(+), 63 deletions(-) diff --git a/Composer/packages/client/src/components/ManageService/ManageService.tsx b/Composer/packages/client/src/components/ManageService/ManageService.tsx index 357b3cf339..cc559763ba 100644 --- a/Composer/packages/client/src/components/ManageService/ManageService.tsx +++ b/Composer/packages/client/src/components/ManageService/ManageService.tsx @@ -27,7 +27,6 @@ import { AzureTenant } from '@botframework-composer/types'; import TelemetryClient from '../../telemetry/TelemetryClient'; import { AuthClient } from '../../utils/authClient'; import { AuthDialog } from '../../components/Auth/AuthDialog'; -import { armScopes } from '../../constants'; import { getTokenFromCache, isShowAuthDialog, userShouldProvideTokens } from '../../utils/auth'; import { dispatcherState } from '../../recoilModel/atoms'; @@ -60,12 +59,13 @@ type KeyRec = { resourceGroup: string; key: string; }; -enum Page { - Intro = 1, - Subscription = 2, - ResourceCreation = 2.1, - Outcome = 3, -} +type Step = 'intro' | 'subscription' | 'resourceCreation' | 'outcome'; +// enum Step { +// Intro = 1, +// Subscription = 2, +// ResourceCreation = 2.1, +// Outcome = 3, +// } const dropdownStyles = { dropdown: { width: '100%', marginBottom: 10 } }; const inputStyles = { root: { width: '100%', marginBottom: 10 } }; const summaryLabelStyles = { display: 'block', color: '#605E5C', fontSize: 14 }; @@ -80,7 +80,7 @@ export const ManageService = (props: ManageServiceProps) => { const { setApplicationLevelError } = useRecoilValue(dispatcherState); const [subscriptionId, setSubscription] = useState(''); - const [tenantId, setTenantId] = useState(undefined); + const [tenantId, setTenantId] = useState(''); const [resourceGroups, setResourceGroups] = useState([]); const [createResourceGroup, setCreateResourceGroup] = useState(false); const [newResourceGroupName, setNewResourceGroupName] = useState(''); @@ -100,7 +100,7 @@ export const ManageService = (props: ManageServiceProps) => { const [subscriptionsErrorMessage, setSubscriptionsErrorMessage] = useState(); const [keys, setKeys] = useState([]); - const [currentPage, setCurrentPage] = useState(1); + const [currentStep, setCurrentStep] = useState('intro'); const [outcomeDescription, setOutcomeDescription] = useState(''); const [outcomeSummary, setOutcomeSummary] = useState(); const [outcomeError, setOutcomeError] = useState(false); @@ -141,6 +141,7 @@ export const ManageService = (props: ManageServiceProps) => { return []; } }; + useEffect(() => { if (!userShouldProvideTokens()) { AuthClient.getTenants() @@ -163,6 +164,7 @@ export const ManageService = (props: ManageServiceProps) => { }); } }, []); + useEffect(() => { if (tenantId) { AuthClient.getARMTokenForTenant(tenantId) @@ -171,7 +173,6 @@ export const ManageService = (props: ManageServiceProps) => { setTenantsErrorMessage(undefined); }) .catch((err) => { - setTenantId(undefined); setTenantsErrorMessage( formatMessage( 'There was a problem getting the access token for the current Azure directory. {errMessage}', @@ -184,6 +185,7 @@ export const ManageService = (props: ManageServiceProps) => { }); } }, [tenantId]); + useEffect(() => { if (token) { setAvailableSubscriptions([]); @@ -216,14 +218,14 @@ export const ManageService = (props: ManageServiceProps) => { if (newtoken) { setToken(newtoken); } - setCurrentPage(2); + setCurrentStep('subscription'); }; useEffect(() => { // reset the ui setSubscription(''); setKeys([]); - setCurrentPage(1); + setCurrentStep('intro'); }, [props.hidden]); const handleRegionOnChange = (e, value: IDropdownOption | undefined) => { @@ -323,7 +325,7 @@ export const ManageService = (props: ManageServiceProps) => { ); setOutcomeSummary(

{err.message}

); setOutcomeError(true); - setCurrentPage(3); + setCurrentStep('outcome'); setLoading(undefined); return; } @@ -373,7 +375,7 @@ export const ManageService = (props: ManageServiceProps) => { ); setOutcomeSummary(

{err.message}

); setOutcomeError(true); - setCurrentPage(3); + setCurrentStep('outcome'); setLoading(undefined); return; } @@ -407,7 +409,7 @@ export const ManageService = (props: ManageServiceProps) => { ); setOutcomeError(false); - setCurrentPage(3); + setCurrentStep('outcome'); } }; @@ -474,7 +476,7 @@ export const ManageService = (props: ManageServiceProps) => { ); setOutcomeError(false); - setCurrentPage(3); + setCurrentStep('outcome'); }; const performNextAction = () => { @@ -502,7 +504,7 @@ export const ManageService = (props: ManageServiceProps) => { ); }; - const pageOne = () => { + const renderIntroStep = () => { return (
@@ -522,9 +524,9 @@ export const ManageService = (props: ManageServiceProps) => {
- + @@ -533,7 +535,7 @@ export const ManageService = (props: ManageServiceProps) => { ); }; - const chooseResource = () => { + const renderChooseResourceStep = () => { return (
@@ -551,7 +553,7 @@ export const ManageService = (props: ManageServiceProps) => {
({ key: t.tenantId, text: t.displayName }))} @@ -570,7 +572,7 @@ export const ManageService = (props: ManageServiceProps) => { availableSubscriptions ?.filter((p) => p.subscriptionId && p.displayName) .map((p) => { - return { key: p.subscriptionId ?? '', text: p.displayName ?? 'Unnamed' }; + return { key: p.subscriptionId ?? '', text: p.displayName ?? formatMessage('Unnamed') }; }) ?? [] } placeholder={formatMessage('Select one')} @@ -610,23 +612,19 @@ export const ManageService = (props: ManageServiceProps) => {
{loading && } - setCurrentPage(1)} - /> + setCurrentStep('intro')} /> - +
); }; - const resourceCreator = () => { + const renderResourseCreatorStep = () => { return (
@@ -639,7 +637,7 @@ export const ManageService = (props: ManageServiceProps) => {
{ @@ -657,7 +655,7 @@ export const ManageService = (props: ManageServiceProps) => { required aria-label={formatMessage('Resource group name')} data-testid={'resourceGroupName'} - disabled={!subscriptionId || loading !== undefined} + disabled={!subscriptionId || !!loading} id={'resourceGroupName'} label={formatMessage('Resource group name')} placeholder={formatMessage('Enter name for new resource group')} @@ -672,7 +670,7 @@ export const ManageService = (props: ManageServiceProps) => { required aria-label={formatMessage('Region')} data-testid={'rootRegion'} - disabled={!subscriptionId || loading !== undefined} + disabled={!subscriptionId || !!loading} id={'region'} label={formatMessage('Region')} options={locationList} @@ -685,7 +683,7 @@ export const ManageService = (props: ManageServiceProps) => { required aria-label={formatMessage('Resource name')} data-testid={'resourceName'} - disabled={!subscriptionId || loading !== undefined} + disabled={!subscriptionId || !!loading} id={'resourceName'} label={formatMessage('Resource name')} placeholder={formatMessage('Enter name for new resources')} @@ -698,7 +696,7 @@ export const ManageService = (props: ManageServiceProps) => { required aria-label={formatMessage('Pricing tier')} data-testid={'tier'} - disabled={!subscriptionId || loading !== undefined} + disabled={!subscriptionId || !!loading} id={'tier'} label={formatMessage('Pricing tier')} options={props.tiers} @@ -713,13 +711,13 @@ export const ManageService = (props: ManageServiceProps) => { {loading && } setCurrentPage(2)} + onClick={() => setCurrentStep('subscription')} /> { text={formatMessage('Next')} onClick={createService} /> - +
); }; - const pageThree = () => { + const renderOutcomeStep = () => { return (
@@ -748,7 +746,7 @@ export const ManageService = (props: ManageServiceProps) => { )}
- {outcomeError && setCurrentPage(1)} />} + {outcomeError && setCurrentStep('intro')} />}
@@ -773,7 +771,7 @@ export const ManageService = (props: ManageServiceProps) => {
({ key: t.tenantId, text: t.displayName }))} @@ -785,14 +783,14 @@ export const ManageService = (props: ManageServiceProps) => { /> 0)} + disabled={availableSubscriptions?.length === 0} errorMessage={subscriptionsErrorMessage} label={formatMessage('Subscription')} options={ availableSubscriptions ?.filter((p) => p.subscriptionId && p.displayName) .map((p) => { - return { key: p.subscriptionId ?? '', text: p.displayName ?? 'Unnamed' }; + return { key: p.subscriptionId ?? '', text: p.displayName ?? formatMessage('Unnamed') }; }) ?? [] } placeholder={formatMessage('Select one')} @@ -804,36 +802,32 @@ export const ManageService = (props: ManageServiceProps) => {
{loading && } - setCurrentPage(1)} - /> + setCurrentStep('intro')} /> setCurrentPage(2.1)} + onClick={() => setCurrentStep('resourceCreation')} /> - +
); }; - const getPage = () => { - switch (currentPage as Page) { - case Page.Intro: - return pageOne(); - case Page.Subscription: { + const renderCurrentStep = () => { + switch (currentStep) { + case 'intro': + return renderIntroStep(); + case 'subscription': { if (nextAction === 'choose') { - return chooseResource(); + return renderChooseResourceStep(); } return subscriptionSelector(); } - case Page.ResourceCreation: - return resourceCreator(); - case Page.Outcome: - return pageThree(); + case 'resourceCreation': + return renderResourseCreatorStep(); + case 'outcome': + return renderOutcomeStep(); default: return null; } @@ -881,7 +875,7 @@ export const ManageService = (props: ManageServiceProps) => { }} onDismiss={loading ? () => {} : props.onDismiss} > - {getPage()} + {renderCurrentStep()} ); From f9725f37f1d8fb1de226e5b88dce3259246fd75b Mon Sep 17 00:00:00 2001 From: Vamsi Modem Date: Mon, 3 May 2021 11:22:00 -0700 Subject: [PATCH 3/7] Removed unnecessary code --- .../client/src/components/ManageService/ManageService.tsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Composer/packages/client/src/components/ManageService/ManageService.tsx b/Composer/packages/client/src/components/ManageService/ManageService.tsx index cc559763ba..c08130b4b4 100644 --- a/Composer/packages/client/src/components/ManageService/ManageService.tsx +++ b/Composer/packages/client/src/components/ManageService/ManageService.tsx @@ -59,13 +59,9 @@ type KeyRec = { resourceGroup: string; key: string; }; + type Step = 'intro' | 'subscription' | 'resourceCreation' | 'outcome'; -// enum Step { -// Intro = 1, -// Subscription = 2, -// ResourceCreation = 2.1, -// Outcome = 3, -// } + const dropdownStyles = { dropdown: { width: '100%', marginBottom: 10 } }; const inputStyles = { root: { width: '100%', marginBottom: 10 } }; const summaryLabelStyles = { display: 'block', color: '#605E5C', fontSize: 14 }; From 9525617433f06e8e1df2892ce9f197af5a082273 Mon Sep 17 00:00:00 2001 From: Vamsi Modem Date: Mon, 3 May 2021 11:26:12 -0700 Subject: [PATCH 4/7] changed function from 'subscriptionSelector' to 'renderSubscriptionSelectionStep' --- .../client/src/components/ManageService/ManageService.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Composer/packages/client/src/components/ManageService/ManageService.tsx b/Composer/packages/client/src/components/ManageService/ManageService.tsx index c08130b4b4..f08d55a353 100644 --- a/Composer/packages/client/src/components/ManageService/ManageService.tsx +++ b/Composer/packages/client/src/components/ManageService/ManageService.tsx @@ -749,7 +749,7 @@ export const ManageService = (props: ManageServiceProps) => { ); }; - const subscriptionSelector = () => { + const renderSubscriptionSelectionStep = () => { return (
@@ -818,7 +818,7 @@ export const ManageService = (props: ManageServiceProps) => { if (nextAction === 'choose') { return renderChooseResourceStep(); } - return subscriptionSelector(); + return renderSubscriptionSelectionStep(); } case 'resourceCreation': return renderResourseCreatorStep(); From f7010b75c64444bb1bb92aee37f2b9c03c85b988 Mon Sep 17 00:00:00 2001 From: Vamsi Modem Date: Mon, 3 May 2021 12:17:43 -0700 Subject: [PATCH 5/7] Minor UI fixes --- .../client/src/components/ManageService/ManageService.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Composer/packages/client/src/components/ManageService/ManageService.tsx b/Composer/packages/client/src/components/ManageService/ManageService.tsx index f08d55a353..c205c4e35a 100644 --- a/Composer/packages/client/src/components/ManageService/ManageService.tsx +++ b/Composer/packages/client/src/components/ManageService/ManageService.tsx @@ -67,7 +67,7 @@ const inputStyles = { root: { width: '100%', marginBottom: 10 } }; const summaryLabelStyles = { display: 'block', color: '#605E5C', fontSize: 14 }; const summaryStyles = { background: '#F3F2F1', padding: '1px 1rem' }; const mainElementStyle = { marginBottom: 20 }; -const dialogBodyStyles = { height: 480 }; +const dialogBodyStyles = { height: 400 }; const CREATE_NEW_KEY = 'CREATE_NEW'; export const ManageService = (props: ManageServiceProps) => { @@ -506,7 +506,7 @@ export const ManageService = (props: ManageServiceProps) => {

{formatMessage( - 'Select your Azure directory, then choose the subscription where your existing resource is located and the keys you want to use.', + 'Select your Azure directory, then choose the subscription where your existing resource is located and the keys you want to use. ', { service: props.serviceName } )} {props.learnMore ? ( @@ -537,7 +537,7 @@ export const ManageService = (props: ManageServiceProps) => {

{formatMessage( - 'Select your Azure directory, then choose the subscription where you’d like your new {service} resource.', + 'Select your Azure directory, then choose the subscription where you’d like your new {service} resource. ', { service: props.serviceName } )} {props.learnMore ? ( @@ -862,7 +862,7 @@ export const ManageService = (props: ManageServiceProps) => { title: nextAction === 'create' ? formatMessage('Create new {service} resource', { service: props.serviceName }) - : formatMessage('Select {service} keys', { service: props.serviceName }), + : formatMessage('Select {service} key', { service: props.serviceName }), }} hidden={props.hidden || showAuthDialog} minWidth={480} From 16056fb36188cbd5ce379ec7ca218543a200582a Mon Sep 17 00:00:00 2001 From: Vamsi Modem Date: Mon, 3 May 2021 13:13:14 -0700 Subject: [PATCH 6/7] Added new strings to en-US.json --- .../packages/server/src/locales/en-US.json | 37 +++++++++++++++---- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/Composer/packages/server/src/locales/en-US.json b/Composer/packages/server/src/locales/en-US.json index 2ca9f8e972..7462a2dd51 100644 --- a/Composer/packages/server/src/locales/en-US.json +++ b/Composer/packages/server/src/locales/en-US.json @@ -431,6 +431,9 @@ "azure_connections_9e63f716": { "message": "Azure connections" }, + "azure_directory_d9065529": { + "message": "Azure directory" + }, "azure_functions_5e23be5c": { "message": "Azure Functions" }, @@ -632,9 +635,6 @@ "choose_from_existing_e85a88c4": { "message": "Choose from existing" }, - "choose_from_existing_service_keys_create_a_new_ser_53728093": { - "message": "Choose from existing { service } keys, create a new { service } resource, or generate a request to handoff to your Azure admin. " - }, "choose_how_to_create_your_bot_a97f7b3e": { "message": "Choose how to create your bot" }, @@ -2501,6 +2501,9 @@ "next_steps_fce2208": { "message": "Next steps" }, + "no_azure_directories_were_found_6dfe6f6f": { + "message": "No Azure Directories were found." + }, "no_editor_for_type_8b5593c5": { "message": "No Editor for { type }" }, @@ -3317,11 +3320,8 @@ "select_runtime_version_to_add_d63d383b": { "message": "Select runtime version to add" }, - "select_service_keys_6d3f0980": { - "message": "Select { service } keys" - }, - "select_subscription_c5678611": { - "message": "Select subscription" + "select_service_key_6ca27e67": { + "message": "Select { service } key" }, "select_the_language_that_bot_will_be_able_to_under_1f2bcb96": { "message": "Select the language that bot will be able to understand (User input) and respond to (Bot responses).\n To make this bot available in other languages, click “Add’ to create a copy of the default language, and translate the content into the new language." @@ -3335,6 +3335,15 @@ "select_which_tasks_this_skill_can_perform_172b0eae": { "message": "Select which tasks this skill can perform" }, + "select_your_azure_directory_then_choose_the_subscr_69776814": { + "message": "Select your Azure directory, then choose the subscription where your existing resource is located and the keys you want to use. " + }, + "select_your_azure_directory_then_choose_the_subscr_7034a3c0": { + "message": "Select your Azure directory, then choose the subscription where you’d like your new { service } resource." + }, + "select_your_azure_directory_then_choose_the_subscr_e3d67edf": { + "message": "Select your Azure directory, then choose the subscription where you’d like your new { service } resource. " + }, "selection_field_86d1dc94": { "message": "selection field" }, @@ -3728,6 +3737,12 @@ "there_is_no_thumbnail_view_908fe5cc": { "message": "There is no thumbnail view" }, + "there_was_a_problem_getting_the_access_token_for_t_69f5a5e2": { + "message": "There was a problem getting the access token for the current Azure directory. { errMessage }" + }, + "there_was_a_problem_loading_azure_directories_errm_56e6145d": { + "message": "There was a problem loading Azure directories. { errMessage }" + }, "there_was_an_error_74ed3c58": { "message": "There was an error" }, @@ -3959,6 +3974,9 @@ "unknown_state_23f73afb": { "message": "Unknown State" }, + "unnamed_4c8565a0": { + "message": "Unnamed" + }, "unread_notifications_indicator_e2ca00d5": { "message": "Unread notifications Indicator" }, @@ -4259,6 +4277,9 @@ "your_skill_is_ready_to_be_shared_6376eb3c": { "message": "Your skill is ready to be shared!" }, + "your_subscription_list_is_empty_please_add_your_su_6b229c26": { + "message": "Your subscription list is empty, please add your subscription, or login with another account." + }, "your_teams_adapter_is_configured_for_your_publishe_e84e9275": { "message": "Your Teams adapter is configured for your published bot. Copy the manifest, open App Studio in Teams and add the manifest so you can test your bot in Teams" }, From 9050d3b7dd5d73f758f3e317ed57b41029121db2 Mon Sep 17 00:00:00 2001 From: Vamsi Modem Date: Mon, 3 May 2021 13:41:09 -0700 Subject: [PATCH 7/7] Formatted regions on LUIS/QnA resource creation dialog and removed unused code. --- .../src/components/ManageQNA/ManageQNA.tsx | 2 +- .../components/ManageService/ManageService.tsx | 3 +-- Composer/packages/client/src/constants.ts | 6 +++--- .../packages/server/src/locales/en-US.json | 18 +++++++++--------- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Composer/packages/client/src/components/ManageQNA/ManageQNA.tsx b/Composer/packages/client/src/components/ManageQNA/ManageQNA.tsx index 1a6493e304..9f231a49bb 100644 --- a/Composer/packages/client/src/components/ManageQNA/ManageQNA.tsx +++ b/Composer/packages/client/src/components/ManageQNA/ManageQNA.tsx @@ -12,7 +12,7 @@ import { ManageService } from '../ManageService/ManageService'; import { currentProjectIdState } from '../../recoilModel'; import { rootBotProjectIdSelector } from '../../recoilModel/selectors/project'; -const QNA_REGIONS = [{ key: 'westus', text: 'westus' }]; +const QNA_REGIONS = [{ key: 'westus', text: 'West US' }]; const QNA_TIERS = [ { key: 'free', text: 'Free' }, { key: 'paid', text: 'Paid' }, diff --git a/Composer/packages/client/src/components/ManageService/ManageService.tsx b/Composer/packages/client/src/components/ManageService/ManageService.tsx index c205c4e35a..0fb074c414 100644 --- a/Composer/packages/client/src/components/ManageService/ManageService.tsx +++ b/Composer/packages/client/src/components/ManageService/ManageService.tsx @@ -506,8 +506,7 @@ export const ManageService = (props: ManageServiceProps) => {

{formatMessage( - 'Select your Azure directory, then choose the subscription where your existing resource is located and the keys you want to use. ', - { service: props.serviceName } + 'Select your Azure directory, then choose the subscription where your existing resource is located and the keys you want to use. ' )} {props.learnMore ? ( diff --git a/Composer/packages/client/src/constants.ts b/Composer/packages/client/src/constants.ts index cb650526bf..58a856820e 100644 --- a/Composer/packages/client/src/constants.ts +++ b/Composer/packages/client/src/constants.ts @@ -52,15 +52,15 @@ export const Tips = { export const LUIS_REGIONS: IDropdownOption[] = [ { key: 'westus', - text: formatMessage('westus'), + text: formatMessage('West US'), }, { key: 'westeurope', - text: formatMessage('westeurope'), + text: formatMessage('West Europe'), }, { key: 'australiaeast', - text: formatMessage('australiaeast'), + text: formatMessage('Australia East'), }, ]; diff --git a/Composer/packages/server/src/locales/en-US.json b/Composer/packages/server/src/locales/en-US.json index 7462a2dd51..14fa1c1023 100644 --- a/Composer/packages/server/src/locales/en-US.json +++ b/Composer/packages/server/src/locales/en-US.json @@ -407,8 +407,8 @@ "audio_card_8587cf83": { "message": "Audio card" }, - "australiaeast_f3227a31": { - "message": "australiaeast" + "australia_east_b7af6cc": { + "message": "Australia East" }, "authentication_error_39e996c5": { "message": "Authentication Error" @@ -3335,12 +3335,12 @@ "select_which_tasks_this_skill_can_perform_172b0eae": { "message": "Select which tasks this skill can perform" }, - "select_your_azure_directory_then_choose_the_subscr_69776814": { - "message": "Select your Azure directory, then choose the subscription where your existing resource is located and the keys you want to use. " - }, "select_your_azure_directory_then_choose_the_subscr_7034a3c0": { "message": "Select your Azure directory, then choose the subscription where you’d like your new { service } resource." }, + "select_your_azure_directory_then_choose_the_subscr_8c3aa61": { + "message": "Select your Azure directory, then choose the subscription where your existing resource is located and the keys you want to use." + }, "select_your_azure_directory_then_choose_the_subscr_e3d67edf": { "message": "Select your Azure directory, then choose the subscription where you’d like your new { service } resource. " }, @@ -4127,11 +4127,11 @@ "welcome_to_composer_7147714a": { "message": "Welcome to Composer!" }, - "westeurope_cabf9688": { - "message": "westeurope" + "west_europe_75ac94f4": { + "message": "West Europe" }, - "westus_dc50d800": { - "message": "westus" + "west_us_51d3fdbb": { + "message": "West US" }, "what_can_the_user_accomplish_through_this_conversa_7ddb03a1": { "message": "What can the user accomplish through this conversation? For example, BookATable, OrderACoffee etc."