import _ from 'lodash';
import PropTypes from 'prop-types';
import React from 'react';
import { Col, Icon, Row } from 'antd';
import { metricToFormatter, toShortResourceName } from './util/Utils.js';
import './../../css/octopus.css';
const displayName = resource => `${toShortResourceName(resource.type)}/${resource.name}`;
const getSrClassification = sr => {
if (sr < 0.9) {
return "status-poor";
} else if (sr < 0.95) {
return "status-ok";
} else {return "status-good";}
};
const Metric = ({title, value, className}) => {
return (
{title}
{value}
);
};
Metric.defaultProps = { className: "" };
Metric.propTypes = {
className: PropTypes.string,
title: PropTypes.string.isRequired,
value: PropTypes.string.isRequired
};
const ArrowCol = ({showArrow}) =>
{!showArrow ? " " : };
ArrowCol.propTypes = PropTypes.bool.isRequired;
export default class Octopus extends React.Component {
static defaultProps = {
neighbors: {},
resource: {}
}
static propTypes = {
neighbors: PropTypes.shape({}),
resource: PropTypes.shape({})
}
renderResourceSummary(resource, cn) {
return (
);
}
render() {
let { resource, neighbors } = this.props;
let hasUpstreams = _.size(neighbors.upstream) > 0;
let hasDownstreams = _.size(neighbors.downstream) > 0;
return (
{_.map(neighbors.upstream, n => this.renderResourceSummary(n, "neighbor"))}
{this.renderResourceSummary(resource, "main")}
{_.map(neighbors.downstream, n => this.renderResourceSummary(n, "neighbor"))}
);
}
}