mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-04 11:53:30 +03:00
feat: clean up logmonitor
This commit is contained in:
parent
53a8c74341
commit
d4a0a011cd
|
@ -12,17 +12,15 @@ export function getDefaultStyle(props) {
|
||||||
return {
|
return {
|
||||||
position: 'fixed',
|
position: 'fixed',
|
||||||
zIndex: 999,
|
zIndex: 999,
|
||||||
fontSize: 17,
|
|
||||||
overflow: 'auto',
|
overflow: 'auto',
|
||||||
opacity: 0.92,
|
background: 'rgb(27, 27, 27)',
|
||||||
background: 'black',
|
|
||||||
color: 'white',
|
color: 'white',
|
||||||
left: left ? 0 : undefined,
|
left: left ? 0 : undefined,
|
||||||
right: right ? 0 : undefined,
|
right: right ? 0 : undefined,
|
||||||
top: top ? 0 : undefined,
|
top: top ? 0 : undefined,
|
||||||
bottom: bottom ? 0 : undefined,
|
bottom: bottom ? 0 : undefined,
|
||||||
maxHeight: (bottom && top) ? '100%' : '20%',
|
maxHeight: (bottom && top) ? '100%' : '20%',
|
||||||
maxWidth: (left && right) ? '100%' : '20%',
|
maxWidth: (left && right) ? '100%' : '25%',
|
||||||
wordWrap: 'break-word'
|
wordWrap: 'break-word'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,48 +122,51 @@ export default class LogMonitor {
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
padding: '1rem'
|
padding: '1rem'
|
||||||
}}>
|
}}>
|
||||||
<div>
|
<div style={{marginBottom: 40, fontSize: 12}}>
|
||||||
<div style={{
|
<div style={{float: 'left'}}>
|
||||||
paddingBottom: '.5rem'
|
{computedStates.length > 1 &&
|
||||||
|
<button onClick={::this.handleRollback} style={{
|
||||||
|
cursor: 'hand',
|
||||||
|
padding: '5px 7px',
|
||||||
|
border: '1px solid #eee',
|
||||||
|
display: 'inline-block'
|
||||||
}}>
|
}}>
|
||||||
<small>Press Ctrl+H to hide.</small>
|
Rollback
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
{Object.keys(skippedActions).some(key => skippedActions[key]) &&
|
||||||
|
<button onClick={::this.handleSweep} style={{
|
||||||
|
cursor: 'hand',
|
||||||
|
padding: '5px 7px',
|
||||||
|
border: '1px solid #eee',
|
||||||
|
display: 'inline-block'
|
||||||
|
}}>
|
||||||
|
Sweep
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
{computedStates.length > 1 &&
|
||||||
|
<button onClick={::this.handleCommit} style={{
|
||||||
|
cursor: 'hand',
|
||||||
|
padding: '5px 7px',
|
||||||
|
border: '1px solid #eee',
|
||||||
|
display: 'inline-block'
|
||||||
|
}}>
|
||||||
|
Commit
|
||||||
|
</button>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div style={{float: 'right'}}>
|
||||||
<a onClick={::this.handleReset}
|
<button onClick={::this.handleReset} style={{
|
||||||
style={{ textDecoration: 'underline', cursor: 'hand' }}>
|
cursor: 'hand',
|
||||||
<small>Reset</small>
|
padding: '5px 7px',
|
||||||
</a>
|
border: '1px solid #eee',
|
||||||
|
display: 'inline-block'
|
||||||
|
}}>
|
||||||
|
Reset
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{elements}
|
{elements}
|
||||||
<div>
|
|
||||||
{computedStates.length > 1 &&
|
|
||||||
<a onClick={::this.handleRollback}
|
|
||||||
style={{ textDecoration: 'underline', cursor: 'hand' }}>
|
|
||||||
Rollback
|
|
||||||
</a>
|
|
||||||
}
|
|
||||||
{Object.keys(skippedActions).some(key => skippedActions[key]) &&
|
|
||||||
<span>
|
|
||||||
{' • '}
|
|
||||||
<a onClick={::this.handleSweep}
|
|
||||||
style={{ textDecoration: 'underline', cursor: 'hand' }}>
|
|
||||||
Sweep
|
|
||||||
</a>
|
|
||||||
</span>
|
|
||||||
}
|
|
||||||
{computedStates.length > 1 &&
|
|
||||||
<span>
|
|
||||||
<span>
|
|
||||||
{' • '}
|
|
||||||
</span>
|
|
||||||
<a onClick={::this.handleCommit}
|
|
||||||
style={{ textDecoration: 'underline', cursor: 'hand' }}>
|
|
||||||
Commit
|
|
||||||
</a>
|
|
||||||
</span>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ export default class LogMonitorEntry {
|
||||||
let errorText = error;
|
let errorText = error;
|
||||||
if (!errorText) {
|
if (!errorText) {
|
||||||
try {
|
try {
|
||||||
return JSON.stringify(this.props.select(state));
|
return JSON.stringify(this.props.select(state), null, 2);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
errorText = 'Error selecting state.';
|
errorText = 'Error selecting state.';
|
||||||
}
|
}
|
||||||
|
@ -77,14 +77,14 @@ export default class LogMonitorEntry {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{
|
<div style={{
|
||||||
textDecoration: collapsed ? 'line-through' : 'none'
|
textDecoration: collapsed ? 'line-through' : 'none',
|
||||||
|
borderBottom: '1px solid #333',
|
||||||
|
paddingBottom: '1em'
|
||||||
}}>
|
}}>
|
||||||
<a onClick={::this.handleActionClick}
|
<a onClick={::this.handleActionClick}
|
||||||
style={{
|
style={{
|
||||||
opacity: collapsed ? 0.5 : 1,
|
opacity: collapsed ? 0.5 : 1,
|
||||||
marginTop: '1em',
|
|
||||||
display: 'block',
|
display: 'block',
|
||||||
paddingBottom: '1em',
|
|
||||||
paddingTop: '1em',
|
paddingTop: '1em',
|
||||||
color: `rgb(${r}, ${g}, ${b})`,
|
color: `rgb(${r}, ${g}, ${b})`,
|
||||||
cursor: (index > 0) ? 'hand' : 'default',
|
cursor: (index > 0) ? 'hand' : 'default',
|
||||||
|
@ -94,27 +94,16 @@ export default class LogMonitorEntry {
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
{!collapsed &&
|
{!collapsed &&
|
||||||
<p style={{
|
<pre style={{
|
||||||
textAlign: 'center',
|
backgroundColor: '#fff',
|
||||||
transform: 'rotate(180deg)'
|
color: '#111',
|
||||||
}}>
|
padding: 10,
|
||||||
⇧
|
marginTop: 10,
|
||||||
</p>
|
fontSize: 15
|
||||||
}
|
|
||||||
|
|
||||||
{!collapsed &&
|
|
||||||
<div style={{
|
|
||||||
paddingBottom: '1em',
|
|
||||||
paddingTop: '1em',
|
|
||||||
color: 'lightyellow'
|
|
||||||
}}>
|
}}>
|
||||||
{this.printState(state, error)}
|
{this.printState(state, error)}
|
||||||
</div>
|
</pre>
|
||||||
}
|
}
|
||||||
|
|
||||||
<hr style={{
|
|
||||||
marginBottom: '2em'
|
|
||||||
}} />
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user