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

Add links to docs in UI #842

Merged
merged 11 commits into from
Sep 12, 2018
Merged

Add links to docs in UI #842

merged 11 commits into from
Sep 12, 2018

Conversation

corinagum
Copy link
Contributor

Resolves #816

  • Add links to docs in UI
  • Anchors will open in separate window

AzureLoginSuccessDialogContainer,
AzureLoginFailedDialogContainer));
AzureLoginPromptDialogContainer,
{ ServiceTypes },
Copy link
Contributor

@compulim compulim Sep 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this line should be { serviceType: ServiceTypes.Luis }.

AzureLoginSuccessDialogContainer,
AzureLoginFailedDialogContainer));
AzureLoginPromptDialogContainer,
{ ServiceTypes },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same.

AzureLoginSuccessDialogContainer,
AzureLoginFailedDialogContainer));
AzureLoginPromptDialogContainer,
{ ServiceTypes },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same.

function* launchConnectedServicePickList(
action: ConnectedServiceAction<ConnectedServicePickerPayload>,
availableServices: IConnectedService[],
serviceType: ServiceTypes,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing comma.

@@ -278,20 +286,21 @@ function openLuisDeepLink(luisService: ILuisService): Promise<any> {
regionPrefix = '';
break;
}
const link = `https://www.${regionPrefix}luis.ai/applications/${appId}/versions/${version}/build`;
const link = `https://www.${ regionPrefix }luis.ai/applications/${ appId }/versions/${ version }/build`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should always build links with cautions. Do something like https://www.${ encodeURI( regionPrefix ) }luis.ai/....

return CommandServiceImpl.remoteCall(SharedConstants.Commands.Electron.OpenExternal, link);
}

function openQnaMakerDeepLink(service: IQnAService): Promise<any> {
const { kbId } = service;
const link = `https://qnamaker.ai/Edit/KnowledgeBase?kbid=${kbId}`;
const link = `https://qnamaker.ai/Edit/KnowledgeBase?kbid=${ kbId }`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use encodeURIComponent(kbId) here.

encodeURI is for path.
encodeURIComponent is for values inside query params.

return CommandServiceImpl.remoteCall(SharedConstants.Commands.Electron.OpenExternal, link);
}

function openAzureBotServiceDeepLink(service: IBotService): Promise<any> {
const { tenantId, subscriptionId, resourceGroup, id } = service;
const thankYouTsLint = `https://ms.portal.azure.com/#@${tenantId}/resource/subscriptions/${subscriptionId}`;
const link = `${thankYouTsLint}/resourceGroups/${resourceGroup}/providers/Microsoft.BotService/botServices/${id}`;
const thankYouTsLint = `https://ms.portal.azure.com/#@${ tenantId }/resource/subscriptions/${ subscriptionId }`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same.

const thankYouTsLint = `https://ms.portal.azure.com/#@${tenantId}/resource/subscriptions/${subscriptionId}`;
const link = `${thankYouTsLint}/resourceGroups/${resourceGroup}/providers/Microsoft.BotService/botServices/${id}`;
const thankYouTsLint = `https://ms.portal.azure.com/#@${ tenantId }/resource/subscriptions/${ subscriptionId }`;
const link =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same.

@@ -13,16 +14,30 @@ export class AzureLoginPromptDialog extends Component<AzureLoginPromptDialogProp
<Dialog cancel={ this.props.cancel } title="Sign in with an Azure account">
<p>Use your Azure account to sign in to all your Azure services, such as Azure Bot Service, Dispatch,
LUIS, ans QnA Maker.&nbsp;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Optional) Try not to use   as a space, it's different than a real space.

white-space: normal;
text-decoration: none;

