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

[Backport 2.x] Revert to legacy discover table and add toggle to new discover table #5839

Merged
merged 1 commit into from
Feb 8, 2024
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 @@ -24,7 +24,8 @@
"src/plugins/vis_builder/public/application/components/side_nav.scss",
"packages/osd-ui-framework/src/components/button/button_group/_button_group.scss",
"src/plugins/discover/public/application/components/data_grid/data_grid_table_cell_value.scss",
"src/plugins/discover/public/application/view_components/canvas/discover_canvas.scss"
"src/plugins/discover/public/application/view_components/canvas/discover_canvas.scss",
"src/plugins/discover/public/application/components/sidebar/discover_sidebar.scss"
]
}
}
1 change: 0 additions & 1 deletion packages/osd-ui-shared-deps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,3 @@
"webpack": "npm:@amoo-miki/webpack@4.46.0-rc.2"
}
}

2 changes: 1 addition & 1 deletion src/core/server/core_app/assets/legacy_dark_theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@
width: 100%;
max-width: 100%;
margin-bottom: 20px;
font-size: 14px;
font-size: 12px;
}
.table thead {
font-size: 12px;
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/core_app/assets/legacy_light_theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@
width: 100%;
max-width: 100%;
margin-bottom: 20px;
font-size: 14px;
font-size: 12px;
}
.table thead {
font-size: 12px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export const DataSourceSelectable = ({
setDataSourceOptionList,
onGetDataSetError, // onGetDataSetError, Callback for handling get data set errors. Ensure it's memoized.
singleSelection = { asPlainText: true },
...comboBoxProps
}: DataSourceSelectableProps) => {
// This effect gets data sets and prepares the datasource list for UI rendering.
useEffect(() => {
Expand Down Expand Up @@ -131,6 +132,7 @@ export const DataSourceSelectable = ({

return (
<EuiComboBox
{...comboBoxProps}
data-test-subj="dataExplorerDSSelect"
placeholder={i18n.translate('data.datasource.selectADatasource', {
defaultMessage: 'Select a datasource',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @experimental These interfaces are experimental and might change in future releases.
*/

import { EuiComboBoxSingleSelectionShape } from '@elastic/eui';
import { EuiComboBoxProps, EuiComboBoxSingleSelectionShape } from '@elastic/eui';
import { GenericDataSource } from '../datasource_services';

export interface DataSourceGroup {
Expand All @@ -22,7 +22,7 @@ export interface DataSourceOption {
ds: GenericDataSource;
}

export interface DataSourceSelectableProps {
export interface DataSourceSelectableProps extends Pick<EuiComboBoxProps<unknown>, 'fullWidth'> {
dataSources: GenericDataSource[];
onDataSourceSelect: (dataSourceOption: DataSourceOption[]) => void;
singleSelection?: boolean | EuiComboBoxSingleSelectionShape;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@

// Unlike most inputs within layout control groups, the text area still needs a border.
// These adjusts help it sit above the control groups shadow to line up correctly.
padding: $euiSizeS;
padding-top: $euiSizeS + 3px;
transform: translateY(-1px) translateX(-1px);
padding: ($euiSizeS + 2px) $euiSizeS $euiSizeS;
transform: translateY(-2px) translateX(-1px);

&:not(:focus):not(:invalid) {
@include euiYScrollWithShadows;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
$osdHeaderOffset: $euiHeaderHeightCompensation;

.deSidebar {
max-width: 462px;
min-width: 400px;
height: 100%;

@include ouiBreakpoint("xs", "s", "m") {
max-width: initial;
Expand Down
37 changes: 29 additions & 8 deletions src/plugins/data_explorer/public/components/app_container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

import React from 'react';
import { EuiPage, EuiPageBody } from '@elastic/eui';
import React, { memo } from 'react';
import { EuiPage, EuiPageBody, EuiResizableContainer, useIsWithinBreakpoints } from '@elastic/eui';
import { Suspense } from 'react';
import { AppMountParameters } from '../../../../core/public';
import { Sidebar } from './sidebar';
Expand All @@ -13,25 +13,46 @@
import './app_container.scss';

export const AppContainer = ({ view, params }: { view?: View; params: AppMountParameters }) => {
const isMobile = useIsWithinBreakpoints(['xs', 's', 'm']);
// TODO: Make this more robust.
if (!view) {
return <NoView />;
}

const { Canvas, Panel, Context } = view;

const MemoizedPanel = memo(Panel);
const MemoizedCanvas = memo(Canvas);

// Render the application DOM.
return (
<EuiPage className="deLayout" paddingSize="none">
{/* TODO: improve fallback state */}
<Suspense fallback={<div>Loading...</div>}>
<Context {...params}>
<Sidebar>
<Panel {...params} />
</Sidebar>
<EuiPageBody className="deLayout__canvas">
<Canvas {...params} />
</EuiPageBody>
<EuiResizableContainer direction={isMobile ? 'vertical' : 'horizontal'}>
{(EuiResizablePanel, EuiResizableButton) => (
<>

Check warning on line 35 in src/plugins/data_explorer/public/components/app_container.tsx

View check run for this annotation

Codecov / codecov/patch

src/plugins/data_explorer/public/components/app_container.tsx#L35

Added line #L35 was not covered by tests
<EuiResizablePanel
initialSize={20}
minSize="260px"
mode={['collapsible', { position: 'top' }]}
paddingSize="none"
>
<Sidebar>
<MemoizedPanel {...params} />
</Sidebar>
</EuiResizablePanel>
<EuiResizableButton />

<EuiResizablePanel initialSize={80} minSize="65%" mode="main" paddingSize="none">
<EuiPageBody className="deLayout__canvas">
<MemoizedCanvas {...params} />
</EuiPageBody>
</EuiResizablePanel>
</>
)}
</EuiResizableContainer>
</Context>
</Suspense>
</EuiPage>
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data_explorer/public/components/no_view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const NoView = () => {
return (
<EuiPageTemplate
template="centeredContent"
className="dePageTemplate"
className="deLayout"
pageContentProps={{
role: 'alertdialog',
color: 'plain',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.deSidebar {
&_panel {
border-top: 0;
}

&_dataSource {
border-bottom: $euiBorderThin !important;
}
}
18 changes: 15 additions & 3 deletions src/plugins/data_explorer/public/components/sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { DataSourceOption } from '../../../../data/public/';
import { useOpenSearchDashboards } from '../../../../opensearch_dashboards_react/public';
import { DataExplorerServices } from '../../types';
import { setIndexPattern, useTypedDispatch, useTypedSelector } from '../../utils/state_management';
import './index.scss';

export const Sidebar: FC = ({ children }) => {
const { indexPattern: indexPatternId } = useTypedSelector((state) => state.metadata);
Expand Down Expand Up @@ -91,18 +92,29 @@ export const Sidebar: FC = ({ children }) => {

return (
<EuiPageSideBar className="deSidebar" sticky>
<EuiSplitPanel.Outer className="eui-yScroll" hasBorder={true} borderRadius="none">
<EuiSplitPanel.Inner paddingSize="s" color="subdued" grow={false}>
<EuiSplitPanel.Outer
className="eui-yScroll deSidebar_panel"
hasBorder={true}
borderRadius="none"
color="transparent"
>
<EuiSplitPanel.Inner
paddingSize="s"
grow={false}
color="transparent"
className="deSidebar_dataSource"
>
<DataSourceSelectable
dataSources={activeDataSources}
dataSourceOptionList={dataSourceOptionList}
setDataSourceOptionList={setDataSourceOptionList}
onDataSourceSelect={handleSourceSelection}
selectedSources={selectedSources}
onGetDataSetError={handleGetDataSetError}
fullWidth
/>
</EuiSplitPanel.Inner>
<EuiSplitPanel.Inner paddingSize="none" color="subdued" className="eui-yScroll">
<EuiSplitPanel.Inner paddingSize="none" color="transparent" className="eui-yScroll">
{children}
</EuiSplitPanel.Inner>
</EuiSplitPanel.Outer>
Expand Down
9 changes: 0 additions & 9 deletions src/plugins/data_explorer/public/index.scss

This file was deleted.

2 changes: 0 additions & 2 deletions src/plugins/data_explorer/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

import './index.scss';

import { DataExplorerPlugin } from './plugin';

// This exports static code and TypeScript types,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,14 @@ export class DiscoverHistogram extends Component<DiscoverHistogramProps, Discove
type: TooltipType.VerticalCursor,
};

// These styles override the chartsTheme so that the correct base chart colors are used
delete chartsTheme.axes?.gridLine?.horizontal?.stroke;
delete chartsTheme.axes?.gridLine?.vertical?.stroke;
delete chartsTheme.axes?.axisLine;
chartsTheme.axes!.axisTitle = {
fill: euiThemeVars.euiTextColor,
};

return (
<Chart size="100%">
<Settings
Expand Down

This file was deleted.

Loading
Loading