Fix clearing log focus

This commit is contained in:
Tulir Asokan 2018-11-29 01:06:58 +02:00
parent 32b60fa0ff
commit c3dbf9685d

View file

@ -33,7 +33,7 @@ class Dashboard extends Component {
plugins: {}, plugins: {},
sidebarOpen: false, sidebarOpen: false,
modalOpen: false, modalOpen: false,
logFocus: "", logFocus: null,
} }
this.logLines = [] this.logLines = []
this.logMap = {} this.logMap = {}
@ -126,16 +126,18 @@ class Dashboard extends Component {
entry, entry,
onDelete: () => this.delete(field, id), onDelete: () => this.delete(field, id),
onChange: newEntry => this.add(field, newEntry, id), onChange: newEntry => this.add(field, newEntry, id),
openLog: filter => { openLog: this.openLog,
this.setState({
logFocus: filter,
})
this.logModal.open()
},
ctx: this.state, ctx: this.state,
}) })
} }
openLog = filter => {
this.setState({
logFocus: typeof filter === "string" ? filter : null,
})
this.logModal.open()
}
renderNotFound = (thing = "path") => ( renderNotFound = (thing = "path") => (
<div className="not-found"> <div className="not-found">
Oops! I'm afraid that {thing} couldn't be found. Oops! I'm afraid that {thing} couldn't be found.
@ -185,7 +187,7 @@ class Dashboard extends Component {
<main className="view"> <main className="view">
<Switch> <Switch>
<Route path="/" exact render={() => <Home openLog={this.logModal.open}/>}/> <Route path="/" exact render={() => <Home openLog={this.openLog}/>}/>
<Route path="/new/instance" render={() => <Route path="/new/instance" render={() =>
<Instance onChange={newEntry => this.add("instances", newEntry)} <Instance onChange={newEntry => this.add("instances", newEntry)}
ctx={this.state}/>}/> ctx={this.state}/>}/>