add fix for extra comments for #11781 (#11902)

This commit is contained in:
Grace Guo 2020-12-02 18:13:42 -08:00 committed by GitHub
parent 721f9119e1
commit 61064b9634
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

View File

@ -152,9 +152,7 @@ describe('DatasourceEditor', () => {
beforeAll(() => { beforeAll(() => {
isFeatureEnabledMock = jest isFeatureEnabledMock = jest
.spyOn(featureFlags, 'isFeatureEnabled') .spyOn(featureFlags, 'isFeatureEnabled')
.mockImplementation( .mockImplementation(() => false);
feature => feature === 'ENABLE_DATASET_SOURCE_EDIT',
);
wrapper = shallow(el, { context: { store } }).dive(); wrapper = shallow(el, { context: { store } }).dive();
}); });

View File

@ -715,8 +715,8 @@ class DatasourceEditor extends React.PureComponent {
<TextAreaControl <TextAreaControl
language="sql" language="sql"
offerEditInModal={false} offerEditInModal={false}
minLines={25} minLines={20}
maxLines={25} maxLines={20}
readOnly={!this.state.isEditMode} readOnly={!this.state.isEditMode}
/> />
} }

View File

@ -78,10 +78,14 @@ export default class TextAreaControl extends React.Component {
const value = this.props.value || ''; const value = this.props.value || '';
const minLines = inModal ? 40 : this.props.minLines || 12; const minLines = inModal ? 40 : this.props.minLines || 12;
if (this.props.language) { if (this.props.language) {
const style = { border: '1px solid #CCC' };
if (this.props.readOnly) {
style.backgroundColor = '#f2f2f2';
}
return ( return (
<TextAreaEditor <TextAreaEditor
mode={this.props.language} mode={this.props.language}
style={{ border: '1px solid #CCC' }} style={style}
minLines={minLines} minLines={minLines}
maxLines={inModal ? 1000 : this.props.maxLines} maxLines={inModal ? 1000 : this.props.maxLines}
onChange={this.onAceChangeDebounce} onChange={this.onAceChangeDebounce}