mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Move Visualization to QueryRow (#34658)
* move visualization to queryeditorrow * add prop to hide disable query * move panel plugin state outside the vizwrapper
This commit is contained in:
@@ -42,6 +42,8 @@ interface Props {
|
||||
onRemoveQuery: (query: DataQuery) => void;
|
||||
onChange: (query: DataQuery) => void;
|
||||
onRunQuery: () => void;
|
||||
visualization?: ReactNode;
|
||||
hideDisableQuery?: boolean;
|
||||
}
|
||||
|
||||
interface State {
|
||||
@@ -271,7 +273,7 @@ export class QueryEditorRow extends PureComponent<Props, State> {
|
||||
}
|
||||
|
||||
renderActions = (props: QueryOperationRowRenderProps) => {
|
||||
const { query } = this.props;
|
||||
const { query, hideDisableQuery = false } = this.props;
|
||||
const { hasTextEditMode, datasource } = this.state;
|
||||
const isDisabled = query.hide;
|
||||
|
||||
@@ -292,11 +294,13 @@ export class QueryEditorRow extends PureComponent<Props, State> {
|
||||
/>
|
||||
)}
|
||||
<QueryOperationAction title="Duplicate query" icon="copy" onClick={this.onCopyQuery} />
|
||||
<QueryOperationAction
|
||||
title="Disable/enable query"
|
||||
icon={isDisabled ? 'eye-slash' : 'eye'}
|
||||
onClick={this.onDisableQuery}
|
||||
/>
|
||||
{!hideDisableQuery ? (
|
||||
<QueryOperationAction
|
||||
title="Disable/enable query"
|
||||
icon={isDisabled ? 'eye-slash' : 'eye'}
|
||||
onClick={this.onDisableQuery}
|
||||
/>
|
||||
) : null}
|
||||
<QueryOperationAction title="Remove query" icon="trash-alt" onClick={this.onRemoveQuery} />
|
||||
</HorizontalGroup>
|
||||
);
|
||||
@@ -321,7 +325,7 @@ export class QueryEditorRow extends PureComponent<Props, State> {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { query, id, index } = this.props;
|
||||
const { query, id, index, visualization } = this.props;
|
||||
const { datasource, showingHelp } = this.state;
|
||||
const isDisabled = query.hide;
|
||||
|
||||
@@ -359,6 +363,7 @@ export class QueryEditorRow extends PureComponent<Props, State> {
|
||||
)}
|
||||
{editor}
|
||||
</ErrorBoundaryAlert>
|
||||
{visualization}
|
||||
</div>
|
||||
</QueryOperationRow>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user