The api prop is optional and not used with TrafficSplit.
Fixes
@@ -100,10 +100,11 @@ class Octopus extends React.Component {
}
linkedResourceTitle = (resource, display) => {
- const { api: { ResourceLink } } = this.props;
// trafficsplit leaf resources cannot be linked
- return _isNil(resource.namespace) || resource.isLeafService ? display :
- <ResourceLink resource={resource} linkText={display} />;
+ if (_isNil(resource.namespace) || resource.isLeafService) { return display; }
+
+ const { api: { ResourceLink } } = this.props;
+ return <ResourceLink resource={resource} linkText={display} />;
}
renderResourceCard(resource, type, index, isOutbound) {
@@ -355,14 +356,15 @@ class Octopus extends React.Component {
Octopus.propTypes = {
api: PropTypes.shape({
- ResourceLink: PropTypes.func.isRequired,
- }).isRequired,
+ ResourceLink: PropTypes.element,
+ }),
neighbors: PropTypes.shape({}),
resource: PropTypes.shape({}),
unmeshedSources: PropTypes.arrayOf(PropTypes.shape({})),
};
Octopus.defaultProps = {
+ api: null,
neighbors: {},
resource: {},
unmeshedSources: [],
