import React from 'react';
import Cluster from './Cluster.jsx';
export default class Server extends React.Component {
render() {
let server = this.props.server;
if (!server) {
return (
);
}
let clusters = this.props.clusters;
let clustersWithProblems = this.props.clusters.filter(i => i.error !== undefined || i.result.connectedCount < 6 || i.result.unavailableCount > 10);
let statusColor = 'success';
if (clustersWithProblems.length >= 5) {
statusColor = 'danger';
} else if (clustersWithProblems.length > 0) {
statusColor = 'warning';
}
let gridClusters = clusters.map(cluster => );
return (
Server: {server}
{clustersWithProblems.length} / {clusters.length} clusters have problems.
{gridClusters}
);
}
}