Skip to content

Commit

Permalink
[ML] Keep the edit rule flyout open if there are multiple rules (#68174)
Browse files Browse the repository at this point in the history
  • Loading branch information
qn895 authored Jun 4, 2020
1 parent c5546f4 commit a8f04f8
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,14 @@ class RuleEditorFlyoutUI extends Component {
}
)
);
this.closeFlyout();
const updatedJob = mlJobService.getJob(anomaly.jobId);
const updatedDetector = updatedJob.analysis_config.detectors[detectorIndex];
const updatedRules = updatedDetector.custom_rules;
if (!updatedRules) {
this.closeFlyout();
} else {
this.setState({ job: { ...updatedJob } });
}
} else {
toasts.addDanger(
i18n.translate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function SelectRuleAction({
if (rules.length > 0) {
ruleActionPanels = rules.map((rule, index) => {
return (
<React.Fragment key={`rule_panel_${index}`}>
<React.Fragment key={`rule_panel_${index}_${rules.length}`}>
<RuleActionPanel
job={job}
ruleIndex={index}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,6 @@ function processRecordsForDisplay(anomalyRecords) {
}
});

console.log('explorer charts aggregatedData is:', aggregatedData);
let recordsForSeries = [];
// Convert to an array of the records with the highest record_score per unique series.
_.each(aggregatedData, (detectorsForJob) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,6 @@ export async function loadDataForCharts(
(selectedCells !== undefined && Object.keys(selectedCells).length > 0) ||
influencersFilterQuery !== undefined
) {
console.log('Explorer anomaly charts data set:', resp.records);
resolve(resp.records);
}

Expand Down Expand Up @@ -764,7 +763,6 @@ export function loadOverallData(selectedJobs, interval, bounds) {
interval.asSeconds()
);

console.log('Explorer overall swimlane data set:', overallSwimlaneData);
resolve({
loading: false,
overallSwimlaneData,
Expand Down Expand Up @@ -795,7 +793,6 @@ export function loadViewBySwimlane(
getSwimlaneContainerWidth(noInfluencersConfigured)
).asSeconds()
);
console.log('Explorer view by swimlane data set:', viewBySwimlaneData);

resolve({
viewBySwimlaneData,
Expand Down Expand Up @@ -879,7 +876,6 @@ export async function loadTopInfluencers(
)
.then((resp) => {
// TODO - sort the influencers keys so that the partition field(s) are first.
console.log('Explorer top influencers data set:', resp.influencers);
resolve(resp.influencers);
});
} else {
Expand Down
5 changes: 2 additions & 3 deletions x-pack/plugins/ml/public/application/services/job_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,7 @@ class JobService {
// return the promise chain
return ml
.updateJob({ jobId, job })
.then((resp) => {
console.log('update job', resp);
.then(() => {
return { success: true };
})
.catch((err) => {
Expand All @@ -423,7 +422,7 @@ class JobService {
values: { jobId },
})
);
console.log('update job', err);
console.error('update job', err);
return { success: false, message: err.message };
});
}
Expand Down

0 comments on commit a8f04f8

Please sign in to comment.