mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
convert other uses of state.on() to $scope.$listen(state, ...)
This commit is contained in:
parent
d0a2dde699
commit
5bdb9cb0a2
5 changed files with 6 additions and 15 deletions
2
TODOS.md
2
TODOS.md
|
@ -14,8 +14,6 @@
|
|||
- We need more than just _count here. – (https://github.com/elasticsearch/kibana4/blob/master/src/kibana/components/agg_types/buckets/terms.js)
|
||||
- **src/kibana/components/index_patterns/_mapper.js**
|
||||
- Change index to be the resolved in some way, last three months, last hour, last year, whatever – (https://github.com/elasticsearch/kibana4/blob/master/src/kibana/components/index_patterns/_mapper.js)
|
||||
- **src/kibana/components/state_management/state.js**
|
||||
- Change all the references to onUpdate to the actual fetch_with_changes event – (https://github.com/elasticsearch/kibana4/blob/master/src/kibana/components/state_management/state.js)
|
||||
- **src/kibana/components/visualize/visualize.js**
|
||||
- we need to have some way to clean up result requests – (https://github.com/elasticsearch/kibana4/blob/master/src/kibana/components/visualize/visualize.js)
|
||||
- **src/kibana/directives/rows.js**
|
||||
|
|
|
@ -137,7 +137,7 @@ define(function (require) {
|
|||
var ignoreStateChanges = ['columns'];
|
||||
|
||||
// listen for changes, and relisten everytime something happens
|
||||
$state.onUpdate(function (changed) {
|
||||
$scope.$listen($state, 'fetch_with_changes', function (changed) {
|
||||
if (_.contains(changed, 'columns')) {
|
||||
$scope.fields.forEach(function (field) {
|
||||
field.display = _.contains($state.columns, field.name);
|
||||
|
|
|
@ -110,7 +110,8 @@ define(function (require) {
|
|||
editableVis.dirty = !angular.equals(newState, vis.getState());
|
||||
}, true);
|
||||
|
||||
$state.on('fetch_with_changes', function () {
|
||||
$scope.$listen($state, 'fetch_with_changes', function () {
|
||||
|
||||
vis.setState($state.vis);
|
||||
editableVis.setState($state.vis);
|
||||
|
||||
|
@ -122,10 +123,11 @@ define(function (require) {
|
|||
}
|
||||
|
||||
$scope.fetch();
|
||||
|
||||
});
|
||||
|
||||
timefilter.enabled = true;
|
||||
timefilter.on('update', _.bindKey($scope, 'fetch'));
|
||||
$scope.$listen(timefilter, 'update', _.bindKey($scope, 'fetch'));
|
||||
|
||||
$scope.$on('ready:vis', function () {
|
||||
$scope.$emit('application.load');
|
||||
|
|
|
@ -67,15 +67,6 @@ define(function (require) {
|
|||
this.save();
|
||||
};
|
||||
|
||||
/**
|
||||
* Registers a listner for updates to pulls
|
||||
* TODO: Change all the references to onUpdate to the actual fetch_with_changes event
|
||||
* @returns {void}
|
||||
*/
|
||||
State.prototype.onUpdate = function (cb) {
|
||||
this.on('fetch_with_changes', cb);
|
||||
};
|
||||
|
||||
/**
|
||||
* Cleans up the state object
|
||||
* @returns {void}
|
||||
|
|
|
@ -73,7 +73,7 @@ define(function (require) {
|
|||
|
||||
it('should fire listeners for #onUpdate() on #fetch()', function (done) {
|
||||
var state = new State();
|
||||
state.onUpdate(function (keys) {
|
||||
state.on('fetch_with_changes', function (keys) {
|
||||
expect(keys).to.eql(['foo']);
|
||||
done();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue