Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
Revert "Save capabilities when click outside component (#1039)"
Browse files Browse the repository at this point in the history
This reverts commit b11fcf7.
  • Loading branch information
dpgraham committed Sep 24, 2019
1 parent e4bfd10 commit 0c837ce
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 28 deletions.
41 changes: 19 additions & 22 deletions app/renderer/components/Session/FormattedCaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import formatJSON from 'format-json';
import SessionCSS from './Session.css';
import { Card, Button, Alert, Tooltip } from 'antd';
import { getCapsObject } from '../../actions/Session.js';
import ClickOutside from 'react-click-outside-component';

export default class FormattedCaps extends Component {
export default class NewSessionForm extends Component {

getFormattedJSON (caps) {
return formatJSON.plain(getCapsObject(caps));
Expand All @@ -16,26 +15,24 @@ export default class FormattedCaps extends Component {
isValidCapsJson, invalidCapsJsonReason, t} = this.props;
return caps && <div className={SessionCSS.formattedCapsCont}>
<Card title={title || 'JSON Representation'} className={SessionCSS.formattedCaps}>
<ClickOutside onClickOutside={saveRawDesiredCaps}>
<div className={SessionCSS.capsEditorControls}>
{isEditingDesiredCaps && <Tooltip title={t('Cancel')}>
<Button onClick={abortDesiredCapsEditor} icon='close' className={SessionCSS.capsEditorButton} />
</Tooltip> }
{isEditingDesiredCaps && <Tooltip title={t('Save')}>
<Button onClick={saveRawDesiredCaps} icon='save' className={SessionCSS.capsEditorButton} />
</Tooltip>}
{!isEditingDesiredCaps && <Tooltip title={t('Edit Raw JSON')} placement="topRight" >
<Button onClick={startDesiredCapsEditor} icon='edit' />
</Tooltip> }
</div>
{isEditingDesiredCaps && <div>
<textarea rows='9' onChange={(e) => setRawDesiredCaps(e.target.value)} value={rawDesiredCaps} className={SessionCSS.capsEditor} />
{!isValidCapsJson && <Alert message={invalidCapsJsonReason} type="error" />}
</div>}
{!isEditingDesiredCaps && <div>
<pre>{this.getFormattedJSON(caps)}</pre>
</div>}
</ClickOutside>
<div className={SessionCSS.capsEditorControls}>
{isEditingDesiredCaps && <Tooltip title={t('Cancel')}>
<Button onClick={abortDesiredCapsEditor} icon='close' className={SessionCSS.capsEditorButton} />
</Tooltip> }
{isEditingDesiredCaps && <Tooltip title={t('Save')}>
<Button onClick={saveRawDesiredCaps} icon='save' className={SessionCSS.capsEditorButton} />
</Tooltip>}
{!isEditingDesiredCaps && <Tooltip title={t('Edit Raw JSON')} placement="topRight" >
<Button onClick={startDesiredCapsEditor} icon='edit' />
</Tooltip> }
</div>
{isEditingDesiredCaps && <div>
<textarea rows='9' onChange={(e) => setRawDesiredCaps(e.target.value)} value={rawDesiredCaps} className={SessionCSS.capsEditor} />
{!isValidCapsJson && <Alert message={invalidCapsJsonReason} type="error" />}
</div>}
{!isEditingDesiredCaps && <div>
<pre>{this.getFormattedJSON(caps)}</pre>
</div>}
</Card>
</div>;
}
Expand Down
5 changes: 0 additions & 5 deletions package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@
"postcss": "^7.0.4",
"prop-types": "^15.6.2",
"react": "^16.9.0",
"react-click-outside-component": "^1.1.1",
"react-dom": "^16.9.0",
"react-hot-loader": "^4.3.12",
"react-i18next": "^10.0.4",
Expand Down

0 comments on commit 0c837ce

Please sign in to comment.