Skip to content

Commit

Permalink
[ML] Anomaly detection: Adds spacer below split card chart in job wiz…
Browse files Browse the repository at this point in the history
…ard (elastic#199708)

Adds a spacer below the chart so the `Add metric` label doesn't appear
like it is underneath the cards due to their drop shadow.

Recommend viewing the diff with whitespace hidden as the change looks
larger than it actually is.

<img width="1064" alt="image"
src="https://github.com/user-attachments/assets/90e460c4-5ad6-4f4b-bf9f-7163d740747f">

vs 

<img width="1057" alt="image"
src="https://github.com/user-attachments/assets/bb8d7bc3-17bb-428d-a8a4-c515a5845025">
  • Loading branch information
jgowdyelastic authored Nov 12, 2024
1 parent 23185f2 commit c58989c
Showing 1 changed file with 36 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,42 +97,45 @@ export const SplitCards: FC<PropsWithChildren<Props>> = memo(
}

return (
<EuiFlexGroup>
<EuiFlexItem data-test-subj="mlDataSplit">
{(fieldValues.length === 0 || numberOfDetectors === 0) && <>{children}</>}
{fieldValues.length > 0 && numberOfDetectors > 0 && splitField !== null && (
<Fragment>
{(jobType === JOB_TYPE.MULTI_METRIC || jobType === JOB_TYPE.GEO) && (
<Fragment>
<>
<EuiFlexGroup>
<EuiFlexItem data-test-subj="mlDataSplit">
{(fieldValues.length === 0 || numberOfDetectors === 0) && <>{children}</>}
{fieldValues.length > 0 && numberOfDetectors > 0 && splitField !== null && (
<Fragment>
{(jobType === JOB_TYPE.MULTI_METRIC || jobType === JOB_TYPE.GEO) && (
<Fragment>
<div
css={{ fontSize: 'small' }}
data-test-subj={`mlDataSplitTitle ${splitField.name}`}
>
<FormattedMessage
id="xpack.ml.newJob.wizard.pickFieldsStep.splitCards.dataSplitBy"
defaultMessage="Data split by {field}"
values={{ field: splitField.name }}
/>
</div>
<EuiSpacer size="m" />
</Fragment>
)}

{getBackPanels()}
<EuiPanel paddingSize="m" css={splitCardStyle} data-test-subj="mlSplitCard front">
<div
css={{ fontSize: 'small' }}
data-test-subj={`mlDataSplitTitle ${splitField.name}`}
css={{ fontWeight: 'bold', fontSize: 'small' }}
data-test-subj="mlSplitCardTitle"
>
<FormattedMessage
id="xpack.ml.newJob.wizard.pickFieldsStep.splitCards.dataSplitBy"
defaultMessage="Data split by {field}"
values={{ field: splitField.name }}
/>
{fieldValues[0]}
</div>
<EuiSpacer size="m" />
</Fragment>
)}

{getBackPanels()}
<EuiPanel paddingSize="m" css={splitCardStyle} data-test-subj="mlSplitCard front">
<div
css={{ fontWeight: 'bold', fontSize: 'small' }}
data-test-subj="mlSplitCardTitle"
>
{fieldValues[0]}
</div>
<EuiHorizontalRule margin="s" />
<>{children}</>
</EuiPanel>
</Fragment>
)}
</EuiFlexItem>
</EuiFlexGroup>
<EuiHorizontalRule margin="s" />
<>{children}</>
</EuiPanel>
</Fragment>
)}
</EuiFlexItem>
</EuiFlexGroup>
{splitField !== null ? <EuiSpacer size="m" /> : null}
</>
);
}
);

0 comments on commit c58989c

Please sign in to comment.