-
Notifications
You must be signed in to change notification settings - Fork 916
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Adds visualization type switcher for Wizard Signed-off-by: Ashwin Pc <[email protected]> * Minor fixes Signed-off-by: Ashwin Pc <[email protected]> * Updates options viz options ui Signed-off-by: Ashwin Pc <[email protected]> Signed-off-by: Ashwin Pc <[email protected]> (cherry picked from commit c18736a) Co-authored-by: Ashwin P Chandran <[email protected]>
- Loading branch information
1 parent
b6ab762
commit 278c77f
Showing
16 changed files
with
206 additions
and
183 deletions.
There are no files selected for viewing
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
20 changes: 20 additions & 0 deletions
20
src/plugins/wizard/public/application/components/left_nav.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,20 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import './side_nav.scss'; | ||
import { DataSourceSelect } from './data_source_select'; | ||
import { DataTab } from './data_tab'; | ||
|
||
export const LeftNav = () => { | ||
return ( | ||
<section className="wizSidenav left"> | ||
<div className="wizDatasourceSelect wizSidenav__header"> | ||
<DataSourceSelect /> | ||
</div> | ||
<DataTab key="containerName" /> | ||
</section> | ||
); | ||
}; |
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,8 @@ | ||
.wizOption { | ||
background-color: $euiColorEmptyShade; | ||
padding: $euiSizeM; | ||
|
||
& &__panel { | ||
background-color: $euiColorLightestShade; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/plugins/wizard/public/application/components/option.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,32 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { EuiAccordion, EuiHorizontalRule, EuiPanel, EuiSpacer } from '@elastic/eui'; | ||
import React, { FC } from 'react'; | ||
import './option.scss'; | ||
|
||
interface Props { | ||
title: string; | ||
initialIsOpen?: boolean; | ||
} | ||
|
||
export const Option: FC<Props> = ({ title, children, initialIsOpen = false }) => { | ||
return ( | ||
<> | ||
<EuiAccordion | ||
id={title} | ||
buttonContent={title} | ||
className="wizOption" | ||
initialIsOpen={initialIsOpen} | ||
> | ||
<EuiSpacer size="s" /> | ||
<EuiPanel color="subdued" className="wizOption__panel"> | ||
{children} | ||
</EuiPanel> | ||
</EuiAccordion> | ||
<EuiHorizontalRule margin="none" /> | ||
</> | ||
); | ||
}; |
57 changes: 57 additions & 0 deletions
57
src/plugins/wizard/public/application/components/right_nav.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,57 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { EuiSuperSelect, EuiSuperSelectOption, EuiIcon, IconType } from '@elastic/eui'; | ||
import { useVisualizationType } from '../utils/use'; | ||
import './side_nav.scss'; | ||
import { useOpenSearchDashboards } from '../../../../opensearch_dashboards_react/public'; | ||
import { WizardServices } from '../../types'; | ||
import { setActiveVisualization, useTypedDispatch } from '../utils/state_management'; | ||
|
||
export const RightNav = () => { | ||
const { | ||
services: { types }, | ||
} = useOpenSearchDashboards<WizardServices>(); | ||
const { ui, name: activeVisName } = useVisualizationType(); | ||
const dispatch = useTypedDispatch(); | ||
const StyleSection = ui.containerConfig.style.render; | ||
|
||
const options: Array<EuiSuperSelectOption<string>> = types.all().map(({ name, icon, title }) => ({ | ||
value: name, | ||
inputDisplay: <OptionItem icon={icon} title={title} />, | ||
dropdownDisplay: <OptionItem icon={icon} title={title} />, | ||
})); | ||
|
||
return ( | ||
<section className="wizSidenav right"> | ||
<div className="wizSidenav__header"> | ||
<EuiSuperSelect | ||
options={options} | ||
valueOfSelected={activeVisName} | ||
onChange={(name) => { | ||
dispatch( | ||
setActiveVisualization({ | ||
name, | ||
style: types.get(name)?.ui.containerConfig.style.defaults, | ||
}) | ||
); | ||
}} | ||
fullWidth | ||
/> | ||
</div> | ||
<div className="wizSidenav__style"> | ||
<StyleSection /> | ||
</div> | ||
</section> | ||
); | ||
}; | ||
|
||
const OptionItem = ({ icon, title }: { icon: IconType; title: string }) => ( | ||
<> | ||
<EuiIcon type={icon} className="wizTypeSelector__icon" /> | ||
<span>{title}</span> | ||
</> | ||
); |
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
48 changes: 0 additions & 48 deletions
48
src/plugins/wizard/public/application/components/side_nav.tsx
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
|
||
export * from './store'; | ||
export * from './hooks'; | ||
export * from './shared_actions'; |
14 changes: 14 additions & 0 deletions
14
src/plugins/wizard/public/application/utils/state_management/shared_actions.ts
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,14 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { createAction } from '@reduxjs/toolkit'; | ||
import { VisualizationType } from '../../../services/type_service/visualization_type'; | ||
|
||
interface ActiveVisPayload { | ||
name: VisualizationType['name']; | ||
style: VisualizationType['ui']['containerConfig']['style']['defaults']; | ||
} | ||
|
||
export const setActiveVisualization = createAction<ActiveVisPayload>('setActiveVisualzation'); |
Oops, something went wrong.