mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[ML] [6.x] Better error reporting in create recognized job page (#18638)
* Better error reporting in create recognized job page * removing failed jobs from the results url
This commit is contained in:
parent
e71719f2d3
commit
6b8ce02a96
2 changed files with 46 additions and 20 deletions
|
@ -127,10 +127,15 @@
|
|||
|
||||
<div class='job-state-info' ng-show="overallState === SAVE_STATE.SAVING">Analysis running <i class='fa fa-spinner fa-spin' aria-label="Analysis running" ></i></div>
|
||||
</div>
|
||||
<div ng-show="overallState === SAVE_STATE.SAVED">
|
||||
<h3 class="euiTitle euiTitle--large">Jobs created
|
||||
<div ng-show="overallState === SAVE_STATE.SAVED || overallState === SAVE_STATE.PARTIAL_FAILURE">
|
||||
<h3 ng-if="overallState === SAVE_STATE.SAVED" class="euiTitle euiTitle--large">Jobs created
|
||||
<i style="color:green;" class="fa fa-check" aria-label="Saved"></i>
|
||||
</h3>
|
||||
|
||||
<h3 ng-if="overallState === SAVE_STATE.PARTIAL_FAILURE" class="euiTitle euiTitle--large">Some jobs failed to be created
|
||||
<i style="color:red;" class="fa fa-remove" aria-label="Save failed"></i>
|
||||
</h3>
|
||||
|
||||
<div class="euiSpacer euiSpacer--m"></div>
|
||||
|
||||
<button
|
||||
|
@ -154,7 +159,9 @@
|
|||
</div>
|
||||
|
||||
<div ng-show="overallState === SAVE_STATE.FAILED">
|
||||
<h3 class="euiTitle euiTitle--large">Jobs creation failed</h3>
|
||||
<h3 class="euiTitle euiTitle--large">Jobs creation failed
|
||||
<i style="color:red;" class="fa fa-remove" aria-label="Save failed"></i>
|
||||
</h3>
|
||||
<div class="euiSpacer euiSpacer--m"></div>
|
||||
|
||||
<button
|
||||
|
|
|
@ -58,7 +58,8 @@ module
|
|||
NOT_SAVED: 0,
|
||||
SAVING: 1,
|
||||
SAVED: 2,
|
||||
FAILED: 3
|
||||
FAILED: 3,
|
||||
PARTIAL_FAILURE: 4
|
||||
};
|
||||
|
||||
const DATAFEED_STATE = {
|
||||
|
@ -224,33 +225,21 @@ module
|
|||
angular.element('.results').css('opacity', 1);
|
||||
// wait 500ms for the results section to fade in.
|
||||
window.setTimeout(() => {
|
||||
// save jobs,datafeeds and kibana savedObjects
|
||||
// save jobs,datafeeds and kibana savedObjects
|
||||
saveDataRecognizerItems()
|
||||
.then(() => {
|
||||
const jobIds = $scope.formConfig.jobs.map(job => `${$scope.formConfig.jobLabel}${job.id}`);
|
||||
|
||||
// open jobs and save start datafeeds
|
||||
if ($scope.formConfig.startDatafeedAfterSave) {
|
||||
startDatafeeds()
|
||||
.then(() => {
|
||||
// everything saved correctly and datafeeds have started.
|
||||
$scope.overallState = SAVE_STATE.SAVED;
|
||||
$scope.resultsUrl = createResultsUrl(
|
||||
jobIds,
|
||||
$scope.formConfig.start,
|
||||
$scope.formConfig.end,
|
||||
'explorer');
|
||||
$scope.setOverallState();
|
||||
}).catch(() => {
|
||||
$scope.overallState = SAVE_STATE.FAILED;
|
||||
$scope.setOverallState();
|
||||
});
|
||||
} else {
|
||||
// datafeeds didn't need to be started so finish
|
||||
$scope.overallState = SAVE_STATE.SAVED;
|
||||
$scope.resultsUrl = createResultsUrl(
|
||||
jobIds,
|
||||
$scope.formConfig.start,
|
||||
$scope.formConfig.end,
|
||||
'explorer');
|
||||
$scope.setOverallState();
|
||||
}
|
||||
});
|
||||
}, 500);
|
||||
|
@ -382,6 +371,9 @@ module
|
|||
|
||||
function open(job) {
|
||||
if (job.jobState === SAVE_STATE.FAILED) {
|
||||
// we're skipping over the datafeed, so bump the
|
||||
// counter up manually so it all tallies at the end.
|
||||
datafeedCounter++;
|
||||
job.runningState = DATAFEED_STATE.FAILED;
|
||||
incrementAndOpen(job);
|
||||
return;
|
||||
|
@ -461,6 +453,33 @@ module
|
|||
});
|
||||
}
|
||||
|
||||
$scope.setOverallState = function () {
|
||||
const jobIds = [];
|
||||
const failedJobsCount = $scope.formConfig.jobs.reduce((count, job) => {
|
||||
if (job.jobState === SAVE_STATE.FAILED || job.datafeedState === SAVE_STATE.FAILED) {
|
||||
return count + 1;
|
||||
} else {
|
||||
jobIds.push(`${$scope.formConfig.jobLabel}${job.id}`);
|
||||
return count;
|
||||
}
|
||||
}, 0);
|
||||
|
||||
if (failedJobsCount) {
|
||||
if (failedJobsCount === $scope.formConfig.jobs.length) {
|
||||
$scope.overallState = SAVE_STATE.FAILED;
|
||||
} else {
|
||||
$scope.overallState = SAVE_STATE.PARTIAL_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
$scope.resultsUrl = createResultsUrl(
|
||||
jobIds,
|
||||
$scope.formConfig.start,
|
||||
$scope.formConfig.end,
|
||||
'explorer');
|
||||
};
|
||||
|
||||
|
||||
function validateJobs() {
|
||||
let valid = true;
|
||||
const checks = $scope.ui.validation.checks;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue