mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Revert "Merge pull request #319 from simianhacker/filter-bar-terms"
This reverts commit1cae258cd2
, reversing changes made to1c8ca3e5d9
. Conflicts: src/kibana/components/vislib/visualizations/column_chart.js
This commit is contained in:
parent
774603a50f
commit
d2d52fce0c
5 changed files with 7 additions and 68 deletions
1
TODOS.md
1
TODOS.md
|
@ -446,7 +446,6 @@
|
|||
- **[src/kibana/components/vislib/vis.js](https://github.com/elasticsearch/kibana4/blob/master/src/kibana/components/vislib/vis.js)**
|
||||
- need to come up with a solution for resizing when no data is available
|
||||
- **[src/kibana/components/vislib/visualizations/column_chart.js](https://github.com/elasticsearch/kibana4/blob/master/src/kibana/components/vislib/visualizations/column_chart.js)**
|
||||
- Replace the following code with something more robust for finding the field
|
||||
- refactor so that this is called from the data module
|
||||
- **[src/kibana/components/visualize/visualize.js](https://github.com/elasticsearch/kibana4/blob/master/src/kibana/components/visualize/visualize.js)**
|
||||
- we need to have some way to clean up result requests
|
||||
|
|
|
@ -69,7 +69,6 @@
|
|||
config-object="conf">
|
||||
</config>
|
||||
|
||||
<filter-bar state="state"></filter-bar>
|
||||
|
||||
<div class="vis-editor-content">
|
||||
<vis-editor-sidebar
|
||||
|
@ -85,4 +84,4 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
|
@ -68,8 +68,7 @@ define(function (require) {
|
|||
var savedVisState = vis.getState();
|
||||
|
||||
var $state = appStateFactory.create({
|
||||
vis: savedVisState,
|
||||
filters: _.cloneDeep(searchSource.get('filter'))
|
||||
vis: savedVisState
|
||||
});
|
||||
|
||||
if (!angular.equals($state.vis, savedVisState)) {
|
||||
|
@ -123,12 +122,6 @@ define(function (require) {
|
|||
searchSource.set('query', null);
|
||||
}
|
||||
|
||||
if ($state.filters) {
|
||||
searchSource.set('filter', $state.filters);
|
||||
} else {
|
||||
searchSource.set('filter', null);
|
||||
}
|
||||
|
||||
$scope.fetch();
|
||||
|
||||
});
|
||||
|
@ -143,37 +136,8 @@ define(function (require) {
|
|||
$scope.$on('$destroy', function () {
|
||||
savedVis.destroy();
|
||||
});
|
||||
|
||||
if (!vis.listeners) vis.listeners = {};
|
||||
vis.listeners.click = function (e) {
|
||||
// This code is only inplace for the beta release this will all get refactored
|
||||
// after we get the release out.
|
||||
if (e.aggConfig && e.aggConfig.aggType && e.aggConfig.aggType.name === 'terms') {
|
||||
var filter;
|
||||
var filters = _.flatten([$state.filters || []], true);
|
||||
var previous = _.find(filters, function (item) {
|
||||
if (item && item.query) {
|
||||
return item.query.match[e.field].query === e.label;
|
||||
}
|
||||
});
|
||||
if (!previous) {
|
||||
filter = { query: { match: {} } };
|
||||
filter.query.match[e.field] = { query: e.label, type: 'phrase' };
|
||||
filters.push(filter);
|
||||
$state.filters = filters;
|
||||
}
|
||||
} else {
|
||||
notify.info('Filtering is only supported for Term aggergations at the time, others are coming soon.');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
$scope.$watch('state.filters', function (filters) {
|
||||
searchSource.set('filter', filters);
|
||||
$state.save();
|
||||
$scope.fetch();
|
||||
});
|
||||
|
||||
$scope.fetch = function () {
|
||||
searchSource.fetch();
|
||||
};
|
||||
|
|
|
@ -130,12 +130,8 @@ define(function (require) {
|
|||
datum.y = datum.y * colX.metricScale;
|
||||
}
|
||||
|
||||
if (hasColor) {
|
||||
datum.aggConfigs = [columns[iX], columns[iColor]];
|
||||
}
|
||||
|
||||
s.values.push(datum);
|
||||
});
|
||||
};
|
||||
};
|
||||
});
|
||||
});
|
|
@ -30,35 +30,16 @@ define(function (require) {
|
|||
|
||||
// Response to `click` and `hover` events
|
||||
ColumnChart.prototype.eventResponse = function (d, i) {
|
||||
|
||||
// Adding a look up for the field. Currently this relies on filtering the
|
||||
// data for the label then using that with the pointIndex to get the aggConfig.
|
||||
// It works for now... but we need something a little more robust. That will
|
||||
// come after the first beta. :)
|
||||
//
|
||||
// TODO: Replace the following code with something more robust for finding the field
|
||||
var field, series, aggConfig;
|
||||
if (d.label) {
|
||||
series = _.find(this.chartData.series, { label: d.label });
|
||||
aggConfig = _.last(series.values[i].aggConfigs);
|
||||
if (aggConfig.aggType.name === 'terms') {
|
||||
field = aggConfig.field.name;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
value: this._attr.yValue(d, i),
|
||||
point: d,
|
||||
label: d.label,
|
||||
color: this.vis.data.getColorFunc()(d.label),
|
||||
pointIndex: i,
|
||||
series: this.chartData.series,
|
||||
config: this._attr,
|
||||
data: this.chartData,
|
||||
e: d3.event,
|
||||
field: field,
|
||||
aggConfig: aggConfig,
|
||||
vis: this.vis
|
||||
series : this.chartData.series,
|
||||
config : this._attr,
|
||||
data : this.chartData,
|
||||
e : d3.event
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue