2 * STANDARD_RIFT_IO_COPYRIGHT
5 import React from 'react';
6 import ReactDOM from 'react-dom';
7 import AppHeader from 'widgets/header/header.jsx';
8 import RedundancyStore from './redundancyStore.js';
9 import SkyquakeComponent from 'widgets/skyquake_container/skyquakeComponent.jsx';
10 import SkyquakeRBAC from 'widgets/skyquake_rbac/skyquakeRBAC.jsx';
11 import 'style/layout.scss';
12 import {Panel, PanelWrapper} from 'widgets/panel/panel';
13 import {InputCollection, FormSection} from 'widgets/form_controls/formControls.jsx';
15 import TextInput from 'widgets/form_controls/textInput.jsx';
16 import Input from 'widgets/form_controls/input.jsx';
17 import Button, {ButtonGroup} from 'widgets/button/sq-button.jsx';
18 import SelectOption from 'widgets/form_controls/selectOption.jsx';
19 import 'widgets/form_controls/formControls.scss';
20 import imgAdd from '../../node_modules/open-iconic/svg/plus.svg'
21 import imgRemove from '../../node_modules/open-iconic/svg/trash.svg'
22 import _ from 'lodash';
23 import ROLES from 'utils/roleConstants.js';
25 import './redundancy.scss';
26 const PROJECT_ROLES = ROLES.PROJECT;
27 const PLATFORM = ROLES.PLATFORM;
29 class StatusDashboard extends React.Component {
32 this.Store = this.props.flux.stores.hasOwnProperty('RedundancyStore') ? this.props.flux.stores.RedundancyStore : this.props.flux.createStore(RedundancyStore, 'RedundancyStore');
33 this.state = this.Store.getState();
34 this.actions = this.state.actions;
36 componentDidUpdate() {
38 componentWillMount() {
39 this.state = this.Store.getState();
40 this.Store.getRedundancy();
41 this.Store.openRedundancyStateSocket();
42 this.Store.listen(this.updateState);
44 componentWillUnmount() {
45 this.Store.unlisten(this.updateState);
46 this.Store.closeSocket();
48 updateState = (state) => {
54 let props = this.props;
55 let state = this.state;
56 let STATUS = state.status;
61 "active-inst-id": "10.64.210.20",
62 "is-this-instance-active": "true",
65 "vm-identity": "ebbd6444-d6a7-4eda-ab0d-e23fdbcdeffe",
68 "state": "RUNNING_AS_ACTIVE",
69 "rwinstance-id": "10.64.210.20",
73 "state": "NO_RESPONSE",
74 "rwinstance-id": "10.64.210.33",
84 <PanelWrapper onKeyUp={this.evaluateSubmit}
85 className={`SiteAdmin column`} column>
86 <AppHeader nav={[{ name: 'SITES', onClick: this.context.router.push.bind(this, { pathname: '/sites' }) }, { name: 'CONFIG', onClick: this.context.router.push.bind(this, { pathname: '/config' })}, { name: 'STATUS' }]} />
87 <PanelWrapper onKeyUp={this.evaluateSubmit}
88 className={`SiteAdmin column`} style={{overflow: 'auto'}} column>
90 title="Active Instance"
91 style={{flex: '0 0 300px'}}
93 <TextInput type="text" label="VM ID" readonly={true} value={STATUS['vm-identity'] } />
94 <TextInput type="text" label="active instance ID" readonly={true} value={STATUS['active-instance'] && STATUS['active-instance']['active-inst-id'] } />
95 <TextInput type="text" label="Site Name" readonly={true} value={STATUS['active-instance'] && STATUS['active-instance']['site-name'] } />
98 title="CONFIGURATION STATE"
99 style={{flex: '0 0 250px'}}
101 <div className="tableRow tableRow--header">
122 STATUS['config-state'] && STATUS['config-state'].map((u, k) => {
124 <div className={`tableRow tableRow--data`} key={k}>
126 {u['site-name'] || '--'}
129 {u['rwinstance-ip'] || '--'}
132 {u['current-state'] || '--'}
135 {u['previous-state'] || '--'}
138 {u['config-generation-number'] || '--'}
141 {u['last-package-update'] || '--'}
153 title="HEALTH STATUS"
154 style={{flex: '0 0 250px'}}
156 <div className="tableRow tableRow--header">
164 {STATUS['health-status'] && STATUS['health-status'].map((u, k) => {
166 <div className={`tableRow tableRow--data`} key={k}>
168 {u['rwinstance-id'] || '--'}
187 // onClick={this.Store.update.bind(null, Account)}
188 StatusDashboard.contextTypes = {
189 router: React.PropTypes.object,
190 userProfile: React.PropTypes.object
193 StatusDashboard.defaultProps = {
198 export default SkyquakeComponent(StatusDashboard);