From 408d38f8c7cb4ad0c14472b76ddb35986363f94e Mon Sep 17 00:00:00 2001 From: Peter Fitzgibbons Date: Wed, 4 Oct 2023 16:37:49 -0700 Subject: [PATCH] Metrics Explorer - single-line graph only, no legends (#1068) * Metrics Explorer - single-line graph only, no legends --------- Signed-off-by: Peter Fitzgibbons --- .../custom_panels/helpers/utils.tsx | 21 ++++++++----------- .../visualization_flyout_so.tsx | 2 +- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/public/components/custom_panels/helpers/utils.tsx b/public/components/custom_panels/helpers/utils.tsx index dbd58ffbfb..aac1477181 100644 --- a/public/components/custom_panels/helpers/utils.tsx +++ b/public/components/custom_panels/helpers/utils.tsx @@ -3,19 +3,14 @@ * SPDX-License-Identifier: Apache-2.0 */ -import dateMath from '@elastic/datemath'; import { ShortDate } from '@elastic/eui'; import { DurationRange } from '@elastic/eui/src/components/date_picker/types'; -import _, { castArray, forEach, isEmpty } from 'lodash'; +import _, { forEach, isEmpty } from 'lodash'; import { Moment } from 'moment-timezone'; import React from 'react'; import { Layout } from 'react-grid-layout'; import { CoreStart } from '../../../../../../src/core/public'; -import { - PPL_DATE_FORMAT, - PPL_INDEX_REGEX, - PPL_WHERE_CLAUSE_REGEX, -} from '../../../../common/constants/shared'; +import { PPL_INDEX_REGEX, PPL_WHERE_CLAUSE_REGEX } from '../../../../common/constants/shared'; import { QueryManager } from '../../../../common/query_manager'; import { SavedVisualizationType, @@ -324,10 +319,12 @@ const updateCatalogVisualizationQuery = ({ const attributesGroupString = attributesGroupBy.toString(); const startEpochTime = convertDateTime(startTime, true, false, true); const endEpochTime = convertDateTime(endTime, false, false, true); - const promQuery = - attributesGroupBy.length === 0 - ? catalogTableName - : `${aggregation} by(${attributesGroupString}) (${catalogTableName})`; + // const promQuery = + // attributesGroupBy.length === 0 + // ? `${aggregation} (${catalogTableName})` + // : `${aggregation} by(${attributesGroupString}) (${catalogTableName})`; + + const promQuery = `${aggregation} (${catalogTableName})`; return `source = ${catalogSourceName}.query_range('${promQuery}', ${startEpochTime}, ${endEpochTime}, '${spanParam}')`; }; @@ -399,7 +396,7 @@ export const renderCatalogVisualization = async ({ layoutConfig: { height: 390, margin: { t: 5 }, - legend: { orientation: 'h', yanchor: 'top', x: 0.0, y: -0.4 }, + legend: { visible: false }, }, }; diff --git a/public/components/custom_panels/panel_modules/visualization_flyout/visualization_flyout_so.tsx b/public/components/custom_panels/panel_modules/visualization_flyout/visualization_flyout_so.tsx index 8d4e8da9eb..da5bff1a45 100644 --- a/public/components/custom_panels/panel_modules/visualization_flyout/visualization_flyout_so.tsx +++ b/public/components/custom_panels/panel_modules/visualization_flyout/visualization_flyout_so.tsx @@ -50,7 +50,6 @@ import { SavedObjectsActions } from '../../../../services/saved_objects/saved_ob import { ObservabilitySavedVisualization } from '../../../../services/saved_objects/saved_object_client/types'; import { FlyoutContainers } from '../../../common/flyout_containers'; import { - convertDateTime, displayVisualization, getQueryResponse, isDateValid, @@ -59,6 +58,7 @@ import { import { replaceVizInPanel, selectPanel } from '../../redux/panel_slice'; import './visualization_flyout.scss'; import { useToast } from '../../../common/toast'; +import { convertDateTime } from '../../../common/query_utils'; /* * VisaulizationFlyoutSO - This module create a flyout to add visualization for SavedObjects custom Panels