From ce419d875c1e432428ebd36203bc7db334998810 Mon Sep 17 00:00:00 2001 From: Adam Tackett <105462877+TackAdam@users.noreply.github.com> Date: Wed, 11 Sep 2024 12:33:43 -0700 Subject: [PATCH 1/2] [Bug] UI changes for overview page, fix re-direction for workspaces (#2152) * update overview page, redirection bug, change text Signed-off-by: Adam Tackett * change card order, make button small, rename variable Signed-off-by: Adam Tackett * fix bugs, adjust ui Signed-off-by: Adam Tackett * address comments Signed-off-by: Adam Tackett * change text Signed-off-by: Adam Tackett --------- Signed-off-by: Adam Tackett Co-authored-by: Adam Tackett --- common/constants/shared.ts | 4 +- .../components/getting_started.tsx | 3 +- .../getting_started_collectData.tsx | 70 +++++++++---------- .../getting_started_queryAndAnalyze.tsx | 51 ++++++++------ .../components/integration_overview_panel.tsx | 2 +- .../add_dashboard_callout.test.tsx.snap | 63 +++++++++-------- .../dashboard_controls.test.tsx.snap | 63 +++++++++-------- .../select_dashboard_flyout.test.tsx.snap | 50 ++++++------- .../components/add_dashboard_callout.tsx | 4 +- .../overview/components/card_configs.tsx | 45 +++++++++--- .../components/select_dashboard_flyout.tsx | 1 + public/components/overview/home.tsx | 20 +++--- public/plugin_helpers/plugin_overview.tsx | 1 + 13 files changed, 215 insertions(+), 162 deletions(-) diff --git a/common/constants/shared.ts b/common/constants/shared.ts index f88f833d6..b5ef687b1 100644 --- a/common/constants/shared.ts +++ b/common/constants/shared.ts @@ -33,6 +33,8 @@ export const DATACONNECTIONS_ENDPOINT = '/_plugins/_query/_datasources'; export const JOBS_ENDPOINT_BASE = '/_plugins/_async_query'; export const JOB_RESULT_ENDPOINT = '/result'; +export const tutorialSampleDataPluginId = 'import_sample_data'; + export const observabilityID = 'observability-logs'; export const observabilityTitle = 'Observability'; export const observabilityPluginOrder = 1500; @@ -42,7 +44,7 @@ export const observabilityOverviewTitle = 'Observability overview'; export const observabilityOverviewPluginOrder = 5088; export const observabilityGettingStartedID = 'observability-gettingStarted'; -export const observabilityGettingStartedTitle = 'Getting Started'; +export const observabilityGettingStartedTitle = 'Get started'; export const observabilityGettingStartedPluginOrder = 5089; export const observabilityApplicationsID = 'observability-applications'; diff --git a/public/components/getting_started/components/getting_started.tsx b/public/components/getting_started/components/getting_started.tsx index 894013607..5ebf856fc 100644 --- a/public/components/getting_started/components/getting_started.tsx +++ b/public/components/getting_started/components/getting_started.tsx @@ -8,6 +8,7 @@ import React, { useEffect, useState } from 'react'; import { HomeProps } from 'public/components/getting_started/home'; import { CollectAndShipData } from './getting_started_collectData'; import { QueryAndAnalyze } from './getting_started_queryAndAnalyze'; +import { observabilityGettingStartedTitle } from '../../../../common/constants/shared'; interface ExtendedHomeProps extends HomeProps { selectedDataSourceId: string; @@ -24,7 +25,7 @@ export const NewGettingStarted = (props: ExtendedHomeProps) => { useEffect(() => { chrome.setBreadcrumbs([ { - text: 'Getting Started', + text: observabilityGettingStartedTitle, href: '#/', }, ]); diff --git a/public/components/getting_started/components/getting_started_collectData.tsx b/public/components/getting_started/components/getting_started_collectData.tsx index 30f7e45bd..0d1de005a 100644 --- a/public/components/getting_started/components/getting_started_collectData.tsx +++ b/public/components/getting_started/components/getting_started_collectData.tsx @@ -33,6 +33,10 @@ import javaJson from '../getting_started_artifacts/java_client/java_client-1.0.0 import { IntegrationCards } from './getting_started_integrationCards'; import { UploadAssets } from './utils'; +const cardOne = 'Collector'; +const cardTwo = 'File Upload'; +const cardThree = 'Configure use-case based content'; + interface CollectAndShipDataProps { isOpen: boolean; onToggle: (isOpen: boolean) => void; @@ -103,9 +107,9 @@ export const CollectAndShipData: React.FC = ({ setSelectedWorkflow(''); setGettingStarted(null); setWorkflows([]); - onCardSelectionChange(value === 'Use a sample dataset'); + onCardSelectionChange(value === cardThree); - if (value === 'Configure collectors') { + if (value === cardOne) { setCollectorOptions([ { label: 'Open Telemetry (structured)', value: 'otel' }, { label: 'Nginx (structured)', value: 'nginx' }, @@ -113,7 +117,7 @@ export const CollectAndShipData: React.FC = ({ { label: 'Python (unstructured)', value: 'python' }, { label: 'Golang (unstructured)', value: 'golang' }, ]); - } else if (value === 'Upload a file CSV or JSON') { + } else if (value === cardTwo) { setCollectorOptions([{ label: 'Fluent Bit', value: 'csv' }]); } }; @@ -148,7 +152,7 @@ export const CollectAndShipData: React.FC = ({ return ( <> - Select a collector +

Select a collector

= ({ })); return ( - - - -

Collect your data

-
- + + - Select a collection method +

Collection method

{ - handleCollectionMethodChange('Configure collectors'); - setSelectedCard('Configure collectors'); + handleCollectionMethodChange(cardOne); + setSelectedCard(cardOne); }} > - Configure agents and ingestion pipeline + Configure agents and ingestion pipeline { - handleCollectionMethodChange('Upload a file CSV or JSON'); - setSelectedCard('Upload a file CSV or JSON'); + handleCollectionMethodChange(cardTwo); + setSelectedCard(cardTwo); }} > - Upload your data + Upload your data { - handleCollectionMethodChange('Use a sample dataset'); - setSelectedCard('Use a sample dataset'); + handleCollectionMethodChange(cardThree); + setSelectedCard(cardThree); }} > - Explore with a log dataset + Explore with a log dataset - {collectionMethod === 'Use a sample dataset' ? ( + {collectionMethod === cardThree ? ( ) : ( <> @@ -382,7 +382,7 @@ export const CollectAndShipData: React.FC = ({ )} )} -
-
+ + ); }; diff --git a/public/components/getting_started/components/getting_started_queryAndAnalyze.tsx b/public/components/getting_started/components/getting_started_queryAndAnalyze.tsx index d92a733ff..f6c5a0e93 100644 --- a/public/components/getting_started/components/getting_started_queryAndAnalyze.tsx +++ b/public/components/getting_started/components/getting_started_queryAndAnalyze.tsx @@ -14,10 +14,10 @@ import { EuiPanel, EuiSpacer, EuiText, - EuiTitle, } from '@elastic/eui'; import { coreRefs } from '../../../../public/framework/core_refs'; import { fetchDashboardIds, fetchIndexPatternIds, redirectToDashboards } from './utils'; +import { getWorkspaceIdFromUrl } from '../../../../../../src/core/public/utils'; interface Pattern { id: string; @@ -75,8 +75,15 @@ export const QueryAndAnalyze: React.FC = ({ ? `mds-${selectedDataSourceId}-objectId-${patternId}` : patternId; + const currentUrl = window.location.href; + const workspaceId = getWorkspaceIdFromUrl(currentUrl, coreRefs?.http!.basePath.getBasePath()); + + const workspacePatternId = workspaceId + ? `workspaceId-${workspaceId}-${finalPatternId}` + : finalPatternId; + coreRefs?.application!.navigateToApp('data-explorer', { - path: `discover#?_a=(discover:(columns:!(_source),isDirty:!f,sort:!()),metadata:(indexPattern:'${finalPatternId}',view:discover))&_q=(filters:!(),query:(language:kuery,query:''))&_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now))`, + path: `discover#?_a=(discover:(columns:!(_source),isDirty:!f,sort:!()),metadata:(indexPattern:'${workspacePatternId}',view:discover))&_q=(filters:!(),query:(language:kuery,query:''))&_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now))`, }); }; @@ -85,26 +92,31 @@ export const QueryAndAnalyze: React.FC = ({ ? `mds-${selectedDataSourceId}-objectId-${dashboardId}` : dashboardId; + const currentUrl = window.location.href; + const workspaceId = getWorkspaceIdFromUrl(currentUrl, coreRefs?.http!.basePath.getBasePath()); + + const workspaceDashboardId = workspaceId + ? `workspaceId-${workspaceId}-${finalDashboardId}` + : finalDashboardId; + const dashboardUrl = `#/view/${workspaceDashboardId}`; + coreRefs?.application!.navigateToApp('dashboards', { - path: `#/view/${finalDashboardId}`, + path: dashboardUrl, }); }; return ( - - - -

Query data

-
+ +

- Explore your data +

Explore your data

@@ -119,12 +131,9 @@ export const QueryAndAnalyze: React.FC = ({ ))} - -

Analyze data

-

- Visualize your data +

Visualize your data

@@ -154,7 +163,7 @@ export const QueryAndAnalyze: React.FC = ({ /> -
-
+ + ); }; diff --git a/public/components/integrations/components/integration_overview_panel.tsx b/public/components/integrations/components/integration_overview_panel.tsx index 8200affc5..7ce35f32a 100644 --- a/public/components/integrations/components/integration_overview_panel.tsx +++ b/public/components/integrations/components/integration_overview_panel.tsx @@ -36,7 +36,7 @@ export function IntegrationOverview(props: any) { data-test-subj="try-it-button" data-click-metric-element="integrations.create_from_try_it" > - Try It + Try with sample data diff --git a/public/components/overview/components/__tests__/__snapshots__/add_dashboard_callout.test.tsx.snap b/public/components/overview/components/__tests__/__snapshots__/add_dashboard_callout.test.tsx.snap index ea5427f2f..c4d7d3af8 100644 --- a/public/components/overview/components/__tests__/__snapshots__/add_dashboard_callout.test.tsx.snap +++ b/public/components/overview/components/__tests__/__snapshots__/add_dashboard_callout.test.tsx.snap @@ -95,47 +95,52 @@ exports[`Add dashboard callout renders add dashboard callout 1`] = ` className="euiSpacer euiSpacer--l" />
- - + - - - + + + + + diff --git a/public/components/overview/components/__tests__/__snapshots__/dashboard_controls.test.tsx.snap b/public/components/overview/components/__tests__/__snapshots__/dashboard_controls.test.tsx.snap index 5ed68a52c..1100ae951 100644 --- a/public/components/overview/components/__tests__/__snapshots__/dashboard_controls.test.tsx.snap +++ b/public/components/overview/components/__tests__/__snapshots__/dashboard_controls.test.tsx.snap @@ -96,47 +96,52 @@ exports[`Dashboard controls should render 1`] = ` className="euiSpacer euiSpacer--l" /> - - + - - - + + + + + diff --git a/public/components/overview/components/__tests__/__snapshots__/select_dashboard_flyout.test.tsx.snap b/public/components/overview/components/__tests__/__snapshots__/select_dashboard_flyout.test.tsx.snap index 8200d6f67..15f23205f 100644 --- a/public/components/overview/components/__tests__/__snapshots__/select_dashboard_flyout.test.tsx.snap +++ b/public/components/overview/components/__tests__/__snapshots__/select_dashboard_flyout.test.tsx.snap @@ -84,7 +84,7 @@ exports[`Select dashboard flyout should render 1`] = ` class="euiSelectable euiSelectable-fullHeight" >
@@ -1252,7 +1254,7 @@ exports[`Select dashboard flyout should render 1`] = ` className="euiFormControlLayoutIcons" >