var DomainStore = require('../stores').Domains; var React = require('react'); var DevModeToggle = React.createClass({ getInitialState: function() { return {toggling: false}; }, componentWillReceiveProps: function() { this.setState({toggling: false}); }, toggleDevMode: function() { this.setState({toggling: true}); DomainStore.setDevelopmentMode(this.props.domain, this.props.devMode == 0); }, render: function() { if(this.state.toggling) { return } else if(this.props.devMode > 0) { var date = new Date(this.props.devMode*1000); var dateString = date.getFullYear()+'/'+(1+date.getMonth())+'/'+date.getDate()+' '+date.getHours()+':'+date.getMinutes(); return (
Active until {dateString}
); } else { return } } }); var PurgeButton = React.createClass({ getInitialState: function() { return {purging: false}; }, purgeCache: function() { this.setState({purging: true}); var reset = function() { this.setState({purging: false}); }.bind(this); DomainStore.purgeCache(this.props.domain).then(function(data) { var timeout = data.attributes.cooldown; setTimeout(reset, timeout*1000); }); }, render: function() { if(this.state.purging) { return } else { return } } }); var Settings = React.createClass({ render: function() { if(!this.props.settings.val()) { return
Loading...
} return (
Development Mode
Purge Cache
); } }); module.exports = Settings;