From 233fe603b523cfed600528c77fc04e135582a96c Mon Sep 17 00:00:00 2001
From: Bena Kansara <69037875+benakansara@users.noreply.github.com>
Date: Wed, 11 Sep 2024 17:53:48 +0200
Subject: [PATCH] [RCA] Move charts closer, remove x-axis and labels (#192550)
Resolves https://github.com/elastic/kibana/issues/192548
---------
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
---
.../items/esql_item/register_esql_item.tsx | 21 ++--
.../items/lens_item/register_lens_item.tsx | 5 +-
.../details/components/grid_item/index.tsx | 112 +++++++++---------
.../utils/get_lens_attrs_for_suggestion.ts | 13 ++
.../hooks/use_create_investigation.tsx | 5 +-
5 files changed, 83 insertions(+), 73 deletions(-)
diff --git a/x-pack/plugins/observability_solution/investigate_app/public/items/esql_item/register_esql_item.tsx b/x-pack/plugins/observability_solution/investigate_app/public/items/esql_item/register_esql_item.tsx
index 6ecab29020eba..5f2f95807b4e0 100644
--- a/x-pack/plugins/observability_solution/investigate_app/public/items/esql_item/register_esql_item.tsx
+++ b/x-pack/plugins/observability_solution/investigate_app/public/items/esql_item/register_esql_item.tsx
@@ -21,10 +21,6 @@ import { getLensAttrsForSuggestion } from '../../utils/get_lens_attrs_for_sugges
import type { Options } from '../register_items';
import { getDateHistogramResults } from './get_date_histogram_results';
-const lensClassName = css`
- height: 100%;
-`;
-
interface Props {
suggestion: Suggestion;
dataView: DataView;
@@ -142,7 +138,7 @@ export function EsqlWidget({ suggestion, dataView, esqlQuery, dateHistogramResul
grow={false}
className={css`
> div {
- height: 196px;
+ height: 128px;
}
`}
>
@@ -153,15 +149,12 @@ export function EsqlWidget({ suggestion, dataView, esqlQuery, dateHistogramResul
}
return (
- div {
- height: 196px;
- }
- `}
- >
-
+
+
);
}
diff --git a/x-pack/plugins/observability_solution/investigate_app/public/items/lens_item/register_lens_item.tsx b/x-pack/plugins/observability_solution/investigate_app/public/items/lens_item/register_lens_item.tsx
index c81ebec9c6ade..3f2b1d9f9c1bf 100644
--- a/x-pack/plugins/observability_solution/investigate_app/public/items/lens_item/register_lens_item.tsx
+++ b/x-pack/plugins/observability_solution/investigate_app/public/items/lens_item/register_lens_item.tsx
@@ -148,7 +148,7 @@ export function LensWidget({
interval,
},
},
- seriesType: 'bar',
+ seriesType: 'bar_stacked',
};
if (groupBy && groupBy?.length) {
@@ -221,12 +221,13 @@ export function LensWidget({
);
diff --git a/x-pack/plugins/observability_solution/investigate_app/public/pages/details/components/grid_item/index.tsx b/x-pack/plugins/observability_solution/investigate_app/public/pages/details/components/grid_item/index.tsx
index 91f7a58b43b5e..c43ae1ffaa04f 100644
--- a/x-pack/plugins/observability_solution/investigate_app/public/pages/details/components/grid_item/index.tsx
+++ b/x-pack/plugins/observability_solution/investigate_app/public/pages/details/components/grid_item/index.tsx
@@ -52,13 +52,13 @@ const panelContentClassName = css`
}
`;
-const headerClassName = css`
- height: ${GRID_ITEM_HEADER_HEIGHT}px;
-`;
-
export function GridItem({ id, title, children, onDelete, onCopy, loading }: GridItemProps) {
const theme = useTheme();
+ const headerClassName = css`
+ padding: 0 ${theme.size.s} 0 ${theme.size.s}};
+`;
+
const containerClassName = css`
height: 100%;
max-width: 100%;
@@ -71,58 +71,58 @@ export function GridItem({ id, title, children, onDelete, onCopy, loading }: Gri
`;
return (
-
-
-
-
-
- {title}
-
-
-
-
-
- {
- onCopy();
- }}
- disabled={loading}
- />
-
-
- {
- onDelete();
- }}
- disabled={loading}
- />
-
-
-
-
-
-
-
+
+
+
+
+
+
+ {title}
+
+
+
+
+
+ {
+ onCopy();
+ }}
+ disabled={loading}
+ />
+
+
+ {
+ onDelete();
+ }}
+ disabled={loading}
+ />
+
+
+
+
+
+
{children}
-
-
-
+
+
+
);
}
diff --git a/x-pack/plugins/observability_solution/investigate_app/public/utils/get_lens_attrs_for_suggestion.ts b/x-pack/plugins/observability_solution/investigate_app/public/utils/get_lens_attrs_for_suggestion.ts
index 0483d771954c0..79693ff2941aa 100644
--- a/x-pack/plugins/observability_solution/investigate_app/public/utils/get_lens_attrs_for_suggestion.ts
+++ b/x-pack/plugins/observability_solution/investigate_app/public/utils/get_lens_attrs_for_suggestion.ts
@@ -32,6 +32,19 @@ export function getLensAttrsForSuggestion({
dataView,
}) as TypedLensByValueInput['attributes'];
+ attrs.state.visualization = {
+ ...(attrs.state.visualization as any),
+ axisTitlesVisibilitySettings: {
+ x: false,
+ yLeft: false,
+ yRight: false,
+ },
+ legend: {
+ isVisible: false,
+ position: 'right',
+ },
+ };
+
const lensEmbeddableInput: TypedLensByValueInput = {
attributes: attrs,
id: v4(),
diff --git a/x-pack/plugins/observability_solution/observability/public/pages/alert_details/hooks/use_create_investigation.tsx b/x-pack/plugins/observability_solution/observability/public/pages/alert_details/hooks/use_create_investigation.tsx
index 428e94ef15b15..8fad55195f9b2 100644
--- a/x-pack/plugins/observability_solution/observability/public/pages/alert_details/hooks/use_create_investigation.tsx
+++ b/x-pack/plugins/observability_solution/observability/public/pages/alert_details/hooks/use_create_investigation.tsx
@@ -32,7 +32,10 @@ export function useCreateInvestigation() {
['createInvestigation'],
({ investigation }) => {
const body = JSON.stringify(investigation);
- return http.post(`/api/observability/investigations`, { body });
+ return http.post(`/api/observability/investigations`, {
+ body,
+ version: '2023-10-31',
+ });
},
{
onError: (error, { investigation }, context) => {