import React from 'react'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import Header from '../components/Header'; import Thumbnail from '../components/Thumbnail'; import Icon from '../components/Icon'; import Link from '../components/Link'; import * as uiActions from '../services/ui/actions'; import * as pusherActions from '../services/pusher/actions'; import * as mopidyActions from '../services/mopidy/actions'; import * as spotifyActions from '../services/spotify/actions'; import * as snapcastActions from '../services/snapcast/actions'; class Debug extends React.Component { constructor(props) { super(props); this.state = { mopidy_call: 'playlists.asList', mopidy_data: '{}', pusher_data: '{"method":"get_config"}', snapcast_data: '{"method":"Server.GetStatus"}', access_token: this.props.access_token, toggling_test_mode: false, }; } componentDidMount() { this.props.uiActions.setWindowTitle('Debug'); } callMopidy(e) { e.preventDefault(); this.props.mopidyActions.debug(this.state.mopidy_call, JSON.parse(this.state.mopidy_data)); } callPusher(e) { e.preventDefault(); this.props.pusherActions.debug(JSON.parse(this.state.pusher_data)); } callSnapcast(e) { e.preventDefault(); this.props.snapcastActions.debug(JSON.parse(this.state.snapcast_data)); } toggleTestMode(e) { this.setState({ toggling_test_mode: true }); this.props.uiActions.set({ test_mode: !this.props.test_mode }); // Wait a second to allow state to update, and then refresh setTimeout(location.reload(), 1000); } render() { const options = ( this.props.history.push('/settings')}> Back ); return (
Debug

User interface

Test mode
{this.state.toggling_test_mode ? Applying... : (this.props.test_mode ? this.toggleTestMode(e)}>Disable : this.toggleTestMode(e)}>Enable)}
Debug
Logging

Spotify

Mopidy

this.callMopidy(e)}>