/* * * Copyright 2016 RIFT.IO Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ import React from 'react'; import './accountSidebar.scss'; import DashboardCard from 'widgets/dashboard_card/dashboard_card.jsx'; import AccountStore from '../account/accountStore.js'; import { Link } from 'react-router'; import SkyquakeComponent from 'widgets/skyquake_container/skyquakeComponent.jsx'; import Button from 'widgets/button/rw.button' class AccountSidebar extends React.Component{ constructor(props) { super(props); // this.props.store = this.props.flux.props.stores.hasOwnProperty('AccountStore') ? this.props.flux.props.stores.AccountStore : this.props.flux.createStore(AccountStore); var self = this; // this.props = this.props.store.getState(); } listenerHandler = (state) => { this.setState(state); } componentWillMount() { // this.props.store.listen(this.listenerHandler); // this.props.store.openAccountsSocket(); } componentWillUnmount() { // this.props.store.closeSocket(); // this.props.store.unlisten(this.listenerHandler); } render() { let html; let self = this; let {store, ...props} = this.props; //[this.props.cloud,this.props.sdn,this.props['config-agent']] let AccountData = [ { type: 'cloud', data: this.props.cloud }, { type: 'sdn', data: this.props.sdn }, { type: 'config-agent', data: this.props['config-agent'] }, { type: 'resource-orchestrator', data: this.props['resource-orchestrator'] } ]; let refreshStatus = (
Check All Connectivity Status
) let resourceOrchestrators = (this.props['resource-orchestrator'].length > 0) ? this.props['resource-orchestrator'].map(function(orchestrator, index) { let status = null; if (orchestrator) { if (orchestrator['connection-status']) { status = orchestrator['connection-status'].status; } return (

{orchestrator.name}

); } }) : null; let cloudAccounts = (this.props.cloud.length > 0) ? this.props.cloud.map(function(account, index) { let status = null; if (account) { if (account['connection-status']) { status = account['connection-status'].status; } return (

{account.name}

); } }) : null; let sdnAccounts = (this.props.sdn && this.props.sdn.length > 0) ? this.props.sdn.map(function(account, index) { let status = null; if (account['connection-status']) { status = account['connection-status'].status; } return (

{account.name}

) }) : null; let configAgentAccounts = (this.props['config-agent'].length > 0) ? this.props['config-agent'].map(function(account, index) { let status = null; if (account['connection-status']) { status = account['connection-status'].status; } return (

{account.name}

) }) : null; html = (
{ self.props.readonly ? null :
); return html; } } AccountSidebar.defaultProps = { cloud: [], sdn: [], 'config-agent': [], ro: [] } export class AccountConnectivityStatus extends React.Component { render(){ return } } AccountConnectivityStatus.defaultProps = { status: 'failed' } export default SkyquakeComponent(AccountSidebar);