/* * STANDARD_RIFT_IO_COPYRIGHT */ import React from 'react'; import AppHeader from 'widgets/header/header.jsx'; import ConfigStore from './configStore.js'; import SkyquakeComponent from 'widgets/skyquake_container/skyquakeComponent.jsx'; import 'style/layout.scss'; import './config.scss'; import {Panel, PanelWrapper} from 'widgets/panel/panel'; import TextInput from 'widgets/form_controls/textInput.jsx'; import Button from 'widgets/button/rw.button.js'; class ConfigDashboard extends React.Component { constructor(props) { super(props); this.Store = this.props.flux.stores.hasOwnProperty('ConfigStore') ? this.props.flux.stores.ConfigStore : this.props.flux.createStore(ConfigStore); this.state = this.Store.getState(); } componentWillMount() { this.Store.listen(this.updateState); this.Store.getResourceOrchestrator(); } componentWillUnmount() { this.Store.unlisten(this.updateState); } updateState = (state) => { this.setState(state); } updateAccount = (e) => { e.preventDefault(); e.stopPropagation(); this.Store.update(this.state.account); } render() { let self = this; let html; let Account = this.state.account; let AccountMeta = this.state.AccountMeta; let AccountType = this.state.accountType; let isEdit = true; let ParamsHTML = null; let Store = this.Store; let Types = this.state.AccountMeta['account-types']; let selectAccountStack = []; let selectAccountHTML = null; if (Account['account-type']) { for (var i = 0; i < Types.length; i++) { var node = Types[i]; var isSelected = (Account['account-type'] == node); selectAccountStack.push( ) } selectAccountHTML = (
{selectAccountStack}
); } if (AccountMeta[AccountType] && AccountMeta[AccountType].length > 0) { var paramsStack = []; var optionalField = ''; for (var i = 0; i < AccountMeta[AccountType].length; i++) { var node = AccountMeta[AccountType][i]; var value = "" if (Account[AccountType]) { value = Account[AccountType][node.ref] } paramsStack.push( ); } ParamsHTML = (
{paramsStack}
) } else { ParamsHTML = ( ) } html = (
* required
{ selectAccountHTML } { ParamsHTML }
); return html; } } // onClick={this.Store.update.bind(null, Account)} ConfigDashboard.contextTypes = { router: React.PropTypes.object }; export default SkyquakeComponent(ConfigDashboard);