'use strict'; import React from 'react'; import Router from 'react-router'; import UserActions from '../actions/user_actions'; import UserStore from '../stores/user_store'; import WalletSettingsActions from '../actions/wallet_settings_actions'; import WalletSettingsStore from '../stores/wallet_settings_store'; import ApplicationActions from '../actions/application_actions'; import ApplicationStore from '../stores/application_store'; import GlobalNotificationModel from '../models/global_notification_model'; import GlobalNotificationActions from '../actions/global_notification_actions'; import ReactS3FineUploader from './ascribe_uploader/react_s3_fine_uploader'; import CollapsibleParagraph from './ascribe_collapsible/collapsible_paragraph'; import Form from './ascribe_forms/form'; import Property from './ascribe_forms/property'; import InputCheckbox from './ascribe_forms/input_checkbox'; import apiUrls from '../constants/api_urls'; import AppConstants from '../constants/application_constants'; import { getLangText } from '../utils/lang_utils'; import { getCookie } from '../utils/fetch_api_utils'; let SettingsContainer = React.createClass({ mixins: [Router.Navigation], render() { return (


); } }); let AccountSettings = React.createClass({ getInitialState() { return UserStore.getState(); }, componentDidMount() { UserStore.listen(this.onChange); UserActions.fetchCurrentUser(); }, componentWillUnmount() { UserStore.unlisten(this.onChange); }, onChange(state) { this.setState(state); }, handleSuccess(){ UserActions.fetchCurrentUser(); let notification = new GlobalNotificationModel(getLangText('username succesfully updated'), 'success', 5000); GlobalNotificationActions.appendGlobalNotification(notification); }, getFormDataProfile(){ return {'email': this.state.currentUser.email}; }, render() { let content = ; let profile = null; if (this.state.currentUser.username) { content = (

); profile = (
{' ' + getLangText('Enable hash option for slow connections. ' + 'Computes and uploads a hash of the work instead.')} {/* */}
); } return ( {content} {profile} {/*

*/}
); } }); let BitcoinWalletSettings = React.createClass({ propTypes: { defaultExpanded: React.PropTypes.bool }, getInitialState() { return WalletSettingsStore.getState(); }, componentDidMount() { WalletSettingsStore.listen(this.onChange); WalletSettingsActions.fetchWalletSettings(); }, componentWillUnmount() { WalletSettingsStore.unlisten(this.onChange); }, onChange(state) { this.setState(state); }, render() { let content = ; if (this.state.walletSettings.btc_public_key) { content = (
{this.state.walletSettings.btc_public_key}
{this.state.walletSettings.btc_root_address}

); } return ( {content} ); } }); let LoanContractSettings = React.createClass({ propTypes: { defaultExpanded: React.PropTypes.bool }, render() { return ( ); } }); let FileUploader = React.createClass({ propTypes: { }, render() { return (

); } }); let APISettings = React.createClass({ propTypes: { defaultExpanded: React.PropTypes.bool }, getInitialState() { return ApplicationStore.getState(); }, componentDidMount() { ApplicationStore.listen(this.onChange); ApplicationActions.fetchApplication(); }, componentWillUnmount() { ApplicationStore.unlisten(this.onChange); }, onChange(state) { this.setState(state); }, handleCreateSuccess: function(){ ApplicationActions.fetchApplication(); let notification = new GlobalNotificationModel(getLangText('Application successfully created'), 'success', 5000); GlobalNotificationActions.appendGlobalNotification(notification); }, handleTokenRefresh: function(event){ let applicationName = event.target.getAttribute('data-id'); ApplicationActions.refreshApplicationToken(applicationName); let notification = new GlobalNotificationModel(getLangText('Token refreshed'), 'success', 2000); GlobalNotificationActions.appendGlobalNotification(notification); }, render() { let content = ; if (this.state.applications.length > -1) { content = this.state.applications.map(function(app) { return (
{'Bearer ' + app.bearer_token.token}
); }, this); content = (
{content}
); } return (

                    Usage: curl <url> -H 'Authorization: Bearer <token>'
                
{content}
); } }); export default SettingsContainer;