From 659b668814960b9a590a17d8306ac347eea817e0 Mon Sep 17 00:00:00 2001 From: sveisvei Date: Sat, 10 Dec 2016 14:01:01 +0100 Subject: [PATCH] cleanup log --- .../component/history/history-item-diff.jsx | 58 +++---------------- .../history/history-list-component.jsx | 4 +- 2 files changed, 10 insertions(+), 52 deletions(-) diff --git a/frontend/src/component/history/history-item-diff.jsx b/frontend/src/component/history/history-item-diff.jsx index 2471dc8367..73198f683e 100644 --- a/frontend/src/component/history/history-item-diff.jsx +++ b/frontend/src/component/history/history-item-diff.jsx @@ -17,16 +17,6 @@ const KLASSES = { N: style.positive, // added }; -export function getIcon (type) { - switch (type) { - case 'feature-updated': return 'autorenew'; - case 'feature-created': return 'add'; - case 'feature-deleted': return 'remove'; - case 'feature-archived': return 'archived'; - default: return 'star'; - } -} - function buildItemDiff (diff, key) { let change; if (diff.lhs !== undefined) { @@ -77,52 +67,20 @@ class HistoryItem extends PureComponent { }; } - renderEventDiff (logEntry) { + render () { + const entry = this.props.entry; let changes; - if (logEntry.diffs) { - changes = logEntry.diffs.map(buildDiff); + if (entry.diffs) { + changes = entry.diffs.map(buildDiff); } else { // Just show the data if there is no diff yet. - changes =
{JSON.stringify(logEntry.data, null, 2)}
; + changes =
{JSON.stringify(entry.data, null, 2)}
; } - return {changes.length === 0 ? '(no changes)' : changes}; - } - - render () { - const { - createdBy, - id, - type, - } = this.props.entry; - - const createdAt = (new Date(this.props.entry.createdAt)).toLocaleString('nb-NO'); - const icon = getIcon(type); - - const data = this.renderEventDiff(this.props.entry); - - return data; - - return ( -
-
-
Id:
-
{id}
-
Type:
-
- - {type} -
-
Timestamp:
-
{createdAt}
-
Username:
-
{createdBy}
-
Diff
-
{data}
-
-
- ); + return (
+            {changes.length === 0 ? '(no changes)' : changes}
+        
); } } diff --git a/frontend/src/component/history/history-list-component.jsx b/frontend/src/component/history/history-list-component.jsx index 565aed7181..f3cd3c93cc 100644 --- a/frontend/src/component/history/history-list-component.jsx +++ b/frontend/src/component/history/history-list-component.jsx @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import HistoryItemDiff from './history-item-diff'; import HistoryItemJson from './history-item-json'; -import { Switch, Table, TableHeader, Grid, Cell } from 'react-mdl'; +import { Table, TableHeader, Icon } from 'react-mdl'; import { HeaderTitle, SwitchWithLabel } from '../common'; import style from './history.scss'; @@ -36,7 +36,7 @@ class HistoryList extends Component { Type User Diff - Time + (new Date(v)).toLocaleString('nb-NO')}>Time ); }