提交 224cd9e3 编写于 作者: H huanghaiquan

Merge branch 'master' into develop

* master:
  upgraded version to 1.4.1.RELEASE;
  transactionSource
  event latest transactionSource
  eventAccount latest
  event
  event lastest value
  dataAccount nil

# Conflicts:
#	data-explorer/pom.xml
#	manager-explorer/pom.xml
#	pom.xml
......@@ -3,11 +3,11 @@ import { findDOMNode } from 'react-dom';
import { observable, computed, toJS } from 'mobx';
import { observer, inject } from 'mobx-react';
import nj from 'nornj';
import { Drawer} from 'antd';
import { Drawer } from 'antd';
import { registerTmpl } from 'nornj-react';
import { autobind } from 'core-decorators';
import JSONTree from 'react-json-tree';
import {utf8ToString} from '../../../utils/util';
import { utf8ToString } from '../../../utils/util';
import TransactionInfo from '../transactionInfo';
import AccountRootHash from '../../components/accountRootHash';
import 'flarej/lib/components/antd/table';
......@@ -40,44 +40,44 @@ const theme = {
@observer
export default class AccountInfo extends Component {
@observable kvData=[];
@observable accountcount=0;
@observable accountcurrent=1;
@observable pageSize=10;
@observable visible=false;
@observable valueinfo='';
@observable valueinfotype='BYTES';
@observable jsondata ='';
@observable kvData = [];
@observable accountcount = 0;
@observable accountcurrent = 1;
@observable pageSize = 10;
@observable visible = false;
@observable valueinfo = '';
@observable valueinfotype = 'BYTES';
@observable jsondata = '';
componentDidMount() {
this.Search();
}
Search(){
const { store: { account },accountData} = this.props;
if (accountData&&accountData.address&&accountData.address.value) {
Search() {
const { store: { account }, accountData } = this.props;
if (accountData && accountData.address && accountData.address.value) {
const closeLoading = Message.loading('正在获取数据...', 0);
let leader=this.props.store.common.getDefaultLedger(),
param={
fromIndex:(this.accountcurrent-1)*this.pageSize,
count:this.pageSize,
},
address=accountData.address.value;
let leader = this.props.store.common.getDefaultLedger(),
param = {
fromIndex: (this.accountcurrent - 1) * this.pageSize,
count: this.pageSize,
},
address = accountData.address.value;
Promise.all([
account.getEntriescount(leader,address)
account.getEntriescount(leader, address)
]).then((data) => {
if(data[0]>0){
this.accountcount=data[0];
Promise.all([ account.getEntries(leader,address,
param
if (data[0] > 0) {
this.accountcount = data[0];
Promise.all([account.getEntries(leader, address,
param
),
]).then((data) => {
this.kvData=data[0];
]).then((data) => {
this.kvData = data[0];
closeLoading();
});
}
else {
closeLoading();
});
}
else{
closeLoading();
}
}
});
}
}
......@@ -85,20 +85,20 @@ export default class AccountInfo extends Component {
@autobind
onPageChange(page, pageSize) {
const { store: { account } } = this.props;
this.accountcurrent=page;
this.accountcurrent = page;
this.Search();
}
// 关闭详细信息
@autobind
onClose(visible){
this.show=visible;
onClose(visible) {
this.show = visible;
}
// 跳转到前置区块
@autobind
goBlock(e){
const {goPrev}= this.props;
goBlock(e) {
const { goPrev } = this.props;
if (goPrev) {
goPrev(e.target.innerText);
}
......@@ -107,21 +107,21 @@ export default class AccountInfo extends Component {
isJsonString(str) {
try {
if (typeof JSON.parse(str) == "object") {
return true;
return true;
}
} catch(e) {
} catch (e) {
}
return false;
}
Jsontree=()=>{
Jsontree = () => {
if (this.isJsonString(this.jsondata)) {
return <JSONTree theme={theme}
return <JSONTree theme={theme}
data={JSON.parse(this.jsondata)}
/>
/>
}
else{
return <JSONTree theme={theme}
else {
return <JSONTree theme={theme}
data={this.jsondata}
/>
}
......@@ -130,70 +130,78 @@ export default class AccountInfo extends Component {
// 查看详细信息
@autobind
onShowBlockDetails(text,record){
onShowBlockDetails(text, record) {
this.onCloseblockDetails();
if(record.type.toUpperCase()=='BYTES'){
this.valueinfo=utf8ToString(text);
this.valueinfotype='BYTES';
if (record.type.toUpperCase() == 'BYTES') {
this.valueinfo = utf8ToString(text);
this.valueinfotype = 'BYTES';
}
else if(record.type.toUpperCase()=='JSON'){
this.valueinfotype='JSON';
else if (record.type.toUpperCase() == 'JSON') {
this.valueinfotype = 'JSON';
this.jsondata = text;
}
else{
this.valueinfotype='other';
this.valueinfo=text;
}
else {
this.valueinfotype = 'other';
this.valueinfo = text;
}
}
// 关闭
@autobind
onCloseblockDetails(){
this.visible=!this.visible;
}
//字符串限制长度
strOfLength(str,l){
if(str.length>l){
return str.substring(0,l)+"...";
// 关闭
@autobind
onCloseblockDetails() {
this.visible = !this.visible;
}
else{
return str;
//字符串限制长度
strOfLength(str, l) {
console.log(str, l)
if (str.length > l) {
return str.substring(0, l) + "...";
}
else {
return str;
}
}
}
// 交易列表
@computed get tableColumns() {
return [{
title: '',
dataIndex: 'key',
key:'key'
},{
key: 'key'
}, {
title: '',
dataIndex: 'value',
key:'value',
render: (text, record, index) => nj `
${this.strOfLength(text,50)}&nbsp;&nbsp;&nbsp;
<a onClick=${()=>this.onShowBlockDetails(text,record)}>详细</a>
`()
key: 'value',
// render: (text, record, index) => nj`
// ${this.strOfLength(text || '', 50)}&nbsp;&nbsp;&nbsp;
// <a onClick=${() => this.onShowBlockDetails(text, record)}>详细</a>
// `()
render: (text, record, index) => (
<div>
{this.strOfLength(text || '', 50)}&nbsp;&nbsp;&nbsp;
{text && (<a onClick={() => this.onShowBlockDetails(text, record)}>详细</a>) || null}
</div>
)
}, {
title: '版本',
dataIndex: 'version',
width:'10%',
width: '10%',
key: 'version',
},{
}, {
title: '类型',
dataIndex: 'type',
width:'10%',
width: '10%',
key: 'type',
}];
}
render() {
const { store: { block },accountData } = this.props;
const { store: { block }, accountData } = this.props;
return tmpls.container({
components: {
'ant-Drawer': Drawer,
JSONTree
}},this.props, this, {
}
}, this.props, this, {
styles,
block,
accountData
......
......@@ -34,4 +34,9 @@
color: #374159;
line-height: 20px;
margin: 40px 0 24px 0;
}
.pointer {
cursor: pointer;
color: #1890ff;
}
\ No newline at end of file
......@@ -38,7 +38,7 @@ export default class Event extends Component {
onInputChange = e => {
this.eventAddress = e.target.value;
}
}
componentDidMount() {
const { store: { header } } = this.props;
......@@ -48,7 +48,7 @@ export default class Event extends Component {
eventItem = () => {
this.click++;
return <EventInfo data = {this.accountData} key = {this.click}/>
return <EventInfo data={this.accountData} key={this.click} />
}
......@@ -60,7 +60,7 @@ export default class Event extends Component {
fromIndex: (event.accountcurrent - 1) * this.pageSize,
count: this.pageSize,
};
Promise.all([
event.getAccountCount(leaders)
]).then(() => {
......@@ -96,18 +96,18 @@ export default class Event extends Component {
};
Promise.all([
event.getEventCount(common.getDefaultLedger(), address)
event.getEventCount(common.getDefaultLedger(), address)
]).then(() => {
if (event.eventTotal > 0) {
Promise.all([
event.getEventData(common.getDefaultLedger(), address, param)
]).then(() => {
closeLoading();
this.accountData = record;
Promise.all([
event.getEventData(common.getDefaultLedger(), address, param)
]).then(() => {
closeLoading();
this.accountData = record;
this.show = !this.show;
});
this.show = !this.show;
});
} else if (event.eventTotal == 0) {
closeLoading();
this.accountData = record;
......@@ -118,11 +118,11 @@ export default class Event extends Component {
// duration: 3
// })
} else {
closeLoading();
closeLoading();
}
})
}
onShow = () => {
......@@ -150,7 +150,7 @@ export default class Event extends Component {
}, {
title: '操作',
render: (text, record, index) => nj`
<a onClick=${() => this.showEvent(record, index)}>查看</a>
<a onClick=${() => this.showEvent(record, index)}>查看</a>
`()
}]
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册