diff --git a/src/ic/ic-dialog.js b/src/ic/ic-dialog.js new file mode 100644 index 0000000..b134f95 --- /dev/null +++ b/src/ic/ic-dialog.js @@ -0,0 +1,45 @@ +import React from 'react'; +import {FormLabel} from 'react-bootstrap'; +import Dialog from '../common/dialogs/dialog'; + + +class ICDialog extends React.Component { + valid = true; + + constructor(props) { + super(props); + + this.state = { + ic: props.ic + }; + } + + onClose(canceled) { + this.props.onClose(); + } + + handleChange(e) { + + } + + + render() { + + return ( + this.onClose(c)} + valid={true} + size='lg' + > +
+ Infos and Controls +
+
+ ); + } +} + +export default ICDialog; diff --git a/src/ic/ics.js b/src/ic/ics.js index 7bbb08d..138852f 100644 --- a/src/ic/ics.js +++ b/src/ic/ics.js @@ -17,7 +17,7 @@ import React, { Component } from 'react'; import { Container } from 'flux/utils'; -import { Button } from 'react-bootstrap'; +import { Button, Badge } from 'react-bootstrap'; import FileSaver from 'file-saver'; import _ from 'lodash'; import moment from 'moment' @@ -31,6 +31,7 @@ import TableColumn from '../common/table-column'; import NewICDialog from './new-ic'; import EditICDialog from './edit-ic'; import ImportICDialog from './import-ic'; +import ICDialog from './ic-dialog'; import ICAction from './ic-action'; import DeleteDialog from '../common/dialogs/delete-dialog'; @@ -78,6 +79,7 @@ class InfrastructureComponents extends Component { ics: ics, modalIC: {}, deleteModal: false, + icModal: false, selectedICs: [], currentUser: JSON.parse(localStorage.getItem("currentUser")) }; @@ -99,7 +101,7 @@ class InfrastructureComponents extends Component { refresh() { - if (this.state.editModal || this.state.deleteModal){ + if (this.state.editModal || this.state.deleteModal || this.state.icModal){ // do nothing since a dialog is open at the moment } else { @@ -139,6 +141,10 @@ class InfrastructureComponents extends Component { } } + closeICModal(data){ + this.setState({ icModal : false }); + } + closeDeleteModal(confirmDelete){ this.setState({ deleteModal: false }); @@ -200,7 +206,7 @@ class InfrastructureComponents extends Component { this.setState({ selectedICs: selectedICs }); } - runAction = action => { + runAction(action) { for (let index of this.state.selectedICs) { AppDispatcher.dispatch({ type: 'ics/start-action', @@ -291,6 +297,35 @@ class InfrastructureComponents extends Component { return dateTime.toLocaleString('de-DE'); } + modifyManagedExternallyColumn(managedExternally){ + + if(managedExternally){ + return + } else { + return + } + + } + + modifyUptimeColumn(uptime){ + if(uptime >= 0){ + return {uptime + "s"} + } + else{ + return Unknown + } + } + + modifyNameColumn(name){ + let ic = this.state.ics.find(ic => ic.name === name); + let index = this.state.ics.indexOf(ic); + if(ic.type === "villas-node" || ic.type === "villas-relay"){ + return } + else{ + return {name} + } + } + render() { const buttonStyle = { marginLeft: '10px' @@ -302,13 +337,16 @@ class InfrastructureComponents extends Component { this.onICChecked(index, event)} width='30' /> - + this.modifyNameColumn(name)}/> this.stateLabelStyle(state, component)} /> - + this.modifyManagedExternallyColumn(managedexternally)} width='105' /> + this.modifyUptimeColumn(uptime)}/> + {/* */} - + + this.stateUpdateModifier(stateUpdateAt)} /> {this.state.currentUser.role === "Admin" ? this.runAction(action)} actions={[ { id: '-1', title: 'Select command', data: { action: 'none' } }, { id: '0', title: 'Reset', data: { action: 'reset' } }, @@ -358,6 +396,7 @@ class InfrastructureComponents extends Component { this.closeNewModal(data)} /> this.closeEditModal(data)} ic={this.state.modalIC} /> this.closeImportModal(data)} /> + this.closeICModal(data)} ic={this.state.modalIC} token={this.state.sessionToken} /> this.closeDeleteModal(e)} />