diff --git a/src/web/components/FieldQuickValuesPlus.jsx b/src/web/components/FieldQuickValuesPlus.jsx index 0da044b..831cc49 100644 --- a/src/web/components/FieldQuickValuesPlus.jsx +++ b/src/web/components/FieldQuickValuesPlus.jsx @@ -35,8 +35,8 @@ const FieldQuickValuesPlus = React.createClass({ dropdownIsOpen: false, loaded: false, data: [], - defaults: {top_values: 5, sort_order: "descending", table_size: 25, show_pie_chart: true, show_data_table: true}, - quickValuesOptions: {top_values: 5, sort_order: "descending", table_size: 25, show_pie_chart: true, show_data_table: true} + defaults: {top_values: 5, sort_order: "descending", table_size: 25, show_pie_chart: true, show_data_table: true, display_add_to_search_button: true, display_remove_from_search_button: true, display_exclude_from_query_button: true, display_get_term_reply_in_new_window_button: true}, + quickValuesOptions: {top_values: 5, sort_order: "descending", table_size: 25, show_pie_chart: true, show_data_table: true, display_add_to_search_button: true, display_remove_from_search_button: true, display_exclude_from_query_button: true, display_get_term_reply_in_new_window_button: true} }; }, style: style, @@ -46,7 +46,7 @@ const FieldQuickValuesPlus = React.createClass({ componentWillMount() { if (this.state.debug) console.log("In componentWillMount"); this.setState({ dropdownIsOpen: false }); - this.setState({quickValuesOptions: {top_values: 5, sort_order: "descending", table_size: 25, show_pie_chart: true, show_data_table: true}}); + this.setState({quickValuesOptions: {top_values: 5, sort_order: "descending", table_size: 25, show_pie_chart: true, show_data_table: true, display_add_to_search_button: true, display_remove_from_search_button: true, display_exclude_from_query_button: true, display_get_term_reply_in_new_window_button: true}}); }, componentDidMount() { @@ -125,7 +125,12 @@ const FieldQuickValuesPlus = React.createClass({ sort_order: this.state.configuration['org.graylog.plugins.quickvaluesplus.QuickValuesPlusPluginConfiguration'].sort_order, table_size: this.state.configuration['org.graylog.plugins.quickvaluesplus.QuickValuesPlusPluginConfiguration'].table_size, show_pie_chart: true, - show_data_table: true + show_data_table: true, + display_add_to_search_button: true, + display_remove_from_search_button: true, + display_exclude_from_query_button: true, + display_get_term_reply_in_new_window_button: true + }, loaded: true, }); @@ -148,7 +153,12 @@ const FieldQuickValuesPlus = React.createClass({ sort_order: this.state.defaults.sort_order, table_size: this.state.defaults.table_size, show_pie_chart: true, - show_data_table: true + show_data_table: true, + display_add_to_search_button: true, + display_remove_from_search_button: true, + display_exclude_from_query_button: true, + display_get_term_reply_in_new_window_button: true + }, }); } @@ -233,8 +243,8 @@ const FieldQuickValuesPlus = React.createClass({ data={this.state.data} horizontal displayAddToSearchButton - displayRemoveFromSearchButton - displayAnalysisInformation/> + displayRemoveFromSearchButton={this.state.quickValuesOptions.display_remove_from_search_button} + displayAnalysisInformation={this.state.quickValuesOptions.display_remove_from_search_button}/> ); } @@ -266,4 +276,4 @@ const FieldQuickValuesPlus = React.createClass({ }, }); -export default FieldQuickValuesPlus; \ No newline at end of file +export default FieldQuickValuesPlus; diff --git a/src/web/components/QuickValuesPlusVisualization.jsx b/src/web/components/QuickValuesPlusVisualization.jsx index b4f9a31..68cef23 100644 --- a/src/web/components/QuickValuesPlusVisualization.jsx +++ b/src/web/components/QuickValuesPlusVisualization.jsx @@ -30,8 +30,6 @@ const QuickValuesPlusVisualization = React.createClass({ height: PropTypes.any, horizontal: PropTypes.bool, displayAnalysisInformation: PropTypes.bool, - displayAddToSearchButton: PropTypes.bool, - displayRemoveFromSearchButton: PropTypes.bool, }, getInitialState() { this.filters = []; @@ -308,21 +306,21 @@ const QuickValuesPlusVisualization = React.createClass({ (d) => NumberUtils.formatNumber(d.count), ]; - if (this.props.displayAddToSearchButton) { + if (this.props.config.display_add_to_search_button == true ) { columns.push((d) => this._getAddToSearchButton(d.term)); } - if (this.props.displayRemoveFromSearchButton) { + if (this.props.config.display_remove_from_search_button == true) { columns.push((d) => this._getRemoveFromSearchButton(d.term)); } if (this.props.config.dashboardID) { - if (this.isPermitted(this.state.currentUser.permissions, [`dashboards:edit:${this.props.config.dashboardID}`])) { + if (this.isPermitted(this.state.currentUser.permissions, [`dashboards:edit:${this.props.config.dashboardID}`]) && this.props.config.display_exclude_from_query_button) { columns.push((d) => this._getExcludeFromQueryButton(d.term)); } } - if (this.props.config.field) { + if (this.props.config.field && this.props.config.display_get_term_reply_in_new_window_button) { columns.push((d) => { //Properly format strings containing spaces, backslashes and colons. let escTerm = this.escape(`${d.term}`); @@ -607,14 +605,15 @@ const QuickValuesPlusVisualization = React.createClass({ Value % # - {this.props.displayAddToSearchButton && + {this.props.config.display_add_to_search_button &&   } - {this.props.displayRemoveFromSearchButton && + {this.props.config.display_remove_from_search_button &&   } - {excludeQueryButton} - {this.props.config.field && + {this.props.config.display_exclude_from_query_button && + excludeQueryButton} + {(this.props.config.field && this.props.config.display_get_term_reply_in_new_window_button) &&   } @@ -629,4 +628,4 @@ const QuickValuesPlusVisualization = React.createClass({ }, }); -export default QuickValuesPlusVisualization; \ No newline at end of file +export default QuickValuesPlusVisualization; diff --git a/src/web/components/QuickValuesPlusWidgetCreateConfiguration.jsx b/src/web/components/QuickValuesPlusWidgetCreateConfiguration.jsx index b3ae065..6f1373c 100644 --- a/src/web/components/QuickValuesPlusWidgetCreateConfiguration.jsx +++ b/src/web/components/QuickValuesPlusWidgetCreateConfiguration.jsx @@ -1,4 +1,4 @@ -import React, {PropTypes} from 'react'; + import React, {PropTypes} from 'react'; import { Input } from 'components/bootstrap'; const QuickValuesPlusWidgetCreateConfiguration = React.createClass({ @@ -14,6 +14,10 @@ const QuickValuesPlusWidgetCreateConfiguration = React.createClass({ sort_order: 'descending', show_pie_chart: true, show_data_table: true, + display_add_to_search_button: true, + display_remove_from_search_button: true, + display_exclude_from_query_button: true, + display_get_term_reply_in_new_window_button: true, }; }, @@ -38,7 +42,7 @@ const QuickValuesPlusWidgetCreateConfiguration = React.createClass({ onChange={this.props.onChange} help="Modify the number of results in the table."/> - +