Skip to content

Commit

Permalink
Adds default empty string to query.query passed into QueryBar
Browse files Browse the repository at this point in the history
  • Loading branch information
TinaHeiligers committed May 11, 2019
1 parent 6ef641f commit 061a01d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class GaugePanelConfigUi extends Component {
const { intl } = this.props;
const defaults = {
gauge_max: '',
filter: '',
filter: { query: '', language: uiSettingsQueryLanguage },
gauge_style: 'circle',
gauge_inner_width: '',
gauge_width: ''
Expand Down Expand Up @@ -169,8 +169,8 @@ class GaugePanelConfigUi extends Component {
>
<QueryBar
query={{
language: model.filter.language ? model.filter.language : this.state.uiQueryLanguage,
query: model.filter.query,
language: model.filter.language ? model.filter.language : uiSettingsQueryLanguage,
query: model.filter.query || '',
}}
screenTitle={'GaugePanelConfigQuery'}
onSubmit={this.handleSubmit}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class MarkdownPanelConfigUi extends Component {
this.state = {
selectedTab: 'markdown',
indexPatternForQuery: {},
uiQueryLanguage: uiSettingsQueryLanguage,
};
this.handleCSSChange = this.handleCSSChange.bind(this);
}
Expand Down Expand Up @@ -96,7 +95,7 @@ class MarkdownPanelConfigUi extends Component {
}

render() {
const defaults = { filter: '' };
const defaults = { filter: { query: '', language: uiSettingsQueryLanguage } };
const model = { ...defaults, ...this.props.model };
const { selectedTab } = this.state;
const handleSelectChange = createSelectHandler(this.props.onChange);
Expand Down Expand Up @@ -178,10 +177,10 @@ class MarkdownPanelConfigUi extends Component {
>
<QueryBar
query={{
language: model.filter.language ? model.filter.language : this.state.uiQueryLanguage,
query: model.filter.query,
language: model.filter.language ? model.filter.language : uiSettingsQueryLanguage,
query: model.filter.query || '',
}}
screenTitle={'TimeseriesPanelConfigQuery'}
screenTitle={'MarkdownPanelConfigQuery'}
onSubmit={this.handleSubmit}
appName={'VisEditor'}
indexPatterns={[this.state.indexPatternForQuery]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ class MetricPanelConfig extends Component {
super(props);
this.state = {
selectedTab: 'data',
indexPatternForQuery: {},
uiQueryLanguage: uiSettingsQueryLanguage,
indexPatternForQuery: {}
};
}

Expand Down Expand Up @@ -88,7 +87,7 @@ class MetricPanelConfig extends Component {

render() {
const { selectedTab } = this.state;
const defaults = { filter: '' };
const defaults = { filter: { query: '', language: uiSettingsQueryLanguage } };
const model = { ...defaults, ...this.props.model };
const htmlId = htmlIdGenerator();
let view;
Expand Down Expand Up @@ -138,8 +137,8 @@ class MetricPanelConfig extends Component {
>
<QueryBar
query={{
language: model.filter.language ? model.filter.language : this.state.uiQueryLanguage,
query: model.filter.query,
language: model.filter.language ? model.filter.language : uiSettingsQueryLanguage,
query: model.filter.query || '',
}}
screenTitle={'MetricPanelConfigQuery'}
onSubmit={this.handleSubmit}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,13 @@ class TablePanelConfig extends Component {

render() {
const { selectedTab } = this.state;
const defaults = { drilldown_url: '', filter: '', pivot_label: '', pivot_rows: 10, pivot_type: '' };
const defaults = {
drilldown_url: '',
filter: { query: '', language: uiSettingsQueryLanguage },
pivot_label: '',
pivot_rows: 10,
pivot_type: '',
};
const model = { ...defaults, ...this.props.model };
const handleTextChange = createTextHandler(this.props.onChange);
const htmlId = htmlIdGenerator();
Expand Down Expand Up @@ -187,7 +193,7 @@ class TablePanelConfig extends Component {
visData$={this.props.visData$}
onChange={this.props.onChange}
indexPatterns={this.state.indexPatternForQuery}
uiQueryLanguage={this.state.uiQueryLanguage}
uiQueryLanguage={uiSettingsQueryLanguage}
/>
</div>
);
Expand Down Expand Up @@ -248,10 +254,10 @@ class TablePanelConfig extends Component {
>
<QueryBar
query={{
language: model.filter.language ? model.filter.language : this.state.uiQueryLanguage,
query: model.filter.query,
language: model.filter.language ? model.filter.language : uiSettingsQueryLanguage,
query: model.filter.query || '',
}}
screenTitle={'TimeseriesPanelConfigQuery'}
screenTitle={'TablePanelConfigQuery'}
onSubmit={this.handleSubmit}
appName={'VisEditor'}
indexPatterns={[this.state.indexPatternForQuery]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class TopNPanelConfig extends Component {

render() {
const { selectedTab } = this.state;
const defaults = { drilldown_url: '', filter: '' };
const defaults = { drilldown_url: '', filter: { query: '', language: uiSettingsQueryLanguage } };
const model = { ...defaults, ...this.props.model };
const htmlId = htmlIdGenerator();
const handleTextChange = createTextHandler(this.props.onChange);
Expand Down Expand Up @@ -160,7 +160,7 @@ class TopNPanelConfig extends Component {
<QueryBar
query={{
language: model.filter.language ? model.filter.language : uiSettingsQueryLanguage,
query: model.filter.query,
query: model.filter.query || '',
}}
screenTitle={'TopNPanelConfigQuery'}
onSubmit={this.handleSubmit}
Expand Down

0 comments on commit 061a01d

Please sign in to comment.