-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#59: Moved select for commits to chart.js, made boundaries for commit2
- Loading branch information
1 parent
835681c
commit d652fe0
Showing
3 changed files
with
97 additions
and
47 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
28 changes: 0 additions & 28 deletions
28
ui/src/visualizations/legacy/file-tree-comparison/config.js
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 |
---|---|---|
@@ -1,54 +1,26 @@ | ||
'use strict'; | ||
|
||
import { connect } from 'react-redux'; | ||
import { setCommit1, setCommit2, setTree1, setTree2 } from './sagas/index.js'; | ||
|
||
const mapStateToProps = (state /*, ownProps*/) => { | ||
const fileTreeState = state.visualizations.fileTreeComparison.state.data.data; | ||
return { | ||
commits: fileTreeState.commits, | ||
commit1: null, | ||
commit2: null, | ||
tree1: null, | ||
tree2: null, | ||
}; | ||
}; | ||
|
||
const mapDispatchToProps = (dispatch) => { | ||
return { | ||
onSetCommit1: (commit) => dispatch(setCommit1(commit)), | ||
onSetCommit2: (commit) => dispatch(setCommit2(commit)) | ||
}; | ||
}; | ||
|
||
const ChangesConfigComponent = (props) => { | ||
let commits = []; | ||
for (const i in props.commits) { | ||
commits.push(<option key={i}>{props.commits[i].messageHeader}</option>); | ||
} | ||
commits = commits.slice().reverse(); //reverse Array | ||
|
||
return ( | ||
<div> | ||
<select | ||
value={props.commit1} | ||
onChange={(e) => { | ||
props.onSetCommit1(props.commits[commits.length - e.target.options.selectedIndex - 1]); | ||
}}> | ||
{commits} | ||
</select> | ||
<select | ||
value={props.commit2} | ||
onChange={(e) => { | ||
props.onSetCommit2(props.commits[commits.length - e.target.options.selectedIndex - 1]); | ||
}}> | ||
{commits} | ||
</select> | ||
</div> | ||
); | ||
}; | ||
|
||
const FileTreeConfig = connect(mapStateToProps, mapDispatchToProps)(ChangesConfigComponent); | ||
|
||
export default FileTreeConfig; | ||
|