import React, { Component } from 'react'; import { Link } from 'react-router'; import { Grid, Cell } from 'react-mdl'; class ShowStrategyComponent extends Component { constructor (props) { super(props); this.state = { applications: [] }; } componentDidMount () { if (!this.props.strategy) { this.props.fetchStrategies(); }; this.props.getApplications() .then(res => this.setState({ applications: res.applications })); } renderParameters (parametersTemplate) { if (parametersTemplate) { return Object.keys(parametersTemplate).map((name, i) => (
  • {name} ({parametersTemplate[name]})
  • )); } else { return
  • (no params)
  • ; } } render () { if (!this.props.strategy) { return null; } const { name, description, parametersTemplate = {}, } = this.props.strategy; return (

    {name}

    {description}

    Parameters
      {this.renderParameters(parametersTemplate)}
    Applications using this strategy
      {this.state.applications.map(({ appName }, i) => (
    1. {appName}
    2. ))}
    ); } } export default ShowStrategyComponent;