mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[ML] Fixes watch creation for advanced job wizard. (#27594)
Fixes a regression where the advanced job creation wizard wouldn't trigger the watch creation flyout in the jobs list. The advanced job creation wizard is still based on angularjs and triggered broadcast events to trigger the watch creation, but with the new React based jobs list the listeners for those events were gone. This PR fixes it by passing on the jobs list wrapping angular scope to be able to subscribe to the events from the React based JobsListView component. Passing on angular's scope down to React components should be considered a workaround so we don't have to refactor all affected code to use another event system. Once the advanced job wizard gets ported to React too this should be revisited.
This commit is contained in:
parent
9b4a5a07d8
commit
8fb34fc752
3 changed files with 14 additions and 4 deletions
|
@ -62,6 +62,15 @@ export class JobsListView extends Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
// The advanced job wizard is still angularjs based and triggers
|
||||
// broadcast events which it expects the jobs list to be subscribed to.
|
||||
this.props.angularWrapperScope.$on('jobsUpdated', () => {
|
||||
this.refreshJobSummaryList(true);
|
||||
});
|
||||
this.props.angularWrapperScope.$on('openCreateWatchWindow', (e, job) => {
|
||||
this.showCreateWatchFlyout(job.job_id);
|
||||
});
|
||||
|
||||
timefilter.disableTimeRangeSelector();
|
||||
timefilter.enableAutoRefreshSelector();
|
||||
|
||||
|
|
|
@ -46,7 +46,9 @@ module.directive('jobsPage', function () {
|
|||
restrict: 'E',
|
||||
link: (scope, element) => {
|
||||
ReactDOM.render(
|
||||
<I18nProvider>{React.createElement(JobsPage)}</I18nProvider>,
|
||||
<I18nProvider>
|
||||
{React.createElement(JobsPage, { angularWrapperScope: scope })}
|
||||
</I18nProvider>,
|
||||
element[0]
|
||||
);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import { JobsListView } from './components/jobs_list_view';
|
|||
import React from 'react';
|
||||
|
||||
|
||||
export const JobsPage = () => (
|
||||
<JobsListView />
|
||||
export const JobsPage = (props) => (
|
||||
<JobsListView {...props} />
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue