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

[BUG] Fix Discover table panel size auto adjust in Dashboard #5441

Merged
merged 3 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [BUG] Add platform "darwin-arm64" to unit test ([#5290](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5290))
- [BUG][Dev Tool] Add dev tool documentation link to dev tool's help menu [#5166](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5166)
- Fix navigation issue across dashboards ([#5435](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5435))
- [BUG] Fix Discover table panel size auto adjust in Dashboard ([#5441](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5441))
ananzh marked this conversation as resolved.
Show resolved Hide resolved

### 🚞 Infrastructure

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { DataGridFlyout } from './data_grid_table_flyout';
import { DiscoverGridContextProvider } from './data_grid_table_context';
import { toolbarVisibility } from './constants';
import { DocViewFilterFn, OpenSearchSearchHit } from '../../doc_views/doc_views_types';
import { DiscoverServices } from '../../../build_services';
import { usePagination } from '../utils/use_pagination';
import { SortOrder } from '../../../saved_searches/types';
import { buildColumns } from '../../utils/columns';
Expand Down
12 changes: 12 additions & 0 deletions src/plugins/discover/public/embeddable/search_embeddable.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* 1. We want the osdDocTable__container to scroll only when embedded in an embeddable panel
* 2. Force a better looking scrollbar
*/
.embPanel {
.osdDocTable__container {
@include euiScrollBar; /* 2 */

flex: 1 1 0; /* 1 */
overflow: auto; /* 1 */
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,9 @@ export class SearchEmbeddable
const props = {
searchProps,
};
ReactDOM.render(<SearchEmbeddableComponent {...props} />, node);

const MemorizedSearchEmbeddableComponent = React.memo(SearchEmbeddableComponent);
ReactDOM.render(<MemorizedSearchEmbeddableComponent {...props} />, node);
}

private async pushContainerStateParamsToProps(searchProps: SearchProps, force: boolean = false) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
DataGridTableProps,
} from '../application/components/data_grid/data_grid_table';
import { VisualizationNoResults } from '../../../visualizations/public';
import './search_embeddable.scss';

interface SearchEmbeddableProps {
searchProps: SearchProps;
Expand Down Expand Up @@ -51,8 +52,10 @@ export function SearchEmbeddableComponent({ searchProps }: SearchEmbeddableProps
data-test-subj="embeddedSavedSearchDocTable"
>
{discoverEmbeddableProps.totalHitCount !== 0 ? (
<EuiFlexItem>
<DataGridTableMemoized {...discoverEmbeddableProps} />
<EuiFlexItem style={{ minHeight: 0 }}>
<div className="osdDocTable__container">
AMoo-Miki marked this conversation as resolved.
Show resolved Hide resolved
<DataGridTableMemoized {...discoverEmbeddableProps} />
</div>
</EuiFlexItem>
) : (
<EuiFlexItem>
Expand Down
Loading