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

add list and icon

This commit is contained in:
sveisvei 2016-12-05 18:43:00 +01:00
parent f377fc6f5e
commit 672635a185
2 changed files with 11 additions and 6 deletions

View File

@ -1,5 +1,5 @@
import React, { PropTypes } from 'react'; import React, { PropTypes } from 'react';
import { Grid, Cell, Icon, Switch } from 'react-mdl'; import { Grid, Cell, Icon, Switch, List, ListItem, ListItemContent } from 'react-mdl';
import { Link } from 'react-router'; import { Link } from 'react-router';
import percentLib from 'percent'; import percentLib from 'percent';
@ -10,6 +10,7 @@ import EditFeatureToggle from './form-edit-container.jsx';
import { fetchFeatureToggles, toggleFeature } from '../../store/feature-actions'; import { fetchFeatureToggles, toggleFeature } from '../../store/feature-actions';
import { fetchFeatureMetrics, fetchSeenApps } from '../../store/feature-metrics-actions'; import { fetchFeatureMetrics, fetchSeenApps } from '../../store/feature-metrics-actions';
import { fetchHistoryForToggle } from '../../store/history-actions'; import { fetchHistoryForToggle } from '../../store/history-actions';
import { getIcon } from '../history/history-item-diff';
class EditFeatureToggleWrapper extends React.Component { class EditFeatureToggleWrapper extends React.Component {
@ -113,10 +114,14 @@ class EditFeatureToggleWrapper extends React.Component {
</Cell> </Cell>
<Cell col={3}> <Cell col={3}>
<div><strong>History</strong></div> <div><strong>History</strong></div>
<ol> <List style={{ textAlign: 'left' }}>
{history.map(({ createdAt, type, createdBy }) => {history.map(({ createdAt, type, createdBy }) =>
<li><small>{createdAt}</small> {type} {createdBy}</li>)} <ListItem twoLine>
</ol> <ListItemContent avatar={getIcon(type)} subtitle={createdAt}>
{createdBy}
</ListItemContent>
</ListItem>)}
</List>
<Link to={`/history/${featureToggleName}`}> <Link to={`/history/${featureToggleName}`}>
See all events. See all events.
</Link> </Link>
@ -157,7 +162,7 @@ function getHistoryFromToggle (state, toggleName) {
.slice(0, 5) .slice(0, 5)
.toJS() .toJS()
.map(({ createdAt, createdBy, type }) => ({ .map(({ createdAt, createdBy, type }) => ({
createdAt: new Date(createdAt).toString(), createdAt: new Date(createdAt).toLocaleString('nb-NO'),
createdBy, createdBy,
type, type,
})); }));

View File

@ -17,7 +17,7 @@ const SPADEN_CLASS = {
N: style.positive, // added N: style.positive, // added
}; };
function getIcon (type) { export function getIcon (type) {
switch (type) { switch (type) {
case 'feature-updated': return 'autorenew'; case 'feature-updated': return 'autorenew';
case 'feature-created': return 'add'; case 'feature-created': return 'add';