X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FUI.git;a=blobdiff_plain;f=skyquake%2Fplugins%2Fredundancy%2Fsrc%2Fdashboard%2Fstatus.jsx;fp=skyquake%2Fplugins%2Fredundancy%2Fsrc%2Fdashboard%2Fstatus.jsx;h=fbbd8bda984616171129388b0b30eb05e697f6b4;hp=0000000000000000000000000000000000000000;hb=03156e335275de1dafbc2a816e98006afdf249bf;hpb=f2dc2462571800e62cba969964de621dca09299c diff --git a/skyquake/plugins/redundancy/src/dashboard/status.jsx b/skyquake/plugins/redundancy/src/dashboard/status.jsx new file mode 100644 index 000000000..fbbd8bda9 --- /dev/null +++ b/skyquake/plugins/redundancy/src/dashboard/status.jsx @@ -0,0 +1,198 @@ +/* + * STANDARD_RIFT_IO_COPYRIGHT + */ + +import React from 'react'; +import ReactDOM from 'react-dom'; +import AppHeader from 'widgets/header/header.jsx'; +import RedundancyStore from './redundancyStore.js'; +import SkyquakeComponent from 'widgets/skyquake_container/skyquakeComponent.jsx'; +import SkyquakeRBAC from 'widgets/skyquake_rbac/skyquakeRBAC.jsx'; +import 'style/layout.scss'; +import {Panel, PanelWrapper} from 'widgets/panel/panel'; +import {InputCollection, FormSection} from 'widgets/form_controls/formControls.jsx'; + +import TextInput from 'widgets/form_controls/textInput.jsx'; +import Input from 'widgets/form_controls/input.jsx'; +import Button, {ButtonGroup} from 'widgets/button/sq-button.jsx'; +import SelectOption from 'widgets/form_controls/selectOption.jsx'; +import 'widgets/form_controls/formControls.scss'; +import imgAdd from '../../node_modules/open-iconic/svg/plus.svg' +import imgRemove from '../../node_modules/open-iconic/svg/trash.svg' +import _ from 'lodash'; +import ROLES from 'utils/roleConstants.js'; + +import './redundancy.scss'; +const PROJECT_ROLES = ROLES.PROJECT; +const PLATFORM = ROLES.PLATFORM; + +class StatusDashboard extends React.Component { + constructor(props) { + super(props); + this.Store = this.props.flux.stores.hasOwnProperty('RedundancyStore') ? this.props.flux.stores.RedundancyStore : this.props.flux.createStore(RedundancyStore, 'RedundancyStore'); + this.state = this.Store.getState(); + this.actions = this.state.actions; + } + componentDidUpdate() { + } + componentWillMount() { + this.state = this.Store.getState(); + this.Store.getRedundancy(); + this.Store.openRedundancyStateSocket(); + this.Store.listen(this.updateState); + } + componentWillUnmount() { + this.Store.unlisten(this.updateState); + this.Store.closeSocket(); + } + updateState = (state) => { + this.setState(state); + } + render() { + let self = this; + let html; + let props = this.props; + let state = this.state; + let STATUS = state.status; + /* + + { + "active-instance": { + "active-inst-id": "10.64.210.20", + "is-this-instance-active": "true", + "site-name": "site20" + }, + "vm-identity": "ebbd6444-d6a7-4eda-ab0d-e23fdbcdeffe", + "health-status": [ + { + "state": "RUNNING_AS_ACTIVE", + "rwinstance-id": "10.64.210.20", + "site-name": "site20" + }, + { + "state": "NO_RESPONSE", + "rwinstance-id": "10.64.210.33", + "site-name": "site33" + } + ] + } + + + */ + + html = ( + + + + + + + + + +
+
+ SITE NAME +
+
+ INSTANCE IP +
+
+ CURRENT STATE +
+
+ PREVIOUS STATE +
+
+ CONFIG GENERATION # +
+
+ LAST PACKAGE UPDATE +
+
+ { + STATUS['config-state'] && STATUS['config-state'].map((u, k) => { + return ( +
+
+ {u['site-name'] || '--'} +
+
+ {u['rwinstance-ip'] || '--'} +
+
+ {u['current-state'] || '--'} +
+
+ {u['previous-state'] || '--'} +
+
+ {u['config-generation-number'] || '--'} +
+
+ {u['last-package-update'] || '--'} +
+ + +
+ ) + }) + } + + +
+ +
+
+ RW INSTANCE +
+
+ STATUS +
+
+ {STATUS['health-status'] && STATUS['health-status'].map((u, k) => { + return ( +
+
+ {u['rwinstance-id'] || '--'} +
+
+ {u['state'] || '--'} +
+ + +
+ ) + })} + + +
+
+
+ ); + return html; + } +} +// onClick={this.Store.update.bind(null, Account)} +StatusDashboard.contextTypes = { + router: React.PropTypes.object, + userProfile: React.PropTypes.object +}; + +StatusDashboard.defaultProps = { + siteList: [], + selectedSite: {} +} + +export default SkyquakeComponent(StatusDashboard);