-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/tooltip-section: Added tooltip options for various charts (#952)
* Fix for app crash and dimension disaapearing Signed-off-by: ruchika-narang <[email protected]> * optimized the code and updated snapshots Signed-off-by: Shankha Das <[email protected]> * resolved PR comments Signed-off-by: Shankha Das <[email protected]> * added tooltip options Signed-off-by: Shankha Das <[email protected]> * removed log Signed-off-by: Shankha Das <[email protected]> Signed-off-by: ruchika-narang <[email protected]> Signed-off-by: Shankha Das <[email protected]> Co-authored-by: ruchika-narang <[email protected]>
- Loading branch information
1 parent
d5745db
commit 79197db
Showing
24 changed files
with
3,899 additions
and
140 deletions.
There are no files selected for viewing
352 changes: 352 additions & 0 deletions
352
...ility/public/components/custom_panels/helpers/__tests__/__snapshots__/utils.test.tsx.snap
Large diffs are not rendered by default.
Oops, something went wrong.
3,011 changes: 2,898 additions & 113 deletions
3,011
...s/explorer/visualizations/config_panel/__tests__/__snapshots__/config_panel.test.tsx.snap
Large diffs are not rendered by default.
Oops, something went wrong.
58 changes: 58 additions & 0 deletions
58
...tics/explorer/visualizations/config_panel/config_panes/config_controls/config_tooltip.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React, { useCallback, useMemo } from 'react'; | ||
import { EuiAccordion, EuiSpacer, htmlIdGenerator } from '@elastic/eui'; | ||
import { ButtonGroupItem } from './config_button_group'; | ||
import { IConfigPanelOptionSection } from '../../../../../../../../common/types/explorer'; | ||
|
||
export const ConfigTooltip = ({ schemas, vizState, handleConfigChange }: any) => { | ||
const handleConfigurationChange = useCallback( | ||
(stateFiledName) => { | ||
return (changes: any) => { | ||
handleConfigChange({ | ||
...vizState, | ||
[stateFiledName]: changes, | ||
}); | ||
}; | ||
}, | ||
[handleConfigChange, vizState] | ||
); | ||
|
||
const dimensions = useMemo(() => { | ||
return schemas.map((schema: IConfigPanelOptionSection, index: number) => { | ||
const DimensionComponent = schema.component || ButtonGroupItem; | ||
const params = { | ||
title: schema.name, | ||
legend: schema.name, | ||
groupOptions: schema?.props?.options.map((btn: { name: string }) => ({ | ||
...btn, | ||
label: btn.name, | ||
})), | ||
idSelected: vizState[schema.mapTo] || schema?.props?.defaultSelections[0]?.id, | ||
handleButtonChange: handleConfigurationChange(schema.mapTo), | ||
vizState, | ||
...schema.props, | ||
}; | ||
return ( | ||
<div id={htmlIdGenerator('dimension__component')()}> | ||
<DimensionComponent key={`viz-series-${index}`} {...params} /> | ||
<EuiSpacer size="s" /> | ||
</div> | ||
); | ||
}); | ||
}, [schemas, vizState, handleConfigurationChange]); | ||
|
||
return ( | ||
<EuiAccordion | ||
initialIsOpen | ||
id={htmlIdGenerator('configPanel__tooltip')()} | ||
buttonContent="Tooltip options" | ||
paddingSize="s" | ||
> | ||
{dimensions} | ||
</EuiAccordion> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.