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

View File

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