|
@@ -110,8 +110,8 @@ export class QueryEditorRow extends PureComponent<Props, State> {
|
|
|
const { datasource } = this.state;
|
|
const { datasource } = this.state;
|
|
|
|
|
|
|
|
if (datasource.pluginExports.QueryCtrl) {
|
|
if (datasource.pluginExports.QueryCtrl) {
|
|
|
|
|
+ return <div ref={element => (this.element = element)} />;
|
|
|
}
|
|
}
|
|
|
- return <div ref={element => (this.element = element)} />;
|
|
|
|
|
|
|
|
|
|
if (datasource.pluginExports.QueryEditor) {
|
|
if (datasource.pluginExports.QueryEditor) {
|
|
|
const QueryEditor = datasource.pluginExports.QueryEditor;
|
|
const QueryEditor = datasource.pluginExports.QueryEditor;
|
|
@@ -128,7 +128,7 @@ export class QueryEditorRow extends PureComponent<Props, State> {
|
|
|
angularScope.toggleEditorMode();
|
|
angularScope.toggleEditorMode();
|
|
|
this.angularQueryEditor.digest();
|
|
this.angularQueryEditor.digest();
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
get hasTextEditMode() {
|
|
get hasTextEditMode() {
|
|
|
const { angularScope } = this.state;
|
|
const { angularScope } = this.state;
|
|
@@ -149,6 +149,16 @@ export class QueryEditorRow extends PureComponent<Props, State> {
|
|
|
this.forceUpdate();
|
|
this.forceUpdate();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ renderCollapsedText(): string | null {
|
|
|
|
|
+ const { angularScope } = this.state;
|
|
|
|
|
+
|
|
|
|
|
+ if (angularScope && angularScope.getCollapsedText) {
|
|
|
|
|
+ return angularScope.getCollapsedText();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
render() {
|
|
render() {
|
|
|
const { query, datasourceName, inMixedMode } = this.props;
|
|
const { query, datasourceName, inMixedMode } = this.props;
|
|
|
const { datasource, isCollapsed } = this.state;
|
|
const { datasource, isCollapsed } = this.state;
|
|
@@ -177,9 +187,16 @@ export class QueryEditorRow extends PureComponent<Props, State> {
|
|
|
{inMixedMode && <em className="query-editor-row__context-info"> ({datasourceName})</em>}
|
|
{inMixedMode && <em className="query-editor-row__context-info"> ({datasourceName})</em>}
|
|
|
{isDisabled && <em className="query-editor-row__context-info"> Disabled</em>}
|
|
{isDisabled && <em className="query-editor-row__context-info"> Disabled</em>}
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <div className="query-editor-row__collapsed-text">
|
|
|
|
|
+ {isCollapsed && <div>{this.renderCollapsedText()}</div>}
|
|
|
|
|
+ </div>
|
|
|
<div className="query-editor-row__actions">
|
|
<div className="query-editor-row__actions">
|
|
|
{this.hasTextEditMode && (
|
|
{this.hasTextEditMode && (
|
|
|
- <button className="query-editor-row__action" onClick={this.onToggleEditMode} title="Toggle text edit mode">
|
|
|
|
|
|
|
+ <button
|
|
|
|
|
+ className="query-editor-row__action"
|
|
|
|
|
+ onClick={this.onToggleEditMode}
|
|
|
|
|
+ title="Toggle text edit mode"
|
|
|
|
|
+ >
|
|
|
<i className="fa fa-fw fa-pencil" />
|
|
<i className="fa fa-fw fa-pencil" />
|
|
|
</button>
|
|
</button>
|
|
|
)}
|
|
)}
|
|
@@ -218,4 +235,5 @@ export interface AngularQueryComponentScope {
|
|
|
moveQuery: (query: DataQuery, direction: number) => void;
|
|
moveQuery: (query: DataQuery, direction: number) => void;
|
|
|
datasource: DataSourceApi;
|
|
datasource: DataSourceApi;
|
|
|
toggleEditorMode?: () => void;
|
|
toggleEditorMode?: () => void;
|
|
|
|
|
+ getCollapsedText?: () => string;
|
|
|
}
|
|
}
|