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

fix: clean up history view a bit

This commit is contained in:
Ivar Conradi Østhus 2020-02-29 10:30:13 +01:00
parent d70d3ab978
commit 509b3a6186
2 changed files with 38 additions and 31 deletions

View File

@ -8,6 +8,27 @@ import { formatFullDateTimeWithLocale } from '../common/util';
import styles from './history.scss'; import styles from './history.scss';
const HistoryMeta = ({ entry, timeFormatted }) => (
<div>
<dl>
<dt>Changed at:</dt>
<dd>{timeFormatted}</dd>
<dt>Changed by: </dt>
<dd title={entry.createdBy}>{entry.createdBy}</dd>
<dt>Type: </dt>
<dd>{entry.type}</dd>
<dt>Name: </dt>
<dd>{entry.data.name}</dd>
</dl>
<strong>Change</strong>
<HistoryItemDiff entry={entry} />
</div>
);
HistoryMeta.propTypes = {
entry: PropTypes.object.isRequired,
timeFormatted: PropTypes.string.isRequired,
};
class HistoryList extends Component { class HistoryList extends Component {
static propTypes = { static propTypes = {
title: PropTypes.string, title: PropTypes.string,
@ -26,7 +47,7 @@ class HistoryList extends Component {
} }
render() { render() {
const showData = this.props.settings.showData; const showData = this.props.settings.showData;
const { history, hideName } = this.props; const { history } = this.props;
if (!history || history.length < 0) { if (!history || history.length < 0) {
return null; return null;
} }
@ -35,7 +56,6 @@ class HistoryList extends Component {
<span <span
className={commonStyles.truncate} className={commonStyles.truncate}
style={{ display: 'inline-block', verticalAlign: 'middle', width: '100%' }} style={{ display: 'inline-block', verticalAlign: 'middle', width: '100%' }}
title={v}
> >
{v} {v}
</span> </span>
@ -48,40 +68,24 @@ class HistoryList extends Component {
} else { } else {
entries = ( entries = (
<Table <Table
sortable
rows={history.map(entry => rows={history.map(entry =>
Object.assign( Object.assign(
{ {
diff: <HistoryItemDiff entry={entry} />, meta: (
name: entry.data.name, <HistoryMeta
entry={entry}
timeFormatted={this.formatFulldateTime(entry.createdAt)}
/>
),
}, },
entry entry
) )
)} )}
className={commonStyles.fullwidth} className={commonStyles.fullwidth}
style={{ border: 0, tableLayout: 'fixed', minWidth: '840px' }} style={{ border: 0, tableLayout: 'fixed' }}
> >
<TableHeader name="type" cellFormatter={truncateTableCell} style={{ width: '115px' }}> <TableHeader name="meta" cellFormatter={truncateTableCell}>
Type Change
</TableHeader>
<TableHeader name="createdBy" cellFormatter={truncateTableCell} style={{ width: '115px' }}>
User
</TableHeader>
{hideName ? (
[]
) : (
<TableHeader name="name" cellFormatter={truncateTableCell} style={{ width: '153px' }}>
Feature Toggle
</TableHeader>
)}
<TableHeader name="diff">Diff</TableHeader>
<TableHeader
numeric
name="createdAt"
cellFormatter={this.formatFulldateTime.bind(this)}
style={{ width: '165px' }}
>
Time
</TableHeader> </TableHeader>
</Table> </Table>
); );

View File

@ -33,22 +33,25 @@
dl { dl {
padding: 0.5em; padding: 0em;
} }
dt { dt {
float: left; float: left;
clear: left; clear: left;
width: 100px;
font-weight: bold; font-weight: bold;
} }
dd { dd {
margin: 0 0 0 110px; margin: 0 0 0 83px;
padding: 0 0 0.5em 0; padding: 0 0 0.5em 0;
} }
} }
.history-item:nth-child(odd) { .history-item:nth-child(odd) {
background-color: #efefef; background-color: #efefef;
} }
.history-item {
padding: 5px;
}