&:hover {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation.

<TextField
className={ styles.smallInput }
inputClassName="bot-creation-input"
value={ endpoint.appPassword }
onChanged={ this.onChangeAppPw }
label={ 'MSA app password' } placeholder={ 'Optional' } type={ 'password' }/>
label={ 'MSA app password' } placeholder={ 'Optional' } type={ 'password' } />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • label="MSA app password"
  • Split it out into multiple lines
  • (Optional) Sort the lines

className={ 'secret-checkbox' }
checked={ secretEnabled }
onChange={ this.onToggleSecret }
label={ 'Encrypt keys store in your bot configuration.' } id={ 'bot-secret-checkbox' } />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • label="Encrypt keys store in your bot configuration."
  • (Optional) Can we not to use id? It pollute the environment

onChange={ this.onToggleSecret }
label={ 'Encrypt keys store in your bot configuration.' } id={ 'bot-secret-checkbox' } />
&nbsp;
<a className={ styles.link } href="https://aka.ms/about-bot-file">Learn more.</a>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation.

<Dialog
cancel={ this.props.cancel }
title="Connect your bot to a QnA Maker knowledge base">
<p>Sign in to your Azure account to select the QnA Maker knowledge&nbsp;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation, or split it out like

<p>
  Sign to your Azure ...
  bases you'd like
  <a href="...">Learn more ...</a>
</p>

<Dialog
cancel={ this.props.cancel }
title="Connect your bot to a Dispatch model">
<p>Sign in to your Azure account to select the Dispatch model you'd like to associate with this bot.&nbsp;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same.

cancel: () => DialogService.hideDialog(0),
confirm: () => DialogService.hideDialog(1),
addLuisAppManually: () => DialogService.hideDialog(2)
addLuisAppManually: () => DialogService.hideDialog(2),
onAnchorClick: (url) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Optional) No parenthesis for single argument for Lambda functions.

SecretPromptDialog: function mock() {
return undefined;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentations.

@coveralls
Copy link

coveralls commented Sep 11, 2018

Pull Request Test Coverage Report for Build 329

  • 46 of 82 (56.1%) changed or added relevant lines in 13 files are covered.
  • 2 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.02%) to 50.53%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/app/client/src/commands/uiCommands.ts 1 2 50.0%
packages/app/client/src/ui/shell/explorer/servicesExplorer/connectedServiceEditor/connectedServiceEditorContainer.ts 3 4 75.0%
packages/app/client/src/ui/dialogs/connectLuisAppPromptDialog/connectLuisAppPromptDialogContainer.ts 5 6 83.33%
packages/app/client/src/ui/shell/explorer/servicesExplorer/connectedServicePicker/connectedServicePickerContainer.ts 4 5 80.0%
packages/app/client/src/ui/dialogs/azureLoginPromptDialog/azureLoginPromptDialog.tsx 2 4 50.0%
packages/app/client/src/ui/dialogs/azureLoginPromptDialog/azureLoginPromptDialogContainer.ts 2 4 50.0%
packages/app/client/src/ui/dialogs/getStartedWithCSDialog/getStartedWithCSDialogContainer.ts 4 6 66.67%
packages/app/client/src/ui/dialogs/getStartedWithCSDialog/getStartedWithCSDialog.tsx 7 11 63.64%
packages/app/client/src/ui/shell/explorer/servicesExplorer/connectedServicePicker/connectedServicePicker.tsx 4 8 50.0%
packages/app/client/src/ui/shell/explorer/servicesExplorer/connectedServiceEditor/connectedServiceEditor.tsx 2 8 25.0%
Files with Coverage Reduction New Missed Lines %
packages/app/client/src/data/sagas/servicesExplorerSagas.ts 1 65.5%
packages/app/client/src/ui/dialogs/connectLuisAppPromptDialog/connectLuisAppPromptDialog.tsx 1 59.09%
Totals Coverage Status
Change from base Build 320: -0.02%
Covered Lines: 3581
Relevant Lines: 6003

💛 - Coveralls

