Fix/add default props to prom query editor (#21908)

* Plugins: Add default query to PromQueryEditor

* Plugins: Update PromQueryEditor snapshot

* Plugins: Use Partial for default PromQuery
This commit is contained in:
Alex Khomenko
2020-02-04 11:37:18 +02:00
committed by GitHub
parent bb8e15ceab
commit 3d8317a747
2 changed files with 8 additions and 1 deletions

View File

@@ -37,7 +37,9 @@ export class PromQueryEditor extends PureComponent<Props, State> {
constructor(props: Props) {
super(props);
const { query } = props;
// Use default query to prevent undefined input values
const defaultQuery: Partial<PromQuery> = { expr: '', legendFormat: '', interval: '' };
const query = Object.assign({}, defaultQuery, props.query);
this.query = query;
// Query target properties that are fully controlled inputs
this.state = {