This commit is contained in:
Eugene Rodionov 2015-08-10 17:37:05 +00:00
commit d53b5fbf3d
3 changed files with 68 additions and 65 deletions

View File

@ -12,17 +12,15 @@ export function getDefaultStyle(props) {
return {
position: 'fixed',
zIndex: 999,
fontSize: 17,
overflow: 'auto',
opacity: 0.92,
background: 'black',
background: 'rgb(27, 27, 27)',
color: 'white',
left: left ? 0 : undefined,
right: right ? 0 : undefined,
top: top ? 0 : undefined,
bottom: bottom ? 0 : undefined,
maxHeight: (bottom && top) ? '100%' : '20%',
maxWidth: (left && right) ? '100%' : '20%',
width: (left && right) ? '100%' : '25%',
wordWrap: 'break-word'
};
}

View File

@ -120,50 +120,66 @@ export default class LogMonitor {
<div style={{
fontFamily: 'monospace',
position: 'relative',
padding: '1rem'
padding: '1rem 1rem 0 1rem',
height: '100%'
}}>
<div>
<div style={{
paddingBottom: '.5rem'
<div style={{marginBottom: 40, fontSize: 12}}>
<div style={{float: 'left'}}>
{computedStates.length > 1 &&
<button onClick={::this.handleRollback} style={{
cursor: 'pointer',
padding: '5px 7px',
border: '1px solid #eee',
display: 'inline-block',
backgroundColor: 'transparent',
color: '#eee',
fontFamily: 'monospace'
}}>
<small>Press Ctrl+H to hide.</small>
Rollback
</button>
}
{Object.keys(skippedActions).some(key => skippedActions[key]) &&
<button onClick={::this.handleSweep} style={{
cursor: 'pointer',
padding: '5px 7px',
border: '1px solid #eee',
display: 'inline-block',
backgroundColor: 'transparent',
color: '#eee',
fontFamily: 'monospace'
}}>
Sweep
</button>
}
{computedStates.length > 1 &&
<button onClick={::this.handleCommit} style={{
cursor: 'pointer',
padding: '5px 7px',
border: '1px solid #eee',
display: 'inline-block',
backgroundColor: 'transparent',
color: '#eee',
fontFamily: 'monospace'
}}>
Commit
</button>
}
</div>
<div>
<a onClick={::this.handleReset}
style={{ textDecoration: 'underline', cursor: 'hand' }}>
<small>Reset</small>
</a>
<div style={{float: 'right'}}>
<button onClick={::this.handleReset} style={{
cursor: 'pointer',
padding: '5px 7px',
border: '1px solid #eee',
display: 'inline-block',
backgroundColor: 'transparent',
color: '#eee',
fontFamily: 'monospace'
}}>
Reset
</button>
</div>
</div>
{elements}
<div>
{computedStates.length > 1 &&
<a onClick={::this.handleRollback}
style={{ textDecoration: 'underline', cursor: 'pointer' }}>
Rollback
</a>
}
{Object.keys(skippedActions).some(key => skippedActions[key]) &&
<span>
{' • '}
<a onClick={::this.handleSweep}
style={{ textDecoration: 'underline', cursor: 'pointer' }}>
Sweep
</a>
</span>
}
{computedStates.length > 1 &&
<span>
<span>
{' • '}
</span>
<a onClick={::this.handleCommit}
style={{ textDecoration: 'underline', cursor: 'pointer' }}>
Commit
</a>
</span>
}
</div>
</div>
);
}

View File

@ -49,7 +49,7 @@ export default class LogMonitorEntry {
let errorText = error;
if (!errorText) {
try {
return JSON.stringify(this.props.select(state));
return JSON.stringify(this.props.select(state), null, 2);
} catch (err) {
errorText = 'Error selecting state.';
}
@ -77,14 +77,14 @@ export default class LogMonitorEntry {
return (
<div style={{
textDecoration: collapsed ? 'line-through' : 'none'
textDecoration: collapsed ? 'line-through' : 'none',
borderBottom: '1px solid #333',
paddingBottom: '1em'
}}>
<a onClick={::this.handleActionClick}
style={{
opacity: collapsed ? 0.5 : 1,
marginTop: '1em',
display: 'block',
paddingBottom: '1em',
paddingTop: '1em',
color: `rgb(${r}, ${g}, ${b})`,
cursor: (index > 0) ? 'pointer' : 'default',
@ -94,27 +94,16 @@ export default class LogMonitorEntry {
</a>
{!collapsed &&
<p style={{
textAlign: 'center',
transform: 'rotate(180deg)'
}}>
</p>
}
{!collapsed &&
<div style={{
paddingBottom: '1em',
paddingTop: '1em',
color: 'lightyellow'
<pre style={{
backgroundColor: '#fff',
color: '#111',
padding: 10,
marginTop: 10,
fontSize: 15
}}>
{this.printState(state, error)}
</div>
</pre>
}
<hr style={{
marginBottom: '2em'
}} />
</div>
);
}