Skip to content

Commit

Permalink
[ML] fix getFormattedSeverityScore and showSwimlane condition
Browse files Browse the repository at this point in the history
  • Loading branch information
darnautov committed Oct 6, 2020
1 parent 3a98bce commit 6e63215
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions x-pack/plugins/ml/common/util/anomaly_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ function getSeverityTypes() {
/**
* Return formatted severity score.
*/
export function getFormattedSeverityScore(score: number) {
return score < 1 ? '< 1' : score.toFixed(2);
export function getFormattedSeverityScore(score: number): string {
return score < 1 ? '< 1' : String(parseInt(String(score), 10));
}

// Returns a severity label (one of critical, major, minor, warning or unknown)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,17 +174,6 @@ export const SwimlaneContainer: FC<SwimlaneProps> = ({
[chartWidth]
);

const showSwimlane = swimlaneData?.laneLabels?.length > 0 && swimlaneData?.points.length > 0;

const isPaginationVisible =
(showSwimlane || isLoading) &&
swimlaneLimit !== undefined &&
onPaginationChange &&
fromPage &&
perPage;

const rowsCount = swimlaneData?.laneLabels?.length ?? 0;

const swimLanePoints = useMemo(() => {
const showFilterContext = filterActive === true && swimlaneType === SWIMLANE_TYPE.OVERALL;

Expand All @@ -206,6 +195,17 @@ export const SwimlaneContainer: FC<SwimlaneProps> = ({
.filter((v) => v.value > 0);
}, [swimlaneData?.points, filterActive, swimlaneType]);

const showSwimlane = swimlaneData?.laneLabels?.length > 0 && swimLanePoints.length > 0;

const isPaginationVisible =
(showSwimlane || isLoading) &&
swimlaneLimit !== undefined &&
onPaginationChange &&
fromPage &&
perPage;

const rowsCount = swimlaneData?.laneLabels?.length ?? 0;

const containerHeight = useMemo(() => {
// Persists container height during loading to prevent page from jumping
return isLoading
Expand Down

0 comments on commit 6e63215

Please sign in to comment.