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: publishing page #2440

Merged
merged 71 commits into from
Apr 17, 2020
Merged
Show file tree
Hide file tree
Changes from 68 commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
6cd36b7
re-enable publish page in settings
benbrown Mar 30, 2020
9624671
add description to publish plugin, fix behavior of "Default" local te…
benbrown Mar 30, 2020
1b50c3a
Merge remote-tracking branch 'origin/benbrown/2355' into wenyluo/ui
VanyLaw Mar 31, 2020
f7ea049
add publish page in nav
VanyLaw Apr 1, 2020
b653575
Merge remote-tracking branch 'origin/master' into wenyluo/ui
VanyLaw Apr 2, 2020
af2877f
Merge remote-tracking branch 'origin/master' into benbrown/2355
VanyLaw Apr 2, 2020
2ff9a43
add publish page
VanyLaw Apr 2, 2020
e804767
remove unrelevant
VanyLaw Apr 2, 2020
3893bca
Merge remote-tracking branch 'origin/wenyluo/ui' into benbrown/2355
VanyLaw Apr 2, 2020
39e174b
add publish page and add getHistory method in localpublish plugin
VanyLaw Apr 3, 2020
7a52c34
Merge remote-tracking branch 'origin/wenyluo/ui' into benbrown/2355
VanyLaw Apr 3, 2020
4eedce6
fix bug
VanyLaw Apr 3, 2020
12feb68
merge master and fix conflict
VanyLaw Apr 4, 2020
49a2a8c
polish style
VanyLaw Apr 4, 2020
53a24c0
add mock remote publish for development/testing purposes
benbrown Apr 6, 2020
38682f2
add alerts on failed validation
benbrown Apr 6, 2020
2117ddb
Merge remote-tracking branch 'origin/master' into benbrown/2355
VanyLaw Apr 7, 2020
f36a3d8
add validation chck
VanyLaw Apr 7, 2020
4b504e1
update typedefs
benbrown Apr 7, 2020
c576369
poll for updated stats if status is 202
benbrown Apr 7, 2020
c3dae79
Merge remote-tracking branch 'origin/master' into benbrown/2355
VanyLaw Apr 8, 2020
ceb840b
fix build fail
VanyLaw Apr 8, 2020
b684134
add sensitive setting back and polish UI
VanyLaw Apr 8, 2020
c21ff24
fix localpublish
VanyLaw Apr 8, 2020
dfe8d31
add testInEmulator button
VanyLaw Apr 8, 2020
5c11e7c
add group in detail list
VanyLaw Apr 8, 2020
758031f
add log output
benbrown Apr 8, 2020
c55ab66
bind the log button to the actual log content from the publish process
benbrown Apr 8, 2020
645c8c2
add supported features to return value of types api
benbrown Apr 8, 2020
7e4c2c0
merge master, fix conflict and polish UI
VanyLaw Apr 9, 2020
bd95d73
add default into profile
VanyLaw Apr 9, 2020
01e4b88
remove default show in profile list
VanyLaw Apr 9, 2020
6bcf422
add rollback methods
benbrown Apr 9, 2020
7705ae6
Merge branch 'benbrown/2355' of github.com:microsoft/BotFramework-Com…
benbrown Apr 9, 2020
5f95a35
add rollback endpoint, mock rollback feature, rollback button in ui
benbrown Apr 9, 2020
b831318
fix build
VanyLaw Apr 10, 2020
770bc97
merge master fix conflict
VanyLaw Apr 10, 2020
2d656a9
change status show in list to icon
VanyLaw Apr 10, 2020
4fd6ab8
polish
VanyLaw Apr 10, 2020
253fbe0
fix e2e test
VanyLaw Apr 10, 2020
b7550e2
disable open in emulator button, clean consoles
benbrown Apr 10, 2020
53f8df6
change date format
VanyLaw Apr 10, 2020
a00e9cb
Merge branch 'benbrown/2355' of github.com:microsoft/BotFramework-Com…
benbrown Apr 10, 2020
b36fb05
Merge branch 'benbrown/2355' of github.com:microsoft/BotFramework-Com…
benbrown Apr 10, 2020
f4c7dc8
add targetName into url
VanyLaw Apr 11, 2020
c6a8b6b
fix conflict
VanyLaw Apr 11, 2020
e8f721a
add delete in target list, add edit placehold in target list
VanyLaw Apr 12, 2020
40394ef
Merge remote-tracking branch 'origin/master' into benbrown/2355
VanyLaw Apr 13, 2020
dafde54
fix save target
VanyLaw Apr 13, 2020
26f8123
fix selectVersion after changing target
VanyLaw Apr 13, 2020
5b315d1
implement confirm on delete of target
benbrown Apr 13, 2020
6dbebf3
add error correction
benbrown Apr 13, 2020
10e0cb4
Merge branch 'master' of github.com:microsoft/BotFramework-Composer i…
benbrown Apr 13, 2020
46ce623
Merge branch 'master' into benbrown/2355
cwhitten Apr 14, 2020
8a58f89
fix name undefined when adding target:
VanyLaw Apr 14, 2020
81a4cc8
Merge branch 'benbrown/2355' of https://github.com/microsoft/BotFrame…
VanyLaw Apr 14, 2020
063d3a0
fix some comments
VanyLaw Apr 14, 2020
03290ba
fix comment
VanyLaw Apr 14, 2020
85d101f
Merge remote-tracking branch 'origin/master' into benbrown/2355
VanyLaw Apr 15, 2020
669139e
redirect to new target after create and edit, and fix date sort
VanyLaw Apr 15, 2020
c3a1591
fix comments
VanyLaw Apr 15, 2020
c5139ff
Merge remote-tracking branch 'origin/master' into benbrown/2355
VanyLaw Apr 15, 2020
edf3fce
fix history update after publish fail
VanyLaw Apr 15, 2020
ba52734
resolve comments from cwhitten
benbrown Apr 15, 2020
17f2401
fix some code issues
benbrown Apr 15, 2020
dcec252
Merge remote-tracking branch 'origin/master' into benbrown/2355
VanyLaw Apr 16, 2020
0d1385d
Merge branch 'master' into benbrown/2355
cwhitten Apr 16, 2020
7e536be
Merge branch 'master' into benbrown/2355
cwhitten Apr 16, 2020
5a1f606
Merge branch 'master' into benbrown/2355
cwhitten Apr 16, 2020
5c30e0e
Merge branch 'master' into benbrown/2355
cwhitten Apr 16, 2020
dc05e73
Merge branch 'master' into benbrown/2355
cwhitten Apr 16, 2020
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
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,6 @@ DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
Expand Down
3 changes: 2 additions & 1 deletion Composer/cypress/integration/LuisDeploy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
context('Luis Deploy', () => {
beforeEach(() => {
cy.server();
cy.route('POST', '/api/publish/*/publish/default', 'OK');
cy.route('POST', '/api/publish/*/publish/default', { endpointURL: 'anything' });
cy.route('POST', '/api/projects/*/settings', 'OK');
cy.route('GET', '/api/publish/*/status/default', { endpointURL: 'anything' });
cy.visit(Cypress.env('COMPOSER_URL'));
cy.createBot('ToDoBotWithLuisSample');
});
Expand Down
5 changes: 1 addition & 4 deletions Composer/cypress/integration/SaveAs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@
context('Saving As', () => {
beforeEach(() => {
cy.visit(Cypress.env('COMPOSER_URL'));
cy.createBot('ToDoBotWithLuisSample');
cy.createBot('EchoBot', 'TestBot');
});

it('can create a new bot from an existing bot', () => {
cy.findByTestId('LeftNav-CommandBarButtonHome').click();
cy.url().should('contain', 'home');
cy.findByText('Save as').click();

cy.findByTestId('NewDialogName').type('{selectall}__TestSaveAs{enter}');

cy.findByTestId('ProjectTree').within(() => {
cy.findByText('__TestSaveAs.Main').should('exist');
cy.findByText('View').should('exist');
});
});
});
7 changes: 7 additions & 0 deletions Composer/packages/client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ const topLinks = (projectId: string, openedDialogId: string) => {
exact: true,
disabled: !botLoaded,
},
{
to: `/bot/${projectId}/publish`,
iconName: 'CloudUpload',
labelName: formatMessage('Publish'),
exact: true,
disabled: !botLoaded,
},
{
to: `/bot/${projectId}/skills`,
iconName: 'PlugDisconnected',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,22 @@ import React, { useState, useRef, Fragment, useContext, useEffect, useCallback }
import { PrimaryButton } from 'office-ui-fabric-react/lib/Button';
import formatMessage from 'format-message';

import { DefaultPublishConfig } from '../../constants';

import settingsStorage from './../../utils/dialogSettingStorage';
import { StoreContext } from './../../store';
import { BotStatus, LuisConfig } from './../../constants';
import { isAbsHosted } from './../../utils/envUtil';
import { getReferredFiles } from './../../utils/luUtil';
import useNotifications from './../../pages/notifications/useNotifications';
import { navigateTo } from './../../utils';
import { navigateTo, openInEmulator } from './../../utils';
import { PublishLuisDialog } from './publishDialog';
import { bot, botButton } from './styles';
import { ErrorCallout } from './errorCallout';
import { EmulatorOpenButton } from './emulatorOpenButton';
import { Loading } from './loading';
import { ErrorInfo } from './errorInfo';

const openInEmulator = (url, authSettings: { MicrosoftAppId: string; MicrosoftAppPassword: string }) => {
// this creates a temporary hidden iframe to fire off the bfemulator protocol
// and start up the emulator
const i = document.createElement('iframe');
i.style.display = 'none';
i.onload = () => i.parentNode && i.parentNode.removeChild(i);
i.src = `bfemulator://livechat.open?botUrl=${encodeURIComponent(url)}&msaAppId=${
authSettings.MicrosoftAppId
}&msaAppPassword=${encodeURIComponent(authSettings.MicrosoftAppPassword)}`;
document.body.appendChild(i);
};

const defaultPublishConfig = {
name: 'default',
};
export const TestController: React.FC = () => {
const { state, actions } = useContext(StoreContext);
const [modalOpen, setModalOpen] = useState(false);
Expand All @@ -53,7 +40,7 @@ export const TestController: React.FC = () => {

useEffect(() => {
if (projectId) {
getPublishStatus(projectId, defaultPublishConfig);
getPublishStatus(projectId, DefaultPublishConfig);
}
}, [projectId]);

Expand Down Expand Up @@ -95,7 +82,7 @@ export const TestController: React.FC = () => {
async function handleLoadBot() {
setBotStatus(BotStatus.reloading);
const sensitiveSettings = settingsStorage.get(botName);
await publishToTarget(state.projectId, { ...defaultPublishConfig, sensitiveSettings });
await publishToTarget(state.projectId, DefaultPublishConfig, { comment: '' }, sensitiveSettings);
}

function isLuisConfigComplete(config) {
Expand Down
8 changes: 7 additions & 1 deletion Composer/packages/client/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ export enum ActionTypes {
PUBLISH_SUCCESS = 'PUBLISH_SUCCESS',
PUBLISH_FAILED = 'PUBLISH_FAILED',
GET_PUBLISH_STATUS = 'GET_PUBLISH_STATUS',
GET_PUBLISH_STATUS_FAILED = 'GET_PUBLISH_STATUS_FAILED',
GET_PUBLISH_HISTORY = 'GET_PUBLISH_HISTORY',
UPDATE_BOTSTATUS = 'UPDATE_BOTSTATUS',

SET_USER_SETTINGS = 'SET_USER_SETTINGS',
ADD_SKILL_DIALOG_BEGIN = 'ADD_SKILL_DIALOG_BEGIN',
ADD_SKILL_DIALOG_END = 'ADD_SKILL_DIALOG_END',
Expand Down Expand Up @@ -221,3 +222,8 @@ export const SupportedFileTypes = [
];

export const USER_TOKEN_STORAGE_KEY = 'composer.userToken';

export const DefaultPublishConfig = {
name: 'default',
type: 'localpublish',
};
1 change: 0 additions & 1 deletion Composer/packages/client/src/pages/design/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const projectContainer = css`
flex-grow: 0;
flex-shrink: 0;
width: 255px;
height: 100%;
overflow: auto;
border-right: 1px solid #c4c4c4;
`;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

/** @jsx jsx */
import { jsx } from '@emotion/core';
import formatMessage from 'format-message';
import { Dropdown } from 'office-ui-fabric-react/lib/Dropdown';
import { TextField } from 'office-ui-fabric-react/lib/TextField';
import { DialogFooter } from 'office-ui-fabric-react/lib/Dialog';
import { Fragment, useState } from 'react';
import { PrimaryButton, DefaultButton } from 'office-ui-fabric-react/lib/Button';
import { JsonEditor } from '@bfc/code-editor';

import { label } from './styles';

export const CreatePublishTarget = props => {
const [targetType, setTargetType] = useState(props.current ? props.current.type : '');
const [name, setName] = useState(props.current ? props.current.name : '');
const [config, setConfig] = useState(props.current ? JSON.parse(props.current.configuration) : {});
const [errorMessage, setErrorMsg] = useState('');

const updateType = (e, type) => {
setTargetType(type.key);
};
const updateConfig = newConfig => {
setConfig(newConfig);
};

const updateName = (e, newName) => {
setErrorMsg('');
setName(newName);
isNameValid(newName);
};

const isNameValid = newName => {
if (!newName || newName.trim() === '') {
setErrorMsg(formatMessage('Must have a name'));
} else {
const exists =
props.targets?.filter(t => {
return t.name.toLowerCase() === newName?.toLowerCase();
}).length > 0;
if (exists) {
setErrorMsg(formatMessage('A profile with that name already exists.'));
}
}
};

const isDisable = () => {
if (!targetType || !name || errorMessage) {
return true;
} else {
return false;
}
};

const submit = async () => {
await props.updateSettings(name, targetType, JSON.stringify(config, null, 2) || '{}');
props.closeDialog();
};

return (
<Fragment>
<form onSubmit={submit}>
<TextField
placeholder="My Publish Profile"
defaultValue={props.current ? props.current.name : null}
label={formatMessage('Name')}
onChange={updateName}
errorMessage={errorMessage}
/>
<Dropdown
placeholder={formatMessage('Choose One')}
label={formatMessage('Publish Destination Type')}
options={props.targetTypes}
defaultSelectedKey={props.current ? props.current.type : null}
onChange={updateType}
/>
<div css={label}>{formatMessage('Paste Configuration')}</div>
<JsonEditor onChange={updateConfig} height={200} value={config} />
</form>
<DialogFooter>
<DefaultButton onClick={props.closeDialog} text={formatMessage('Cancel')} />
<PrimaryButton onClick={submit} disabled={isDisable()} text={formatMessage('Save')} />
</DialogFooter>
</Fragment>
);
};
Loading