Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.6] [ML] Fix missing $applyAsync() in AnomalyExplorer and Time Series Viewer (#28237) #28339

Merged
merged 1 commit into from
Jan 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ module.directive('mlJobSelectList', function (Private) {
} else {
$scope.noJobsCreated = true;
}
$scope.$applyAsync();
}).catch((resp) => {
console.log('mlJobSelectList controller - error getting job info from ES:', resp);
});
Expand Down
7 changes: 5 additions & 2 deletions x-pack/plugins/ml/public/explorer/explorer_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import 'plugins/ml/components/job_select_list';

import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter';
import { parseInterval } from 'ui/utils/parse_interval';
import { initPromise } from 'plugins/ml/util/promise';
import template from './explorer.html';

import uiRoutes from 'ui/routes';
Expand Down Expand Up @@ -64,7 +63,6 @@ uiRoutes
CheckLicense: checkFullLicense,
privileges: checkGetJobsPrivilege,
indexPatterns: loadIndexPatterns,
initPromise: initPromise(true)
}
});

Expand Down Expand Up @@ -196,6 +194,7 @@ module.controller('MlExplorerController', function (
$scope.loading = false;
}

$scope.$applyAsync();
}).catch((resp) => {
console.log('Explorer - error getting job info from elasticsearch:', resp);
});
Expand Down Expand Up @@ -291,6 +290,7 @@ module.controller('MlExplorerController', function (
restoreCellDataFromAppState();
updateExplorer();
}
$scope.$applyAsync();
});
};

Expand Down Expand Up @@ -647,6 +647,7 @@ module.controller('MlExplorerController', function (

loadTopInfluencers(jobIds, earliestMs, latestMs, filterInfluencers);
}
$scope.$applyAsync();
});
}

Expand Down Expand Up @@ -821,10 +822,12 @@ module.controller('MlExplorerController', function (
).then((resp) => {
// TODO - sort the influencers keys so that the partition field(s) are first.
$scope.influencers = resp.influencers;
$scope.$applyAsync();
console.log('Explorer top influencers data set:', $scope.influencers);
});
} else {
$scope.influencers = {};
$scope.$applyAsync();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ import { mlFieldFormatService } from 'plugins/ml/services/field_format_service';
import { JobSelectServiceProvider } from 'plugins/ml/components/job_select_list/job_select_service';
import { mlForecastService } from 'plugins/ml/services/forecast_service';
import { mlTimeSeriesSearchService } from 'plugins/ml/timeseriesexplorer/timeseries_search_service';
import { initPromise } from 'plugins/ml/util/promise';
import {
ANNOTATIONS_TABLE_DEFAULT_QUERY_SIZE,
ANOMALIES_TABLE_DEFAULT_QUERY_SIZE
Expand All @@ -67,7 +66,6 @@ uiRoutes
privileges: checkGetJobsPrivilege,
indexPatterns: loadIndexPatterns,
mlNodeCount: getMlNodeCount,
initPromise: initPromise(true)
}
});

Expand Down Expand Up @@ -193,6 +191,7 @@ module.controller('MlTimeSeriesExplorerController', function (
$scope.loading = false;
}

$scope.$applyAsync();
}).catch((resp) => {
console.log('Time series explorer - error getting job info from elasticsearch:', resp);
});
Expand Down Expand Up @@ -245,6 +244,10 @@ module.controller('MlTimeSeriesExplorerController', function (
$timeout(() => {
$scope.$broadcast('render');
}, 0);
} else {
// Call $applyAsync() if for any reason the upper condition doesn't trigger the $timeout.
// We still want to trigger a scope update about the changes above the condition.
$scope.$applyAsync();
}

}
Expand Down Expand Up @@ -843,6 +846,7 @@ module.controller('MlTimeSeriesExplorerController', function (
entity.fieldValues = _.chain(resp.records).pluck('by_field_value').uniq().value();
}
});
$scope.$applyAsync();
}

});
Expand Down