Skip to content

Commit

Permalink
chore(rca): Hide X axis on ESQL item (elastic#192696)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdelemme authored Sep 16, 2024
1 parent 4d48881 commit 684da23
Showing 1 changed file with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { EuiFlexGroup, EuiFlexItem, EuiLoadingSpinner } from '@elastic/eui';
import { css } from '@emotion/css';
import { EuiFlexItem, EuiLoadingSpinner } from '@elastic/eui';
import type { DataView } from '@kbn/data-views-plugin/common';
import type { ESQLSearchResponse } from '@kbn/es-types';
import { i18n } from '@kbn/i18n';
Expand Down Expand Up @@ -123,29 +122,24 @@ export function EsqlWidget({ suggestion, dataView, esqlQuery, dateHistogramResul
[dataView, lens, dateHistogramResults]
);

// in the case of a lnsDatatable, we want to render the preview of the histogram and not the datable (input) itself
if (input.attributes.visualizationType === 'lnsDatatable') {
let innerElement: React.ReactElement;
if (previewInput.error) {
innerElement = <ErrorMessage error={previewInput.error} />;
} else if (previewInput.value) {
innerElement = <lens.EmbeddableComponent {...previewInput.value} />;
innerElement = (
<lens.EmbeddableComponent
{...previewInput.value}
style={{ height: 128 }}
overrides={{ axisX: { hide: true } }}
/>
);
} else {
innerElement = <EuiLoadingSpinner size="s" />;
}
return (
<EuiFlexGroup direction="column" gutterSize="s">
<EuiFlexItem
grow={false}
className={css`
> div {
height: 128px;
}
`}
>
{innerElement}
</EuiFlexItem>
</EuiFlexGroup>
);

return <EuiFlexItem grow={true}>{innerElement}</EuiFlexItem>;
}

return (
Expand Down

0 comments on commit 684da23

Please sign in to comment.