-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* lint Signed-off-by: John Lukenoff <jlukenoff@gmail.com> * refactor Signed-off-by: John Lukenoff <jlukenoff@gmail.com> * fix test Signed-off-by: John Lukenoff <jlukenoff@gmail.com> * add tests Signed-off-by: John Lukenoff <johnlukenoff@asana.com> * convert depthconfig to formcontrol label Signed-off-by: John Lukenoff <johnlukenoff@asana.com> * unused import Signed-off-by: John Lukenoff <johnlukenoff@asana.com> --------- Signed-off-by: John Lukenoff <jlukenoff@gmail.com> Signed-off-by: John Lukenoff <johnlukenoff@asana.com>
- Loading branch information
Showing
8 changed files
with
258 additions
and
143 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright 2018-2023 contributors to the Marquez project | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import * as Redux from 'redux' | ||
import { Box, FormControlLabel, Switch } from '@mui/material' | ||
import { IState } from '../../store/reducers' | ||
import { bindActionCreators } from 'redux' | ||
import { connect } from 'react-redux' | ||
import { setShowFullGraph } from '../../store/actionCreators' | ||
import React from 'react' | ||
|
||
interface FullGraphSwitch { | ||
showFullGraph: boolean | ||
setShowFullGraph: (showFullGraph: boolean) => void | ||
} | ||
|
||
const FullGraphSwitch: React.FC<FullGraphSwitch> = ({ setShowFullGraph, showFullGraph }) => { | ||
const i18next = require('i18next') | ||
const FULL_GRAPH_LABEL = i18next.t('lineage.full_graph_label') | ||
return ( | ||
<Box | ||
sx={theme => ({ | ||
display: 'flex', | ||
justifyContent: 'space-evenly', | ||
alignItems: 'center', | ||
zIndex: theme.zIndex.appBar | ||
})} | ||
> | ||
<FormControlLabel | ||
sx={{ | ||
marginLeft: 0 | ||
}} | ||
labelPlacement='start' | ||
control={ | ||
<Switch | ||
checked={showFullGraph} | ||
onChange={(_, checked) => setShowFullGraph(checked)} | ||
color='primary' | ||
/> | ||
} | ||
label={FULL_GRAPH_LABEL} | ||
/> | ||
</Box> | ||
) | ||
} | ||
|
||
const mapStateToProps = (state: IState) => ({ | ||
showFullGraph: state.lineage.showFullGraph | ||
}) | ||
|
||
const mapDispatchToProps = (dispatch: Redux.Dispatch) => | ||
bindActionCreators( | ||
{ | ||
setShowFullGraph: setShowFullGraph | ||
}, | ||
dispatch | ||
) | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(FullGraphSwitch) |
Oops, something went wrong.