Skip to content

Commit

Permalink
Merge pull request #51 from tomatau/should-expand-node
Browse files Browse the repository at this point in the history
replace JSONTree.expandRoot with shouldExpandNode
  • Loading branch information
gaearon committed Apr 17, 2016
2 parents cc33262 + 9095b35 commit 82f7815
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/LogMonitorEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default class LogMonitorEntry extends Component {
constructor(props) {
super(props);
this.handleActionClick = this.handleActionClick.bind(this);
this.shouldExpandNode = this.shouldExpandNode.bind(this);
}

printState(state, error) {
Expand All @@ -47,7 +48,7 @@ export default class LogMonitorEntry extends Component {
this.props.select(this.props.previousState) :
undefined
}
expandRoot={this.props.expandStateRoot}
shouldExpandNode={this.shouldExpandNode}
style={styles.tree} />
);
} catch (err) {
Expand Down Expand Up @@ -75,6 +76,10 @@ export default class LogMonitorEntry extends Component {
}
}

shouldExpandNode() {
return this.props.expandStateRoot;
}

render() {
const { actionId, error, action, state, collapsed } = this.props;
const styleEntry = {
Expand Down
11 changes: 10 additions & 1 deletion src/LogMonitorEntryAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ const styles = {
};

export default class LogMonitorAction extends Component {
constructor(props) {
super(props);
this.shouldExpandNode = this.shouldExpandNode.bind(this);
}

renderPayload(payload) {
return (
<div style={{
Expand All @@ -24,11 +29,15 @@ export default class LogMonitorAction extends Component {
<JSONTree theme={this.props.theme}
keyPath={['action']}
data={payload}
expandRoot={this.props.expandActionRoot} /> : '' }
shouldExpandNode={this.shouldExpandNode} /> : '' }
</div>
);
}

shouldExpandNode() {
return this.props.expandActionRoot;
}

render() {
const { type, ...payload } = this.props.action;
return (
Expand Down

0 comments on commit 82f7815

Please sign in to comment.