Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Discover] Misc fixes #5114

Merged
merged 3 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ import {
EuiFlexItem,
EuiTitle,
} from '@elastic/eui';
import { FormattedMessage } from '@osd/i18n/react';
import { DocViewer } from '../doc_viewer/doc_viewer';
import { IndexPattern } from '../../../opensearch_dashboards_services';
import { DocViewFilterFn } from '../../doc_views/doc_views_types';
import { DocViewFilterFn, OpenSearchSearchHit } from '../../doc_views/doc_views_types';
import { DocViewerLinks } from '../doc_viewer_links/doc_viewer_links';

interface Props {
columns: string[];
hit: any;
hit: OpenSearchSearchHit;
indexPattern: IndexPattern;
onAddColumn: (column: string) => void;
onClose: () => void;
Expand All @@ -40,10 +41,12 @@ export function DataGridFlyout({
// TODO: replace EuiLink with doc_view_links registry
// TODO: Also move the flyout higher in the react tree to prevent redrawing the table component and slowing down page performance
return (
<EuiFlyout onClose={onClose} size="m" data-test-subj="documentDetailFlyOut">
<EuiFlyout onClose={onClose} size="m" data-test-subj="documentDetailFlyOut" ownFocus={false}>
<EuiFlyoutHeader>
<EuiTitle>
<h2>Document Details</h2>
<h2>
<FormattedMessage id="discover.docView.flyoutTitle" defaultMessage="Document Details" />
</h2>
</EuiTitle>
</EuiFlyoutHeader>
<EuiFlyoutBody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,13 @@
min-width: 260px;
max-width: 300px;
}

.dscSidebarField__actionButton {
opacity: 0;
transition: opacity $ouiAnimSpeedExtraFast;

&:hover,
&:focus {
opacity: 1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {
} from '@elastic/eui';
import { i18n } from '@osd/i18n';
import { DiscoverFieldDetails } from './discover_field_details';
import { FieldIcon, FieldButton } from '../../../../../opensearch_dashboards_react/public';
import { FieldIcon } from '../../../../../opensearch_dashboards_react/public';
import { FieldDetails } from './types';
import { IndexPatternField, IndexPattern } from '../../../../../data/public';
import { shortenDottedString } from '../../helpers';
Expand Down Expand Up @@ -163,6 +163,7 @@ export const DiscoverField = ({
}}
data-test-subj={`fieldToggle-${field.name}`}
aria-label={addLabelAria}
className="dscSidebarField__actionButton"
/>
</EuiToolTip>
);
Expand All @@ -187,6 +188,7 @@ export const DiscoverField = ({
}}
data-test-subj={`fieldToggle-${field.name}`}
aria-label={removeLabelAria}
className="dscSidebarField__actionButton"
/>
</EuiToolTip>
);
Expand Down Expand Up @@ -219,6 +221,7 @@ export const DiscoverField = ({
onClick={() => setOpen((state) => !state)}
aria-label={infoLabelAria}
data-test-subj={`field-${field.name}-showDetails`}
className="dscSidebarField__actionButton"
/>
}
panelClassName="dscSidebarItem__fieldPopoverPanel"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.dscCanvas {
@include euiYScrollWithShadows;

height: 100%;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import React, { useEffect, useState, useRef } from 'react';
import { EuiFlexGroup, EuiFlexItem, EuiPanel, EuiCallOut, EuiLink } from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem, EuiPanel } from '@elastic/eui';
import { TopNav } from './top_nav';
import { ViewProps } from '../../../../../data_explorer/public';
import { DiscoverTable } from './discover_table';
Expand All @@ -19,9 +19,7 @@ import { DiscoverViewServices } from '../../../build_services';
import { useOpenSearchDashboards } from '../../../../../opensearch_dashboards_react/public';
import { filterColumns } from '../utils/filter_columns';
import { DEFAULT_COLUMNS_SETTING } from '../../../../common';

const KEY_SHOW_NOTICE = 'discover:deprecation-notice:show';

import './discover_canvas.scss';
// eslint-disable-next-line import/no-default-export
export default function DiscoverCanvas({ setHeaderActionMenu, history }: ViewProps) {
const { data$, refetch$, indexPattern } = useDiscoverContext();
Expand All @@ -43,39 +41,6 @@ export default function DiscoverCanvas({ setHeaderActionMenu, history }: ViewPro
bucketInterval: {},
});

const [isCallOutVisible, setIsCallOutVisible] = useState(
localStorage.getItem(KEY_SHOW_NOTICE) !== 'false'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's probably unnecessary to clear out this key if it does exist correct?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, thats overkill :)

);
const closeCallOut = () => {
localStorage.setItem(KEY_SHOW_NOTICE, 'false');
setIsCallOutVisible(false);
};

let callOut;

if (isCallOutVisible) {
callOut = (
<EuiFlexItem grow={false}>
<EuiPanel hasBorder={false} hasShadow={false} color="transparent" paddingSize="s">
<EuiCallOut
title="You're viewing Discover 2.0. The old Discover app will be retired in OpenSearch version 2.11. To switch back to the old version, turn off the New Discover toggle."
iconType="alert"
dismissible
onDismiss={closeCallOut}
>
<p>
To provide feedback,{' '}
<EuiLink href="https://github.com/opensearch-project/OpenSearch-Dashboards/issues">
open an issue
</EuiLink>
.
</p>
</EuiCallOut>
</EuiPanel>
</EuiFlexItem>
);
}

const { status } = fetchState;

useEffect(() => {
Expand Down Expand Up @@ -104,7 +69,7 @@ export default function DiscoverCanvas({ setHeaderActionMenu, history }: ViewPro
const timeField = indexPattern?.timeFieldName ? indexPattern.timeFieldName : undefined;

return (
<EuiFlexGroup direction="column" gutterSize="none">
<EuiFlexGroup direction="column" gutterSize="none" className="dscCanvas">
<EuiFlexItem grow={false}>
<TopNav
opts={{
Expand All @@ -123,7 +88,6 @@ export default function DiscoverCanvas({ setHeaderActionMenu, history }: ViewPro
{status === ResultStatus.LOADING && <LoadingSpinner />}
{status === ResultStatus.READY && (
<>
{callOut}
<EuiFlexItem grow={false}>
<EuiPanel hasBorder={false} hasShadow={false} color="transparent" paddingSize="s">
<EuiPanel>
Expand Down
Loading
Loading