2 * STANDARD_RIFT_IO_COPYRIGHT
5 import AppHeader from 'widgets/header/header.jsx';
6 import ConfigAgentAccount from './configAgentAccount.jsx';
7 import ConfigAgentAccountStore from './configAgentAccountStore';
8 import AccountSidebar from '../account_sidebar/accountSidebar.jsx';
9 import React from 'react';
10 import '../launchpad_cloud_account/cloud-account.css';
11 export default class LaunchpadConfigAgentAccount extends React.Component {
14 this.configName = this.props.routeParams.name;
15 this.state = ConfigAgentAccountStore.getState();
16 ConfigAgentAccountStore.getCatalog();
17 ConfigAgentAccountStore.listen(this.updateState);
18 if(this.configName && this.configName != 'create') {
19 ConfigAgentAccountStore.getConfigAgentAccount(this.configName)
20 this.state.isEdit = true;
22 this.state.isLoading = false;
23 this.state.isEdit = false;
26 componentWillReceiveProps(props) {
27 let cn = props.routeParams.name;
28 if(cn && (cn != 'create')) {
30 ConfigAgentAccountStore.getConfigAgentAccount(this.configName);
31 this.setState({isEdit: true});
33 ConfigAgentAccountStore.resetAccount();
34 this.setState({isEdit: false});
37 componentWillMount() {
38 ConfigAgentAccountStore.resetAccount();
40 componentWillUnmount() {
41 ConfigAgentAccountStore.unlisten(this.updateState);
43 updateState = (state) => {
49 let title = "Launchpad: Add Config Agent Account";
50 if (this.props.edit) {
51 title = "Launchpad: Edit Config Agent Account";
53 if (this.props.isDashboard) {
54 body = (<div>Edit or Create a New Accounts</div>);
56 body = <ConfigAgentAccount {...this.props} edit={this.state.isEdit} />
59 <AppHeader title={title} isLoading={this.state.isLoading} />
60 <div className="flex">