Skip to content

Commit 3332ac8

Browse files
committed
[bugfix] querier datasource, editor content and sql content overlap
**Phenomenon and reproduction steps** none **Root cause and solution** root cause - editor content is too wide solution - add hide/show button to sql content **Impactions** none **Test method** none **Affected branch(es)** - main **Checklist** - [ ] Dependencies update required - [ ] Common bug (similar problem in other repo)
1 parent 6259ebe commit 3332ac8

File tree

2 files changed

+35
-10
lines changed

2 files changed

+35
-10
lines changed

deepflow-querier-datasource/src/QueryEditor.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@
197197
.sql-content {
198198
min-width: 120px;
199199
margin-left: 12px;
200-
overflow: auto;
201-
padding: 8px 12px 8px 6px;
200+
overflow: hidden;
201+
padding: 12px 6px 12px 6px;
202202
background: #00262f;
203203
border-radius: 2px;
204204
box-shadow: 0px 0px 1px 0 #938d8d;

deepflow-querier-datasource/src/QueryEditor.tsx

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ export class QueryEditor extends PureComponent<Props> {
124124
templateVariableOpts: SelectOpts
125125
runQueryWarning: boolean
126126
copied: boolean
127+
collapsed: boolean
127128
}
128129
constructor(props: any) {
129130
super(props)
@@ -170,7 +171,8 @@ export class QueryEditor extends PureComponent<Props> {
170171
gotBasicData: false,
171172
templateVariableOpts: [],
172173
runQueryWarning: false,
173-
copied: false
174+
copied: false,
175+
collapsed: false
174176
}
175177
}
176178

@@ -1188,6 +1190,12 @@ export class QueryEditor extends PureComponent<Props> {
11881190
}, 1800)
11891191
}
11901192

1193+
onCollapseBtnClick = () => {
1194+
this.setState({
1195+
collapsed: !this.state.collapsed
1196+
})
1197+
}
1198+
11911199
render() {
11921200
const {
11931201
formConfig,
@@ -1525,13 +1533,30 @@ export class QueryEditor extends PureComponent<Props> {
15251533
</div>
15261534
{appType !== APPTYPE_APP_TRACING_FLAME && this.sqlContent ? (
15271535
<div className="sql-content-wrapper">
1528-
<div className="sql-content" dangerouslySetInnerHTML={{ __html: this.sqlContent }}></div>
1529-
<Button
1530-
style={{ position: 'absolute', right: 0, top: 0 }}
1531-
fill="text"
1532-
icon={this.state.copied ? 'check' : 'copy'}
1533-
onClick={this.onCopySQLBtnClick}
1534-
/>
1536+
<div
1537+
className="sql-content"
1538+
style={{
1539+
maxHeight: this.state.collapsed ? '32px' : '',
1540+
padding: this.state.collapsed ? '32px 6px 0 6px' : ''
1541+
}}
1542+
dangerouslySetInnerHTML={{ __html: this.sqlContent }}
1543+
></div>
1544+
<Tooltip content={this.state.collapsed ? 'Show' : 'Hide'} placement="top">
1545+
<Button
1546+
style={{ position: 'absolute', right: '32px', top: 0 }}
1547+
fill="text"
1548+
icon={this.state.collapsed ? 'eye' : 'eye-slash'}
1549+
onClick={this.onCollapseBtnClick}
1550+
/>
1551+
</Tooltip>
1552+
<Tooltip content={this.state.copied ? 'Copied' : 'Copy'} placement="top">
1553+
<Button
1554+
style={{ position: 'absolute', right: 0, top: 0 }}
1555+
fill="text"
1556+
icon={this.state.copied ? 'check' : 'copy'}
1557+
onClick={this.onCopySQLBtnClick}
1558+
/>
1559+
</Tooltip>
15351560
</div>
15361561
) : null}
15371562
</div>

0 commit comments

Comments
 (0)