Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { AppStateSelectedCells } from '../explorer/explorer_utils';

declare interface ExplorerProps {
explorerState: ExplorerState;
severity: number;
showCharts: boolean;
setSelectedCells: (swimlaneSelectedCells: AppStateSelectedCells) => void;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export class Explorer extends React.Component {
static propTypes = {
explorerState: PropTypes.object.isRequired,
setSelectedCells: PropTypes.func.isRequired,
severity: PropTypes.number.isRequired,
showCharts: PropTypes.bool.isRequired,
};

Expand Down Expand Up @@ -260,7 +261,7 @@ export class Explorer extends React.Component {
};

render() {
const { showCharts } = this.props;
const { showCharts, severity } = this.props;

const {
annotationsData,
Expand All @@ -276,7 +277,6 @@ export class Explorer extends React.Component {
queryString,
selectedCells,
selectedJobs,
severity,
swimlaneContainerWidth,
tableData,
tableQueryString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const ExplorerChartSingleMetric = injectI18n(
static propTypes = {
tooManyBuckets: PropTypes.bool,
seriesConfig: PropTypes.object,
severity: PropTypes.number,
severity: PropTypes.number.isRequired,
};

componentDidMount() {
Expand Down Expand Up @@ -312,13 +312,16 @@ export const ExplorerChartSingleMetric = injectI18n(
})
.on('mouseout', () => mlChartTooltipService.hide());

const isAnomalyVisible = d =>
_.has(d, 'anomalyScore') && Number(d.anomalyScore) >= severity;

// Update all dots to new positions.
dots
.attr('cx', d => lineChartXScale(d.date))
.attr('cy', d => lineChartYScale(d.value))
.attr('class', d => {
let markerClass = 'metric-value';
if (_.has(d, 'anomalyScore') && Number(d.anomalyScore) >= severity) {
if (isAnomalyVisible(d)) {
markerClass += ` anomaly-marker ${getSeverityWithLow(d.anomalyScore).id}`;
}
return markerClass;
Expand All @@ -328,9 +331,7 @@ export const ExplorerChartSingleMetric = injectI18n(
const multiBucketMarkers = lineChartGroup
.select('.chart-markers')
.selectAll('.multi-bucket')
.data(
data.filter(d => d.anomalyScore !== null && showMultiBucketAnomalyMarker(d) === true)
);
.data(data.filter(d => isAnomalyVisible(d) && showMultiBucketAnomalyMarker(d) === true));

// Remove multi-bucket markers that are no longer needed
multiBucketMarkers.exit().remove();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,13 @@ export function loadViewByTopFieldValuesForSelectedTime(

const topFieldValues = [];
const topInfluencers = resp.influencers[viewBySwimlaneFieldName];
topInfluencers.forEach(influencerData => {
if (influencerData.maxAnomalyScore > 0) {
topFieldValues.push(influencerData.influencerFieldValue);
}
});
if (Array.isArray(topInfluencers)) {
topInfluencers.forEach(influencerData => {
if (influencerData.maxAnomalyScore > 0) {
topFieldValues.push(influencerData.influencerFieldValue);
}
});
}
resolve(topFieldValues);
});
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ const ExplorerUrlStateManager: FC<ExplorerUrlStateManagerProps> = ({ jobsWithTim
explorerState,
setSelectedCells,
showCharts,
severity: tableSeverity.val,
}}
/>
</div>
Expand Down