lib/js/app/stores/ExplorerStore.js
function _removeInvalidFields(newModel) {
  if (!ExplorerUtils.isEmailExtraction(newModel)) {
    newModel.query.latest = null;
    newModel.query.email = null;
  }
  if (newModel.query.analysis_type === 'extraction') {
    newModel.query.group_by = null;
    newModel.query.order_by = null;
    newModel.query.limit = null;
    newModel.query.interval = null;
  }
  if (newModel.query.analysis_type !== 'extraction') {
    newModel.query.latest = null;
  }
  if (newModel.query.analysis_type !== 'percentile') {
    newModel.query.percentile = null;
  }
  if (_.includes(['count', 'extraction', 'funnel'], newModel.query.analysis_type)) {
    newModel.query.target_property = null;
  }
  if (newModel.query.analysis_type !== 'funnel') {
    newModel.query.steps = [];
  }
  if(newModel.query.analysis_type === 'funnel') {
    newModel.query.filters = [];
    newModel.query.time = null;
    newModel.query.timezone = null;
    newModel.query.group_by = null;
    newModel.query.order_by = null;
    newModel.query.limit = null;
    newModel.query.timeframe = null;
    newModel.query.interval = null;
  }
  return newModel;
}
function _removeInvalidFields(newModel) {
  if (!ExplorerUtils.isEmailExtraction(newModel)) {
    newModel.query.latest = null;
    newModel.query.email = null;
  }
  if (newModel.query.analysis_type === 'extraction') {
    newModel.query.group_by = null;
    newModel.query.order_by = null;
    newModel.query.limit = null;
    newModel.query.interval = null;
  }
  if (newModel.query.analysis_type !== 'extraction') {
    newModel.query.latest = null;
  }
  if (newModel.query.analysis_type !== 'percentile') {
    newModel.query.percentile = null;
  }
  if (_.includes(['count', 'extraction', 'funnel'], newModel.query.analysis_type)) {
    newModel.query.target_property = null;
  }
  if (newModel.query.analysis_type !== 'funnel') {
    newModel.query.steps = [];
  }
  if(newModel.query.analysis_type === 'funnel') {
    newModel.query.filters = [];
    newModel.query.time = null;
    newModel.query.timezone = null;
    newModel.query.group_by = null;
    newModel.query.order_by = null;
    newModel.query.limit = null;
    newModel.query.timeframe = null;
    newModel.query.interval = null;
  }
  return newModel;
}
function _removeInvalidFields ( newModel ) { if ( ! ExplorerUtils . isEmailExtraction ( newModel ) ) { newModel . query . latest = null ; newModel . query . email = null ; } if ( newModel . query . analysis_type === 'extraction' ) { newModel . query . group_by = null ; newModel . query . order_by = null ; newModel . query . limit = null ; newModel . query . interval = null ; } if ( newModel . query . analysis_type !== 'extraction' ) { newModel . query . latest = null ; } if ( newModel . query . analysis_type !== 'percentile' ) { newModel . query . percentile = null ; } if ( _ . includes ( [ 'count' , 'extraction' , 'funnel' ] , newModel . query . analysis_type ) ) { newModel . query . target_property = null ; } if ( newModel . query . analysis_type !== 'funnel' ) { newModel . query . steps = [ ] ; } if ( newModel . query . analysis_type === 'funnel' ) { newModel . query . filters = [ ] ; newModel . query . time = null ; newModel . query . timezone = null ; newModel . query . group_by = null ; newModel . query . order_by = null ; newModel . query . limit = null ; newModel . query . timeframe = null ; newModel . query . interval = null ; } return newModel ; }
Removes fields from the query that aren't valid given the new analysis type.
@param {Object} newModel   The updated explorer model
@return {Object}           The new set of updates
Removes fields from the query that aren t valid given the new analysis type .