2017-01-29 12:54:06 +13:00
|
|
|
|
|
|
|
|
import React, { PropTypes } from 'react'
|
|
|
|
|
import { connect } from 'react-redux'
|
|
|
|
|
import { Link } from 'react-router'
|
|
|
|
|
import { createStore, bindActionCreators } from 'redux'
|
|
|
|
|
|
2017-01-29 16:25:05 +13:00
|
|
|
import * as helpers from '../helpers'
|
2017-01-29 12:54:06 +13:00
|
|
|
import * as uiActions from '../services/ui/actions'
|
|
|
|
|
|
|
|
|
|
class DebugInfo extends React.Component{
|
|
|
|
|
|
2017-10-10 13:05:28 +13:00
|
|
|
constructor(props){
|
2017-01-29 12:54:06 +13:00
|
|
|
super(props);
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-27 14:23:38 +13:00
|
|
|
renderLoadQueue(){
|
|
|
|
|
if (!this.props.ui.load_queue){
|
|
|
|
|
return null
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var load_queue = this.props.ui.load_queue
|
|
|
|
|
var queue = []
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="item">
|
|
|
|
|
{queue}
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
renderLoadQueue(){
|
|
|
|
|
if (!this.props.ui.load_queue){
|
|
|
|
|
return null
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var load_queue = this.props.ui.load_queue
|
|
|
|
|
var queue = []
|
|
|
|
|
for (var key in load_queue){
|
|
|
|
|
if (load_queue.hasOwnProperty(key)){
|
|
|
|
|
queue.push(<div key={key}>{load_queue[key]}</div>)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-04 18:41:20 +12:00
|
|
|
if (queue.length > 0){
|
|
|
|
|
return (
|
|
|
|
|
<div className="item">
|
|
|
|
|
<br />
|
|
|
|
|
{queue}
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
} else {
|
|
|
|
|
return null
|
|
|
|
|
}
|
2017-03-27 14:23:38 +13:00
|
|
|
}
|
|
|
|
|
|
2017-01-29 12:54:06 +13:00
|
|
|
render(){
|
|
|
|
|
return (
|
|
|
|
|
<div className="debug-info">
|
|
|
|
|
<div className="item">
|
2017-08-03 16:56:38 +12:00
|
|
|
Albums: {this.props.core.albums ? Object.keys(this.props.core.albums).length : '0'}
|
2017-04-04 18:41:20 +12:00
|
|
|
</div>
|
|
|
|
|
<div className="item">
|
2017-08-03 16:56:38 +12:00
|
|
|
Artists: {this.props.core.artists ? Object.keys(this.props.core.artists).length : '0'}
|
2017-01-29 12:54:06 +13:00
|
|
|
</div>
|
|
|
|
|
<div className="item">
|
2017-08-03 16:56:38 +12:00
|
|
|
Playlists: {this.props.core.playlists ? Object.keys(this.props.core.playlists).length : '0'}
|
2017-01-29 12:54:06 +13:00
|
|
|
</div>
|
|
|
|
|
<div className="item">
|
2017-08-02 10:53:30 +12:00
|
|
|
Tracks: {this.props.core.tracks ? Object.keys(this.props.core.tracks).length : '0'}
|
2017-01-29 12:54:06 +13:00
|
|
|
</div>
|
2017-02-01 10:10:31 +13:00
|
|
|
<div className="item">
|
2017-08-03 16:56:38 +12:00
|
|
|
Users: {this.props.core.users ? Object.keys(this.props.core.users).length : '0'}
|
2017-02-01 10:10:31 +13:00
|
|
|
</div>
|
2017-01-29 12:54:06 +13:00
|
|
|
<div className="item">
|
2017-04-04 18:41:20 +12:00
|
|
|
Notifications: {this.props.ui.notifications ? Object.keys(this.props.ui.notifications).length : '0'}
|
2017-01-29 12:54:06 +13:00
|
|
|
</div>
|
2017-04-05 20:28:41 +12:00
|
|
|
<div className="item">
|
|
|
|
|
Processes: {this.props.ui.processes ? Object.keys(this.props.ui.processes).length : '0'}
|
|
|
|
|
</div>
|
2017-05-05 08:31:53 +12:00
|
|
|
<div className="item">
|
|
|
|
|
Enqueue batches: {this.props.mopidy.enqueue_uris_batches ? this.props.mopidy.enqueue_uris_batches.length : '0'}
|
|
|
|
|
</div>
|
2017-04-04 18:41:20 +12:00
|
|
|
<br />
|
2017-07-17 07:16:33 +12:00
|
|
|
<div className="item">
|
|
|
|
|
Slim mode: {this.props.ui.slim_mode ? 'on' : 'off'}
|
|
|
|
|
</div>
|
2017-04-03 20:58:47 +12:00
|
|
|
<div className="item">
|
2017-09-03 21:00:17 +12:00
|
|
|
Test mode: {this.props.ui.test_mode ? 'on' : 'off'}
|
2017-04-03 20:58:47 +12:00
|
|
|
</div>
|
2017-01-29 12:54:06 +13:00
|
|
|
<div className="item">
|
2017-04-05 20:28:41 +12:00
|
|
|
Touch: {helpers.isTouchDevice() ? 'on' : 'off'}
|
2017-01-29 12:54:06 +13:00
|
|
|
</div>
|
2017-07-25 09:22:28 +12:00
|
|
|
<div className="item">
|
|
|
|
|
Selected tracks: {this.props.ui.selected_tracks.length}<br />
|
|
|
|
|
{
|
|
|
|
|
this.props.ui.selected_tracks.map((track_key, index) => {
|
|
|
|
|
return (
|
|
|
|
|
<div key={track_key+'_'+index}>{track_key}</div>
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
</div>
|
2017-03-27 14:23:38 +13:00
|
|
|
{this.renderLoadQueue()}
|
2017-01-29 12:54:06 +13:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const mapStateToProps = (state, ownProps) => {
|
|
|
|
|
return {
|
2017-08-03 16:56:38 +12:00
|
|
|
core: state.core,
|
2017-05-05 08:31:53 +12:00
|
|
|
ui: state.ui,
|
|
|
|
|
mopidy: state.mopidy
|
2017-01-29 12:54:06 +13:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const mapDispatchToProps = (dispatch) => {
|
|
|
|
|
return {
|
|
|
|
|
uiActions: bindActionCreators(uiActions, dispatch)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(DebugInfo)
|