Skip to content

Commit

Permalink
fix to not display SMV chart when not all selectors are filled
Browse files Browse the repository at this point in the history
  • Loading branch information
walterra committed Aug 21, 2024
1 parent ac97673 commit 977b9bf
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,8 @@ export class TimeSeriesExplorer extends React.Component {
* @param callback to invoke after a state update.
*/
getControlsForDetector = () => {
const { selectedDetectorIndex, selectedEntities, selectedJob } = this.props;
const { selectedDetectorIndex, selectedEntities, selectedJobId } = this.props;
const selectedJob = this.mlJobService.getJob(selectedJobId);
return getControlsForDetector(selectedDetectorIndex, selectedEntities, selectedJob);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@ export default function ({ getService }: FtrProviderContext) {

await ml.jobTable.clickOpenJobInSingleMetricViewerButton(jobConfig.job_id);
await ml.commonUI.waitForMlLoadingIndicatorToDisappear();

// assert that the results view is not displayed when no entity is selected
await ml.testExecution.logTestStep('does not display the chart');
await ml.singleMetricViewer.assertChartNotExist();

await ml.testExecution.logTestStep('does not display the anomalies table');
await ml.anomaliesTable.assertTableNotExists();
});

it('render entity control', async () => {
Expand Down
4 changes: 4 additions & 0 deletions x-pack/test/functional/services/ml/anomalies_table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ export function MachineLearningAnomaliesTableProvider({ getService }: FtrProvide
await testSubjects.existOrFail('mlAnomaliesTable');
},

async assertTableNotExists() {
await testSubjects.missingOrFail('mlAnomaliesTable');
},

async getTableRows() {
return await testSubjects.findAll('mlAnomaliesTable > ~mlAnomaliesListRow');
},
Expand Down
9 changes: 8 additions & 1 deletion x-pack/test/functional/services/ml/single_metric_viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ export function MachineLearningSingleMetricViewerProvider(
await testSubjects.existOrFail('mlSingleMetricViewerChart');
},

async assertChartNotExist() {
await testSubjects.missingOrFail('mlSingleMetricViewerChart');
},

async assertAnomalyMarkerExist() {
await testSubjects.existOrFail('mlAnomalyMarker');
},
Expand Down Expand Up @@ -181,7 +185,10 @@ export function MachineLearningSingleMetricViewerProvider(
`mlSingleMetricViewerEntitySelectionConfigOrder_${entityFieldName}`,
order
);
await this.assertEntityConfig(entityFieldName, anomalousOnly, sortBy, order);

await retry.tryForTime(30 * 1000, async () => {
await this.assertEntityConfig(entityFieldName, anomalousOnly, sortBy, order);
});
},

async assertToastMessageExists(dataTestSubj: string) {
Expand Down

0 comments on commit 977b9bf

Please sign in to comment.