From fdf337dac1316b6a015fad531638dc8f72519dfb Mon Sep 17 00:00:00 2001 From: Miki Date: Fri, 18 Oct 2024 10:31:27 -0700 Subject: [PATCH] Update Discover appearance (#8651) * Update Discover appearance Signed-off-by: Miki * Changeset file for PR #8651 created/updated --------- Signed-off-by: Miki Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> (cherry picked from commit 17103ba86370456fa5df6ccc722a22bee8fe2d35) Signed-off-by: Miki --- changelogs/fragments/8651.yml | 2 + .../header/collapsible_nav_group_enabled.scss | 2 +- src/plugins/data/public/index.ts | 10 +++- .../dataset_selector/_dataset_selector.scss | 4 +- .../ui/dataset_selector/dataset_selector.tsx | 51 +++++++++++++++++-- .../data/public/ui/dataset_selector/index.tsx | 16 ++++-- .../ui/filter_bar/_global_filter_group.scss | 4 ++ .../public/ui/filter_bar/filter_options.tsx | 3 +- src/plugins/data/public/ui/index.ts | 1 + .../public/ui/query_editor/_query_editor.scss | 10 +++- .../default_editor/_default_editor.scss | 33 +++++++++++- .../editors/default_editor/index.tsx | 14 +++-- .../ui/query_string_input/_query_bar.scss | 4 ++ .../query_string_input/query_bar_top_row.tsx | 2 +- .../public/components/app_container.scss | 10 ++++ .../public/components/sidebar/index.scss | 4 -- .../public/components/sidebar/index.tsx | 46 ++++++++++++----- .../components/chart/_histogram.scss | 1 - .../timechart_header/timechart_header.tsx | 2 +- .../default_discover_table/_table_cell.scss | 2 +- .../default_discover_table/_table_header.scss | 2 +- .../sidebar/discover_field_search.tsx | 1 + .../components/sidebar/discover_sidebar.scss | 32 ++++++++++-- .../components/sidebar/discover_sidebar.tsx | 15 +++--- .../canvas/discover_canvas.scss | 2 +- .../view_components/canvas/index.tsx | 6 +-- .../public/top_nav_menu/_index.scss | 2 +- 27 files changed, 222 insertions(+), 59 deletions(-) create mode 100644 changelogs/fragments/8651.yml diff --git a/changelogs/fragments/8651.yml b/changelogs/fragments/8651.yml new file mode 100644 index 000000000000..0baf8f35105c --- /dev/null +++ b/changelogs/fragments/8651.yml @@ -0,0 +1,2 @@ +feat: +- Update the appearance of Discover ([#8651](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8651)) \ No newline at end of file diff --git a/src/core/public/chrome/ui/header/collapsible_nav_group_enabled.scss b/src/core/public/chrome/ui/header/collapsible_nav_group_enabled.scss index de3a6021b47d..1310585eefea 100644 --- a/src/core/public/chrome/ui/header/collapsible_nav_group_enabled.scss +++ b/src/core/public/chrome/ui/header/collapsible_nav_group_enabled.scss @@ -1,9 +1,9 @@ .context-nav-wrapper { border: none !important; border-top-right-radius: $euiSizeL; - border-bottom-right-radius: $euiSizeL; background-color: $euiSideNavBackgroundColor; overflow: hidden; + box-shadow: 1px 0 0 $euiBorderColor !important; .nav-link-item { padding: $euiSizeS; diff --git a/src/plugins/data/public/index.ts b/src/plugins/data/public/index.ts index fb0e36fa1f1d..f986cd59e0eb 100644 --- a/src/plugins/data/public/index.ts +++ b/src/plugins/data/public/index.ts @@ -62,7 +62,15 @@ import { } from '../common'; import { FilterLabel } from './ui'; -export { createEditor, DefaultInput, DQLBody, SingleLineInput } from './ui'; + +export { + createEditor, + DefaultInput, + DQLBody, + SingleLineInput, + DatasetSelector, + DatasetSelectorAppearance, +} from './ui'; import { generateFilters, diff --git a/src/plugins/data/public/ui/dataset_selector/_dataset_selector.scss b/src/plugins/data/public/ui/dataset_selector/_dataset_selector.scss index 0fd82fc1b9ca..2f92480a4413 100644 --- a/src/plugins/data/public/ui/dataset_selector/_dataset_selector.scss +++ b/src/plugins/data/public/ui/dataset_selector/_dataset_selector.scss @@ -19,7 +19,9 @@ &__advancedModal { width: 1200px; height: 800px; - max-height: calc(100vh - $euiSizeS); + + // euiOverlayMask pushes the modal up due to having padding-bottom: 10vh + max-height: calc(90vh - $euiSizeL); .euiModal__flex { max-height: none; diff --git a/src/plugins/data/public/ui/dataset_selector/dataset_selector.tsx b/src/plugins/data/public/ui/dataset_selector/dataset_selector.tsx index 76c9fbe74546..691f477a5818 100644 --- a/src/plugins/data/public/ui/dataset_selector/dataset_selector.tsx +++ b/src/plugins/data/public/ui/dataset_selector/dataset_selector.tsx @@ -11,6 +11,7 @@ import { EuiSelectable, EuiSelectableOption, EuiSmallButtonEmpty, + EuiSmallButton, EuiToolTip, } from '@elastic/eui'; import { FormattedMessage } from '@osd/i18n/react'; @@ -22,12 +23,41 @@ import { getQueryService } from '../../services'; import { IDataPluginServices } from '../../types'; import { AdvancedSelector } from './advanced_selector'; +export enum DatasetSelectorAppearance { + Button = 'button', + None = 'none', +} + +type EuiSmallButtonProps = React.ComponentProps; +type EuiSmallButtonEmptyProps = React.ComponentProps; + interface DatasetSelectorProps { selectedDataset?: Dataset; setSelectedDataset: (dataset: Dataset) => void; services: IDataPluginServices; } +export interface DatasetSelectorUsingButtonProps { + appearance: DatasetSelectorAppearance.Button; + buttonProps?: EuiSmallButtonProps; +} + +export interface DatasetSelectorUsingButtonEmptyProps { + appearance?: DatasetSelectorAppearance.None; + buttonProps?: EuiSmallButtonEmptyProps; +} + +const RootComponent: React.FC< + (EuiSmallButtonEmptyProps | EuiSmallButtonProps) & { appearance?: DatasetSelectorAppearance } +> = (props) => { + const { appearance, ...rest } = props; + if (appearance === DatasetSelectorAppearance.Button) { + return ; + } else { + return ; + } +}; + /** * This component provides a dropdown selector for datasets and an advanced selector modal. * It fetches datasets once on mount to populate the selector options. @@ -42,7 +72,10 @@ export const DatasetSelector = ({ selectedDataset, setSelectedDataset, services, -}: DatasetSelectorProps) => { + appearance, + buttonProps, +}: DatasetSelectorProps & + (DatasetSelectorUsingButtonProps | DatasetSelectorUsingButtonEmptyProps)) => { const isMounted = useRef(false); const [isOpen, setIsOpen] = useState(false); const [indexPatterns, setIndexPatterns] = useState([]); @@ -168,8 +201,18 @@ export const DatasetSelector = ({ return ( - + {datasetTitle} - + } isOpen={isOpen} diff --git a/src/plugins/data/public/ui/dataset_selector/index.tsx b/src/plugins/data/public/ui/dataset_selector/index.tsx index d89f92bc3ad7..8d34b60d36d5 100644 --- a/src/plugins/data/public/ui/dataset_selector/index.tsx +++ b/src/plugins/data/public/ui/dataset_selector/index.tsx @@ -6,7 +6,12 @@ import { useCallback, useState } from 'react'; import React from 'react'; import { Dataset, Query, TimeRange } from '../../../common'; -import { DatasetSelector } from './dataset_selector'; +import { + DatasetSelector, + DatasetSelectorUsingButtonEmptyProps, + DatasetSelectorUsingButtonProps, + DatasetSelectorAppearance, +} from './dataset_selector'; import { useOpenSearchDashboards } from '../../../../opensearch_dashboards_react/public'; import { IDataPluginServices } from '../../types'; @@ -14,7 +19,11 @@ interface ConnectedDatasetSelectorProps { onSubmit: ((query: Query, dateRange?: TimeRange | undefined) => void) | undefined; } -const ConnectedDatasetSelector = ({ onSubmit }: ConnectedDatasetSelectorProps) => { +const ConnectedDatasetSelector = ({ + onSubmit, + ...datasetSelectorProps +}: ConnectedDatasetSelectorProps & + (DatasetSelectorUsingButtonProps | DatasetSelectorUsingButtonEmptyProps)) => { const { services } = useOpenSearchDashboards(); const queryString = services.data.query.queryString; const [selectedDataset, setSelectedDataset] = useState( @@ -36,6 +45,7 @@ const ConnectedDatasetSelector = ({ onSubmit }: ConnectedDatasetSelectorProps) = return ( { return ( { return (