Skip to content

Commit

Permalink
show vis configuration panel only when using default datasource
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Li <[email protected]>
  • Loading branch information
joshuali925 committed Mar 12, 2024
1 parent fd0d9e8 commit 6ff99af
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
1 change: 1 addition & 0 deletions public/components/event_analytics/explorer/explorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,7 @@ export const Explorer = ({
handleOverrideTimestamp={handleOverrideTimestamp}
callback={callbackForConfig}
queryManager={queryManager}
shouldShowConfigurationUI={isDefaultDataSourceType}
/>
),
[

Check warning on line 690 in public/components/event_analytics/explorer/explorer.tsx

View workflow job for this annotation

GitHub Actions / Lint

React Hook useMemo has missing dependencies: 'callbackForConfig', 'handleOverrideTimestamp', 'isDefaultDataSourceType', and 'queryManager'. Either include them or remove the dependency array
Expand Down
38 changes: 23 additions & 15 deletions public/components/event_analytics/explorer/visualizations/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
* SPDX-License-Identifier: Apache-2.0
*/

import React from 'react';
import { EuiResizableContainer } from '@elastic/eui';
import { QueryManager } from 'common/query_manager';
import React from 'react';
import { VIS_CHART_TYPES } from '../../../../../common/constants/shared';
import {
ExplorerFields,
IField,
IQuery,
IVisualizationContainerProps,
ExplorerFields,
} from '../../../../../common/types/explorer';
import { WorkspacePanel } from './workspace_panel';
import { ConfigPanel } from './config_panel';
import { DataConfigPanelItem } from './config_panel/config_panes/config_controls/data_configurations_panel';
import { VIS_CHART_TYPES } from '../../../../../common/constants/shared';
import { TreemapConfigPanelItem } from './config_panel/config_panes/config_controls/treemap_config_panel_item';
import { LogsViewConfigPanelItem } from './config_panel/config_panes/config_controls/logs_view_config_panel_item';
import { TreemapConfigPanelItem } from './config_panel/config_panes/config_controls/treemap_config_panel_item';
import { WorkspacePanel } from './workspace_panel';

interface IExplorerVisualizationsProps {
query: IQuery;
Expand All @@ -30,6 +30,7 @@ interface IExplorerVisualizationsProps {
handleOverrideTimestamp: (field: IField) => void;
callback?: any;
queryManager: QueryManager;
shouldShowConfigurationUI: boolean;
}

export const ExplorerVisualizations = ({
Expand All @@ -40,6 +41,7 @@ export const ExplorerVisualizations = ({
visualizations,
callback,
queryManager,
shouldShowConfigurationUI,
}: IExplorerVisualizationsProps) => {
const { vis } = visualizations;
const isMarkDown = vis.id === VIS_CHART_TYPES.Text;
Expand Down Expand Up @@ -86,16 +88,22 @@ export const ExplorerVisualizations = ({
<EuiResizableContainer onPanelWidthChange={syntheticResize}>
{(EuiResizablePanel, EuiResizableButton) => (
<>
<EuiResizablePanel
initialSize={isMarkDown ? 12 : 20}
minSize={isMarkDown ? '10%' : '17%'}
mode={['collapsible', { position: 'top' }]}
paddingSize="none"
className="vis__leftPanel"
>
{!isMarkDown && <>{renderDataConfigContainer()}</>}
</EuiResizablePanel>
<EuiResizableButton />
{shouldShowConfigurationUI ? (
<>
<EuiResizablePanel
initialSize={isMarkDown ? 12 : 20}
minSize={isMarkDown ? '10%' : '17%'}
mode={['collapsible', { position: 'top' }]}
paddingSize="none"
className="vis__leftPanel"
>
{!isMarkDown && <>{renderDataConfigContainer()}</>}
</EuiResizablePanel>
<EuiResizableButton />
</>
) : (
<></>
)}
<EuiResizablePanel
className="ws__central--canvas"
initialSize={80}
Expand Down

0 comments on commit 6ff99af

Please sign in to comment.