diff --git a/src/components/common/Menu.js b/src/components/common/Menu.js
index e91332f..7886d11 100644
--- a/src/components/common/Menu.js
+++ b/src/components/common/Menu.js
@@ -1,9 +1,20 @@
-import React from 'react'
+import React, {useState, useEffect} from 'react'
import Tooltip from '@material-ui/core/Tooltip';
import HelpIcon from '@material-ui/icons/Help';
import './Menu.scss'
-const Menu = ({ title = "", description=[], onChange=(e) => console.log(e), entries = [] }) => {
+const Menu = ({ title = "", description=[], onChange=(e) => console.log(e.target.value), entries = [], reset, updateReset}) => {
+ const [value, setValue] = useState("default");
+
+ const handleChange = e =>{
+ if(reset === true){
+ updateReset();
+ }
+ setValue(e.target.value);
+ onChange(e);
+
+ }
+
let tooltip = description.length === 0 ? null : (
console.log(e), entr
)
+ useEffect(() => {
+ if(reset) {
+ setValue("default")
+ }
+ }, [reset]); // Only re-run the effect if reset changes
+
return (
{title}:
{tooltip}
-
)
-}
+}
export default Menu;
\ No newline at end of file
diff --git a/src/components/routes/TestMatrixView.js b/src/components/routes/TestMatrixView.js
index 7e673c7..e928eac 100644
--- a/src/components/routes/TestMatrixView.js
+++ b/src/components/routes/TestMatrixView.js
@@ -41,13 +41,15 @@ class TestMatrixView extends Component {
history: [new FunctionMap()],
projects: [],
commits: [],
- expanded: false
+ expanded: false,
+ reset: false
}
this.backInTime = this.backInTime.bind(this);
this.reset = this.reset.bind(this);
this.onProjectChange = this.onProjectChange.bind(this);
- this.onCommitChange = this.onCommitChange.bind(this)
+ this.onCommitChange = this.onCommitChange.bind(this);
+ this.updateReset = this.updateReset.bind(this);
}
async onCommitChange(event) {
@@ -184,8 +186,14 @@ class TestMatrixView extends Component {
this.setState({
history: [new FunctionMap()]
})
+ this.setState({selectedProject: "", selectedCommit: "", reset: true});
}
+ updateReset(){
+ this.setState({reset: false});
+ }
+
+
render() {
const history = this.state.history;
const current_filter_map = history[history.length - 1];
@@ -237,8 +245,8 @@ class TestMatrixView extends Component {
Project selector
-
-
+
@@ -279,7 +287,10 @@ class TestMatrixView extends Component {
{ key: 1, value: "Coverage" },
{ key: 2, value: "Cluster" },
{ key: 3, value: "Suspiciousness"}
- ]} />
+ ]}
+ reset={this.state.reset}
+ updateReset={this.updateReset}
+ />
{
@@ -305,7 +316,10 @@ class TestMatrixView extends Component {
{ key: 0, value: "Name" },
{ key: 1, value: "Coverage" },
{ key: 2, value: "Cluster" },
- ]} />
+ ]}
+ reset={this.state.reset}
+ updateReset={this.updateReset}
+ />
@@ -332,7 +346,10 @@ class TestMatrixView extends Component {
this.setState({
history: this.state.history.concat(new_filter_map)
})
- }} />
+ }}
+ reset={this.state.reset}
+ updateReset={this.updateReset}
+ />
+ }}
+ reset={this.state.reset}
+ updateReset={this.updateReset}
+ />
{