const _ = require('lodash'); const React = require('react'); const NodeDetailsControls = require('./node-details-controls'); const NodeDetailsTable = require('./node-details-table'); const NodeColorMixin = require('../mixins/node-color-mixin'); const TitleUtils = require('../utils/title-utils'); const NodeDetails = React.createClass({ mixins: [ NodeColorMixin ], componentDidMount: function() { this.updateTitle(); }, componentWillUnmount: function() { TitleUtils.resetTitle(); }, renderLoading: function() { return (
); }, renderNotAvailable: function() { return (

n/a

{this.props.nodeId}

This node is not visible to Scope anymore. The node will re-appear if it communicates again.

); }, render: function() { const details = this.props.details; const nodeExists = this.props.nodes && this.props.nodes.has(this.props.nodeId); if (!nodeExists) { return this.renderNotAvailable(); } if (!details) { return this.renderLoading(); } const nodeColor = this.getNodeColorDark(details.label_major); const styles = { controls: { 'backgroundColor': this.brightenColor(nodeColor) }, header: { 'backgroundColor': nodeColor } }; return (

{details.label_major}

{details.label_minor}
{details.controls && details.controls.length > 0 &&
}
{details.tables.map(function(table) { const key = _.snakeCase(table.title); return ; })}
); }, componentDidUpdate: function() { this.updateTitle(); }, updateTitle: function() { TitleUtils.setTitle(this.props.details && this.props.details.label_major); } }); module.exports = NodeDetails;