[ML] Adding missed applyAsync calls (#28814)

* [ML] Adding missed applyAsync calls

* fixing data recognizer results panel

* adding extra applySync calls to job saving in advanced job page

* fix for forcast results display issue
This commit is contained in:
James Gowdy 2019-01-24 10:01:15 +00:00 committed by GitHub
parent 735cc82edd
commit ad4884890b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 3 deletions

View file

@ -41,6 +41,9 @@ export class DataRecognizer extends Component {
));
if (typeof this.results === 'object') {
this.results.count = results.length;
if (typeof this.results.onChange === 'function') {
this.results.onChange();
}
}
this.setState({

View file

@ -95,7 +95,12 @@ module
$scope.metricFieldFilter = '';
$scope.fieldFilterIcon = 0;
$scope.fieldFilter = '';
$scope.recognizerResults = { count: 0 };
$scope.recognizerResults = {
count: 0,
onChange() {
$scope.$applyAsync();
}
};
$scope.showSidebar = isFullLicense();

View file

@ -595,6 +595,7 @@ module.controller('MlNewJob',
);
// update status
$scope.ui.saveStatus.job = 2;
$scope.$applyAsync();
// save successful, attempt to open the job
mlJobService.openJob($scope.job.job_id)
@ -631,10 +632,14 @@ module.controller('MlNewJob',
resp
);
$scope.saveLock = false;
})
.then(() => {
$scope.$applyAsync();
});
} else {
// no datafeed, so save is complete
$scope.saveLock = false;
$scope.$applyAsync();
}
}
@ -650,6 +655,7 @@ module.controller('MlNewJob',
values: { message: result.resp.message }
})
);
$scope.$applyAsync();
}
}).catch((result) => {
$scope.ui.saveStatus.job = -1;
@ -660,6 +666,7 @@ module.controller('MlNewJob',
values: { message: result.resp.message }
})
);
$scope.$applyAsync();
});
}
})
@ -670,11 +677,13 @@ module.controller('MlNewJob',
})
);
console.log('save(): job validation failed. Jobs list could not be loaded.');
$scope.$applyAsync();
});
}
else {
msgs.error(jobValid.message);
console.log('save(): job validation failed');
$scope.$applyAsync();
}
};
@ -689,6 +698,7 @@ module.controller('MlNewJob',
})
.then(() => {
msgs.clear();
$scope.$applyAsync();
$location.path('jobs');
});
};

View file

@ -475,6 +475,7 @@ module
msgs.error(i18n('xpack.ml.newJob.simple.singleMetric.saveDatafeedFailedErrorMessage', {
defaultMessage: 'Save datafeed failed: '
}), resp);
$scope.$applyAsync();
});
}
};

View file

@ -32,7 +32,7 @@ import { I18nProvider } from '@kbn/i18n/react';
import chrome from 'ui/chrome';
const mlAnnotationsEnabled = chrome.getInjected('mlAnnotationsEnabled', false);
module.directive('mlTimeseriesChart', function () {
module.directive('mlTimeseriesChart', function ($timeout) {
function link(scope, element) {
// Key dimensions for the viz and constituent charts.
@ -85,7 +85,9 @@ module.directive('mlTimeseriesChart', function () {
renderReactComponent();
scope.$on('render', () => {
renderReactComponent();
$timeout(() => {
renderReactComponent();
});
});
function renderFocusChart() {