X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=skyquake%2Fplugins%2Fconfig%2Fsrc%2Fdashboard%2Fdashboard.jsx;fp=skyquake%2Fplugins%2Fconfig%2Fsrc%2Fdashboard%2Fdashboard.jsx;h=b8a743fc43542cfafbd068a149a8d8247016feef;hb=dfe972ff7c9f7b6b1d730e66b0b2aa8df2ce329b;hp=0000000000000000000000000000000000000000;hpb=e8b63f1993b397787576bdd884366a6640a5adea;p=osm%2FUI.git diff --git a/skyquake/plugins/config/src/dashboard/dashboard.jsx b/skyquake/plugins/config/src/dashboard/dashboard.jsx new file mode 100644 index 000000000..b8a743fc4 --- /dev/null +++ b/skyquake/plugins/config/src/dashboard/dashboard.jsx @@ -0,0 +1,140 @@ +/* + * 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);