import React from 'react';
-import {Icon, Table, Menu, Message, Button} from 'semantic-ui-react'
+import {Icon, Table, Label, Message, Button} from 'semantic-ui-react'
import Pagination from 'util/pagination/index.jsx'
import './index.css';
+function Bubble(props) {
+
+ if (props.num <= 0) {
+ return null;
+ }
+ let className = props.name + 'IconClassName';
+ return (
+ <Label circular size="mini" className={"mini-label " + className}>
+ {props.num}
+ </Label>
+ );
+}
+
// general basic table
class BasicTable extends React.Component {
constructor(props) {
}
}
- onPageNumChange(current){
+
+
+ onPageNumChange(current) {
this.setState({
- currentPage : current
+ currentPage: current
}, () => {
this.props.loadfunc(current);
});
let branch = record.pg_info.pg_branch;
let trend = record.trend
+ let improvedIconClassName = trend.improved > 0 ? 'improved' : 'anonymous'
+ let quoIconClassName = trend.quo > 0 ? 'quo' : 'anonymous'
+ let regressiveIconClassName = trend.regressive > 0 ? 'regressive' : 'anonymous'
return (
<Table.Row key={index}>
{/*trending-data*/}
<Table.Cell textAlign='center'>
- <Icon color='green' name='checkmark' size='large'/>{trend.improved}
+ <Icon className={"bgc-clear " + improvedIconClassName} name='smile outline' size='large'/>
+ <Bubble num={trend.improved} name="improved"/>
</Table.Cell>
<Table.Cell textAlign='center'>
- <Icon color='green' name='meh' size='large'/>{trend.quo}
+ <Icon className={"bgc-clear " + quoIconClassName} name='meh outline' size='large'/>
+ <Bubble num={trend.quo} name="quo"/>
</Table.Cell>
<Table.Cell textAlign='center'>
- <i className="fa fa-meh-o"></i>{trend.regressive}
+ <Icon className={"bgc-clear " + regressiveIconClassName} name='frown outline'
+ size='large'/>
+ <Bubble num={trend.regressive} name="regressive"/>
</Table.Cell>
<Table.Cell textAlign='center'>
- <a href={'detail/' + record.uuid}>
- <Button size='mini' color='linkedin'>
- <Icon name='linkify' /> Link
- </Button>
+ <a color='linkedin' href={'detailInfo/' + record.uuid}>
+ {/*<Button size='mini' color='linkedin'>*/}
+ <Icon name='linkify'/> Link
+ {/*</Button>*/}
</a>
</Table.Cell>
{/*date*/}
- <Table.Cell>{new Date().toDateString()}</Table.Cell>
+ <Table.Cell>{record.add_time}</Table.Cell>
</Table.Row>
);
});
<Table.Row>
<Table.HeaderCell colSpan='10'>
{/*<Menu size='small' floated='right' pagination>*/}
- {/*<Menu.Item as='a' icon>*/}
- {/*<Icon name='chevron left'/>*/}
- {/*</Menu.Item>*/}
- {/*<Menu.Item as='a'>1</Menu.Item>*/}
- {/*<Menu.Item as='a'>2</Menu.Item>*/}
- {/*<Menu.Item as='a'>3</Menu.Item>*/}
- {/*<Menu.Item as='a'>4</Menu.Item>*/}
- {/*<Menu.Item as='a' icon>*/}
- {/*<Icon name='chevron right'/>*/}
- {/*</Menu.Item>*/}
+ {/*<Menu.Item as='a' icon>*/}
+ {/*<Icon name='chevron left'/>*/}
+ {/*</Menu.Item>*/}
+ {/*<Menu.Item as='a'>1</Menu.Item>*/}
+ {/*<Menu.Item as='a'>2</Menu.Item>*/}
+ {/*<Menu.Item as='a'>3</Menu.Item>*/}
+ {/*<Menu.Item as='a'>4</Menu.Item>*/}
+ {/*<Menu.Item as='a' icon>*/}
+ {/*<Icon name='chevron right'/>*/}
+ {/*</Menu.Item>*/}
{/*</Menu>*/}
- <Pagination style={style} onChange={(current) => this.onPageNumChange(current)} pageSize={2} current={this.state.currentPage} total={this.props.total}/>
+ <Pagination style={style} onChange={(current) => this.onPageNumChange(current)} pageSize={2}
+ current={this.state.currentPage} total={this.props.total}/>
</Table.HeaderCell>
);
}
+
+
}
export default BasicTable;
\ No newline at end of file
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
+import django_filters
import shortuuid
from django.contrib.auth.hashers import make_password
from rest_framework.pagination import PageNumberPagination
from exception import TestDataUploadError
+from filters import TestRecordListFilter
from models import UserMachine, TestCategory
from pgperffarm.settings import DB_ENUM
from .serializer import TestRecordListSerializer, TestRecordDetailSerializer, LinuxInfoSerializer, MetaInfoSerializer, \
queryset = TestRecord.objects.all().order_by('add_time')
serializer_class = TestRecordListSerializer
pagination_class = StandardResultsSetPagination
-
+ filter_backends = (django_filters.rest_framework.DjangoFilterBackend,)
+ filter_class = TestRecordListFilter
class TestRecordDetailViewSet(mixins.RetrieveModelMixin, viewsets.GenericViewSet):
"""