1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-20 00:08:02 +01:00

Link to strategy from applications page

This commit is contained in:
ivaosthu 2016-12-05 16:01:09 +01:00
parent 23bf4cb1fb
commit ef969ffff4
3 changed files with 21 additions and 7 deletions

View File

@ -1,15 +1,15 @@
import React, { Component } from 'react'; import React, { PureComponent } from 'react';
import { Link } from 'react-router'; import { Link } from 'react-router';
import { Grid, Cell } from 'react-mdl'; import { Grid, Cell } from 'react-mdl';
class ClientStrategies extends Component { class ClientStrategies extends PureComponent {
componentDidMount () { componentDidMount () {
this.props.fetchApplication(this.props.appName); this.props.fetchApplication(this.props.appName);
} }
render () { render () {
if (!this.props.application) { if (!this.props.application) {
return <div>Loading application info...</div>; return <div>Loading application info...</div>;
} }
@ -19,11 +19,10 @@ class ClientStrategies extends Component {
strategies, strategies,
seenToggles, seenToggles,
} = this.props.application; } = this.props.application;
return ( return (
<div> <div>
<h5>{appName}</h5> <h5>{appName}</h5>
<Grid> <Grid>
<Cell col={4}> <Cell col={4}>
<h6>Instances</h6> <h6>Instances</h6>
@ -32,9 +31,15 @@ class ClientStrategies extends Component {
</ol> </ol>
</Cell> </Cell>
<Cell col={4}> <Cell col={4}>
<h6>Strategies</h6> <h6>Implemented strategies</h6>
<ol className="demo-list-item mdl-list"> <ol className="demo-list-item mdl-list">
{/*strategies.map((name, i) => <li className="mdl-list__item" key={i}>{name}</li>)*/} {strategies.map((name, i) => (
<li className="mdl-list__item" key={`${name}-${i}`}>
<Link to={`/strategies/view/${name}`}>
{name}
</Link>
</li>
))}
</ol> </ol>
</Cell> </Cell>
<Cell col={4}> <Cell col={4}>

View File

@ -13,6 +13,7 @@ import Features from './page/features';
import CreateFeatureToggle from './page/features/create'; import CreateFeatureToggle from './page/features/create';
import EditFeatureToggle from './page/features/edit'; import EditFeatureToggle from './page/features/edit';
import Strategies from './page/strategies'; import Strategies from './page/strategies';
import StrategyView from './page/strategies/show';
import CreateStrategies from './page/strategies/create'; import CreateStrategies from './page/strategies/create';
import HistoryPage from './page/history'; import HistoryPage from './page/history';
import HistoryTogglePage from './page/history/toggle'; import HistoryTogglePage from './page/history/toggle';
@ -38,6 +39,7 @@ ReactDOM.render(
<Route pageTitle="Features" path="/features/edit/:name" component={EditFeatureToggle} /> <Route pageTitle="Features" path="/features/edit/:name" component={EditFeatureToggle} />
<Route pageTitle="Strategies" path="/strategies" component={Strategies} /> <Route pageTitle="Strategies" path="/strategies" component={Strategies} />
<Route pageTitle="Strategies" path="/strategies/create" component={CreateStrategies} /> <Route pageTitle="Strategies" path="/strategies/create" component={CreateStrategies} />
<Route pageTitle="Strategies" path="/strategies/view/:strategyName" component={StrategyView} />
<Route pageTitle="History" path="/history" component={HistoryPage} /> <Route pageTitle="History" path="/history" component={HistoryPage} />
<Route pageTitle="History" path="/history/:toggleName" component={HistoryTogglePage} /> <Route pageTitle="History" path="/history/:toggleName" component={HistoryTogglePage} />
<Route pageTitle="Archive" path="/archive" component={Archive} /> <Route pageTitle="Archive" path="/archive" component={Archive} />

View File

@ -0,0 +1,7 @@
import React from 'react';
const render = ({ params }) => (
<div>Show details of strategy: {params.strategyName} (applications implementing it, toggles using it etc)!</div>
);
export default render;