Skip to content
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: appended provision with a profile #5741

Merged
merged 66 commits into from
Mar 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
41e61cc
change edit dialog page 1
VanyLaw Feb 4, 2021
6a24f1c
Merge remote-tracking branch 'origin/main' into wenyluo/prov2
VanyLaw Feb 5, 2021
1eb3ae2
Merge remote-tracking branch 'origin/main' into wenyluo/prov2
VanyLaw Feb 8, 2021
ff0cc0a
change add and edit page one
VanyLaw Feb 8, 2021
722ae73
add review page and enable provision resources in current provision
VanyLaw Feb 9, 2021
b52e8ce
add some log
VanyLaw Feb 9, 2021
863c34a
fix test
VanyLaw Feb 9, 2021
52bd3f6
add profile merge logic
Feb 9, 2021
ff6dd1f
add retry logic judging
Feb 9, 2021
d8855a3
remove settings
Feb 9, 2021
205dc99
remove settings
Feb 9, 2021
c86c8e2
fix review page display error
VanyLaw Feb 9, 2021
0b48821
Merge branch 'wenyluo/prov2' of https://github.com/microsoft/BotFrame…
VanyLaw Feb 9, 2021
5daccf3
fix profile update in edit
VanyLaw Feb 9, 2021
f5104ce
remove status and fix provision update
VanyLaw Feb 9, 2021
ec03934
add missed field in current settings
Feb 10, 2021
19f6cdb
Fix some issues
luhan2017 Feb 18, 2021
6d0b7cc
merge main, fix conflict
VanyLaw Feb 19, 2021
2961939
remove the dependency between webapp and bot channel registration in …
luhan2017 Feb 19, 2021
6cba057
Merge remote-tracking branch 'origin/main' into wenyluo/prov2
VanyLaw Feb 19, 2021
f93987c
fix luis region always westus
VanyLaw Feb 19, 2021
93b00b3
decouple resourceGroup and hostName, fix regex
luhan2017 Feb 20, 2021
74ea3ef
Add a botName field for channel service
luhan2017 Feb 20, 2021
9ee1a8a
fix bug when select luis resource but not select the luis region
VanyLaw Feb 22, 2021
c18406e
add botName to publish profile
luhan2017 Feb 22, 2021
52f4623
make hostname disable if name or hostname already have
VanyLaw Feb 22, 2021
cdea646
Merge branch 'wenyluo/prov2' of https://github.com/microsoft/BotFrame…
VanyLaw Feb 22, 2021
b7d2db5
fix resourceGroup display error in review page
VanyLaw Feb 22, 2021
0f74d2e
remove annotation
VanyLaw Feb 22, 2021
5509f9a
Merge branch 'main' into wenyluo/prov2
luhan2017 Feb 22, 2021
de98b97
Merge branch 'main' into wenyluo/prov2
benbrown Feb 22, 2021
076aeba
fix regex issue and get location issue
VanyLaw Feb 23, 2021
9364d45
Merge branch 'wenyluo/prov2' of https://github.com/microsoft/BotFrame…
VanyLaw Feb 23, 2021
70a5c84
merge main fix conflict
VanyLaw Feb 23, 2021
61c6965
update publish function getPublishConfig
VanyLaw Feb 23, 2021
93194e8
Merge branch 'main' into wenyluo/prov2
luhan2017 Feb 23, 2021
c0529a1
fix hostname check issue
VanyLaw Feb 24, 2021
e868a15
Merge branch 'wenyluo/prov2' of https://github.com/microsoft/BotFrame…
VanyLaw Feb 24, 2021
ddda758
fix UI in add resource page
VanyLaw Feb 24, 2021
2f79a3c
fix UI issue
VanyLaw Feb 24, 2021
a1b3519
Fix the config missing issue
luhan2017 Feb 25, 2021
10dc131
merge main
VanyLaw Feb 26, 2021
b155176
update qna image and resource group check
VanyLaw Feb 26, 2021
e23de4e
merge main
VanyLaw Mar 1, 2021
338c54f
Merge branch 'main' into wenyluo/prov2
luhan2017 Mar 1, 2021
85dfda3
add region to profile and show the profile region as default in edit …
VanyLaw Mar 1, 2021
4d68c77
Merge branch 'wenyluo/prov2' of https://github.com/microsoft/BotFrame…
VanyLaw Mar 1, 2021
e0f68a2
add display name for app registration
VanyLaw Mar 1, 2021
701947c
Merge branch 'main' into wenyluo/prov2
luhan2017 Mar 1, 2021
159575d
remove form page if type already have
VanyLaw Mar 1, 2021
625a706
fix bug
VanyLaw Mar 1, 2021
5332fb4
Merge branch 'wenyluo/prov2' of https://github.com/microsoft/BotFrame…
VanyLaw Mar 1, 2021
22653bd
fix bug
VanyLaw Mar 1, 2021
41b5ee5
remove image
VanyLaw Mar 1, 2021
de0b25d
add image
VanyLaw Mar 1, 2021
621b8ac
fix bugs
VanyLaw Mar 1, 2021
582285b
fix: provision process shown in publish list (#6044)
alanlong9278 Mar 1, 2021
c021d27
fix region
VanyLaw Mar 1, 2021
71132f9
Merge branch 'wenyluo/prov2' of https://github.com/microsoft/BotFrame…
VanyLaw Mar 1, 2021
52c60f8
Merge branch 'main' into wenyluo/prov2
boydc2014 Mar 1, 2021
f6b88eb
go to edit page if no resources can be added
VanyLaw Mar 1, 2021
c6a3bde
Merge branch 'wenyluo/prov2' of https://github.com/microsoft/BotFrame…
VanyLaw Mar 1, 2021
f3cbe00
fix the region issue
luhan2017 Mar 1, 2021
cde52aa
fix ut
VanyLaw Mar 1, 2021
626f930
Merge branch 'wenyluo/prov2' of https://github.com/microsoft/BotFrame…
VanyLaw Mar 1, 2021
c1b4dd8
fix auth dialog popup everytime
VanyLaw Mar 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,23 @@ import { act, fireEvent } from '@botframework-composer/test-utils';
import { PublishTargets } from '../../../src/pages/botProject/PublishTargets';
import { renderWithRecoilAndCustomDispatchers } from '../../testUtils';
import { dispatcherState, publishTypesState } from '../../../src/recoilModel';
import { isShowAuthDialog } from '../../../src/utils/auth';

jest.mock('../../../src/utils/auth', () => ({
isShowAuthDialog: jest.fn(),
getTokenFromCache: jest.fn(),
isGetTokenFromUser: jest.fn(),
}));

const state = {
projectId: 'test',
publishTypes: [{ name: 'azureFunctionsPublish', description: 'Publish bot to Azure Functions (Preview)' }],
};

describe('Publish Target', () => {
beforeEach(() => {
(isShowAuthDialog as jest.Mock).mockReturnValue(false);
});
const setPublishTargetsMock = jest.fn();
const initRecoilState = ({ set }) => {
set(dispatcherState, {
Expand All @@ -28,6 +40,7 @@ describe('Publish Target', () => {
<PublishTargets projectId={state.projectId} />,
initRecoilState
);

const addNewPublishProfile = getByTestId('addNewPublishProfile');
act(() => {
fireEvent.click(addNewPublishProfile);
Expand Down
28 changes: 26 additions & 2 deletions Composer/packages/client/src/pages/botProject/PublishTargets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { NeutralColors, SharedColors } from '@uifabric/fluent-theme';

import { dispatcherState, settingsState, publishTypesState } from '../../recoilModel';
import { CollapsableWrapper } from '../../components/CollapsableWrapper';
import { AuthDialog } from '../../components/Auth/AuthDialog';
import { isShowAuthDialog } from '../../utils/auth';

import { PublishProfileDialog } from './create-publish-profile/PublishProfileDialog';

Expand Down Expand Up @@ -106,6 +108,7 @@ export const PublishTargets: React.FC<PublishTargetsProps> = (props) => {
const publishTypes = useRecoilValue(publishTypesState(projectId));

const [dialogHidden, setDialogHidden] = useState(true);
const [showAuthDialog, setShowAuthDialog] = useState(false);

const publishTargetsRef = React.useRef<HTMLDivElement>(null);
const [current, setCurrent] = useState<{ index: number; item: PublishTarget } | null>(null);
Expand Down Expand Up @@ -145,7 +148,11 @@ export const PublishTargets: React.FC<PublishTargetsProps> = (props) => {
styles={editPublishProfile}
onClick={() => {
setCurrent({ item: p, index: index });
setDialogHidden(false);
if (isShowAuthDialog(true)) {
setShowAuthDialog(true);
} else {
setDialogHidden(false);
}
}}
>
{formatMessage('Edit')}
Expand All @@ -157,12 +164,29 @@ export const PublishTargets: React.FC<PublishTargetsProps> = (props) => {
<ActionButton
data-testid={'addNewPublishProfile'}
styles={addPublishProfile}
onClick={() => setDialogHidden(false)}
onClick={() => {
if (isShowAuthDialog(true)) {
setShowAuthDialog(true);
} else {
setDialogHidden(false);
}
}}
>
{formatMessage('Add new')}
</ActionButton>
</div>
</CollapsableWrapper>
{showAuthDialog && (
<AuthDialog
needGraph
next={() => {
setDialogHidden(false);
}}
onDismiss={() => {
setShowAuthDialog(false);
}}
/>
)}
{!dialogHidden ? (
<PublishProfileDialog
closeDialog={() => {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,20 @@ import { Icon } from 'office-ui-fabric-react/lib/Icon';
import { separator } from '../../publish/styles';
import { armScopes, graphScopes } from '../../../constants';
import { PublishType } from '../../../recoilModel/types';
import { isShowAuthDialog } from '../../../utils/auth';
import { AuthDialog } from '../../../components/Auth/AuthDialog';
import { PluginAPI } from '../../../plugins/api';
import { dispatcherState } from '../../../recoilModel';
import { AuthClient } from '../../../utils/authClient';
import { getTokenFromCache, isGetTokenFromUser } from '../../../utils/auth';

type AddProfileDialogProps = {
type ProfileFormDialogProps = {
onDismiss: () => void;
targets: PublishTarget[];
types: PublishType[];
onNext: () => void;
updateSettings: (name: string, type: string, configuration: string) => Promise<void>;
projectId: string;
setType: (value) => void;
current?: { index: number; item: PublishTarget } | null;
};
const labelContainer = css`
display: flex;
Expand Down Expand Up @@ -72,12 +71,11 @@ const onRenderLabel = (props) => {
);
};

export const AddProfileDialog: React.FC<AddProfileDialogProps> = (props) => {
const { onDismiss, targets, types, onNext, updateSettings, projectId, setType } = props;
const [name, setName] = useState('');
export const ProfileFormDialog: React.FC<ProfileFormDialogProps> = (props) => {
const { onDismiss, targets, types, onNext, updateSettings, projectId, setType, current } = props;
const [name, setName] = useState(current?.item.name || '');
const [errorMessage, setErrorMsg] = useState('');
const [targetType, setTargetType] = useState<string>('');
const [showAuthDialog, setShowAuthDialog] = useState(false);
const [targetType, setTargetType] = useState<string>(current?.item.type || '');
const { provisionToTarget } = useRecoilValue(dispatcherState);

const updateName = (e, newName) => {
Expand Down Expand Up @@ -144,30 +142,20 @@ export const AddProfileDialog: React.FC<AddProfileDialogProps> = (props) => {
arm = getTokenFromCache('accessToken');
graph = getTokenFromCache('graphToken');
}
provisionToTarget(fullConfig, config.type, projectId, arm, graph);
provisionToTarget(fullConfig, config.type, projectId, arm, graph, current?.item);
};
}, [name, targetType]);

return (
<Fragment>
{showAuthDialog && (
<AuthDialog
needGraph
next={() => {
onNext();
}}
onDismiss={() => {
setShowAuthDialog(false);
}}
/>
)}
<Fragment>
<div style={{ width: '49%', minHeight: '430px' }}>
<form>
<TextField
required
ariaLabel={formatMessage('The name of your publishing file')}
defaultValue={name}
disabled={current?.item.name ? true : false}
errorMessage={errorMessage}
label={formatMessage('Name')}
placeholder={formatMessage('e.g. AzureBot')}
Expand All @@ -193,12 +181,8 @@ export const AddProfileDialog: React.FC<AddProfileDialogProps> = (props) => {
<PrimaryButton
disabled={saveDisabled}
text={formatMessage('Next: Configure resources')}
onClick={async () => {
if (isShowAuthDialog(true)) {
setShowAuthDialog(true);
} else {
onNext();
}
onClick={() => {
onNext();
}}
/>
</DialogFooter>
Expand Down
Loading