@@ -23,7 +42,7 @@ describe('The GetStartedWithCSDialog component should', () => {
mockStore = createStore(combineReducers({ azureAuth }));
mockStore.dispatch(azureArmTokenDataChanged(mockArmToken));
parent = mount(<Provider store={ mockStore }>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Optional) Split this line into its own line.

parent = mount(
  <Provider>
    ...
  </Provider>
);

<a href="javascript:void(0);" onClick={ this.props.launchConnectedServiceEditor }>
connect to a LUIS app manually
</a>&nbsp;
if you know the app ID, version, and authoring key.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentations.

}
private get dispatchContent(): JSX.Element {
const { showNoModelsFoundContent, authenticatedUser } = this.props;
if (!showNoModelsFoundContent) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New line after const.

private get dispatchContent(): JSX.Element {
const { showNoModelsFoundContent, authenticatedUser } = this.props;
if (!showNoModelsFoundContent) {
return (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New line before return.

if you know the app ID, version, and authoring key.
</>
);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Optional) Consider use else here for clarity. I think Uglify will remove it for you for shorter code anyway.

</p>
Alternatively, you can
<a href="javascript:void(0);" onClick={ this.props.launchConnectedServiceEditor }>
connect to a Dispatch app manually
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation.

by entering this app ID and key.
</p>
<p>
<a href="javascript:void(0)" onClick={ this.onLearnMoreDispatch }>Learn more about Dispatch models</a>&nbsp;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need the trailing &nbsp;.

const [, payload] = token.split('.');
const pJson = JSON.parse(atob(payload));
return {...ownProps, user: (pJson.upn || pJson.unique_name || pJson.name || pJson.email) };
return { ...ownProps, user: (pJson.upn || pJson.unique_name || pJson.name || pJson.email) };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty line before return and after const.

const [, payload] = token.split('.');
const pJson = JSON.parse(atob(payload));
return {...ownProps, user: (pJson.upn || pJson.unique_name || pJson.name || pJson.email) };
return { ...ownProps, user: (pJson.upn || pJson.unique_name || pJson.name || pJson.email) };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to use parenthesis here. user: pJson.upn || pJson.unique_name || pJson.name || pJson.email.

close: () => void;
onAnchorClick: (url: string) => void;
}
export class PostMigrationDialog extends React.Component<PostMigrationDialogProps> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New line after interface and before class.

<Dialog cancel={ this.onClose } className={ styles.postMigrationDialog } title="Migration complete!">
<p>We’ve copied your bot endpoints from Emulator v3 and saved them as <strong>.bot files</strong>.
A <strong>.bot file</strong> stores metadata about different services your bot consumes
and enables you to edit these services directly from the Emulator v4.&nbsp;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentations.

</p>
<p>You can move a bot to any location by right-clicking the bot’s name under My Bots.&nbsp;
<a href="">Learn more developing locally.</a>
<p>You can move a bot to any location by right-clicking the bot's name under My Bots.&nbsp;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Snap </p> back to the line
  • Do we need trailing &nbsp; here?

import { PostMigrationDialog, PostMigrationDialogProps } from './postMigrationDialog';
import { SharedConstants } from '@bfemulator/app-shared';

const mapStateToProps = (ownProps: PostMigrationDialogProps) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Optional) Consider:

const mapStateToProps = (ownProps: PostMigrationDialogProps) => ownProps;

onClick={onNewBotClick}>create a new bot configuration.</button>
<span>If you don’t have a bot configuration,&nbsp;
<button className={ styles.ctaLink }
onClick={ onNewBotClick }>create a new bot configuration.</button>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentations.

<div className={styles.recentBotActionBar}>
<button data-index={index} onClick={this.onDeleteBotClick}></button>
<li className={ styles.recentBot } key={ bot.path }>
<button data-index={ index } onClick={ this.onBotClick }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put one prop on its own line.

Copy link
Contributor

@tonyanziano tonyanziano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made some minor suggestions. Otherwise looks good to me.

@justinwilaby Since this is a case where only markup was changed and no functionality changed, I think it's acceptable to overlook the minor decrease in code coverage. The drop was only caused due to an increase in markup. What are your thoughts?

Copy link
Contributor

@tonyanziano tonyanziano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

:shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants