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