diff --git a/app/cdap/components/AbstractWidget/SecureKey/SecureKeyTextarea.js b/app/cdap/components/AbstractWidget/SecureKey/SecureKeyTextarea.js index aae5085a5d8..7f8979a848b 100644 --- a/app/cdap/components/AbstractWidget/SecureKey/SecureKeyTextarea.js +++ b/app/cdap/components/AbstractWidget/SecureKey/SecureKeyTextarea.js @@ -20,7 +20,7 @@ import SecureKey from 'components/AbstractWidget/SecureKey'; import { WIDGET_PROPTYPES } from 'components/AbstractWidget/constants'; export default function SecureKeyTextarea(props) { - return ; + return ; } SecureKeyTextarea.propTypes = WIDGET_PROPTYPES; diff --git a/app/cdap/components/AbstractWidget/SecureKey/index.js b/app/cdap/components/AbstractWidget/SecureKey/index.js index 299f430f160..c4ef294507b 100644 --- a/app/cdap/components/AbstractWidget/SecureKey/index.js +++ b/app/cdap/components/AbstractWidget/SecureKey/index.js @@ -15,6 +15,7 @@ */ import React, { Component } from 'react'; +import styled from 'styled-components'; import PropTypes from 'prop-types'; import { DEFAULT_WIDGET_PROPS } from 'components/AbstractWidget'; import { MySecureKeyApi } from 'api/securekey'; @@ -27,14 +28,24 @@ import { SECURE_KEY_PREFIX, SECURE_KEY_SUFFIX, SYSTEM_NAMESPACE } from 'services import Mousetrap from 'mousetrap'; import { Observable } from 'rxjs/Observable'; import { WIDGET_PROPTYPES } from 'components/AbstractWidget/constants'; +import { IconButton } from '@material-ui/core'; +import ClearIcon from '@material-ui/icons/Clear'; require('./SecureKeyTextarea.scss'); const PREFIX = 'features.AbstractWidget.SecureKeyTextarea'; +const NonEditableTextWrapper = styled.div` + position: relative; + display: flex; + align-items: center; + justify-content: space-between; + width: 100%; +`; + export default class SecureKeyTextarea extends Component { static propTypes = { ...WIDGET_PROPTYPES, - inputTextType: PropTypes.oneOf(['textarea', 'text', 'password']), + inputTextType: PropTypes.oneOf(['textarea', 'text', 'password', 'none']), dataCy: PropTypes.string, dataTestId: PropTypes.string, }; @@ -146,6 +157,13 @@ export default class SecureKeyTextarea extends Component { } }; + handleClearInput = (e) => { + e.stopPropagation(); + if (this.props.onChange) { + this.props.onChange(''); + } + }; + renderCustomEntry = () => { const helperText = (
@@ -215,6 +233,25 @@ export default class SecureKeyTextarea extends Component { }; renderInput = () => { + if (this.props.inputTextType === 'none') { + return ( + + {this.props.value} + {this.props.value && ( + + + + )} + + ); + } + if (this.props.inputTextType === 'textarea') { return (