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

remove code

This commit is contained in:
ivaosthu 2016-12-03 15:18:50 +01:00
parent e2fdacd997
commit d7901a2790

View File

@ -1,75 +1,7 @@
import React, { PropTypes, PureComponent } from 'react';
import FontIcon from 'react-toolbox/lib/font_icon';
import style from './history.scss';
const DIFF_PREFIXES = {
A: ' ',
E: ' ',
D: '-',
N: '+',
};
const SPADEN_CLASS = {
A: style.blue, // array edited
E: style.blue, // edited
D: style.negative, // deleted
N: style.positive, // added
};
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) {
change = (
<div>
<div className={SPADEN_CLASS.D}>- {key}: {JSON.stringify(diff.lhs)}</div>
</div>
);
} else if (diff.rhs !== undefined) {
change = (
<div>
<div className={SPADEN_CLASS.N}>+ {key}: {JSON.stringify(diff.rhs)}</div>
</div>
);
}
return change;
}
function buildDiff (diff, idx) {
let change;
const key = diff.path.join('.');
if (diff.item) {
change = buildItemDiff(diff.item, key);
} else if (diff.lhs !== undefined && diff.rhs !== undefined) {
change = (
<div>
<div className={SPADEN_CLASS.D}>- {key}: {JSON.stringify(diff.lhs)}</div>
<div className={SPADEN_CLASS.N}>+ {key}: {JSON.stringify(diff.rhs)}</div>
</div>
);
} else {
const spadenClass = SPADEN_CLASS[diff.kind];
const prefix = DIFF_PREFIXES[diff.kind];
change = (<div className={spadenClass}>{prefix} {key}: {JSON.stringify(diff.rhs || diff.item)}</div>);
}
return (<div key={idx}>{change}</div>);
}
class HistoryItem extends PureComponent {
static propTypes () {
@ -79,10 +11,6 @@ class HistoryItem extends PureComponent {
}
render () {
const { type } = this.props.entry;
const icon = getIcon(type);
const localEventData = JSON.parse(JSON.stringify(this.props.entry));
delete localEventData.description;
delete localEventData.name;