Skip to content

Commit

Permalink
Merge 868fb70 into e1e5f9e
Browse files Browse the repository at this point in the history
  • Loading branch information
Corina committed Oct 20, 2018
2 parents e1e5f9e + 868fb70 commit a9008b2
Show file tree
Hide file tree
Showing 12 changed files with 80 additions and 61 deletions.
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -66,14 +66,14 @@
.actions-list {
list-style: none;
position: absolute;
right: 0;
bottom: 4px;
right: 106px; // when re-enabling 'Generate new secret' link, original value: 0;
bottom: 3px;
padding: 0;
margin: 0;

li {
display: inline;
padding: 2px 5px;
padding: 2px 12px;
}

li + li {
Expand Down
Expand Up @@ -65,14 +65,18 @@ describe('BotCreationDialog tests', () => {
expect(state1.secret).not.toEqual(state2.secret);
});

it('should generate a new bot secret when reset is clicked', () => {
const testWrapper = shallow(<BotCreationDialog/>);
const initialSecret = 'secret1';
testWrapper.instance().setState({ secret: initialSecret, encryptKey: true });
(testWrapper.instance() as any).onResetClick();
const state = testWrapper.state() as Partial<BotCreationDialogState>;
expect(state.secret).not.toEqual(initialSecret);
});
// TODO: Re-enable ability to re-generate secret after 4.1
// See 'https://github.com/Microsoft/BotFramework-Emulator/issues/964' for more information
// See also: botCreationDialog.spec.tsx

// it('should generate a new bot secret when reset is clicked', () => {
// const testWrapper = shallow(<BotCreationDialog/>);
// const initialSecret = 'secret1';
// testWrapper.instance().setState({ secret: initialSecret, encryptKey: true });
// (testWrapper.instance() as any).onResetClick();
// const state = testWrapper.state() as Partial<BotCreationDialogState>;
// expect(state.secret).not.toEqual(initialSecret);
// });

it('should execute a window copy command when copy is clicked', () => {
const testWrapper = mount(<BotCreationDialog/>);
Expand Down
Expand Up @@ -144,7 +144,7 @@ export class BotCreationDialog extends React.Component<{}, BotCreationDialogStat
<a
href="javascript:void(0);"
onClick={ this.onLearnMoreEncryptionClick }>
Learn more.
&nbsp;Learn more.
</a>
</Row>

Expand Down Expand Up @@ -173,14 +173,14 @@ export class BotCreationDialog extends React.Component<{}, BotCreationDialogStat
Copy
</a>
</li>
<li>
{/* <li>
<a
className={ !encryptKey ? styles.disabledAction : '' }
href="javascript:void(0);"
onClick={ this.onResetClick }>
Generate new secret
</a>
</li>
</li> */}
</ul>
</div>

Expand Down Expand Up @@ -248,14 +248,18 @@ export class BotCreationDialog extends React.Component<{}, BotCreationDialogStat
input.type = type;
input.setAttribute('disabled', '');
}

// TODO: Re-enable ability to re-generate secret after 4.1
// See 'https://github.com/Microsoft/BotFramework-Emulator/issues/964' for more information
// See also: botCreationDialog.spec.tsx

private onResetClick = (): void => {
if (!this.state.encryptKey) {
return null;
}
const generatedSecret = generateBotSecret();
this.setState({ secret: generatedSecret });
}
// private onResetClick = (): void => {
// if (!this.state.encryptKey) {
// return null;
// }
// const generatedSecret = generateBotSecret();
// this.setState({ secret: generatedSecret });
// }

private onLearnMoreEncryptionClick = (): void => {
const url = 'https://aka.ms/bot-framework-bot-file-encryption';
Expand Down
Expand Up @@ -34,12 +34,13 @@ a {
.actions-list {
list-style: none;
position: absolute;
right: 85px;
right: 199px; // when re-enabling 'Generate new secret' link, original value: 85px;
bottom: 62px;

li {
display: inline;
padding: 2px 5px;
padding: 2px 12px;
font-weight: 400;
}

li + li {
Expand Down
Expand Up @@ -131,12 +131,15 @@ describe('The BotSettingsEditor dialog should', () => {
expect(documentSpies.getElementById).toHaveBeenCalledWith('key-input');
});

it('should generate a new secret when the "onResetClick" function is executed', () => {
const instance = node.instance();
const secret = instance.generatedSecret;
instance.onResetClick();
expect(instance.generatedSecret).not.toEqual(secret);
});
// TODO: Re-enable ability to re-generate secret after 4.1
// See 'https://github.com/Microsoft/BotFramework-Emulator/issues/964' for more information

// it('should generate a new secret when the "onResetClick" function is executed', () => {
// const instance = node.instance();
// const secret = instance.generatedSecret;
// instance.onResetClick();
// expect(instance.generatedSecret).not.toEqual(secret);
// });

describe('onSaveClick', () => {
it('should make the expected calls when saving a bot from protocol', async () => {
Expand Down
Expand Up @@ -114,7 +114,7 @@ export class BotSettingsEditor extends React.Component<BotSettingsEditorProps, B
<a
href="javascript:void(0);"
onClick={ this.onLearnMoreEncryptionClick }>
Learn more.
&nbsp;Learn more.
</a>
</Row>

Expand Down Expand Up @@ -143,14 +143,14 @@ export class BotSettingsEditor extends React.Component<BotSettingsEditorProps, B
Copy
</a>
</li>
<li>
{/* <li>
<a
className={ !encryptKey ? styles.disabledAction : '' }
href="javascript:void(0);"
onClick={ this.onResetClick }>
Generate new secret
</a>
</li>
</li> */}
</ul>

<DialogFooter>
Expand Down Expand Up @@ -299,14 +299,18 @@ export class BotSettingsEditor extends React.Component<BotSettingsEditorProps, B
input.setAttribute('disabled', '');
}

private onResetClick = (): void => {
if (!this.state.encryptKey) {
return null;
}
this._generatedSecret = null;
const { generatedSecret } = this;
this.setState({ secret: generatedSecret, padlock: '', dirty: true });
}
// TODO: Re-enable ability to re-generate secret after 4.1
// See 'https://github.com/Microsoft/BotFramework-Emulator/issues/964' for more information
// See also: botSettingsEditor.spec.tsx

// private onResetClick = (): void => {
// if (!this.state.encryptKey) {
// return null;
// }
// this._generatedSecret = null;
// const { generatedSecret } = this;
// this.setState({ secret: generatedSecret, padlock: '', dirty: true });
// }

private get generatedSecret(): string {
if (this._generatedSecret) {
Expand Down
Expand Up @@ -4,27 +4,31 @@
}

.button-row {
margin-top: 48px;
margin-top: 50px;
float: right;
margin-bottom: 25px;

> button {
height: 21px;
}

& > .save-button {
margin-left: 8px
margin-left: 8px;
}
}

.key-container {
position: relative;
.key {
margin: 16px 100px 20px 0;
margin: 16px 100px 0 0;
}
}

.show {
padding-left: 12px;
text-decoration: none;
position: absolute;
top: 30px;
right: 50px;
top: 28px;
right: 58px;
&[disabled="true"], &[aria-disabled="true"] {
color: var(--p-button-color-disabled);
}
Expand Down
Expand Up @@ -67,7 +67,7 @@ export class SecretPromptDialog extends React.Component<SecretPromptDialogProps,
</p>
<p>
{ 'If you encrypted your bot file with the MsBot command-line tool, your bot file secret was displayed ' +
'when you ran MsBot.' }
'when you ran MsBot. ' }
<a href="javascript:void(0)" onClick={ this.onLearnMoreClick }>Learn more about MsBot.</a>
</p>
<div className={ styles.keyContainer }>
Expand Down
Expand Up @@ -250,7 +250,7 @@

> dt {
display: block;
font-family: var(--default-font-semibold);
font-weight: 600;
font-size: 13px;
line-height: 18px;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/app/client/src/ui/styles/globals.scss
Expand Up @@ -60,9 +60,9 @@
font-weight: 600;
}

input, textarea, button, select {
input, textarea, button, select, p, a {
font-family: var(--default-font-family);
font-weight: normal;
font-weight: 400;
}

div {
Expand Down
1 change: 0 additions & 1 deletion packages/sdk/ui-react/src/widget/dialog/dialog.scss
Expand Up @@ -20,7 +20,6 @@
font: var(--default-font-family);
padding: 24px 24px 32px 24px;
header {
padding: 0 12px 20px 0;
font-size: 21px;
font-weight: 100;
}
Expand Down

0 comments on commit a9008b2

Please sign in to comment.