mirror of https://github.com/docker/docs.git
67 lines
2.0 KiB
JavaScript
67 lines
2.0 KiB
JavaScript
import React from 'react/addons';
|
|
import metrics from '../utils/MetricsUtil';
|
|
import Router from 'react-router';
|
|
|
|
var Preferences = React.createClass({
|
|
mixins: [Router.Navigation],
|
|
getInitialState: function () {
|
|
return {
|
|
closeVMOnQuit: localStorage.getItem('settings.closeVMOnQuit') === 'true',
|
|
metricsEnabled: metrics.enabled()
|
|
};
|
|
},
|
|
handleGoBackClick: function () {
|
|
this.goBack();
|
|
metrics.track('Went Back From Preferences');
|
|
},
|
|
handleChangeCloseVMOnQuit: function (e) {
|
|
var checked = e.target.checked;
|
|
this.setState({
|
|
closeVMOnQuit: checked
|
|
});
|
|
localStorage.setItem('settings.closeVMOnQuit', checked);
|
|
metrics.track('Toggled Close VM On Quit', {
|
|
close: checked
|
|
});
|
|
},
|
|
handleChangeMetricsEnabled: function (e) {
|
|
var checked = e.target.checked;
|
|
this.setState({
|
|
metricsEnabled: checked
|
|
});
|
|
metrics.setEnabled(checked);
|
|
metrics.track('Toggled util/MetricsUtil', {
|
|
enabled: checked
|
|
});
|
|
},
|
|
render: function () {
|
|
return (
|
|
<div className="preferences">
|
|
<div className="preferences-content">
|
|
<a onClick={this.handleGoBackClick}>Go Back</a>
|
|
<div className="title">VM Settings</div>
|
|
<div className="option">
|
|
<div className="option-name">
|
|
Shut Down Linux VM on closing Kitematic
|
|
</div>
|
|
<div className="option-value">
|
|
<input type="checkbox" checked={this.state.closeVMOnQuit} onChange={this.handleChangeCloseVMOnQuit}/>
|
|
</div>
|
|
</div>
|
|
<div className="title">App Settings</div>
|
|
<div className="option">
|
|
<div className="option-name">
|
|
Report anonymous usage analytics
|
|
</div>
|
|
<div className="option-value">
|
|
<input type="checkbox" checked={this.state.metricsEnabled} onChange={this.handleChangeMetricsEnabled}/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
});
|
|
|
|
module.exports = Preferences;
|